|
41 | 41 | #include <linux/mmc/sh_mmcif.h>
|
42 | 42 | #include <linux/mmc/sh_mobile_sdhi.h>
|
43 | 43 | #include <linux/mfd/tmio.h>
|
| 44 | +#include <linux/platform_data/bd6107.h> |
44 | 45 | #include <linux/sh_clk.h>
|
45 | 46 | #include <linux/irqchip/arm-gic.h>
|
46 | 47 | #include <video/sh_mobile_lcdc.h>
|
@@ -291,47 +292,7 @@ static struct platform_device mipidsi0_device = {
|
291 | 292 | },
|
292 | 293 | };
|
293 | 294 |
|
294 |
| -static unsigned char lcd_backlight_seq[3][2] = { |
295 |
| - { 0x04, 0x07 }, |
296 |
| - { 0x23, 0x80 }, |
297 |
| - { 0x03, 0x01 }, |
298 |
| -}; |
299 |
| - |
300 |
| -static int lcd_backlight_set_brightness(int brightness) |
301 |
| -{ |
302 |
| - struct i2c_adapter *adap; |
303 |
| - struct i2c_msg msg; |
304 |
| - unsigned int i; |
305 |
| - int ret; |
306 |
| - |
307 |
| - if (brightness == 0) { |
308 |
| - /* Reset the chip */ |
309 |
| - gpio_set_value(235, 0); |
310 |
| - mdelay(24); |
311 |
| - gpio_set_value(235, 1); |
312 |
| - return 0; |
313 |
| - } |
314 |
| - |
315 |
| - adap = i2c_get_adapter(1); |
316 |
| - if (adap == NULL) |
317 |
| - return -ENODEV; |
318 |
| - |
319 |
| - for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) { |
320 |
| - msg.addr = 0x6d; |
321 |
| - msg.buf = &lcd_backlight_seq[i][0]; |
322 |
| - msg.len = 2; |
323 |
| - msg.flags = 0; |
324 |
| - |
325 |
| - ret = i2c_transfer(adap, &msg, 1); |
326 |
| - if (ret < 0) |
327 |
| - break; |
328 |
| - } |
329 |
| - |
330 |
| - i2c_put_adapter(adap); |
331 |
| - return ret < 0 ? ret : 0; |
332 |
| -} |
333 |
| - |
334 |
| -/* LCDC0 */ |
| 295 | +/* LCDC0 and backlight */ |
335 | 296 | static const struct fb_videomode lcdc0_modes[] = {
|
336 | 297 | {
|
337 | 298 | .name = "R63302(QHD)",
|
@@ -361,11 +322,6 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
|
361 | 322 | .width = 44,
|
362 | 323 | .height = 79,
|
363 | 324 | },
|
364 |
| - .bl_info = { |
365 |
| - .name = "sh_mobile_lcdc_bl", |
366 |
| - .max_brightness = 1, |
367 |
| - .set_brightness = lcd_backlight_set_brightness, |
368 |
| - }, |
369 | 325 | .tx_dev = &mipidsi0_device,
|
370 | 326 | }
|
371 | 327 | };
|
@@ -394,6 +350,17 @@ static struct platform_device lcdc0_device = {
|
394 | 350 | },
|
395 | 351 | };
|
396 | 352 |
|
| 353 | +static struct bd6107_platform_data backlight_data = { |
| 354 | + .fbdev = &lcdc0_device.dev, |
| 355 | + .reset = 235, |
| 356 | + .def_value = 0, |
| 357 | +}; |
| 358 | + |
| 359 | +static struct i2c_board_info backlight_board_info = { |
| 360 | + I2C_BOARD_INFO("bd6107", 0x6d), |
| 361 | + .platform_data = &backlight_data, |
| 362 | +}; |
| 363 | + |
397 | 364 | /* Fixed 2.8V regulators to be used by SDHI0 */
|
398 | 365 | static struct regulator_consumer_supply fixed2v8_power_consumers[] =
|
399 | 366 | {
|
@@ -648,15 +615,15 @@ static void __init ag5evm_init(void)
|
648 | 615 | gpio_set_value(217, 1);
|
649 | 616 | mdelay(100);
|
650 | 617 |
|
651 |
| - /* LCD backlight controller */ |
652 |
| - gpio_request_one(235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */ |
653 |
| - lcd_backlight_set_brightness(0); |
654 | 618 |
|
655 | 619 | #ifdef CONFIG_CACHE_L2X0
|
656 | 620 | /* Shared attribute override enable, 64K*8way */
|
657 | 621 | l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
|
658 | 622 | #endif
|
659 | 623 | sh73a0_add_standard_devices();
|
| 624 | + |
| 625 | + i2c_register_board_info(1, &backlight_board_info, 1); |
| 626 | + |
660 | 627 | platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
|
661 | 628 | }
|
662 | 629 |
|
|
0 commit comments