1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * wm_hubs.h  --  WM899x common code
4  *
5  * Copyright 2009 Wolfson Microelectronics plc
6  *
7  * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
8  */
9 
10 #ifndef _WM_HUBS_H
11 #define _WM_HUBS_H
12 
13 #include <linux/completion.h>
14 #include <linux/interrupt.h>
15 #include <linux/list.h>
16 #include <sound/control.h>
17 
18 struct snd_soc_component;
19 
20 extern const unsigned int wm_hubs_spkmix_tlv[];
21 
22 /* This *must* be the first element of the codec->private_data struct */
23 struct wm_hubs_data {
24 	int dcs_codes_l;
25 	int dcs_codes_r;
26 	int dcs_readback_mode;
27 	int hp_startup_mode;
28 	int series_startup;
29 	int no_series_update;
30 	bool micd_scthr;
31 
32 	bool no_cache_dac_hp_direct;
33 	struct list_head dcs_cache;
34 	bool (*check_class_w_digital)(struct snd_soc_component *);
35 
36 	int micb1_delay;
37 	int micb2_delay;
38 
39 	bool lineout1_se;
40 	bool lineout1n_ena;
41 	bool lineout1p_ena;
42 
43 	bool lineout2_se;
44 	bool lineout2n_ena;
45 	bool lineout2p_ena;
46 
47 	bool dcs_done_irq;
48 	struct completion dcs_done;
49 
50 	struct snd_soc_component *component;
51 };
52 
53 extern int wm_hubs_add_analogue_controls(struct snd_soc_component *);
54 extern int wm_hubs_add_analogue_routes(struct snd_soc_component *, int, int);
55 extern int wm_hubs_handle_analogue_pdata(struct snd_soc_component *,
56 					 int lineout1_diff, int lineout2_diff,
57 					 int lineout1fb, int lineout2fb,
58 					 int jd_scthr, int jd_thr,
59 					 int micbias1_delay, int micbias2_delay,
60 					 int micbias1_lvl, int micbias2_lvl);
61 
62 extern irqreturn_t wm_hubs_dcs_done(int irq, void *data);
63 extern void wm_hubs_vmid_ena(struct snd_soc_component *component);
64 extern void wm_hubs_set_bias_level(struct snd_soc_component *component,
65 				   enum snd_soc_bias_level level);
66 extern void wm_hubs_update_class_w(struct snd_soc_component *component);
67 
68 extern const struct snd_kcontrol_new wm_hubs_hpl_mux;
69 extern const struct snd_kcontrol_new wm_hubs_hpr_mux;
70 
71 #endif
72