int __init pismo_panel_init(void)
{
	int err = 0;
	struct resource __maybe_unused *res;
	struct platform_device *phost1x = NULL;

	sd_settings = pismo_sd_settings;

	pismo_panel_select();

#ifdef CONFIG_TEGRA_NVMAP
	pismo_carveouts[1].base = tegra_carveout_start;
	pismo_carveouts[1].size = tegra_carveout_size;
	pismo_carveouts[2].base = tegra_vpr_start;
	pismo_carveouts[2].size = tegra_vpr_size;

	err = platform_device_register(&pismo_nvmap_device);
	if (err) {
		pr_err("nvmap device registration failed\n");
		return err;
	}
#endif

	phost1x = pismo_host1x_init();
	if (!phost1x) {
		pr_err("host1x devices registration failed\n");
		return -EINVAL;
	}

	res = platform_get_resource_byname(&pismo_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;

	/* Copy the bootloader fb to the fb. */
	__tegra_move_framebuffer(&pismo_nvmap_device,
		tegra_fb_start, tegra_bootloader_fb_start,
			min(tegra_fb_size, tegra_bootloader_fb_size));

	pismo_disp1_device.dev.parent = &phost1x->dev;
	err = platform_device_register(&pismo_disp1_device);
	if (err) {
		pr_err("disp1 device registration failed\n");
		return err;
	}

	err = tegra_init_hdmi(&pismo_disp2_device, phost1x);
	if (err)
		return err;

#ifdef CONFIG_TEGRA_NVAVP
	nvavp_device.dev.parent = &phost1x->dev;
	err = platform_device_register(&nvavp_device);
	if (err) {
		pr_err("nvavp device registration failed\n");
		return err;
	}
#endif
	return err;
}
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;
}
int __init dalmore_panel_init(void)
{
	int err = 0;
	struct resource __maybe_unused *res;
	struct platform_device *phost1x;

	sd_settings = dalmore_sd_settings;

	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;

	err = platform_device_register(&dalmore_nvmap_device);
	if (err) {
		pr_err("nvmap device registration failed\n");
		return err;
	}
#endif

	phost1x = dalmore_host1x_init();
	if (!phost1x) {
		pr_err("host1x devices registration failed\n");
		return -EINVAL;
	}

	gpio_request(dalmore_hdmi_hpd, "hdmi_hpd");
	gpio_direction_input(dalmore_hdmi_hpd);

	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;

	/* Copy the bootloader fb to the fb. */
	__tegra_move_framebuffer(&dalmore_nvmap_device,
		tegra_fb_start, tegra_bootloader_fb_start,
			min(tegra_fb_size, tegra_bootloader_fb_size));

	/*
	 * 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(tegra_fb2_start,
			tegra_bootloader_fb2_start,
			min(tegra_fb2_size, tegra_bootloader_fb2_size));
	else
		tegra_clear_framebuffer(tegra_fb2_start, tegra_fb2_size);

	res = platform_get_resource_byname(&dalmore_disp2_device,
		IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;

	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;
	}

	dalmore_disp2_device.dev.parent = &phost1x->dev;
	err = platform_device_register(&dalmore_disp2_device);
	if (err) {
		pr_err("disp2 device registration failed\n");
		return err;
	}

#ifdef CONFIG_TEGRA_NVAVP
	nvavp_device.dev.parent = &phost1x->dev;
	err = platform_device_register(&nvavp_device);
	if (err) {
		pr_err("nvavp device registration failed\n");
		return err;
	}
#endif
	return err;
}
Exemplo n.º 4
0
int __init loki_panel_init(int board_id)
{
	int err = 0;
	struct resource __maybe_unused *res;
	struct platform_device *phost1x = NULL;
	struct board_info bi;
#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
	struct dma_declare_info vpr_dma_info;
	struct dma_declare_info generic_dma_info;
#endif

	tegra_get_board_info(&bi);
	if ((bi.sku == BOARD_SKU_FOSTER) && (bi.board_id == BOARD_P2530)) {
		res = platform_get_resource_byname(&loki_disp2_device,
					 IORESOURCE_IRQ, "irq");
		res->start = INT_DISPLAY_GENERAL;
		res->end = INT_DISPLAY_GENERAL;
		res = platform_get_resource_byname(&loki_disp2_device,
					 IORESOURCE_MEM, "regs");
		res->start = TEGRA_DISPLAY_BASE;
		res->end = TEGRA_DISPLAY_BASE + TEGRA_DISPLAY_SIZE - 1;
		loki_disp2_fb_data.xres = 1920;
		loki_disp2_fb_data.yres = 1080;
		loki_disp2_device.id = 0;
		loki_disp2_out.parent_clk = "pll_d";

		loki_disp2_out.modes = hdmi_panel_modes;
		loki_disp2_out.n_modes = ARRAY_SIZE(hdmi_panel_modes);
	} else
		loki_panel_select();

#ifdef CONFIG_TEGRA_NVMAP
	loki_carveouts[1].base = tegra_carveout_start;
	loki_carveouts[1].size = tegra_carveout_size;

	loki_carveouts[2].base = tegra_vpr_start;
	loki_carveouts[2].size = tegra_vpr_size;

#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
	generic_dma_info.name = "generic";
	generic_dma_info.base = tegra_carveout_start;
	generic_dma_info.size = tegra_carveout_size;
	generic_dma_info.resize = false;
	generic_dma_info.cma_dev = NULL;

	vpr_dma_info.name = "vpr";
	vpr_dma_info.base = tegra_vpr_start;
	vpr_dma_info.size = tegra_vpr_size;
	vpr_dma_info.resize = false;
	vpr_dma_info.cma_dev = NULL;
	loki_carveouts[1].cma_dev = &tegra_generic_cma_dev;
	loki_carveouts[1].resize = false;
	loki_carveouts[2].cma_dev = &tegra_vpr_cma_dev;
	loki_carveouts[2].resize = true;

	vpr_dma_info.size = SZ_32M;
	vpr_dma_info.resize = true;
	vpr_dma_info.cma_dev = &tegra_vpr_cma_dev;
	vpr_dma_info.notifier.ops = &vpr_dev_ops;

	if (tegra_carveout_size) {
		err = dma_declare_coherent_resizable_cma_memory(
				&tegra_generic_dev, &generic_dma_info);
		if (err) {
			pr_err("Generic coherent memory declaration failed\n");
			return err;
		}
	}
	if (tegra_vpr_size) {
		err = dma_declare_coherent_resizable_cma_memory(
				&tegra_vpr_dev, &vpr_dma_info);
		if (err) {
			pr_err("VPR coherent memory declaration failed\n");
			return err;
		}
	}
#endif

	err = platform_device_register(&loki_nvmap_device);
	if (err) {
		pr_err("nvmap device registration failed\n");
		return err;
	}
#endif

	phost1x = loki_host1x_init();
	if (!phost1x) {
		pr_err("host1x devices registration failed\n");
		return -EINVAL;
	}

	res = platform_get_resource_byname(&loki_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;

	/* Copy the bootloader fb to the fb. */
	if (tegra_bootloader_fb_size)
		__tegra_move_framebuffer(&loki_nvmap_device,
			tegra_fb_start, tegra_bootloader_fb_start,
			min(tegra_fb_size, tegra_bootloader_fb_size));
	else
		__tegra_clear_framebuffer(&loki_nvmap_device,
				tegra_fb_start, tegra_fb_size);

	/* Copy the bootloader fb2 to the fb2. */
	if (tegra_bootloader_fb2_size)
		__tegra_move_framebuffer(&loki_nvmap_device,
			tegra_fb2_start, tegra_bootloader_fb2_start,
			min(tegra_fb2_size, tegra_bootloader_fb2_size));
	else
		__tegra_clear_framebuffer(&loki_nvmap_device,
				tegra_fb2_start, tegra_fb2_size);

	res = platform_get_resource_byname(&loki_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;

	loki_disp1_device.dev.parent = &phost1x->dev;

	if ((bi.sku != BOARD_SKU_FOSTER) || (bi.board_id != BOARD_P2530)) {
		err = platform_device_register(&loki_disp1_device);
		if (err) {
			pr_err("disp1 device registration failed\n");
			return err;
		}
	}

	loki_disp2_device.dev.parent = &phost1x->dev;
	loki_disp2_out.hdmi_out = &loki_hdmi_out;
	err = platform_device_register(&loki_disp2_device);
	if (err) {
		pr_err("disp2 device registration failed\n");
		return err;
	}

	return err;
}
Exemplo n.º 5
0
int __init roth_panel_init(int board_id)
{
    int err = 0;
    struct resource __maybe_unused *res;
    struct platform_device *phost1x = NULL;

#ifdef CONFIG_TEGRA_NVMAP
    roth_carveouts[1].base = tegra_carveout_start;
    roth_carveouts[1].size = tegra_carveout_size;
    roth_carveouts[2].base = tegra_vpr_start;
    roth_carveouts[2].size = tegra_vpr_size;

    err = platform_device_register(&roth_nvmap_device);
    if (err) {
        pr_err("nvmap device registration failed\n");
        return err;
    }
#endif

    phost1x = roth_host1x_init();
    if (!phost1x) {
        pr_err("host1x devices registration failed\n");
        return -EINVAL;
    }

    res = platform_get_resource_byname(&roth_disp1_device,
                                       IORESOURCE_MEM, "fbmem");
    res->start = tegra_fb_start;
    res->end = tegra_fb_start + tegra_fb_size - 1;

    /* Copy the bootloader fb to the fb. */
    __tegra_move_framebuffer(&roth_nvmap_device,
                             tegra_fb_start, tegra_bootloader_fb_start,
                             min(tegra_fb_size, tegra_bootloader_fb_size));

    /*
     * only roth supports initialized mode.
     */
    if (!board_id)
        roth_disp1_out.flags |= TEGRA_DC_OUT_INITIALIZED_MODE;

    roth_disp1_device.dev.parent = &phost1x->dev;
    err = platform_device_register(&roth_disp1_device);
    if (err) {
        pr_err("disp1 device registration failed\n");
        return err;
    }

    err = tegra_init_hdmi(&roth_disp2_device, phost1x);
    if (err)
        return err;

#if IS_EXTERNAL_PWM
    err = platform_add_devices(roth_bl_device,
                               ARRAY_SIZE(roth_bl_device));
    if (err) {
        pr_err("disp1 bl device registration failed");
        return err;
    }
#endif

#ifdef CONFIG_TEGRA_NVAVP
    if (!of_have_populated_dt()) {
        nvavp_device.dev.parent = &phost1x->dev;
        err = platform_device_register(&nvavp_device);
        if (err) {
            pr_err("nvavp device registration failed\n");
            return err;
        }
    }
#endif
    return err;
}
Exemplo n.º 6
0
int __init kai_panel_init(void)
{
	int err;
	struct resource __maybe_unused *res;
	struct board_info board_info;
	struct platform_device *phost1x;

	tegra_get_board_info(&board_info);

#if defined(CONFIG_TEGRA_NVMAP)
	kai_carveouts[1].base = tegra_carveout_start;
	kai_carveouts[1].size = tegra_carveout_size;
#endif
	err = gpio_request(kai_lvds_avdd_en, "lvds_avdd_en");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, err);
		return err;
	}
	err = gpio_direction_output(kai_lvds_avdd_en, 1);
	if (err < 0) {
		pr_err("%s: gpio_direction_output failed %d\n",
			__func__, err);
			gpio_free(kai_lvds_avdd_en);
		return err;
	}
	err = gpio_request(kai_lvds_stdby, "lvds_stdby");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, err);
		return err;
	}
	err = gpio_direction_output(kai_lvds_stdby, 1);
	if (err < 0) {
		pr_err("%s: gpio_direction_output failed %d\n",
			__func__, err);
			gpio_free(kai_lvds_stdby);
		return err;
	}
	err = gpio_request(kai_lvds_rst, "lvds_rst");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, err);
		return err;
	}
	err = gpio_direction_output(kai_lvds_rst, 1);
	if (err < 0) {
		pr_err("%s: gpio_direction_output failed %d\n",
			__func__, err);
			gpio_free(kai_lvds_rst);
		return err;
	}
	if (board_info.fab == BOARD_FAB_A00) {
		err = gpio_request(kai_lvds_rs_a00, "lvds_rs");
		if (err < 0) {
			pr_err("%s: gpio_request failed %d\n",
				__func__, err);
			return err;
		}
		err = gpio_direction_output(kai_lvds_rs_a00, 0);
		if (err < 0) {
			pr_err("%s: gpio_direction_output failed %d\n",
				__func__, err);
			gpio_free(kai_lvds_rs_a00);
			return err;
		}
	} else {
		err = gpio_request(kai_lvds_rs, "lvds_rs");
		if (err < 0) {
			pr_err("%s: gpio_request failed %d\n",
				__func__, err);
			return err;
		}
		err = gpio_direction_output(kai_lvds_rs, 0);
		if (err < 0) {
			pr_err("%s: gpio_direction_output failed %d\n",
				__func__, err);
			gpio_free(kai_lvds_rs);
			return err;
		}
	}

	err = gpio_request(kai_lvds_lr, "lvds_lr");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, err);
		return err;
	}
	err = gpio_direction_output(kai_lvds_lr, 1);
	if (err < 0) {
		pr_err("%s: gpio_direction_output failed %d\n",
			__func__, err);
		gpio_free(kai_lvds_lr);
		return err;
	}

	err = gpio_request(kai_lvds_shutdown, "lvds_shutdown");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, err);
		return err;
	}
	err = gpio_direction_output(kai_lvds_shutdown, 1);
	if (err < 0) {
		pr_err("%s: gpio_direction_output failed %d\n",
			__func__, err);
		gpio_free(kai_lvds_shutdown);
		return err;
	}

	err = gpio_request(kai_hdmi_hpd, "hdmi_hpd");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n",
			__func__, err);
		return err;
	}
	err = gpio_direction_input(kai_hdmi_hpd);
	if (err < 0) {
		pr_err("%s: gpio_direction_input failed %d\n",
			__func__, err);
		gpio_free(kai_hdmi_hpd);
		return err;
	}

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

