xref: /linux/sound/soc/codecs/wm_hubs.h (revision 811c5494436789e7149487c06e0602b507ce274b)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2a2342ae3SMark Brown /*
3a2342ae3SMark Brown  * wm_hubs.h  --  WM899x common code
4a2342ae3SMark Brown  *
5a2342ae3SMark Brown  * Copyright 2009 Wolfson Microelectronics plc
6a2342ae3SMark Brown  *
7a2342ae3SMark Brown  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8a2342ae3SMark Brown  */
9a2342ae3SMark Brown 
10a2342ae3SMark Brown #ifndef _WM_HUBS_H
11a2342ae3SMark Brown #define _WM_HUBS_H
12a2342ae3SMark Brown 
13d96ca3cdSMark Brown #include <linux/completion.h>
14d96ca3cdSMark Brown #include <linux/interrupt.h>
1594aa733aSMark Brown #include <linux/list.h>
16c340304dSMark Brown #include <sound/control.h>
17d96ca3cdSMark Brown 
1800a6941cSKuninori Morimoto struct snd_soc_component;
19a2342ae3SMark Brown 
20a2342ae3SMark Brown extern const unsigned int wm_hubs_spkmix_tlv[];
21a2342ae3SMark Brown 
223ed7074cSMark Brown /* This *must* be the first element of the codec->private_data struct */
233ed7074cSMark Brown struct wm_hubs_data {
244537c4e7SMark Brown 	int dcs_codes_l;
254537c4e7SMark Brown 	int dcs_codes_r;
268437f700SMark Brown 	int dcs_readback_mode;
273ed7074cSMark Brown 	int hp_startup_mode;
28f9acf9feSMark Brown 	int series_startup;
29780b75b4SMark Brown 	int no_series_update;
30*811c5494SSylwester Nawrocki 	bool micd_scthr;
31fec6dd83SMark Brown 
32af31a227SMark Brown 	bool no_cache_dac_hp_direct;
3394aa733aSMark Brown 	struct list_head dcs_cache;
3400a6941cSKuninori Morimoto 	bool (*check_class_w_digital)(struct snd_soc_component *);
35d96ca3cdSMark Brown 
3602e79476SMark Brown 	int micb1_delay;
3702e79476SMark Brown 	int micb2_delay;
3802e79476SMark Brown 
395f2f3890SMark Brown 	bool lineout1_se;
405f2f3890SMark Brown 	bool lineout1n_ena;
415f2f3890SMark Brown 	bool lineout1p_ena;
425f2f3890SMark Brown 
435f2f3890SMark Brown 	bool lineout2_se;
445f2f3890SMark Brown 	bool lineout2n_ena;
455f2f3890SMark Brown 	bool lineout2p_ena;
465f2f3890SMark Brown 
47d96ca3cdSMark Brown 	bool dcs_done_irq;
48d96ca3cdSMark Brown 	struct completion dcs_done;
498cb8e83bSMark Brown 
5000a6941cSKuninori Morimoto 	struct snd_soc_component *component;
513ed7074cSMark Brown };
523ed7074cSMark Brown 
5300a6941cSKuninori Morimoto extern int wm_hubs_add_analogue_controls(struct snd_soc_component *);
5400a6941cSKuninori Morimoto extern int wm_hubs_add_analogue_routes(struct snd_soc_component *, int, int);
5500a6941cSKuninori Morimoto extern int wm_hubs_handle_analogue_pdata(struct snd_soc_component *,
56aa983d9dSMark Brown 					 int lineout1_diff, int lineout2_diff,
57aa983d9dSMark Brown 					 int lineout1fb, int lineout2fb,
58aa983d9dSMark Brown 					 int jd_scthr, int jd_thr,
5902e79476SMark Brown 					 int micbias1_dly, int micbias2_dly,
60aa983d9dSMark Brown 					 int micbias1_lvl, int micbias2_lvl);
61a2342ae3SMark Brown 
62d96ca3cdSMark Brown extern irqreturn_t wm_hubs_dcs_done(int irq, void *data);
6300a6941cSKuninori Morimoto extern void wm_hubs_vmid_ena(struct snd_soc_component *component);
6400a6941cSKuninori Morimoto extern void wm_hubs_set_bias_level(struct snd_soc_component *component,
655f2f3890SMark Brown 				   enum snd_soc_bias_level level);
6600a6941cSKuninori Morimoto extern void wm_hubs_update_class_w(struct snd_soc_component *component);
67c340304dSMark Brown 
68c340304dSMark Brown extern const struct snd_kcontrol_new wm_hubs_hpl_mux;
69c340304dSMark Brown extern const struct snd_kcontrol_new wm_hubs_hpr_mux;
70d96ca3cdSMark Brown 
71a2342ae3SMark Brown #endif
72