aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-01-23 20:09:02 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-01-25 10:15:24 -0500
commit3f25c9ccb7409e6f61c11e7828c0ddb54ab1cb7b (patch)
treefe370fad65d0cdaf31884af905c9d7fdc04da682
parent3d23c73fa0a47e8aecd2a4d8f280f45f6f7611a1 (diff)
ASoC: sh: fsi-hdmi: Add FSI port and HDMI selection
This patch add platform_device_id which can control PortA/PortB for FSI2-HDMI from platform data. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c5
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c5
-rw-r--r--sound/soc/sh/fsi-hdmi.c66
3 files changed, 71 insertions, 5 deletions
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index d503a74e30e4..920ed81f1c61 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -781,6 +781,10 @@ static struct platform_device hdmi_device = {
781 }, 781 },
782}; 782};
783 783
784static struct platform_device fsi_hdmi_device = {
785 .name = "sh_fsi2_b_hdmi",
786};
787
784static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq, 788static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
785 unsigned long *parent_freq) 789 unsigned long *parent_freq)
786{ 790{
@@ -934,6 +938,7 @@ static struct platform_device *ap4evb_devices[] __initdata = {
934 &usb1_host_device, 938 &usb1_host_device,
935 &fsi_device, 939 &fsi_device,
936 &fsi_ak4643_device, 940 &fsi_ak4643_device,
941 &fsi_hdmi_device,
937 &sh_mmcif_device, 942 &sh_mmcif_device,
938 &lcdc1_device, 943 &lcdc1_device,
939 &lcdc_device, 944 &lcdc_device,
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 425962d5b29c..aa4bcc347044 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -400,6 +400,10 @@ static struct platform_device hdmi_device = {
400 }, 400 },
401}; 401};
402 402
403static struct platform_device fsi_hdmi_device = {
404 .name = "sh_fsi2_b_hdmi",
405};
406
403static int __init hdmi_init_pm_clock(void) 407static int __init hdmi_init_pm_clock(void)
404{ 408{
405 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick"); 409 struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
@@ -920,6 +924,7 @@ static struct platform_device *mackerel_devices[] __initdata = {
920 &leds_device, 924 &leds_device,
921 &fsi_device, 925 &fsi_device,
922 &fsi_ak4643_device, 926 &fsi_ak4643_device,
927 &fsi_hdmi_device,
923 &sdhi0_device, 928 &sdhi0_device,
924#if !defined(CONFIG_MMC_SH_MMCIF) 929#if !defined(CONFIG_MMC_SH_MMCIF)
925 &sdhi1_device, 930 &sdhi1_device,
diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c
index 96d8ce3f3211..9719985eb82d 100644
--- a/sound/soc/sh/fsi-hdmi.c
+++ b/sound/soc/sh/fsi-hdmi.c
@@ -12,6 +12,12 @@
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <sound/sh_fsi.h> 13#include <sound/sh_fsi.h>
14 14
15struct fsi_hdmi_data {
16 const char *cpu_dai;
17 const char *card;
18 int id;
19};
20
15static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd) 21static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd)
16{ 22{
17 struct snd_soc_dai *cpu = rtd->cpu_dai; 23 struct snd_soc_dai *cpu = rtd->cpu_dai;
@@ -25,7 +31,6 @@ static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd)
25static struct snd_soc_dai_link fsi_dai_link = { 31static struct snd_soc_dai_link fsi_dai_link = {
26 .name = "HDMI", 32 .name = "HDMI",
27 .stream_name = "HDMI", 33 .stream_name = "HDMI",
28 .cpu_dai_name = "fsib-dai", /* fsi B */
29 .codec_dai_name = "sh_mobile_hdmi-hifi", 34 .codec_dai_name = "sh_mobile_hdmi-hifi",
30 .platform_name = "sh_fsi2", 35 .platform_name = "sh_fsi2",
31 .codec_name = "sh-mobile-hdmi", 36 .codec_name = "sh-mobile-hdmi",
@@ -33,21 +38,33 @@ static struct snd_soc_dai_link fsi_dai_link = {
33}; 38};
34 39
35static struct snd_soc_card fsi_soc_card = { 40static struct snd_soc_card fsi_soc_card = {
36 .name = "FSI (SH MOBILE HDMI)",
37 .dai_link = &fsi_dai_link, 41 .dai_link = &fsi_dai_link,
38 .num_links = 1, 42 .num_links = 1,
39}; 43};
40 44
41static struct platform_device *fsi_snd_device; 45static struct platform_device *fsi_snd_device;
42 46
43static int __init fsi_hdmi_init(void) 47static int fsi_hdmi_probe(struct platform_device *pdev)
44{ 48{
45 int ret = -ENOMEM; 49 int ret = -ENOMEM;
50 const struct platform_device_id *id_entry;
51 struct fsi_hdmi_data *pdata;
46 52
47 fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B); 53 id_entry = pdev->id_entry;
54 if (!id_entry) {
55 dev_err(&pdev->dev, "unknown fsi hdmi\n");
56 return -ENODEV;
57 }
58
59 pdata = (struct fsi_hdmi_data *)id_entry->driver_data;
60
61 fsi_snd_device = platform_device_alloc("soc-audio", pdata->id);
48 if (!fsi_snd_device) 62 if (!fsi_snd_device)
49 goto out; 63 goto out;
50 64
65 fsi_dai_link.cpu_dai_name = pdata->cpu_dai;
66 fsi_soc_card.name = pdata->card;
67
51 platform_set_drvdata(fsi_snd_device, &fsi_soc_card); 68 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
52 ret = platform_device_add(fsi_snd_device); 69 ret = platform_device_add(fsi_snd_device);
53 70
@@ -58,9 +75,48 @@ out:
58 return ret; 75 return ret;
59} 76}
60 77
61static void __exit fsi_hdmi_exit(void) 78static int fsi_hdmi_remove(struct platform_device *pdev)
62{ 79{
63 platform_device_unregister(fsi_snd_device); 80 platform_device_unregister(fsi_snd_device);
81 return 0;
82}
83
84static struct fsi_hdmi_data fsi2_a_hdmi = {
85 .cpu_dai = "fsia-dai",
86 .card = "FSI2A (SH MOBILE HDMI)",
87 .id = FSI_PORT_A,
88};
89
90static struct fsi_hdmi_data fsi2_b_hdmi = {
91 .cpu_dai = "fsib-dai",
92 .card = "FSI2B (SH MOBILE HDMI)",
93 .id = FSI_PORT_B,
94};
95
96static struct platform_device_id fsi_id_table[] = {
97 /* FSI 2 */
98 { "sh_fsi2_a_hdmi", (kernel_ulong_t)&fsi2_a_hdmi },
99 { "sh_fsi2_b_hdmi", (kernel_ulong_t)&fsi2_b_hdmi },
100 {},
101};
102
103static struct platform_driver fsi_hdmi = {
104 .driver = {
105 .name = "fsi-hdmi-audio",
106 },
107 .probe = fsi_hdmi_probe,
108 .remove = fsi_hdmi_remove,
109 .id_table = fsi_id_table,
110};
111
112static int __init fsi_hdmi_init(void)
113{
114 return platform_driver_register(&fsi_hdmi);
115}
116
117static void __exit fsi_hdmi_exit(void)
118{
119 platform_driver_unregister(&fsi_hdmi);
64} 120}
65 121
66module_init(fsi_hdmi_init); 122module_init(fsi_hdmi_init);