Devicetree
 help / color / mirror / Atom feed
From: Mikko Perttunen <mperttunen@nvidia.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Thierry Reding <thierry.reding@kernel.org>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	Svyatoslav Ryhel <clamor95@gmail.com>,
	devicetree@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
	Svyatoslav Ryhel <clamor95@gmail.com>
Subject: Re: [PATCH v8 06/12] drm/tegra: dc: Add elements required by Tegra MIPI DBI
Date: Fri, 27 Nov 2026 13:56:37 +0900	[thread overview]
Message-ID: <CQmBXmddTJ6v1iTnbDfQLA@nvidia.com> (raw)
In-Reply-To: <20261122081820.53199-7-clamor95@gmail.com>

On Sunday, November 22, 2026 5:18 PM Svyatoslav Ryhel wrote:
> Add DC register definitions with additional fields in preparation for
> adding the 8-bit CPU interface (MIPI DBI).

Maybe also mention that some whitespace cleanup has been done.

> 
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  drivers/gpu/drm/tegra/dc.h | 194 ++++++++++++++++++++++++++++++++++---
>  1 file changed, 183 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/dc.h b/drivers/gpu/drm/tegra/dc.h
> index 0cb0515968b35..e8913c5530a2d 100644
> --- a/drivers/gpu/drm/tegra/dc.h
> +++ b/drivers/gpu/drm/tegra/dc.h
> @@ -272,14 +272,150 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc);
>  #define  DC_COM_CRC_CONTROL_WAIT (1 << 1)
>  #define  DC_COM_CRC_CONTROL_ENABLE (1 << 0)
>  #define DC_COM_CRC_CHECKSUM			0x301
> -#define DC_COM_PIN_OUTPUT_ENABLE(x) (0x302 + (x))
> -#define DC_COM_PIN_OUTPUT_POLARITY(x) (0x306 + (x))
> -#define LVS_OUTPUT_POLARITY_LOW (1 << 28)
> -#define LHS_OUTPUT_POLARITY_LOW (1 << 30)
> -#define DC_COM_PIN_OUTPUT_DATA(x) (0x30a + (x))
> -#define DC_COM_PIN_INPUT_ENABLE(x) (0x30e + (x))
> -#define DC_COM_PIN_INPUT_DATA(x) (0x312 + (x))
> -#define DC_COM_PIN_OUTPUT_SELECT(x) (0x314 + (x))
> +
> +#define DC_COM_PIN_OUTPUT_ENABLE(x)		(0x302 + (x))
> +#define DC_COM_PIN_OUTPUT_POLARITY(x)		(0x306 + (x))
> +#define LVS_OUTPUT_POLARITY_LOW			BIT(28)
> +#define LHS_OUTPUT_POLARITY_LOW			BIT(30)
> +#define DC_COM_PIN_OUTPUT_DATA(x)		(0x30a + (x))
> +/* Pin unmask is 1 bit above position of the pin in the OUTPUT_DATA register */
> +#define PIN_UNMASK(x)				BIT((x) + 1)
> +#define DC_COM_PIN_INPUT_ENABLE(x)		(0x30e + (x))
> +
> +/*
> + * The definitions below describe pin positions in the DC_COM_PIN_OUTPUT_ENABLE(x),
> + * DC_COM_PIN_OUTPUT_POLARITY(x), DC_COM_PIN_OUTPUT_DATA(x), and
> + * DC_COM_PIN_INPUT_ENABLE(x) registers. The comment before each group indicates
> + * the index of the register (the x value).
> + */
> +
> +/* 0 */
> +#define PIN_LD0					0
> +#define PIN_LD1					2
> +#define PIN_LD2					4
> +#define PIN_LD3					6
> +#define PIN_LD4					8
> +#define PIN_LD5					10
> +#define PIN_LD6					12
> +#define PIN_LD7					14
> +#define PIN_LD8					16
> +#define PIN_LD9					18
> +#define PIN_LD10				20
> +#define PIN_LD11				22
> +#define PIN_LD12				24
> +#define PIN_LD13				26
> +#define PIN_LD14				28
> +#define PIN_LD15				30
> +
> +/* 1 */
> +#define PIN_LD16				0
> +#define PIN_LD17				2
> +#define PIN_LPW0				16
> +#define PIN_LPW1				18
> +#define PIN_LPW2				20
> +#define PIN_LSC0				24
> +#define PIN_LSC1				26
> +#define PIN_LVS					28
> +#define PIN_LHS					30
> +
> +/* 2 */
> +#define PIN_LHP0				0
> +#define PIN_LHP1				2
> +#define PIN_LHP2				4
> +#define PIN_LVP0				8
> +#define PIN_LVP1				10
> +#define PIN_LM0					16
> +#define PIN_LM1					18
> +#define PIN_LDI					20
> +#define PIN_LPP					22
> +
> +/* 3 */
> +#define PIN_LSCK				0
> +#define PIN_LSDA				2
> +#define PIN_LCSN				4
> +#define PIN_LDC					6
> +#define PIN_LSPI				8
> +#define PIN_LSDI				10
> +
> +#define DC_COM_PIN_INPUT_DATA(x)		(0x312 + (x))
> +
> +/*
> + * DC_COM_PIN_OUTPUT_SELECT(x) is a set of 7 registers that allow selecting
> + * one of 7 functions for each pin using 3 bits. Clearing all bits sets
> + * the pin to its primary function, while setting them to 1 configures it
> + * as a GPIO output. Other functions are unique to each pin. For details,
> + * check "23.7.17 DC_COM_PIN_OUTPUT_SELECT0_0" in the Tegra30 TRM.
> + */
> +#define DC_COM_PIN_OUTPUT_SELECT(x)		(0x314 + (x))
> +#define PIN_OUTPUT_SELECT_MASK(x)		(0x7 << (x))
> +#define PIN_OUTPUT_SELECT_PRIM(x)		(0 << (x))
> +#define PIN_OUTPUT_SELECT_OUT(x)		(1 << (x))
> +#define PIN_OUTPUT_SELECT_F2(x)			(2 << (x))
> +#define PIN_OUTPUT_SELECT_F3(x)			(3 << (x))
> +#define PIN_OUTPUT_SELECT_F4(x)			(4 << (x))
> +#define PIN_OUTPUT_SELECT_F5(x)			(5 << (x))
> +#define PIN_OUTPUT_SELECT_F6(x)			(6 << (x))
> +#define PIN_OUTPUT_SELECT_F7(x)			(7 << (x))
> +
> +/*
> + * The definitions below describe pin offset in the DC_COM_PIN_OUTPUT_SELECT(x)
> + * registers. The comment before each group indicates the index of the register
> + * (the x value).
> + */
> +
> +/* 0 */
> +#define PIN_OUTPUT_SELECT_LD0			0
> +#define PIN_OUTPUT_SELECT_LD1			4
> +#define PIN_OUTPUT_SELECT_LD2			8
> +#define PIN_OUTPUT_SELECT_LD3			12
> +#define PIN_OUTPUT_SELECT_LD4			16
> +#define PIN_OUTPUT_SELECT_LD5			20
> +#define PIN_OUTPUT_SELECT_LD6			24
> +#define PIN_OUTPUT_SELECT_LD7			28
> +
> +/* 1 */
> +#define PIN_OUTPUT_SELECT_LD8			0
> +#define PIN_OUTPUT_SELECT_LD9			4
> +#define PIN_OUTPUT_SELECT_LD10			8
> +#define PIN_OUTPUT_SELECT_LD11			12
> +#define PIN_OUTPUT_SELECT_LD12			16
> +#define PIN_OUTPUT_SELECT_LD13			20
> +#define PIN_OUTPUT_SELECT_LD14			24
> +#define PIN_OUTPUT_SELECT_LD15			28
> +
> +/* 2 */
> +#define PIN_OUTPUT_SELECT_LD16			0
> +#define PIN_OUTPUT_SELECT_LD17			4
> +
> +/* 3 */
> +#define PIN_OUTPUT_SELECT_LPW0			0
> +#define PIN_OUTPUT_SELECT_LPW1			4
> +#define PIN_OUTPUT_SELECT_LPW2			8
> +#define PIN_OUTPUT_SELECT_LSC0			16
> +#define PIN_OUTPUT_SELECT_LSC1			20
> +#define PIN_OUTPUT_SELECT_LVS			24
> +#define PIN_OUTPUT_SELECT_LHS			28
> +
> +/* 4 */
> +#define PIN_OUTPUT_SELECT_LHP0			0
> +#define PIN_OUTPUT_SELECT_LHP1			4
> +#define PIN_OUTPUT_SELECT_LHP2			8
> +#define PIN_OUTPUT_SELECT_LVP0			16
> +#define PIN_OUTPUT_SELECT_LVP1			20
> +
> +/* 5 */
> +#define PIN_OUTPUT_SELECT_LM0			0
> +#define PIN_OUTPUT_SELECT_LM1			4
> +#define PIN_OUTPUT_SELECT_LDI			8
> +#define PIN_OUTPUT_SELECT_LPP			12
> +
> +/* 6 */
> +#define PIN_OUTPUT_SELECT_LSCK			0
> +#define PIN_OUTPUT_SELECT_LSDA			4
> +#define PIN_OUTPUT_SELECT_LCSN			8
> +#define PIN_OUTPUT_SELECT_LDC			12
> +#define PIN_OUTPUT_SELECT_LSPI			16
> +#define PIN_OUTPUT_SELECT_LSDI			20

