ASoC: rt712-sdca: Add RT712 SDCA driver for Mic topology
Subsystems (3)
PATCH v3 1/1 ASoC: rt712-sdca: Add RT712 SDCA driver for Mic topology
From: Shuming Fan <[email protected]>
This is the initial codec driver for rt712 SDCA (Mic topology). The host should connect with rt712 SdW2 interface.
--- sound/soc/codecs/Kconfig | 7 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt712-sdca-dmic.c | 983 +++++++++++++++++++++++++++++ sound/soc/codecs/rt712-sdca-dmic.h | 106 ++++ 4 files changed, 1098 insertions(+) create mode 100644 sound/soc/codecs/rt712-sdca-dmic.c create mode 100644 sound/soc/codecs/rt712-sdca-dmic.h
sound/soc/codecs/Kconfig +7 -0
@@ -203,6 +203,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT711_SDW imply SND_SOC_RT711_SDCA_SDW imply SND_SOC_RT712_SDCA_SDW + imply SND_SOC_RT712_SDCA_DMIC_SDW imply SND_SOC_RT715_SDW imply SND_SOC_RT715_SDCA_SDW imply SND_SOC_RT1308_SDW
@@ -1521,6 +1522,12 @@ config SND_SOC_RT712_SDCA_SDW select REGMAP_SOUNDWIRE select REGMAP_SOUNDWIRE_MBQ +config SND_SOC_RT712_SDCA_DMIC_SDW + tristate "Realtek RT712 SDCA DMIC Codec - SDW" + depends on SOUNDWIRE + select REGMAP_SOUNDWIRE + select REGMAP_SOUNDWIRE_MBQ + config SND_SOC_RT715 tristate
sound/soc/codecs/Makefile +2 -0
@@ -233,6 +233,7 @@ snd-soc-rt700-objs := rt700.o rt700-sdw.o snd-soc-rt711-objs := rt711.o rt711-sdw.o snd-soc-rt711-sdca-objs := rt711-sdca.o rt711-sdca-sdw.o snd-soc-rt712-sdca-objs := rt712-sdca.o rt712-sdca-sdw.o +snd-soc-rt712-sdca-dmic-objs := rt712-sdca-dmic.o snd-soc-rt715-objs := rt715.o rt715-sdw.o snd-soc-rt715-sdca-objs := rt715-sdca.o rt715-sdca-sdw.o snd-soc-rt9120-objs := rt9120.o
@@ -601,6 +602,7 @@ obj-$(CONFIG_SND_SOC_RT700) += snd-soc-rt700.o obj-$(CONFIG_SND_SOC_RT711) += snd-soc-rt711.o obj-$(CONFIG_SND_SOC_RT711_SDCA_SDW) += snd-soc-rt711-sdca.o 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_RT9120) += snd-soc-rt9120.o
sound/soc/codecs/rt712-sdca-dmic.c new file +983 -0
983 lines not on this page · raw message
sound/soc/codecs/rt712-sdca-dmic.h new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
2.34.1
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on linus/master v6.3-rc5 next-20230404] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/shumingf-realtek-com/ASoC-rt712-sdca-Add-RT712-SDCA-driver-for-Mic-topology/20230329-171313 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20230329090737.254649-1-shumingf%40realtek.com patch subject: [PATCH v3] ASoC: rt712-sdca: Add RT712 SDCA driver for Mic topology config: arc-randconfig-r043-20230404 (https://download.01.org/0day-ci/archive/20230404/[email protected]/config) compiler: arc-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/aeee9e435d2d3b75d6cacb0b19bd6afb06c287ac
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review shumingf-realtek-com/ASoC-rt712-sdca-Add-RT712-SDCA-driver-for-Mic-topology/20230329-171313 git checkout aeee9e435d2d3b75d6cacb0b19bd6afb06c287ac
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/virtio/ sound/soc/codecs/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> sound/soc/codecs/rt712-sdca-dmic.c:178:5: warning: no previous prototype for 'rt712_sdca_dmic_io_init' [-Wmissing-prototypes]
178 | int rt712_sdca_dmic_io_init(struct device *dev, struct sdw_slave *slave)
| ^~~~~~~~~~~~~~~~~~~~~~~
>> sound/soc/codecs/rt712-sdca-dmic.c:765:5: warning: no previous prototype for 'rt712_sdca_dmic_init' [-Wmissing-prototypes] 765 | int rt712_sdca_dmic_init(struct device *dev, struct regmap *regmap,
| ^~~~~~~~~~~~~~~~~~~~
vim +/rt712_sdca_dmic_io_init +178 sound/soc/codecs/rt712-sdca-dmic.c
177
> 178 int rt712_sdca_dmic_io_init(struct device *dev, struct sdw_slave *slave)
179 {
180 struct rt712_sdca_dmic_priv *rt712 = dev_get_drvdata(dev);
181
182 if (rt712->hw_init)
183 return 0;
184
185 if (rt712->first_hw_init) {
186 regcache_cache_only(rt712->regmap, false);
187 regcache_cache_bypass(rt712->regmap, true);
188 regcache_cache_only(rt712->mbq_regmap, false);
189 regcache_cache_bypass(rt712->mbq_regmap, true);
190 } else {
191 /*
192 * PM runtime is only enabled when a Slave reports as Attached
193 */
194
195 /* set autosuspend parameters */
196 pm_runtime_set_autosuspend_delay(&slave->dev, 3000);
197 pm_runtime_use_autosuspend(&slave->dev);
198
199 /* update count of parent 'active' children */
200 pm_runtime_set_active(&slave->dev);
201
202 /* make sure the device does not suspend immediately */
203 pm_runtime_mark_last_busy(&slave->dev);
204
205 pm_runtime_enable(&slave->dev);
206 }
207
208 pm_runtime_get_noresume(&slave->dev);
209
210 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
211 RT712_ADC0A_08_PDE_FLOAT_CTL, 0x1112);
212 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
213 RT712_ADC0B_11_PDE_FLOAT_CTL, 0x1111);
214 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
215 RT712_DMIC1_2_PDE_FLOAT_CTL, 0x1111);
216 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
217 RT712_I2S_IN_OUT_PDE_FLOAT_CTL, 0x1155);
218 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
219 RT712_DMIC_ENT_FLOAT_CTL, 0x2626);
220 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
221 RT712_ADC_ENT_FLOAT_CTL, 0x1e19);
222 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
223 RT712_DMIC_GAIN_ENT_FLOAT_CTL0, 0x1515);
224 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
225 RT712_ADC_VOL_CH_FLOAT_CTL2, 0x0304);
226 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
227 RT712_DMIC_GAIN_ENT_FLOAT_CTL2, 0x0304);
228 rt712_sdca_dmic_index_write(rt712, RT712_VENDOR_HDA_CTL,
229 RT712_HDA_LEGACY_CONFIG_CTL0, 0x0050);
230 regmap_write(rt712->regmap,
231 SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT712_SDCA_ENT_IT26, RT712_SDCA_CTL_VENDOR_DEF, 0), 0x01);
232 rt712_sdca_dmic_index_write(rt712, RT712_ULTRA_SOUND_DET,
233 RT712_ULTRA_SOUND_DETECTOR6, 0x3200);
234 regmap_write(rt712->regmap, RT712_RC_CAL, 0x23);
235 regmap_write(rt712->regmap, 0x2f52, 0x00);
236
237 if (rt712->first_hw_init) {
238 regcache_cache_bypass(rt712->regmap, false);
239 regcache_mark_dirty(rt712->regmap);
240 regcache_cache_bypass(rt712->mbq_regmap, false);
241 regcache_mark_dirty(rt712->mbq_regmap);
242 } else
243 rt712->first_hw_init = true;
244
245 /* Mark Slave initialization complete */
246 rt712->hw_init = true;
247
248 pm_runtime_mark_last_busy(&slave->dev);
249 pm_runtime_put_autosuspend(&slave->dev);
250
251 dev_dbg(&slave->dev, "%s hw_init complete\n", __func__);
252 return 0;
253 }
254
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests