All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: dri-devel@lists.freedesktop.org
Cc: Marek Vasut <marex@denx.de>, Robert Foss <robert.foss@linaro.org>,
	Maxime Ripard <maxime@cerno.tech>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Sam Ravnborg <sam@ravnborg.org>,
	Jagan Teki <jagan@amarulasolutions.com>
Subject: [PATCH v5 03/11] drm: bridge: icn6211: Add HS/VS/DE polarity handling
Date: Fri, 18 Mar 2022 19:47:47 +0100	[thread overview]
Message-ID: <20220318184755.113152-4-marex@denx.de> (raw)
In-Reply-To: <20220318184755.113152-1-marex@denx.de>

The driver currently hard-codes HS/VS polarity to active-low and DE to
active-high, which is not correct for a lot of supported DPI panels.
Add the missing mode flag handling for HS/VS/DE polarity.

Acked-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
To: dri-devel@lists.freedesktop.org
---
V2: Rebase on next-20220214
V3: No change
V4: Add AB from Maxime
V5: No change
---
 drivers/gpu/drm/bridge/chipone-icn6211.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/chipone-icn6211.c b/drivers/gpu/drm/bridge/chipone-icn6211.c
index c871a90c0b8f4..30db8d1783cef 100644
--- a/drivers/gpu/drm/bridge/chipone-icn6211.c
+++ b/drivers/gpu/drm/bridge/chipone-icn6211.c
@@ -165,8 +165,16 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
 				  struct drm_bridge_state *old_bridge_state)
 {
 	struct chipone *icn = bridge_to_chipone(bridge);
+	struct drm_atomic_state *state = old_bridge_state->base.state;
 	struct drm_display_mode *mode = &icn->mode;
+	const struct drm_bridge_state *bridge_state;
 	u16 hfp, hbp, hsync;
+	u32 bus_flags;
+	u8 pol;
+
+	/* Get the DPI flags from the bridge state. */
+	bridge_state = drm_atomic_get_new_bridge_state(state, bridge);
+	bus_flags = bridge_state->output_bus_cfg.flags;
 
 	ICN6211_DSI(icn, MIPI_CFG_PW, MIPI_CFG_PW_CONFIG_DSI);
 
@@ -206,7 +214,13 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,
 	ICN6211_DSI(icn, HFP_MIN, hfp & 0xff);
 	ICN6211_DSI(icn, MIPI_PD_CK_LANE, 0xa0);
 	ICN6211_DSI(icn, PLL_CTRL(12), 0xff);
-	ICN6211_DSI(icn, BIST_POL, BIST_POL_DE_POL);
+
+	/* DPI HS/VS/DE polarity */
+	pol = ((mode->flags & DRM_MODE_FLAG_PHSYNC) ? BIST_POL_HSYNC_POL : 0) |
+	      ((mode->flags & DRM_MODE_FLAG_PVSYNC) ? BIST_POL_VSYNC_POL : 0) |
+	      ((bus_flags & DRM_BUS_FLAG_DE_HIGH) ? BIST_POL_DE_POL : 0);
+	ICN6211_DSI(icn, BIST_POL, pol);
+
 	ICN6211_DSI(icn, PLL_CTRL(6), PLL_CTRL_6_MIPI_CLK);
 	ICN6211_DSI(icn, PLL_REF_DIV, 0x71);
 	ICN6211_DSI(icn, PLL_INT(0), 0x2b);
-- 
2.35.1


  parent reply	other threads:[~2022-03-18 18:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 18:47 [PATCH v5 00/11] drm: bridge: icn6211: Fix hard-coded panel settings and add I2C support Marek Vasut
2022-03-18 18:47 ` [PATCH v5 01/11] drm: bridge: icn6211: Fix register layout Marek Vasut
2022-03-18 18:47 ` [PATCH v5 02/11] drm: bridge: icn6211: Fix HFP_HSW_HBP_HI and HFP_MIN handling Marek Vasut
2022-03-18 18:47 ` Marek Vasut [this message]
2022-03-18 18:47 ` [PATCH v5 04/11] drm: bridge: icn6211: Add generic DSI-to-DPI PLL configuration Marek Vasut
2022-03-18 18:47 ` [PATCH v5 05/11] drm: bridge: icn6211: Use DSI burst mode without EoT and with LP command mode Marek Vasut
2022-03-18 18:47 ` [PATCH v5 06/11] drm: bridge: icn6211: Disable DPI color swap Marek Vasut
2022-03-18 18:47 ` [PATCH v5 07/11] drm: bridge: icn6211: Set SYS_CTRL_1 to value used in examples Marek Vasut
2022-03-18 18:47 ` [PATCH v5 08/11] drm: bridge: icn6211: Implement atomic_get_input_bus_fmts Marek Vasut
2022-03-18 18:47 ` [PATCH v5 09/11] drm: bridge: icn6211: Add I2C configuration support Marek Vasut
2022-03-23 15:35   ` Maxime Ripard
2022-03-18 18:47 ` [PATCH v5 10/11] drm: bridge: icn6211: Rework ICN6211_DSI to chipone_writeb() Marek Vasut
2022-03-18 18:47 ` [PATCH v5 11/11] drm: bridge: icn6211: Read and validate chip IDs before configuration Marek Vasut
2022-03-31 12:02 ` [PATCH v5 00/11] drm: bridge: icn6211: Fix hard-coded panel settings and add I2C support Robert Foss
2022-03-31 13:41   ` Marek Vasut
2022-03-31 14:48     ` Robert Foss

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=20220318184755.113152-4-marex@denx.de \
    --to=marex@denx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@amarulasolutions.com \
    --cc=maxime@cerno.tech \
    --cc=robert.foss@linaro.org \
    --cc=sam@ravnborg.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 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.