| OLD | NEW |
| 1 /* | 1 /* |
| 2 * FSI - HDMI sound support | 2 * FSI - HDMI sound support |
| 3 * | 3 * |
| 4 * Copyright (C) 2010 Renesas Solutions Corp. | 4 * Copyright (C) 2010 Renesas Solutions Corp. |
| 5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 5 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> |
| 6 * | 6 * |
| 7 * This file is subject to the terms and conditions of the GNU General Public | 7 * This file is subject to the terms and conditions of the GNU General Public |
| 8 * License. See the file "COPYING" in the main directory of this archive | 8 * License. See the file "COPYING" in the main directory of this archive |
| 9 * for more details. | 9 * for more details. |
| 10 */ | 10 */ |
| 11 | 11 |
| 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 |
| 15 struct fsi_hdmi_data { |
| 16 const char *cpu_dai; |
| 17 const char *card; |
| 18 int id; |
| 19 }; |
| 20 |
| 21 static int fsi_hdmi_dai_init(struct snd_soc_pcm_runtime *rtd) |
| 22 { |
| 23 struct snd_soc_dai *cpu = rtd->cpu_dai; |
| 24 int ret; |
| 25 |
| 26 ret = snd_soc_dai_set_fmt(cpu, SND_SOC_DAIFMT_CBM_CFM); |
| 27 |
| 28 return ret; |
| 29 } |
| 30 |
| 15 static struct snd_soc_dai_link fsi_dai_link = { | 31 static struct snd_soc_dai_link fsi_dai_link = { |
| 16 .name = "HDMI", | 32 .name = "HDMI", |
| 17 .stream_name = "HDMI", | 33 .stream_name = "HDMI", |
| 18 .cpu_dai_name = "fsib-dai", /* fsi B */ | |
| 19 .codec_dai_name = "sh_mobile_hdmi-hifi", | 34 .codec_dai_name = "sh_mobile_hdmi-hifi", |
| 20 .platform_name = "sh_fsi2", | 35 .platform_name = "sh_fsi2", |
| 21 .codec_name = "sh-mobile-hdmi", | 36 .codec_name = "sh-mobile-hdmi", |
| 37 .init = fsi_hdmi_dai_init, |
| 22 }; | 38 }; |
| 23 | 39 |
| 24 static struct snd_soc_card fsi_soc_card = { | 40 static struct snd_soc_card fsi_soc_card = { |
| 25 .name = "FSI (SH MOBILE HDMI)", | |
| 26 .dai_link = &fsi_dai_link, | 41 .dai_link = &fsi_dai_link, |
| 27 .num_links = 1, | 42 .num_links = 1, |
| 28 }; | 43 }; |
| 29 | 44 |
| 30 static struct platform_device *fsi_snd_device; | 45 static struct platform_device *fsi_snd_device; |
| 31 | 46 |
| 32 static int __init fsi_hdmi_init(void) | 47 static int fsi_hdmi_probe(struct platform_device *pdev) |
| 33 { | 48 { |
| 34 int ret = -ENOMEM; | 49 int ret = -ENOMEM; |
| 50 const struct platform_device_id *id_entry; |
| 51 struct fsi_hdmi_data *pdata; |
| 35 | 52 |
| 36 » 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); |
| 37 if (!fsi_snd_device) | 62 if (!fsi_snd_device) |
| 38 goto out; | 63 goto out; |
| 39 | 64 |
| 65 fsi_dai_link.cpu_dai_name = pdata->cpu_dai; |
| 66 fsi_soc_card.name = pdata->card; |
| 67 |
| 40 platform_set_drvdata(fsi_snd_device, &fsi_soc_card); | 68 platform_set_drvdata(fsi_snd_device, &fsi_soc_card); |
| 41 ret = platform_device_add(fsi_snd_device); | 69 ret = platform_device_add(fsi_snd_device); |
| 42 | 70 |
| 43 if (ret) | 71 if (ret) |
| 44 platform_device_put(fsi_snd_device); | 72 platform_device_put(fsi_snd_device); |
| 45 | 73 |
| 46 out: | 74 out: |
| 47 return ret; | 75 return ret; |
| 48 } | 76 } |
| 49 | 77 |
| 78 static int fsi_hdmi_remove(struct platform_device *pdev) |
| 79 { |
| 80 platform_device_unregister(fsi_snd_device); |
| 81 return 0; |
| 82 } |
| 83 |
| 84 static 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 |
| 90 static 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 |
| 96 static 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 |
| 103 static 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 |
| 112 static int __init fsi_hdmi_init(void) |
| 113 { |
| 114 return platform_driver_register(&fsi_hdmi); |
| 115 } |
| 116 |
| 50 static void __exit fsi_hdmi_exit(void) | 117 static void __exit fsi_hdmi_exit(void) |
| 51 { | 118 { |
| 52 » platform_device_unregister(fsi_snd_device); | 119 » platform_driver_unregister(&fsi_hdmi); |
| 53 } | 120 } |
| 54 | 121 |
| 55 module_init(fsi_hdmi_init); | 122 module_init(fsi_hdmi_init); |
| 56 module_exit(fsi_hdmi_exit); | 123 module_exit(fsi_hdmi_exit); |
| 57 | 124 |
| 58 MODULE_LICENSE("GPL"); | 125 MODULE_LICENSE("GPL"); |
| 59 MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); | 126 MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); |
| 60 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); | 127 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>"); |
| OLD | NEW |