All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Madhav Chauhan <madhav.chauhan@intel.com>,
	"Kulkarni, Vandita" <vandita.kulkarni@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: paulo.r.zanoni@intel.com, rodrigo.vivi@intel.com
Subject: Re: [v5, 02/13] drm/i915/icl: DSI vswing programming sequence
Date: Tue, 11 Sep 2018 21:16:22 +0300	[thread overview]
Message-ID: <87efdzew7d.fsf@intel.com> (raw)
In-Reply-To: <7958dbc0-d09a-4dd0-b153-6aa3b4f91a8f@intel.com>

On Mon, 10 Sep 2018, Madhav Chauhan <madhav.chauhan@intel.com> wrote:
> On 9/6/2018 7:31 PM, Kulkarni, Vandita wrote:
>>
>>
>>
>> On 7/10/2018 3:10 PM, Madhav Chauhan wrote:
>>> This patch setup voltage swing before enabling
>>> combo PHY DDI (shared with DSI).
>>> Note that DSI voltage swing programming is for
>>> high speed data buffers. HW automatically handles
>>> the voltage swing for the low power data buffers.
>>>
>>> v2: Rebase
>>>
>>> Signed-off-by: Madhav Chauhan<madhav.chauhan@intel.com>
>>> ---
>>>   drivers/gpu/drm/i915/icl_dsi.c | 114 +++++++++++++++++++++++++++++++++++++++++
>>>   1 file changed, 114 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/icl_dsi.c b/drivers/gpu/drm/i915/icl_dsi.c
>>> index a571339..dc16c1f 100644
>>> --- a/drivers/gpu/drm/i915/icl_dsi.c
>>> +++ b/drivers/gpu/drm/i915/icl_dsi.c
>>> @@ -27,6 +27,65 @@
>>>   
>>>   #include "intel_dsi.h"
>>>   
>>> +static void dsi_program_swing_and_deemphasis(struct intel_encoder *encoder)
>>> +{
>>> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>> +	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>>> +	enum port port;
>>> +	u32 tmp;
>>> +	int lane;
>>> +
>>> +	for_each_dsi_port(port, intel_dsi->ports) {
>>> +
>>> +		/* Bspec: set scaling mode to 0x6 */
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_LN0(port));
>>> +		tmp |= SCALING_MODE_SEL(6);
>>> +		I915_WRITE(ICL_PORT_TX_DW5_GRP(port), tmp);
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_AUX(port));
>>> +		tmp |= SCALING_MODE_SEL(6);
>>> +		I915_WRITE(ICL_PORT_TX_DW5_AUX(port), tmp);
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_LN0(port));
>>> +		tmp |= TAP2_DISABLE | TAP3_DISABLE;
>>> +		I915_WRITE(ICL_PORT_TX_DW5_GRP(port), tmp);
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_AUX(port));
>>> +		tmp |= TAP2_DISABLE | TAP3_DISABLE;
>>> +		I915_WRITE(ICL_PORT_TX_DW5_AUX(port), tmp);
>>> +
>>> +		/*
>>> +		 * swing and scaling values are taken from DSI
>>> +		 * table under vswing programming sequence for
>>> +		 * combo phy ddi in BSPEC.
>>> +		 * program swing values
>>> +		 */
>>> +		tmp = I915_READ(ICL_PORT_TX_DW2_LN0(port));
>>> +		tmp |= SWING_SEL_UPPER(0x2);
>>> +		tmp |= SWING_SEL_LOWER(0x2);
>>> +		tmp |= RCOMP_SCALAR(0x98);
>>> +		I915_WRITE(ICL_PORT_TX_DW2_GRP(port), tmp);
>>> +		tmp = I915_READ(ICL_PORT_TX_DW2_AUX(port));
>>> +		tmp |= SWING_SEL_UPPER(0x2);
>>> +		tmp |= SWING_SEL_LOWER(0x2);
>>> +		tmp |= RCOMP_SCALAR(0x98);
>>> +		I915_WRITE(ICL_PORT_TX_DW2_AUX(port), tmp);
>>> +
>>> +		/* program scaling values */
>>> +		tmp = I915_READ(ICL_PORT_TX_DW4_AUX(port));
>>> +		tmp |= POST_CURSOR_1(0x0);
>>> +		tmp |= POST_CURSOR_2(0x0);
>>> +		tmp |= CURSOR_COEFF(0x18);
>>> +		I915_WRITE(ICL_PORT_TX_DW4_AUX(port), tmp);
>>> +
>>> +		for (lane = 0; lane <= 3; lane++) {
>>> +			/* Bspec: must not use GRP register for write */
>>> +			tmp = I915_READ(ICL_PORT_TX_DW4_LN(port, lane));
>>> +			tmp |= POST_CURSOR_1(0x0);
>>> +			tmp |= POST_CURSOR_2(0x0);
>>> +			tmp |= CURSOR_COEFF(0x18);
>>> +			I915_WRITE(ICL_PORT_TX_DW4_LN(port, lane), tmp);
>>> +		}
>>> +	}
>>> +}
>>> +
>>>   static void gen11_dsi_program_esc_clk_div(struct intel_encoder *encoder)
>>>   {
>>>   	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>> @@ -140,6 +199,58 @@ static void gen11_dsi_config_phy_lanes_sequence(struct intel_encoder *encoder)
>>>   	}
>>>   }
>>>   
>>
>> I see from the bspec that except for the Loadgen Select and Latency 
>> Optimization all other DDI buffer programming can be taken from the 
>> DDI Buffer section.
>>
>> Can we use this function "icl_ddi_combo_vswing_program" function which 
>> is already there
>> patch for reference:
>> https://patchwork.freedesktop.org/patch/213515/

