Lines Matching full:ssc

3  * Atmel SSC driver
14 #include <linux/atmel-ssc.h>
29 struct ssc_device *ssc; in ssc_request() local
32 list_for_each_entry(ssc, &ssc_list, list) { in ssc_request()
33 if (ssc->pdev->dev.of_node) { in ssc_request()
34 if (of_alias_get_id(ssc->pdev->dev.of_node, "ssc") in ssc_request()
36 ssc->pdev->id = ssc_num; in ssc_request()
40 } else if (ssc->pdev->id == ssc_num) { in ssc_request()
48 pr_err("ssc: ssc%d platform device is missing\n", ssc_num); in ssc_request()
52 if (ssc->user) { in ssc_request()
54 dev_dbg(&ssc->pdev->dev, "module busy\n"); in ssc_request()
57 ssc->user++; in ssc_request()
60 clk_prepare(ssc->clk); in ssc_request()
62 return ssc; in ssc_request()
66 void ssc_free(struct ssc_device *ssc) in ssc_free() argument
71 if (ssc->user) in ssc_free()
72 ssc->user--; in ssc_free()
75 dev_dbg(&ssc->pdev->dev, "device already free\n"); in ssc_free()
80 clk_unprepare(ssc->clk); in ssc_free()
117 .compatible = "atmel,at91rm9200-ssc",
120 .compatible = "atmel,at91sam9rl-ssc",
123 .compatible = "atmel,at91sam9g45-ssc",
148 static int ssc_sound_dai_probe(struct ssc_device *ssc) in ssc_sound_dai_probe() argument
150 struct device_node *np = ssc->pdev->dev.of_node; in ssc_sound_dai_probe()
154 ssc->sound_dai = false; in ssc_sound_dai_probe()
159 id = of_alias_get_id(np, "ssc"); in ssc_sound_dai_probe()
164 ssc->sound_dai = !ret; in ssc_sound_dai_probe()
169 static void ssc_sound_dai_remove(struct ssc_device *ssc) in ssc_sound_dai_remove() argument
171 if (!ssc->sound_dai) in ssc_sound_dai_remove()
174 atmel_ssc_put_audio(of_alias_get_id(ssc->pdev->dev.of_node, "ssc")); in ssc_sound_dai_remove()
177 static inline int ssc_sound_dai_probe(struct ssc_device *ssc) in ssc_sound_dai_probe() argument
179 if (of_property_read_bool(ssc->pdev->dev.of_node, "#sound-dai-cells")) in ssc_sound_dai_probe()
185 static inline void ssc_sound_dai_remove(struct ssc_device *ssc) in ssc_sound_dai_remove() argument
193 struct ssc_device *ssc; in ssc_probe() local
196 ssc = devm_kzalloc(&pdev->dev, sizeof(struct ssc_device), GFP_KERNEL); in ssc_probe()
197 if (!ssc) { in ssc_probe()
202 ssc->pdev = pdev; in ssc_probe()
207 ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat; in ssc_probe()
211 ssc->clk_from_rk_pin = in ssc_probe()
215 ssc->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &regs); in ssc_probe()
216 if (IS_ERR(ssc->regs)) in ssc_probe()
217 return PTR_ERR(ssc->regs); in ssc_probe()
219 ssc->phybase = regs->start; in ssc_probe()
221 ssc->clk = devm_clk_get(&pdev->dev, "pclk"); in ssc_probe()
222 if (IS_ERR(ssc->clk)) { in ssc_probe()
228 clk_prepare_enable(ssc->clk); in ssc_probe()
229 ssc_writel(ssc->regs, IDR, -1); in ssc_probe()
230 ssc_readl(ssc->regs, SR); in ssc_probe()
231 clk_disable_unprepare(ssc->clk); in ssc_probe()
233 ssc->irq = platform_get_irq(pdev, 0); in ssc_probe()
234 if (ssc->irq < 0) { in ssc_probe()
236 return ssc->irq; in ssc_probe()
240 list_add_tail(&ssc->list, &ssc_list); in ssc_probe()
243 platform_set_drvdata(pdev, ssc); in ssc_probe()
245 dev_info(&pdev->dev, "Atmel SSC device at 0x%p (irq %d)\n", in ssc_probe()
246 ssc->regs, ssc->irq); in ssc_probe()
248 if (ssc_sound_dai_probe(ssc)) in ssc_probe()
249 dev_err(&pdev->dev, "failed to auto-setup ssc for audio\n"); in ssc_probe()
256 struct ssc_device *ssc = platform_get_drvdata(pdev); in ssc_remove() local
258 ssc_sound_dai_remove(ssc); in ssc_remove()
261 list_del(&ssc->list); in ssc_remove()
267 .name = "ssc",
277 MODULE_DESCRIPTION("SSC driver for Atmel AT91");
279 MODULE_ALIAS("platform:ssc");