Skip to content

Commit 0ec561f

Browse files
lumagrpurdie
authored andcommitted
backlight: Support VGA/QVGA mode switching in tosa_lcd
LCD driver on tosa requires reprogramming TG after mode switching. Add support for switching to QVGA mode. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
1 parent 9a2c61a commit 0ec561f

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

‎drivers/video/backlight/tosa_lcd.c‎

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct tosa_lcd_data {
3939
struct i2c_client *i2c;
4040

4141
int lcd_power;
42+
bool is_vga;
4243
};
4344

4445
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)
8182
static void tosa_lcd_tg_on(struct tosa_lcd_data *data)
8283
{
8384
struct spi_device *spi = data->spi;
84-
const 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 */
85+
int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR;
86+
87+
if (data->is_vga)
88+
value |= TG_REG0_VQV;
89+
90+
tosa_tg_send(spi, TG_PNLCTL, value);
8691

8792
/* TG LCD pannel power up */
8893
tosa_tg_send(spi, TG_PINICTL,0x4);
@@ -142,9 +147,25 @@ static int tosa_lcd_get_power(struct lcd_device *lcd)
142147
return data->lcd_power;
143148
}
144149

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+
145165
static struct lcd_ops tosa_lcd_ops = {
146166
.set_power = tosa_lcd_set_power,
147167
.get_power = tosa_lcd_get_power,
168+
.set_mode = tosa_lcd_set_mode,
148169
};
149170

150171
static int __devinit tosa_lcd_probe(struct spi_device *spi)
@@ -156,6 +177,8 @@ static int __devinit tosa_lcd_probe(struct spi_device *spi)
156177
if (!data)
157178
return -ENOMEM;
158179

180+
data->is_vga = true; /* defaut to VGA mode */
181+
159182
/*
160183
* bits_per_word cannot be configured in platform data
161184
*/

0 commit comments

Comments
 (0)