Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
board-zoom-display.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Texas Instruments Inc.
3  *
4  * Modified from mach-omap2/board-zoom-peripherals.c
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/gpio.h>
15 #include <linux/i2c/twl.h>
16 #include <linux/spi/spi.h>
18 #include <video/omapdss.h>
19 #include <mach/board-zoom.h>
20 
21 #include "common.h"
22 
23 #define LCD_PANEL_RESET_GPIO_PROD 96
24 #define LCD_PANEL_RESET_GPIO_PILOT 55
25 #define LCD_PANEL_QVGA_GPIO 56
26 
27 static struct gpio zoom_lcd_gpios[] __initdata = {
28  { -EINVAL, GPIOF_OUT_INIT_HIGH, "lcd reset" },
30 };
31 
32 static void __init zoom_lcd_panel_init(void)
33 {
34  zoom_lcd_gpios[0].gpio = (omap_rev() > OMAP3430_REV_ES3_0) ?
37 
38  if (gpio_request_array(zoom_lcd_gpios, ARRAY_SIZE(zoom_lcd_gpios)))
39  pr_err("%s: Failed to get LCD GPIOs.\n", __func__);
40 }
41 
42 static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev)
43 {
44  return 0;
45 }
46 
47 static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev)
48 {
49 }
50 
51 /*
52  * PWMA/B register offsets (TWL4030_MODULE_PWMA)
53  */
54 #define TWL_INTBR_PMBR1 0xD
55 #define TWL_INTBR_GPBR1 0xC
56 #define TWL_LED_PWMON 0x0
57 #define TWL_LED_PWMOFF 0x1
58 
59 static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level)
60 {
61 #ifdef CONFIG_TWL4030_CORE
62  unsigned char c;
63  u8 mux_pwm, enb_pwm;
64 
65  if (level > 100)
66  return -1;
67 
70 
71  if (level == 0) {
72  /* disable pwm1 output and clock */
73  enb_pwm = enb_pwm & 0xF5;
74  /* change pwm1 pin to gpio pin */
75  mux_pwm = mux_pwm & 0xCF;
77  enb_pwm, TWL_INTBR_GPBR1);
79  mux_pwm, TWL_INTBR_PMBR1);
80  return 0;
81  }
82 
83  if (!((enb_pwm & 0xA) && (mux_pwm & 0x30))) {
84  /* change gpio pin to pwm1 pin */
85  mux_pwm = mux_pwm | 0x30;
86  /* enable pwm1 output and clock*/
87  enb_pwm = enb_pwm | 0x0A;
89  mux_pwm, TWL_INTBR_PMBR1);
91  enb_pwm, TWL_INTBR_GPBR1);
92  }
93 
94  c = ((50 * (100 - level)) / 100) + 1;
97 #else
98  pr_warn("Backlight not enabled\n");
99 #endif
100 
101  return 0;
102 }
103 
104 static struct omap_dss_device zoom_lcd_device = {
105  .name = "lcd",
106  .driver_name = "NEC_8048_panel",
107  .type = OMAP_DISPLAY_TYPE_DPI,
108  .phy.dpi.data_lines = 24,
109  .platform_enable = zoom_panel_enable_lcd,
110  .platform_disable = zoom_panel_disable_lcd,
111  .max_backlight_level = 100,
112  .set_backlight = zoom_set_bl_intensity,
113 };
114 
115 static struct omap_dss_device *zoom_dss_devices[] = {
116  &zoom_lcd_device,
117 };
118 
119 static struct omap_dss_board_info zoom_dss_data = {
120  .num_devices = ARRAY_SIZE(zoom_dss_devices),
121  .devices = zoom_dss_devices,
122  .default_device = &zoom_lcd_device,
123 };
124 
125 static struct omap2_mcspi_device_config dss_lcd_mcspi_config = {
126  .turbo_mode = 1,
127 };
128 
129 static struct spi_board_info nec_8048_spi_board_info[] __initdata = {
130  [0] = {
131  .modalias = "nec_8048_spi",
132  .bus_num = 1,
133  .chip_select = 2,
134  .max_speed_hz = 375000,
135  .controller_data = &dss_lcd_mcspi_config,
136  },
137 };
138 
140 {
141  omap_display_init(&zoom_dss_data);
142  spi_register_board_info(nec_8048_spi_board_info,
143  ARRAY_SIZE(nec_8048_spi_board_info));
144  zoom_lcd_panel_init();
145 }
146