summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2016-10-19 17:22:16 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:25:08 +0800
commit0745d78f2a7408b2695bd542e878c1fe23909c2c (patch)
tree019d3259a39721c1171aba62ff2e37a1c66881b9 /sound
parent0fdb7e8210c44f159a2a68319e9c1869197f4ea0 (diff)
MLK-13369-1: ASoC: fsl: fix the hard code gpr address in machine driver
There is hard code for gpr address in machine driver, imx-wm8960 and imx-wm8958, when the sai interface changed to sai1 or sai3, there will be issue, so remove the hard code, use the property from the device tree. Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-wm8958.c16
-rw-r--r--sound/soc/fsl/imx-wm8960.c16
2 files changed, 19 insertions, 13 deletions
diff --git a/sound/soc/fsl/imx-wm8958.c b/sound/soc/fsl/imx-wm8958.c
index e8ad44c315e8..c1d153d8c902 100644
--- a/sound/soc/fsl/imx-wm8958.c
+++ b/sound/soc/fsl/imx-wm8958.c
@@ -403,12 +403,13 @@ static int imx_wm8958_set_bias_level_post(struct snd_soc_card *card,
static int imx_wm8958_probe(struct platform_device *pdev)
{
- struct device_node *cpu_np, *codec_np = NULL, *gpr_np;
+ struct device_node *cpu_np, *codec_np = NULL;
struct device_node *np = pdev->dev.of_node;
struct platform_device *cpu_pdev;
struct imx_priv *priv = &card_priv;
struct i2c_client *codec_dev;
struct imx_wm8958_data *data;
+ struct of_phandle_args args;
int ret;
priv->pdev = pdev;
@@ -447,16 +448,19 @@ static int imx_wm8958_probe(struct platform_device *pdev)
goto fail;
}
- gpr_np = of_parse_phandle(pdev->dev.of_node, "gpr", 0);
- if (gpr_np) {
- data->gpr = syscon_node_to_regmap(gpr_np);
+ ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node, "gpr", 3,
+ 0, &args);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to get gpr property\n");
+ goto fail;
+ } else {
+ data->gpr = syscon_node_to_regmap(args.np);
if (IS_ERR(data->gpr)) {
ret = PTR_ERR(data->gpr);
dev_err(&pdev->dev, "failed to get gpr regmap\n");
goto fail;
}
- if (data->gpr)
- regmap_update_bits(data->gpr, 4, 1<<20, 1<<20);
+ regmap_update_bits(data->gpr, args.args[0], args.args[1], args.args[2]);
}
if (of_property_read_bool(np, "codec-master")) {
diff --git a/sound/soc/fsl/imx-wm8960.c b/sound/soc/fsl/imx-wm8960.c
index e96e8098389e..a177cb780d6c 100644
--- a/sound/soc/fsl/imx-wm8960.c
+++ b/sound/soc/fsl/imx-wm8960.c
@@ -422,13 +422,13 @@ static struct snd_soc_dai_link imx_wm8960_dai[] = {
static int imx_wm8960_probe(struct platform_device *pdev)
{
struct device_node *cpu_np, *codec_np = NULL;
- struct device_node *gpr_np;
struct platform_device *cpu_pdev;
struct imx_priv *priv = &card_priv;
struct i2c_client *codec_dev;
struct imx_wm8960_data *data;
struct platform_device *asrc_pdev = NULL;
struct device_node *asrc_np;
+ struct of_phandle_args args;
u32 width;
int ret;
@@ -478,17 +478,19 @@ static int imx_wm8960_probe(struct platform_device *pdev)
goto fail;
}
- gpr_np = of_parse_phandle(pdev->dev.of_node, "gpr", 0);
- if (gpr_np) {
- data->gpr = syscon_node_to_regmap(gpr_np);
+ ret = of_parse_phandle_with_fixed_args(pdev->dev.of_node, "gpr", 3,
+ 0, &args);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to get gpr property\n");
+ goto fail;
+ } else {
+ data->gpr = syscon_node_to_regmap(args.np);
if (IS_ERR(data->gpr)) {
ret = PTR_ERR(data->gpr);
dev_err(&pdev->dev, "failed to get gpr regmap\n");
goto fail;
}
-
- /* set SAI2_MCLK_DIR to enable codec MCLK for imx7d */
- regmap_update_bits(data->gpr, 4, 1<<20, 1<<20);
+ regmap_update_bits(data->gpr, args.args[0], args.args[1], args.args[2]);
}
of_property_read_u32_array(pdev->dev.of_node, "hp-det", data->hp_det, 2);