diff options
author | Alexander Sverdlin <subaparts@yandex.ru> | 2011-03-03 04:53:52 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-03-06 03:39:57 -0500 |
commit | 31bb68a314e9a2c9fbe054441b18c0608585605e (patch) | |
tree | 5405ca99051b32d3c05309750d9146b5000136de /arch/arm/mach-ep93xx/edb93xx.c | |
parent | 130551928195bdef3369e13572b9a383400681bb (diff) |
ARM: 6780/1: EDB93xx: Add support for CS4271 SPI-connected CODEC
Add support for CS4271 SPI-connected CODEC to EDB93xx.
Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ep93xx/edb93xx.c')
-rw-r--r-- | arch/arm/mach-ep93xx/edb93xx.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c index fad371df40ed..9969bb115f60 100644 --- a/arch/arm/mach-ep93xx/edb93xx.c +++ b/arch/arm/mach-ep93xx/edb93xx.c | |||
@@ -30,9 +30,13 @@ | |||
30 | #include <linux/gpio.h> | 30 | #include <linux/gpio.h> |
31 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
32 | #include <linux/i2c-gpio.h> | 32 | #include <linux/i2c-gpio.h> |
33 | #include <linux/spi/spi.h> | ||
34 | |||
35 | #include <sound/cs4271.h> | ||
33 | 36 | ||
34 | #include <mach/hardware.h> | 37 | #include <mach/hardware.h> |
35 | #include <mach/fb.h> | 38 | #include <mach/fb.h> |
39 | #include <mach/ep93xx_spi.h> | ||
36 | 40 | ||
37 | #include <asm/mach-types.h> | 41 | #include <asm/mach-types.h> |
38 | #include <asm/mach/arch.h> | 42 | #include <asm/mach/arch.h> |
@@ -94,6 +98,83 @@ static void __init edb93xx_register_i2c(void) | |||
94 | 98 | ||
95 | 99 | ||
96 | /************************************************************************* | 100 | /************************************************************************* |
101 | * EDB93xx SPI peripheral handling | ||
102 | *************************************************************************/ | ||
103 | static struct cs4271_platform_data edb93xx_cs4271_data = { | ||
104 | .gpio_nreset = -EINVAL, /* filled in later */ | ||
105 | }; | ||
106 | |||
107 | static int edb93xx_cs4271_hw_setup(struct spi_device *spi) | ||
108 | { | ||
109 | return gpio_request_one(EP93XX_GPIO_LINE_EGPIO6, | ||
110 | GPIOF_OUT_INIT_HIGH, spi->modalias); | ||
111 | } | ||
112 | |||
113 | static void edb93xx_cs4271_hw_cleanup(struct spi_device *spi) | ||
114 | { | ||
115 | gpio_free(EP93XX_GPIO_LINE_EGPIO6); | ||
116 | } | ||
117 | |||
118 | static void edb93xx_cs4271_hw_cs_control(struct spi_device *spi, int value) | ||
119 | { | ||
120 | gpio_set_value(EP93XX_GPIO_LINE_EGPIO6, value); | ||
121 | } | ||
122 | |||
123 | static struct ep93xx_spi_chip_ops edb93xx_cs4271_hw = { | ||
124 | .setup = edb93xx_cs4271_hw_setup, | ||
125 | .cleanup = edb93xx_cs4271_hw_cleanup, | ||
126 | .cs_control = edb93xx_cs4271_hw_cs_control, | ||
127 | }; | ||
128 | |||
129 | static struct spi_board_info edb93xx_spi_board_info[] __initdata = { | ||
130 | { | ||
131 | .modalias = "cs4271", | ||
132 | .platform_data = &edb93xx_cs4271_data, | ||
133 | .controller_data = &edb93xx_cs4271_hw, | ||
134 | .max_speed_hz = 6000000, | ||
135 | .bus_num = 0, | ||
136 | .chip_select = 0, | ||
137 | .mode = SPI_MODE_3, | ||
138 | }, | ||
139 | }; | ||
140 | |||
141 | static struct ep93xx_spi_info edb93xx_spi_info __initdata = { | ||
142 | .num_chipselect = ARRAY_SIZE(edb93xx_spi_board_info), | ||
143 | }; | ||
144 | |||
145 | static void __init edb93xx_register_spi(void) | ||
146 | { | ||
147 | if (machine_is_edb9301() || machine_is_edb9302()) | ||
148 | edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO1; | ||
149 | else if (machine_is_edb9302a() || machine_is_edb9307a()) | ||
150 | edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_H(2); | ||
151 | else if (machine_is_edb9315a()) | ||
152 | edb93xx_cs4271_data.gpio_nreset = EP93XX_GPIO_LINE_EGPIO14; | ||
153 | |||
154 | ep93xx_register_spi(&edb93xx_spi_info, edb93xx_spi_board_info, | ||
155 | ARRAY_SIZE(edb93xx_spi_board_info)); | ||
156 | } | ||
157 | |||
158 | |||
159 | /************************************************************************* | ||
160 | * EDB93xx I2S | ||
161 | *************************************************************************/ | ||
162 | static int __init edb93xx_has_audio(void) | ||
163 | { | ||
164 | return (machine_is_edb9301() || machine_is_edb9302() || | ||
165 | machine_is_edb9302a() || machine_is_edb9307a() || | ||
166 | machine_is_edb9315a()); | ||
167 | } | ||
168 | |||
169 | static void __init edb93xx_register_i2s(void) | ||
170 | { | ||
171 | if (edb93xx_has_audio()) { | ||
172 | ep93xx_register_i2s(); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | |||
177 | /************************************************************************* | ||
97 | * EDB93xx pwm | 178 | * EDB93xx pwm |
98 | *************************************************************************/ | 179 | *************************************************************************/ |
99 | static void __init edb93xx_register_pwm(void) | 180 | static void __init edb93xx_register_pwm(void) |
@@ -149,6 +230,8 @@ static void __init edb93xx_init_machine(void) | |||
149 | edb93xx_register_flash(); | 230 | edb93xx_register_flash(); |
150 | ep93xx_register_eth(&edb93xx_eth_data, 1); | 231 | ep93xx_register_eth(&edb93xx_eth_data, 1); |
151 | edb93xx_register_i2c(); | 232 | edb93xx_register_i2c(); |
233 | edb93xx_register_spi(); | ||
234 | edb93xx_register_i2s(); | ||
152 | edb93xx_register_pwm(); | 235 | edb93xx_register_pwm(); |
153 | edb93xx_register_fb(); | 236 | edb93xx_register_fb(); |
154 | } | 237 | } |