Asish Bhattacharya | 8e2277f | 2017-07-20 18:31:55 +0530 | [diff] [blame] | 1 | /* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | #ifndef __WCD_MBHC_V2_API_H__ |
| 13 | #define __WCD_MBHC_V2_API_H__ |
| 14 | |
| 15 | #include "wcd-mbhc-v2.h" |
| 16 | |
| 17 | #if IS_ENABLED(CONFIG_SND_SOC_WCD_MBHC) |
| 18 | int wcd_mbhc_start(struct wcd_mbhc *mbhc, |
| 19 | struct wcd_mbhc_config *mbhc_cfg); |
| 20 | void wcd_mbhc_stop(struct wcd_mbhc *mbhc); |
| 21 | int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, |
| 22 | const struct wcd_mbhc_cb *mbhc_cb, |
| 23 | const struct wcd_mbhc_intr *mbhc_cdc_intr_ids, |
| 24 | struct wcd_mbhc_register *wcd_mbhc_regs, |
| 25 | bool impedance_det_en); |
| 26 | int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl, |
| 27 | uint32_t *zr); |
| 28 | void wcd_mbhc_deinit(struct wcd_mbhc *mbhc); |
| 29 | |
| 30 | #else |
| 31 | static inline void wcd_mbhc_stop(struct wcd_mbhc *mbhc) |
| 32 | { |
| 33 | } |
| 34 | int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, |
| 35 | const struct wcd_mbhc_cb *mbhc_cb, |
| 36 | const struct wcd_mbhc_intr *mbhc_cdc_intr_ids, |
| 37 | struct wcd_mbhc_register *wcd_mbhc_regs, |
| 38 | bool impedance_det_en) |
| 39 | { |
| 40 | return 0; |
| 41 | } |
| 42 | static inline int wcd_mbhc_start(struct wcd_mbhc *mbhc, |
| 43 | struct wcd_mbhc_config *mbhc_cfg) |
| 44 | { |
| 45 | return 0; |
| 46 | } |
| 47 | static inline int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, |
| 48 | uint32_t *zl, |
| 49 | uint32_t *zr) |
| 50 | { |
| 51 | *zl = 0; |
| 52 | *zr = 0; |
| 53 | return -EINVAL; |
| 54 | } |
| 55 | static inline void wcd_mbhc_deinit(struct wcd_mbhc *mbhc) |
| 56 | { |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | #endif /* __WCD_MBHC_V2_API_H__ */ |