summaryrefstree
path: root/kernel/techpack/audio/asoc/codecs/aqt1000/aqt1000-mbhc.h
blob: 770472c32887ac695cac4dabbe1e85f2dbdee80a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved.
 */
#ifndef __AQT1000_MBHC_H__
#define __AQT1000_MBHC_H__
#include <asoc/wcd-mbhc-v2.h>

struct aqt1000_mbhc {
	struct wcd_mbhc wcd_mbhc;
	struct blocking_notifier_head notifier;
	struct aqt1000 *aqt;
	struct fw_info *fw_data;
	bool mbhc_started;
};

#if IS_ENABLED(CONFIG_SND_SOC_AQT1000)
extern int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
			   struct snd_soc_component *component,
			   struct fw_info *fw_data);
extern void aqt_mbhc_hs_detect_exit(struct snd_soc_component *component);
extern int aqt_mbhc_hs_detect(struct snd_soc_component *component,
				struct wcd_mbhc_config *mbhc_cfg);
extern void aqt_mbhc_deinit(struct snd_soc_component *component);
extern int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
				    struct snd_soc_component *component);
extern int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
				    uint32_t *zl, uint32_t *zr);
#else
static inline int aqt_mbhc_init(struct aqt1000_mbhc **mbhc,
				  struct snd_soc_component *component,
				  struct fw_info *fw_data)
{
	return 0;
}
static inline void aqt_mbhc_hs_detect_exit(struct snd_soc_component *component)
{
}
static inline int aqt_mbhc_hs_detect(struct snd_soc_component *component,
				       struct wcd_mbhc_config *mbhc_cfg)
{
		return 0;
}
static inline void aqt_mbhc_deinit(struct snd_soc_component *component)
{
}
static inline int aqt_mbhc_post_ssr_init(struct aqt1000_mbhc *mbhc,
					   struct snd_soc_component *component)
{
	return 0;
}

static inline int aqt_mbhc_get_impedance(struct aqt1000_mbhc *aqt_mbhc,
					   uint32_t *zl, uint32_t *zr)
{
	if (zl)
		*zl = 0;
	if (zr)
		*zr = 0;
	return -EINVAL;
}
#endif

#endif /* __AQT1000_MBHC_H__ */