aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2009-01-05 02:25:16 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-01-21 03:41:55 -0500
commitdeae7b860a5aca341410b72cca789589c5c93ce4 (patch)
tree3ae0983d8dbeb16759f0eb2f2b52df75ade5d277
parentb9afb0bae5411faadc0afcfbaa8ef0035fc0e8f8 (diff)
sh: mach-migor: Add tw9910 support.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/boards/mach-migor/setup.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 6df933da6251..53537fec3194 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -20,6 +20,7 @@
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <media/sh_mobile_ceu.h> 21#include <media/sh_mobile_ceu.h>
22#include <media/ov772x.h> 22#include <media/ov772x.h>
23#include <media/tw9910.h>
23#include <video/sh_mobile_lcdc.h> 24#include <video/sh_mobile_lcdc.h>
24#include <asm/clock.h> 25#include <asm/clock.h>
25#include <asm/machvec.h> 26#include <asm/machvec.h>
@@ -292,9 +293,12 @@ static struct platform_device migor_lcdc_device = {
292}; 293};
293 294
294static struct clk *camera_clk; 295static struct clk *camera_clk;
296static DEFINE_MUTEX(camera_lock);
295 297
296static void camera_power_on(void) 298static void camera_power_on(int is_tw)
297{ 299{
300 mutex_lock(&camera_lock);
301
298 /* Use 10 MHz VIO_CKO instead of 24 MHz to work 302 /* Use 10 MHz VIO_CKO instead of 24 MHz to work
299 * around signal quality issues on Panel Board V2.1. 303 * around signal quality issues on Panel Board V2.1.
300 */ 304 */
@@ -304,6 +308,12 @@ static void camera_power_on(void)
304 308
305 /* use VIO_RST to take camera out of reset */ 309 /* use VIO_RST to take camera out of reset */
306 mdelay(10); 310 mdelay(10);
311 if (is_tw) {
312 gpio_set_value(GPIO_PTT2, 0);
313 gpio_set_value(GPIO_PTT0, 0);
314 } else {
315 gpio_set_value(GPIO_PTT0, 1);
316 }
307 gpio_set_value(GPIO_PTT3, 0); 317 gpio_set_value(GPIO_PTT3, 0);
308 mdelay(10); 318 mdelay(10);
309 gpio_set_value(GPIO_PTT3, 1); 319 gpio_set_value(GPIO_PTT3, 1);
@@ -316,12 +326,23 @@ static void camera_power_off(void)
316 clk_put(camera_clk); 326 clk_put(camera_clk);
317 327
318 gpio_set_value(GPIO_PTT3, 0); 328 gpio_set_value(GPIO_PTT3, 0);
329 mutex_unlock(&camera_lock);
319} 330}
320 331
321static int ov7725_power(struct device *dev, int mode) 332static int ov7725_power(struct device *dev, int mode)
322{ 333{
323 if (mode) 334 if (mode)
324 camera_power_on(); 335 camera_power_on(0);
336 else
337 camera_power_off();
338
339 return 0;
340}
341
342static int tw9910_power(struct device *dev, int mode)
343{
344 if (mode)
345 camera_power_on(1);
325 else 346 else
326 camera_power_off(); 347 camera_power_off();
327 348
@@ -366,6 +387,14 @@ static struct ov772x_camera_info ov7725_info = {
366 }, 387 },
367}; 388};
368 389
390static struct tw9910_video_info tw9910_info = {
391 .buswidth = SOCAM_DATAWIDTH_8,
392 .mpout = TW9910_MPO_FIELD,
393 .link = {
394 .power = tw9910_power,
395 }
396};
397
369static struct platform_device *migor_devices[] __initdata = { 398static struct platform_device *migor_devices[] __initdata = {
370 &smc91x_eth_device, 399 &smc91x_eth_device,
371 &sh_keysc_device, 400 &sh_keysc_device,
@@ -387,6 +416,10 @@ static struct i2c_board_info migor_i2c_devices[] = {
387 I2C_BOARD_INFO("ov772x", 0x21), 416 I2C_BOARD_INFO("ov772x", 0x21),
388 .platform_data = &ov7725_info, 417 .platform_data = &ov7725_info,
389 }, 418 },
419 {
420 I2C_BOARD_INFO("tw9910", 0x45),
421 .platform_data = &tw9910_info,
422 },
390}; 423};
391 424
392static int __init migor_devices_setup(void) 425static int __init migor_devices_setup(void)