Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Dmitry Baryshkov and committed by
Richard Purdie
0ec561f4 9a2c61a9

+25 -2
+25 -2
drivers/video/backlight/tosa_lcd.c
··· 39 39 struct i2c_client *i2c; 40 40 41 41 int lcd_power; 42 + bool is_vga; 42 43 }; 43 44 44 45 static int tosa_tg_send(struct spi_device *spi, int adrs, uint8_t data) ··· 82 81 static void tosa_lcd_tg_on(struct tosa_lcd_data *data) 83 82 { 84 83 struct spi_device *spi = data->spi; 85 - const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR; 86 - tosa_tg_send(spi, TG_PNLCTL, value | TG_REG0_VQV); /* this depends on mode */ 84 + int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR; 85 + 86 + if (data->is_vga) 87 + value |= TG_REG0_VQV; 88 + 89 + tosa_tg_send(spi, TG_PNLCTL, value); 87 90 88 91 /* TG LCD pannel power up */ 89 92 tosa_tg_send(spi, TG_PINICTL,0x4); ··· 147 142 return data->lcd_power; 148 143 } 149 144 145 + static int tosa_lcd_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) 146 + { 147 + struct tosa_lcd_data *data = lcd_get_data(lcd); 148 + 149 + if (mode->xres == 320 || mode->yres == 320) 150 + data->is_vga = false; 151 + else 152 + data->is_vga = true; 153 + 154 + if (POWER_IS_ON(data->lcd_power)) 155 + tosa_lcd_tg_on(data); 156 + 157 + return 0; 158 + } 159 + 150 160 static struct lcd_ops tosa_lcd_ops = { 151 161 .set_power = tosa_lcd_set_power, 152 162 .get_power = tosa_lcd_get_power, 163 + .set_mode = tosa_lcd_set_mode, 153 164 }; 154 165 155 166 static int __devinit tosa_lcd_probe(struct spi_device *spi) ··· 176 155 data = kzalloc(sizeof(struct tosa_lcd_data), GFP_KERNEL); 177 156 if (!data) 178 157 return -ENOMEM; 158 + 159 + data->is_vga = true; /* defaut to VGA mode */ 179 160 180 161 /* 181 162 * bits_per_word cannot be configured in platform data