int __init cardhu_panel_init(void) { int err; struct resource __maybe_unused *res; tegra_get_board_info(&board_info); tegra_get_display_board_info(&display_board_info); #if defined(CONFIG_TEGRA_NVMAP) cardhu_carveouts[1].base = tegra_carveout_start; cardhu_carveouts[1].size = tegra_carveout_size; #endif #if defined(CONFIG_ION_TEGRA) tegra_ion_data.heaps[0].base = tegra_carveout_start; tegra_ion_data.heaps[0].size = tegra_carveout_size; #endif cardhu_panel_preinit(); if (is_dsi_panel()) { if (is_panel_1506) { /* * HACK: To be Removed */ int i; struct clk *c = tegra_get_clock_by_name("dsia"); for (i = 0; i < c->dvfs->num_freqs; i++) c->dvfs->freqs[i] = 500000000; } goto skip_lvds; } #if defined(CONFIG_TEGRA_DC) if (WARN_ON(board_info.board_id == BOARD_E1291 && ((board_info.sku & SKU_TOUCHSCREEN_MECH_FIX) == 0))) { /* use 55Hz panel timings to reduce noise on sensitive touch */ printk("Using cardhu_panel_modes_55hz\n"); cardhu_disp1_out.parent_clk = "pll_p"; cardhu_disp1_out.modes = cardhu_panel_modes_55hz; cardhu_disp1_out.n_modes = ARRAY_SIZE(cardhu_panel_modes_55hz); } if (display_board_info.board_id == BOARD_DISPLAY_PM313) { /* initialize the values */ #if defined(PM313_LVDS_PANEL_19X12) cardhu_disp1_out.modes = panel_19X12_modes; cardhu_disp1_out.n_modes = ARRAY_SIZE(panel_19X12_modes); cardhu_disp1_out.parent_clk = "pll_d_out0"; #if (PM313_LVDS_PANEL_BPP == 1) cardhu_disp1_out.depth = 18; #else cardhu_disp1_out.depth = 24; #endif cardhu_fb_data.xres = 1920; cardhu_fb_data.yres = 1200; cardhu_disp2_out.parent_clk = "pll_d2_out0"; cardhu_hdmi_fb_data.xres = 1920; cardhu_hdmi_fb_data.yres = 1200; #endif /* lvds configuration */ err = gpio_request(pm313_R_FDE, "R_FDE"); err |= gpio_direction_output(pm313_R_FDE, 1); err |= gpio_request(pm313_R_FB, "R_FB"); err |= gpio_direction_output(pm313_R_FB, 1); err |= gpio_request(pm313_MODE0, "MODE0"); err |= gpio_direction_output(pm313_MODE0, 1); err |= gpio_request(pm313_MODE1, "MODE1"); err |= gpio_direction_output(pm313_MODE1, 0); err |= gpio_request(pm313_BPP, "BPP"); err |= gpio_direction_output(pm313_BPP, PM313_LVDS_PANEL_BPP); err = gpio_request(pm313_lvds_shutdown, "lvds_shutdown"); /* free ride provided by bootloader */ err |= gpio_direction_output(pm313_lvds_shutdown, 1); if (err) printk(KERN_ERR "ERROR(s) in LVDS configuration\n"); } else if ((display_board_info.board_id == BOARD_DISPLAY_E1247 && board_info.board_id == BOARD_PM269) || (board_info.board_id == BOARD_E1257) || (board_info.board_id == BOARD_PM305) || (board_info.board_id == BOARD_PM311)) { gpio_request(e1247_pm269_lvds_shutdown, "lvds_shutdown"); gpio_direction_output(e1247_pm269_lvds_shutdown, 1); } else { gpio_request(cardhu_lvds_shutdown, "lvds_shutdown"); gpio_direction_output(cardhu_lvds_shutdown, 1); } #endif skip_lvds: gpio_request(cardhu_hdmi_hpd, "hdmi_hpd"); gpio_direction_input(cardhu_hdmi_hpd); #if !(DC_CTRL_MODE & TEGRA_DC_OUT_ONE_SHOT_MODE) tegra_gpio_enable(e1506_lcd_te); gpio_request(e1506_lcd_te, "lcd_te"); gpio_direction_input(e1506_lcd_te); #endif #ifdef CONFIG_HAS_EARLYSUSPEND cardhu_panel_early_suspender.suspend = cardhu_panel_early_suspend; cardhu_panel_early_suspender.resume = cardhu_panel_late_resume; cardhu_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB; register_early_suspend(&cardhu_panel_early_suspender); #endif #ifdef CONFIG_TEGRA_GRHOST err = nvhost_device_register(&tegra_grhost_device); if (err) return err; #endif err = platform_add_devices(cardhu_gfx_devices, ARRAY_SIZE(cardhu_gfx_devices)); #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) res = nvhost_get_resource_byname(&cardhu_disp1_device, IORESOURCE_MEM, "fbmem"); res->start = tegra_fb_start; res->end = tegra_fb_start + tegra_fb_size - 1; #endif /* Copy the bootloader fb to the fb. */ tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start, min(tegra_fb_size, tegra_bootloader_fb_size)); #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) if (!err) err = nvhost_device_register(&cardhu_disp1_device); res = nvhost_get_resource_byname(&cardhu_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 fb2. */ tegra_move_framebuffer(tegra_fb2_start, tegra_bootloader_fb_start, min(tegra_fb2_size, tegra_bootloader_fb_size)); if (!err) err = nvhost_device_register(&cardhu_disp2_device); #endif #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP) if (!err) err = nvhost_device_register(&nvavp_device); #endif return err; }
int __init cardhu_panel_init(void) { int err; struct resource __maybe_unused *res; tegra_get_board_info(&board_info); tegra_get_display_board_info(&display_board_info); #if defined(CONFIG_TEGRA_NVMAP) cardhu_carveouts[1].base = tegra_carveout_start; cardhu_carveouts[1].size = tegra_carveout_size; #endif #if defined(CONFIG_ION_TEGRA) tegra_ion_data.heaps[0].base = tegra_carveout_start; tegra_ion_data.heaps[0].size = tegra_carveout_size; #endif cardhu_panel_preinit(); if (is_dsi_panel()) goto skip_lvds; #if defined(CONFIG_TEGRA_DC) if (WARN_ON(board_info.board_id == BOARD_E1291 && ((board_info.sku & SKU_TOUCHSCREEN_MECH_FIX) == 0))) { /* use 55Hz panel timings to reduce noise on sensitive touch */ printk("Using cardhu_panel_modes_55hz\n"); cardhu_disp1_out.parent_clk = "pll_p"; cardhu_disp1_out.modes = cardhu_panel_modes_55hz; cardhu_disp1_out.n_modes = ARRAY_SIZE(cardhu_panel_modes_55hz); } if (display_board_info.board_id == BOARD_DISPLAY_PM313) { /* initialize the values */ #if defined(PM313_LVDS_PANEL_19X12) cardhu_disp1_out.modes = panel_19X12_modes; cardhu_disp1_out.n_modes = ARRAY_SIZE(panel_19X12_modes); cardhu_disp1_out.parent_clk = "pll_d_out0"; #if (PM313_LVDS_PANEL_BPP == 1) cardhu_disp1_out.depth = 18; #else cardhu_disp1_out.depth = 24; #endif /* Set height and width in mm. */ cardhu_disp1_out.height = 127; cardhu_disp1_out.width = 203; cardhu_fb_data.xres = 1920; cardhu_fb_data.yres = 1200; cardhu_disp2_out.parent_clk = "pll_d2_out0"; cardhu_hdmi_fb_data.xres = 1920; cardhu_hdmi_fb_data.yres = 1200; #endif /* lvds configuration */ err = gpio_request(pm313_R_FDE, "R_FDE"); err |= gpio_direction_output(pm313_R_FDE, 1); err |= gpio_request(pm313_R_FB, "R_FB"); err |= gpio_direction_output(pm313_R_FB, 1); err |= gpio_request(pm313_MODE0, "MODE0"); err |= gpio_direction_output(pm313_MODE0, 1); err |= gpio_request(pm313_MODE1, "MODE1"); err |= gpio_direction_output(pm313_MODE1, 0); err |= gpio_request(pm313_BPP, "BPP"); err |= gpio_direction_output(pm313_BPP, PM313_LVDS_PANEL_BPP); err = gpio_request(pm313_lvds_shutdown, "lvds_shutdown"); /* free ride provided by bootloader */ err |= gpio_direction_output(pm313_lvds_shutdown, 1); if (err) printk(KERN_ERR "ERROR(s) in LVDS configuration\n"); } /* else if ((display_board_info.board_id == BOARD_DISPLAY_E1247 && board_info.board_id == BOARD_PM269) || (board_info.board_id == BOARD_E1257) || (board_info.board_id == BOARD_PM305) || (board_info.board_id == BOARD_PM311)) { gpio_request(e1247_pm269_lvds_shutdown, "lvds_shutdown"); gpio_direction_output(e1247_pm269_lvds_shutdown, 1); } else { gpio_request(cardhu_lvds_shutdown, "lvds_shutdown"); gpio_direction_output(cardhu_lvds_shutdown, 1); } */ if ( tegra3_get_project_id() == TEGRA3_PROJECT_P1801 ){ printk("P1801 display setting, set HDMI as main display\n "); cardhu_fb_data.xres = 1920; cardhu_fb_data.yres = 1080; cardhu_disp1_pdata.default_out = &cardhu_disp1_out_P1801; cardhu_disp1_device.resource = cardhu_disp1_resources_P1801; cardhu_disp1_device.num_resources = ARRAY_SIZE(cardhu_disp1_resources_P1801); } if (tegra3_get_project_id()==0x4 ){ printk("Check TF700T setting \n "); cardhu_disp1_out.modes = panel_19X12_modes; cardhu_disp1_out.n_modes = ARRAY_SIZE(panel_19X12_modes); cardhu_disp1_out.parent_clk = "pll_d_out0"; cardhu_disp1_out.depth = 24; cardhu_fb_data.xres = 1920; cardhu_fb_data.yres = 1200; cardhu_disp2_out.parent_clk = "pll_d2_out0"; cardhu_hdmi_fb_data.xres = 1920; cardhu_hdmi_fb_data.yres = 1200; gpio_request(TEGRA_GPIO_PU5, "LDO_EN"); gpio_request(TEGRA_GPIO_PBB3, "TF700T_1.2V"); gpio_request(TEGRA_GPIO_PC6, "TF700T_1.8V"); gpio_request(TEGRA_GPIO_PX0, "TF700T_I2C_Switch"); gpio_request(TEGRA_GPIO_PD2, "TF700T_OSC"); } #endif if (tegra3_get_project_id()==0x4 ){ tegra_gpio_enable(cardhu_hdmi_enb); gpio_request(cardhu_hdmi_enb, "hdmi_5v_en"); gpio_direction_output(cardhu_hdmi_enb, 0); } else { tegra_gpio_enable(cardhu_hdmi_enb); gpio_request(cardhu_hdmi_enb, "hdmi_5v_en"); gpio_direction_output(cardhu_hdmi_enb, 1); } skip_lvds: gpio_request(cardhu_hdmi_hpd, "hdmi_hpd"); gpio_direction_input(cardhu_hdmi_hpd); #if !(DC_CTRL_MODE & TEGRA_DC_OUT_ONE_SHOT_MODE) tegra_gpio_enable(e1506_lcd_te); gpio_request(e1506_lcd_te, "lcd_te"); gpio_direction_input(e1506_lcd_te); #endif #ifdef CONFIG_HAS_EARLYSUSPEND cardhu_panel_early_suspender.suspend = cardhu_panel_early_suspend; cardhu_panel_early_suspender.resume = cardhu_panel_late_resume; cardhu_panel_early_suspender.level = EARLY_SUSPEND_LEVEL_DISABLE_FB; register_early_suspend(&cardhu_panel_early_suspender); #endif #ifdef CONFIG_TEGRA_GRHOST err = tegra3_register_host1x_devices(); if (err) return err; #endif err = platform_add_devices(cardhu_gfx_devices, ARRAY_SIZE(cardhu_gfx_devices)); #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) res = nvhost_get_resource_byname(&cardhu_disp1_device, IORESOURCE_MEM, "fbmem"); res->start = tegra_fb_start; res->end = tegra_fb_start + tegra_fb_size - 1; #endif /* Copy the bootloader fb to the fb. */ tegra_move_framebuffer(tegra_fb_start, tegra_bootloader_fb_start, min(tegra_fb_size, tegra_bootloader_fb_size)); #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC) if (!err) err = nvhost_device_register(&cardhu_disp1_device); if ( tegra3_get_project_id() != TEGRA3_PROJECT_P1801 ){ res = nvhost_get_resource_byname(&cardhu_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 fb2. */ tegra_move_framebuffer(tegra_fb2_start, tegra_bootloader_fb_start, min(tegra_fb2_size, tegra_bootloader_fb_size)); if (!err) err = nvhost_device_register(&cardhu_disp2_device); } #endif #if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP) if (!err) err = nvhost_device_register(&nvavp_device); #endif return err; }