Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: rt1320-sdw: kcontrol for brown-out feature update

Create a kcontrol to enable or disable brown-out dynamically.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://patch.msgid.link/20260409060102.4177554-1-jack.yu@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Jack Yu and committed by
Mark Brown
fbb1f8ba 833011cb

+43
+42
sound/soc/codecs/rt1320-sdw.c
··· 2486 2486 return 0; 2487 2487 } 2488 2488 2489 + static int rt1320_brown_out_put(struct snd_kcontrol *kcontrol, 2490 + struct snd_ctl_elem_value *ucontrol) 2491 + { 2492 + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 2493 + struct rt1320_sdw_priv *rt1320 = snd_soc_component_get_drvdata(component); 2494 + int ret, changed = 0; 2495 + 2496 + if (!rt1320->hw_init) 2497 + return 0; 2498 + 2499 + ret = pm_runtime_resume(component->dev); 2500 + if (ret < 0 && ret != -EACCES) 2501 + return ret; 2502 + 2503 + if (rt1320->brown_out != ucontrol->value.integer.value[0]) { 2504 + changed = 1; 2505 + rt1320->brown_out = ucontrol->value.integer.value[0]; 2506 + } 2507 + 2508 + if (rt1320->brown_out == 0) 2509 + regmap_write(rt1320->regmap, 0xdb03, 0x00); 2510 + else 2511 + regmap_write(rt1320->regmap, 0xdb03, 0xf0); 2512 + 2513 + 2514 + return changed; 2515 + } 2516 + 2517 + static int rt1320_brown_out_get(struct snd_kcontrol *kcontrol, 2518 + struct snd_ctl_elem_value *ucontrol) 2519 + { 2520 + struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 2521 + struct rt1320_sdw_priv *rt1320 = snd_soc_component_get_drvdata(component); 2522 + 2523 + ucontrol->value.integer.value[0] = rt1320->brown_out; 2524 + 2525 + return 0; 2526 + } 2527 + 2489 2528 static int rt1320_r0_temperature_get(struct snd_kcontrol *kcontrol, 2490 2529 struct snd_ctl_elem_value *ucontrol) 2491 2530 { ··· 2584 2545 rt1320_r0_temperature_get, rt1320_r0_temperature_put), 2585 2546 SOC_SINGLE_EXT("RAE Update", SND_SOC_NOPM, 0, 1, 0, 2586 2547 rt1320_rae_update_get, rt1320_rae_update_put), 2548 + SOC_SINGLE_EXT("Brown Out Switch", SND_SOC_NOPM, 0, 1, 0, 2549 + rt1320_brown_out_get, rt1320_brown_out_put), 2587 2550 }; 2588 2551 2589 2552 static const struct snd_kcontrol_new rt1320_spk_l_dac = ··· 2945 2904 rt1320->fu_dapm_mute = true; 2946 2905 rt1320->fu_mixer_mute[0] = rt1320->fu_mixer_mute[1] = 2947 2906 rt1320->fu_mixer_mute[2] = rt1320->fu_mixer_mute[3] = true; 2907 + rt1320->brown_out = 1; 2948 2908 2949 2909 INIT_WORK(&rt1320->load_dspfw_work, rt1320_load_dspfw_work); 2950 2910
+1
sound/soc/codecs/rt1320-sdw.h
··· 159 159 bool hw_init; 160 160 bool first_hw_init; 161 161 int version_id; 162 + int brown_out; 162 163 unsigned int dev_id; 163 164 bool fu_dapm_mute; 164 165 bool fu_mixer_mute[4];