]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-rx51-video.c
Merge branch 'omap-fixes'
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-rx51-video.c
1 /*
2  * linux/arch/arm/mach-omap2/board-rx51-video.c
3  *
4  * Copyright (C) 2008 Nokia
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/delay.h>
15 #include <linux/spi/spi.h>
16
17 #include <mach/lcd_mipid.h>
18 #include <mach/mcspi.h>
19 #include <mach/gpio.h>
20 #include <mach/board.h>
21
22
23 static struct omap2_mcspi_device_config mipid_mcspi_config = {
24         .turbo_mode     = 0,
25         .single_channel = 1,
26 };
27
28 static struct platform_device rx51_lcd_device = {
29         .name           = "lcd_mipid",
30         .id             = -1,
31 };
32
33 static void mipid_shutdown(struct mipid_platform_data *pdata)
34 {
35         if (pdata->nreset_gpio != -1) {
36                 pr_info("shutdown LCD\n");
37                 gpio_direction_output(pdata->nreset_gpio, 0);
38                 msleep(120);
39         }
40 }
41
42 static struct mipid_platform_data rx51_mipid_platform_data = {
43         .shutdown = mipid_shutdown,
44 };
45
46 static void __init mipid_dev_init(void)
47 {
48         const struct omap_lcd_config *conf;
49
50         conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
51         if (conf != NULL) {
52                 rx51_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
53                 rx51_mipid_platform_data.data_lines = conf->data_lines;
54         }
55 }
56
57 static struct spi_board_info rx51_video_spi_board_info[] = {
58         [0] = {
59                 .modalias               = "lcd_mipid",
60                 .bus_num                = 1,
61                 .chip_select            = 2,
62                 .max_speed_hz           = 6000000,
63                 .controller_data        = &mipid_mcspi_config,
64                 .platform_data          = &rx51_mipid_platform_data,
65         },
66 };
67
68 static struct platform_device *rx51_video_devices[] = {
69         &rx51_lcd_device,
70 };
71
72 void __init rx51_video_init(void)
73 {
74         platform_add_devices(rx51_video_devices, ARRAY_SIZE(rx51_video_devices));
75         spi_register_board_info(rx51_video_spi_board_info,
76                         ARRAY_SIZE(rx51_video_spi_board_info));
77         mipid_dev_init();
78 }
79