aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-armadillo800eva.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-06-25 06:33:04 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-06-30 09:24:52 -0400
commit0676c05e57c6e37fc9f985a8f6ea2883e5b2cbda (patch)
tree626e83127c9421ab51c14671a3837866f0364f25 /arch/arm/mach-shmobile/board-armadillo800eva.c
parent5389bf719f87101339f292256392bff5ae926917 (diff)
ARM: shmobile: armadillo800eva: enable FSI-HDMI sound
This patch enable HDMI sound support on CON3 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch/arm/mach-shmobile/board-armadillo800eva.c')
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c82
1 files changed, 79 insertions, 3 deletions
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 08f0e7b5deef..a642ce68dddf 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -739,10 +739,42 @@ static struct platform_device ceu0_device = {
739}; 739};
740 740
741/* FSI */ 741/* FSI */
742static int fsi_hdmi_set_rate(struct device *dev, int rate, int enable)
743{
744 struct clk *fsib;
745 int ret;
746
747 /* it support 48KHz only */
748 if (48000 != rate)
749 return -EINVAL;
750
751 fsib = clk_get(dev, "ickb");
752 if (IS_ERR(fsib))
753 return -EINVAL;
754
755 if (enable) {
756 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
757 clk_enable(fsib);
758 } else {
759 ret = 0;
760 clk_disable(fsib);
761 }
762
763 clk_put(fsib);
764
765 return ret;
766}
767
742static struct sh_fsi_platform_info fsi_info = { 768static struct sh_fsi_platform_info fsi_info = {
743 /* FSI-WM8978 */ 769 /* FSI-WM8978 */
744 .port_a = { 770 .port_a = {
745 }, 771 },
772 /* FSI-HDMI */
773 .port_b = {
774 .flags = SH_FSI_FMT_SPDIF |
775 SH_FSI_ENABLE_STREAM_MODE,
776 .set_rate = fsi_hdmi_set_rate,
777 }
746}; 778};
747 779
748static struct resource fsi_resources[] = { 780static struct resource fsi_resources[] = {
@@ -794,6 +826,29 @@ static struct platform_device fsi_wm8978_device = {
794 }, 826 },
795}; 827};
796 828
829/* FSI-HDMI */
830static struct asoc_simple_dai_init_info fsi2_hdmi_init_info = {
831 .cpu_daifmt = SND_SOC_DAIFMT_CBM_CFM,
832};
833
834static struct asoc_simple_card_info fsi2_hdmi_info = {
835 .name = "HDMI",
836 .card = "FSI2B-HDMI",
837 .cpu_dai = "fsib-dai",
838 .codec = "sh-mobile-hdmi",
839 .platform = "sh_fsi2",
840 .codec_dai = "sh_mobile_hdmi-hifi",
841 .init = &fsi2_hdmi_init_info,
842};
843
844static struct platform_device fsi_hdmi_device = {
845 .name = "asoc-simple-card",
846 .id = 1,
847 .dev = {
848 .platform_data = &fsi2_hdmi_info,
849 },
850};
851
797/* I2C */ 852/* I2C */
798static struct i2c_board_info i2c0_devices[] = { 853static struct i2c_board_info i2c0_devices[] = {
799 { 854 {
@@ -819,6 +874,7 @@ static struct platform_device *eva_devices[] __initdata = {
819 &camera_device, 874 &camera_device,
820 &ceu0_device, 875 &ceu0_device,
821 &fsi_device, 876 &fsi_device,
877 &fsi_hdmi_device,
822 &fsi_wm8978_device, 878 &fsi_wm8978_device,
823}; 879};
824 880
@@ -827,10 +883,14 @@ static void __init eva_clock_init(void)
827 struct clk *system = clk_get(NULL, "system_clk"); 883 struct clk *system = clk_get(NULL, "system_clk");
828 struct clk *xtal1 = clk_get(NULL, "extal1"); 884 struct clk *xtal1 = clk_get(NULL, "extal1");
829 struct clk *usb24s = clk_get(NULL, "usb24s"); 885 struct clk *usb24s = clk_get(NULL, "usb24s");
886 struct clk *fsibck = clk_get(NULL, "fsibck");
887 struct clk *fsib = clk_get(&fsi_device.dev, "ickb");
830 888
831 if (IS_ERR(system) || 889 if (IS_ERR(system) ||
832 IS_ERR(xtal1) || 890 IS_ERR(xtal1) ||
833 IS_ERR(usb24s)) { 891 IS_ERR(usb24s) ||
892 IS_ERR(fsibck) ||
893 IS_ERR(fsib)) {
834 pr_err("armadillo800eva board clock init failed\n"); 894 pr_err("armadillo800eva board clock init failed\n");
835 goto clock_error; 895 goto clock_error;
836 } 896 }
@@ -841,6 +901,11 @@ static void __init eva_clock_init(void)
841 /* usb24s use extal1 (= system) clock (= 24MHz) */ 901 /* usb24s use extal1 (= system) clock (= 24MHz) */
842 clk_set_parent(usb24s, system); 902 clk_set_parent(usb24s, system);
843 903
904 /* FSIBCK is 12.288MHz, and it is parent of FSI-B */
905 clk_set_parent(fsib, fsibck);
906 clk_set_rate(fsibck, 12288000);
907 clk_set_rate(fsib, 12288000);
908
844clock_error: 909clock_error:
845 if (!IS_ERR(system)) 910 if (!IS_ERR(system))
846 clk_put(system); 911 clk_put(system);
@@ -848,6 +913,10 @@ clock_error:
848 clk_put(xtal1); 913 clk_put(xtal1);
849 if (!IS_ERR(usb24s)) 914 if (!IS_ERR(usb24s))
850 clk_put(usb24s); 915 clk_put(usb24s);
916 if (!IS_ERR(fsibck))
917 clk_put(fsibck);
918 if (!IS_ERR(fsib))
919 clk_put(fsib);
851} 920}
852 921
853/* 922/*
@@ -857,8 +926,6 @@ clock_error:
857#define GPIO_PORT8CR 0xe6050008 926#define GPIO_PORT8CR 0xe6050008
858static void __init eva_init(void) 927static void __init eva_init(void)
859{ 928{
860 eva_clock_init();
861
862 r8a7740_pinmux_init(); 929 r8a7740_pinmux_init();
863 r8a7740_meram_workaround(); 930 r8a7740_meram_workaround();
864 931
@@ -1015,6 +1082,13 @@ static void __init eva_init(void)
1015 gpio_no_direction(GPIO_PORT7CR); /* FSIAOBT needs no direction */ 1082 gpio_no_direction(GPIO_PORT7CR); /* FSIAOBT needs no direction */
1016 gpio_no_direction(GPIO_PORT8CR); /* FSIAOLR needs no direction */ 1083 gpio_no_direction(GPIO_PORT8CR); /* FSIAOLR needs no direction */
1017 1084
1085 /* FSI-HDMI */
1086 gpio_request(GPIO_FN_FSIBCK, NULL);
1087
1088 /* HDMI */
1089 gpio_request(GPIO_FN_HDMI_HPD, NULL);
1090 gpio_request(GPIO_FN_HDMI_CEC, NULL);
1091
1018 /* 1092 /*
1019 * CAUTION 1093 * CAUTION
1020 * 1094 *
@@ -1061,6 +1135,8 @@ static void __init eva_init(void)
1061 1135
1062 platform_add_devices(eva_devices, 1136 platform_add_devices(eva_devices,
1063 ARRAY_SIZE(eva_devices)); 1137 ARRAY_SIZE(eva_devices));
1138
1139 eva_clock_init();
1064} 1140}
1065 1141
1066static void __init eva_earlytimer_init(void) 1142static void __init eva_earlytimer_init(void)