Commit a10facb7 authored by Steve Lee's avatar Steve Lee Committed by Mark Brown

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.
Signed-off-by: default avatarSteve Lee <steves.lee@maximintegrated.com>
Link: https://lore.kernel.org/r/20210809142140.9293-1-steves.lee@maximintegrated.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 455ecc80
...@@ -765,18 +765,27 @@ static int max98390_dsm_init(struct snd_soc_component *component) ...@@ -765,18 +765,27 @@ static int max98390_dsm_init(struct snd_soc_component *component)
vendor = dmi_get_system_info(DMI_SYS_VENDOR); vendor = dmi_get_system_info(DMI_SYS_VENDOR);
product = dmi_get_system_info(DMI_PRODUCT_NAME); product = dmi_get_system_info(DMI_PRODUCT_NAME);
if (!strcmp(max98390->dsm_param_name, "default")) {
if (vendor && product) { if (vendor && product) {
snprintf(filename, sizeof(filename), "dsm_param_%s_%s.bin", snprintf(filename, sizeof(filename),
vendor, product); "dsm_param_%s_%s.bin", vendor, product);
} else { } else {
sprintf(filename, "dsm_param.bin"); sprintf(filename, "dsm_param.bin");
} }
} else {
snprintf(filename, sizeof(filename), "%s",
max98390->dsm_param_name);
}
ret = request_firmware(&fw, filename, component->dev); ret = request_firmware(&fw, filename, component->dev);
if (ret) { if (ret) {
ret = request_firmware(&fw, "dsm_param.bin", component->dev); ret = request_firmware(&fw, "dsm_param.bin", component->dev);
if (ret) {
ret = request_firmware(&fw, "dsmparam.bin",
component->dev);
if (ret) if (ret)
goto err; goto err;
} }
}
dev_dbg(component->dev, dev_dbg(component->dev,
"max98390: param fw size %zd\n", "max98390: param fw size %zd\n",
...@@ -1047,6 +1056,11 @@ static int max98390_i2c_probe(struct i2c_client *i2c, ...@@ -1047,6 +1056,11 @@ static int max98390_i2c_probe(struct i2c_client *i2c,
__func__, max98390->ref_rdc_value, __func__, max98390->ref_rdc_value,
max98390->ambient_temp_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 */ /* voltage/current slot configuration */
max98390_slot_config(i2c, max98390); max98390_slot_config(i2c, max98390);
......
...@@ -662,5 +662,6 @@ struct max98390_priv { ...@@ -662,5 +662,6 @@ struct max98390_priv {
unsigned int i_l_slot; unsigned int i_l_slot;
unsigned int ref_rdc_value; unsigned int ref_rdc_value;
unsigned int ambient_temp_value; unsigned int ambient_temp_value;
const char *dsm_param_name;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment