Skip to content

Commit 0fb19cd

Browse files
Laurent Pincharthorms
authored andcommitted
ARM: mach-shmobile: ag5evm: Use bd6107 backlight driver
Replace the backlight callback with a bd6107 backlight platform device. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Simon Horman <[email protected]>
1 parent 3f3bee2 commit 0fb19cd

File tree

1 file changed

+16
-49
lines changed

1 file changed

+16
-49
lines changed

arch/arm/mach-shmobile/board-ag5evm.c

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <linux/mmc/sh_mmcif.h>
4242
#include <linux/mmc/sh_mobile_sdhi.h>
4343
#include <linux/mfd/tmio.h>
44+
#include <linux/platform_data/bd6107.h>
4445
#include <linux/sh_clk.h>
4546
#include <linux/irqchip/arm-gic.h>
4647
#include <video/sh_mobile_lcdc.h>
@@ -291,47 +292,7 @@ static struct platform_device mipidsi0_device = {
291292
},
292293
};
293294

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 */
335296
static const struct fb_videomode lcdc0_modes[] = {
336297
{
337298
.name = "R63302(QHD)",
@@ -361,11 +322,6 @@ static struct sh_mobile_lcdc_info lcdc0_info = {
361322
.width = 44,
362323
.height = 79,
363324
},
364-
.bl_info = {
365-
.name = "sh_mobile_lcdc_bl",
366-
.max_brightness = 1,
367-
.set_brightness = lcd_backlight_set_brightness,
368-
},
369325
.tx_dev = &mipidsi0_device,
370326
}
371327
};
@@ -394,6 +350,17 @@ static struct platform_device lcdc0_device = {
394350
},
395351
};
396352

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+
397364
/* Fixed 2.8V regulators to be used by SDHI0 */
398365
static struct regulator_consumer_supply fixed2v8_power_consumers[] =
399366
{
@@ -648,15 +615,15 @@ static void __init ag5evm_init(void)
648615
gpio_set_value(217, 1);
649616
mdelay(100);
650617

651-
/* LCD backlight controller */
652-
gpio_request_one(235, GPIOF_OUT_INIT_LOW, NULL); /* RESET */
653-
lcd_backlight_set_brightness(0);
654618

655619
#ifdef CONFIG_CACHE_L2X0
656620
/* Shared attribute override enable, 64K*8way */
657621
l2x0_init(IOMEM(0xf0100000), 0x00460000, 0xc2000fff);
658622
#endif
659623
sh73a0_add_standard_devices();
624+
625+
i2c_register_board_info(1, &backlight_board_info, 1);
626+
660627
platform_add_devices(ag5evm_devices, ARRAY_SIZE(ag5evm_devices));
661628
}
662629

0 commit comments

Comments
 (0)