13 #include <linux/module.h>
16 #include <linux/slab.h>
58 struct ccsr_guts __iomem *guts;
60 guts =
ioremap(guts_phys,
sizeof(
struct ccsr_guts));
62 dev_err(card->
dev,
"could not map global utilities\n");
67 guts_set_dmacr(guts, machine_data->
dma_id[0],
69 CCSR_GUTS_DMACR_DEV_SSI);
70 guts_set_dmacr(guts, machine_data->
dma_id[1],
72 CCSR_GUTS_DMACR_DEV_SSI);
74 guts_set_pmuxcr_dma(guts, machine_data->
dma_id[0],
76 guts_set_pmuxcr_dma(guts, machine_data->
dma_id[1],
79 switch (machine_data->
ssi_id) {
81 clrsetbits_be32(&guts->pmuxcr,
82 CCSR_GUTS_PMUXCR_SSI1_MASK, CCSR_GUTS_PMUXCR_SSI1_SSI);
85 clrsetbits_be32(&guts->pmuxcr,
86 CCSR_GUTS_PMUXCR_SSI2_MASK, CCSR_GUTS_PMUXCR_SSI2_SSI);
113 dev_err(dev,
"could not set codec driver audio format\n");
125 dev_err(dev,
"could not set codec driver clock params\n");
138 static int mpc8610_hpcd_machine_remove(
struct snd_soc_card *card)
142 struct ccsr_guts __iomem *guts;
144 guts =
ioremap(guts_phys,
sizeof(
struct ccsr_guts));
146 dev_err(card->
dev,
"could not map global utilities\n");
152 guts_set_dmacr(guts, machine_data->
dma_id[0],
154 guts_set_dmacr(guts, machine_data->
dma_id[1],
157 switch (machine_data->
ssi_id) {
159 clrsetbits_be32(&guts->pmuxcr,
160 CCSR_GUTS_PMUXCR_SSI1_MASK, CCSR_GUTS_PMUXCR_SSI1_LA);
163 clrsetbits_be32(&guts->pmuxcr,
164 CCSR_GUTS_PMUXCR_SSI2_MASK, CCSR_GUTS_PMUXCR_SSI2_LA);
177 .startup = mpc8610_hpcd_startup,
203 dev_err(dev,
"invalid codec node\n");
213 machine_data->
dai[0].cpu_dai_name = dev_name(&ssi_pdev->
dev);
214 machine_data->
dai[0].ops = &mpc8610_hpcd_ops;
217 machine_data->
dai[0].codec_of_node = codec_np;
220 machine_data->
dai[0].codec_dai_name =
"cs4270-hifi";
232 dev_err(&pdev->
dev,
"cell-index property not found\n");
241 dev_err(&pdev->
dev,
"fsl,mode property not found\n");
257 if (!iprop || !*iprop) {
259 "property is missing or invalid\n");
264 }
else if (
strcasecmp(sprop,
"i2s-master") == 0) {
269 }
else if (
strcasecmp(sprop,
"lj-slave") == 0) {
274 }
else if (
strcasecmp(sprop,
"lj-master") == 0) {
279 }
else if (
strcasecmp(sprop,
"rj-slave") == 0) {
284 }
else if (
strcasecmp(sprop,
"rj-master") == 0) {
289 }
else if (
strcasecmp(sprop,
"ac97-slave") == 0) {
294 }
else if (
strcasecmp(sprop,
"ac97-master") == 0) {
301 "unrecognized fsl,mode property '%s'\n", sprop);
307 dev_err(&pdev->
dev,
"unknown clock frequency\n");
315 &machine_data->
dai[0],
317 &machine_data->
dma_id[0]);
319 dev_err(&pdev->
dev,
"missing/invalid playback DMA phandle\n");
326 &machine_data->
dai[1],
328 &machine_data->
dma_id[1]);
330 dev_err(&pdev->
dev,
"missing/invalid capture DMA phandle\n");
335 machine_data->
dai[0].stream_name =
"playback";
336 machine_data->
dai[1].stream_name =
"capture";
337 machine_data->
dai[0].name = machine_data->
dai[0].stream_name;
338 machine_data->
dai[1].name = machine_data->
dai[1].stream_name;
340 machine_data->
card.probe = mpc8610_hpcd_machine_probe;
341 machine_data->
card.remove = mpc8610_hpcd_machine_remove;
342 machine_data->
card.name = pdev->
name;
344 machine_data->
card.dev = &pdev->
dev;
345 machine_data->
card.num_links = 2;
346 machine_data->
card.dai_link = machine_data->
dai;
351 dev_err(&pdev->
dev,
"could not register card\n");
355 of_node_put(codec_np);
362 of_node_put(codec_np);
384 .probe = mpc8610_hpcd_probe,
390 .name =
"snd-soc-mpc8610hpcd",
400 static int __init mpc8610_hpcd_init(
void)
405 pr_info(
"Freescale MPC8610 HPCD ALSA SoC machine driver\n");
410 pr_err(
"mpc8610-hpcd: missing/invalid global utilities node\n");
413 guts_phys =
res.start;
423 static void __exit mpc8610_hpcd_exit(
void)