コード例 #1
0
ファイル: display_lvds.c プロジェクト: iTOP4418/kernel-3.4.39
static int lvds_probe(struct platform_device *pdev)
{
	struct nxp_lcd_plat_data *plat = pdev->dev.platform_data;
	struct disp_lvds_param *plvds;
	struct disp_syncgen_par *sgpar;
	struct disp_vsync_info *psync;
	int device = DISP_DEVICE_LVDS;
	int input;

	RET_ASSERT_VAL(plat, -EINVAL);
	RET_ASSERT_VAL(plat->display_in == DISP_DEVICE_SYNCGEN0 ||
				   plat->display_in == DISP_DEVICE_SYNCGEN1 ||
				   plat->display_dev == DISP_DEVICE_LVDS ||
				   plat->display_in == DISP_DEVICE_RESCONV, -EINVAL);
	RET_ASSERT_VAL(plat->vsync, -EINVAL);

	plvds = kzalloc(sizeof(*plvds), GFP_KERNEL);
	RET_ASSERT_VAL(plvds, -EINVAL);

	if (plat->dev_param) {
		memcpy(plvds, plat->dev_param, sizeof(*plvds));
	} else {
		plvds->lcd_format = LVDS_LCDFORMAT_JEIDA;
	}

	sgpar = plat->sync_gen;
	psync = plat->vsync;
	input = plat->display_in;

	lvds_initialize();

	nxp_soc_disp_register_proc_ops(device, &lvds_ops);
	nxp_soc_disp_device_connect_to(device, input, psync);
	nxp_soc_disp_device_set_dev_param(device, plvds);

	if (sgpar && (input == DISP_DEVICE_SYNCGEN0 || input == DISP_DEVICE_SYNCGEN1))
		nxp_soc_disp_device_set_sync_param(input, sgpar);

	printk("LVDS: [%d]=%s connect to [%d]=%s\n",
		device, dev_to_str(device), input, dev_to_str(input));

	return 0;
}
コード例 #2
0
static int mipi_probe(struct platform_device *pdev)
{
	struct nxp_lcd_plat_data *plat = pdev->dev.platform_data;
	struct disp_mipi_param *pmipi;
	struct disp_vsync_info *psync;
	struct disp_syncgen_par *sgpar;
	int device = DISP_DEVICE_MIPI;
	int input;

	RET_ASSERT_VAL(plat, -EINVAL);
	RET_ASSERT_VAL(plat->display_in == DISP_DEVICE_SYNCGEN0 ||
				   plat->display_in == DISP_DEVICE_SYNCGEN1 ||
				   plat->display_dev == DISP_DEVICE_MIPI ||
				   plat->display_in == DISP_DEVICE_RESCONV, -EINVAL);
	RET_ASSERT_VAL(plat->vsync, -EINVAL);

	pmipi = kzalloc(sizeof(*pmipi), GFP_KERNEL);
	RET_ASSERT_VAL(pmipi, -EINVAL);

	if (plat->dev_param)
		memcpy(pmipi, plat->dev_param, sizeof(*pmipi));

	sgpar = plat->sync_gen;
	psync = plat->vsync;
	input = plat->display_in;

	mipi_initialize();

	nxp_soc_disp_register_proc_ops(device, &mipi_ops);
	nxp_soc_disp_device_connect_to(device, input, psync);
	nxp_soc_disp_device_set_dev_param(device, pmipi);

	if (sgpar &&
		(input == DISP_DEVICE_SYNCGEN0 ||
		 input == DISP_DEVICE_SYNCGEN1))
		nxp_soc_disp_device_set_sync_param(input, sgpar);

	printk("MIPI: [%d]=%s connect to [%d]=%s\n",
		device, dev_to_str(device), input, dev_to_str(input));

	return 0;
}
コード例 #3
0
ファイル: nxp-resc.c プロジェクト: advx9600/kernel-4.4-RuiEr
static int _set_remote_sync(struct nxp_resc *me)
{
    int ret;
    struct disp_vsync_info vsync;
    struct disp_syncgen_par param;
    int source_device;
    struct v4l2_subdev *remote_source;

    remote_source = _get_remote_source_subdev(me);
    if (!remote_source) {
        pr_err("%s: can't get remote source\n", __func__);
        return -EIO;
    }

    if (!strncmp(remote_source->name, "NXP MLC", 7)) {
        char *numchar = remote_source->name + 7;
        int module = *numchar - '0';
        if (module == 0) {
            source_device = DISP_DEVICE_SYNCGEN0;
            NX_DISPLAYTOP_SetRESCONVMUX(CTRUE, PrimaryMLC);
        } else {
            source_device = DISP_DEVICE_SYNCGEN1;
            NX_DISPLAYTOP_SetRESCONVMUX(CTRUE, SecondaryMLC);
        }
        me->dpc_module_num = module;
        pr_debug("%s: dpc module num %d\n", __func__, module);

        if (me->preset) {
            ret = _get_vsync_info_with_preset(me, source_device, &vsync, &param);
            if (ret) {
                pr_err("%s: failed to _get_vsync_info_with_preset()\n", __func__);
                return ret;
            }
        } else {
            ret = _get_vsync_info(me, source_device, &vsync, &param);
            if (ret) {
                pr_err("%s: failed to _get_vsync_info()\n", __func__);
                return ret;
            }
        }

        pr_debug("%s: RESC Source Device 0x%x\n", __func__, source_device);
        ret = nxp_soc_disp_device_set_sync_param(source_device, (void *)&param);
        if (ret) {
            pr_err("%s: failed to nxp_soc_disp_device_set_sync_param()\n", __func__);
            return ret;
        }

        me->dynamic_change_count = 0;
        if (me->preset && me->preset->dpc_sync_param.use_dynamic)
            me->callback = nxp_soc_disp_register_irq_callback(me->dpc_module_num, _resc_intr_callback, me);

        ret = nxp_soc_disp_device_connect_to(DISP_DEVICE_RESCONV, source_device, &vsync);
        if (ret) {
            pr_err("%s: failed to connect to source\n", __func__);
            return ret;
        }

        me->source_device = source_device;
        return nxp_soc_disp_device_enable(source_device, 1);
    } else {
        pr_err("%s: invalid source %s\n", __func__, remote_source->name);
        return -EINVAL;
    }
}