#ifdef CONFIG_TEGRA_GRHOST
	phost1x = tegra3_register_host1x_devices();
	if (!phost1x)
		return -EINVAL;
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	res = platform_get_resource_byname(&kai_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(&kai_nvmap_device,
		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) {
		kai_disp1_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&kai_disp1_device);
	}

	res = platform_get_resource_byname(&kai_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err) {
		kai_disp2_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&kai_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
	return err;
}
int __init ardbeg_panel_init(void)
{
	int err = 0;
	struct resource __maybe_unused *res;
	struct platform_device *phost1x = NULL;
	struct board_info board_info;

	struct device_node *dc1_node = NULL;
	struct device_node *dc2_node = NULL;
#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
	struct dma_declare_info vpr_dma_info;
	struct dma_declare_info generic_dma_info;
#endif

	find_dc_node(&dc1_node, &dc2_node);

#ifndef CONFIG_TEGRA_HDMI_PRIMARY
	ardbeg_panel_select();
#endif

#ifdef CONFIG_TEGRA_NVMAP
	ardbeg_carveouts[1].base = tegra_carveout_start;
	ardbeg_carveouts[1].size = tegra_carveout_size;

	ardbeg_carveouts[2].base = tegra_vpr_start;
	ardbeg_carveouts[2].size = tegra_vpr_size;

#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
	generic_dma_info.name = "generic";
	generic_dma_info.base = tegra_carveout_start;
	generic_dma_info.size = tegra_carveout_size;
	generic_dma_info.resize = false;
	generic_dma_info.cma_dev = NULL;

	vpr_dma_info.name = "vpr";
	vpr_dma_info.base = tegra_vpr_start;
	vpr_dma_info.size = tegra_vpr_size;
	vpr_dma_info.resize = false;
	vpr_dma_info.cma_dev = NULL;
	ardbeg_carveouts[1].cma_dev = &tegra_generic_cma_dev;
	ardbeg_carveouts[1].resize = false;
	ardbeg_carveouts[2].cma_dev = &tegra_vpr_cma_dev;
	ardbeg_carveouts[2].resize = true;

	vpr_dma_info.size = SZ_32M;
	vpr_dma_info.resize = true;
	vpr_dma_info.cma_dev = &tegra_vpr_cma_dev;
	vpr_dma_info.notifier.ops = &vpr_dev_ops;

	if (tegra_carveout_size) {
		err = dma_declare_coherent_resizable_cma_memory(
				&tegra_generic_dev, &generic_dma_info);
		if (err) {
			pr_err("Generic coherent memory declaration failed\n");
			return err;
		}
	}
	if (tegra_vpr_size) {
		err = dma_declare_coherent_resizable_cma_memory(
				&tegra_vpr_dev, &vpr_dma_info);
		if (err) {
			pr_err("VPR coherent memory declaration failed\n");
			return err;
		}
	}
#endif

	err = platform_device_register(&ardbeg_nvmap_device);
	if (err) {
		pr_err("nvmap device registration failed\n");
		return err;
	}
#endif

	phost1x = ardbeg_host1x_init();
	if (!phost1x) {
		pr_err("host1x devices registration failed\n");
		return -EINVAL;
	}

	if (!of_have_populated_dt() || !dc1_node ||
		!of_device_is_available(dc1_node)) {
#ifndef CONFIG_TEGRA_HDMI_PRIMARY
		res = platform_get_resource_byname(&ardbeg_disp1_device,
					 IORESOURCE_MEM, "fbmem");
#else
		res = platform_get_resource_byname(&ardbeg_disp2_device,
					 IORESOURCE_MEM, "fbmem");
#endif
		res->start = tegra_fb_start;
		res->end = tegra_fb_start + tegra_fb_size - 1;
	}

	/* Copy the bootloader fb to the fb. */
	if (tegra_bootloader_fb_size)
		__tegra_move_framebuffer(&ardbeg_nvmap_device,
				tegra_fb_start, tegra_bootloader_fb_start,
				min(tegra_fb_size, tegra_bootloader_fb_size));
	else
		__tegra_clear_framebuffer(&ardbeg_nvmap_device,
					  tegra_fb_start, tegra_fb_size);

	/* Copy the bootloader fb2 to the fb2. */
	if (tegra_bootloader_fb2_size)
		__tegra_move_framebuffer(&ardbeg_nvmap_device,
				tegra_fb2_start, tegra_bootloader_fb2_start,
				min(tegra_fb2_size, tegra_bootloader_fb2_size));
	else
		__tegra_clear_framebuffer(&ardbeg_nvmap_device,
					tegra_fb2_start, tegra_fb2_size);

#ifndef CONFIG_TEGRA_HDMI_PRIMARY
	if (!of_have_populated_dt() || !dc1_node ||
		!of_device_is_available(dc1_node)) {
		ardbeg_disp1_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&ardbeg_disp1_device);
		if (err) {
			pr_err("disp1 device registration failed\n");
			return err;
		}
	}