For code already merged upstream, please use commit id or file
references.

>
> We can't directly use that implementation. Reasons:
> 1. For DSI we use AUX register as well to write which is not the case 
> for DDI. We need to add multiple INTEL_OUTPUT_DSI
> checks .
> 2. DSI specific icl_combo_phy_ddi_buf_trans not added in intel_ddi.c 
> which will be used while doing vswing programming
> 3. intel_ddi_dp_level doesn't support "level" calculation for DSI.
>
> Also in past we had similar discussion (with Jani N) to keep DSI 
> specific entries/code in DSI encoder.
>
> Jani N whats the suggestion here??

Let's go with the slightly duplicated code, at least for now to get this
merged. This is tedious stuff to review, and combining that with merging
to DP/HDMI buf programming makes it unnecessarily hard. We can refactor
afterwards as needed.

BR,
Jani.


>
> Regards,
> Madhav
>
>>
>> Thanks,
>> Vandita
>>
>>> +static void gen11_dsi_voltage_swing_program_seq(struct intel_encoder *encoder)
>>> +{
>>> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>> +	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>>> +	u32 tmp;
>>> +	enum port port;
>>> +
>>> +	/* Step C.1:clear common keeper enable bit */
>>> +	for_each_dsi_port(port, intel_dsi->ports) {
>>> +		tmp = I915_READ(ICL_PORT_PCS_DW1_LN0(port));
>>> +		tmp &= ~COMMON_KEEPER_EN;
>>> +		I915_WRITE(ICL_PORT_PCS_DW1_GRP(port), tmp);
>>> +		tmp = I915_READ(ICL_PORT_PCS_DW1_AUX(port));
>>> +		tmp &= ~COMMON_KEEPER_EN;
>>> +		I915_WRITE(ICL_PORT_PCS_DW1_AUX(port), tmp);
>>> +	}
>>> +
>>> +	/*
>>> +	 * Step C.3: Set SUS Clock Config bitfield to 11b
>>> +	 * Note: Step C.2 (loadgen select program) is done
>>> +	 * as part of lane phy sequence configuration
>>> +	 */
>>> +	for_each_dsi_port(port, intel_dsi->ports) {
>>> +		tmp = I915_READ(ICL_PORT_CL_DW5(port));
>>> +		tmp |= SUS_CLOCK_CONFIG;
>>> +		I915_WRITE(ICL_PORT_CL_DW5(port), tmp);
>>> +	}
>>> +
>>> +	/* Step C.4: Clear training enable to change swing values */
>>> +	for_each_dsi_port(port, intel_dsi->ports) {
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_LN0(port));
>>> +		tmp &= ~TX_TRAINING_EN;
>>> +		I915_WRITE(ICL_PORT_TX_DW5_GRP(port), tmp);
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_AUX(port));
>>> +		tmp &= ~TX_TRAINING_EN;
>>> +		I915_WRITE(ICL_PORT_TX_DW5_AUX(port), tmp);
>>> +	}
>>> +
>>> +	/* Step C.5: Program swing and de-emphasis */
>>> +	dsi_program_swing_and_deemphasis(encoder);
>>> +
>>> +	/* Step: C.6: Set training enable to trigger update */
>>> +	for_each_dsi_port(port, intel_dsi->ports) {
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_LN0(port));
>>> +		tmp |= TX_TRAINING_EN;
>>> +		I915_WRITE(ICL_PORT_TX_DW5_GRP(port), tmp);
>>> +		tmp = I915_READ(ICL_PORT_TX_DW5_AUX(port));
>>> +		tmp |= TX_TRAINING_EN;
>>> +		I915_WRITE(ICL_PORT_TX_DW5_AUX(port), tmp);
>>> +	}
>>> +}
>>> +
>>>   static void gen11_dsi_enable_port_and_phy(struct intel_encoder *encoder)
>>>   {
>>>   	/* step 4a: power up all lanes of the DDI used by DSI */
>>> @@ -147,6 +258,9 @@ static void gen11_dsi_enable_port_and_phy(struct intel_encoder *encoder)
>>>   
>>>   	/* step 4b: configure lane sequencing of the Combo-PHY transmitters */
>>>   	gen11_dsi_config_phy_lanes_sequence(encoder);
>>> +
>>> +	/* step 4c: configure voltage swing and skew */
>>> +	gen11_dsi_voltage_swing_program_seq(encoder);
>>>   }
>>>   
>>>   static void __attribute__((unused))
>>
>

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-09-11 18:16 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-10  9:40 [PATCH v5 00/13] ICELAKE DSI DRIVER Madhav Chauhan
2018-07-10  9:40 ` [PATCH v5 01/13] drm/i915/icl: Configure lane sequencing of combo phy transmitter Madhav Chauhan
2018-07-19 16:11   ` Ville Syrjälä
2018-07-19 18:35     ` Chauhan, Madhav
2018-07-27 11:57       ` Chauhan, Madhav
2018-09-11 17:46         ` Jani Nikula
2018-09-12  6:32           ` Madhav Chauhan
2018-09-10 12:20   ` Lisovskiy, Stanislav
2018-09-10 15:27     ` Madhav Chauhan
2018-09-11  8:08       ` Lisovskiy, Stanislav
2018-07-10  9:40 ` [PATCH v5 02/13] drm/i915/icl: DSI vswing programming sequence Madhav Chauhan
2018-09-06 14:01   ` [v5, " Kulkarni, Vandita
2018-09-10  7:43     ` Madhav Chauhan
2018-09-11 18:16       ` Jani Nikula [this message]
2018-09-12  6:34         ` Madhav Chauhan
2018-09-11 18:50   ` [PATCH v5 " Jani Nikula
2018-09-12  9:03     ` Madhav Chauhan
2018-09-12  9:10       ` Jani Nikula
2018-07-10  9:40 ` [PATCH v5 03/13] drm/i915/icl: Enable DDI Buffer Madhav Chauhan
2018-09-11 18:54   ` Jani Nikula
2018-09-12  9:06     ` Madhav Chauhan
2018-09-12  9:10       ` Jani Nikula
2018-07-10  9:40 ` [PATCH v5 04/13] drm/i915/icl: Define T_INIT_MASTER registers Madhav Chauhan
2018-09-11 19:18   ` Jani Nikula
2018-07-10  9:40 ` [PATCH v5 05/13] drm/i915/icl: Program " Madhav Chauhan
2018-09-11 19:17   ` Jani Nikula
2018-07-10  9:40 ` [PATCH v5 06/13] drm/i915/icl: Define data/clock lanes dphy timing registers Madhav Chauhan
2018-09-11 19:14   ` Jani Nikula
2018-09-12  9:11     ` Madhav Chauhan
2018-07-10  9:40 ` [PATCH v5 07/13] drm/i915/icl: Program DSI clock and data lane timing params Madhav Chauhan
2018-07-19 16:17   ` Ville Syrjälä
2018-07-10  9:40 ` [PATCH v5 08/13] drm/i915/icl: Define TA_TIMING_PARAM registers Madhav Chauhan
2018-09-11 19:23   ` Jani Nikula
2018-09-12  9:13     ` Madhav Chauhan
2018-07-10  9:40 ` [PATCH v5 09/13] drm/i915/icl: Program " Madhav Chauhan
2018-07-19 16:21   ` Ville Syrjälä
2018-07-20  8:08     ` Chauhan, Madhav
2018-09-11 19:26       ` Jani Nikula
2018-09-12  9:25         ` Madhav Chauhan
2018-09-12  9:39           ` Jani Nikula
2018-07-10  9:40 ` [PATCH v5 10/13] drm/i915/icl: Get DSI transcoder for a given port Madhav Chauhan
2018-07-10  9:40 ` [PATCH v5 11/13] drm/i915/icl: Add macros for MMIO of DSI transcoder registers Madhav Chauhan
2018-07-19 16:22   ` Ville Syrjälä
2018-07-20  8:55     ` Chauhan, Madhav
2018-09-12  9:36     ` Madhav Chauhan
2018-09-12 18:00       ` Ville Syrjälä
2018-09-14  6:12         ` Madhav Chauhan
2018-09-14 12:25           ` Ville Syrjälä
2018-09-14 13:06             ` Madhav Chauhan
2018-09-14 13:27               ` Madhav Chauhan
2018-09-14 13:41                 ` Ville Syrjälä
2018-07-10  9:40 ` [PATCH v5 12/13] drm/i915/icl: Define TRANS_DSI_FUNC_CONF register Madhav Chauhan
2018-09-11 19:30   ` Jani Nikula
2018-09-12  9:35     ` Madhav Chauhan
2018-09-12  9:47       ` Jani Nikula
2018-07-10  9:40 ` [PATCH v5 13/13] drm/i915/icl: Configure DSI transcoders Madhav Chauhan
2018-07-10 10:46 ` ✗ Fi.CI.CHECKPATCH: warning for ICELAKE DSI DRIVER (rev5) Patchwork
2018-07-10 10:51 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-07-10 11:04 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-10 16:28 ` ✓ Fi.CI.IGT: " Patchwork
2018-09-11 19:35 ` [PATCH v5 00/13] ICELAKE DSI DRIVER Jani Nikula
2018-09-12  6:16   ` Madhav Chauhan
2018-09-12  7:31     ` Jani Nikula

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=87efdzew7d.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=madhav.chauhan@intel.com \
    --cc=paulo.r.zanoni@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=vandita.kulkarni@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.