|
31 | 31 | #include <linux/gpio_keys.h>
|
32 | 32 | #include <linux/regulator/driver.h>
|
33 | 33 | #include <linux/pinctrl/machine.h>
|
| 34 | +#include <linux/platform_data/pwm-renesas-tpu.h> |
| 35 | +#include <linux/pwm_backlight.h> |
34 | 36 | #include <linux/regulator/fixed.h>
|
35 | 37 | #include <linux/regulator/gpio-regulator.h>
|
36 | 38 | #include <linux/regulator/machine.h>
|
@@ -387,7 +389,50 @@ static struct platform_device sh_eth_device = {
|
387 | 389 | .num_resources = ARRAY_SIZE(sh_eth_resources),
|
388 | 390 | };
|
389 | 391 |
|
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 | + |
391 | 436 | static struct fb_videomode lcdc0_mode = {
|
392 | 437 | .name = "AMPIER/AM-800480",
|
393 | 438 | .xres = 800,
|
@@ -1030,6 +1075,8 @@ static struct i2c_board_info i2c2_devices[] = {
|
1030 | 1075 | */
|
1031 | 1076 | static struct platform_device *eva_devices[] __initdata = {
|
1032 | 1077 | &lcdc0_device,
|
| 1078 | + &pwm_device, |
| 1079 | + &pwm_backlight_device, |
1033 | 1080 | &gpio_keys_device,
|
1034 | 1081 | &sh_eth_device,
|
1035 | 1082 | &vcc_sdhi0,
|
@@ -1101,6 +1148,9 @@ static const struct pinctrl_map eva_pinctrl_map[] = {
|
1101 | 1148 | /* ST1232 */
|
1102 | 1149 | PIN_MAP_MUX_GROUP_DEFAULT("0-0055", "pfc-r8a7740",
|
1103 | 1150 | "intc_irq10", "intc"),
|
| 1151 | + /* TPU0 */ |
| 1152 | + PIN_MAP_MUX_GROUP_DEFAULT("renesas-tpu-pwm", "pfc-r8a7740", |
| 1153 | + "tpu0_to2_1", "tpu0"), |
1104 | 1154 | /* USBHS */
|
1105 | 1155 | PIN_MAP_MUX_GROUP_DEFAULT("renesas_usbhs", "pfc-r8a7740",
|
1106 | 1156 | "intc_irq7_1", "intc"),
|
@@ -1154,13 +1204,13 @@ static void __init eva_init(void)
|
1154 | 1204 | ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
|
1155 | 1205 |
|
1156 | 1206 | pinctrl_register_mappings(eva_pinctrl_map, ARRAY_SIZE(eva_pinctrl_map));
|
| 1207 | + pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup)); |
1157 | 1208 |
|
1158 | 1209 | r8a7740_pinmux_init();
|
1159 | 1210 | r8a7740_meram_workaround();
|
1160 | 1211 |
|
1161 | 1212 | /* LCDC0 */
|
1162 | 1213 | gpio_request_one(61, GPIOF_OUT_INIT_HIGH, NULL); /* LCDDON */
|
1163 |
| - gpio_request_one(202, GPIOF_OUT_INIT_LOW, NULL); /* LCD0_LED_CONT */ |
1164 | 1214 |
|
1165 | 1215 | /* Touchscreen */
|
1166 | 1216 | gpio_request_one(166, GPIOF_OUT_INIT_HIGH, NULL); /* TP_RST_B */
|
|
0 commit comments