diff options
author | Nicolin Chen <Guangyu.Chen@freescale.com> | 2014-04-08 07:13:15 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:58:18 -0400 |
commit | b6fca438dde1b4c0bbdee31729871d601f287dc9 (patch) | |
tree | 4cfb7fdda1e5607cbddf8963739afbd9221e1f00 /sound/soc/fsl | |
parent | 8ecd9158728b846e2c13c7d81d33b4b277df1067 (diff) |
ENGR00307635-5 ASoC: imx-wm8962: Add non-SSI cpu dai support
The current imx-wm8962 machine driver is designed for SSI as CPU DAI only
while as its name we should make the driver more generic to any other CPU
DAI on i.MX serires -- ESAI, SAI for example.
So this patch makes the driver more general so as to support those non-SSI
cases.
Acked-by: Wang Shengjiu <b02247@freescale.com>
Signed-off-by: Nicolin Chen <Guangyu.Chen@freescale.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/imx-wm8962.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index 2776a08370c0..66cb2df64032 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c | |||
@@ -386,8 +386,8 @@ static int imx_wm8962_late_probe(struct snd_soc_card *card) | |||
386 | static int imx_wm8962_probe(struct platform_device *pdev) | 386 | static int imx_wm8962_probe(struct platform_device *pdev) |
387 | { | 387 | { |
388 | struct device_node *np = pdev->dev.of_node; | 388 | struct device_node *np = pdev->dev.of_node; |
389 | struct device_node *ssi_np, *codec_np; | 389 | struct device_node *cpu_np, *codec_np; |
390 | struct platform_device *ssi_pdev; | 390 | struct platform_device *cpu_pdev; |
391 | struct imx_priv *priv = &card_priv; | 391 | struct imx_priv *priv = &card_priv; |
392 | struct i2c_client *codec_dev; | 392 | struct i2c_client *codec_dev; |
393 | struct imx_wm8962_data *data; | 393 | struct imx_wm8962_data *data; |
@@ -397,6 +397,16 @@ static int imx_wm8962_probe(struct platform_device *pdev) | |||
397 | 397 | ||
398 | priv->pdev = pdev; | 398 | priv->pdev = pdev; |
399 | 399 | ||
400 | cpu_np = of_parse_phandle(pdev->dev.of_node, "cpu-dai", 0); | ||
401 | if (!cpu_np) { | ||
402 | dev_err(&pdev->dev, "cpu dai phandle missing or invalid\n"); | ||
403 | ret = -EINVAL; | ||
404 | goto fail; | ||
405 | } | ||
406 | |||
407 | if (!strstr(cpu_np->name, "ssi")) | ||
408 | goto audmux_bypass; | ||
409 | |||
400 | ret = of_property_read_u32(np, "mux-int-port", &int_port); | 410 | ret = of_property_read_u32(np, "mux-int-port", &int_port); |
401 | if (ret) { | 411 | if (ret) { |
402 | dev_err(&pdev->dev, "mux-int-port missing or invalid\n"); | 412 | dev_err(&pdev->dev, "mux-int-port missing or invalid\n"); |
@@ -433,16 +443,16 @@ static int imx_wm8962_probe(struct platform_device *pdev) | |||
433 | return ret; | 443 | return ret; |
434 | } | 444 | } |
435 | 445 | ||
436 | ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0); | 446 | audmux_bypass: |
437 | codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); | 447 | codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); |
438 | if (!ssi_np || !codec_np) { | 448 | if (!codec_np) { |
439 | dev_err(&pdev->dev, "phandle missing or invalid\n"); | 449 | dev_err(&pdev->dev, "phandle missing or invalid\n"); |
440 | ret = -EINVAL; | 450 | ret = -EINVAL; |
441 | goto fail; | 451 | goto fail; |
442 | } | 452 | } |
443 | 453 | ||
444 | ssi_pdev = of_find_device_by_node(ssi_np); | 454 | cpu_pdev = of_find_device_by_node(cpu_np); |
445 | if (!ssi_pdev) { | 455 | if (!cpu_pdev) { |
446 | dev_err(&pdev->dev, "failed to find SSI platform device\n"); | 456 | dev_err(&pdev->dev, "failed to find SSI platform device\n"); |
447 | ret = -EINVAL; | 457 | ret = -EINVAL; |
448 | goto fail; | 458 | goto fail; |
@@ -484,8 +494,8 @@ static int imx_wm8962_probe(struct platform_device *pdev) | |||
484 | data->dai.stream_name = "HiFi"; | 494 | data->dai.stream_name = "HiFi"; |
485 | data->dai.codec_dai_name = "wm8962"; | 495 | data->dai.codec_dai_name = "wm8962"; |
486 | data->dai.codec_of_node = codec_np; | 496 | data->dai.codec_of_node = codec_np; |
487 | data->dai.cpu_dai_name = dev_name(&ssi_pdev->dev); | 497 | data->dai.cpu_dai_name = dev_name(&cpu_pdev->dev); |
488 | data->dai.platform_of_node = ssi_np; | 498 | data->dai.platform_of_node = cpu_np; |
489 | data->dai.ops = &imx_hifi_ops; | 499 | data->dai.ops = &imx_hifi_ops; |
490 | data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | 500 | data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
491 | SND_SOC_DAIFMT_CBM_CFM; | 501 | SND_SOC_DAIFMT_CBM_CFM; |
@@ -544,8 +554,8 @@ fail_mic: | |||
544 | fail_hp: | 554 | fail_hp: |
545 | snd_soc_unregister_card(&data->card); | 555 | snd_soc_unregister_card(&data->card); |
546 | fail: | 556 | fail: |
547 | if (ssi_np) | 557 | if (cpu_np) |
548 | of_node_put(ssi_np); | 558 | of_node_put(cpu_np); |
549 | if (codec_np) | 559 | if (codec_np) |
550 | of_node_put(codec_np); | 560 | of_node_put(codec_np); |
551 | 561 | ||