#endif
	tegra_get_board_info(&board_info);
	switch (board_info.board_id) {
	case BOARD_E1991:
		ardbeg_hdmi_out.tmds_config = ardbeg_tn8_tmds_config2;
		break;
	case BOARD_P1761:
		if (board_info.fab == 3)
			ardbeg_hdmi_out.tmds_config = ardbeg_tn8_tmds_config2;
		else
			ardbeg_hdmi_out.tmds_config = ardbeg_tn8_tmds_config;
		break;
	case BOARD_PM359:
	case BOARD_E1971:
	case BOARD_E1973:
	default:	 /* default is ardbeg_tmds_config[] */
		break;
	}

	if (!of_have_populated_dt() || !dc2_node ||
		!of_device_is_available(dc2_node)) {
#ifndef CONFIG_TEGRA_HDMI_PRIMARY
		res = platform_get_resource_byname(&ardbeg_disp2_device,
					IORESOURCE_MEM, "fbmem");
		res->start = tegra_fb2_start;
		res->end = tegra_fb2_start + tegra_fb2_size - 1;
#endif
		ardbeg_disp2_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&ardbeg_disp2_device);
		if (err) {
			pr_err("disp2 device registration failed\n");
			return err;
		}
	}

	return err;
}
int __init pluto_panel_init(void)
{
	int err = 0;
	struct resource __maybe_unused *res;
	struct platform_device *phost1x;

	sd_settings = pluto_sd_settings;

#ifdef CONFIG_BACKLIGHT_1_WIRE_MODE
      tps61165_pin_init();
#endif

	pluto_panel_select();
    err = gpio_request(pluto_LCD_1V8_EN, "LCD_1V8EN");
    if(err < 0){
        pr_err("[shangzhi]panel LCD 1v8 enable gpio request failed\n");
    }
	gpio_direction_output(pluto_LCD_1V8_EN,1);

#ifdef CONFIG_TEGRA_NVMAP
	pluto_carveouts[1].base = tegra_carveout_start;
	pluto_carveouts[1].size = tegra_carveout_size;
	pluto_carveouts[2].base = tegra_vpr_start;
	pluto_carveouts[2].size = tegra_vpr_size;

	err = platform_device_register(&pluto_nvmap_device);
	if (err) {
		pr_err("nvmap device registration failed\n");
		return err;
	}
#endif
	gpio_request(pluto_hdmi_hpd, "hdmi_hpd");
	gpio_direction_input(pluto_hdmi_hpd);

	phost1x = pluto_host1x_init();
	if (!phost1x) {
		pr_err("host1x devices registration failed\n");
		return -EINVAL;
	}

	res = platform_get_resource_byname(&pluto_disp1_device,
		IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;

	/* Copy the bootloader fb to the fb. */
	__tegra_move_framebuffer(&pluto_nvmap_device,
		tegra_fb_start, tegra_bootloader_fb_start,
			min(tegra_fb_size, tegra_bootloader_fb_size));

	/*
	 * 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(tegra_fb2_start,
			tegra_bootloader_fb2_start,
			min(tegra_fb2_size, tegra_bootloader_fb2_size));
	else
		tegra_clear_framebuffer(tegra_fb2_start, tegra_fb2_size);

	res = platform_get_resource_byname(&pluto_disp2_device,
		IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;

	pluto_disp1_device.dev.parent = &phost1x->dev;
	err = platform_device_register(&pluto_disp1_device);
	if (err) {
		pr_err("disp1 device registration failed\n");
		return err;
	}

	pluto_disp2_device.dev.parent = &phost1x->dev;
#if 0
	err = platform_device_register(&pluto_disp2_device);
	if (err) {
		pr_err("disp2 device registration failed\n");
		return err;
	}
#endif
#if CONFIG_ESD_READ_TE
        gpio_request(TEGRA_GPIO_PR6, "TE-irq");
        gpio_direction_input(TEGRA_GPIO_PR6);

        if (request_irq(gpio_to_irq(TEGRA_GPIO_PR6), te_signal_irq_handler,
                    IRQF_TRIGGER_RISING, "TE-Signal", NULL) < 0)
        {
            printk("Failed to request TE IRQ!\n");
        }
        setup_timer(&te_watchdog_timer, te_watchdog_timeout, 0);
        mod_timer(&te_watchdog_timer,  jiffies + msecs_to_jiffies(30000));
#endif

#if defined(CONFIG_LEDS_PWM)	
	err = platform_device_register(&tegra_pwfm0_device);
	if (err) {
		pr_err("led pwm device registration failed");
		return err;
	}
#endif

#ifdef CONFIG_TEGRA_NVAVP
	nvavp_device.dev.parent = &phost1x->dev;
	err = platform_device_register(&nvavp_device);
	if (err) {
		pr_err("nvavp device registration failed\n");
		return err;
	}
#endif
	return err;
}
int __init pluto_panel_init(void)
{
	int err = 0;
	struct resource __maybe_unused *res;
	struct platform_device *phost1x = NULL;

	pluto_panel_select();

#ifdef CONFIG_TEGRA_NVMAP
	pluto_carveouts[1].base = tegra_carveout_start;
	pluto_carveouts[1].size = tegra_carveout_size;
	pluto_carveouts[2].base = tegra_vpr_start;
	pluto_carveouts[2].size = tegra_vpr_size;
#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
	pluto_carveouts[1].cma_dev = &tegra_generic_cma_dev;
	pluto_carveouts[1].resize = false;
	pluto_carveouts[2].cma_dev = &tegra_vpr_cma_dev;
	pluto_carveouts[2].resize = true;
	pluto_carveouts[2].cma_chunk_size = SZ_32M;
#endif

	err = platform_device_register(&pluto_nvmap_device);
	if (err) {
		pr_err("nvmap device registration failed\n");
		return err;
	}
#endif
	phost1x = pluto_host1x_init();
	if (!phost1x) {
		pr_err("host1x devices registration failed\n");
		return -EINVAL;
	}

	res = platform_get_resource_byname(&pluto_disp1_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb_start;
	res->end = tegra_fb_start + tegra_fb_size - 1;

	/* Copy the bootloader fb to the fb. */
	__tegra_move_framebuffer(&pluto_nvmap_device,
		tegra_fb_start, tegra_bootloader_fb_start,
			min(tegra_fb_size, tegra_bootloader_fb_size));

	pluto_disp1_device.dev.parent = &phost1x->dev;
	err = platform_device_register(&pluto_disp1_device);
	if (err) {
		pr_err("disp1 device registration failed\n");
		return err;
	}

	err = tegra_init_hdmi(&pluto_disp2_device, phost1x);
	if (err)
		return err;

#ifdef CONFIG_TEGRA_NVAVP
	if (!of_have_populated_dt()) {
		nvavp_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&nvavp_device);
		if (err) {
			pr_err("nvavp device registration failed\n");
			return err;
		}
	}
#endif
	return err;
}
static int __init p1852_sku8_panel_init(void)
{
	int err;
	struct resource *res;
	struct platform_device *phost1x = NULL;
	bool is_dt = of_have_populated_dt();

	p1852_carveouts[1].base = tegra_carveout_start;
	p1852_carveouts[1].size = tegra_carveout_size;
	/* sku 8 has primary RGB out and secondary HDMI out */
	tegra_disp1_device.dev.platform_data = &p1852_disp1_pdata;
	tegra_disp2_device.dev.platform_data = &p1852_hdmi_pdata;

	err = platform_add_devices(p1852_gfx_devices,
				ARRAY_SIZE(p1852_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(&p1852_nvmap_device,
				tegra_fb_start, tegra_bootloader_fb_start,
				min(tegra_fb_size, tegra_bootloader_fb_size));
	else
		__tegra_clear_framebuffer(&p1852_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(&p1852_nvmap_device,
			tegra_fb2_start, tegra_bootloader_fb2_start,
			min(tegra_fb2_size, tegra_bootloader_fb2_size));
	else
		__tegra_clear_framebuffer(&p1852_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
	return err;
}
Exemplo n.º 11
0
int __init enterprise_panel_init(void)
{
	int err;
	struct resource __maybe_unused *res;
	struct board_info board_info;
	struct platform_device *phost1x;

	tegra_get_board_info(&board_info);

	BUILD_BUG_ON(ARRAY_SIZE(enterprise_bl_output_measured_a03) != 256);
	BUILD_BUG_ON(ARRAY_SIZE(enterprise_bl_output_measured_a02) != 256);

	if (board_info.board_id != BOARD_E1239) {
		if (board_info.fab >= BOARD_FAB_A03) {
#if !(IS_EXTERNAL_PWM)
			enterprise_disp1_backlight_data.clk_div = 0x1D;
#endif
			bl_output = enterprise_bl_output_measured_a03;
		} else
			bl_output = enterprise_bl_output_measured_a02;
	} else {
		enterprise_bl_devices[0] = &external_pwm_disp1_backlight_device;
		bl_output = tai_bl_output_measured;
	}
	enterprise_dsi.chip_id = tegra_get_chipid();
	enterprise_dsi.chip_rev = tegra_revision;

#if defined(CONFIG_TEGRA_NVMAP)
	enterprise_carveouts[1].base = tegra_carveout_start;
	enterprise_carveouts[1].size = tegra_carveout_size;
#endif

	err = gpio_request(enterprise_hdmi_hpd, "hdmi_hpd");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n", __func__, err);
		return err;
	}
	err = gpio_direction_input(enterprise_hdmi_hpd);
	if (err < 0) {
		pr_err("%s: gpio_direction_input failed %d\n",
			__func__, err);
		gpio_free(enterprise_hdmi_hpd);
		return err;
	}

	if (board_info.board_id != BOARD_E1239) {
		err = gpio_request(enterprise_lcd_2d_3d, "lcd_2d_3d");
		if (err < 0) {
			pr_err("%s: gpio_request failed %d\n", __func__, err);
			return err;
		}
		err = gpio_direction_output(enterprise_lcd_2d_3d, 0);
		if (err < 0) {
			pr_err("%s: gpio_direction_ouput failed %d\n",
				__func__, err);
			gpio_free(enterprise_lcd_2d_3d);
			return err;
		}
		enterprise_stereo_set_mode(enterprise_stereo.mode_2d_3d);

		err = gpio_request(enterprise_lcd_swp_pl, "lcd_swp_pl");
		if (err < 0) {
			pr_err("%s: gpio_request failed %d\n", __func__, err);
			return err;
		}
		err = gpio_direction_output(enterprise_lcd_swp_pl, 0);
		if (err < 0) {
			pr_err("%s: gpio_direction_ouput failed %d\n",
				__func__, err);
			gpio_free(enterprise_lcd_swp_pl);
			return err;
		}
		enterprise_stereo_set_orientation(
						enterprise_stereo.orientation);
#if IS_EXTERNAL_PWM
		err = gpio_request(enterprise_bl_pwm, "bl_pwm");
		if (err < 0) {
			pr_err("%s: gpio_request failed %d\n", __func__, err);
			return err;
		}
		gpio_free(enterprise_bl_pwm);
#endif
	} else {
		/* External pwm is used but do not use IS_EXTERNAL_PWM
		compiler switch for TAI */
		err = gpio_request(enterprise_bl_pwm, "bl_pwm");
		if (err < 0) {
			pr_err("%s: gpio_request failed %d\n", __func__, err);
			return err;
		}
		gpio_free(enterprise_bl_pwm);
	}

#if !(DC_CTRL_MODE & TEGRA_DC_OUT_ONE_SHOT_MODE)
	err = gpio_request(enterprise_lcd_swp_pl, "lcd_te");
	if (err < 0) {
		pr_err("%s: gpio_request failed %d\n", __func__, err);
		return err;
	}
	err = gpio_direction_input(enterprise_lcd_te);
	if (err < 0) {
		pr_err("%s: gpio_direction_input failed %d\n",
			__func__, err);
		gpio_free(enterprise_lcd_te);
		return err;
	}
#endif

	if (board_info.board_id != BOARD_E1239)
		err = platform_add_devices(enterprise_gfx_devices,
			ARRAY_SIZE(enterprise_gfx_devices));
	else
		err = platform_add_devices(external_pwm_gfx_devices,
			ARRAY_SIZE(external_pwm_gfx_devices));

#ifdef CONFIG_TEGRA_GRHOST
	phost1x = tegra3_register_host1x_devices();
	if (!phost1x)
		return -EINVAL;
#endif

#if defined(CONFIG_TEGRA_GRHOST) && defined(CONFIG_TEGRA_DC)
	res = platform_get_resource_byname(&enterprise_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(&enterprise_nvmap_device,
		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) {
		enterprise_disp1_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&enterprise_disp1_device);
	}

	res = platform_get_resource_byname(&enterprise_disp2_device,
					 IORESOURCE_MEM, "fbmem");
	res->start = tegra_fb2_start;
	res->end = tegra_fb2_start + tegra_fb2_size - 1;
	if (!err) {
		enterprise_disp2_device.dev.parent = &phost1x->dev;
		err = platform_device_register(&enterprise_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 (!err)
		err = platform_add_devices(enterprise_bl_devices,
				ARRAY_SIZE(enterprise_bl_devices));

	return err;
}