Пример #1
0
static void __init tegra_e1853_init(void)
{
	tegra_init_board_info();
	tegra_clk_init_from_table(e1853_clk_init_table);
	tegra_enable_pinmux();
	tegra_smmu_init();
	tegra_soc_device_init("e1853");
	e1853_pinmux_init();
	e1853_i2c_init();
	e1853_gpio_init();
/*	e1853_regulator_init();
	e1853_suspend_init(); */
	e1853_i2s_audio_init();
	e1853_uart_init();
	e1853_usb_init();
	tegra_io_dpd_init();
	e1853_sdhci_init();
	e1853_spi_init();
	platform_add_devices(e1853_devices, ARRAY_SIZE(e1853_devices));
#ifdef CONFIG_TOUCHSCREEN_ATMEL_MXT
	e1853_touch_init();
#endif
	e1853_panel_init();
	e1853_nor_init();
	e1853_pcie_init();
}
int __init e1853_panel_init(void)
{
	bool has_ebb = false;
	int err;
#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	struct resource *res;
	struct platform_device *phost1x = NULL;
#endif
	bool is_dt = of_have_populated_dt();

	if (tegra_is_board(NULL, "61861", NULL, NULL, NULL)) {
		has_ebb = true;
		if (tegra_is_board(NULL, "61227", NULL, NULL, NULL)) {
			e1853_config_CLAA101WB03_lcd();
			e1853_touch_init();
		}
	}

	e1853_carveouts[1].base = tegra_carveout_start;
	e1853_carveouts[1].size = tegra_carveout_size;
	tegra_disp1_device.dev.platform_data = &e1853_disp1_pdata;
	tegra_disp2_device.dev.platform_data = &e1853_hdmi_pdata;

	err = platform_add_devices(e1853_gfx_devices,
		ARRAY_SIZE(e1853_gfx_devices));

#ifdef CONFIG_TEGRA_GRHOST
	if (!is_dt)
		phost1x = tegra3_register_host1x_devices();
	else
		phost1x = to_platform_device(bus_find_device_by_name(
			&platform_bus_type, NULL, "host1x"));
	if (!phost1x) {
		pr_err("host1x devices registration failed\n");
		return -EINVAL;
	}
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	res = platform_get_resource_byname(&tegra_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	if (res) {
		res->start = tegra_fb_start;
		res->end = tegra_fb_start + tegra_fb_size - 1;
	}

	/*
	 * If the bootloader fb is valid, copy it to the fb, or else
	 * clear fb to avoid garbage on dispaly1.
	 */
	if (tegra_bootloader_fb_size)
		__tegra_move_framebuffer(&e1853_nvmap_device,
				tegra_fb_start, tegra_bootloader_fb_start,
				min(tegra_fb_size, tegra_bootloader_fb_size));
	else
		__tegra_clear_framebuffer(&e1853_nvmap_device,
					  tegra_fb_start, tegra_fb_size);

	if (!err) {
		tegra_disp1_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&tegra_disp1_device);
	}

	res = platform_get_resource_byname(&tegra_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	if (res) {
		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(&e1853_nvmap_device,
			tegra_fb2_start, tegra_bootloader_fb2_start,
			min(tegra_fb2_size, tegra_bootloader_fb2_size));
	else
		__tegra_clear_framebuffer(&e1853_nvmap_device,
					  tegra_fb2_start, tegra_fb2_size);

	if (!err) {
		tegra_disp2_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&tegra_disp2_device);
	}
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_NVAVP)
	if (!err) {
		nvavp_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&nvavp_device);
	}
#endif

	if (has_ebb) {
		if (!err)
			i2c_register_board_info(1, lvds_ser_info, 1);
	}

	return err;
}