asoc: Parse adsp_varient to update sound_card name for holi
Update the sound card name corresponding to 1MB SKU holi varient. Change-Id: I6d13b5d642dee168cc79be54d0f45a58b396630f
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
a387074fd0
commit
77bfded0b3
48
asoc/holi.c
48
asoc/holi.c
@@ -14,6 +14,7 @@
|
||||
#include <linux/input.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/soc/qcom/fsa4480-i2c.h>
|
||||
#include <linux/nvmem-consumer.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/soc.h>
|
||||
#include <sound/soc-dapm.h>
|
||||
@@ -6602,6 +6603,49 @@ static int msm_audio_ssr_register(struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_asoc_parse_soundcard_name(struct platform_device *pdev,
|
||||
struct snd_soc_card *card)
|
||||
{
|
||||
struct nvmem_cell *cell;
|
||||
size_t len;
|
||||
u32 *buf;
|
||||
u32 adsp_var_idx = 0;
|
||||
int ret = 0;
|
||||
|
||||
/* get adsp variant idx */
|
||||
cell = nvmem_cell_get(&pdev->dev, "adsp_variant");
|
||||
if (IS_ERR_OR_NULL(cell)) {
|
||||
dev_dbg(&pdev->dev, "%s: FAILED to get nvmem cell \n", __func__);
|
||||
goto parse;
|
||||
}
|
||||
buf = nvmem_cell_read(cell, &len);
|
||||
nvmem_cell_put(cell);
|
||||
if (IS_ERR_OR_NULL(buf)) {
|
||||
dev_dbg(&pdev->dev, "%s: FAILED to read nvmem cell \n", __func__);
|
||||
goto parse;
|
||||
}
|
||||
if (len <= 0 || len > sizeof(u32)) {
|
||||
dev_dbg(&pdev->dev, "%s: nvmem cell length out of range: %d\n",
|
||||
__func__, len);
|
||||
kfree(buf);
|
||||
goto parse;
|
||||
}
|
||||
memcpy(&adsp_var_idx, buf, len);
|
||||
kfree(buf);
|
||||
|
||||
parse:
|
||||
if(adsp_var_idx == 1)
|
||||
ret = snd_soc_of_parse_card_name(card, "qcom,sku-model");
|
||||
else
|
||||
ret = snd_soc_of_parse_card_name(card, "qcom,model");
|
||||
|
||||
if (ret)
|
||||
dev_err(&pdev->dev, "%s: parse card name failed, err:%d\n",
|
||||
__func__, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int msm_asoc_machine_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_soc_card *card = NULL;
|
||||
@@ -6637,9 +6681,9 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
|
||||
platform_set_drvdata(pdev, card);
|
||||
snd_soc_card_set_drvdata(card, pdata);
|
||||
|
||||
ret = snd_soc_of_parse_card_name(card, "qcom,model");
|
||||
ret = msm_asoc_parse_soundcard_name(pdev, card);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "%s: parse card name failed, err:%d\n",
|
||||
dev_err(&pdev->dev, "%s: parse soundcard name failed, err:%d\n",
|
||||
__func__, ret);
|
||||
goto err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user