4141#include <linux/mtd/physmap.h>
4242#include <linux/mtd/sh_flctl.h>
4343#include <linux/pinctrl/machine.h>
44+ #include <linux/platform_data/gpio_backlight.h>
4445#include <linux/pm_clock.h>
4546#include <linux/regulator/fixed.h>
4647#include <linux/regulator/machine.h>
4950#include <linux/tca6416_keypad.h>
5051#include <linux/usb/renesas_usbhs.h>
5152#include <linux/dma-mapping.h>
52-
5353#include <video/sh_mobile_hdmi.h>
5454#include <video/sh_mobile_lcdc.h>
5555#include <media/sh_mobile_ceu.h>
@@ -346,7 +346,7 @@ static struct platform_device meram_device = {
346346 },
347347};
348348
349- /* LCDC */
349+ /* LCDC and backlight */
350350static struct fb_videomode mackerel_lcdc_modes [] = {
351351 {
352352 .name = "WVGA Panel" ,
@@ -362,13 +362,6 @@ static struct fb_videomode mackerel_lcdc_modes[] = {
362362 },
363363};
364364
365- static int mackerel_set_brightness (int brightness )
366- {
367- gpio_set_value (31 , brightness );
368-
369- return 0 ;
370- }
371-
372365static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
373366 .icb [0 ] = {
374367 .meram_size = 0x40 ,
@@ -393,11 +386,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
393386 .width = 152 ,
394387 .height = 91 ,
395388 },
396- .bl_info = {
397- .name = "sh_mobile_lcdc_bl" ,
398- .max_brightness = 1 ,
399- .set_brightness = mackerel_set_brightness ,
400- },
401389 .meram_cfg = & lcd_meram_cfg ,
402390 }
403391};
@@ -425,6 +413,20 @@ static struct platform_device lcdc_device = {
425413 },
426414};
427415
416+ static struct gpio_backlight_platform_data gpio_backlight_data = {
417+ .fbdev = & lcdc_device .dev ,
418+ .gpio = 31 ,
419+ .def_value = 1 ,
420+ .name = "backlight" ,
421+ };
422+
423+ static struct platform_device gpio_backlight_device = {
424+ .name = "gpio-backlight" ,
425+ .dev = {
426+ .platform_data = & gpio_backlight_data ,
427+ },
428+ };
429+
428430/* HDMI */
429431static struct sh_mobile_hdmi_info hdmi_info = {
430432 .flags = HDMI_SND_SRC_SPDIF ,
@@ -1231,6 +1233,7 @@ static struct platform_device *mackerel_devices[] __initdata = {
12311233 & nor_flash_device ,
12321234 & smc911x_device ,
12331235 & lcdc_device ,
1236+ & gpio_backlight_device ,
12341237 & usbhs0_device ,
12351238 & usbhs1_device ,
12361239 & leds_device ,
@@ -1441,9 +1444,6 @@ static void __init mackerel_init(void)
14411444 ARRAY_SIZE (mackerel_pinctrl_map ));
14421445 sh7372_pinmux_init ();
14431446
1444- /* backlight, off by default */
1445- gpio_request_one (31 , GPIOF_OUT_INIT_LOW , NULL );
1446-
14471447 gpio_request_one (151 , GPIOF_OUT_INIT_HIGH , NULL ); /* LCDDON */
14481448
14491449 /* USBHS0 */
0 commit comments