]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/commitdiff
ASoC: sh: fsi-hdmi: Add FSI port and HDMI selection
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 24 Jan 2011 01:09:02 +0000 (10:09 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 25 Jan 2011 15:15:24 +0000 (15:15 +0000)
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>
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/board-mackerel.c
sound/soc/sh/fsi-hdmi.c

index d503a74e30e456fc81c174e63a82fe97414d2e69..920ed81f1c618c12c74bb917a207979fea1431a4 100644 (file)
@@ -781,6 +781,10 @@ static struct platform_device hdmi_device = {
        },
 };
 
+static struct platform_device fsi_hdmi_device = {
+       .name           = "sh_fsi2_b_hdmi",
+};
+
 static long ap4evb_clk_optimize(unsigned long target, unsigned long *best_freq,
                                unsigned long *parent_freq)
 {
@@ -934,6 +938,7 @@ static struct platform_device *ap4evb_devices[] __initdata = {
        &usb1_host_device,
        &fsi_device,
        &fsi_ak4643_device,
+       &fsi_hdmi_device,
        &sh_mmcif_device,
        &lcdc1_device,
        &lcdc_device,
index 425962d5b29c8133872f74ad85fc3e8d64c96c36..aa4bcc347044231fc43da060ee4bbb052e70edaa 100644 (file)
@@ -400,6 +400,10 @@ static struct platform_device hdmi_device = {
        },
 };
 
+static struct platform_device fsi_hdmi_device = {
+       .name           = "sh_fsi2_b_hdmi",
+};
+
 static int __init hdmi_init_pm_clock(void)
 {
        struct clk *hdmi_ick = clk_get(&hdmi_device.dev, "ick");
@@ -920,6 +924,7 @@ static struct platform_device *mackerel_devices[] __initdata = {
        &leds_device,
        &fsi_device,
        &fsi_ak4643_device,
+       &fsi_hdmi_device,
        &sdhi0_device,
 #if !defined(CONFIG_MMC_SH_MMCIF)
        &sdhi1_device,
index 96d8ce3f3211ec01e49c9e628fb7218123575c3a..9719985eb82d2b4c3169be670cd7138abf41047c 100644 (file)
 #include <linux/platform_device.h>
 #include <sound/sh_fsi.h>
 
+struct fsi_hdmi_data {
+       const char *cpu_dai;
+       const char *card;
+       int id;
+};
+
 static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
        struct snd_soc_dai *cpu = rtd->cpu_dai;
@@ -25,7 +31,6 @@ static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd)
 static struct snd_soc_dai_link fsi_dai_link = {
        .name           = "HDMI",
        .stream_name    = "HDMI",
-       .cpu_dai_name   = "fsib-dai", /* fsi B */
        .codec_dai_name = "sh_mobile_hdmi-hifi",
        .platform_name  = "sh_fsi2",
        .codec_name     = "sh-mobile-hdmi",
@@ -33,21 +38,33 @@ static struct snd_soc_dai_link fsi_dai_link = {
 };
 
 static struct snd_soc_card fsi_soc_card  = {
-       .name           = "FSI (SH MOBILE HDMI)",
        .dai_link       = &fsi_dai_link,
        .num_links      = 1,
 };
 
 static struct platform_device *fsi_snd_device;
 
-static int __init fsi_hdmi_init(void)
+static int fsi_hdmi_probe(struct platform_device *pdev)
 {
        int ret = -ENOMEM;
+       const struct platform_device_id *id_entry;
+       struct fsi_hdmi_data *pdata;
 
-       fsi_snd_device = platform_device_alloc("soc-audio", FSI_PORT_B);
+       id_entry = pdev->id_entry;
+       if (!id_entry) {
+               dev_err(&pdev->dev, "unknown fsi hdmi\n");
+               return -ENODEV;
+       }
+
+       pdata = (struct fsi_hdmi_data *)id_entry->driver_data;
+
+       fsi_snd_device = platform_device_alloc("soc-audio", pdata->id);
        if (!fsi_snd_device)
                goto out;
 
+       fsi_dai_link.cpu_dai_name       = pdata->cpu_dai;
+       fsi_soc_card.name               = pdata->card;
+
        platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
        ret = platform_device_add(fsi_snd_device);
 
@@ -58,9 +75,48 @@ out:
        return ret;
 }
 
-static void __exit fsi_hdmi_exit(void)
+static int fsi_hdmi_remove(struct platform_device *pdev)
 {
        platform_device_unregister(fsi_snd_device);
+       return 0;
+}
+
+static struct fsi_hdmi_data fsi2_a_hdmi = {
+       .cpu_dai        = "fsia-dai",
+       .card           = "FSI2A (SH MOBILE HDMI)",
+       .id             = FSI_PORT_A,
+};
+
+static struct fsi_hdmi_data fsi2_b_hdmi = {
+       .cpu_dai        = "fsib-dai",
+       .card           = "FSI2B (SH MOBILE HDMI)",
+       .id             = FSI_PORT_B,
+};
+
+static struct platform_device_id fsi_id_table[] = {
+       /* FSI 2 */
+       { "sh_fsi2_a_hdmi",     (kernel_ulong_t)&fsi2_a_hdmi },
+       { "sh_fsi2_b_hdmi",     (kernel_ulong_t)&fsi2_b_hdmi },
+       {},
+};
+
+static struct platform_driver fsi_hdmi = {
+       .driver = {
+               .name   = "fsi-hdmi-audio",
+       },
+       .probe          = fsi_hdmi_probe,
+       .remove         = fsi_hdmi_remove,
+       .id_table       = fsi_id_table,
+};
+
+static int __init fsi_hdmi_init(void)
+{
+       return platform_driver_register(&fsi_hdmi);
+}
+
+static void __exit fsi_hdmi_exit(void)
+{
+       platform_driver_unregister(&fsi_hdmi);
 }
 
 module_init(fsi_hdmi_init);