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 05/12] drm/i915/dsi: remove unnecessary dsi device callbacks
Date: Fri, 23 Jan 2015 15:14:41 +0530	[thread overview]
Message-ID: <54C21809.1020708@linux.intel.com> (raw)
In-Reply-To: <87r3ungd9a.fsf@intel.com>

On 01/22/2015 06:53 PM, Jani Nikula wrote:
> On Thu, 22 Jan 2015, Shobhit Kumar <shobhit.kumar@linux.intel.com> wrote:
>> On 01/16/2015 05:57 PM, Jani Nikula wrote:
>>> Remove all the trivial and/or dummy callbacks from intel dsi device
>>> ops. Merge send_otp_cmds into panel_reset as they're called back to
>>> back.
>>>
>>> This will be helpful for switching to use drm_panel for the
>>> callbacks. If we ever need the additional callbacks, we should add them
>>> to drm_panel funcs.
>>>
>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>> ---
>>>    drivers/gpu/drm/i915/intel_dsi.c           | 32 ++-------------------
>>>    drivers/gpu/drm/i915/intel_dsi.h           | 20 -------------
>>>    drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 45 ++----------------------------
>>>    3 files changed, 5 insertions(+), 92 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
>>> index 9b0eaa9db845..fc218b7754b3 100644
>>> --- a/drivers/gpu/drm/i915/intel_dsi.c
>>> +++ b/drivers/gpu/drm/i915/intel_dsi.c
>>> @@ -70,12 +70,6 @@ static void band_gap_reset(struct drm_i915_private *dev_priv)
>>>    	mutex_unlock(&dev_priv->dpio_lock);
>>>    }
>>>
>>> -static struct intel_dsi *intel_attached_dsi(struct drm_connector *connector)
>>> -{
>>> -	return container_of(intel_attached_encoder(connector),
>>> -			    struct intel_dsi, base);
>>> -}
>>> -
>>>    static inline bool is_vid_mode(struct intel_dsi *intel_dsi)
>>>    {
>>>    	return intel_dsi->operation_mode == INTEL_DSI_VIDEO_MODE;
>>> @@ -99,7 +93,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>>    	struct intel_connector *intel_connector = intel_dsi->attached_connector;
>>>    	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
>>>    	struct drm_display_mode *adjusted_mode = &config->adjusted_mode;
>>> -	struct drm_display_mode *mode = &config->requested_mode;
>>>
>>>    	DRM_DEBUG_KMS("\n");
>>>
>>> @@ -109,10 +102,6 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>>    	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>>>    	adjusted_mode->flags = 0;
>>>
>>> -	if (intel_dsi->dev.dev_ops->mode_fixup)
>>> -		return intel_dsi->dev.dev_ops->mode_fixup(&intel_dsi->dev,
>>> -							  mode, adjusted_mode);
>>> -
>>
>> There had been a instance where we had to drive different resolution
>> (lower) than the native one. Also in VBT there is a field to make this
>> generic at least from driver perspective to give the needed target
>> resolution. In case target resolution is same as native, nothing gets
>> changed, else mode_fixup function adjusts the mode accordingly keeping
>> timing as same and enabling scalar. Might not be useful in general, but
>> did find a use internally.
>
> Can we just have the driver return the desired mode from .get_modes in
> that case?

Okay, I think I did not explain correctly. Get modes is modified to give 
the needed target mode only so that userspace creates buffer of the 
needed resolution, but in fixup which is called at modeset, we correct 
the adjusted_mode back to have native resolutions so that modeset is 
correctly done. if we do not do like this, during modeset resolutions 
will be wrong as per the timings.

Regards
Shobhit

>
> BR,
> Jani.
>
>
>>
>> Either way
>>
>> Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>
>>
>>>    	return true;
>>>    }
>>>
>>> @@ -269,9 +258,6 @@ static void intel_dsi_pre_enable(struct intel_encoder *encoder)
>>>    	if (intel_dsi->dev.dev_ops->panel_reset)
>>>    		intel_dsi->dev.dev_ops->panel_reset(&intel_dsi->dev);
>>>
>>> -	if (intel_dsi->dev.dev_ops->send_otp_cmds)
>>> -		intel_dsi->dev.dev_ops->send_otp_cmds(&intel_dsi->dev);
>>> -
>>>    	for_each_dsi_port(port, intel_dsi->ports)
>>>    		wait_for_dsi_fifo_empty(intel_dsi, port);
>>>
>>> @@ -484,7 +470,6 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>>>    {
>>>    	struct intel_connector *intel_connector = to_intel_connector(connector);
>>>    	struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;
>>> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
>>>
>>>    	DRM_DEBUG_KMS("\n");
>>>
>>> @@ -500,7 +485,7 @@ intel_dsi_mode_valid(struct drm_connector *connector,
>>>    			return MODE_PANEL;
>>>    	}
>>>
>>> -	return intel_dsi->dev.dev_ops->mode_valid(&intel_dsi->dev, mode);
>>> +	return MODE_OK;
>>>    }
>>>
>>>    /* return txclkesc cycles in terms of divider and duration in us */
>>> @@ -749,20 +734,7 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)
>>>    static enum drm_connector_status
>>>    intel_dsi_detect(struct drm_connector *connector, bool force)
>>>    {
>>> -	struct intel_dsi *intel_dsi = intel_attached_dsi(connector);
>>> -	struct intel_encoder *intel_encoder = &intel_dsi->base;
>>> -	enum intel_display_power_domain power_domain;
>>> -	enum drm_connector_status connector_status;
>>> -	struct drm_i915_private *dev_priv = intel_encoder->base.dev->dev_private;
>>> -
>>> -	DRM_DEBUG_KMS("\n");
>>> -	power_domain = intel_display_port_power_domain(intel_encoder);
>>> -
>>> -	intel_display_power_get(dev_priv, power_domain);
>>> -	connector_status = intel_dsi->dev.dev_ops->detect(&intel_dsi->dev);
>>> -	intel_display_power_put(dev_priv, power_domain);
>>> -
>>> -	return connector_status;
>>> +	return connector_status_connected;
>>>    }
>>>
>>>    static int intel_dsi_get_modes(struct drm_connector *connector)
>>> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
>>> index 2bb8c46c7889..22f87036a256 100644
>>> --- a/drivers/gpu/drm/i915/intel_dsi.h
>>> +++ b/drivers/gpu/drm/i915/intel_dsi.h
>>> @@ -47,33 +47,13 @@ struct intel_dsi_dev_ops {
>>>
>>>    	void (*disable_panel_power)(struct intel_dsi_device *dsi);
>>>
>>> -	/* one time programmable commands if needed */
>>> -	void (*send_otp_cmds)(struct intel_dsi_device *dsi);
>>> -
>>>    	/* This callback must be able to assume DSI commands can be sent */
>>>    	void (*enable)(struct intel_dsi_device *dsi);
>>>
>>>    	/* This callback must be able to assume DSI commands can be sent */
>>>    	void (*disable)(struct intel_dsi_device *dsi);
>>>
>>> -	int (*mode_valid)(struct intel_dsi_device *dsi,
>>> -			  struct drm_display_mode *mode);
>>> -
>>> -	bool (*mode_fixup)(struct intel_dsi_device *dsi,
>>> -			   const struct drm_display_mode *mode,
>>> -			   struct drm_display_mode *adjusted_mode);
>>> -
>>> -	void (*mode_set)(struct intel_dsi_device *dsi,
>>> -			 struct drm_display_mode *mode,
>>> -			 struct drm_display_mode *adjusted_mode);
>>> -
>>> -	enum drm_connector_status (*detect)(struct intel_dsi_device *dsi);
>>> -
>>> -	bool (*get_hw_state)(struct intel_dsi_device *dev);
>>> -
>>>    	struct drm_display_mode *(*get_modes)(struct intel_dsi_device *dsi);
>>> -
>>> -	void (*destroy) (struct intel_dsi_device *dsi);
>>>    };
>>>
>>>    struct intel_dsi {
>>> diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>>> index 5493aef5a6a3..b0e7327a485f 100644
>>> --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>>> +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c
>>> @@ -559,18 +559,6 @@ static bool generic_init(struct intel_dsi_device *dsi)
>>>    	return true;
>>>    }
>>>
>>> -static int generic_mode_valid(struct intel_dsi_device *dsi,
>>> -		   struct drm_display_mode *mode)
>>> -{
>>> -	return MODE_OK;
>>> -}
>>> -
>>> -static bool generic_mode_fixup(struct intel_dsi_device *dsi,
>>> -		    const struct drm_display_mode *mode,
>>> -		    struct drm_display_mode *adjusted_mode) {
>>> -	return true;
>>> -}
>>> -
>>>    static void generic_panel_reset(struct intel_dsi_device *dsi)
>>>    {
>>>    	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>> @@ -580,26 +568,18 @@ static void generic_panel_reset(struct intel_dsi_device *dsi)
>>>    	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_ASSERT_RESET];
>>>
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>> -}
>>> -
>>> -static void generic_disable_panel_power(struct intel_dsi_device *dsi)
>>> -{
>>> -	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>> -	struct drm_device *dev = intel_dsi->base.base.dev;
>>> -	struct drm_i915_private *dev_priv = dev->dev_private;
>>> -
>>> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>>>
>>> +	sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>>    }
>>>
>>> -static void generic_send_otp_cmds(struct intel_dsi_device *dsi)
>>> +static void generic_disable_panel_power(struct intel_dsi_device *dsi)
>>>    {
>>>    	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>>    	struct drm_device *dev = intel_dsi->base.base.dev;
>>>    	struct drm_i915_private *dev_priv = dev->dev_private;
>>>
>>> -	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_INIT_OTP];
>>> +	char *sequence = dev_priv->vbt.dsi.sequence[MIPI_SEQ_DEASSERT_RESET];
>>>
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>>    }
>>> @@ -626,16 +606,6 @@ static void generic_disable(struct intel_dsi_device *dsi)
>>>    	generic_exec_sequence(intel_dsi, sequence);
>>>    }
>>>
>>> -static enum drm_connector_status generic_detect(struct intel_dsi_device *dsi)
>>> -{
>>> -	return connector_status_connected;
>>> -}
>>> -
>>> -static bool generic_get_hw_state(struct intel_dsi_device *dev)
>>> -{
>>> -	return true;
>>> -}
>>> -
>>>    static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>>>    {
>>>    	struct intel_dsi *intel_dsi = container_of(dsi, struct intel_dsi, dev);
>>> @@ -646,20 +616,11 @@ static struct drm_display_mode *generic_get_modes(struct intel_dsi_device *dsi)
>>>    	return dev_priv->vbt.lfp_lvds_vbt_mode;
>>>    }
>>>
>>> -static void generic_destroy(struct intel_dsi_device *dsi) { }
>>> -
>>> -/* Callbacks. We might not need them all. */
>>>    struct intel_dsi_dev_ops vbt_generic_dsi_display_ops = {
>>>    	.init = generic_init,
>>> -	.mode_valid = generic_mode_valid,
>>> -	.mode_fixup = generic_mode_fixup,
>>>    	.panel_reset = generic_panel_reset,
>>>    	.disable_panel_power = generic_disable_panel_power,
>>> -	.send_otp_cmds = generic_send_otp_cmds,
>>>    	.enable = generic_enable,
>>>    	.disable = generic_disable,
>>> -	.detect = generic_detect,
>>> -	.get_hw_state = generic_get_hw_state,
>>>    	.get_modes = generic_get_modes,
>>> -	.destroy = generic_destroy,
>>>    };
>>>
>>
>> Regards
>> Shobhit
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-01-23  9:45 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 [this message]
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
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=54C21809.1020708@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