public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Shobhit Kumar <shobhit.kumar@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Shobhit Kumar <shobhit.kumar@intel.com>,
	Thierry Reding <thierry.reding@gmail.com>
Subject: Re: [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers
Date: Fri, 23 Jan 2015 17:54:04 +0530	[thread overview]
Message-ID: <54C23D64.2030700@linux.intel.com> (raw)
In-Reply-To: <6f16170f044611e14bb6f978e4cb36b21b6dbfb3.1421410274.git.jani.nikula@intel.com>

On 01/16/2015 05:57 PM, Jani Nikula wrote:
> Use the drm core interfaces in preparation of removing our homebrew.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

All looks well on code review and tested also and everything works. I 
have ASUS T100 whose panel does not need actually the DCS write commands 
during OTP or enabling, so this patch won't get exercised. With that said-

Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>

> ---
>   drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 52 +++++++++++++++++++-----------
>   1 file changed, 34 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> index e363c26a2b05..0b09e66f7e29 100644
> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
> @@ -113,14 +113,18 @@ static inline enum port intel_dsi_seq_port_to_port(u8 port)
>   static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
>   				       const u8 *data)
>   {
> -	u8 type, byte, mode, vc, seq_port;
> +	struct mipi_dsi_device *dsi_device;
> +	u8 type, flags, seq_port;
>   	u16 len;
>   	enum port port;
>
> -	byte = *data++;
> -	mode = (byte >> MIPI_TRANSFER_MODE_SHIFT) & 0x1;
> -	vc = (byte >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 0x3;
> -	seq_port = (byte >> MIPI_PORT_SHIFT) & 0x3;
> +	flags = *data++;
> +	type = *data++;
> +
> +	len = *((u16 *) data);
> +	data += 2;
> +
> +	seq_port = (flags >> MIPI_PORT_SHIFT) & 3;
>
>   	/* For DSI single link on Port A & C, the seq_port value which is
>   	 * parsed from Sequence Block#53 of VBT has been set to 0
> @@ -131,24 +135,29 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
>   		port = PORT_C;
>   	else
>   		port = intel_dsi_seq_port_to_port(seq_port);
> -	/* LP or HS mode */
> -	intel_dsi->hs = mode;
>
> -	/* get packet type and increment the pointer */
> -	type = *data++;
> +	dsi_device = intel_dsi->dsi_hosts[port]->device;
> +	if (!dsi_device) {
> +		DRM_DEBUG_KMS("no dsi device for port %c\n", port_name(port));
> +		goto out;
> +	}
>
> -	len = *((u16 *) data);
> -	data += 2;
> +	if ((flags >> MIPI_TRANSFER_MODE_SHIFT) & 1)
> +		dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM;
> +	else
> +		dsi_device->mode_flags |= MIPI_DSI_MODE_LPM;
> +
> +	dsi_device->channel = (flags >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 3;
>
>   	switch (type) {
>   	case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
> -		dsi_vc_generic_write_0(intel_dsi, vc, port);
> +		mipi_dsi_generic_write(dsi_device, NULL, 0);
>   		break;
>   	case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
> -		dsi_vc_generic_write_1(intel_dsi, vc, *data, port);
> +		mipi_dsi_generic_write(dsi_device, data, 1);
>   		break;
>   	case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
> -		dsi_vc_generic_write_2(intel_dsi, vc, *data, *(data + 1), port);
> +		mipi_dsi_generic_write(dsi_device, data, 2);
>   		break;
>   	case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
>   	case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
> @@ -156,22 +165,23 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
>   		DRM_DEBUG_DRIVER("Generic Read not yet implemented or used\n");
>   		break;
>   	case MIPI_DSI_GENERIC_LONG_WRITE:
> -		dsi_vc_generic_write(intel_dsi, vc, data, len, port);
> +		mipi_dsi_generic_write(dsi_device, data, len);
>   		break;
>   	case MIPI_DSI_DCS_SHORT_WRITE:
> -		dsi_vc_dcs_write_0(intel_dsi, vc, *data, port);
> +		mipi_dsi_dcs_write_buffer(dsi_device, data, 1);
>   		break;
>   	case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
> -		dsi_vc_dcs_write_1(intel_dsi, vc, *data, *(data + 1), port);
> +		mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
>   		break;
>   	case MIPI_DSI_DCS_READ:
>   		DRM_DEBUG_DRIVER("DCS Read not yet implemented or used\n");
>   		break;
>   	case MIPI_DSI_DCS_LONG_WRITE:
> -		dsi_vc_dcs_write(intel_dsi, vc, data, len, port);
> +		mipi_dsi_dcs_write_buffer(dsi_device, data, len);
>   		break;
>   	}
>
> +out:
>   	data += len;
>
>   	return data;
> @@ -389,6 +399,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>   	u32 lp_to_hs_switch, hs_to_lp_switch;
>   	u32 pclk, computed_ddr;
>   	u16 burst_mode_ratio;
> +	enum port port;
>
>   	DRM_DEBUG_KMS("\n");
>
> @@ -661,5 +672,10 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
>   	vbt_panel->panel.funcs = &vbt_panel_funcs;
>   	drm_panel_add(&vbt_panel->panel);
>
> +	/* a regular driver would get the device in probe */
> +	for_each_dsi_port(port, intel_dsi->ports) {
> +		mipi_dsi_attach(intel_dsi->dsi_hosts[port]->device);
> +	}
> +
>   	return &vbt_panel->panel;
>   }
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-01-23 12:24 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 12:27 [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Jani Nikula
2015-01-16 12:27 ` [RFC PATCH 01/12] drm/i915/dsi: call dpi_send_cmd() for each dsi port at a higher level Jani Nikula
2015-01-22  8:48   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 02/12] drm/i915/dsi: set max return packet size for each dsi port Jani Nikula
2015-01-22 10:53   ` Shobhit Kumar
2015-01-22 12:57     ` Jani Nikula
2015-01-22 13:01   ` [PATCH v2] " Jani Nikula
2015-01-23  2:07     ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 03/12] drm/i915/dsi: move wait_for_dsi_fifo_empty to intel_dsi.c Jani Nikula
2015-01-22  9:01   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 04/12] drm/i915/dsi: call wait_for_dsi_fifo_empty() for each dsi port Jani Nikula
2015-01-22 10:55   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks Jani Nikula
2015-01-22 11:23   ` Shobhit Kumar
2015-01-22 13:23     ` Jani Nikula
2015-01-23  9:44       ` Shobhit Kumar
2015-01-23 15:22         ` Daniel Vetter
2015-01-27  8:41           ` Shobhit Kumar
2015-01-27 13:09             ` Daniel Vetter
2015-01-27 13:13               ` Chris Wilson
2015-01-28  5:08                 ` Shobhit Kumar
2015-01-28  9:17                   ` Daniel Vetter
2015-01-16 12:27 ` [RFC PATCH 06/12] drm/i915/dsi: add some constness to vbt panel driver Jani Nikula
2015-01-22 11:25   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 07/12] drm/i915/dsi: switch to drm_panel interface Jani Nikula
2015-01-23 10:57   ` Shobhit Kumar
2015-01-23 15:31     ` Daniel Vetter
2015-01-27  8:52       ` Shobhit Kumar
2015-01-23 13:30   ` [PATCH v2] " Jani Nikula
2015-01-29  4:52     ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 08/12] drm/i915/dsi: add drm mipi dsi host support Jani Nikula
2015-01-23 12:21   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 09/12] drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers Jani Nikula
2015-01-23 12:24   ` Shobhit Kumar [this message]
2015-01-16 12:27 ` [RFC PATCH 10/12] drm/i915/dsi: remove old read/write functions in favor of new stuff Jani Nikula
2015-01-23 12:25   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 11/12] drm/i915/dsi: move dpi_send_cmd() to intel_dsi.c and make it static Jani Nikula
2015-01-23 12:27   ` Shobhit Kumar
2015-01-16 12:27 ` [RFC PATCH 12/12] drm/i915/dsi: remove intel_dsi_cmd.c and the unused functions therein Jani Nikula
2015-01-23 12:28   ` Shobhit Kumar
2015-01-29 16:04     ` Daniel Vetter
2015-01-22 11:46 ` [RFC PATCH 00/12] drm/i915: port dsi over to drm panel/dsi frameworks Shobhit Kumar
2015-01-22 13:28   ` Jani Nikula
2015-01-23  2:13     ` Shobhit Kumar
2015-01-23 12:30       ` Shobhit Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54C23D64.2030700@linux.intel.com \
    --to=shobhit.kumar@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=shobhit.kumar@intel.com \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox