Skip to content

Commit d58226a

Browse files
Laurent Pincharthorms
authored andcommitted
ARM: shmobile: armadillo800eva: Add backlight support
The flat panel backlight on the Armadillo 800 EVA board is driven by the TPU PWM output. Signed-off-by: Laurent Pinchart <[email protected]> Tested-by: Simon Horman <[email protected]> Signed-off-by: Simon Horman <[email protected]>
1 parent ad81f05 commit d58226a

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

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

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
#include <linux/gpio_keys.h>
3232
#include <linux/regulator/driver.h>
3333
#include <linux/pinctrl/machine.h>
34+
#include <linux/platform_data/pwm-renesas-tpu.h>
35+
#include <linux/pwm_backlight.h>
3436
#include <linux/regulator/fixed.h>
3537
#include <linux/regulator/gpio-regulator.h>
3638
#include <linux/regulator/machine.h>
@@ -387,7 +389,50 @@ static struct platform_device sh_eth_device = {
387389
.num_resources = ARRAY_SIZE(sh_eth_resources),
388390
};
389391

390-
/* LCDC */
392+
/* PWM */
393+
static struct resource pwm_resources[] = {
394+
[0] = {
395+
.start = 0xe6600000,
396+
.end = 0xe66000ff,
397+
.flags = IORESOURCE_MEM,
398+
},
399+
};
400+
401+
static struct tpu_pwm_platform_data pwm_device_data = {
402+
.channels[2] = {
403+
.polarity = PWM_POLARITY_INVERSED,
404+
}
405+
};
406+
407+
static struct platform_device pwm_device = {
408+
.name = "renesas-tpu-pwm",
409+
.id = -1,
410+
.dev = {
411+
.platform_data = &pwm_device_data,
412+
},
413+
.num_resources = ARRAY_SIZE(pwm_resources),
414+
.resource = pwm_resources,
415+
};
416+
417+
static struct pwm_lookup pwm_lookup[] = {
418+
PWM_LOOKUP("renesas-tpu-pwm", 2, "pwm-backlight.0", NULL),
419+
};
420+
421+
/* LCDC and backlight */
422+
static struct platform_pwm_backlight_data pwm_backlight_data = {
423+
.lth_brightness = 50,
424+
.max_brightness = 255,
425+
.dft_brightness = 255,
426+
.pwm_period_ns = 33333, /* 30kHz */
427+
};
428+
429+
static struct platform_device pwm_backlight_device = {
430+
.name = "pwm-backlight",
431+
.dev = {
432+
.platform_data = &pwm_backlight_data,
433+
},
434+
};
435+
391436
static struct fb_videomode lcdc0_mode = {
392437
.name = "AMPIER/AM-800480",
393438
.xres = 800,
@@ -1030,6 +1075,8 @@ static struct i2c_board_info i2c2_devices[] = {
10301075
*/
10311076
static struct platform_device *eva_devices[] __initdata = {
10321077
&lcdc0_device,
1078+
&pwm_device,
1079+
&pwm_backlight_device,
10331080
&gpio_keys_device,
10341081
&sh_eth_device,
10351082
&vcc_sdhi0,
@@ -1101,6 +1148,9 @@ static const struct pinctrl_map eva_pinctrl_map[] = {
11011148
/* ST1232 */
11021149
PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-r8a7740",
11031150
"intc_irq10", "intc"),
1151+
/* TPU0 */
1152+
PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm", "pfc-r8a7740",
1153+
"tpu0_to2_1", "tpu0"),
11041154
/* USBHS */
11051155
PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7740",
11061156
"intc_irq7_1", "intc"),
@@ -1154,13 +1204,13 @@ static void __init eva_init(void)
11541204
ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
11551205

11561206
pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
1207+
pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
11571208

11581209
r8a7740_pinmux_init();
11591210
r8a7740_meram_workaround();
11601211

11611212
/* LCDC0 */
11621213
gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
1163-
gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */
11641214

11651215
/* Touchscreen */
11661216
gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */

0 commit comments

Comments
 (0)