Skip to content

Commit

Permalink
board tf101 panel backlight troubles fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mozggg committed Jun 26, 2013
1 parent 0714ea1 commit 5ddd965
Showing 1 changed file with 40 additions and 32 deletions.
72 changes: 40 additions & 32 deletions arch/arm/mach-tegra/board-tf101-panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
#define tf101_pnl_to_lvds_ms 0
#define tf101_lvds_to_bl_ms 200

#ifdef CONFIG_TEGRA_DC
static struct regulator *tf101_hdmi_reg = NULL;
static struct regulator *tf101_hdmi_pll = NULL;
static struct regulator *pnl_pwr;

#endif

static int tf101_backlight_init(struct device *dev) {
int ret;
Expand All @@ -64,13 +64,16 @@ static int tf101_backlight_init(struct device *dev) {
ret = gpio_direction_output(tf101_bl_enb, 1);
if (ret < 0)
gpio_free(tf101_bl_enb);
else
tegra_gpio_enable(tf101_bl_enb);

return ret;
};

static void tf101_backlight_exit(struct device *dev) {
gpio_set_value(tf101_bl_enb, 0);
gpio_free(tf101_bl_enb);
tegra_gpio_disable(tf101_bl_enb);
}

static int tf101_backlight_notify(struct device *unused, int brightness)
Expand Down Expand Up @@ -101,25 +104,17 @@ static struct platform_device tf101_backlight_device = {
},
};

#ifdef CONFIG_TEGRA_DC
static int tf101_panel_enable(void)
{
struct regulator *reg = regulator_get(NULL, "vdd_ldo4");

if (reg) {
if (!reg) {
regulator_enable(reg);
regulator_put(reg);
}

if (pnl_pwr == NULL) {
pnl_pwr = regulator_get(NULL, "pnl_pwr");
if (WARN_ON(IS_ERR(pnl_pwr)))
pr_err("%s: couldn't get regulator pnl_pwr: %ld\n",
__func__, PTR_ERR(pnl_pwr));
else
regulator_enable(pnl_pwr);
} else {
regulator_enable(pnl_pwr);
}
gpio_set_value(tf101_pnl_pwr_enb, 1);
mdelay(tf101_pnl_to_lvds_ms);
gpio_set_value(tf101_lvds_shutdown, 1);
mdelay(tf101_lvds_to_bl_ms);
Expand All @@ -129,7 +124,7 @@ static int tf101_panel_enable(void)
static int tf101_panel_disable(void)
{
gpio_set_value(tf101_lvds_shutdown, 0);
regulator_disable(pnl_pwr);
gpio_set_value(tf101_pnl_pwr_enb, 0);
return 0;
}

Expand Down Expand Up @@ -231,7 +226,9 @@ static struct tegra_fb_data tf101_fb_data = {
.xres = 1280,
.yres = 800,
.bits_per_pixel = 32,
.flags = TEGRA_FB_FLIP_ON_PROBE,
/* The flag, TEGRA_FB_FLIP_ON_PROBE, will make artifacts from bootloader FB
* before boot animation starts.*/
// .flags = TEGRA_FB_FLIP_ON_PROBE,
};

static struct tegra_fb_data tf101_hdmi_fb_data = {
Expand Down Expand Up @@ -280,7 +277,7 @@ static struct tegra_dc_platform_data tf101_disp1_pdata = {
};

static struct tegra_dc_platform_data tf101_disp2_pdata = {
.flags = TEGRA_DC_FLAG_ENABLED,
.flags = 0,
.default_out = &tf101_disp2_out,
.fb = &tf101_hdmi_fb_data,
};
Expand Down Expand Up @@ -309,6 +306,12 @@ static struct nvhost_device tf101_disp2_device = {
.platform_data = &tf101_disp2_pdata,
},
};
#else
static int tf101_disp1_check_fb(struct device *dev, struct fb_info *info)
{
return 0;
}
#endif

static struct nvmap_platform_carveout tf101_carveouts[] = {
[0] = NVMAP_HEAP_CARVEOUT_IRAM_INIT,
Expand Down Expand Up @@ -336,7 +339,7 @@ static struct platform_device *tf101_gfx_devices[] __initdata = {
&tf101_nvmap_device,
&tegra_pwfm2_device,
};
static struct platform_device *ventana_backlight_devices[] __initdata = {
static struct platform_device *tf101_backlight_devices[] __initdata = {
&tf101_backlight_device,
};

Expand All @@ -354,8 +357,16 @@ static void tf101_panel_early_suspend(struct early_suspend *h)
if (num_registered_fb > 1)
fb_blank(registered_fb[1], FB_BLANK_NORMAL);
#ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
cpufreq_store_default_gov();
cpufreq_change_gov(cpufreq_conservative_gov);
cpufreq_save_default_governor();
cpufreq_set_conservative_governor();
cpufreq_set_conservative_governor_param("up_threshold",
SET_CONSERVATIVE_GOVERNOR_UP_THRESHOLD);

cpufreq_set_conservative_governor_param("down_threshold",
SET_CONSERVATIVE_GOVERNOR_DOWN_THRESHOLD);

cpufreq_set_conservative_governor_param("freq_step",
SET_CONSERVATIVE_GOVERNOR_FREQ_STEP);
#endif
}

Expand Down Expand Up @@ -390,14 +401,21 @@ void tf101_clear_framebuffer(unsigned long base, unsigned long size)
int __init tf101_panel_init(void)
{
int err;
struct resource *res;
struct resource __maybe_unused *res;

gpio_request(tf101_pnl_pwr_enb, "pnl_pwr_enb");
gpio_direction_output(tf101_pnl_pwr_enb, 1);
tegra_gpio_enable(tf101_pnl_pwr_enb);

gpio_request(tf101_lvds_shutdown, "lvds_shdn");
gpio_direction_output(tf101_lvds_shutdown, 1);
tegra_gpio_enable(tf101_lvds_shutdown);

tegra_gpio_enable(tf101_hdmi_enb);
gpio_request(tf101_hdmi_enb, "hdmi_5v_en");
gpio_direction_output(tf101_hdmi_enb, 1);

tegra_gpio_enable(tf101_hdmi_hpd);
gpio_request(tf101_hdmi_hpd, "hdmi_hpd");
gpio_direction_input(tf101_hdmi_hpd);

Expand Down Expand Up @@ -432,16 +450,6 @@ int __init tf101_panel_init(void)
IORESOURCE_MEM, "fbmem");
res->start = tegra_fb2_start;
res->end = tegra_fb2_start + tegra_fb2_size - 1;
/*
* If the bootloader fb2 is valid, copy it to the fb2, or else
* clear fb2 to avoid garbage on dispaly2.
*/
if (tegra_bootloader_fb2_size)
tegra_move_framebuffer(tegra_fb2_start,
tegra_bootloader_fb2_start,
min(tegra_fb2_size, tegra_bootloader_fb2_size));
else
tegra_clear_framebuffer(tegra_fb2_start, tegra_fb2_size);

if (!err)
err = nvhost_device_register(&tf101_disp1_device);
Expand All @@ -450,8 +458,8 @@ int __init tf101_panel_init(void)
err = nvhost_device_register(&tf101_disp2_device);
#endif

err = platform_add_devices(ventana_backlight_devices,
ARRAY_SIZE(ventana_backlight_devices));
err = platform_add_devices(tf101_backlight_devices,
ARRAY_SIZE(tf101_backlight_devices));

return err;
}
Expand Down

0 comments on commit 5ddd965

Please sign in to comment.