xref: /openbmc/linux/sound/soc/codecs/cs42l42.h (revision b48d1da00fc8f32f7f75b8a34eb484f08b39ffaa)
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 
15*b48d1da0SRichard Fitzgerald #include <dt-bindings/sound/cs42l42.h>
16*b48d1da0SRichard Fitzgerald #include <linux/device.h>
17*b48d1da0SRichard Fitzgerald #include <linux/gpio.h>
18fdd53528SRichard Fitzgerald #include <linux/mutex.h>
19*b48d1da0SRichard Fitzgerald #include <linux/regmap.h>
20*b48d1da0SRichard Fitzgerald #include <linux/regulator/consumer.h>
21c5b8ee08SLucas Tanure #include <sound/jack.h>
227b43e6d7SStefan Binding #include <sound/cs42l42.h>
232c394ca7SJames Schulman 
242c394ca7SJames Schulman static const char *const cs42l42_supply_names[CS42L42_NUM_SUPPLIES] = {
252c394ca7SJames Schulman 	"VA",
262c394ca7SJames Schulman 	"VP",
272c394ca7SJames Schulman 	"VCP",
282c394ca7SJames Schulman 	"VD_FILT",
292c394ca7SJames Schulman 	"VL",
302c394ca7SJames Schulman };
312c394ca7SJames Schulman 
322c394ca7SJames Schulman struct  cs42l42_private {
332c394ca7SJames Schulman 	struct regmap *regmap;
342003c44eSRichard Fitzgerald 	struct device *dev;
352c394ca7SJames Schulman 	struct regulator_bulk_data supplies[CS42L42_NUM_SUPPLIES];
362c394ca7SJames Schulman 	struct gpio_desc *reset_gpio;
372c394ca7SJames Schulman 	struct completion pdn_done;
38c26a5289SLucas Tanure 	struct snd_soc_jack *jack;
395982b5a8SRichard Fitzgerald 	struct mutex irq_lock;
40f1040e86SRichard Fitzgerald 	int pll_config;
412cdba9b0SLucas Tanure 	int bclk;
422c394ca7SJames Schulman 	u32 sclk;
432c394ca7SJames Schulman 	u32 srate;
442c394ca7SJames Schulman 	u8 plug_state;
452c394ca7SJames Schulman 	u8 hs_type;
462c394ca7SJames Schulman 	u8 ts_inv;
472c394ca7SJames Schulman 	u8 ts_dbnc_rise;
482c394ca7SJames Schulman 	u8 ts_dbnc_fall;
492c394ca7SJames Schulman 	u8 btn_det_init_dbnce;
502c394ca7SJames Schulman 	u8 btn_det_event_dbnce;
512c394ca7SJames Schulman 	u8 bias_thresholds[CS42L42_NUM_BIASES];
522c394ca7SJames Schulman 	u8 hs_bias_ramp_rate;
532c394ca7SJames Schulman 	u8 hs_bias_ramp_time;
54c9f2e3c3SVitaly Rodionov 	u8 hs_bias_sense_en;
5543fc3571SLucas Tanure 	u8 stream_use;
564ae1d8f9SRichard Fitzgerald 	bool hp_adc_up_pending;
57f8593e88SRichard Fitzgerald 	bool suspended;
582c394ca7SJames Schulman };
592c394ca7SJames Schulman 
602c394ca7SJames Schulman #endif /* __CS42L42_H__ */
61