/*
* arch/arm/mach-tegra/board-dalmore-panel.c
*
- * Copyright (c) 2011-2012, NVIDIA Corporation.
+ * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
+ * This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/ioport.h>
#include <linux/fb.h>
#include <linux/gpio.h>
#include <linux/tegra_pwm_bl.h>
#include <linux/regulator/consumer.h>
+#include <linux/pwm_backlight.h>
+#include <linux/of.h>
#include <mach/irqs.h>
-#include <mach/iomap.h>
#include <mach/dc.h>
+#include <mach/pinmux.h>
+#include <mach/pinmux-t11.h>
#include "board.h"
#include "devices.h"
#include "gpio-names.h"
-#ifdef CONFIG_ARCH_TEGRA_3x_SOC
-#include "tegra3_host1x_devices.h"
-#else
+#include "board-panel.h"
+#include "common.h"
+#include "iomap.h"
#include "tegra11_host1x_devices.h"
-#endif
-
-#define TEGRA_PANEL_ENABLE 1
-
-#if TEGRA_PANEL_ENABLE
-
-#define TEGRA_DSI_GANGED_MODE 0
-#define IS_EXTERNAL_PWM 0
-
-/* PANEL_<diagonal length in inches>_<vendor name>_<resolution> */
-#define PANEL_10_1_PANASONIC_1920_1200 0
-#define PANEL_11_6_AUO_1920_1080 0
-#define PANEL_10_1_SHARP_2560_1600 0
-#define DSI_PANEL_RESET 1
#define DSI_PANEL_RST_GPIO TEGRA_GPIO_PH3
-#define DSI_PANEL_BL_EN_GPIO TEGRA_GPIO_PH2
+#define DSI_PANEL_BL_PWM_GPIO TEGRA_GPIO_PH1
-#define DC_CTRL_MODE TEGRA_DC_OUT_CONTINUOUS_MODE
+struct platform_device * __init dalmore_host1x_init(void)
+{
+ struct platform_device *pdev = NULL;
-static atomic_t sd_brightness = ATOMIC_INIT(255);
-/* regulators */
-#if PANEL_10_1_PANASONIC_1920_1200 || \
- PANEL_11_6_AUO_1920_1080 || \
- PANEL_10_1_SHARP_2560_1600
-static struct regulator *avdd_lcd_3v3;
-static struct regulator *vdd_lcd_bl_12v;
+#ifdef CONFIG_TEGRA_GRHOST
+ if (!of_have_populated_dt())
+ pdev = tegra11_register_host1x_devices();
+ else
+ pdev = to_platform_device(bus_find_device_by_name(
+ &platform_bus_type, NULL, "host1x"));
#endif
+ return pdev;
+}
+
+/* HDMI Hotplug detection pin */
+#define dalmore_hdmi_hpd TEGRA_GPIO_PN7
-static struct resource dalmore_disp1_resources[] __initdata = {
+static struct regulator *dalmore_hdmi_reg;
+static struct regulator *dalmore_hdmi_pll;
+static struct regulator *dalmore_hdmi_vddio;
+
+static struct resource dalmore_disp1_resources[] = {
{
.name = "irq",
.start = INT_DISPLAY_GENERAL,
.end = 0, /* Filled in by dalmore_panel_init() */
.flags = IORESOURCE_MEM,
},
-#if TEGRA_DSI_GANGED_MODE
{
.name = "ganged_dsia_regs",
- .start = TEGRA_DSI_BASE,
- .end = TEGRA_DSI_BASE + TEGRA_DSI_SIZE - 1,
+ .start = 0, /* Filled in the panel file by init_resources() */
+ .end = 0, /* Filled in the panel file by init_resources() */
.flags = IORESOURCE_MEM,
},
{
.name = "ganged_dsib_regs",
- .start = TEGRA_DSIB_BASE,
- .end = TEGRA_DSIB_BASE + TEGRA_DSIB_SIZE - 1,
+ .start = 0, /* Filled in the panel file by init_resources() */
+ .end = 0, /* Filled in the panel file by init_resources() */
.flags = IORESOURCE_MEM,
},
-#else
{
.name = "dsi_regs",
- .start = TEGRA_DSI_BASE,
- .end = TEGRA_DSI_BASE + TEGRA_DSI_SIZE - 1,
+ .start = 0, /* Filled in the panel file by init_resources() */
+ .end = 0, /* Filled in the panel file by init_resources() */
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .name = "mipi_cal",
+ .start = TEGRA_MIPI_CAL_BASE,
+ .end = TEGRA_MIPI_CAL_BASE + TEGRA_MIPI_CAL_SIZE - 1,
.flags = IORESOURCE_MEM,
},
-#endif
};
-static struct resource dalmore_disp2_resources[] __initdata = {
+static struct resource dalmore_disp2_resources[] = {
{
.name = "irq",
.start = INT_DISPLAY_B_GENERAL,
},
};
-static struct tegra_dsi_cmd dsi_init_cmd[] = {
-#if PANEL_10_1_PANASONIC_1920_1200
- /* no init command required */
-#endif
-#if PANEL_11_6_AUO_1920_1080
- /* no init command required */
-#endif
-#if PANEL_10_1_SHARP_2560_1600
- /* TODO */
-#endif
-};
-static struct tegra_dsi_out dalmore_dsi = {
- .n_data_lanes = 4,
- .pixel_format = TEGRA_DSI_PIXEL_FORMAT_24BIT_P,
- .refresh_rate = 60,
- .virtual_channel = TEGRA_DSI_VIRTUAL_CHANNEL_0,
+static struct tegra_dc_sd_settings sd_settings;
- .dsi_instance = 0,
- .controller_vs = DSI_VS_1,
-
- .panel_reset = DSI_PANEL_RESET,
- .power_saving_suspend = true,
- .video_data_type = TEGRA_DSI_VIDEO_TYPE_COMMAND_MODE,
-
- .dsi_init_cmd = dsi_init_cmd,
- .n_init_cmd = ARRAY_SIZE(dsi_init_cmd),
+static struct tegra_dc_out dalmore_disp1_out = {
+ .type = TEGRA_DC_OUT_DSI,
+ .sd_settings = &sd_settings,
};
-static int dalmore_dsi_panel_enable(void)
+static int dalmore_hdmi_enable(struct device *dev)
{
- int err = 0;
-
-#if DSI_PANEL_RESET
- gpio_direction_output(DSI_PANEL_RST_GPIO, 1);
- usleep_range(1000, 5000);
- gpio_set_value(DSI_PANEL_RST_GPIO, 0);
- usleep_range(1000, 5000);
- gpio_set_value(DSI_PANEL_RST_GPIO, 1);
- msleep(20);
-#endif
-
- gpio_direction_output(DSI_PANEL_BL_EN_GPIO, 1);
-
-#if PANEL_10_1_PANASONIC_1920_1200 || \
- PANEL_11_6_AUO_1920_1080 || \
- PANEL_10_1_SHARP_2560_1600
- if (avdd_lcd_3v3) {
- err = regulator_enable(avdd_lcd_3v3);
- if (err < 0) {
- pr_err("avdd_lcd regulator enable failed\n");
- return err;
+ int ret;
+ if (!dalmore_hdmi_reg) {
+ dalmore_hdmi_reg = regulator_get(dev, "avdd_hdmi");
+ if (IS_ERR(dalmore_hdmi_reg)) {
+ pr_err("hdmi: couldn't get regulator avdd_hdmi\n");
+ dalmore_hdmi_reg = NULL;
+ return PTR_ERR(dalmore_hdmi_reg);
}
}
-
- if (vdd_lcd_bl_12v) {
- err = regulator_enable(vdd_lcd_bl_12v);
- if (err < 0) {
- pr_err("vdd_lcd_bl regulator enable failed\n");
- return err;
+ ret = regulator_enable(dalmore_hdmi_reg);
+ if (ret < 0) {
+ pr_err("hdmi: couldn't enable regulator avdd_hdmi\n");
+ return ret;
+ }
+ if (!dalmore_hdmi_pll) {
+ dalmore_hdmi_pll = regulator_get(dev, "avdd_hdmi_pll");
+ if (IS_ERR(dalmore_hdmi_pll)) {
+ pr_err("hdmi: couldn't get regulator avdd_hdmi_pll\n");
+ dalmore_hdmi_pll = NULL;
+ regulator_put(dalmore_hdmi_reg);
+ dalmore_hdmi_reg = NULL;
+ return PTR_ERR(dalmore_hdmi_pll);
}
}
-#endif
- return err;
-}
-
-static int dalmore_dsi_panel_disable(void)
-{
-#if PANEL_10_1_PANASONIC_1920_1200 || \
- PANEL_11_6_AUO_1920_1080 || \
- PANEL_10_1_SHARP_2560_1600
- if (vdd_lcd_bl_12v)
- regulator_disable(vdd_lcd_bl_12v);
-
- if (avdd_lcd_3v3)
- regulator_disable(avdd_lcd_3v3);
-#endif
+ ret = regulator_enable(dalmore_hdmi_pll);
+ if (ret < 0) {
+ pr_err("hdmi: couldn't enable regulator avdd_hdmi_pll\n");
+ return ret;
+ }
return 0;
}
-static int dalmore_dsi_panel_postsuspend(void)
+static int dalmore_hdmi_disable(void)
{
- /* TODO */
- return -EPERM;
-}
-
-static struct tegra_dc_mode dalmore_dsi_modes[] = {
-#if PANEL_10_1_PANASONIC_1920_1200
- {
- .pclk = 10000000,
- .h_ref_to_sync = 4,
- .v_ref_to_sync = 1,
- .h_sync_width = 16,
- .v_sync_width = 2,
- .h_back_porch = 32,
- .v_back_porch = 16,
- .h_active = 1920,
- .v_active = 1200,
- .h_front_porch = 112,
- .v_front_porch = 17,
- },
-#endif
-#if PANEL_11_6_AUO_1920_1080
- {
- .pclk = 10000000,
- .h_ref_to_sync = 4,
- .v_ref_to_sync = 1,
- .h_sync_width = 28,
- .v_sync_width = 5,
- .h_back_porch = 148,
- .v_back_porch = 23,
- .h_active = 1920,
- .v_active = 1080,
- .h_front_porch = 66,
- .v_front_porch = 4,
- },
-#endif
-#if PANEL_10_1_SHARP_2560_1600
- {
- .pclk = 10000000,
- .h_ref_to_sync = 4,
- .v_ref_to_sync = 1,
- .h_sync_width = 16,
- .v_sync_width = 2,
- .h_back_porch = 16,
- .v_back_porch = 33,
- .h_active = 2560,
- .v_active = 1600,
- .h_front_porch = 128,
- .v_front_porch = 10,
- },
-#endif
-};
-
-static struct tegra_dc_out dalmore_disp1_out = {
- .type = TEGRA_DC_OUT_DSI,
- .dsi = &dalmore_dsi,
-
- .flags = DC_CTRL_MODE,
-
- .modes = dalmore_dsi_modes,
- .n_modes = ARRAY_SIZE(dalmore_dsi_modes),
-
- .enable = dalmore_dsi_panel_enable,
- .disable = dalmore_dsi_panel_disable,
- .postsuspend = dalmore_dsi_panel_postsuspend,
+ if (dalmore_hdmi_reg) {
+ regulator_disable(dalmore_hdmi_reg);
+ regulator_put(dalmore_hdmi_reg);
+ dalmore_hdmi_reg = NULL;
+ }
-#if PANEL_10_1_PANASONIC_1920_1200
- .width = 217,
- .height = 135,
-#endif
-#if PANEL_11_6_AUO_1920_1080
- .width = 256,
- .height = 144,
-#endif
-#if PANEL_10_1_SHARP_2560_1600
- .width = 216,
- .height = 135,
-#endif
-};
+ if (dalmore_hdmi_pll) {
+ regulator_disable(dalmore_hdmi_pll);
+ regulator_put(dalmore_hdmi_pll);
+ dalmore_hdmi_pll = NULL;
+ }
-static int dalmore_hdmi_enable(void)
-{
- /* TODO */
- return -EPERM;
+ return 0;
}
-static int dalmore_hdmi_disable(void)
+static int dalmore_hdmi_postsuspend(void)
{
- /* TODO */
- return -EPERM;
+ if (dalmore_hdmi_vddio) {
+ regulator_disable(dalmore_hdmi_vddio);
+ regulator_put(dalmore_hdmi_vddio);
+ dalmore_hdmi_vddio = NULL;
+ }
+ return 0;
}
-static int dalmore_hdmi_postsuspend(void)
+static int dalmore_hdmi_hotplug_init(struct device *dev)
{
- /* TODO */
- return -EPERM;
+ int e = 0;
+
+ if (!dalmore_hdmi_vddio) {
+ dalmore_hdmi_vddio = regulator_get(dev, "vdd_hdmi_5v0");
+ if (WARN_ON(IS_ERR(dalmore_hdmi_vddio))) {
+ e = PTR_ERR(dalmore_hdmi_vddio);
+ pr_err("%s: couldn't get regulator vdd_hdmi_5v0: %d\n",
+ __func__, e);
+ dalmore_hdmi_vddio = NULL;
+ } else {
+ e = regulator_enable(dalmore_hdmi_vddio);
+ }
+ }
+
+ return e;
}
-static int dalmore_hdmi_hotplug_init(void)
+static void dalmore_hdmi_hotplug_report(bool state)
{
- /* TODO */
- return -EPERM;
+ if (state) {
+ tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_DDC_SDA,
+ TEGRA_PUPD_PULL_DOWN);
+ tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_DDC_SCL,
+ TEGRA_PUPD_PULL_DOWN);
+ } else {
+ tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_DDC_SDA,
+ TEGRA_PUPD_NORMAL);
+ tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_DDC_SCL,
+ TEGRA_PUPD_NORMAL);
+ }
}
+/* Electrical characteristics for HDMI, all modes must be declared here */
+struct tmds_config dalmore_tmds_config[] = {
+ { /* 480p : 27 MHz and below */
+ .pclk = 27000000,
+ .pll0 = 0x01003010,
+ .pll1 = 0x00301b00,
+ .drive_current = 0x23232323,
+ .pe_current = 0x00000000,
+ .peak_current = 0x00000000,
+ },
+ { /* 720p : 74.25MHz modes */
+ .pclk = 74250000,
+ .pll0 = 0x01003110,
+ .pll1 = 0x00301b00,
+ .drive_current = 0x25252525,
+ .pe_current = 0x00000000,
+ .peak_current = 0x03030303,
+ },
+ { /* 1080p : 148.5MHz modes */
+ .pclk = 148500000,
+ .pll0 = 0x01003310,
+ .pll1 = 0x00301b00,
+ .drive_current = 0x27272727,
+ .pe_current = 0x00000000,
+ .peak_current = 0x03030303,
+ },
+ { /* 4K : 297MHz modes */
+ .pclk = INT_MAX,
+ .pll0 = 0x01003f10,
+ .pll1 = 0x00300f00,
+ .drive_current = 0x303f3f3f,
+ .pe_current = 0x00000000,
+ .peak_current = 0x040f0f0f,
+ },
+};
+
+struct tegra_hdmi_out dalmore_hdmi_out = {
+ .tmds_config = dalmore_tmds_config,
+ .n_tmds_config = ARRAY_SIZE(dalmore_tmds_config),
+};
+
static struct tegra_dc_out dalmore_disp2_out = {
.type = TEGRA_DC_OUT_HDMI,
.flags = TEGRA_DC_OUT_HOTPLUG_HIGH,
.parent_clk = "pll_d2_out0",
.dcc_bus = 3,
+ .hotplug_gpio = dalmore_hdmi_hpd,
+ .hdmi_out = &dalmore_hdmi_out,
+
+ .max_pixclock = KHZ2PICOS(297000),
- .max_pixclock = KHZ2PICOS(148500),
+ .align = TEGRA_DC_ALIGN_MSB,
+ .order = TEGRA_DC_ORDER_RED_BLUE,
.enable = dalmore_hdmi_enable,
.disable = dalmore_hdmi_disable,
.postsuspend = dalmore_hdmi_postsuspend,
.hotplug_init = dalmore_hdmi_hotplug_init,
+ .hotplug_report = dalmore_hdmi_hotplug_report,
};
static struct tegra_fb_data dalmore_disp1_fb_data = {
.win = 0,
.bits_per_pixel = 32,
.flags = TEGRA_FB_FLIP_ON_PROBE,
-#if PANEL_10_1_PANASONIC_1920_1200
- .xres = 1920,
- .yres = 1200,
-#endif
-#if PANEL_11_6_AUO_1920_1080
- .xres = 1920,
- .yres = 1080,
-#endif
-#if PANEL_10_1_SHARP_2560_1600
- .xres = 2560,
- .yres = 1600,
-#endif
};
static struct tegra_dc_platform_data dalmore_disp1_pdata = {
.default_out = &dalmore_disp1_out,
.fb = &dalmore_disp1_fb_data,
.emc_clk_rate = 204000000,
+#ifdef CONFIG_TEGRA_DC_CMU
+ .cmu_enable = 1,
+#endif
};
static struct tegra_fb_data dalmore_disp2_fb_data = {
.win = 0,
+ .xres = 1280,
+ .yres = 720,
.bits_per_pixel = 32,
.flags = TEGRA_FB_FLIP_ON_PROBE,
};
.default_out = &dalmore_disp2_out,
.fb = &dalmore_disp2_fb_data,
.emc_clk_rate = 300000000,
+#ifdef CONFIG_TEGRA_DC_CMU
+ .cmu_enable = 1,
+#endif
};
-static struct nvhost_device dalmore_disp2_device __initdata = {
+static struct platform_device dalmore_disp2_device = {
.name = "tegradc",
.id = 1,
.resource = dalmore_disp2_resources,
},
};
-static struct nvhost_device dalmore_disp1_device __initdata = {
+static struct platform_device dalmore_disp1_device = {
.name = "tegradc",
.id = 0,
.resource = dalmore_disp1_resources,
.usage_mask = NVMAP_HEAP_CARVEOUT_IRAM,
.base = TEGRA_IRAM_BASE + TEGRA_RESET_HANDLER_SIZE,
.size = TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE,
- .buddy_size = 0, /* no buddy allocation for IRAM */
},
[1] = {
.name = "generic-0",
.usage_mask = NVMAP_HEAP_CARVEOUT_GENERIC,
.base = 0, /* Filled in by dalmore_panel_init() */
.size = 0, /* Filled in by dalmore_panel_init() */
- .buddy_size = SZ_32K,
},
[2] = {
.name = "vpr",
.usage_mask = NVMAP_HEAP_CARVEOUT_VPR,
.base = 0, /* Filled in by dalmore_panel_init() */
.size = 0, /* Filled in by dalmore_panel_init() */
- .buddy_size = SZ_32K,
},
};
.carveouts = dalmore_carveouts,
.nr_carveouts = ARRAY_SIZE(dalmore_carveouts),
};
-
-static struct platform_device dalmore_nvmap_device __initdata = {
+static struct platform_device dalmore_nvmap_device = {
.name = "tegra-nvmap",
.id = -1,
.dev = {
},
};
-static int dalmore_disp1_bl_notify(struct device *unused, int brightness)
+static void dalmore_panel_select(void)
{
- int cur_sd_brightness = atomic_read(&sd_brightness);
-
- /* SD brightness is a percentage */
- brightness = (brightness * cur_sd_brightness) / 255;
-
- /* Apply any backlight response curve */
- if (brightness > 255)
- pr_info("Error: Brightness > 255!\n");
- else
- /* TODO: backlight response LUT */
- brightness = brightness;
-
- return brightness;
-}
-
-static int dalmore_disp1_check_fb(struct device *dev, struct fb_info *info)
-{
- return info->device == &dalmore_disp1_device.dev;
-}
-
-static struct platform_tegra_pwm_backlight_data dalmore_disp1_bl_data = {
- .which_dc = 0,
- .which_pwm = TEGRA_PWM_PM1,
- .gpio_conf_to_sfio = TEGRA_GPIO_PH1,
- .max_brightness = 255,
- .dft_brightness = 224,
- .notify = dalmore_disp1_bl_notify,
- .period = 0x3F,
- .clk_div = 0x3FF,
- .clk_select = 0,
- /* Only toggle backlight on fb blank notifications for disp1 */
- .check_fb = dalmore_disp1_check_fb,
-};
-
-static struct platform_device dalmore_disp1_bl_device __initdata = {
- .name = "tegra-pwm-bl",
- .id = -1,
- .dev = {
- .platform_data = &dalmore_disp1_bl_data,
- },
-};
+ struct tegra_panel *panel = NULL;
+ struct board_info board;
+ u8 dsi_instance;
+
+ tegra_get_display_board_info(&board);
+
+ switch (board.board_id) {
+ case BOARD_E1639:
+ panel = &dsi_s_wqxga_10_1;
+ /* FIXME: panel used ganged mode,need to check if
+ * the dsi_instance is useful in this case
+ */
+ dsi_instance = DSI_INSTANCE_0;
+ break;
+ case BOARD_E1631:
+ panel = &dsi_a_1080p_11_6;
+ dsi_instance = DSI_INSTANCE_0;
+ break;
+ case BOARD_E1627:
+ /* fall through */
+ default:
+ panel = &dsi_p_wuxga_10_1;
+ dsi_instance = DSI_INSTANCE_0;
+ break;
+ }
+ if (panel) {
+ if (panel->init_sd_settings)
+ panel->init_sd_settings(&sd_settings);
+
+ if (panel->init_dc_out) {
+ panel->init_dc_out(&dalmore_disp1_out);
+ dalmore_disp1_out.dsi->dsi_instance = dsi_instance;
+ dalmore_disp1_out.dsi->dsi_panel_rst_gpio =
+ DSI_PANEL_RST_GPIO;
+ dalmore_disp1_out.dsi->dsi_panel_bl_pwm_gpio =
+ DSI_PANEL_BL_PWM_GPIO;
+ }
-static int dalmore_dsi_regulator_get(void)
-{
- int err = 0;
+ if (panel->init_fb_data)
+ panel->init_fb_data(&dalmore_disp1_fb_data);
-#if PANEL_10_1_PANASONIC_1920_1200 || \
- PANEL_11_6_AUO_1920_1080 || \
- PANEL_10_1_SHARP_2560_1600
- avdd_lcd_3v3 = regulator_get(NULL, "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;
- return err;
- }
+ if (panel->init_cmu_data)
+ panel->init_cmu_data(&dalmore_disp1_pdata);
- vdd_lcd_bl_12v = regulator_get(NULL, "vdd_lcd_bl");
- if (IS_ERR_OR_NULL(vdd_lcd_bl_12v)) {
- pr_err("vdd_lcd_bl regulator get failed\n");
- err = PTR_ERR(vdd_lcd_bl_12v);
- vdd_lcd_bl_12v = NULL;
- return err;
- }
-#endif
- return err;
-}
+ if (panel->set_disp_device)
+ panel->set_disp_device(&dalmore_disp1_device);
-static int dalmore_dsi_gpio_get(void)
-{
- int err = 0;
+ tegra_dsi_resources_init(dsi_instance, dalmore_disp1_resources,
+ ARRAY_SIZE(dalmore_disp1_resources));
- err = gpio_request(DSI_PANEL_RST_GPIO, "panel rst");
- if (err < 0) {
- pr_err("panel reset gpio request failed\n");
- return err;
- }
+ if (panel->register_bl_dev)
+ panel->register_bl_dev();
- err = gpio_request(DSI_PANEL_BL_EN_GPIO, "panel backlight");
- if (err < 0) {
- pr_err("panel backlight gpio request failed\n");
- return err;
+ if (panel->register_i2c_bridge)
+ panel->register_i2c_bridge();
}
- return err;
}
-
int __init dalmore_panel_init(void)
{
int err = 0;
struct resource __maybe_unused *res;
+ struct platform_device *phost1x = NULL;
+
+ dalmore_panel_select();
#ifdef CONFIG_TEGRA_NVMAP
dalmore_carveouts[1].base = tegra_carveout_start;
dalmore_carveouts[1].size = tegra_carveout_size;
dalmore_carveouts[2].base = tegra_vpr_start;
dalmore_carveouts[2].size = tegra_vpr_size;
+#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
+ dalmore_carveouts[1].cma_dev = &tegra_generic_cma_dev;
+ dalmore_carveouts[1].resize = false;
+ dalmore_carveouts[2].cma_dev = &tegra_vpr_cma_dev;
+ dalmore_carveouts[2].resize = true;
+ dalmore_carveouts[2].cma_chunk_size = SZ_32M;
+#endif
err = platform_device_register(&dalmore_nvmap_device);
if (err) {
}
#endif
-#ifdef CONFIG_TEGRA_GRHOST
-#ifdef CONFIG_ARCH_TEGRA_3x_SOC
- err = tegra3_register_host1x_devices();
-#else
- err = tegra11_register_host1x_devices();
-#endif
- if (err) {
+ phost1x = dalmore_host1x_init();
+ if (!phost1x) {
pr_err("host1x devices registration failed\n");
- return err;
+ return -EINVAL;
}
-#ifdef CONFIG_TEGRA_DC
- res = nvhost_get_resource_byname(&dalmore_disp1_device,
+ res = platform_get_resource_byname(&dalmore_disp1_device,
IORESOURCE_MEM, "fbmem");
res->start = tegra_fb_start;
res->end = tegra_fb_start + tegra_fb_size - 1;
- res = nvhost_get_resource_byname(&dalmore_disp2_device,
- IORESOURCE_MEM, "fbmem");
- res->start = tegra_fb2_start;
- res->end = tegra_fb2_start + tegra_fb2_size - 1;
+ /* Copy the bootloader fb to the fb. */
+ if (tegra_bootloader_fb_size)
+ __tegra_move_framebuffer(&dalmore_nvmap_device,
+ tegra_fb_start, tegra_bootloader_fb_start,
+ min(tegra_fb_size, tegra_bootloader_fb_size));
+ else
+ __tegra_clear_framebuffer(&dalmore_nvmap_device,
+ tegra_fb_start, tegra_fb_size);
- err = nvhost_device_register(&dalmore_disp1_device);
+ dalmore_disp1_device.dev.parent = &phost1x->dev;
+ err = platform_device_register(&dalmore_disp1_device);
if (err) {
pr_err("disp1 device registration failed\n");
return err;
}
- err = nvhost_device_register(&dalmore_disp2_device);
- if (err) {
- pr_err("disp2 device registration failed\n");
+ err = tegra_init_hdmi(&dalmore_disp2_device, phost1x);
+ if (err)
return err;
- }
-
-#if !IS_EXTERNAL_PWM
- err = platform_device_register(&dalmore_disp1_bl_device);
- if (err) {
- pr_err("disp1 bl device registration failed");
- return err;
- }
-#endif
-
- err = dalmore_dsi_regulator_get();
- if (err < 0) {
- pr_err("regulator get failed\n");
- return err;
- }
-
- err = dalmore_dsi_gpio_get();
- if (err < 0) {
- pr_err("panel gpio get failed\n");
- return err;
- }
-#endif
#ifdef CONFIG_TEGRA_NVAVP
- err = nvhost_device_register(&nvavp_device);
+ nvavp_device.dev.parent = &phost1x->dev;
+ err = platform_device_register(&nvavp_device);
if (err) {
pr_err("nvavp device registration failed\n");
return err;
}
-#endif
#endif
return err;
}
-#else
-int __init dalmore_panel_init(void)
-{
- return -ENODEV;
-}
-#endif