diff options
-rw-r--r-- | src/mainboard/google/nyan/devicetree.cb | 2 | ||||
-rw-r--r-- | src/mainboard/google/nyan_big/devicetree.cb | 2 | ||||
-rw-r--r-- | src/soc/nvidia/tegra124/display.c | 16 |
3 files changed, 13 insertions, 7 deletions
diff --git a/src/mainboard/google/nyan/devicetree.cb b/src/mainboard/google/nyan/devicetree.cb index 58945568e9..5ae86913d1 100644 --- a/src/mainboard/google/nyan/devicetree.cb +++ b/src/mainboard/google/nyan/devicetree.cb @@ -38,7 +38,7 @@ chip soc/nvidia/tegra124 register "lvds_shutdown_gpio" = "0" register "backlight_vdd_gpio" = "GPIO(P2)" register "panel_vdd_gpio" = "0" - register "pwm" = "GPIO(H1)" + register "pwm" = "1" # taken from u-boot; these look wrong however. register "vdd_delay" = "400" diff --git a/src/mainboard/google/nyan_big/devicetree.cb b/src/mainboard/google/nyan_big/devicetree.cb index cb55b72b93..9541ce9c9d 100644 --- a/src/mainboard/google/nyan_big/devicetree.cb +++ b/src/mainboard/google/nyan_big/devicetree.cb @@ -38,7 +38,7 @@ chip soc/nvidia/tegra124 register "lvds_shutdown_gpio" = "0" register "backlight_vdd_gpio" = "GPIO(P2)" register "panel_vdd_gpio" = "0" - register "pwm" = "GPIO(H1)" + register "pwm" = "1" # taken from u-boot; these look wrong however. register "vdd_delay" = "400" diff --git a/src/soc/nvidia/tegra124/display.c b/src/soc/nvidia/tegra124/display.c index 2fbec50cf8..8c4e8232dd 100644 --- a/src/soc/nvidia/tegra124/display.c +++ b/src/soc/nvidia/tegra124/display.c @@ -33,6 +33,7 @@ #include <edid.h> #include <soc/clock.h> #include <soc/nvidia/tegra/dc.h> +#include <soc/nvidia/tegra/pwm.h> #include <soc/nvidia/tegra124/sdram.h> #include "chip.h" #include <soc/display.h> @@ -240,6 +241,7 @@ void display_startup(device_t dev) int i; struct soc_nvidia_tegra124_config *config = dev->chip_info; struct display_controller *dc = (void *)config->display_controller; + struct pwm_controller *pwm = (void *)TEGRA_PWM_BASE; struct disp_ctl_win window; /* should probably just make it all MiB ... in future */ @@ -270,11 +272,15 @@ void display_startup(device_t dev) __func__, config->backlight_en_gpio, 1); } - if (config->pwm){ - gpio_output(config->pwm, 1); - printk(BIOS_SPEW,"%s: pwm setting gpio %08x to %d\n", - __func__, config->pwm, 1); - } + /* Set up Tegra PWM n (where n is specified in config->pwm) to drive the + * panel backlight. + */ + printk(BIOS_SPEW, "%s: enable panel backlight pwm\n", __func__); + WRITEL(((1 << NV_PWM_CSR_ENABLE_SHIFT) | + (220 << NV_PWM_CSR_PULSE_WIDTH_SHIFT) | /* 220/256 */ + 0x02e), /* frequency divider */ + &pwm->pwm[config->pwm].csr); + printk(BIOS_SPEW, "%s: xres %d yres %d framebuffer_bits_per_pixel %d\n", __func__, |