diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/backlight/tosa_lcd.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c index 57a26649f1a5..b7fbc75a62fc 100644 --- a/drivers/video/backlight/tosa_lcd.c +++ b/drivers/video/backlight/tosa_lcd.c | |||
@@ -39,6 +39,7 @@ struct tosa_lcd_data { | |||
39 | struct i2c_client *i2c; | 39 | struct i2c_client *i2c; |
40 | 40 | ||
41 | int lcd_power; | 41 | int lcd_power; |
42 | bool is_vga; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data) | 45 | static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data) |
@@ -81,8 +82,12 @@ static void tosa_lcd_tg_init(struct tosa_lcd_data *data) | |||
81 | static void tosa_lcd_tg_on(struct tosa_lcd_data *data) | 82 | static void tosa_lcd_tg_on(struct tosa_lcd_data *data) |
82 | { | 83 | { |
83 | struct spi_device *spi = data->spi; | 84 | struct spi_device *spi = data->spi; |
84 | const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR; | 85 | int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR; |
85 | tosa_tg_send(spi, TG_PNLCTL, value | TG_REG0_VQV); /* this depends on mode */ | 86 | |
87 | if (data->is_vga) | ||
88 | value |= TG_REG0_VQV; | ||
89 | |||
90 | tosa_tg_send(spi, TG_PNLCTL, value); | ||
86 | 91 | ||
87 | /* TG LCD pannel power up */ | 92 | /* TG LCD pannel power up */ |
88 | tosa_tg_send(spi, TG_PINICTL,0x4); | 93 | tosa_tg_send(spi, TG_PINICTL,0x4); |
@@ -142,9 +147,25 @@ static int tosa_lcd_get_power(struct lcd_device *lcd) | |||
142 | return data->lcd_power; | 147 | return data->lcd_power; |
143 | } | 148 | } |
144 | 149 | ||
150 | static int tosa_lcd_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) | ||
151 | { | ||
152 | struct tosa_lcd_data *data = lcd_get_data(lcd); | ||
153 | |||
154 | if (mode->xres == 320 || mode->yres == 320) | ||
155 | data->is_vga = false; | ||
156 | else | ||
157 | data->is_vga = true; | ||
158 | |||
159 | if (POWER_IS_ON(data->lcd_power)) | ||
160 | tosa_lcd_tg_on(data); | ||
161 | |||
162 | return 0; | ||
163 | } | ||
164 | |||
145 | static struct lcd_ops tosa_lcd_ops = { | 165 | static struct lcd_ops tosa_lcd_ops = { |
146 | .set_power = tosa_lcd_set_power, | 166 | .set_power = tosa_lcd_set_power, |
147 | .get_power = tosa_lcd_get_power, | 167 | .get_power = tosa_lcd_get_power, |
168 | .set_mode = tosa_lcd_set_mode, | ||
148 | }; | 169 | }; |
149 | 170 | ||
150 | static int __devinit tosa_lcd_probe(struct spi_device *spi) | 171 | static int __devinit tosa_lcd_probe(struct spi_device *spi) |
@@ -156,6 +177,8 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi) | |||
156 | if (!data) | 177 | if (!data) |
157 | return -ENOMEM; | 178 | return -ENOMEM; |
158 | 179 | ||
180 | data->is_vga = true; /* defaut to VGA mode */ | ||
181 | |||
159 | /* | 182 | /* |
160 | * bits_per_word cannot be configured in platform data | 183 | * bits_per_word cannot be configured in platform data |
161 | */ | 184 | */ |