tegra124: Program PWM1 to drive panel backlight

Repurpose config->pwm to mean the particular PWM device (we use PWM1 on
nyan), and add code to program the PWM device.

BUG=none
TEST=emerge-nyan chromeos-coreboot-nyan, regenerate bootimage, and boot.
See that the backlight comes up in the bootloader, and brightness can be
adjusted via pwm_bl driver in the kernel.

Original-Change-Id: I2db047e5ef23c0e8fb66dd05ad6339d60918d493
Original-Signed-off-by: Andrew Chew <achew@nvidia.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/185772
Original-Reviewed-by: Andrew Bresticker <abrestic@chromium.org>
(cherry picked from commit 0dee98dd0c8510ecd630b5c6cb9ea49724dc8b55)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>

Change-Id: Ie53610f3afa30b2d8f484685fb0e8c0b12cd8241
Reviewed-on: http://review.coreboot.org/7402
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
Andrew Chew 2014-02-10 16:44:18 -08:00 committed by Marc Jones
parent 372a5bbd66
commit 7f0cb15999
3 changed files with 13 additions and 7 deletions

View File

@ -38,7 +38,7 @@ chip soc/nvidia/tegra124
register "lvds_shutdown_gpio" = "0" register "lvds_shutdown_gpio" = "0"
register "backlight_vdd_gpio" = "GPIO(P2)" register "backlight_vdd_gpio" = "GPIO(P2)"
register "panel_vdd_gpio" = "0" register "panel_vdd_gpio" = "0"
register "pwm" = "GPIO(H1)" register "pwm" = "1"
# taken from u-boot; these look wrong however. # taken from u-boot; these look wrong however.
register "vdd_delay" = "400" register "vdd_delay" = "400"

View File

@ -38,7 +38,7 @@ chip soc/nvidia/tegra124
register "lvds_shutdown_gpio" = "0" register "lvds_shutdown_gpio" = "0"
register "backlight_vdd_gpio" = "GPIO(P2)" register "backlight_vdd_gpio" = "GPIO(P2)"
register "panel_vdd_gpio" = "0" register "panel_vdd_gpio" = "0"
register "pwm" = "GPIO(H1)" register "pwm" = "1"
# taken from u-boot; these look wrong however. # taken from u-boot; these look wrong however.
register "vdd_delay" = "400" register "vdd_delay" = "400"

View File

@ -33,6 +33,7 @@
#include <edid.h> #include <edid.h>
#include <soc/clock.h> #include <soc/clock.h>
#include <soc/nvidia/tegra/dc.h> #include <soc/nvidia/tegra/dc.h>
#include <soc/nvidia/tegra/pwm.h>
#include <soc/nvidia/tegra124/sdram.h> #include <soc/nvidia/tegra124/sdram.h>
#include "chip.h" #include "chip.h"
#include <soc/display.h> #include <soc/display.h>
@ -240,6 +241,7 @@ void display_startup(device_t dev)
int i; int i;
struct soc_nvidia_tegra124_config *config = dev->chip_info; struct soc_nvidia_tegra124_config *config = dev->chip_info;
struct display_controller *dc = (void *)config->display_controller; struct display_controller *dc = (void *)config->display_controller;
struct pwm_controller *pwm = (void *)TEGRA_PWM_BASE;
struct disp_ctl_win window; struct disp_ctl_win window;
/* should probably just make it all MiB ... in future */ /* 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); __func__, config->backlight_en_gpio, 1);
} }
if (config->pwm){ /* Set up Tegra PWM n (where n is specified in config->pwm) to drive the
gpio_output(config->pwm, 1); * panel backlight.
printk(BIOS_SPEW,"%s: pwm setting gpio %08x to %d\n", */
__func__, config->pwm, 1); 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, printk(BIOS_SPEW,
"%s: xres %d yres %d framebuffer_bits_per_pixel %d\n", "%s: xres %d yres %d framebuffer_bits_per_pixel %d\n",
__func__, __func__,