Skip to content

Commit 85d12ed

Browse files
committed
ALSA: hda: Adding support for CS35L56 on HDA
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: This set of patches adds support for using the CS35L56 boosted smart amplifier on HDA systems. In these systems the CS35L56 audio is routed through a HDA-to-I2S bridge codec. This doesn't include the changes to the Realtek driver to actually hook up the CS35L56 driver, because we don't yet have the QUIRK IDs to associate it with. But we want to publish the driver now so that it is available for bringing up hardware with the CS35L56. The first 9 patches are moving code out of the ASoC driver and into the shared library so that it can be shared with the HDA driver. Patch #10 fixes missing #includes in the HDA headers so that the CS35L56 driver doesn't have to #include headers that it doesn't use.
2 parents f54e347 + 73cfbfa commit 85d12ed

File tree

15 files changed

+1877
-591
lines changed

15 files changed

+1877
-591
lines changed

include/sound/cs35l56.h

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,40 @@
252252
#define CS35L56_NUM_BULK_SUPPLIES 3
253253
#define CS35L56_NUM_DSP_REGIONS 5
254254

255+
struct cs35l56_base {
256+
struct device *dev;
257+
struct regmap *regmap;
258+
int irq;
259+
struct mutex irq_lock;
260+
u8 rev;
261+
bool init_done;
262+
bool fw_patched;
263+
bool secured;
264+
bool can_hibernate;
265+
struct gpio_desc *reset_gpio;
266+
};
267+
255268
extern struct regmap_config cs35l56_regmap_i2c;
256269
extern struct regmap_config cs35l56_regmap_spi;
257270
extern struct regmap_config cs35l56_regmap_sdw;
258271

259-
extern const struct cs_dsp_region cs35l56_dsp1_regions[CS35L56_NUM_DSP_REGIONS];
260272
extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];
261273
extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];
262274

263-
int cs35l56_set_patch(struct regmap *regmap);
275+
int cs35l56_set_patch(struct cs35l56_base *cs35l56_base);
276+
int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command);
277+
int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base);
278+
int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base);
279+
void cs35l56_wait_control_port_ready(void);
280+
void cs35l56_wait_min_reset_pulse(void);
281+
void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_soundwire);
282+
int cs35l56_irq_request(struct cs35l56_base *cs35l56_base, int irq);
283+
irqreturn_t cs35l56_irq(int irq, void *data);
284+
int cs35l56_is_fw_reload_needed(struct cs35l56_base *cs35l56_base);
285+
int cs35l56_runtime_suspend_common(struct cs35l56_base *cs35l56_base);
286+
int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_soundwire);
287+
void cs35l56_init_cs_dsp(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp);
288+
int cs35l56_hw_init(struct cs35l56_base *cs35l56_base);
264289
int cs35l56_get_bclk_freq_id(unsigned int freq);
265290
void cs35l56_fill_supply_names(struct regulator_bulk_data *data);
266291

sound/pci/hda/Kconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,37 @@ config SND_HDA_SCODEC_CS35L41_SPI
130130
comment "Set to Y if you want auto-loading the side codec driver"
131131
depends on SND_HDA=y && SND_HDA_SCODEC_CS35L41_SPI=m
132132

133+
config SND_HDA_SCODEC_CS35L56
134+
tristate
135+
136+
config SND_HDA_SCODEC_CS35L56_I2C
137+
tristate "Build CS35L56 HD-audio side codec support for I2C Bus"
138+
depends on I2C
139+
depends on ACPI || COMPILE_TEST
140+
depends on SND_SOC
141+
select CS_DSP
142+
select SND_HDA_GENERIC
143+
select SND_SOC_CS35L56_SHARED
144+
select SND_HDA_SCODEC_CS35L56
145+
select SND_HDA_CS_DSP_CONTROLS
146+
help
147+
Say Y or M here to include CS35L56 amplifier support with
148+
I2C control.
149+
150+
config SND_HDA_SCODEC_CS35L56_SPI
151+
tristate "Build CS35L56 HD-audio side codec support for SPI Bus"
152+
depends on SPI_MASTER
153+
depends on ACPI || COMPILE_TEST
154+
depends on SND_SOC
155+
select CS_DSP
156+
select SND_HDA_GENERIC
157+
select SND_SOC_CS35L56_SHARED
158+
select SND_HDA_SCODEC_CS35L56
159+
select SND_HDA_CS_DSP_CONTROLS
160+
help
161+
Say Y or M here to include CS35L56 amplifier support with
162+
SPI control.
163+
133164
config SND_HDA_CODEC_REALTEK
134165
tristate "Build Realtek HD-audio codec support"
135166
select SND_HDA_GENERIC

sound/pci/hda/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o
3131
snd-hda-scodec-cs35l41-objs := cs35l41_hda.o
3232
snd-hda-scodec-cs35l41-i2c-objs := cs35l41_hda_i2c.o
3333
snd-hda-scodec-cs35l41-spi-objs := cs35l41_hda_spi.o
34+
snd-hda-scodec-cs35l56-objs := cs35l56_hda.o
35+
snd-hda-scodec-cs35l56-i2c-objs := cs35l56_hda_i2c.o
36+
snd-hda-scodec-cs35l56-spi-objs := cs35l56_hda_spi.o
3437
snd-hda-cs-dsp-ctls-objs := hda_cs_dsp_ctl.o
3538

3639
# common driver
@@ -55,6 +58,9 @@ obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o
5558
obj-$(CONFIG_SND_HDA_SCODEC_CS35L41) += snd-hda-scodec-cs35l41.o
5659
obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_I2C) += snd-hda-scodec-cs35l41-i2c.o
5760
obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_SPI) += snd-hda-scodec-cs35l41-spi.o
61+
obj-$(CONFIG_SND_HDA_SCODEC_CS35L56) += snd-hda-scodec-cs35l56.o
62+
obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_I2C) += snd-hda-scodec-cs35l56-i2c.o
63+
obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_SPI) += snd-hda-scodec-cs35l56-spi.o
5864
obj-$(CONFIG_SND_HDA_CS_DSP_CONTROLS) += snd-hda-cs-dsp-ctls.o
5965

6066
# this must be the last entry after codec drivers;

0 commit comments

Comments
 (0)