Skip to contentSkip to conversation

ASoC: max98390: Add support change dsm param name

PATCH Superseded Steve Lee 2 participants 5 messages Aug 6, 2021 – Aug 9, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Steve Lee

author
#0 lore raw

PATCH 1/1 ASoC: max98390: Add support change dsm param name

In case of using different type of speaker, support
using different dsm parameter bin file for each amp connected.

---
 sound/soc/codecs/max98390.c | 20 +++++++++++++++-----
 sound/soc/codecs/max98390.h |  1 +
 2 files changed, 16 insertions(+), 5 deletions(-)
sound/soc/codecs/max98390.c +15 -5
index 94773ccee9d5..82d2dd52c17d 100644
@@ -765,15 +765,20 @@ static int max98390_dsm_init(struct snd_soc_component *component)
 	vendor = dmi_get_system_info(DMI_SYS_VENDOR);
 	product = dmi_get_system_info(DMI_PRODUCT_NAME);
 
-	if (vendor && product) {
-		snprintf(filename, sizeof(filename), "dsm_param_%s_%s.bin",
-			vendor, product);
+	if (!strcmp(max98390->dsm_param_name, "default")) {
+		if (vendor && product) {
+			snprintf(filename, sizeof(filename),
+				"dsm_param_%s_%s.bin", vendor, product);
+		} else {
+			sprintf(filename, "dsmparam.bin");
+		}
 	} else {
-		sprintf(filename, "dsm_param.bin");
+		snprintf(filename, sizeof(filename), "%s",
+			max98390->dsm_param_name);
 	}
 	ret = request_firmware(&fw, filename, component->dev);
 	if (ret) {
-		ret = request_firmware(&fw, "dsm_param.bin", component->dev);
+		ret = request_firmware(&fw, "dsmparam.bin", component->dev);
 		if (ret)
 			goto err;
 	}
@@ -1047,6 +1052,11 @@ static int max98390_i2c_probe(struct i2c_client *i2c,
 		__func__, max98390->ref_rdc_value,
 		max98390->ambient_temp_value);
 
+	ret = device_property_read_string(&i2c->dev, "maxim,dsm_param_name",
+				       &max98390->dsm_param_name);
+	if (ret)
+		max98390->dsm_param_name = "default";
+
 	/* voltage/current slot configuration */
 	max98390_slot_config(i2c, max98390);
 
sound/soc/codecs/max98390.h +1 -0
index e31516717d3b..c250740f73a2 100644
@@ -662,5 +662,6 @@ struct max98390_priv {
 	unsigned int i_l_slot;
 	unsigned int ref_rdc_value;
 	unsigned int ambient_temp_value;
+	const char *dsm_param_name;
 };
 #endif
Signature · 1 line
2.17.1
maintainer
#1 lore raw

sound/soc/codecs/max98390.c static int max98390_dsm_init(struct snd_soc_component *component) · line 781

Quoted 4 lines · Steve Lee
sound/soc/codecs/max98390.c +1 -1
 	ret = request_firmware(&fw, filename, component->dev);
 	if (ret) {
-		ret = request_firmware(&fw, "dsm_param.bin", component->dev);
+		ret = request_firmware(&fw, "dsmparam.bin", component->dev);

This will break anything using dsm_param.bin as the default - why make the change?

author
#2 lore raw
Quoted 10 lines · Steve Lee
Quoted 7 lines
sound/soc/codecs/max98390.c +0 -1
 	ret = request_firmware(&fw, filename, component->dev);
 	if (ret) {
-		ret = request_firmware(&fw, "dsm_param.bin", component-

dev);

(quoted diff) +1 -0
+		ret = request_firmware(&fw, "dsmparam.bin", component-

dev);

This will break anything using dsm_param.bin as the default - why make the change?

I'd like to make that as same name with other using SoF project line.
This originally production default is "dsm_param_%s_%s.bin with vendor and product name".

maintainer
#3 lore raw
Quoted 7 lines · Steve Lee
Quoted 2 lines · Steve Lee

This will break anything using dsm_param.bin as the default - why make the change?

I'd like to make that as same name with other using SoF project line.
This originally production default is "dsm_param_%s_%s.bin with vendor and product name".

If you want to add a new filename then that's fine but we shouldn't be breaking backwards compatibility for a minor reason like that.

author
#4 lore raw
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

This will break anything using dsm_param.bin as the default - why make the change?

I'd like to make that as same name with other using SoF project line.
This originally production default is "dsm_param_%s_%s.bin with vendor and

product name".

If you want to add a new filename then that's fine but we shouldn't be breaking backwards compatibility for a minor reason like that.

Thanks for reply. I will add new filename not to break backwards compatibility.