xref: /openbmc/linux/sound/soc/codecs/cs42l42.h (revision 0285042feda799edca63b35cea0cda32ed0c47c2)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
22c394ca7SJames Schulman /*
32c394ca7SJames Schulman  * cs42l42.h -- CS42L42 ALSA SoC audio driver header
42c394ca7SJames Schulman  *
57b43e6d7SStefan Binding  * Copyright 2016-2022 Cirrus Logic, Inc.
62c394ca7SJames Schulman  *
72c394ca7SJames Schulman  * Author: James Schulman <james.schulman@cirrus.com>
82c394ca7SJames Schulman  * Author: Brian Austin <brian.austin@cirrus.com>
92c394ca7SJames Schulman  * Author: Michael White <michael.white@cirrus.com>
102c394ca7SJames Schulman  */
112c394ca7SJames Schulman 
122c394ca7SJames Schulman #ifndef __CS42L42_H__
132c394ca7SJames Schulman #define __CS42L42_H__
142c394ca7SJames Schulman 
15b48d1da0SRichard Fitzgerald #include <dt-bindings/sound/cs42l42.h>
16b48d1da0SRichard Fitzgerald #include <linux/device.h>
17b48d1da0SRichard Fitzgerald #include <linux/gpio.h>
18fdd53528SRichard Fitzgerald #include <linux/mutex.h>
19b48d1da0SRichard Fitzgerald #include <linux/regmap.h>
20b48d1da0SRichard Fitzgerald #include <linux/regulator/consumer.h>
21c5b8ee08SLucas Tanure #include <sound/jack.h>
227b43e6d7SStefan Binding #include <sound/cs42l42.h>
232c394ca7SJames Schulman 
242c394ca7SJames Schulman struct  cs42l42_private {
252c394ca7SJames Schulman 	struct regmap *regmap;
262003c44eSRichard Fitzgerald 	struct device *dev;
272c394ca7SJames Schulman 	struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES];
282c394ca7SJames Schulman 	struct gpio_desc *reset_gpio;
292c394ca7SJames Schulman 	struct completion pdn_done;
30c26a5289SLucas Tanure 	struct snd_soc_jack *jack;
315982b5a8SRichard Fitzgerald 	struct mutex irq_lock;
32*0285042fSRichard Fitzgerald 	int irq;
33f1040e86SRichard Fitzgerald 	int pll_config;
342c394ca7SJames Schulman 	u32 sclk;
352c394ca7SJames Schulman 	u32 srate;
362c394ca7SJames Schulman 	u8 plug_state;
372c394ca7SJames Schulman 	u8 hs_type;
382c394ca7SJames Schulman 	u8 ts_inv;
392c394ca7SJames Schulman 	u8 ts_dbnc_rise;
402c394ca7SJames Schulman 	u8 ts_dbnc_fall;
412c394ca7SJames Schulman 	u8 btn_det_init_dbnce;
422c394ca7SJames Schulman 	u8 btn_det_event_dbnce;
432c394ca7SJames Schulman 	u8 bias_thresholds[CS42L42_NUM_BIASES];
442c394ca7SJames Schulman 	u8 hs_bias_ramp_rate;
452c394ca7SJames Schulman 	u8 hs_bias_ramp_time;
46c9f2e3c3SVitaly Rodionov 	u8 hs_bias_sense_en;
4743fc3571SLucas Tanure 	u8 stream_use;
484ae1d8f9SRichard Fitzgerald 	bool hp_adc_up_pending;
49f8593e88SRichard Fitzgerald 	bool suspended;
50*0285042fSRichard Fitzgerald 	bool init_done;
512c394ca7SJames Schulman };
522c394ca7SJames Schulman 
532c394ca7SJames Schulman #endif /* __CS42L42_H__ */
54