Skip to content

Commit 98fda42

Browse files
committed
ASoC: cs42l42: Add SoundWire support
Merge series from Stefan Binding <[email protected]>: The CS42L42 has a SoundWire interface for control and audio. This chain of patches adds support for this. Patches #1 .. #5 split out various changes to the existing code that are needed for adding Soundwire. These are mostly around clocking and supporting the separate probe and enumeration stages in SoundWire. Patches #6 .. #8 actually adds the SoundWire handling.
2 parents 6570bef + 16838bf commit 98fda42

File tree

8 files changed

+729
-50
lines changed

8 files changed

+729
-50
lines changed

drivers/soundwire/stream.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
469469
}
470470

471471
/* Inform slave about the impending port prepare */
472-
sdw_do_port_prep(s_rt, prep_ch, SDW_OPS_PORT_PRE_PREP);
472+
sdw_do_port_prep(s_rt, prep_ch, prep ? SDW_OPS_PORT_PRE_PREP : SDW_OPS_PORT_PRE_DEPREP);
473473

474474
/* Prepare Slave port implementing CP_SM */
475475
if (!dpn_prop->simple_ch_prep_sm) {
@@ -501,7 +501,7 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
501501
}
502502

503503
/* Inform slaves about ports prepared */
504-
sdw_do_port_prep(s_rt, prep_ch, SDW_OPS_PORT_POST_PREP);
504+
sdw_do_port_prep(s_rt, prep_ch, prep ? SDW_OPS_PORT_POST_PREP : SDW_OPS_PORT_POST_DEPREP);
505505

506506
/* Disable interrupt after Port de-prepare */
507507
if (!prep && intr)

include/linux/soundwire/sdw.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -566,13 +566,15 @@ struct sdw_prepare_ch {
566566
* enum sdw_port_prep_ops: Prepare operations for Data Port
567567
*
568568
* @SDW_OPS_PORT_PRE_PREP: Pre prepare operation for the Port
569-
* @SDW_OPS_PORT_PREP: Prepare operation for the Port
569+
* @SDW_OPS_PORT_PRE_DEPREP: Pre deprepare operation for the Port
570570
* @SDW_OPS_PORT_POST_PREP: Post prepare operation for the Port
571+
* @SDW_OPS_PORT_POST_DEPREP: Post deprepare operation for the Port
571572
*/
572573
enum sdw_port_prep_ops {
573574
SDW_OPS_PORT_PRE_PREP = 0,
574-
SDW_OPS_PORT_PREP = 1,
575-
SDW_OPS_PORT_POST_PREP = 2,
575+
SDW_OPS_PORT_PRE_DEPREP,
576+
SDW_OPS_PORT_POST_PREP,
577+
SDW_OPS_PORT_POST_DEPREP,
576578
};
577579

578580
/**

include/sound/cs42l42.h

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define CS42L42_PAGE_24 0x2400
3535
#define CS42L42_PAGE_25 0x2500
3636
#define CS42L42_PAGE_26 0x2600
37+
#define CS42L42_PAGE_27 0x2700
3738
#define CS42L42_PAGE_28 0x2800
3839
#define CS42L42_PAGE_29 0x2900
3940
#define CS42L42_PAGE_2A 0x2A00
@@ -720,6 +721,10 @@
720721

721722
#define CS42L42_SRC_SDOUT_FS (CS42L42_PAGE_26 + 0x09)
722723

724+
/* Page 0x27 DMA */
725+
#define CS42L42_SOFT_RESET_REBOOT (CS42L42_PAGE_27 + 0x01)
726+
#define CS42L42_SFT_RST_REBOOT_MASK BIT(1)
727+
723728
/* Page 0x28 S/PDIF Registers */
724729
#define CS42L42_SPDIF_CTL1 (CS42L42_PAGE_28 + 0x01)
725730
#define CS42L42_SPDIF_CTL2 (CS42L42_PAGE_28 + 0x02)

sound/soc/codecs/Kconfig

+8
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ config SND_SOC_ALL_CODECS
6969
imply SND_SOC_CS35L45_I2C
7070
imply SND_SOC_CS35L45_SPI
7171
imply SND_SOC_CS42L42
72+
imply SND_SOC_CS42L42_SDW
7273
imply SND_SOC_CS42L51_I2C
7374
imply SND_SOC_CS42L52
7475
imply SND_SOC_CS42L56
@@ -722,6 +723,13 @@ config SND_SOC_CS42L42
722723
select REGMAP_I2C
723724
select SND_SOC_CS42L42_CORE
724725

726+
config SND_SOC_CS42L42_SDW
727+
tristate "Cirrus Logic CS42L42 CODEC on Soundwire"
728+
depends on SOUNDWIRE
729+
select SND_SOC_CS42L42_CORE
730+
help
731+
Enable support for Cirrus Logic CS42L42 codec with Soundwire control
732+
725733
config SND_SOC_CS42L51
726734
tristate
727735

sound/soc/codecs/Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ snd-soc-cs35l45-spi-objs := cs35l45-spi.o
6969
snd-soc-cs35l45-i2c-objs := cs35l45-i2c.o
7070
snd-soc-cs42l42-objs := cs42l42.o
7171
snd-soc-cs42l42-i2c-objs := cs42l42-i2c.o
72+
snd-soc-cs42l42-sdw-objs := cs42l42-sdw.o
7273
snd-soc-cs42l51-objs := cs42l51.o
7374
snd-soc-cs42l51-i2c-objs := cs42l51-i2c.o
7475
snd-soc-cs42l52-objs := cs42l52.o
@@ -434,6 +435,7 @@ obj-$(CONFIG_SND_SOC_CS35L45_SPI) += snd-soc-cs35l45-spi.o
434435
obj-$(CONFIG_SND_SOC_CS35L45_I2C) += snd-soc-cs35l45-i2c.o
435436
obj-$(CONFIG_SND_SOC_CS42L42_CORE) += snd-soc-cs42l42.o
436437
obj-$(CONFIG_SND_SOC_CS42L42) += snd-soc-cs42l42-i2c.o
438+
obj-$(CONFIG_SND_SOC_CS42L42_SDW) += snd-soc-cs42l42-sdw.o
437439
obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o
438440
obj-$(CONFIG_SND_SOC_CS42L51_I2C) += snd-soc-cs42l51-i2c.o
439441
obj-$(CONFIG_SND_SOC_CS42L52) += snd-soc-cs42l52.o

0 commit comments

Comments
 (0)