It becomes apparent here that the PIN_* and PIN_OUTPUT_SELECT_* are kind 
of redundant as the pins are in the same order, the stride (and thus 
register indexing) is just different. Hence, I think it would be cleaner 
to have ..

#define PIN_LD0		0
#define PIN_LD1		1
...

and then

#define PIN_REGISTER_INDEX(pin)		((pin) / 16)
#define PIN_SHIFT(pin)			(((pin) % 16) * 2)

#define PIN_SELECT_REGISTER_INDEX(pin)	((pin) / 8)
#define PIN_SELECT_SHIFT(pin)		(((pin) % 8) * 4)

This will also simplify the tegra_dbi_idx tables since they can just 
store the pin index, and the register index (and shift) can be 
calculated based on that.

>  
>  #define DC_COM_PIN_MISC_CONTROL			0x31b
>  #define DC_COM_PIN_PM0_CONTROL			0x31c
> @@ -303,9 +439,15 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc);
>  #define  UNDERFLOW_REPORT_ENABLE (1 << 0)
>  
>  #define DC_DISP_DISP_SIGNAL_OPTIONS0		0x400
> -#define H_PULSE0_ENABLE (1 <<  8)
> -#define H_PULSE1_ENABLE (1 << 10)
> -#define H_PULSE2_ENABLE (1 << 12)
> +#define H_PULSE0_ENABLE				BIT(8)
> +#define H_PULSE1_ENABLE				BIT(10)
> +#define H_PULSE2_ENABLE				BIT(12)
> +#define V_PULSE0_ENABLE				BIT(16)
> +#define V_PULSE1_ENABLE				BIT(18)
> +#define V_PULSE2_ENABLE				BIT(19)
> +#define V_PULSE3_ENABLE				BIT(20)
> +#define M0_ENABLE				BIT(24)
> +#define M1_ENABLE				BIT(26)
>  
>  #define DC_DISP_DISP_SIGNAL_OPTIONS1		0x401
>  
> @@ -456,6 +598,22 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc);
>  #define DC_DISP_SHIFT_CLOCK_OPTIONS		0x431
>  #define  SC1_H_QUALIFIER_NONE	(1 << 16)
>  #define  SC0_H_QUALIFIER_NONE	(1 <<  0)
> +#define  SC0_H_QUALIFIER(x)			(((x) & 0x7) <<  0)
> +#define  SC1_H_QUALIFIER(x)			(((x) & 0x7) << 16)
> +#define  SC_H_QUALIFIER_DISABLE			0
> +#define  SC_H_QUALIFIER_NONE			1
> +#define  SC_H_QUALIFIER_HACTIVE			2
> +#define  SC_H_QUALIFIER_EXT_HACTIVE		3
> +#define  SC_H_QUALIFIER_HPULSE			4
> +#define  SC_H_QUALIFIER_EXT_HPULSE		5
> +#define  SC0_V_QUALIFIER(x)			(((x) & 0x7) <<  3)
> +#define  SC1_V_QUALIFIER(x)			(((x) & 0x7) <<  19)
> +#define  SC_V_QUALIFIER_NONE			0
> +#define  SC_V_QUALIFIER_RSVD			1
> +#define  SC_V_QUALIFIER_VACTIVE			2
> +#define  SC_V_QUALIFIER_EXT_VACTIVE		3
> +#define  SC_V_QUALIFIER_VPULSE			4
> +#define  SC_V_QUALIFIER_EXT_VPULSE		5
>  
>  #define DC_DISP_DATA_ENABLE_OPTIONS		0x432
>  #define DE_SELECT_ACTIVE_BLANK  (0 << 0)
> @@ -493,6 +651,20 @@ int tegra_dc_rgb_exit(struct tegra_dc *dc);
>  #define DC_DISP_CURSOR_POSITION_NS		0x441
>  
>  #define DC_DISP_INIT_SEQ_CONTROL		0x442
> +#define SEND_INIT_SEQUENCE			BIT(0)
> +#define INIT_SEQUENCE_MODE_SPI			BIT(1)
> +#define INIT_SEQUENCE_MODE_PLCD			0
> +#define INIT_SEQ_DC_SIGNAL_SHIFT		4
> +#define INIT_SEQ_DC_SIGNAL_MASK			(0x7 << INIT_SEQ_DC_SIGNAL_SHIFT)
> +#define NO_DC_SIGNAL				0
> +#define DC_SIGNAL_VSYNC				1
> +#define DC_SIGNAL_VPULSE0			2
> +#define DC_SIGNAL_VPULSE1			3
> +#define DC_SIGNAL_VPULSE2			4
> +#define DC_SIGNAL_VPULSE3			5
> +#define INIT_SEQ_DC_CONTROL_SHIFT		7
> +#define FRAME_INIT_SEQ_CYCLES_SHIFT		8
> +
>  #define DC_DISP_SPI_INIT_SEQ_DATA_A		0x443
>  #define DC_DISP_SPI_INIT_SEQ_DATA_B		0x444
>  #define DC_DISP_SPI_INIT_SEQ_DATA_C		0x445
> -- 
> 2.53.0
> 
> 





  reply	other threads:[~2026-11-27  4:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  8:18 [PATCH v8 00/12] drm/tegra: Add support for Tegra20/Tegra30 8-bit CPU interface Svyatoslav Ryhel
2026-11-22  8:18 ` [PATCH v8 01/12] drm: Add MIPI DBI bus support for MIPI DBI Type A and B Svyatoslav Ryhel
2026-11-27  4:16   ` Mikko Perttunen
2026-11-22  8:18 ` [PATCH v8 02/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-27  4:23   ` Mikko Perttunen
2026-11-22  8:18 ` [PATCH v8 03/12] drm/panel: panel-hitachi-tx10d07vm0baa: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-27  4:40   ` Mikko Perttunen
2026-11-22  8:18 ` [PATCH v8 04/12] drm/panel: panel-lg-lh400wv3: Convert to use MIPI DBI bus Svyatoslav Ryhel
2026-11-22  8:18 ` [PATCH v8 05/12] drm/panel: panel-lg-lh400wv3: Convert to mipi_dbi_write_seq_multi() Svyatoslav Ryhel
2026-11-27  4:40   ` Mikko Perttunen
2026-11-22  8:18 ` [PATCH v8 06/12] drm/tegra: dc: Add elements required by Tegra MIPI DBI Svyatoslav Ryhel
2026-11-27  4:56   ` Mikko Perttunen [this message]
2026-11-22  8:18 ` [PATCH v8 07/12] dt-bindings: display: tegra: Document Tegra20 DSI port Svyatoslav Ryhel
2026-11-22  8:18 ` [PATCH v8 08/12] drm/tegra: output: Make panel parsing configurable Svyatoslav Ryhel
2026-11-27  5:01   ` Mikko Perttunen
2026-11-22  8:18 ` [PATCH v8 09/12] drm/tegra: Convert to use atomic versions of drm_encoder_helper_funcs Svyatoslav Ryhel
2026-11-22  8:18 ` [PATCH v8 10/12] drm/tegra: rgb: Parameterize configuration based on bus flags Svyatoslav Ryhel
2026-11-22  8:18 ` [PATCH v8 11/12] dt-bindings: display: tegra: Document 8-bit CPU parallel interface Svyatoslav Ryhel
2026-11-22  8:18 ` [PATCH v8 12/12] drm/tegra: Add support for 8-bit CPU interface Svyatoslav Ryhel
2026-11-22  8:43   ` sashiko-bot

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=CQmBXmddTJ6v1iTnbDfQLA@nvidia.com \
    --to=mperttunen@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=thierry.reding@kernel.org \
    --cc=tzimmermann@suse.de \
    /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