ASoC: rt722-sdca: Add a control to support CAE firmware update
Subsystems (3)
PATCH 1/1 ASoC: rt722-sdca: Add a control to support CAE firmware update
From: Jack Yu <[email protected]>
Realtek CAE requires specific tuning parameters based on the system vendor and SKU.
This patch adds a kcontrol to trigger the firmware loading process.
--- sound/soc/codecs/rt722-sdca-sdw.c | 39 ++++- sound/soc/codecs/rt722-sdca.c | 272 +++++++++++++++++++++++++++++- sound/soc/codecs/rt722-sdca.h | 23 +++ 3 files changed, 326 insertions(+), 8 deletions(-)
sound/soc/codecs/rt722-sdca-sdw.c +37 -2
@@ -19,7 +19,9 @@static int rt722_sdca_mbq_size (struct device *dev,unsigned int reg) {switch (reg) { - case 0x2f01 ... 0x2f0a: + case 0x22f0 ... 0x22f1: + case 0x2f01 ... 0x2f0c: + case 0x2f21 ... 0x2f24: case 0x2f35 ... 0x2f36: case 0x2f50 ... 0x2f52:case 0x2f54 :
@@ -84,6 +86,21 @@ static int rt722_sdca_mbq_size(struct device *dev, unsigned int reg)case SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_CS31 ,RT722_SDCA_CTL_SAMPLE_FREQ_INDEX ,0 ): case RT722_BUF_ADDR_HID1 ... RT722_BUF_ADDR_HID2: + case 0x44011000 ... 0x440115ff: +case 0x44012000 : +case 0x44012021 : +case 0x44012022 : +case 0x44012025 : + case 0x44021000 ... 0x440211ff: +case 0x44022000 : +case 0x44022019 : +case 0x4402201a : +case 0x4402201d : + case 0x44041000 ... 0x440415ff: +case 0x44042000 : +case 0x44042019 : +case 0x4404201a : +case 0x4404201d :return 1 ; case 0x2000000 ... 0x2000024: case 0x2000029 ... 0x200004a:
@@ -95,8 +112,10 @@ static int rt722_sdca_mbq_size(struct device *dev, unsigned int reg)case 0x200007f : case 0x2000082 ... 0x200008e: case 0x2000090 ... 0x2000094: +case 0x20000b1 : +case 0x20000b4 :case 0x3110000 : - case 0x5300000 ... 0x5300002: + case 0x5300000 ... 0x5300300:case 0x5400002 : case 0x5600000 ... 0x5600007: case 0x5700000 ... 0x5700004:
@@ -175,6 +194,7 @@ static bool rt722_sdca_volatile_register(struct device *dev, unsigned int reg)case SDW_SDCA_CTL (FUNC_NUM_AMP ,RT722_SDCA_ENT_PDE23 ,RT722_SDCA_CTL_ACTUAL_POWER_STATE ,0 ): case RT722_BUF_ADDR_HID1 ... RT722_BUF_ADDR_HID2:case 0x2000000 : +case 0x2000007 :case 0x200000d :case 0x2000019 :case 0x2000020 :
@@ -186,6 +206,21 @@ static bool rt722_sdca_volatile_register(struct device *dev, unsigned int reg)case 0x3110000 :case 0x5800003 :case 0x5810000 : + case 0x44011000 ... 0x440115ff: +case 0x44012000 : +case 0x44012021 : +case 0x44012022 : +case 0x44012025 : + case 0x44021000 ... 0x440211ff: +case 0x44022000 : +case 0x44022019 : +case 0x4402201a : +case 0x4402201d : + case 0x44041000 ... 0x440415ff: +case 0x44042000 : +case 0x44042019 : +case 0x4404201a : +case 0x4404201d :return true;default :return false;
sound/soc/codecs/rt722-sdca.c +266 -6
303 lines not on this page · raw message
sound/soc/codecs/rt722-sdca.h +23 -0
@@ -44,6 +44,7 @@ struct rt722_sdca_priv {bool fu1e_dapm_mute;bool fu1e_mixer_mute[4 ];int hw_vid; +int cae_update_done; };struct rt722_sdca_dmic_kctrl_priv {
@@ -55,6 +56,7 @@ struct rt722_sdca_dmic_kctrl_priv {/* NID */ #define RT722_VENDOR_REG 0x20 +#define RT722_VENDOR_EQ_CAE 0x53#define RT722_VENDOR_CALI 0x58#define RT722_VENDOR_SPK_EFUSE 0x5c#define RT722_VENDOR_IMS_DRE 0x5b
@@ -64,6 +66,7 @@ struct rt722_sdca_dmic_kctrl_priv {/* Index (NID:20h) */ #define RT722_JD_PRODUCT_NUM 0x00#define RT722_ANALOG_BIAS_CTL3 0x04 +#define RT722_MISC_CTRL1 0x07#define RT722_JD_CTRL1 0x09#define RT722_LDO2_3_CTL1 0x0e#define RT722_LDO1_CTL 0x1a
@@ -79,6 +82,12 @@ struct rt722_sdca_dmic_kctrl_priv {#define RT722_SW_CONFIG1 0x8a#define RT722_SW_CONFIG2 0x8b +/* Index (NID:53h) */ +#define RT722_EQ_CTRL_SPK 0x00 +#define RT722_EQ_CTRL_HP 0x100 +#define RT722_EQ_CTRL_DMIC 0x200 +#define RT722_EQ_CTRL_AMIC 0x300 +/* Index (NID:58h) */ #define RT722_DAC_DC_CALI_CTL0 0x00#define RT722_DAC_DC_CALI_CTL1 0x01
@@ -156,6 +165,20 @@ struct rt722_sdca_dmic_kctrl_priv {#define RT722_BUF_ADDR_HID1 0x44030000#define RT722_BUF_ADDR_HID2 0x44030020 +/* RT722 CAE parameter settings */ +#define RT722_SPK_CAE_PARAM1 0x44012000 +#define RT722_SPK_CAE_PARAM34 0x44012021 +#define RT722_SPK_CAE_PARAM35 0x44012022 +#define RT722_SPK_CAE_PARAM38 0x44012025 +#define RT722_HP_CAE_PARAM39 0x44022000 +#define RT722_HP_CAE_PARAM64 0x44022019 +#define RT722_HP_CAE_PARAM65 0x4402201a +#define RT722_HP_CAE_PARAM68 0x4402201d +#define RT722_MIC_CAE_PARAM39 0x44042000 +#define RT722_MIC_CAE_PARAM95 0x44042019 +#define RT722_MIC_CAE_PARAM96 0x4404201a +#define RT722_MIC_CAE_PARAM99 0x4404201d +/* RT722 SDCA Control - function number */ #define FUNC_NUM_JACK_CODEC 0x01#define FUNC_NUM_MIC_ARRAY 0x02
Signature · 1 line
2.54.0
kernel test robot
build botkernel test robot noticed the following build errors:
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v7.1-rc3 next-20260508] [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/jack-yu-realtek-com/ASoC-rt722-sdca-Add-a-control-to-support-CAE-firmware-update/20260515-191729 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20260515091643.3038701-1-jack.yu%40realtek.com patch subject: [PATCH] ASoC: rt722-sdca: Add a control to support CAE firmware update config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20260516/[email protected]/config) compiler: sh4-linux-gcc (GCC) 15.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260516/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
sound/soc/codecs/rt722-sdca.c: In function 'rt722_cae_update_put':
>> sound/soc/codecs/rt722-sdca.c:571:21: error: implicit declaration of function 'snd_soc_component_get_bias_level'; did you mean 'snd_soc_component_set_bias_level'? [-Wimplicit-function-declaration]
571 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| snd_soc_component_set_bias_levelvim +571 sound/soc/codecs/rt722-sdca.c
555
556 static int rt722_cae_update_put(struct snd_kcontrol *kcontrol,
557 struct snd_ctl_elem_value *ucontrol)
558 {
559 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
560 struct rt722_sdca_priv *rt722 = snd_soc_component_get_drvdata(component);
561 int ret, changed = 0;
562
563 if (!rt722->hw_init)
564 return 0;
565
566 ret = pm_runtime_resume_and_get(component->dev);
567 if (ret < 0 && ret != -EACCES)
568 return ret;
569
570 if (ucontrol->value.integer.value[0]) {
> 571 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { 572 ret = rt722_cae_load(rt722);
573 if (ret)
574 dev_err(component->dev, "CAE load failed: %d\n", ret);
575 else
576 changed = 1;
577 }
578 } else {
579 if (rt722->cae_update_done) {
580 rt722->cae_update_done = 0;
581 changed = 1;
582 }
583 }
584
585 pm_runtime_mark_last_busy(component->dev);
586 pm_runtime_put_autosuspend(component->dev);
587
588 return changed;
589 }
590
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
Hi,
kernel test robot noticed the following build errors:
[auto build test ERROR on broonie-sound/for-next]
[also build test ERROR on linus/master v7.1-rc3 next-20260508] [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/jack-yu-realtek-com/ASoC-rt722-sdca-Add-a-control-to-support-CAE-firmware-update/20260515-191729 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20260515091643.3038701-1-jack.yu%40realtek.com patch subject: [PATCH] ASoC: rt722-sdca: Add a control to support CAE firmware update config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20260516/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260516/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
>> sound/soc/codecs/rt722-sdca.c:571:7: error: call to undeclared function 'snd_soc_component_get_bias_level'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
571 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
| ^ sound/soc/codecs/rt722-sdca.c:571:7: note: did you mean 'snd_soc_component_set_bias_level'? include/sound/soc-component.h:326:5: note: 'snd_soc_component_set_bias_level' declared here
326 | int snd_soc_component_set_bias_level(struct snd_soc_component *component,
| ^
1 error generated.
vim +/snd_soc_component_get_bias_level +571 sound/soc/codecs/rt722-sdca.c
555
556 static int rt722_cae_update_put(struct snd_kcontrol *kcontrol,
557 struct snd_ctl_elem_value *ucontrol)
558 {
559 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
560 struct rt722_sdca_priv *rt722 = snd_soc_component_get_drvdata(component);
561 int ret, changed = 0;
562
563 if (!rt722->hw_init)
564 return 0;
565
566 ret = pm_runtime_resume_and_get(component->dev);
567 if (ret < 0 && ret != -EACCES)
568 return ret;
569
570 if (ucontrol->value.integer.value[0]) {
> 571 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { 572 ret = rt722_cae_load(rt722);
573 if (ret)
574 dev_err(component->dev, "CAE load failed: %d\n", ret);
575 else
576 changed = 1;
577 }
578 } else {
579 if (rt722->cae_update_done) {
580 rt722->cae_update_done = 0;
581 changed = 1;
582 }
583 }
584
585 pm_runtime_mark_last_busy(component->dev);
586 pm_runtime_put_autosuspend(component->dev);
587
588 return changed;
589 }
590
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki