2 * Copyright (C) ST-Ericsson SA 2012
4 * Author: Ola Lilja (ola.o.lilja@stericsson.com)
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as published
11 * by the Free Software Foundation.
14 #include <asm/mach-types.h>
16 #include <linux/module.h>
18 #include <linux/spi/spi.h>
20 #include <sound/soc.h>
21 #include <sound/initval.h>
23 #include "ux500_pcm.h"
24 #include "ux500_msp_dai.h"
26 #include <mop500_ab8500.h>
28 /* Define the whole MOP500 soundcard, linking platform to the codec-drivers */
29 struct snd_soc_dai_link mop500_dai_links
[] = {
32 .stream_name
= "ab8500_0",
33 .cpu_dai_name
= "ux500-msp-i2s.1",
34 .codec_dai_name
= "ab8500-codec-dai.0",
35 .platform_name
= "ux500-pcm.0",
36 .codec_name
= "ab8500-codec.0",
37 .init
= mop500_ab8500_machine_init
,
38 .ops
= mop500_ab8500_ops
,
42 .stream_name
= "ab8500_1",
43 .cpu_dai_name
= "ux500-msp-i2s.3",
44 .codec_dai_name
= "ab8500-codec-dai.1",
45 .platform_name
= "ux500-pcm.0",
46 .codec_name
= "ab8500-codec.0",
48 .ops
= mop500_ab8500_ops
,
52 static struct snd_soc_card mop500_card
= {
53 .name
= "MOP500-card",
55 .dai_link
= mop500_dai_links
,
56 .num_links
= ARRAY_SIZE(mop500_dai_links
),
59 static int __devinit
mop500_probe(struct platform_device
*pdev
)
63 pr_debug("%s: Enter.\n", __func__
);
65 dev_dbg(&pdev
->dev
, "%s: Enter.\n", __func__
);
67 mop500_card
.dev
= &pdev
->dev
;
69 dev_dbg(&pdev
->dev
, "%s: Card %s: Set platform drvdata.\n",
70 __func__
, mop500_card
.name
);
71 platform_set_drvdata(pdev
, &mop500_card
);
73 snd_soc_card_set_drvdata(&mop500_card
, NULL
);
75 dev_dbg(&pdev
->dev
, "%s: Card %s: num_links = %d\n",
76 __func__
, mop500_card
.name
, mop500_card
.num_links
);
77 dev_dbg(&pdev
->dev
, "%s: Card %s: DAI-link 0: name = %s\n",
78 __func__
, mop500_card
.name
, mop500_card
.dai_link
[0].name
);
79 dev_dbg(&pdev
->dev
, "%s: Card %s: DAI-link 0: stream_name = %s\n",
80 __func__
, mop500_card
.name
,
81 mop500_card
.dai_link
[0].stream_name
);
83 ret
= snd_soc_register_card(&mop500_card
);
86 "Error: snd_soc_register_card failed (%d)!\n",
92 static int __devexit
mop500_remove(struct platform_device
*pdev
)
94 struct snd_soc_card
*mop500_card
= platform_get_drvdata(pdev
);
96 pr_debug("%s: Enter.\n", __func__
);
98 snd_soc_unregister_card(mop500_card
);
99 mop500_ab8500_remove(mop500_card
);
104 static struct platform_driver snd_soc_mop500_driver
= {
106 .owner
= THIS_MODULE
,
107 .name
= "snd-soc-mop500",
109 .probe
= mop500_probe
,
110 .remove
= __devexit_p(mop500_remove
),
113 module_platform_driver(snd_soc_mop500_driver
);