mop500.c (9c3f9e281697d02889c3b08922f3b30be75f56c2) | mop500.c (1428c20f7c38e9fbf59923d1b9615ebdaf2862b7) |
---|---|
1/* 2 * Copyright (C) ST-Ericsson SA 2012 3 * 4 * Author: Ola Lilja (ola.o.lilja@stericsson.com) 5 * for ST-Ericsson. 6 * 7 * License terms: 8 * --- 19 unchanged lines hidden (view full) --- 28 29/* Define the whole MOP500 soundcard, linking platform to the codec-drivers */ 30struct snd_soc_dai_link mop500_dai_links[] = { 31 { 32 .name = "ab8500_0", 33 .stream_name = "ab8500_0", 34 .cpu_dai_name = "ux500-msp-i2s.1", 35 .codec_dai_name = "ab8500-codec-dai.0", | 1/* 2 * Copyright (C) ST-Ericsson SA 2012 3 * 4 * Author: Ola Lilja (ola.o.lilja@stericsson.com) 5 * for ST-Ericsson. 6 * 7 * License terms: 8 * --- 19 unchanged lines hidden (view full) --- 28 29/* Define the whole MOP500 soundcard, linking platform to the codec-drivers */ 30struct snd_soc_dai_link mop500_dai_links[] = { 31 { 32 .name = "ab8500_0", 33 .stream_name = "ab8500_0", 34 .cpu_dai_name = "ux500-msp-i2s.1", 35 .codec_dai_name = "ab8500-codec-dai.0", |
36 .platform_name = "ux500-pcm.0", | 36 .platform_name = "ux500-msp-i2s.1", |
37 .codec_name = "ab8500-codec.0", 38 .init = mop500_ab8500_machine_init, 39 .ops = mop500_ab8500_ops, 40 }, 41 { 42 .name = "ab8500_1", 43 .stream_name = "ab8500_1", 44 .cpu_dai_name = "ux500-msp-i2s.3", 45 .codec_dai_name = "ab8500-codec-dai.1", | 37 .codec_name = "ab8500-codec.0", 38 .init = mop500_ab8500_machine_init, 39 .ops = mop500_ab8500_ops, 40 }, 41 { 42 .name = "ab8500_1", 43 .stream_name = "ab8500_1", 44 .cpu_dai_name = "ux500-msp-i2s.3", 45 .codec_dai_name = "ab8500-codec-dai.1", |
46 .platform_name = "ux500-pcm.0", | 46 .platform_name = "ux500-msp-i2s.3", |
47 .codec_name = "ab8500-codec.0", 48 .init = NULL, 49 .ops = mop500_ab8500_ops, 50 }, 51}; 52 53static struct snd_soc_card mop500_card = { 54 .name = "MOP500-card", 55 .probe = NULL, 56 .dai_link = mop500_dai_links, 57 .num_links = ARRAY_SIZE(mop500_dai_links), 58}; 59 | 47 .codec_name = "ab8500-codec.0", 48 .init = NULL, 49 .ops = mop500_ab8500_ops, 50 }, 51}; 52 53static struct snd_soc_card mop500_card = { 54 .name = "MOP500-card", 55 .probe = NULL, 56 .dai_link = mop500_dai_links, 57 .num_links = ARRAY_SIZE(mop500_dai_links), 58}; 59 |
60static void mop500_of_node_put(void) 61{ 62 int i; 63 64 for (i = 0; i < 2; i++) { 65 if (mop500_dai_links[i].cpu_of_node) 66 of_node_put((struct device_node *) 67 mop500_dai_links[i].cpu_of_node); 68 if (mop500_dai_links[i].codec_of_node) 69 of_node_put((struct device_node *) 70 mop500_dai_links[i].codec_of_node); 71 } 72} 73 | |
74static int __devinit mop500_of_probe(struct platform_device *pdev, 75 struct device_node *np) 76{ 77 struct device_node *codec_np, *msp_np[2]; 78 int i; 79 80 msp_np[0] = of_parse_phandle(np, "stericsson,cpu-dai", 0); 81 msp_np[1] = of_parse_phandle(np, "stericsson,cpu-dai", 1); 82 codec_np = of_parse_phandle(np, "stericsson,audio-codec", 0); 83 84 if (!(msp_np[0] && msp_np[1] && codec_np)) { 85 dev_err(&pdev->dev, "Phandle missing or invalid\n"); | 60static int __devinit mop500_of_probe(struct platform_device *pdev, 61 struct device_node *np) 62{ 63 struct device_node *codec_np, *msp_np[2]; 64 int i; 65 66 msp_np[0] = of_parse_phandle(np, "stericsson,cpu-dai", 0); 67 msp_np[1] = of_parse_phandle(np, "stericsson,cpu-dai", 1); 68 codec_np = of_parse_phandle(np, "stericsson,audio-codec", 0); 69 70 if (!(msp_np[0] && msp_np[1] && codec_np)) { 71 dev_err(&pdev->dev, "Phandle missing or invalid\n"); |
86 mop500_of_node_put(); | |
87 return -EINVAL; 88 } 89 90 for (i = 0; i < 2; i++) { 91 mop500_dai_links[i].cpu_of_node = msp_np[i]; 92 mop500_dai_links[i].cpu_dai_name = NULL; 93 mop500_dai_links[i].codec_of_node = codec_np; 94 mop500_dai_links[i].codec_name = NULL; 95 } 96 97 snd_soc_of_parse_card_name(&mop500_card, "stericsson,card-name"); 98 99 return 0; 100} | 72 return -EINVAL; 73 } 74 75 for (i = 0; i < 2; i++) { 76 mop500_dai_links[i].cpu_of_node = msp_np[i]; 77 mop500_dai_links[i].cpu_dai_name = NULL; 78 mop500_dai_links[i].codec_of_node = codec_np; 79 mop500_dai_links[i].codec_name = NULL; 80 } 81 82 snd_soc_of_parse_card_name(&mop500_card, "stericsson,card-name"); 83 84 return 0; 85} |
101 | |
102static int __devinit mop500_probe(struct platform_device *pdev) 103{ 104 struct device_node *np = pdev->dev.of_node; 105 int ret; 106 107 dev_dbg(&pdev->dev, "%s: Enter.\n", __func__); 108 109 mop500_card.dev = &pdev->dev; --- 29 unchanged lines hidden (view full) --- 139static int __devexit mop500_remove(struct platform_device *pdev) 140{ 141 struct snd_soc_card *mop500_card = platform_get_drvdata(pdev); 142 143 pr_debug("%s: Enter.\n", __func__); 144 145 snd_soc_unregister_card(mop500_card); 146 mop500_ab8500_remove(mop500_card); | 86static int __devinit mop500_probe(struct platform_device *pdev) 87{ 88 struct device_node *np = pdev->dev.of_node; 89 int ret; 90 91 dev_dbg(&pdev->dev, "%s: Enter.\n", __func__); 92 93 mop500_card.dev = &pdev->dev; --- 29 unchanged lines hidden (view full) --- 123static int __devexit mop500_remove(struct platform_device *pdev) 124{ 125 struct snd_soc_card *mop500_card = platform_get_drvdata(pdev); 126 127 pr_debug("%s: Enter.\n", __func__); 128 129 snd_soc_unregister_card(mop500_card); 130 mop500_ab8500_remove(mop500_card); |
147 mop500_of_node_put(); | |
148 149 return 0; 150} 151 152static const struct of_device_id snd_soc_mop500_match[] = { 153 { .compatible = "stericsson,snd-soc-mop500", }, 154 {}, 155}; --- 12 unchanged lines hidden --- | 131 132 return 0; 133} 134 135static const struct of_device_id snd_soc_mop500_match[] = { 136 { .compatible = "stericsson,snd-soc-mop500", }, 137 {}, 138}; --- 12 unchanged lines hidden --- |