ASoC: rt1320: Add RT1320 SDCA vendor-specific driver
Subsystems (3)
PATCH v2 1/1 ASoC: rt1320: Add RT1320 SDCA vendor-specific driver
From: Shuming Fan <[email protected]>
This is the initial amplifier driver for rt1320.
--- sound/soc/codecs/Kconfig | 7 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt1320-sdw.c | 2244 +++++++++++++++++++++++++++++++++ sound/soc/codecs/rt1320-sdw.h | 96 ++ 4 files changed, 2349 insertions(+) create mode 100644 sound/soc/codecs/rt1320-sdw.c create mode 100644 sound/soc/codecs/rt1320-sdw.h
sound/soc/codecs/Kconfig +7 -0
@@ -222,6 +222,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT1308_SDW imply SND_SOC_RT1316_SDW imply SND_SOC_RT1318_SDW + imply SND_SOC_RT1320_SDW imply SND_SOC_RT9120 imply SND_SOC_RTQ9128 imply SND_SOC_SDW_MOCKUP
@@ -1575,6 +1576,12 @@ config SND_SOC_RT1318_SDW depends on SOUNDWIRE select REGMAP_SOUNDWIRE +config SND_SOC_RT1320_SDW + tristate "Realtek RT1320 Codec - SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + select REGMAP_SOUNDWIRE_MBQ + config SND_SOC_RT5514 tristate depends on I2C
sound/soc/codecs/Makefile +2 -0
@@ -222,6 +222,7 @@ snd-soc-rt1308-y := rt1308.o snd-soc-rt1308-sdw-y := rt1308-sdw.o snd-soc-rt1316-sdw-y := rt1316-sdw.o snd-soc-rt1318-sdw-y := rt1318-sdw.o +snd-soc-rt1320-sdw-y := rt1320-sdw.o snd-soc-rt274-y := rt274.o snd-soc-rt286-y := rt286.o snd-soc-rt298-y := rt298.o
@@ -614,6 +615,7 @@ obj-$(CONFIG_SND_SOC_RT1308) += snd-soc-rt1308.o obj-$(CONFIG_SND_SOC_RT1308_SDW) += snd-soc-rt1308-sdw.o obj-$(CONFIG_SND_SOC_RT1316_SDW) += snd-soc-rt1316-sdw.o obj-$(CONFIG_SND_SOC_RT1318_SDW) += snd-soc-rt1318-sdw.o +obj-$(CONFIG_SND_SOC_RT1320_SDW) += snd-soc-rt1320-sdw.o obj-$(CONFIG_SND_SOC_RT274) += snd-soc-rt274.o obj-$(CONFIG_SND_SOC_RT286) += snd-soc-rt286.o obj-$(CONFIG_SND_SOC_RT298) += snd-soc-rt298.o
sound/soc/codecs/rt1320-sdw.c new file +2244 -0
2,244 lines not on this page · raw message
sound/soc/codecs/rt1320-sdw.h new file +96 -0
96 lines not on this page · raw message
Signature · 1 line
2.34.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mark Brown
maintainerQuoted 9 lines · Pierre-Louis Bossart
Quoted 2 lines
sound/soc/codecs/rt1320-sdw.c new file +2
-0+static const struct reg_sequence rt1320_blind_write[] = { + {0xc003 ,0xe0 },...
sound/soc/codecs/rt1320-sdw.c line 88
Quoted 2 lines
sound/soc/codecs/rt1320-sdw.c new file +2
-0+ { 0xd486, 0xc3 }, +};I would add a comment that the 'blind writes' is an SDCA term to deal with platform-specific initialization, but in this case it seems that all the addresses targeted are in the vendor-specific space
TBH it seems perfectly intelligable without knowing anything about SCDA.
Quoted 9 lines
Quoted 2 lines
sound/soc/codecs/rt1320-sdw.c new file +2
-0+static const struct reg_sequence rt1320_blind_write[] = { + {0xc003 ,0xe0 },...
sound/soc/codecs/rt1320-sdw.c line 88
Quoted 2 lines
sound/soc/codecs/rt1320-sdw.c new file +2
-0+ { 0xd486, 0xc3 }, +};I would add a comment that the 'blind writes' is an SDCA term to deal with platform-specific initialization, but in this case it seems that all the addresses targeted are in the vendor-specific space
Sure, will add a comment to describe what blind writes means.
Quoted 11 lines
Quoted 2 lines
sound/soc/codecs/rt1320-sdw.c new file +2
-0+static const struct reg_sequence rt1320_patch_code_write[] = { + {0x10007000 ,0x37 },...
Review
Quoted 2 lines
(quoted diff) +2
-0+ { 0x0000d540, 0x01 }, +};I would add a comment on the targeted register space. It seems to be the SDCA function 1, except for the last one?
Also possibly move the tables to a different file to make the driver code easier to get to (less scrolling required).
The driver will add a comment for the patch_code_write.
The setting of the last one notifies the patch code and blind writes are done. That is the handshake mechanism we shall set.
Quoted 4 lines
Quoted 4 lines
sound/soc/codecs/rt1320-sdw.c new file +4
-0+static int rt1320_read_prop (struct sdw_slave *slave) { +struct sdw_slave_prop *prop = &slave->prop; +int nval; +int i, j;
Quoted 8 lines
sound/soc/codecs/rt1320-sdw.c line 1602
Quoted 5 lines
sound/soc/codecs/rt1320-sdw.c new file +5
-0+u32 bit; +unsigned long addr; +struct sdw_dpn_prop *dpn; + +sdw_slave_read_prop (slave);add a comment that this is needed to fetch the lane information from platform firmware.
OK, will do.
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+static const struct sdw_device_id rt1320_id[] = { + SDW_SLAVE_ENTRY_EXT(0x025d, 0x1320, 0x3, 0x0, 0),\missing class ID 1?
Will add class ID 1.
Quoted 6 lines
sound/soc/codecs/rt1320-sdw.h line 59
Quoted 4 lines
sound/soc/codecs/rt1320-sdw.h new file +4
-0+ +/* Function_Status */ +#define FUNCTION_NEEDS_INITIALIZATION BIT(5) +#define FUNCTION_HAS_BEEN_RESET BIT(6)You seem to use only
NEEDS_INITIALIZATION, what happens on a RESET?
The RESET should influence the SDCA control.
The blind writes doesn't set the SDCA control. Therefore, the driver doesn't check RESET flag.
Quoted 2 lines
Quoted 1 line
+#define
FUNCTION_BUSYBIT(7)not used, can it be asserted?
Will remove it.
Quoted 1 line
Looks mostly good otherwise, thanks for the patch.