blob: 7b6e94507ad06ae6dfa7c21e1e426b8b7da9484f [file] [log] [blame]
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05301/* 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)
18int wcd_mbhc_start(struct wcd_mbhc *mbhc,
19 struct wcd_mbhc_config *mbhc_cfg);
20void wcd_mbhc_stop(struct wcd_mbhc *mbhc);
21int 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);
26int wcd_mbhc_get_impedance(struct wcd_mbhc *mbhc, uint32_t *zl,
27 uint32_t *zr);
28void wcd_mbhc_deinit(struct wcd_mbhc *mbhc);
29
30#else
31static inline void wcd_mbhc_stop(struct wcd_mbhc *mbhc)
32{
33}
34int 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}
42static inline int wcd_mbhc_start(struct wcd_mbhc *mbhc,
43 struct wcd_mbhc_config *mbhc_cfg)
44{
45 return 0;
46}
47static 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}
55static inline void wcd_mbhc_deinit(struct wcd_mbhc *mbhc)
56{
57}
58#endif
59
60#endif /* __WCD_MBHC_V2_API_H__ */