diff options
author | Timur Tabi <timur@freescale.com> | 2010-08-19 16:26:58 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-08-20 12:19:44 -0400 |
commit | 38fec7272bc033b75a0eb8976c56c2024d371b7d (patch) | |
tree | edde947e89e821a1f66440cf8d82d8e73475c1ab /sound | |
parent | bf557a50f59fc62dfd89fa5bf08c6f5d96fb2f45 (diff) |
ASoC: mpc8610: replace of_device with platform_device
'struct of_device' no longer exists, and its functionality has been merged
into platform_device. Update the MPC8610 HPCD audio drivers (fsl_ssi, fsl_dma,
and mpc8610_hpcd) accordingly.
Also add a #include for slab.h, which is now needed for kmalloc and kfree.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/fsl/fsl_dma.c | 23 | ||||
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 42 | ||||
-rw-r--r-- | sound/soc/fsl/mpc8610_hpcd.c | 10 |
3 files changed, 39 insertions, 36 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index f039e8db0765..4cf98c03af22 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/gfp.h> | 23 | #include <linux/gfp.h> |
24 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
25 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <linux/slab.h> | ||
26 | 27 | ||
27 | #include <sound/core.h> | 28 | #include <sound/core.h> |
28 | #include <sound/pcm.h> | 29 | #include <sound/pcm.h> |
@@ -895,11 +896,11 @@ static struct snd_pcm_ops fsl_dma_ops = { | |||
895 | .pointer = fsl_dma_pointer, | 896 | .pointer = fsl_dma_pointer, |
896 | }; | 897 | }; |
897 | 898 | ||
898 | static int __devinit fsl_soc_dma_probe(struct of_device *of_dev, | 899 | static int __devinit fsl_soc_dma_probe(struct platform_device *pdev, |
899 | const struct of_device_id *match) | 900 | const struct of_device_id *match) |
900 | { | 901 | { |
901 | struct dma_object *dma; | 902 | struct dma_object *dma; |
902 | struct device_node *np = of_dev->dev.of_node; | 903 | struct device_node *np = pdev->dev.of_node; |
903 | struct device_node *ssi_np; | 904 | struct device_node *ssi_np; |
904 | struct resource res; | 905 | struct resource res; |
905 | const uint32_t *iprop; | 906 | const uint32_t *iprop; |
@@ -908,13 +909,13 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev, | |||
908 | /* Find the SSI node that points to us. */ | 909 | /* Find the SSI node that points to us. */ |
909 | ssi_np = find_ssi_node(np); | 910 | ssi_np = find_ssi_node(np); |
910 | if (!ssi_np) { | 911 | if (!ssi_np) { |
911 | dev_err(&of_dev->dev, "cannot find parent SSI node\n"); | 912 | dev_err(&pdev->dev, "cannot find parent SSI node\n"); |
912 | return -ENODEV; | 913 | return -ENODEV; |
913 | } | 914 | } |
914 | 915 | ||
915 | ret = of_address_to_resource(ssi_np, 0, &res); | 916 | ret = of_address_to_resource(ssi_np, 0, &res); |
916 | if (ret) { | 917 | if (ret) { |
917 | dev_err(&of_dev->dev, "could not determine resources for %s\n", | 918 | dev_err(&pdev->dev, "could not determine resources for %s\n", |
918 | ssi_np->full_name); | 919 | ssi_np->full_name); |
919 | of_node_put(ssi_np); | 920 | of_node_put(ssi_np); |
920 | return ret; | 921 | return ret; |
@@ -922,7 +923,7 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev, | |||
922 | 923 | ||
923 | dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL); | 924 | dma = kzalloc(sizeof(*dma) + strlen(np->full_name), GFP_KERNEL); |
924 | if (!dma) { | 925 | if (!dma) { |
925 | dev_err(&of_dev->dev, "could not allocate dma object\n"); | 926 | dev_err(&pdev->dev, "could not allocate dma object\n"); |
926 | of_node_put(ssi_np); | 927 | of_node_put(ssi_np); |
927 | return -ENOMEM; | 928 | return -ENOMEM; |
928 | } | 929 | } |
@@ -945,9 +946,9 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev, | |||
945 | 946 | ||
946 | of_node_put(ssi_np); | 947 | of_node_put(ssi_np); |
947 | 948 | ||
948 | ret = snd_soc_register_platform(&of_dev->dev, &dma->dai); | 949 | ret = snd_soc_register_platform(&pdev->dev, &dma->dai); |
949 | if (ret) { | 950 | if (ret) { |
950 | dev_err(&of_dev->dev, "could not register platform\n"); | 951 | dev_err(&pdev->dev, "could not register platform\n"); |
951 | kfree(dma); | 952 | kfree(dma); |
952 | return ret; | 953 | return ret; |
953 | } | 954 | } |
@@ -955,16 +956,16 @@ static int __devinit fsl_soc_dma_probe(struct of_device *of_dev, | |||
955 | dma->channel = of_iomap(np, 0); | 956 | dma->channel = of_iomap(np, 0); |
956 | dma->irq = irq_of_parse_and_map(np, 0); | 957 | dma->irq = irq_of_parse_and_map(np, 0); |
957 | 958 | ||
958 | dev_set_drvdata(&of_dev->dev, dma); | 959 | dev_set_drvdata(&pdev->dev, dma); |
959 | 960 | ||
960 | return 0; | 961 | return 0; |
961 | } | 962 | } |
962 | 963 | ||
963 | static int __devexit fsl_soc_dma_remove(struct of_device *of_dev) | 964 | static int __devexit fsl_soc_dma_remove(struct platform_device *pdev) |
964 | { | 965 | { |
965 | struct dma_object *dma = dev_get_drvdata(&of_dev->dev); | 966 | struct dma_object *dma = dev_get_drvdata(&pdev->dev); |
966 | 967 | ||
967 | snd_soc_unregister_platform(&of_dev->dev); | 968 | snd_soc_unregister_platform(&pdev->dev); |
968 | iounmap(dma->channel); | 969 | iounmap(dma->channel); |
969 | irq_dispose_mapping(dma->irq); | 970 | irq_dispose_mapping(dma->irq); |
970 | kfree(dma); | 971 | kfree(dma); |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index d1c855ade8fb..4cc167a7aeb8 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -624,13 +624,13 @@ static void make_lowercase(char *s) | |||
624 | } | 624 | } |
625 | } | 625 | } |
626 | 626 | ||
627 | static int __devinit fsl_ssi_probe(struct of_device *of_dev, | 627 | static int __devinit fsl_ssi_probe(struct platform_device *pdev, |
628 | const struct of_device_id *match) | 628 | const struct of_device_id *match) |
629 | { | 629 | { |
630 | struct fsl_ssi_private *ssi_private; | 630 | struct fsl_ssi_private *ssi_private; |
631 | int ret = 0; | 631 | int ret = 0; |
632 | struct device_attribute *dev_attr = NULL; | 632 | struct device_attribute *dev_attr = NULL; |
633 | struct device_node *np = of_dev->dev.of_node; | 633 | struct device_node *np = pdev->dev.of_node; |
634 | const char *p, *sprop; | 634 | const char *p, *sprop; |
635 | const uint32_t *iprop; | 635 | const uint32_t *iprop; |
636 | struct resource res; | 636 | struct resource res; |
@@ -645,14 +645,14 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev, | |||
645 | 645 | ||
646 | /* Check for a codec-handle property. */ | 646 | /* Check for a codec-handle property. */ |
647 | if (!of_get_property(np, "codec-handle", NULL)) { | 647 | if (!of_get_property(np, "codec-handle", NULL)) { |
648 | dev_err(&of_dev->dev, "missing codec-handle property\n"); | 648 | dev_err(&pdev->dev, "missing codec-handle property\n"); |
649 | return -ENODEV; | 649 | return -ENODEV; |
650 | } | 650 | } |
651 | 651 | ||
652 | /* We only support the SSI in "I2S Slave" mode */ | 652 | /* We only support the SSI in "I2S Slave" mode */ |
653 | sprop = of_get_property(np, "fsl,mode", NULL); | 653 | sprop = of_get_property(np, "fsl,mode", NULL); |
654 | if (!sprop || strcmp(sprop, "i2s-slave")) { | 654 | if (!sprop || strcmp(sprop, "i2s-slave")) { |
655 | dev_notice(&of_dev->dev, "mode %s is unsupported\n", sprop); | 655 | dev_notice(&pdev->dev, "mode %s is unsupported\n", sprop); |
656 | return -ENODEV; | 656 | return -ENODEV; |
657 | } | 657 | } |
658 | 658 | ||
@@ -661,7 +661,7 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev, | |||
661 | ssi_private = kzalloc(sizeof(struct fsl_ssi_private) + strlen(p), | 661 | ssi_private = kzalloc(sizeof(struct fsl_ssi_private) + strlen(p), |
662 | GFP_KERNEL); | 662 | GFP_KERNEL); |
663 | if (!ssi_private) { | 663 | if (!ssi_private) { |
664 | dev_err(&of_dev->dev, "could not allocate DAI object\n"); | 664 | dev_err(&pdev->dev, "could not allocate DAI object\n"); |
665 | return -ENOMEM; | 665 | return -ENOMEM; |
666 | } | 666 | } |
667 | 667 | ||
@@ -675,7 +675,7 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev, | |||
675 | /* Get the addresses and IRQ */ | 675 | /* Get the addresses and IRQ */ |
676 | ret = of_address_to_resource(np, 0, &res); | 676 | ret = of_address_to_resource(np, 0, &res); |
677 | if (ret) { | 677 | if (ret) { |
678 | dev_err(&of_dev->dev, "could not determine device resources\n"); | 678 | dev_err(&pdev->dev, "could not determine device resources\n"); |
679 | kfree(ssi_private); | 679 | kfree(ssi_private); |
680 | return ret; | 680 | return ret; |
681 | } | 681 | } |
@@ -703,19 +703,19 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev, | |||
703 | dev_attr->attr.mode = S_IRUGO; | 703 | dev_attr->attr.mode = S_IRUGO; |
704 | dev_attr->show = fsl_sysfs_ssi_show; | 704 | dev_attr->show = fsl_sysfs_ssi_show; |
705 | 705 | ||
706 | ret = device_create_file(&of_dev->dev, dev_attr); | 706 | ret = device_create_file(&pdev->dev, dev_attr); |
707 | if (ret) { | 707 | if (ret) { |
708 | dev_err(&of_dev->dev, "could not create sysfs %s file\n", | 708 | dev_err(&pdev->dev, "could not create sysfs %s file\n", |
709 | ssi_private->dev_attr.attr.name); | 709 | ssi_private->dev_attr.attr.name); |
710 | goto error; | 710 | goto error; |
711 | } | 711 | } |
712 | 712 | ||
713 | /* Register with ASoC */ | 713 | /* Register with ASoC */ |
714 | dev_set_drvdata(&of_dev->dev, ssi_private); | 714 | dev_set_drvdata(&pdev->dev, ssi_private); |
715 | 715 | ||
716 | ret = snd_soc_register_dai(&of_dev->dev, &ssi_private->cpu_dai_drv); | 716 | ret = snd_soc_register_dai(&pdev->dev, &ssi_private->cpu_dai_drv); |
717 | if (ret) { | 717 | if (ret) { |
718 | dev_err(&of_dev->dev, "failed to register DAI: %d\n", ret); | 718 | dev_err(&pdev->dev, "failed to register DAI: %d\n", ret); |
719 | goto error; | 719 | goto error; |
720 | } | 720 | } |
721 | 721 | ||
@@ -733,20 +733,20 @@ static int __devinit fsl_ssi_probe(struct of_device *of_dev, | |||
733 | make_lowercase(name); | 733 | make_lowercase(name); |
734 | 734 | ||
735 | ssi_private->pdev = | 735 | ssi_private->pdev = |
736 | platform_device_register_data(&of_dev->dev, name, 0, NULL, 0); | 736 | platform_device_register_data(&pdev->dev, name, 0, NULL, 0); |
737 | if (IS_ERR(ssi_private->pdev)) { | 737 | if (IS_ERR(ssi_private->pdev)) { |
738 | ret = PTR_ERR(ssi_private->pdev); | 738 | ret = PTR_ERR(ssi_private->pdev); |
739 | dev_err(&of_dev->dev, "failed to register platform: %d\n", ret); | 739 | dev_err(&pdev->dev, "failed to register platform: %d\n", ret); |
740 | goto error; | 740 | goto error; |
741 | } | 741 | } |
742 | 742 | ||
743 | return 0; | 743 | return 0; |
744 | 744 | ||
745 | error: | 745 | error: |
746 | snd_soc_unregister_dai(&of_dev->dev); | 746 | snd_soc_unregister_dai(&pdev->dev); |
747 | dev_set_drvdata(&of_dev->dev, NULL); | 747 | dev_set_drvdata(&pdev->dev, NULL); |
748 | if (dev_attr) | 748 | if (dev_attr) |
749 | device_remove_file(&of_dev->dev, dev_attr); | 749 | device_remove_file(&pdev->dev, dev_attr); |
750 | irq_dispose_mapping(ssi_private->irq); | 750 | irq_dispose_mapping(ssi_private->irq); |
751 | iounmap(ssi_private->ssi); | 751 | iounmap(ssi_private->ssi); |
752 | kfree(ssi_private); | 752 | kfree(ssi_private); |
@@ -754,16 +754,16 @@ error: | |||
754 | return ret; | 754 | return ret; |
755 | } | 755 | } |
756 | 756 | ||
757 | static int fsl_ssi_remove(struct of_device *of_dev) | 757 | static int fsl_ssi_remove(struct platform_device *pdev) |
758 | { | 758 | { |
759 | struct fsl_ssi_private *ssi_private = dev_get_drvdata(&of_dev->dev); | 759 | struct fsl_ssi_private *ssi_private = dev_get_drvdata(&pdev->dev); |
760 | 760 | ||
761 | platform_device_unregister(ssi_private->pdev); | 761 | platform_device_unregister(ssi_private->pdev); |
762 | snd_soc_unregister_dai(&of_dev->dev); | 762 | snd_soc_unregister_dai(&pdev->dev); |
763 | device_remove_file(&of_dev->dev, &ssi_private->dev_attr); | 763 | device_remove_file(&pdev->dev, &ssi_private->dev_attr); |
764 | 764 | ||
765 | kfree(ssi_private); | 765 | kfree(ssi_private); |
766 | dev_set_drvdata(&of_dev->dev, NULL); | 766 | dev_set_drvdata(&pdev->dev, NULL); |
767 | 767 | ||
768 | return 0; | 768 | return 0; |
769 | } | 769 | } |
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c index 38339c158ed9..0d7dcf1e4863 100644 --- a/sound/soc/fsl/mpc8610_hpcd.c +++ b/sound/soc/fsl/mpc8610_hpcd.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
16 | #include <linux/slab.h> | ||
16 | #include <sound/soc.h> | 17 | #include <sound/soc.h> |
17 | #include <asm/fsl_guts.h> | 18 | #include <asm/fsl_guts.h> |
18 | 19 | ||
@@ -323,9 +324,10 @@ static int get_dma_channel(struct device_node *ssi_np, | |||
323 | static int mpc8610_hpcd_probe(struct platform_device *pdev) | 324 | static int mpc8610_hpcd_probe(struct platform_device *pdev) |
324 | { | 325 | { |
325 | struct device *dev = pdev->dev.parent; | 326 | struct device *dev = pdev->dev.parent; |
326 | /* of_dev is the OF device for the SSI node that probed us */ | 327 | /* ssi_pdev is the platform device for the SSI node that probed us */ |
327 | struct of_device *of_dev = container_of(dev, struct of_device, dev); | 328 | struct platform_device *ssi_pdev = |
328 | struct device_node *np = of_dev->dev.of_node; | 329 | container_of(dev, struct platform_device, dev); |
330 | struct device_node *np = ssi_pdev->dev.of_node; | ||
329 | struct device_node *codec_np = NULL; | 331 | struct device_node *codec_np = NULL; |
330 | struct platform_device *sound_device = NULL; | 332 | struct platform_device *sound_device = NULL; |
331 | struct mpc8610_hpcd_data *machine_data; | 333 | struct mpc8610_hpcd_data *machine_data; |
@@ -348,7 +350,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev) | |||
348 | if (!machine_data) | 350 | if (!machine_data) |
349 | return -ENOMEM; | 351 | return -ENOMEM; |
350 | 352 | ||
351 | machine_data->dai[0].cpu_dai_name = dev_name(&of_dev->dev); | 353 | machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); |
352 | machine_data->dai[0].ops = &mpc8610_hpcd_ops; | 354 | machine_data->dai[0].ops = &mpc8610_hpcd_ops; |
353 | 355 | ||
354 | /* Determine the codec name, it will be used as the codec DAI name */ | 356 | /* Determine the codec name, it will be used as the codec DAI name */ |