Example #1
0
static int s6e63m0_dsi_read_panel_id(struct s6e63m0_dsi_lcd *lcd)
{
	int readret = 0;
	int len = 1;

	if (lcd->lcd_id[0] != 0xFE) {
		dev_dbg(&lcd->ddev->dev, "%s: Read device id of the display\n", __func__);

		readret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID1,
						(u32 *)&lcd->lcd_id[0], &len);
		if (!readret)
			readret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID2,
						(u32 *)&lcd->lcd_id[1], &len);
		if (!readret)
			readret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID3,
						(u32 *)&lcd->lcd_id[2], &len);
		if (readret)
			dev_info(&lcd->ddev->dev,
				"mcde_dsi_dcs_read failed to read display ID\n");

		switch (lcd->lcd_id[1]) {

			case ID_VALUE_M2:
				dev_info(lcd->dev, "Panel is AMS397GE MIPI M2\n");
				lcd->elvss_pulse = lcd->lcd_id[2];
				lcd->elvss_offsets = stod13cm_elvss_offsets;
				break;

			case ID_VALUE_SM2:
			case ID_VALUE_SM2_1:
				dev_info(lcd->dev, "Panel is AMS397GE MIPI SM2\n");
				lcd->elvss_pulse = lcd->lcd_id[2];
				lcd->elvss_offsets = stod13cm_elvss_offsets;
				break;

			default:
				dev_err(lcd->dev, "panel type not recognised (panel_id = %x, %x, %x)\n",
					lcd->lcd_id[0], lcd->lcd_id[1], lcd->lcd_id[2]);
				lcd->elvss_pulse = 0x16;
				lcd->elvss_offsets = stod13cm_elvss_offsets;
				
//				readret = -EINVAL;
				break;
		}
	}
	return 0;
}
Example #2
0
static int hva40wv1_dsi_read_panel_id(struct hva40wv1_lcd *lcd)
{
	int ret = 0;
	int len = 1;

	if (lcd->lcd_id[0] == 0x00) {
		dev_dbg(&lcd->ddev->dev, "%s: Read device id of the display\n", __func__);

		ret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID1,
						(u32 *)&lcd->lcd_id[0], &len);
		ret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID2,
						(u32 *)&lcd->lcd_id[1], &len);
		ret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID3,
						(u32 *)&lcd->lcd_id[2], &len);
		if (ret)
			dev_info(&lcd->ddev->dev,
				"mcde_dsi_dcs_read failed (%d) to read display ID (len %d)\n",
				ret, len);
	}
	return ret;
}
static int nt35512_read_checksum(struct skomer_lcd_data *lcd, u8 *checksum)
{
	int ret;
	int len = 1;

	ret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_CHECKSUM,
				(u32 *)checksum, &len);
	if (ret)
		dev_info(lcd->dev, "ESD Read checksum failed (%d)\n", ret);

	return ret;
}
static int dsi_read_panel_id(struct skomer_lcd_data *lcd)
{
	int readret = 0;
	int len = 1;

	if (lcd->lcd_id[0] == 0x00) {
		dev_dbg(&lcd->ddev->dev, "%s: Read device id of the display\n", __func__);

		readret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID1,
						(u32 *)&lcd->lcd_id[0], &len);
		readret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID2,
						(u32 *)&lcd->lcd_id[1], &len);
		readret = mcde_dsi_dcs_read(lcd->ddev->chnl_state, DCS_CMD_READ_ID3,
						(u32 *)&lcd->lcd_id[2], &len);
		if (readret)
			dev_info(&lcd->ddev->dev,
				"mcde_dsi_dcs_read failed to read display ID\n");
		else
			dev_info(&lcd->ddev->dev, "Panel id = 0x%x,0x%x,0x%x\n",
				lcd->lcd_id[0], lcd->lcd_id[1], lcd->lcd_id[2]);
	}
	return readret;
}
Example #5
0
static ssize_t reg_read(struct file *file, const char __user *ubuf,
						size_t count, loff_t *ppos)
{
	struct seq_file *s = file->private_data;
	struct mcde_display_device *ddev = s->private;
	struct device *dev;
	u8 reg;
	int len;
	u32 tmp_data;
	u8 data[MCDE_MAX_DSI_DIRECT_CMD_WRITE];
	char *buf;
	int ret;
	struct mcde_chnl_state *chnl;
	char tmp[TMP_BUF_SZ];

	if (!ddev || !&ddev->dev) {
		pr_err("%s: no device\n", __func__);
		ret = -ENODEV;
		goto exit;
	}
	chnl = ddev->chnl_state;
	dev = &ddev->dev;

	dev_dbg(dev, "%s\n", __func__);

	reset_res_buf();

	buf = kzalloc(sizeof(char) * count, GFP_KERNEL);
	if (!buf) {
		dev_err(dev, "%s: Failed to allocate buffer\n", __func__);
		ret = -ENOMEM;
		goto exit;
	}

	dev_dbg(dev, "%s: buf = %p, ubuf = %p, count = %d, "
				"sizeof(char) * count = %d, line = %d\n",
		__func__, buf, ubuf, count, sizeof(char) * count, __LINE__);

	if (copy_from_user(buf, ubuf, count)) {
		ret = -EFAULT;
		goto fail_free_mem;
	}

	if (sscanf(buf, "%4hhx %1u", &reg, &len) != 2) {
		update_res_buf("Read - parameter error\n");
		ret = -EINVAL;
		goto fail_free_mem;
	}

	dev_dbg(dev, "reg=%hx, len=%d\n", reg, len);

	/* length restriction in mcde read function */
	if (len > MCDE_MAX_DCS_READ)
		len = MCDE_MAX_DCS_READ;

	memset(data, 0, sizeof(data));

	ret = mcde_dsi_dcs_read(chnl, reg, &tmp_data, &len);
	if (!ret) {
		memcpy(data, &tmp_data, len);
		print_params(READ_CMD, reg, len, data);
	} else {
		snprintf(tmp, sizeof(tmp), "Read failed, ret = %d!\n", ret);
		update_res_buf(tmp);
	}

fail_free_mem:
	kfree(buf);
exit:
	return count;
}