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;
}
Example #2
0
void __init p1859_audio_init(void)
{
	int is_e1860_b00 = tegra_is_board(NULL, "61860", NULL, "300", NULL);
	int modem_id = tegra_get_modem_id();
	int is_e1892 = 0, i;
	struct device_node *np;
	static struct property tegra_audio_property = {
		.name = "platform_data",
		.value = &tegra_e1860_b00_pdata,
		.length = sizeof(tegra_e1860_b00_pdata),
	};

	/* check the version of embedded breakout board */
	is_e1892 = tegra_is_board(NULL, "61892", NULL, NULL, NULL);

	/* set max9485 addr as priv data for a0x and b00 */
	tegra_e1860_a0x_pdata.priv_data =
	tegra_e1860_b00_pdata.priv_data =
	tegra_voice_call_pdata.priv_data =
		(void *)(is_e1892 ? 0x70 : 0x60);

	np = of_find_compatible_node(NULL, NULL,
		"nvidia,tegra-audio-vcm30t124");
	if (NULL != np) {
		if (is_e1860_b00) {
			if (modem_id) {
				tegra_audio_property.value =
					(void *)(&tegra_voice_call_pdata);
				tegra_audio_property.length =
					sizeof(tegra_voice_call_pdata);
			}
		} else {
				tegra_audio_property.value =
					(void *)(&tegra_e1860_a0x_pdata);
				tegra_audio_property.length =
					sizeof(tegra_e1860_a0x_pdata);
			}
		of_update_property(np, &tegra_audio_property);
	}

	for (i = 0; i < ARRAY_SIZE(tegra_spdif_dit); i++)
		platform_device_register(&tegra_spdif_dit[i]);

}

void __init p1859_audio_dap_d_sel(void)
{
	int modem_id = tegra_get_modem_id();
	struct device_node *np;
	int gpio;

	if (modem_id) {
		np = of_find_compatible_node(NULL, NULL, "nvidia,dap-d-mux");
		if (NULL != np) {
			gpio = of_get_named_gpio(np,
				"nvidia,dap-d-sel-gpio", 0);
			pr_info("dap-d-sel-gpio:%d\n", gpio);
			if (gpio_is_valid(gpio))
				gpio_direction_output(gpio, 1);
		}
	}
}