ASoC: rt721-sdca: Add RT721 SDCA driver
Subsystems (3)
PATCH 1/1 ASoC: rt721-sdca: Add RT721 SDCA driver
This is the initial codec driver for rt721-sdca.
--- sound/soc/codecs/Kconfig | 7 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt721-sdca-sdw.c | 550 +++++++++ sound/soc/codecs/rt721-sdca-sdw.h | 151 +++ sound/soc/codecs/rt721-sdca.c | 1790 +++++++++++++++++++++++++++++ sound/soc/codecs/rt721-sdca.h | 277 +++++ 6 files changed, 2777 insertions(+) create mode 100644 sound/soc/codecs/rt721-sdca-sdw.c create mode 100644 sound/soc/codecs/rt721-sdca-sdw.h create mode 100644 sound/soc/codecs/rt721-sdca.c create mode 100644 sound/soc/codecs/rt721-sdca.h
sound/soc/codecs/Kconfig +7 -0
@@ -222,6 +222,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT712_SDCA_DMIC_SDW imply SND_SOC_RT715_SDW imply SND_SOC_RT715_SDCA_SDW + imply SND_SOC_RT721_SDCA_SDW imply SND_SOC_RT722_SDCA_SDW imply SND_SOC_RT1308_SDW imply SND_SOC_RT1316_SDW
@@ -1743,6 +1744,12 @@ config SND_SOC_RT712_SDCA_DMIC_SDW select REGMAP_SOUNDWIRE select REGMAP_SOUNDWIRE_MBQ +config SND_SOC_RT721_SDCA_SDW + tristate "Realtek RT721 SDCA Codec - SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + select REGMAP_SOUNDWIRE_MBQ + config SND_SOC_RT722_SDCA_SDW tristate "Realtek RT722 SDCA Codec - SDW" depends on SOUNDWIRE
sound/soc/codecs/Makefile +2 -0
@@ -259,6 +259,7 @@ snd-soc-rt712-sdca-y := rt712-sdca.o rt712-sdca-sdw.o snd-soc-rt712-sdca-dmic-y := rt712-sdca-dmic.o snd-soc-rt715-y := rt715.o rt715-sdw.o snd-soc-rt715-sdca-y := rt715-sdca.o rt715-sdca-sdw.o +snd-soc-rt721-sdca-y := rt721-sdca.o rt721-sdca-sdw.o snd-soc-rt722-sdca-y := rt722-sdca.o rt722-sdca-sdw.o snd-soc-rt9120-y := rt9120.o snd-soc-rtq9128-y := rtq9128.o
@@ -662,6 +663,7 @@ obj-$(CONFIG_SND_SOC_RT712_SDCA_SDW) += snd-soc-rt712-sdca.o obj-$(CONFIG_SND_SOC_RT712_SDCA_DMIC_SDW) += snd-soc-rt712-sdca-dmic.o obj-$(CONFIG_SND_SOC_RT715) += snd-soc-rt715.o obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW) += snd-soc-rt715-sdca.o +obj-$(CONFIG_SND_SOC_RT721_SDCA_SDW) += snd-soc-rt721-sdca.o obj-$(CONFIG_SND_SOC_RT722_SDCA_SDW) += snd-soc-rt722-sdca.o obj-$(CONFIG_SND_SOC_RT9120) += snd-soc-rt9120.o obj-$(CONFIG_SND_SOC_RTQ9128) += snd-soc-rtq9128.o
sound/soc/codecs/rt721-sdca-sdw.c new file +550 -0
550 lines not on this page · raw message
sound/soc/codecs/rt721-sdca-sdw.h new file +151 -0
151 lines not on this page · raw message
sound/soc/codecs/rt721-sdca.c new file +1790 -0
1,790 lines not on this page · raw message
sound/soc/codecs/rt721-sdca.h new file +277 -0
277 lines not on this page · raw message
Signature · 1 line
2.34.1
Mark Brown
maintainersound/soc/codecs/rt721-sdca-sdw.h line 90
Quoted 9 lines · Jack Yu
sound/soc/codecs/rt721-sdca-sdw.h new file +9
-0+static const struct reg_default rt721_sdca_mbq_defaults[] = { + {0x0900007 ,0xc004 }, + {0x2000001 ,0x0000 }, + {0x2000002 ,0x0000 }, + {0x2000003 ,0x0000 }, + {0x2000013 ,0x8001 }, + {0x200003c ,0x0000 }, + {0x2000046 ,0x3400 }, +// { 0x5810000, 0x702d },
Why is there this one commented value?
Quoted 13 lines
sound/soc/codecs/rt721-sdca.c new file +13
-0+ +static int rt721_sdca_pde34_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) +{ +struct snd_soc_component *component = +snd_soc_dapm_to_component (w->dapm); +struct rt721_sdca_priv *rt721 =snd_soc_component_get_drvdata (component); +unsigned char ps0 =0x0 , ps3 =0x3 ; + +switch (event) { +case SND_SOC_DAPM_POST_PMU : + regmap_write(rt721->regmap, + SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_PDE12,
sound/soc/codecs/rt721-sdca.c line 1337
Quoted 10 lines
sound/soc/codecs/rt721-sdca.c new file +10
-0+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0); +break ; +case SND_SOC_DAPM_PRE_PMD : +regmap_write (rt721->regmap, +SDW_SDCA_CTL (FUNC_NUM_JACK_CODEC ,RT721_SDCA_ENT_PDE12 , +RT721_SDCA_CTL_REQ_POWER_STATE ,0 ), ps3); +break ; + } +return 0 ; +}
We should perhaps invent some helpers for these Soundwire events, there's clearly a common pattern.
Quoted 12 lines
-----Original Message-----
From: Mark Brown <[email protected]>
Sent: Tuesday, September 24, 2024 4:45 PM
To: Jack Yu <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Flove(HsinFu) <[email protected]>; Oder Chiou <[email protected]>; Shuming [范書銘] <[email protected]>; Derek [方德義] <[email protected]>
Subject: Re: [PATCH] ASoC: rt721-sdca: Add RT721 SDCA driverOn Tue, Sep 24, 2024 at 02:13:24AM +0000, Jack Yu wrote:
Quoted 11 lines
sound/soc/codecs/rt721-sdca-sdw.h line 90
Quoted 9 lines
sound/soc/codecs/rt721-sdca-sdw.h new file +9
-0+static const struct reg_default rt721_sdca_mbq_defaults[] = { + {0x0900007 ,0xc004 }, + {0x2000001 ,0x0000 }, + {0x2000002 ,0x0000 }, + {0x2000003 ,0x0000 }, + {0x2000013 ,0x8001 }, + {0x200003c ,0x0000 }, + {0x2000046 ,0x3400 }, +// { 0x5810000, 0x702d }, Why is there this one commented value?
It's a typo.
I'll send a v2 patch to fix it.
Quoted 29 lines
sound/soc/codecs/rt721-sdca.c
Quoted 7 lines
sound/soc/codecs/rt721-sdca.c new file +6
-0+ +static int rt721_sdca_pde34_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *kcontrol,int event) { +struct snd_soc_component *component = +snd_soc_dapm_to_component (w->dapm); + struct rt721_sdca_priv *rt721 =
snd_soc_component_get_drvdata(component);sound/soc/codecs/rt721-sdca.c
Quoted 6 lines
sound/soc/codecs/rt721-sdca.c new file +6
-0+unsigned char ps0 =0x0 , ps3 =0x3 ; + +switch (event) { +case SND_SOC_DAPM_POST_PMU : + regmap_write(rt721->regmap, + SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
RT721_SDCA_ENT_PDE12,sound/soc/codecs/rt721-sdca.c
Quoted 5 lines
sound/soc/codecs/rt721-sdca.c new file +5
-0+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps0); +break ; +case SND_SOC_DAPM_PRE_PMD : + regmap_write(rt721->regmap, + SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC,
RT721_SDCA_ENT_PDE12,sound/soc/codecs/rt721-sdca.c line 1268
Quoted 5 lines
sound/soc/codecs/rt721-sdca.c new file +5
-0+ RT721_SDCA_CTL_REQ_POWER_STATE, 0), ps3); +break ; + } +return 0 ; +}We should perhaps invent some helpers for these Soundwire events, there's clearly a common pattern.