Skip to contentSkip to conversation

ASoC: rt721: Use the function_status check to avoid duplicate presets

PATCH In review Oder Chiou 2 participants 2 messages Sep 11 – Sep 15

Subsystems (3)
lore
Share & tools
lore

Oder Chiou

author maintainer
#0 lore raw

PATCH 1/1 ASoC: rt721: Use the function_status check to avoid duplicate presets

This patch adds the function_status check to avoid duplicate presets. The codec driver reinitializes when the 'FUNCTION_NEEDS_INITIALIZATION' flag is raised.

---
 sound/soc/codecs/rt721-sdca-sdw.c |  12 ++
 sound/soc/codecs/rt721-sdca.c     | 315 +++++++++++++++++-------------
 sound/soc/codecs/rt721-sdca.h     |   5 +
 3 files changed, 195 insertions(+), 137 deletions(-)
sound/soc/codecs/rt721-sdca-sdw.c +12 -0
index eae7d662efae..d0f3fc1978c3 100644
@@ -25,16 +25,22 @@ static bool rt721_sdca_readable_register(struct device *dev, unsigned int reg)
 	case 0x2f50:
 	case 0x2f51:
 	case 0x2f58 ... 0x2f5d:
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT0,
+		RT721_SDCA_CTL_FUNC_STATUS, 0):
 	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XUV,
 		RT721_SDCA_CTL_XUV, 0):
 	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
 		RT721_SDCA_CTL_SELECTED_MODE, 0):
 	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
 		RT721_SDCA_CTL_DETECTED_MODE, 0):
+	case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT0,
+		RT721_SDCA_CTL_FUNC_STATUS, 0):
 	case SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
 		RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... SDW_SDCA_CTL(FUNC_NUM_HID,
 		RT721_SDCA_ENT_HID01, RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0):
 	case RT721_BUF_ADDR_HID1 ... RT721_BUF_ADDR_HID2:
+	case SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT0,
+		RT721_SDCA_CTL_FUNC_STATUS, 0):
 		return true;
 	default:
 		return false;
@@ -46,14 +52,20 @@ static bool rt721_sdca_volatile_register(struct device *dev, unsigned int reg)
 	switch (reg) {
 	case 0x2f01:
 	case 0x2f51:
+	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT0,
+		RT721_SDCA_CTL_FUNC_STATUS, 0):
 	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_GE49,
 		RT721_SDCA_CTL_DETECTED_MODE, 0):
 	case SDW_SDCA_CTL(FUNC_NUM_JACK_CODEC, RT721_SDCA_ENT_XUV,
 		RT721_SDCA_CTL_XUV, 0):
+	case SDW_SDCA_CTL(FUNC_NUM_MIC_ARRAY, RT721_SDCA_ENT0,
+		RT721_SDCA_CTL_FUNC_STATUS, 0):
 	case SDW_SDCA_CTL(FUNC_NUM_HID, RT721_SDCA_ENT_HID01,
 		RT721_SDCA_CTL_HIDTX_CURRENT_OWNER, 0) ... SDW_SDCA_CTL(FUNC_NUM_HID,
 		RT721_SDCA_ENT_HID01, RT721_SDCA_CTL_HIDTX_MESSAGE_LENGTH, 0):
 	case RT721_BUF_ADDR_HID1 ... RT721_BUF_ADDR_HID2:
+	case SDW_SDCA_CTL(FUNC_NUM_AMP, RT721_SDCA_ENT0,
+		RT721_SDCA_CTL_FUNC_STATUS, 0):
 		return true;
 	default:
 		return false;
sound/soc/codecs/rt721-sdca.c +178 -137

329 lines not on this page · raw message

sound/soc/codecs/rt721-sdca.h +5 -0
index 24ce188562ba..b8873b18a648 100644
@@ -214,6 +214,7 @@ struct rt721_sdca_dmic_kctrl_priv {
 #define RT721_SDCA_ENT_XU03			0x03
 #define RT721_SDCA_ENT_XU0D			0x0d
 #define RT721_SDCA_ENT_FU55			0x55
+#define RT721_SDCA_ENT0				0x00
 
 /* RT721 SDCA control */
 #define RT721_SDCA_CTL_SAMPLE_FREQ_INDEX		0x10
@@ -229,6 +230,7 @@ struct rt721_sdca_dmic_kctrl_priv {
 #define RT721_SDCA_CTL_VENDOR_DEF			0x30
 #define RT721_SDCA_CTL_XUV				0x34
 #define RT721_SDCA_CTL_FU_CH_GAIN			0x0b
+#define RT721_SDCA_CTL_FUNC_STATUS			0x10
 
 /* RT721 SDCA channel */
 #define CH_L	0x01
@@ -261,6 +263,9 @@ struct rt721_sdca_dmic_kctrl_priv {
 /* RT721 HID ID */
 #define RT721_SDCA_HID_ID		0x11
 
+/* Function_Status */
+#define FUNCTION_NEEDS_INITIALIZATION	BIT(5)
+
 enum {
 	RT721_AIF1, /* For headset mic and headphone */
 	RT721_AIF2, /* For speaker */
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 1 line · Oder Chiou

ASoC: rt721: Use the function_status check to avoid duplicate presets

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4

Thanks!

[1/1] ASoC: rt721: Use the function_status check to avoid duplicate presets

      https://git.kernel.org/broonie/sound/c/247b84c07b7e

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark