summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuang Chao <chao7.huang@samsung.com>2014-07-31 14:05:52 +0800
committerChanho Park <chanho61.park@samsung.com>2014-08-07 15:17:58 +0900
commita5dc50563bb2724bc6dbec3f3704e81bb56dc4d3 (patch)
treeccf90bbd7d734e7fa273ed74cc9bafcc91de6abd
parente1c53533e917ce95f25323ec1c4cbb4fcdc41d7f (diff)
downloadlinux-3.10-a5dc50563bb2724bc6dbec3f3704e81bb56dc4d3.tar.gz
linux-3.10-a5dc50563bb2724bc6dbec3f3704e81bb56dc4d3.tar.bz2
linux-3.10-a5dc50563bb2724bc6dbec3f3704e81bb56dc4d3.zip
ASoC: odroidx2_max98090: Update odroidx2_audio_probe from upstream
This patch mainly updates the audio probe and remove function from the upstream driver, replace the of_parse_phandle return pointer from the global variables to be local ones. And update the goto error jump symbols. Change-Id: Ie0724f1cc0709f72d4feccda4af60985cb732764 Signed-off-by: Huang Chao <chao7.huang@samsung.com>
-rw-r--r--sound/soc/samsung/odroidx2_max98090.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/sound/soc/samsung/odroidx2_max98090.c b/sound/soc/samsung/odroidx2_max98090.c
index 27355a765b5..ad1f3c8baae 100644
--- a/sound/soc/samsung/odroidx2_max98090.c
+++ b/sound/soc/samsung/odroidx2_max98090.c
@@ -116,21 +116,21 @@ MODULE_DEVICE_TABLE(of, odroidx2_audio_of_match);
static int odroidx2_audio_probe(struct platform_device *pdev)
{
- struct device_node *np = pdev->dev.of_node;
+ struct device_node *snd_node = pdev->dev.of_node;
struct snd_soc_card *card = &odroidx2;
+ struct device_node *i2s_node, *codec_node;
struct odroidx2_drv_data *dd;
const struct of_device_id *of_id;
int ret;
- card->dev = &pdev->dev;
-
- of_id = of_match_node(odroidx2_audio_of_match, np);
+ of_id = of_match_node(odroidx2_audio_of_match, snd_node);
dd = (struct odroidx2_drv_data *)of_id->data;
card->dapm_widgets = dd->dapm_widgets;
card->num_dapm_widgets = dd->num_dapm_widgets;
card->controls = dd->controls;
card->num_controls = dd->num_controls;
+ card->dev = &pdev->dev;
ret = snd_soc_of_parse_card_name(card, "samsung,model");
if (ret < 0)
@@ -140,40 +140,37 @@ static int odroidx2_audio_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
- odroidx2_dai[0].codec_of_node = of_parse_phandle(np,
- "samsung,audio-codec", 0);
- if (!odroidx2_dai[0].codec_of_node) {
+ codec_node = of_parse_phandle(snd_node, "samsung,audio-codec", 0);
+ if (!codec_node) {
dev_err(&pdev->dev,
- "Property 'samsung,audio-codec' missing or invalid\n");
+ "Failed parsing samsung,audio-codec property\n");
return -EINVAL;
}
- odroidx2_dai[0].cpu_of_node = of_parse_phandle(np,
- "samsung,i2s-controller", 0);
- if (!odroidx2_dai[0].cpu_of_node) {
+ i2s_node = of_parse_phandle(snd_node, "samsung,i2s-controller", 0);
+ if (!i2s_node) {
dev_err(&pdev->dev,
- "Property 'samsung,i2s-controller' missing or invalid\n");
+ "Failed parsing samsung,i2s-controller property\n");
ret = -EINVAL;
- goto err_put_cod_n;
+ goto err_put_codec_n;
}
- odroidx2_dai[0].platform_of_node = odroidx2_dai[0].cpu_of_node;
-
- /* Configure the secondary audio interface with the same codec dai */
- odroidx2_dai[1].codec_of_node = odroidx2_dai[0].codec_of_node;
+ odroidx2_dai[0].codec_of_node = codec_node;
+ odroidx2_dai[0].cpu_of_node = i2s_node;
+ odroidx2_dai[0].platform_of_node = i2s_node;
+ odroidx2_dai[1].codec_of_node = codec_node;
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card failed: %d\n", ret);
- goto err_put_cpu_n;
+ goto err_put_i2s_n;
}
-
return 0;
-err_put_cpu_n:
- of_node_put((struct device_node *)odroidx2_dai[0].cpu_of_node);
-err_put_cod_n:
- of_node_put((struct device_node *)odroidx2_dai[0].codec_of_node);
+err_put_i2s_n:
+ of_node_put(i2s_node);
+err_put_codec_n:
+ of_node_put(codec_node);
return ret;
}
@@ -185,6 +182,7 @@ static int odroidx2_audio_remove(struct platform_device *pdev)
of_node_put((struct device_node *)odroidx2_dai[0].cpu_of_node);
of_node_put((struct device_node *)odroidx2_dai[0].codec_of_node);
+ of_node_put((struct device_node *)odroidx2_dai[1].codec_of_node);
return 0;
}