xref: /openbmc/linux/sound/pci/hda/cs35l41_hda.h (revision cc19db8b)
1 /* SPDX-License-Identifier: GPL-2.0
2  *
3  * CS35L41 ALSA HDA audio driver
4  *
5  * Copyright 2021 Cirrus Logic, Inc.
6  *
7  * Author: Lucas Tanure <tanureal@opensource.cirrus.com>
8  */
9 
10 #ifndef __CS35L41_HDA_H__
11 #define __CS35L41_HDA_H__
12 
13 #include <linux/regulator/consumer.h>
14 #include <linux/gpio/consumer.h>
15 #include <linux/device.h>
16 #include <sound/cs35l41.h>
17 
18 enum cs35l41_hda_spk_pos {
19 	CS35l41_LEFT,
20 	CS35l41_RIGHT,
21 };
22 
23 enum cs35l41_hda_gpio_function {
24 	CS35L41_NOT_USED,
25 	CS35l41_VSPK_SWITCH,
26 	CS35L41_INTERRUPT,
27 	CS35l41_SYNC,
28 };
29 
30 struct cs35l41_hda_reg_sequence {
31 	const struct reg_sequence *probe;
32 	unsigned int num_probe;
33 	const struct reg_sequence *open;
34 	unsigned int num_open;
35 	const struct reg_sequence *prepare;
36 	unsigned int num_prepare;
37 	const struct reg_sequence *cleanup;
38 	unsigned int num_cleanup;
39 	const struct reg_sequence *close;
40 	unsigned int num_close;
41 };
42 
43 struct cs35l41_hda_hw_config {
44 	unsigned int spk_pos;
45 	unsigned int gpio1_func;
46 	unsigned int gpio2_func;
47 	int bst_ind;
48 	int bst_ipk;
49 	int bst_cap;
50 };
51 
52 struct cs35l41_hda {
53 	struct device *dev;
54 	struct regmap *regmap;
55 	struct gpio_desc *reset_gpio;
56 	const struct cs35l41_hda_reg_sequence *reg_seq;
57 
58 	int irq;
59 	int index;
60 
61 	/* Don't put the AMP in reset of VSPK can not be turned off */
62 	bool vspk_always_on;
63 };
64 
65 int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq,
66 		      struct regmap *regmap);
67 void cs35l41_hda_remove(struct device *dev);
68 
69 #endif /*__CS35L41_HDA_H__*/
70