~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/fsl/pcm030-audio-fabric.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/soc/fsl/pcm030-audio-fabric.c (Version linux-6.11-rc3) and /sound/soc/fsl/pcm030-audio-fabric.c (Version linux-5.10.223)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 //                                                  2 //
  3 // Phytec pcm030 driver for the PSC of the Fre      3 // Phytec pcm030 driver for the PSC of the Freescale MPC52xx
  4 // configured as AC97 interface                     4 // configured as AC97 interface
  5 //                                                  5 //
  6 // Copyright 2008 Jon Smirl, Digispeaker            6 // Copyright 2008 Jon Smirl, Digispeaker
  7 // Author: Jon Smirl <jonsmirl@gmail.com>           7 // Author: Jon Smirl <jonsmirl@gmail.com>
  8                                                     8 
  9 #include <linux/init.h>                             9 #include <linux/init.h>
 10 #include <linux/module.h>                          10 #include <linux/module.h>
 11 #include <linux/device.h>                          11 #include <linux/device.h>
 12 #include <linux/of.h>                          !!  12 #include <linux/of_device.h>
                                                   >>  13 #include <linux/of_platform.h>
 13                                                    14 
 14 #include <sound/soc.h>                             15 #include <sound/soc.h>
 15                                                    16 
 16 #include "mpc5200_dma.h"                           17 #include "mpc5200_dma.h"
 17                                                    18 
 18 #define DRV_NAME "pcm030-audio-fabric"             19 #define DRV_NAME "pcm030-audio-fabric"
 19                                                    20 
 20 struct pcm030_audio_data {                         21 struct pcm030_audio_data {
 21         struct snd_soc_card *card;                 22         struct snd_soc_card *card;
 22         struct platform_device *codec_device;      23         struct platform_device *codec_device;
 23 };                                                 24 };
 24                                                    25 
 25 SND_SOC_DAILINK_DEFS(analog,                       26 SND_SOC_DAILINK_DEFS(analog,
 26         DAILINK_COMP_ARRAY(COMP_CPU("mpc5200-p     27         DAILINK_COMP_ARRAY(COMP_CPU("mpc5200-psc-ac97.0")),
 27         DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-     28         DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-hifi")),
 28         DAILINK_COMP_ARRAY(COMP_EMPTY()));         29         DAILINK_COMP_ARRAY(COMP_EMPTY()));
 29                                                    30 
 30 SND_SOC_DAILINK_DEFS(iec958,                       31 SND_SOC_DAILINK_DEFS(iec958,
 31         DAILINK_COMP_ARRAY(COMP_CPU("mpc5200-p     32         DAILINK_COMP_ARRAY(COMP_CPU("mpc5200-psc-ac97.1")),
 32         DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-     33         DAILINK_COMP_ARRAY(COMP_CODEC("wm9712-codec", "wm9712-aux")),
 33         DAILINK_COMP_ARRAY(COMP_EMPTY()));         34         DAILINK_COMP_ARRAY(COMP_EMPTY()));
 34                                                    35 
 35 static struct snd_soc_dai_link pcm030_fabric_d     36 static struct snd_soc_dai_link pcm030_fabric_dai[] = {
 36 {                                                  37 {
 37         .name = "AC97.0",                          38         .name = "AC97.0",
 38         .stream_name = "AC97 Analog",              39         .stream_name = "AC97 Analog",
 39         SND_SOC_DAILINK_REG(analog),               40         SND_SOC_DAILINK_REG(analog),
 40 },                                                 41 },
 41 {                                                  42 {
 42         .name = "AC97.1",                          43         .name = "AC97.1",
 43         .stream_name = "AC97 IEC958",              44         .stream_name = "AC97 IEC958",
 44         SND_SOC_DAILINK_REG(iec958),               45         SND_SOC_DAILINK_REG(iec958),
 45 },                                                 46 },
 46 };                                                 47 };
 47                                                    48 
 48 static struct snd_soc_card pcm030_card = {         49 static struct snd_soc_card pcm030_card = {
 49         .name = "pcm030",                          50         .name = "pcm030",
 50         .owner = THIS_MODULE,                      51         .owner = THIS_MODULE,
 51         .dai_link = pcm030_fabric_dai,             52         .dai_link = pcm030_fabric_dai,
 52         .num_links = ARRAY_SIZE(pcm030_fabric_     53         .num_links = ARRAY_SIZE(pcm030_fabric_dai),
 53 };                                                 54 };
 54                                                    55 
 55 static int pcm030_fabric_probe(struct platform     56 static int pcm030_fabric_probe(struct platform_device *op)
 56 {                                                  57 {
 57         struct device_node *np = op->dev.of_no     58         struct device_node *np = op->dev.of_node;
 58         struct device_node *platform_np;           59         struct device_node *platform_np;
 59         struct snd_soc_card *card = &pcm030_ca     60         struct snd_soc_card *card = &pcm030_card;
 60         struct pcm030_audio_data *pdata;           61         struct pcm030_audio_data *pdata;
 61         struct snd_soc_dai_link *dai_link;         62         struct snd_soc_dai_link *dai_link;
 62         int ret;                                   63         int ret;
 63         int i;                                     64         int i;
 64                                                    65 
 65         if (!of_machine_is_compatible("phytec,     66         if (!of_machine_is_compatible("phytec,pcm030"))
 66                 return -ENODEV;                    67                 return -ENODEV;
 67                                                    68 
 68         pdata = devm_kzalloc(&op->dev, sizeof(     69         pdata = devm_kzalloc(&op->dev, sizeof(struct pcm030_audio_data),
 69                              GFP_KERNEL);          70                              GFP_KERNEL);
 70         if (!pdata)                                71         if (!pdata)
 71                 return -ENOMEM;                    72                 return -ENOMEM;
 72                                                    73 
 73         card->dev = &op->dev;                      74         card->dev = &op->dev;
 74                                                    75 
 75         pdata->card = card;                        76         pdata->card = card;
 76                                                    77 
 77         platform_np = of_parse_phandle(np, "as     78         platform_np = of_parse_phandle(np, "asoc-platform", 0);
 78         if (!platform_np) {                        79         if (!platform_np) {
 79                 dev_err(&op->dev, "ac97 not re     80                 dev_err(&op->dev, "ac97 not registered\n");
 80                 return -ENODEV;                    81                 return -ENODEV;
 81         }                                          82         }
 82                                                    83 
 83         for_each_card_prelinks(card, i, dai_li     84         for_each_card_prelinks(card, i, dai_link)
 84                 dai_link->platforms->of_node =     85                 dai_link->platforms->of_node = platform_np;
 85                                                    86 
 86         ret = request_module("snd-soc-wm9712")     87         ret = request_module("snd-soc-wm9712");
 87         if (ret)                                   88         if (ret)
 88                 dev_err(&op->dev, "request_mod     89                 dev_err(&op->dev, "request_module returned: %d\n", ret);
 89                                                    90 
 90         pdata->codec_device = platform_device_     91         pdata->codec_device = platform_device_alloc("wm9712-codec", -1);
 91         if (!pdata->codec_device)                  92         if (!pdata->codec_device)
 92                 dev_err(&op->dev, "platform_de     93                 dev_err(&op->dev, "platform_device_alloc() failed\n");
 93                                                    94 
 94         ret = platform_device_add(pdata->codec     95         ret = platform_device_add(pdata->codec_device);
 95         if (ret) {                                 96         if (ret) {
 96                 dev_err(&op->dev, "platform_de     97                 dev_err(&op->dev, "platform_device_add() failed: %d\n", ret);
 97                 platform_device_put(pdata->cod     98                 platform_device_put(pdata->codec_device);
 98         }                                          99         }
 99                                                   100 
100         ret = snd_soc_register_card(card);        101         ret = snd_soc_register_card(card);
101         if (ret) {                                102         if (ret) {
102                 dev_err(&op->dev, "snd_soc_reg    103                 dev_err(&op->dev, "snd_soc_register_card() failed: %d\n", ret);
103                 platform_device_unregister(pda !! 104                 platform_device_del(pdata->codec_device);
                                                   >> 105                 platform_device_put(pdata->codec_device);
104         }                                         106         }
105                                                   107 
106         platform_set_drvdata(op, pdata);          108         platform_set_drvdata(op, pdata);
107         return ret;                               109         return ret;
108                                                   110 
109 }                                                 111 }
110                                                   112 
111 static void pcm030_fabric_remove(struct platfo !! 113 static int pcm030_fabric_remove(struct platform_device *op)
112 {                                                 114 {
113         struct pcm030_audio_data *pdata = plat    115         struct pcm030_audio_data *pdata = platform_get_drvdata(op);
                                                   >> 116         int ret;
114                                                   117 
115         snd_soc_unregister_card(pdata->card);  !! 118         ret = snd_soc_unregister_card(pdata->card);
116         platform_device_unregister(pdata->code    119         platform_device_unregister(pdata->codec_device);
                                                   >> 120 
                                                   >> 121         return ret;
117 }                                                 122 }
118                                                   123 
119 static const struct of_device_id pcm030_audio_    124 static const struct of_device_id pcm030_audio_match[] = {
120         { .compatible = "phytec,pcm030-audio-f    125         { .compatible = "phytec,pcm030-audio-fabric", },
121         {}                                        126         {}
122 };                                                127 };
123 MODULE_DEVICE_TABLE(of, pcm030_audio_match);      128 MODULE_DEVICE_TABLE(of, pcm030_audio_match);
124                                                   129 
125 static struct platform_driver pcm030_fabric_dr    130 static struct platform_driver pcm030_fabric_driver = {
126         .probe          = pcm030_fabric_probe,    131         .probe          = pcm030_fabric_probe,
127         .remove_new     = pcm030_fabric_remove !! 132         .remove         = pcm030_fabric_remove,
128         .driver         = {                       133         .driver         = {
129                 .name   = DRV_NAME,               134                 .name   = DRV_NAME,
130                 .of_match_table    = pcm030_au    135                 .of_match_table    = pcm030_audio_match,
131         },                                        136         },
132 };                                                137 };
133                                                   138 
134 module_platform_driver(pcm030_fabric_driver);     139 module_platform_driver(pcm030_fabric_driver);
135                                                   140 
136                                                   141 
137 MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"    142 MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
138 MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030     143 MODULE_DESCRIPTION(DRV_NAME ": mpc5200 pcm030 fabric driver");
139 MODULE_LICENSE("GPL");                            144 MODULE_LICENSE("GPL");
140                                                   145 
141                                                   146 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php