Skip to content

Commit 3f3bee2

Browse files
Laurent Pincharthorms
authored andcommitted
sh: kfr2r09: Use lv5207lp backlight
Replace the backlight callback with a lv5207lp backlight platform device. Signed-off-by: Laurent Pinchart <[email protected]> Signed-off-by: Simon Horman <[email protected]>
1 parent fe79f91 commit 3f3bee2

File tree

3 files changed

+14
-55
lines changed

3 files changed

+14
-55
lines changed

arch/sh/boards/mach-kfr2r09/lcd_wqvga.c

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -276,51 +276,3 @@ void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
276276
{
277277
write_memory_start(sohandle, so);
278278
}
279-
280-
#define CTRL_CKSW 0x10
281-
#define CTRL_C10 0x20
282-
#define CTRL_CPSW 0x80
283-
#define MAIN_MLED4 0x40
284-
#define MAIN_MSW 0x80
285-
286-
int kfr2r09_lcd_set_brightness(int brightness)
287-
{
288-
struct i2c_adapter *a;
289-
struct i2c_msg msg;
290-
unsigned char buf[2];
291-
int ret;
292-
293-
a = i2c_get_adapter(0);
294-
if (!a)
295-
return -ENODEV;
296-
297-
buf[0] = 0x00;
298-
if (brightness)
299-
buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW;
300-
else
301-
buf[1] = 0;
302-
303-
msg.addr = 0x75;
304-
msg.buf = buf;
305-
msg.len = 2;
306-
msg.flags = 0;
307-
ret = i2c_transfer(a, &msg, 1);
308-
if (ret != 1)
309-
return -ENODEV;
310-
311-
buf[0] = 0x01;
312-
if (brightness)
313-
buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c;
314-
else
315-
buf[1] = 0;
316-
317-
msg.addr = 0x75;
318-
msg.buf = buf;
319-
msg.len = 2;
320-
msg.flags = 0;
321-
ret = i2c_transfer(a, &msg, 1);
322-
if (ret != 1)
323-
return -ENODEV;
324-
325-
return 0;
326-
}

arch/sh/boards/mach-kfr2r09/setup.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/input.h>
2222
#include <linux/input/sh_keysc.h>
2323
#include <linux/i2c.h>
24+
#include <linux/platform_data/lv5207lp.h>
2425
#include <linux/regulator/fixed.h>
2526
#include <linux/regulator/machine.h>
2627
#include <linux/usb/r8a66597.h>
@@ -159,11 +160,6 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
159160
.setup_sys = kfr2r09_lcd_setup,
160161
.start_transfer = kfr2r09_lcd_start,
161162
},
162-
.bl_info = {
163-
.name = "sh_mobile_lcdc_bl",
164-
.max_brightness = 1,
165-
.set_brightness = kfr2r09_lcd_set_brightness,
166-
},
167163
.sys_bus_cfg = {
168164
.ldmt2r = 0x07010904,
169165
.ldmt3r = 0x14012914,
@@ -195,6 +191,17 @@ static struct platform_device kfr2r09_sh_lcdc_device = {
195191
},
196192
};
197193

194+
static struct lv5207lp_platform_data kfr2r09_backlight_data = {
195+
.fbdev = &kfr2r09_sh_lcdc_device.dev,
196+
.def_value = 13,
197+
.max_value = 13,
198+
};
199+
200+
static struct i2c_board_info kfr2r09_backlight_board_info = {
201+
I2C_BOARD_INFO("lv5207lp", 0x75),
202+
.platform_data = &kfr2r09_backlight_data,
203+
};
204+
198205
static struct r8a66597_platdata kfr2r09_usb0_gadget_data = {
199206
.on_chip = 1,
200207
};
@@ -627,6 +634,8 @@ static int __init kfr2r09_devices_setup(void)
627634
gpio_request(GPIO_FN_SDHI0CMD, NULL);
628635
gpio_request(GPIO_FN_SDHI0CLK, NULL);
629636

637+
i2c_register_board_info(0, &kfr2r09_backlight_board_info, 1);
638+
630639
return platform_add_devices(kfr2r09_devices,
631640
ARRAY_SIZE(kfr2r09_devices));
632641
}

arch/sh/include/mach-kfr2r09/mach/kfr2r09.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
#include <video/sh_mobile_lcdc.h>
55

66
#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
7-
int kfr2r09_lcd_set_brightness(int brightness);
87
int kfr2r09_lcd_setup(void *sys_ops_handle,
98
struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
109
void kfr2r09_lcd_start(void *sys_ops_handle,
1110
struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
1211
#else
13-
static int kfr2r09_lcd_set_brightness(int brightness) {}
1412
static int kfr2r09_lcd_setup(void *sys_ops_handle,
1513
struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
1614
{

0 commit comments

Comments
 (0)