[PATCH 5/8] ASoC: aw88399: add channel setter for HDA side codec

Marco Giunta <[email protected]>
Newsgroups org.kernel.vger.platform-driver-x86,org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel,org.kernel.vger.linux-sound
Message-ID <DS7PR19MB7724E8A1AD36D1E623FA2A0AFCC62@DS7PR19MB7724.namprd19.prod.outlook.com>
Add aw88399_dev_set_channel() to the shared library so that the HDA side
codec driver can set the amplifier's channel assignment without
including the aw88395 device header directly.

The AW88399's struct aw_device is defined in aw88395_device.h, which
lives under sound/soc/codecs/aw88395/. Without this accessor, the
HDA driver would need a cross-subsystem relative include path to
access the channel field. Providing a setter in the library keeps the
interface clean and avoids coupling the HDA driver to ASoC-internal
headers.

Tested-by: Nadim Kobeissi <[email protected]>
Tested-by: Xia Yun'an <[email protected]>
Tested-by: Munzir Taha <[email protected]>
Signed-off-by: Marco Giunta <[email protected]>
---
 include/sound/aw88399.h        | 1 +
 sound/soc/codecs/aw88399-lib.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/include/sound/aw88399.h b/include/sound/aw88399.h
index 3dbc37dc13d1..a1e0de6be8ea 100644
--- a/include/sound/aw88399.h
+++ b/include/sound/aw88399.h
@@ -609,6 +609,7 @@ int aw_dev_set_volume(struct aw_device *aw_dev, unsigned int value);
 int aw_dev_update_cali_re(struct aw_cali_desc *cali_desc);
 int aw88399_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name);
 void aw88399_dev_mute(struct aw_device *aw_dev, bool is_mute);
+void aw88399_dev_set_channel(struct aw88399 *aw88399, int channel);
 void aw88399_hw_reset(struct aw88399 *aw88399);
 int aw88399_init(struct aw88399 *aw88399, struct i2c_client *i2c, struct regmap *regmap);
 extern const struct regmap_config aw88399_remap_config;
diff --git a/sound/soc/codecs/aw88399-lib.c b/sound/soc/codecs/aw88399-lib.c
index 094a37b66fb5..5c7982891def 100644
--- a/sound/soc/codecs/aw88399-lib.c
+++ b/sound/soc/codecs/aw88399-lib.c
@@ -1401,5 +1401,11 @@ int aw88399_init(struct aw88399 *aw88399, struct i2c_client *i2c, struct regmap
 }
 EXPORT_SYMBOL_GPL(aw88399_init);
 
+void aw88399_dev_set_channel(struct aw88399 *aw88399, int channel)
+{
+	aw88399->aw_pa->channel = channel;
+}
+EXPORT_SYMBOL_GPL(aw88399_dev_set_channel);
+
 MODULE_DESCRIPTION("AW88399 common device library");
 MODULE_LICENSE("GPL");
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.