arm: tegra: macallan: Runtime panel detection for
Vick Yu [Tue, 26 Feb 2013 08:41:00 +0000 (16:41 +0800)]
 sharp 25x16.

Bug 1241867

Change-Id: I34e2a258fe12960e07d43ded3bdedbd0046b6037
Signed-off-by: Vick Yu <vyu@nvidia.com>
Reviewed-on: http://git-master/r/221529
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Tested-by: Bitan Biswas <bbiswas@nvidia.com>

arch/arm/mach-tegra/board-macallan-panel.c
arch/arm/mach-tegra/panel-s-wqxga-10-1.c

index aadd2a2..bcfd4fe 100644 (file)
@@ -390,6 +390,9 @@ static void macallan_panel_select(void)
        tegra_get_display_board_info(&board);
 
        switch (board.board_id) {
+       case BOARD_E1639:
+               panel = &dsi_s_wqxga_10_1;
+               break;
        default:
                panel = &dsi_p_wuxga_10_1;
                dsi_instance = DSI_INSTANCE_0;
index 2fd9743..766949d 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/max8831_backlight.h>
 #include <linux/leds.h>
 #include <linux/ioport.h>
+#include <generated/mach-types.h>
 #include "board.h"
 #include "board-panel.h"
 #include "devices.h"
@@ -189,16 +190,77 @@ fail:
        return err;
 }
 
+static int macallan_dsi_regulator_get(struct device *dev)
+{
+       int err = 0;
+
+       if (reg_requested)
+               return 0;
+
+       avdd_lcd_3v3 = regulator_get(dev, "avdd_lcd");
+       if (IS_ERR_OR_NULL(avdd_lcd_3v3)) {
+               pr_err("avdd_lcd regulator get failed\n");
+               err = PTR_ERR(avdd_lcd_3v3);
+               avdd_lcd_3v3 = NULL;
+               goto fail;
+       }
+
+       vdd_lcd_bl_en = regulator_get(dev, "vdd_lcd_bl_en");
+       if (IS_ERR_OR_NULL(vdd_lcd_bl_en)) {
+               pr_err("vdd_lcd_bl_en regulator get failed\n");
+               err = PTR_ERR(vdd_lcd_bl_en);
+               vdd_lcd_bl_en = NULL;
+               goto fail;
+       }
+       reg_requested = true;
+       return 0;
+fail:
+       return err;
+}
+
+static int macallan_dsi_gpio_get(void)
+{
+       int err = 0;
+
+       if (gpio_requested)
+               return 0;
+
+       err = gpio_request(dsi_s_wqxga_10_1_pdata.dsi_panel_rst_gpio,
+        "panel rst");
+       if (err < 0) {
+               pr_err("panel reset gpio request failed\n");
+               goto fail;
+       }
+
+       /* free pwm GPIO */
+       err = gpio_request(dsi_s_wqxga_10_1_pdata.dsi_panel_bl_pwm_gpio,
+        "panel pwm");
+       if (err < 0) {
+               pr_err("panel pwm gpio request failed\n");
+               goto fail;
+       }
+       gpio_free(dsi_s_wqxga_10_1_pdata.dsi_panel_bl_pwm_gpio);
+       gpio_requested = true;
+       return 0;
+fail:
+       return err;
+}
 static int dsi_s_wqxga_10_1_enable(struct device *dev)
 {
        int err = 0;
 
-       err = dalmore_dsi_regulator_get(dev);
+       if (machine_is_dalmore())
+               err = dalmore_dsi_regulator_get(dev);
+       else if (machine_is_macallan())
+               err = macallan_dsi_regulator_get(dev);
        if (err < 0) {
                pr_err("dsi regulator get failed\n");
                goto fail;
        }
-       err = dalmore_dsi_gpio_get();
+       if (machine_is_dalmore())
+               err = dalmore_dsi_gpio_get();
+       else if (machine_is_macallan())
+               err = macallan_dsi_gpio_get();
        if (err < 0) {
                pr_err("dsi gpio request failed\n");
                goto fail;