Skip to content

Commit

Permalink
backlight: Support VGA/QVGA mode switching in tosa_lcd
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dmitry Baryshkov authored and Richard Purdie committed Jan 8, 2009
1 parent 9a2c61a commit 0ec561f
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions drivers/video/backlight/tosa_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct tosa_lcd_data {
struct i2c_client *i2c;

int lcd_power;
bool is_vga;
};

static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data)
Expand Down Expand Up @@ -81,8 +82,12 @@ static void tosa_lcd_tg_init(struct tosa_lcd_data *data)
static void tosa_lcd_tg_on(struct tosa_lcd_data *data)
{
struct spi_device *spi = data->spi;
const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR;
tosa_tg_send(spi, TG_PNLCTL, value | TG_REG0_VQV); /* this depends on mode */
int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR;

if (data->is_vga)
value |= TG_REG0_VQV;

tosa_tg_send(spi, TG_PNLCTL, value);

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

static int tosa_lcd_set_mode(struct lcd_device *lcd, struct fb_videomode *mode)
{
struct tosa_lcd_data *data = lcd_get_data(lcd);

if (mode->xres == 320 || mode->yres == 320)
data->is_vga = false;
else
data->is_vga = true;

if (POWER_IS_ON(data->lcd_power))
tosa_lcd_tg_on(data);

return 0;
}

static struct lcd_ops tosa_lcd_ops = {
.set_power = tosa_lcd_set_power,
.get_power = tosa_lcd_get_power,
.set_mode = tosa_lcd_set_mode,
};

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

data->is_vga = true; /* defaut to VGA mode */

/*
* bits_per_word cannot be configured in platform data
*/
Expand Down

0 comments on commit 0ec561f

Please sign in to comment.