linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: max98390: Add support change dsm param name
@ 2021-08-06  8:08 Steve Lee
  2021-08-06 11:03 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Lee @ 2021-08-06  8:08 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, ckeepax, geert, rf, shumingf,
	srinivas.kandagatla, krzk, dmurphy, jack.yu, nuno.sa, steves.lee,
	linux-kernel, alsa-devel
  Cc: ryan.lee.maxim, steves.lee.maxim

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

Signed-off-by: Steve Lee <steves.lee@maximintegrated.com>
---
 sound/soc/codecs/max98390.c | 20 +++++++++++++++-----
 sound/soc/codecs/max98390.h |  1 +
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/max98390.c b/sound/soc/codecs/max98390.c
index 94773ccee9d5..82d2dd52c17d 100644
--- a/sound/soc/codecs/max98390.c
+++ b/sound/soc/codecs/max98390.c
@@ -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);
 
diff --git a/sound/soc/codecs/max98390.h b/sound/soc/codecs/max98390.h
index e31516717d3b..c250740f73a2 100644
--- a/sound/soc/codecs/max98390.h
+++ b/sound/soc/codecs/max98390.h
@@ -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
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ASoC: max98390: Add support change dsm param name
  2021-08-06  8:08 [PATCH] ASoC: max98390: Add support change dsm param name Steve Lee
@ 2021-08-06 11:03 ` Mark Brown
  2021-08-09  0:57   ` [EXTERNAL] " Steve Lee
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2021-08-06 11:03 UTC (permalink / raw)
  To: Steve Lee
  Cc: lgirdwood, perex, tiwai, ckeepax, geert, rf, shumingf,
	srinivas.kandagatla, krzk, dmurphy, jack.yu, nuno.sa,
	linux-kernel, alsa-devel, ryan.lee.maxim, steves.lee.maxim

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

On Fri, Aug 06, 2021 at 05:08:34PM +0900, Steve Lee wrote:

>  	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?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [EXTERNAL] Re: [PATCH] ASoC: max98390: Add support change dsm param name
  2021-08-06 11:03 ` Mark Brown
@ 2021-08-09  0:57   ` Steve Lee
  2021-08-09 12:21     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Lee @ 2021-08-09  0:57 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, perex, tiwai, ckeepax, geert, rf, shumingf,
	srinivas.kandagatla, krzk, dmurphy, jack.yu, nuno.sa,
	linux-kernel, alsa-devel, ryan.lee.maxim, steves.lee.maxim

On Fri, Aug 06, 2021 at 05:08:34PM +0900, Steve Lee wrote:
> 
> >  	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?
 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".

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [EXTERNAL] Re: [PATCH] ASoC: max98390: Add support change dsm param name
  2021-08-09  0:57   ` [EXTERNAL] " Steve Lee
@ 2021-08-09 12:21     ` Mark Brown
  2021-08-09 13:55       ` Steve Lee
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2021-08-09 12:21 UTC (permalink / raw)
  To: Steve Lee
  Cc: lgirdwood, perex, tiwai, ckeepax, geert, rf, shumingf,
	srinivas.kandagatla, krzk, dmurphy, jack.yu, nuno.sa,
	linux-kernel, alsa-devel, ryan.lee.maxim, steves.lee.maxim

[-- Attachment #1: Type: text/plain, Size: 513 bytes --]

On Mon, Aug 09, 2021 at 12:57:48AM +0000, Steve Lee wrote:
> On Fri, Aug 06, 2021 at 05:08:34PM +0900, Steve Lee wrote:

> > 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [EXTERNAL] Re: [PATCH] ASoC: max98390: Add support change dsm param name
  2021-08-09 12:21     ` Mark Brown
@ 2021-08-09 13:55       ` Steve Lee
  0 siblings, 0 replies; 5+ messages in thread
From: Steve Lee @ 2021-08-09 13:55 UTC (permalink / raw)
  To: Mark Brown
  Cc: lgirdwood, perex, tiwai, ckeepax, geert, rf, shumingf,
	srinivas.kandagatla, krzk, dmurphy, jack.yu, nuno.sa,
	linux-kernel, alsa-devel, ryan.lee.maxim, steves.lee.maxim

> 
> > > 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-09 13:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06  8:08 [PATCH] ASoC: max98390: Add support change dsm param name Steve Lee
2021-08-06 11:03 ` Mark Brown
2021-08-09  0:57   ` [EXTERNAL] " Steve Lee
2021-08-09 12:21     ` Mark Brown
2021-08-09 13:55       ` Steve Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).