Exemplo n.º 1
0
static void s6e8aa0_set_maximum_return_packet_size(struct s6e8aa0 *ctx,
						   int size)
{
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	const struct mipi_dsi_host_ops *ops = dsi->host->ops;
	u8 buf[] = {size, 0};
	struct mipi_dsi_msg msg = {
		.channel = dsi->channel,
		.type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE,
		.tx_len = sizeof(buf),
		.tx_buf = buf
	};
	int ret;

	if (ctx->error < 0)
		return;

	if (!ops || !ops->transfer)
		ret = -EIO;
	else
		ret = ops->transfer(dsi->host, &msg);

	if (ret < 0) {
		dev_err(ctx->dev,
			"error %d setting maximum return packet size to %d\n",
			ret, size);
		ctx->error = ret;
	}
}

static void s6e8aa0_read_mtp_id(struct s6e8aa0 *ctx)
{
	u8 id[3];
	int ret, i;

	ret = s6e8aa0_dcs_read(ctx, 0xd1, id, ARRAY_SIZE(id));
	if (ret < ARRAY_SIZE(id) || id[0] == 0x00) {
		dev_err(ctx->dev, "read id failed\n");
		ctx->error = -EIO;
		return;
	}

	dev_info(ctx->dev, "ID: 0x%2x, 0x%2x, 0x%2x\n", id[0], id[1], id[2]);

	for (i = 0; i < ARRAY_SIZE(s6e8aa0_variants); ++i) {
		if (id[1] == s6e8aa0_variants[i].version)
			break;
	}
	if (i >= ARRAY_SIZE(s6e8aa0_variants)) {
		dev_err(ctx->dev, "unsupported display version %d\n", id[1]);
		ctx->error = -EINVAL;
		return;
	}

	ctx->variant = &s6e8aa0_variants[i];
	ctx->version = id[1];
	ctx->id = id[2];
}
Exemplo n.º 2
0
static int s6e3ha2_disable(struct drm_panel *panel)
{
	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	int ret;

	s6e3ha2_call_write_func(ret, mipi_dsi_dcs_enter_sleep_mode(dsi));
	s6e3ha2_call_write_func(ret, mipi_dsi_dcs_set_display_off(dsi));

	msleep(40);
	ctx->bl_dev->props.power = FB_BLANK_NORMAL;

	return 0;
}
Exemplo n.º 3
0
static void s6e8aa0_dcs_write(struct s6e8aa0 *ctx, const void *data, size_t len)
{
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	int ret;

	if (ctx->error < 0)
		return;

	ret = mipi_dsi_dcs_write(dsi, dsi->channel, data, len);
	if (ret < 0) {
		dev_err(ctx->dev, "error %d writing dcs seq: %*ph\n", ret, len,
			data);
		ctx->error = ret;
	}
}
Exemplo n.º 4
0
static int s6e8aa0_dcs_read(struct s6e8aa0 *ctx, u8 cmd, void *data, size_t len)
{
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	int ret;

	if (ctx->error < 0)
		return ctx->error;

	ret = mipi_dsi_dcs_read(dsi, dsi->channel, cmd, data, len);
	if (ret < 0) {
		dev_err(ctx->dev, "error %d reading dcs seq(%#x)\n", ret, cmd);
		ctx->error = ret;
	}

	return ret;
}
Exemplo n.º 5
0
static int s6e3ha2_panel_init(struct s6e3ha2 *ctx)
{
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	int ret;

	s6e3ha2_call_write_func(ret, mipi_dsi_dcs_exit_sleep_mode(dsi));
	usleep_range(5000, 6000);

	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_single_dsi_set(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_fc(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_freq_calibration(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_fc(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx));

	return 0;
}
Exemplo n.º 6
0
static int s6e3ha2_enable(struct drm_panel *panel)
{
	struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);
	int ret;

	/* common setting */
	s6e3ha2_call_write_func(ret,
		mipi_dsi_dcs_set_tear_on(dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK));

	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_f0(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_on_fc(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_touch_hsync_on1(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_pentile_control(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_poc_global(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_poc_setting(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_fc(ctx));

	/* pcd setting off for TB */
	s6e3ha2_call_write_func(ret, s6e3ha2_pcd_set_off(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_err_fg_set(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_te_start_setting(ctx));

	/* brightness setting */
	s6e3ha2_call_write_func(ret, s6e3ha2_set_brightness(ctx->bl_dev));
	s6e3ha2_call_write_func(ret, s6e3ha2_aor_control(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_caps_elvss_set(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_gamma_update(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_acl_off(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_acl_off_opr(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_hbm_off(ctx));

	/* elvss temp compensation */
	s6e3ha2_call_write_func(ret, s6e3ha2_test_global(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_test(ctx));
	s6e3ha2_call_write_func(ret, s6e3ha2_test_key_off_f0(ctx));

	s6e3ha2_call_write_func(ret, mipi_dsi_dcs_set_display_on(dsi));
	ctx->bl_dev->props.power = FB_BLANK_UNBLANK;

	return 0;
}
Exemplo n.º 7
0
static int s6e3ha2_dcs_write(struct s6e3ha2 *ctx, const void *data, size_t len)
{
	struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev);

	return mipi_dsi_dcs_write_buffer(dsi, data, len);
}