* [PATCH v2 00/13] drm/bridge: lt9611: several fixes and improvements
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
A series of patches to fix mode programming for the Lontium lt9611
DSI-to-HDMI bridge (found e.g. on the Thundercomm RB3/Dragonboard845c
platform).
Changes since v1:
- Fixed the double-DSI check to look for the lt9611->dsi1_node rather
than lt9611->dsi1, modesetting happens before lt9611->dsi1 is set.
- Added full dual-DSI support, properly enabling the 4k modes on RB3.
Dmitry Baryshkov (13):
drm/bridge: lt9611: fix sleep mode setup
drm/bridge: lt9611: fix HPD reenablement
drm/bridge: lt9611: fix polarity programming
drm/bridge: lt9611: fix programming of video modes
drm/bridge: lt9611: fix clock calculation
drm/bridge: lt9611: pass a pointer to the of node
drm/bridge: lt9611: rework the mode_set function
drm/bridge: lt9611: attach to the next bridge
drm/bridge: lt9611: fix sync polarity for DVI output
drm/bridge: lt9611: simplify video timings programming
drm/bridge: lt9611: rework infoframes handling
drm/bridge: lt9611: stop filtering modes via the table
drm/bridge: lt9611: properly program the dual host mode
drivers/gpu/drm/bridge/lontium-lt9611.c | 332 ++++++++++--------------
1 file changed, 133 insertions(+), 199 deletions(-)
--
2.39.0
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 00/13] drm/bridge: lt9611: several fixes and improvements
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
A series of patches to fix mode programming for the Lontium lt9611
DSI-to-HDMI bridge (found e.g. on the Thundercomm RB3/Dragonboard845c
platform).
Changes since v1:
- Fixed the double-DSI check to look for the lt9611->dsi1_node rather
than lt9611->dsi1, modesetting happens before lt9611->dsi1 is set.
- Added full dual-DSI support, properly enabling the 4k modes on RB3.
Dmitry Baryshkov (13):
drm/bridge: lt9611: fix sleep mode setup
drm/bridge: lt9611: fix HPD reenablement
drm/bridge: lt9611: fix polarity programming
drm/bridge: lt9611: fix programming of video modes
drm/bridge: lt9611: fix clock calculation
drm/bridge: lt9611: pass a pointer to the of node
drm/bridge: lt9611: rework the mode_set function
drm/bridge: lt9611: attach to the next bridge
drm/bridge: lt9611: fix sync polarity for DVI output
drm/bridge: lt9611: simplify video timings programming
drm/bridge: lt9611: rework infoframes handling
drm/bridge: lt9611: stop filtering modes via the table
drm/bridge: lt9611: properly program the dual host mode
drivers/gpu/drm/bridge/lontium-lt9611.c | 332 ++++++++++--------------
1 file changed, 133 insertions(+), 199 deletions(-)
--
2.39.0
^ permalink raw reply [flat|nested] 60+ messages in thread
* [PATCH v2 01/13] drm/bridge: lt9611: fix sleep mode setup
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On atomic_post_disable the bridge goes to the low power state. However
the code disables too much of the chip, so the HPD event is not being
detected and delivered to the host. Reduce the power saving in order to
get the HPD event.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 7c0a99173b39..2714184cc53f 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -448,12 +448,11 @@ static void lt9611_sleep_setup(struct lt9611 *lt9611)
{ 0x8023, 0x01 },
{ 0x8157, 0x03 }, /* set addr pin as output */
{ 0x8149, 0x0b },
- { 0x8151, 0x30 }, /* disable IRQ */
+
{ 0x8102, 0x48 }, /* MIPI Rx power down */
{ 0x8123, 0x80 },
{ 0x8130, 0x00 },
- { 0x8100, 0x01 }, /* bandgap power down */
- { 0x8101, 0x00 }, /* system clk power down */
+ { 0x8011, 0x0a },
};
regmap_multi_reg_write(lt9611->regmap,
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 01/13] drm/bridge: lt9611: fix sleep mode setup
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On atomic_post_disable the bridge goes to the low power state. However
the code disables too much of the chip, so the HPD event is not being
detected and delivered to the host. Reduce the power saving in order to
get the HPD event.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 7c0a99173b39..2714184cc53f 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -448,12 +448,11 @@ static void lt9611_sleep_setup(struct lt9611 *lt9611)
{ 0x8023, 0x01 },
{ 0x8157, 0x03 }, /* set addr pin as output */
{ 0x8149, 0x0b },
- { 0x8151, 0x30 }, /* disable IRQ */
+
{ 0x8102, 0x48 }, /* MIPI Rx power down */
{ 0x8123, 0x80 },
{ 0x8130, 0x00 },
- { 0x8100, 0x01 }, /* bandgap power down */
- { 0x8101, 0x00 }, /* system clk power down */
+ { 0x8011, 0x0a },
};
regmap_multi_reg_write(lt9611->regmap,
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 02/13] drm/bridge: lt9611: fix HPD reenablement
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
The driver will reset the bridge in the atomic_pre_enable(). However
this will also drop the HPD interrupt state. Instead of resetting the
bridge, properly wake it up. This fixes the HPD interrupt delivery after
the disable/enable cycle.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 2714184cc53f..58f39b279217 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -856,12 +856,18 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+ static const struct reg_sequence reg_cfg[] = {
+ { 0x8102, 0x12 },
+ { 0x8123, 0x40 },
+ { 0x8130, 0xea },
+ { 0x8011, 0xfa },
+ };
if (!lt9611->sleep)
return;
- lt9611_reset(lt9611);
- regmap_write(lt9611->regmap, 0x80ee, 0x01);
+ regmap_multi_reg_write(lt9611->regmap,
+ reg_cfg, ARRAY_SIZE(reg_cfg));
lt9611->sleep = false;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 02/13] drm/bridge: lt9611: fix HPD reenablement
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
The driver will reset the bridge in the atomic_pre_enable(). However
this will also drop the HPD interrupt state. Instead of resetting the
bridge, properly wake it up. This fixes the HPD interrupt delivery after
the disable/enable cycle.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 2714184cc53f..58f39b279217 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -856,12 +856,18 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+ static const struct reg_sequence reg_cfg[] = {
+ { 0x8102, 0x12 },
+ { 0x8123, 0x40 },
+ { 0x8130, 0xea },
+ { 0x8011, 0xfa },
+ };
if (!lt9611->sleep)
return;
- lt9611_reset(lt9611);
- regmap_write(lt9611->regmap, 0x80ee, 0x01);
+ regmap_multi_reg_write(lt9611->regmap,
+ reg_cfg, ARRAY_SIZE(reg_cfg));
lt9611->sleep = false;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 03/13] drm/bridge: lt9611: fix polarity programming
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
Fix programming of hsync and vsync polarities
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 58f39b279217..deb503ca956a 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -207,7 +207,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
/* stage 2 */
{ 0x834a, 0x40 },
- { 0x831d, 0x10 },
/* MK limit */
{ 0x832d, 0x38 },
@@ -222,11 +221,19 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
{ 0x8325, 0x00 },
{ 0x832a, 0x01 },
{ 0x834a, 0x10 },
- { 0x831d, 0x10 },
- { 0x8326, 0x37 },
};
+ u8 pol = 0x10;
- regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
+ if (mode->flags & DRM_MODE_FLAG_NHSYNC)
+ pol |= 0x2;
+ if (mode->flags & DRM_MODE_FLAG_NVSYNC)
+ pol |= 0x1;
+ regmap_write(lt9611->regmap, 0x831d, pol);
+
+ if (mode->hdisplay == 3840)
+ regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
+ else
+ regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
switch (mode->hdisplay) {
case 640:
@@ -236,7 +243,7 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
regmap_write(lt9611->regmap, 0x8326, 0x37);
break;
case 3840:
- regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
+ regmap_write(lt9611->regmap, 0x8326, 0x37);
break;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 03/13] drm/bridge: lt9611: fix polarity programming
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
Fix programming of hsync and vsync polarities
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 58f39b279217..deb503ca956a 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -207,7 +207,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
/* stage 2 */
{ 0x834a, 0x40 },
- { 0x831d, 0x10 },
/* MK limit */
{ 0x832d, 0x38 },
@@ -222,11 +221,19 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
{ 0x8325, 0x00 },
{ 0x832a, 0x01 },
{ 0x834a, 0x10 },
- { 0x831d, 0x10 },
- { 0x8326, 0x37 },
};
+ u8 pol = 0x10;
- regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
+ if (mode->flags & DRM_MODE_FLAG_NHSYNC)
+ pol |= 0x2;
+ if (mode->flags & DRM_MODE_FLAG_NVSYNC)
+ pol |= 0x1;
+ regmap_write(lt9611->regmap, 0x831d, pol);
+
+ if (mode->hdisplay == 3840)
+ regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
+ else
+ regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
switch (mode->hdisplay) {
case 640:
@@ -236,7 +243,7 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
regmap_write(lt9611->regmap, 0x8326, 0x37);
break;
case 3840:
- regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
+ regmap_write(lt9611->regmap, 0x8326, 0x37);
break;
}
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 04/13] drm/bridge: lt9611: fix programming of video modes
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
Program the upper part of the hfront_porch into the proper register.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index deb503ca956a..f377052a45a4 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -187,7 +187,8 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
regmap_write(lt9611->regmap, 0x8319, (u8)(hfront_porch % 256));
- regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256));
+ regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256) |
+ ((hfront_porch / 256) << 4));
regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
}
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 04/13] drm/bridge: lt9611: fix programming of video modes
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
Program the upper part of the hfront_porch into the proper register.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index deb503ca956a..f377052a45a4 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -187,7 +187,8 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
regmap_write(lt9611->regmap, 0x8319, (u8)(hfront_porch % 256));
- regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256));
+ regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256) |
+ ((hfront_porch / 256) << 4));
regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
}
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 05/13] drm/bridge: lt9611: fix clock calculation
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
Instead of having several fixed values for the pcr register, calculate
it before programming. This allows the bridge to support most of the
display modes.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 32 +++++++++++--------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index f377052a45a4..e2799a0df8f8 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -192,8 +192,9 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
}
-static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
+static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int postdiv)
{
+ unsigned int pcr_m = mode->clock * 5 * postdiv / 27000;
const struct reg_sequence reg_cfg[] = {
{ 0x830b, 0x01 },
{ 0x830c, 0x10 },
@@ -236,24 +237,14 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
else
regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
- switch (mode->hdisplay) {
- case 640:
- regmap_write(lt9611->regmap, 0x8326, 0x14);
- break;
- case 1920:
- regmap_write(lt9611->regmap, 0x8326, 0x37);
- break;
- case 3840:
- regmap_write(lt9611->regmap, 0x8326, 0x37);
- break;
- }
+ regmap_write(lt9611->regmap, 0x8326, pcr_m);
/* pcr rst */
regmap_write(lt9611->regmap, 0x8011, 0x5a);
regmap_write(lt9611->regmap, 0x8011, 0xfa);
}
-static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
+static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int *postdiv)
{
unsigned int pclk = mode->clock;
const struct reg_sequence reg_cfg[] = {
@@ -271,12 +262,16 @@ static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode
regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
- if (pclk > 150000)
+ if (pclk > 150000) {
regmap_write(lt9611->regmap, 0x812d, 0x88);
- else if (pclk > 70000)
+ *postdiv = 1;
+ } else if (pclk > 70000) {
regmap_write(lt9611->regmap, 0x812d, 0x99);
- else
+ *postdiv = 2;
+ } else {
regmap_write(lt9611->regmap, 0x812d, 0xaa);
+ *postdiv = 4;
+ }
/*
* first divide pclk by 2 first
@@ -895,14 +890,15 @@ static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
struct hdmi_avi_infoframe avi_frame;
+ unsigned int postdiv;
int ret;
lt9611_bridge_pre_enable(bridge);
lt9611_mipi_input_digital(lt9611, mode);
- lt9611_pll_setup(lt9611, mode);
+ lt9611_pll_setup(lt9611, mode, &postdiv);
lt9611_mipi_video_setup(lt9611, mode);
- lt9611_pcr_setup(lt9611, mode);
+ lt9611_pcr_setup(lt9611, mode, postdiv);
ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
<9611->connector,
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 05/13] drm/bridge: lt9611: fix clock calculation
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
Instead of having several fixed values for the pcr register, calculate
it before programming. This allows the bridge to support most of the
display modes.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 32 +++++++++++--------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index f377052a45a4..e2799a0df8f8 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -192,8 +192,9 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
}
-static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
+static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int postdiv)
{
+ unsigned int pcr_m = mode->clock * 5 * postdiv / 27000;
const struct reg_sequence reg_cfg[] = {
{ 0x830b, 0x01 },
{ 0x830c, 0x10 },
@@ -236,24 +237,14 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
else
regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
- switch (mode->hdisplay) {
- case 640:
- regmap_write(lt9611->regmap, 0x8326, 0x14);
- break;
- case 1920:
- regmap_write(lt9611->regmap, 0x8326, 0x37);
- break;
- case 3840:
- regmap_write(lt9611->regmap, 0x8326, 0x37);
- break;
- }
+ regmap_write(lt9611->regmap, 0x8326, pcr_m);
/* pcr rst */
regmap_write(lt9611->regmap, 0x8011, 0x5a);
regmap_write(lt9611->regmap, 0x8011, 0xfa);
}
-static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
+static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int *postdiv)
{
unsigned int pclk = mode->clock;
const struct reg_sequence reg_cfg[] = {
@@ -271,12 +262,16 @@ static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode
regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
- if (pclk > 150000)
+ if (pclk > 150000) {
regmap_write(lt9611->regmap, 0x812d, 0x88);
- else if (pclk > 70000)
+ *postdiv = 1;
+ } else if (pclk > 70000) {
regmap_write(lt9611->regmap, 0x812d, 0x99);
- else
+ *postdiv = 2;
+ } else {
regmap_write(lt9611->regmap, 0x812d, 0xaa);
+ *postdiv = 4;
+ }
/*
* first divide pclk by 2 first
@@ -895,14 +890,15 @@ static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
struct hdmi_avi_infoframe avi_frame;
+ unsigned int postdiv;
int ret;
lt9611_bridge_pre_enable(bridge);
lt9611_mipi_input_digital(lt9611, mode);
- lt9611_pll_setup(lt9611, mode);
+ lt9611_pll_setup(lt9611, mode, &postdiv);
lt9611_mipi_video_setup(lt9611, mode);
- lt9611_pcr_setup(lt9611, mode);
+ lt9611_pcr_setup(lt9611, mode, postdiv);
ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
<9611->connector,
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 06/13] drm/bridge: lt9611: pass a pointer to the of node
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
Pass a pointer to the OF node while registering lt9611 MIPI device.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index e2799a0df8f8..3b77238ca4af 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -769,7 +769,7 @@ static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
struct device_node *dsi_node)
{
- const struct mipi_dsi_device_info info = { "lt9611", 0, NULL };
+ const struct mipi_dsi_device_info info = { "lt9611", 0, lt9611->dev->of_node};
struct mipi_dsi_device *dsi;
struct mipi_dsi_host *host;
struct device *dev = lt9611->dev;
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 06/13] drm/bridge: lt9611: pass a pointer to the of node
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
Pass a pointer to the OF node while registering lt9611 MIPI device.
Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index e2799a0df8f8..3b77238ca4af 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -769,7 +769,7 @@ static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
struct device_node *dsi_node)
{
- const struct mipi_dsi_device_info info = { "lt9611", 0, NULL };
+ const struct mipi_dsi_device_info info = { "lt9611", 0, lt9611->dev->of_node};
struct mipi_dsi_device *dsi;
struct mipi_dsi_host *host;
struct device *dev = lt9611->dev;
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 07/13] drm/bridge: lt9611: rework the mode_set function
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
The mode_set callback is deprectated for drm_bridges in favour of using
atomic_enable callback. Move corresponding code into the function
lt9611_bridge_atomic_enable() and turn lt9611_bridge_pre_enable() into
the proper atomic_pre_enable callback.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 61 +++++++++++++++----------
1 file changed, 36 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 3b77238ca4af..1b65a573be27 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -713,6 +713,39 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+ struct drm_atomic_state *state = old_bridge_state->base.state;
+ struct drm_connector *connector;
+ struct drm_connector_state *conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_display_mode *mode;
+ struct hdmi_avi_infoframe avi_frame;
+ unsigned int postdiv;
+ int ret;
+
+ connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
+ if (WARN_ON(!connector))
+ return;
+
+ conn_state = drm_atomic_get_new_connector_state(state, connector);
+ if (WARN_ON(!conn_state))
+ return;
+
+ crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
+ if (WARN_ON(!crtc_state))
+ return;
+
+ mode = &crtc_state->adjusted_mode;
+
+ lt9611_mipi_input_digital(lt9611, mode);
+ lt9611_pll_setup(lt9611, mode, &postdiv);
+ lt9611_mipi_video_setup(lt9611, mode);
+ lt9611_pcr_setup(lt9611, mode, postdiv);
+
+ ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
+ connector,
+ mode);
+ if (!ret)
+ lt9611->vic = avi_frame.video_code;
if (lt9611_power_on(lt9611)) {
dev_err(lt9611->dev, "power on failed\n");
@@ -856,7 +889,8 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
return MODE_OK;
}
-static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
+static void lt9611_bridge_atomic_pre_enable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
static const struct reg_sequence reg_cfg[] = {
@@ -884,29 +918,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
lt9611_sleep_setup(lt9611);
}
-static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
- const struct drm_display_mode *mode,
- const struct drm_display_mode *adj_mode)
-{
- struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- struct hdmi_avi_infoframe avi_frame;
- unsigned int postdiv;
- int ret;
-
- lt9611_bridge_pre_enable(bridge);
-
- lt9611_mipi_input_digital(lt9611, mode);
- lt9611_pll_setup(lt9611, mode, &postdiv);
- lt9611_mipi_video_setup(lt9611, mode);
- lt9611_pcr_setup(lt9611, mode, postdiv);
-
- ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
- <9611->connector,
- mode);
- if (!ret)
- lt9611->vic = avi_frame.video_code;
-}
-
static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
{
return __lt9611_detect(bridge_to_lt9611(bridge));
@@ -957,11 +968,11 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
static const struct drm_bridge_funcs lt9611_bridge_funcs = {
.attach = lt9611_bridge_attach,
.mode_valid = lt9611_bridge_mode_valid,
- .mode_set = lt9611_bridge_mode_set,
.detect = lt9611_bridge_detect,
.get_edid = lt9611_bridge_get_edid,
.hpd_enable = lt9611_bridge_hpd_enable,
+ .atomic_pre_enable = lt9611_bridge_atomic_pre_enable,
.atomic_enable = lt9611_bridge_atomic_enable,
.atomic_disable = lt9611_bridge_atomic_disable,
.atomic_post_disable = lt9611_bridge_atomic_post_disable,
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 07/13] drm/bridge: lt9611: rework the mode_set function
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
The mode_set callback is deprectated for drm_bridges in favour of using
atomic_enable callback. Move corresponding code into the function
lt9611_bridge_atomic_enable() and turn lt9611_bridge_pre_enable() into
the proper atomic_pre_enable callback.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 61 +++++++++++++++----------
1 file changed, 36 insertions(+), 25 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 3b77238ca4af..1b65a573be27 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -713,6 +713,39 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
struct drm_bridge_state *old_bridge_state)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
+ struct drm_atomic_state *state = old_bridge_state->base.state;
+ struct drm_connector *connector;
+ struct drm_connector_state *conn_state;
+ struct drm_crtc_state *crtc_state;
+ struct drm_display_mode *mode;
+ struct hdmi_avi_infoframe avi_frame;
+ unsigned int postdiv;
+ int ret;
+
+ connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
+ if (WARN_ON(!connector))
+ return;
+
+ conn_state = drm_atomic_get_new_connector_state(state, connector);
+ if (WARN_ON(!conn_state))
+ return;
+
+ crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
+ if (WARN_ON(!crtc_state))
+ return;
+
+ mode = &crtc_state->adjusted_mode;
+
+ lt9611_mipi_input_digital(lt9611, mode);
+ lt9611_pll_setup(lt9611, mode, &postdiv);
+ lt9611_mipi_video_setup(lt9611, mode);
+ lt9611_pcr_setup(lt9611, mode, postdiv);
+
+ ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
+ connector,
+ mode);
+ if (!ret)
+ lt9611->vic = avi_frame.video_code;
if (lt9611_power_on(lt9611)) {
dev_err(lt9611->dev, "power on failed\n");
@@ -856,7 +889,8 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
return MODE_OK;
}
-static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
+static void lt9611_bridge_atomic_pre_enable(struct drm_bridge *bridge,
+ struct drm_bridge_state *old_bridge_state)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
static const struct reg_sequence reg_cfg[] = {
@@ -884,29 +918,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
lt9611_sleep_setup(lt9611);
}
-static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
- const struct drm_display_mode *mode,
- const struct drm_display_mode *adj_mode)
-{
- struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- struct hdmi_avi_infoframe avi_frame;
- unsigned int postdiv;
- int ret;
-
- lt9611_bridge_pre_enable(bridge);
-
- lt9611_mipi_input_digital(lt9611, mode);
- lt9611_pll_setup(lt9611, mode, &postdiv);
- lt9611_mipi_video_setup(lt9611, mode);
- lt9611_pcr_setup(lt9611, mode, postdiv);
-
- ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
- <9611->connector,
- mode);
- if (!ret)
- lt9611->vic = avi_frame.video_code;
-}
-
static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
{
return __lt9611_detect(bridge_to_lt9611(bridge));
@@ -957,11 +968,11 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
static const struct drm_bridge_funcs lt9611_bridge_funcs = {
.attach = lt9611_bridge_attach,
.mode_valid = lt9611_bridge_mode_valid,
- .mode_set = lt9611_bridge_mode_set,
.detect = lt9611_bridge_detect,
.get_edid = lt9611_bridge_get_edid,
.hpd_enable = lt9611_bridge_hpd_enable,
+ .atomic_pre_enable = lt9611_bridge_atomic_pre_enable,
.atomic_enable = lt9611_bridge_atomic_enable,
.atomic_disable = lt9611_bridge_atomic_disable,
.atomic_post_disable = lt9611_bridge_atomic_post_disable,
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 08/13] drm/bridge: lt9611: attach to the next bridge
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
The bindings require that there is a next bridge after the lt9611. If
nothing else it can be the hdmi-connector (as used on the RB3 platform,
see sdm845-db845c.dts).
Bring in the next bridge into the drm bridges chain and attach to it.
Since lt9611 is not anymore the last bridge in the chain, this also
allows us to drop all the !DRM_BRIDGE_ATTACH_NO_CONNECTOR functionality.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 99 ++-----------------------
1 file changed, 7 insertions(+), 92 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 1b65a573be27..773d7a56f86f 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -19,6 +19,7 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_of.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
@@ -33,7 +34,7 @@
struct lt9611 {
struct device *dev;
struct drm_bridge bridge;
- struct drm_connector connector;
+ struct drm_bridge *next_bridge;
struct regmap *regmap;
@@ -107,11 +108,6 @@ static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
return container_of(bridge, struct lt9611, bridge);
}
-static struct lt9611 *connector_to_lt9611(struct drm_connector *connector)
-{
- return container_of(connector, struct lt9611, connector);
-}
-
static int lt9611_mipi_input_analog(struct lt9611 *lt9611)
{
const struct reg_sequence reg_cfg[] = {
@@ -581,9 +577,9 @@ static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
return NULL;
}
-/* connector funcs */
-static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
+static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
unsigned int reg_val = 0;
int connected = 0;
@@ -596,12 +592,6 @@ static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
return lt9611->status;
}
-static enum drm_connector_status
-lt9611_connector_detect(struct drm_connector *connector, bool force)
-{
- return __lt9611_detect(connector_to_lt9611(connector));
-}
-
static int lt9611_read_edid(struct lt9611 *lt9611)
{
unsigned int temp;
@@ -683,30 +673,6 @@ lt9611_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
return 0;
}
-static int lt9611_connector_get_modes(struct drm_connector *connector)
-{
- struct lt9611 *lt9611 = connector_to_lt9611(connector);
- unsigned int count;
- struct edid *edid;
-
- lt9611_power_on(lt9611);
- edid = drm_do_get_edid(connector, lt9611_get_edid_block, lt9611);
- drm_connector_update_edid_property(connector, edid);
- count = drm_add_edid_modes(connector, edid);
- kfree(edid);
-
- return count;
-}
-
-static enum drm_mode_status
-lt9611_connector_mode_valid(struct drm_connector *connector,
- struct drm_display_mode *mode)
-{
- struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
-
- return lt9611_mode ? MODE_OK : MODE_BAD;
-}
-
/* bridge funcs */
static void
lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
@@ -784,21 +750,6 @@ lt9611_bridge_atomic_disable(struct drm_bridge *bridge,
}
}
-static struct
-drm_connector_helper_funcs lt9611_bridge_connector_helper_funcs = {
- .get_modes = lt9611_connector_get_modes,
- .mode_valid = lt9611_connector_mode_valid,
-};
-
-static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
- .fill_modes = drm_helper_probe_single_connector_modes,
- .detect = lt9611_connector_detect,
- .destroy = drm_connector_cleanup,
- .reset = drm_atomic_helper_connector_reset,
- .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
- .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-};
-
static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
struct device_node *dsi_node)
{
@@ -834,44 +785,13 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
return dsi;
}
-static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt9611)
-{
- int ret;
-
- ret = drm_connector_init(bridge->dev, <9611->connector,
- <9611_bridge_connector_funcs,
- DRM_MODE_CONNECTOR_HDMIA);
- if (ret) {
- DRM_ERROR("Failed to initialize connector with drm\n");
- return ret;
- }
-
- drm_connector_helper_add(<9611->connector,
- <9611_bridge_connector_helper_funcs);
-
- if (!bridge->encoder) {
- DRM_ERROR("Parent encoder object not found");
- return -ENODEV;
- }
-
- drm_connector_attach_encoder(<9611->connector, bridge->encoder);
-
- return 0;
-}
-
static int lt9611_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- int ret;
-
- if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
- ret = lt9611_connector_init(bridge, lt9611);
- if (ret < 0)
- return ret;
- }
- return 0;
+ return drm_bridge_attach(bridge->encoder, lt9611->next_bridge,
+ bridge, flags);
}
static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
@@ -918,11 +838,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
lt9611_sleep_setup(lt9611);
}
-static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
-{
- return __lt9611_detect(bridge_to_lt9611(bridge));
-}
-
static struct edid *lt9611_bridge_get_edid(struct drm_bridge *bridge,
struct drm_connector *connector)
{
@@ -995,7 +910,7 @@ static int lt9611_parse_dt(struct device *dev,
lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
- return 0;
+ return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611->next_bridge);
}
static int lt9611_gpio_init(struct lt9611 *lt9611)
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 08/13] drm/bridge: lt9611: attach to the next bridge
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
The bindings require that there is a next bridge after the lt9611. If
nothing else it can be the hdmi-connector (as used on the RB3 platform,
see sdm845-db845c.dts).
Bring in the next bridge into the drm bridges chain and attach to it.
Since lt9611 is not anymore the last bridge in the chain, this also
allows us to drop all the !DRM_BRIDGE_ATTACH_NO_CONNECTOR functionality.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 99 ++-----------------------
1 file changed, 7 insertions(+), 92 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 1b65a573be27..773d7a56f86f 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -19,6 +19,7 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_of.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
@@ -33,7 +34,7 @@
struct lt9611 {
struct device *dev;
struct drm_bridge bridge;
- struct drm_connector connector;
+ struct drm_bridge *next_bridge;
struct regmap *regmap;
@@ -107,11 +108,6 @@ static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
return container_of(bridge, struct lt9611, bridge);
}
-static struct lt9611 *connector_to_lt9611(struct drm_connector *connector)
-{
- return container_of(connector, struct lt9611, connector);
-}
-
static int lt9611_mipi_input_analog(struct lt9611 *lt9611)
{
const struct reg_sequence reg_cfg[] = {
@@ -581,9 +577,9 @@ static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
return NULL;
}
-/* connector funcs */
-static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
+static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
{
+ struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
unsigned int reg_val = 0;
int connected = 0;
@@ -596,12 +592,6 @@ static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
return lt9611->status;
}
-static enum drm_connector_status
-lt9611_connector_detect(struct drm_connector *connector, bool force)
-{
- return __lt9611_detect(connector_to_lt9611(connector));
-}
-
static int lt9611_read_edid(struct lt9611 *lt9611)
{
unsigned int temp;
@@ -683,30 +673,6 @@ lt9611_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
return 0;
}
-static int lt9611_connector_get_modes(struct drm_connector *connector)
-{
- struct lt9611 *lt9611 = connector_to_lt9611(connector);
- unsigned int count;
- struct edid *edid;
-
- lt9611_power_on(lt9611);
- edid = drm_do_get_edid(connector, lt9611_get_edid_block, lt9611);
- drm_connector_update_edid_property(connector, edid);
- count = drm_add_edid_modes(connector, edid);
- kfree(edid);
-
- return count;
-}
-
-static enum drm_mode_status
-lt9611_connector_mode_valid(struct drm_connector *connector,
- struct drm_display_mode *mode)
-{
- struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
-
- return lt9611_mode ? MODE_OK : MODE_BAD;
-}
-
/* bridge funcs */
static void
lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
@@ -784,21 +750,6 @@ lt9611_bridge_atomic_disable(struct drm_bridge *bridge,
}
}
-static struct
-drm_connector_helper_funcs lt9611_bridge_connector_helper_funcs = {
- .get_modes = lt9611_connector_get_modes,
- .mode_valid = lt9611_connector_mode_valid,
-};
-
-static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
- .fill_modes = drm_helper_probe_single_connector_modes,
- .detect = lt9611_connector_detect,
- .destroy = drm_connector_cleanup,
- .reset = drm_atomic_helper_connector_reset,
- .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
- .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-};
-
static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
struct device_node *dsi_node)
{
@@ -834,44 +785,13 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
return dsi;
}
-static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt9611)
-{
- int ret;
-
- ret = drm_connector_init(bridge->dev, <9611->connector,
- <9611_bridge_connector_funcs,
- DRM_MODE_CONNECTOR_HDMIA);
- if (ret) {
- DRM_ERROR("Failed to initialize connector with drm\n");
- return ret;
- }
-
- drm_connector_helper_add(<9611->connector,
- <9611_bridge_connector_helper_funcs);
-
- if (!bridge->encoder) {
- DRM_ERROR("Parent encoder object not found");
- return -ENODEV;
- }
-
- drm_connector_attach_encoder(<9611->connector, bridge->encoder);
-
- return 0;
-}
-
static int lt9611_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- int ret;
-
- if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
- ret = lt9611_connector_init(bridge, lt9611);
- if (ret < 0)
- return ret;
- }
- return 0;
+ return drm_bridge_attach(bridge->encoder, lt9611->next_bridge,
+ bridge, flags);
}
static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
@@ -918,11 +838,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
lt9611_sleep_setup(lt9611);
}
-static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
-{
- return __lt9611_detect(bridge_to_lt9611(bridge));
-}
-
static struct edid *lt9611_bridge_get_edid(struct drm_bridge *bridge,
struct drm_connector *connector)
{
@@ -995,7 +910,7 @@ static int lt9611_parse_dt(struct device *dev,
lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
- return 0;
+ return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611->next_bridge);
}
static int lt9611_gpio_init(struct lt9611 *lt9611)
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 09/13] drm/bridge: lt9611: fix sync polarity for DVI output
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
Attaching DVI sink to the lt9611 requires different setup. Fix the
register write to make the DVI displays sync onto the correct sync
pulse.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 773d7a56f86f..7f9be74acf0d 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -352,13 +352,16 @@ static int lt9611_video_check(struct lt9611 *lt9611)
return temp;
}
-static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611)
+static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
{
regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
- regmap_write(lt9611->regmap, 0x82d6, 0x8c);
+ if (is_hdmi)
+ regmap_write(lt9611->regmap, 0x82d6, 0x8c);
+ else
+ regmap_write(lt9611->regmap, 0x82d6, 0x0c);
regmap_write(lt9611->regmap, 0x82d7, 0x04);
}
@@ -719,7 +722,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
}
lt9611_mipi_input_analog(lt9611);
- lt9611_hdmi_tx_digital(lt9611);
+ lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
lt9611_hdmi_tx_phy(lt9611);
msleep(500);
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 09/13] drm/bridge: lt9611: fix sync polarity for DVI output
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
Attaching DVI sink to the lt9611 requires different setup. Fix the
register write to make the DVI displays sync onto the correct sync
pulse.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 773d7a56f86f..7f9be74acf0d 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -352,13 +352,16 @@ static int lt9611_video_check(struct lt9611 *lt9611)
return temp;
}
-static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611)
+static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
{
regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
- regmap_write(lt9611->regmap, 0x82d6, 0x8c);
+ if (is_hdmi)
+ regmap_write(lt9611->regmap, 0x82d6, 0x8c);
+ else
+ regmap_write(lt9611->regmap, 0x82d6, 0x0c);
regmap_write(lt9611->regmap, 0x82d7, 0x04);
}
@@ -719,7 +722,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
}
lt9611_mipi_input_analog(lt9611);
- lt9611_hdmi_tx_digital(lt9611);
+ lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
lt9611_hdmi_tx_phy(lt9611);
msleep(500);
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 10/13] drm/bridge: lt9611: simplify video timings programming
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
Inline calculated values to simplify the calculation in
lt9611_mipi_video_setup().
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 7f9be74acf0d..1396ab081f61 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -155,12 +155,12 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
hactive = mode->hdisplay;
hsync_len = mode->hsync_end - mode->hsync_start;
hfront_porch = mode->hsync_start - mode->hdisplay;
- hsync_porch = hsync_len + mode->htotal - mode->hsync_end;
+ hsync_porch = mode->htotal - mode->hsync_start;
vactive = mode->vdisplay;
vsync_len = mode->vsync_end - mode->vsync_start;
vfront_porch = mode->vsync_start - mode->vdisplay;
- vsync_porch = vsync_len + mode->vtotal - mode->vsync_end;
+ vsync_porch = mode->vtotal - mode->vsync_start;
regmap_write(lt9611->regmap, 0x830d, (u8)(v_total / 256));
regmap_write(lt9611->regmap, 0x830e, (u8)(v_total % 256));
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 10/13] drm/bridge: lt9611: simplify video timings programming
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
Inline calculated values to simplify the calculation in
lt9611_mipi_video_setup().
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 7f9be74acf0d..1396ab081f61 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -155,12 +155,12 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
hactive = mode->hdisplay;
hsync_len = mode->hsync_end - mode->hsync_start;
hfront_porch = mode->hsync_start - mode->hdisplay;
- hsync_porch = hsync_len + mode->htotal - mode->hsync_end;
+ hsync_porch = mode->htotal - mode->hsync_start;
vactive = mode->vdisplay;
vsync_len = mode->vsync_end - mode->vsync_start;
vfront_porch = mode->vsync_start - mode->vdisplay;
- vsync_porch = vsync_len + mode->vtotal - mode->vsync_end;
+ vsync_porch = mode->vtotal - mode->vsync_start;
regmap_write(lt9611->regmap, 0x830d, (u8)(v_total / 256));
regmap_write(lt9611->regmap, 0x830e, (u8)(v_total % 256));
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 11/13] drm/bridge: lt9611: rework infoframes handling
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
Rework handling infoframes:
- Write full HDMI AVI infoframe instead of just fixing the VIC value
- Also send the HDMI Vendor Specific infoframe, as recommended by the
HDMI spec.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 57 +++++++++++++++++++------
1 file changed, 44 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 1396ab081f61..82af1f954cc6 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -59,7 +59,6 @@ struct lt9611 {
enum drm_connector_status status;
u8 edid_buf[EDID_SEG_SIZE];
- u32 vic;
};
#define LT9611_PAGE_CONTROL 0xff
@@ -352,12 +351,51 @@ static int lt9611_video_check(struct lt9611 *lt9611)
return temp;
}
-static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
+static void lt9611_hdmi_set_infoframes(struct lt9611 *lt9611,
+ struct drm_connector *connector,
+ struct drm_display_mode *mode)
{
- regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
- regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
- regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
+ union hdmi_infoframe infoframe;
+ ssize_t len;
+ u8 iframes = 0x0a; /* UD1 infoframe */
+ u8 buf[32];
+ int ret;
+ int i;
+
+ ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi,
+ connector,
+ mode);
+ if (ret < 0)
+ goto out;
+
+ len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
+ if (len < 0)
+ goto out;
+
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x8440 + i, buf[i]);
+
+ ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi,
+ connector,
+ mode);
+ if (ret < 0)
+ goto out;
+
+ len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
+ if (len < 0)
+ goto out;
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x8474 + i, buf[i]);
+
+ iframes |= 0x20;
+
+out:
+ regmap_write(lt9611->regmap, 0x843d, iframes); /* UD1 infoframe */
+}
+
+static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
+{
if (is_hdmi)
regmap_write(lt9611->regmap, 0x82d6, 0x8c);
else
@@ -687,9 +725,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
struct drm_connector_state *conn_state;
struct drm_crtc_state *crtc_state;
struct drm_display_mode *mode;
- struct hdmi_avi_infoframe avi_frame;
unsigned int postdiv;
- int ret;
connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
if (WARN_ON(!connector))
@@ -710,18 +746,13 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
lt9611_mipi_video_setup(lt9611, mode);
lt9611_pcr_setup(lt9611, mode, postdiv);
- ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
- connector,
- mode);
- if (!ret)
- lt9611->vic = avi_frame.video_code;
-
if (lt9611_power_on(lt9611)) {
dev_err(lt9611->dev, "power on failed\n");
return;
}
lt9611_mipi_input_analog(lt9611);
+ lt9611_hdmi_set_infoframes(lt9611, connector, mode);
lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
lt9611_hdmi_tx_phy(lt9611);
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 11/13] drm/bridge: lt9611: rework infoframes handling
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
Rework handling infoframes:
- Write full HDMI AVI infoframe instead of just fixing the VIC value
- Also send the HDMI Vendor Specific infoframe, as recommended by the
HDMI spec.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 57 +++++++++++++++++++------
1 file changed, 44 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 1396ab081f61..82af1f954cc6 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -59,7 +59,6 @@ struct lt9611 {
enum drm_connector_status status;
u8 edid_buf[EDID_SEG_SIZE];
- u32 vic;
};
#define LT9611_PAGE_CONTROL 0xff
@@ -352,12 +351,51 @@ static int lt9611_video_check(struct lt9611 *lt9611)
return temp;
}
-static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
+static void lt9611_hdmi_set_infoframes(struct lt9611 *lt9611,
+ struct drm_connector *connector,
+ struct drm_display_mode *mode)
{
- regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
- regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
- regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
+ union hdmi_infoframe infoframe;
+ ssize_t len;
+ u8 iframes = 0x0a; /* UD1 infoframe */
+ u8 buf[32];
+ int ret;
+ int i;
+
+ ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi,
+ connector,
+ mode);
+ if (ret < 0)
+ goto out;
+
+ len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
+ if (len < 0)
+ goto out;
+
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x8440 + i, buf[i]);
+
+ ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi,
+ connector,
+ mode);
+ if (ret < 0)
+ goto out;
+
+ len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
+ if (len < 0)
+ goto out;
+ for (i = 0; i < len; i++)
+ regmap_write(lt9611->regmap, 0x8474 + i, buf[i]);
+
+ iframes |= 0x20;
+
+out:
+ regmap_write(lt9611->regmap, 0x843d, iframes); /* UD1 infoframe */
+}
+
+static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
+{
if (is_hdmi)
regmap_write(lt9611->regmap, 0x82d6, 0x8c);
else
@@ -687,9 +725,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
struct drm_connector_state *conn_state;
struct drm_crtc_state *crtc_state;
struct drm_display_mode *mode;
- struct hdmi_avi_infoframe avi_frame;
unsigned int postdiv;
- int ret;
connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
if (WARN_ON(!connector))
@@ -710,18 +746,13 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
lt9611_mipi_video_setup(lt9611, mode);
lt9611_pcr_setup(lt9611, mode, postdiv);
- ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
- connector,
- mode);
- if (!ret)
- lt9611->vic = avi_frame.video_code;
-
if (lt9611_power_on(lt9611)) {
dev_err(lt9611->dev, "power on failed\n");
return;
}
lt9611_mipi_input_analog(lt9611);
+ lt9611_hdmi_set_infoframes(lt9611, connector, mode);
lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
lt9611_hdmi_tx_phy(lt9611);
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
The lt9611 bridge can support different modes, it makes no sense to list
them in the table. Drop the table and check the number of interfaces
using the fixed value.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
1 file changed, 4 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 82af1f954cc6..df9f015aa3a0 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -84,24 +84,6 @@ static const struct regmap_config lt9611_regmap_config = {
.num_ranges = ARRAY_SIZE(lt9611_ranges),
};
-struct lt9611_mode {
- u16 hdisplay;
- u16 vdisplay;
- u8 vrefresh;
- u8 lanes;
- u8 intfs;
-};
-
-static struct lt9611_mode lt9611_modes[] = {
- { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
- { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
- { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
- { 1920, 1080, 24, 3, 1 },
- { 720, 480, 60, 4, 1 },
- { 720, 576, 50, 2, 1 },
- { 640, 480, 60, 2, 1 },
-};
-
static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
{
return container_of(bridge, struct lt9611, bridge);
@@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611)
return 0;
}
-static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
- if (lt9611_modes[i].hdisplay == mode->hdisplay &&
- lt9611_modes[i].vdisplay == mode->vdisplay &&
- lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
- return <9611_modes[i];
- }
- }
-
- return NULL;
-}
-
static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
@@ -832,12 +799,12 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
const struct drm_display_info *info,
const struct drm_display_mode *mode)
{
- struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- if (!lt9611_mode)
- return MODE_BAD;
- else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
+ if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
+ return MODE_CLOCK_HIGH;
+
+ if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
return MODE_PANEL;
else
return MODE_OK;
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
The lt9611 bridge can support different modes, it makes no sense to list
them in the table. Drop the table and check the number of interfaces
using the fixed value.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
1 file changed, 4 insertions(+), 37 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index 82af1f954cc6..df9f015aa3a0 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -84,24 +84,6 @@ static const struct regmap_config lt9611_regmap_config = {
.num_ranges = ARRAY_SIZE(lt9611_ranges),
};
-struct lt9611_mode {
- u16 hdisplay;
- u16 vdisplay;
- u8 vrefresh;
- u8 lanes;
- u8 intfs;
-};
-
-static struct lt9611_mode lt9611_modes[] = {
- { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
- { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
- { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
- { 1920, 1080, 24, 3, 1 },
- { 720, 480, 60, 4, 1 },
- { 720, 576, 50, 2, 1 },
- { 640, 480, 60, 2, 1 },
-};
-
static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
{
return container_of(bridge, struct lt9611, bridge);
@@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611)
return 0;
}
-static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
- if (lt9611_modes[i].hdisplay == mode->hdisplay &&
- lt9611_modes[i].vdisplay == mode->vdisplay &&
- lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
- return <9611_modes[i];
- }
- }
-
- return NULL;
-}
-
static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
{
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
@@ -832,12 +799,12 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
const struct drm_display_info *info,
const struct drm_display_mode *mode)
{
- struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
- if (!lt9611_mode)
- return MODE_BAD;
- else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
+ if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
+ return MODE_CLOCK_HIGH;
+
+ if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
return MODE_PANEL;
else
return MODE_OK;
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 13/13] drm/bridge: lt9611: properly program the dual host mode
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-08 16:56 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
If the bridge is connected using both DSI ports, the driver should use
both of them all the time. Correct programming sequence to always use
dual-port mode if both dsi0 and dsi1 are connected.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 28 ++++++++++++-------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index df9f015aa3a0..561da6bd2698 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -118,7 +118,7 @@ static int lt9611_mipi_input_digital(struct lt9611 *lt9611,
{ 0x8306, 0x0a },
};
- if (mode->hdisplay == 3840)
+ if (lt9611->dsi1_node)
reg_cfg[1].def = 0x03;
return regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
@@ -191,16 +191,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
{ 0x832d, 0x38 },
{ 0x8331, 0x08 },
};
- const struct reg_sequence reg_cfg2[] = {
- { 0x830b, 0x03 },
- { 0x830c, 0xd0 },
- { 0x8348, 0x03 },
- { 0x8349, 0xe0 },
- { 0x8324, 0x72 },
- { 0x8325, 0x00 },
- { 0x832a, 0x01 },
- { 0x834a, 0x10 },
- };
u8 pol = 0x10;
if (mode->flags & DRM_MODE_FLAG_NHSYNC)
@@ -209,10 +199,18 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
pol |= 0x1;
regmap_write(lt9611->regmap, 0x831d, pol);
- if (mode->hdisplay == 3840)
- regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
- else
- regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
+ regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
+ if (lt9611->dsi1_node) {
+ unsigned int hact = mode->hdisplay;
+
+ hact >>= 2;
+ hact += 0x50;
+ hact = min(hact, 0x3e0U);
+ regmap_write(lt9611->regmap, 0x830b, hact / 256);
+ regmap_write(lt9611->regmap, 0x830c, hact % 256);
+ regmap_write(lt9611->regmap, 0x8348, hact / 256);
+ regmap_write(lt9611->regmap, 0x8349, hact % 256);
+ }
regmap_write(lt9611->regmap, 0x8326, pcr_m);
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* [PATCH v2 13/13] drm/bridge: lt9611: properly program the dual host mode
@ 2023-01-08 16:56 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-08 16:56 UTC (permalink / raw)
To: Vinod Koul, Andrzej Hajda, Neil Armstrong, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
If the bridge is connected using both DSI ports, the driver should use
both of them all the time. Correct programming sequence to always use
dual-port mode if both dsi0 and dsi1 are connected.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/gpu/drm/bridge/lontium-lt9611.c | 28 ++++++++++++-------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
index df9f015aa3a0..561da6bd2698 100644
--- a/drivers/gpu/drm/bridge/lontium-lt9611.c
+++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
@@ -118,7 +118,7 @@ static int lt9611_mipi_input_digital(struct lt9611 *lt9611,
{ 0x8306, 0x0a },
};
- if (mode->hdisplay == 3840)
+ if (lt9611->dsi1_node)
reg_cfg[1].def = 0x03;
return regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
@@ -191,16 +191,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
{ 0x832d, 0x38 },
{ 0x8331, 0x08 },
};
- const struct reg_sequence reg_cfg2[] = {
- { 0x830b, 0x03 },
- { 0x830c, 0xd0 },
- { 0x8348, 0x03 },
- { 0x8349, 0xe0 },
- { 0x8324, 0x72 },
- { 0x8325, 0x00 },
- { 0x832a, 0x01 },
- { 0x834a, 0x10 },
- };
u8 pol = 0x10;
if (mode->flags & DRM_MODE_FLAG_NHSYNC)
@@ -209,10 +199,18 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
pol |= 0x1;
regmap_write(lt9611->regmap, 0x831d, pol);
- if (mode->hdisplay == 3840)
- regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
- else
- regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
+ regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
+ if (lt9611->dsi1_node) {
+ unsigned int hact = mode->hdisplay;
+
+ hact >>= 2;
+ hact += 0x50;
+ hact = min(hact, 0x3e0U);
+ regmap_write(lt9611->regmap, 0x830b, hact / 256);
+ regmap_write(lt9611->regmap, 0x830c, hact % 256);
+ regmap_write(lt9611->regmap, 0x8348, hact / 256);
+ regmap_write(lt9611->regmap, 0x8349, hact % 256);
+ }
regmap_write(lt9611->regmap, 0x8326, pcr_m);
--
2.39.0
^ permalink raw reply related [flat|nested] 60+ messages in thread
* Re: [PATCH v2 07/13] drm/bridge: lt9611: rework the mode_set function
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-11 10:53 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:53 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The mode_set callback is deprectated for drm_bridges in favour of using
> atomic_enable callback. Move corresponding code into the function
> lt9611_bridge_atomic_enable() and turn lt9611_bridge_pre_enable() into
> the proper atomic_pre_enable callback.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 61 +++++++++++++++----------
> 1 file changed, 36 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 3b77238ca4af..1b65a573be27 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -713,6 +713,39 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> struct drm_bridge_state *old_bridge_state)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> + struct drm_atomic_state *state = old_bridge_state->base.state;
> + struct drm_connector *connector;
> + struct drm_connector_state *conn_state;
> + struct drm_crtc_state *crtc_state;
> + struct drm_display_mode *mode;
> + struct hdmi_avi_infoframe avi_frame;
> + unsigned int postdiv;
> + int ret;
> +
> + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
> + if (WARN_ON(!connector))
> + return;
> +
> + conn_state = drm_atomic_get_new_connector_state(state, connector);
> + if (WARN_ON(!conn_state))
> + return;
> +
> + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
> + if (WARN_ON(!crtc_state))
> + return;
> +
> + mode = &crtc_state->adjusted_mode;
> +
> + lt9611_mipi_input_digital(lt9611, mode);
> + lt9611_pll_setup(lt9611, mode, &postdiv);
> + lt9611_mipi_video_setup(lt9611, mode);
> + lt9611_pcr_setup(lt9611, mode, postdiv);
> +
> + ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> + connector,
> + mode);
> + if (!ret)
> + lt9611->vic = avi_frame.video_code;
>
> if (lt9611_power_on(lt9611)) {
> dev_err(lt9611->dev, "power on failed\n");
> @@ -856,7 +889,8 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> return MODE_OK;
> }
>
> -static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
> +static void lt9611_bridge_atomic_pre_enable(struct drm_bridge *bridge,
> + struct drm_bridge_state *old_bridge_state)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> static const struct reg_sequence reg_cfg[] = {
> @@ -884,29 +918,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
> lt9611_sleep_setup(lt9611);
> }
>
> -static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
> - const struct drm_display_mode *mode,
> - const struct drm_display_mode *adj_mode)
> -{
> - struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> - struct hdmi_avi_infoframe avi_frame;
> - unsigned int postdiv;
> - int ret;
> -
> - lt9611_bridge_pre_enable(bridge);
> -
> - lt9611_mipi_input_digital(lt9611, mode);
> - lt9611_pll_setup(lt9611, mode, &postdiv);
> - lt9611_mipi_video_setup(lt9611, mode);
> - lt9611_pcr_setup(lt9611, mode, postdiv);
> -
> - ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> - <9611->connector,
> - mode);
> - if (!ret)
> - lt9611->vic = avi_frame.video_code;
> -}
> -
> static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> {
> return __lt9611_detect(bridge_to_lt9611(bridge));
> @@ -957,11 +968,11 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> static const struct drm_bridge_funcs lt9611_bridge_funcs = {
> .attach = lt9611_bridge_attach,
> .mode_valid = lt9611_bridge_mode_valid,
> - .mode_set = lt9611_bridge_mode_set,
> .detect = lt9611_bridge_detect,
> .get_edid = lt9611_bridge_get_edid,
> .hpd_enable = lt9611_bridge_hpd_enable,
>
> + .atomic_pre_enable = lt9611_bridge_atomic_pre_enable,
> .atomic_enable = lt9611_bridge_atomic_enable,
> .atomic_disable = lt9611_bridge_atomic_disable,
> .atomic_post_disable = lt9611_bridge_atomic_post_disable,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 07/13] drm/bridge: lt9611: rework the mode_set function
@ 2023-01-11 10:53 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:53 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The mode_set callback is deprectated for drm_bridges in favour of using
> atomic_enable callback. Move corresponding code into the function
> lt9611_bridge_atomic_enable() and turn lt9611_bridge_pre_enable() into
> the proper atomic_pre_enable callback.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 61 +++++++++++++++----------
> 1 file changed, 36 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 3b77238ca4af..1b65a573be27 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -713,6 +713,39 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> struct drm_bridge_state *old_bridge_state)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> + struct drm_atomic_state *state = old_bridge_state->base.state;
> + struct drm_connector *connector;
> + struct drm_connector_state *conn_state;
> + struct drm_crtc_state *crtc_state;
> + struct drm_display_mode *mode;
> + struct hdmi_avi_infoframe avi_frame;
> + unsigned int postdiv;
> + int ret;
> +
> + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
> + if (WARN_ON(!connector))
> + return;
> +
> + conn_state = drm_atomic_get_new_connector_state(state, connector);
> + if (WARN_ON(!conn_state))
> + return;
> +
> + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc);
> + if (WARN_ON(!crtc_state))
> + return;
> +
> + mode = &crtc_state->adjusted_mode;
> +
> + lt9611_mipi_input_digital(lt9611, mode);
> + lt9611_pll_setup(lt9611, mode, &postdiv);
> + lt9611_mipi_video_setup(lt9611, mode);
> + lt9611_pcr_setup(lt9611, mode, postdiv);
> +
> + ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> + connector,
> + mode);
> + if (!ret)
> + lt9611->vic = avi_frame.video_code;
>
> if (lt9611_power_on(lt9611)) {
> dev_err(lt9611->dev, "power on failed\n");
> @@ -856,7 +889,8 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> return MODE_OK;
> }
>
> -static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
> +static void lt9611_bridge_atomic_pre_enable(struct drm_bridge *bridge,
> + struct drm_bridge_state *old_bridge_state)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> static const struct reg_sequence reg_cfg[] = {
> @@ -884,29 +918,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
> lt9611_sleep_setup(lt9611);
> }
>
> -static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
> - const struct drm_display_mode *mode,
> - const struct drm_display_mode *adj_mode)
> -{
> - struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> - struct hdmi_avi_infoframe avi_frame;
> - unsigned int postdiv;
> - int ret;
> -
> - lt9611_bridge_pre_enable(bridge);
> -
> - lt9611_mipi_input_digital(lt9611, mode);
> - lt9611_pll_setup(lt9611, mode, &postdiv);
> - lt9611_mipi_video_setup(lt9611, mode);
> - lt9611_pcr_setup(lt9611, mode, postdiv);
> -
> - ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> - <9611->connector,
> - mode);
> - if (!ret)
> - lt9611->vic = avi_frame.video_code;
> -}
> -
> static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> {
> return __lt9611_detect(bridge_to_lt9611(bridge));
> @@ -957,11 +968,11 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> static const struct drm_bridge_funcs lt9611_bridge_funcs = {
> .attach = lt9611_bridge_attach,
> .mode_valid = lt9611_bridge_mode_valid,
> - .mode_set = lt9611_bridge_mode_set,
> .detect = lt9611_bridge_detect,
> .get_edid = lt9611_bridge_get_edid,
> .hpd_enable = lt9611_bridge_hpd_enable,
>
> + .atomic_pre_enable = lt9611_bridge_atomic_pre_enable,
> .atomic_enable = lt9611_bridge_atomic_enable,
> .atomic_disable = lt9611_bridge_atomic_disable,
> .atomic_post_disable = lt9611_bridge_atomic_post_disable,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 08/13] drm/bridge: lt9611: attach to the next bridge
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-11 10:56 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:56 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The bindings require that there is a next bridge after the lt9611. If
> nothing else it can be the hdmi-connector (as used on the RB3 platform,
> see sdm845-db845c.dts).
>
> Bring in the next bridge into the drm bridges chain and attach to it.
>
> Since lt9611 is not anymore the last bridge in the chain, this also
> allows us to drop all the !DRM_BRIDGE_ATTACH_NO_CONNECTOR functionality.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 99 ++-----------------------
> 1 file changed, 7 insertions(+), 92 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 1b65a573be27..773d7a56f86f 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -19,6 +19,7 @@
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_bridge.h>
> #include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_of.h>
> #include <drm/drm_print.h>
> #include <drm/drm_probe_helper.h>
>
> @@ -33,7 +34,7 @@
> struct lt9611 {
> struct device *dev;
> struct drm_bridge bridge;
> - struct drm_connector connector;
> + struct drm_bridge *next_bridge;
>
> struct regmap *regmap;
>
> @@ -107,11 +108,6 @@ static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
> return container_of(bridge, struct lt9611, bridge);
> }
>
> -static struct lt9611 *connector_to_lt9611(struct drm_connector *connector)
> -{
> - return container_of(connector, struct lt9611, connector);
> -}
> -
> static int lt9611_mipi_input_analog(struct lt9611 *lt9611)
> {
> const struct reg_sequence reg_cfg[] = {
> @@ -581,9 +577,9 @@ static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
> return NULL;
> }
>
> -/* connector funcs */
> -static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
> +static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> {
> + struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> unsigned int reg_val = 0;
> int connected = 0;
>
> @@ -596,12 +592,6 @@ static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
> return lt9611->status;
> }
>
> -static enum drm_connector_status
> -lt9611_connector_detect(struct drm_connector *connector, bool force)
> -{
> - return __lt9611_detect(connector_to_lt9611(connector));
> -}
> -
> static int lt9611_read_edid(struct lt9611 *lt9611)
> {
> unsigned int temp;
> @@ -683,30 +673,6 @@ lt9611_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
> return 0;
> }
>
> -static int lt9611_connector_get_modes(struct drm_connector *connector)
> -{
> - struct lt9611 *lt9611 = connector_to_lt9611(connector);
> - unsigned int count;
> - struct edid *edid;
> -
> - lt9611_power_on(lt9611);
> - edid = drm_do_get_edid(connector, lt9611_get_edid_block, lt9611);
> - drm_connector_update_edid_property(connector, edid);
> - count = drm_add_edid_modes(connector, edid);
> - kfree(edid);
> -
> - return count;
> -}
> -
> -static enum drm_mode_status
> -lt9611_connector_mode_valid(struct drm_connector *connector,
> - struct drm_display_mode *mode)
> -{
> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
> -
> - return lt9611_mode ? MODE_OK : MODE_BAD;
> -}
> -
> /* bridge funcs */
> static void
> lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> @@ -784,21 +750,6 @@ lt9611_bridge_atomic_disable(struct drm_bridge *bridge,
> }
> }
>
> -static struct
> -drm_connector_helper_funcs lt9611_bridge_connector_helper_funcs = {
> - .get_modes = lt9611_connector_get_modes,
> - .mode_valid = lt9611_connector_mode_valid,
> -};
> -
> -static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
> - .fill_modes = drm_helper_probe_single_connector_modes,
> - .detect = lt9611_connector_detect,
> - .destroy = drm_connector_cleanup,
> - .reset = drm_atomic_helper_connector_reset,
> - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> -};
> -
> static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
> struct device_node *dsi_node)
> {
> @@ -834,44 +785,13 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
> return dsi;
> }
>
> -static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt9611)
> -{
> - int ret;
> -
> - ret = drm_connector_init(bridge->dev, <9611->connector,
> - <9611_bridge_connector_funcs,
> - DRM_MODE_CONNECTOR_HDMIA);
> - if (ret) {
> - DRM_ERROR("Failed to initialize connector with drm\n");
> - return ret;
> - }
> -
> - drm_connector_helper_add(<9611->connector,
> - <9611_bridge_connector_helper_funcs);
> -
> - if (!bridge->encoder) {
> - DRM_ERROR("Parent encoder object not found");
> - return -ENODEV;
> - }
> -
> - drm_connector_attach_encoder(<9611->connector, bridge->encoder);
> -
> - return 0;
> -}
> -
> static int lt9611_bridge_attach(struct drm_bridge *bridge,
> enum drm_bridge_attach_flags flags)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> - int ret;
> -
> - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
> - ret = lt9611_connector_init(bridge, lt9611);
> - if (ret < 0)
> - return ret;
> - }
>
> - return 0;
> + return drm_bridge_attach(bridge->encoder, lt9611->next_bridge,
> + bridge, flags);
> }
>
> static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> @@ -918,11 +838,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
> lt9611_sleep_setup(lt9611);
> }
>
> -static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> -{
> - return __lt9611_detect(bridge_to_lt9611(bridge));
> -}
> -
> static struct edid *lt9611_bridge_get_edid(struct drm_bridge *bridge,
> struct drm_connector *connector)
> {
> @@ -995,7 +910,7 @@ static int lt9611_parse_dt(struct device *dev,
>
> lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
>
> - return 0;
> + return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611->next_bridge);
> }
>
> static int lt9611_gpio_init(struct lt9611 *lt9611)
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 08/13] drm/bridge: lt9611: attach to the next bridge
@ 2023-01-11 10:56 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:56 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The bindings require that there is a next bridge after the lt9611. If
> nothing else it can be the hdmi-connector (as used on the RB3 platform,
> see sdm845-db845c.dts).
>
> Bring in the next bridge into the drm bridges chain and attach to it.
>
> Since lt9611 is not anymore the last bridge in the chain, this also
> allows us to drop all the !DRM_BRIDGE_ATTACH_NO_CONNECTOR functionality.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 99 ++-----------------------
> 1 file changed, 7 insertions(+), 92 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 1b65a573be27..773d7a56f86f 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -19,6 +19,7 @@
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_bridge.h>
> #include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_of.h>
> #include <drm/drm_print.h>
> #include <drm/drm_probe_helper.h>
>
> @@ -33,7 +34,7 @@
> struct lt9611 {
> struct device *dev;
> struct drm_bridge bridge;
> - struct drm_connector connector;
> + struct drm_bridge *next_bridge;
>
> struct regmap *regmap;
>
> @@ -107,11 +108,6 @@ static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
> return container_of(bridge, struct lt9611, bridge);
> }
>
> -static struct lt9611 *connector_to_lt9611(struct drm_connector *connector)
> -{
> - return container_of(connector, struct lt9611, connector);
> -}
> -
> static int lt9611_mipi_input_analog(struct lt9611 *lt9611)
> {
> const struct reg_sequence reg_cfg[] = {
> @@ -581,9 +577,9 @@ static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
> return NULL;
> }
>
> -/* connector funcs */
> -static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
> +static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> {
> + struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> unsigned int reg_val = 0;
> int connected = 0;
>
> @@ -596,12 +592,6 @@ static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611)
> return lt9611->status;
> }
>
> -static enum drm_connector_status
> -lt9611_connector_detect(struct drm_connector *connector, bool force)
> -{
> - return __lt9611_detect(connector_to_lt9611(connector));
> -}
> -
> static int lt9611_read_edid(struct lt9611 *lt9611)
> {
> unsigned int temp;
> @@ -683,30 +673,6 @@ lt9611_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)
> return 0;
> }
>
> -static int lt9611_connector_get_modes(struct drm_connector *connector)
> -{
> - struct lt9611 *lt9611 = connector_to_lt9611(connector);
> - unsigned int count;
> - struct edid *edid;
> -
> - lt9611_power_on(lt9611);
> - edid = drm_do_get_edid(connector, lt9611_get_edid_block, lt9611);
> - drm_connector_update_edid_property(connector, edid);
> - count = drm_add_edid_modes(connector, edid);
> - kfree(edid);
> -
> - return count;
> -}
> -
> -static enum drm_mode_status
> -lt9611_connector_mode_valid(struct drm_connector *connector,
> - struct drm_display_mode *mode)
> -{
> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
> -
> - return lt9611_mode ? MODE_OK : MODE_BAD;
> -}
> -
> /* bridge funcs */
> static void
> lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> @@ -784,21 +750,6 @@ lt9611_bridge_atomic_disable(struct drm_bridge *bridge,
> }
> }
>
> -static struct
> -drm_connector_helper_funcs lt9611_bridge_connector_helper_funcs = {
> - .get_modes = lt9611_connector_get_modes,
> - .mode_valid = lt9611_connector_mode_valid,
> -};
> -
> -static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
> - .fill_modes = drm_helper_probe_single_connector_modes,
> - .detect = lt9611_connector_detect,
> - .destroy = drm_connector_cleanup,
> - .reset = drm_atomic_helper_connector_reset,
> - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
> - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
> -};
> -
> static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
> struct device_node *dsi_node)
> {
> @@ -834,44 +785,13 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
> return dsi;
> }
>
> -static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt9611)
> -{
> - int ret;
> -
> - ret = drm_connector_init(bridge->dev, <9611->connector,
> - <9611_bridge_connector_funcs,
> - DRM_MODE_CONNECTOR_HDMIA);
> - if (ret) {
> - DRM_ERROR("Failed to initialize connector with drm\n");
> - return ret;
> - }
> -
> - drm_connector_helper_add(<9611->connector,
> - <9611_bridge_connector_helper_funcs);
> -
> - if (!bridge->encoder) {
> - DRM_ERROR("Parent encoder object not found");
> - return -ENODEV;
> - }
> -
> - drm_connector_attach_encoder(<9611->connector, bridge->encoder);
> -
> - return 0;
> -}
> -
> static int lt9611_bridge_attach(struct drm_bridge *bridge,
> enum drm_bridge_attach_flags flags)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> - int ret;
> -
> - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) {
> - ret = lt9611_connector_init(bridge, lt9611);
> - if (ret < 0)
> - return ret;
> - }
>
> - return 0;
> + return drm_bridge_attach(bridge->encoder, lt9611->next_bridge,
> + bridge, flags);
> }
>
> static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> @@ -918,11 +838,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge,
> lt9611_sleep_setup(lt9611);
> }
>
> -static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> -{
> - return __lt9611_detect(bridge_to_lt9611(bridge));
> -}
> -
> static struct edid *lt9611_bridge_get_edid(struct drm_bridge *bridge,
> struct drm_connector *connector)
> {
> @@ -995,7 +910,7 @@ static int lt9611_parse_dt(struct device *dev,
>
> lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode");
>
> - return 0;
> + return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611->next_bridge);
> }
>
> static int lt9611_gpio_init(struct lt9611 *lt9611)
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 10/13] drm/bridge: lt9611: simplify video timings programming
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-11 10:56 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:56 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Inline calculated values to simplify the calculation in
> lt9611_mipi_video_setup().
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 7f9be74acf0d..1396ab081f61 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -155,12 +155,12 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
> hactive = mode->hdisplay;
> hsync_len = mode->hsync_end - mode->hsync_start;
> hfront_porch = mode->hsync_start - mode->hdisplay;
> - hsync_porch = hsync_len + mode->htotal - mode->hsync_end;
> + hsync_porch = mode->htotal - mode->hsync_start;
>
> vactive = mode->vdisplay;
> vsync_len = mode->vsync_end - mode->vsync_start;
> vfront_porch = mode->vsync_start - mode->vdisplay;
> - vsync_porch = vsync_len + mode->vtotal - mode->vsync_end;
> + vsync_porch = mode->vtotal - mode->vsync_start;
>
> regmap_write(lt9611->regmap, 0x830d, (u8)(v_total / 256));
> regmap_write(lt9611->regmap, 0x830e, (u8)(v_total % 256));
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 10/13] drm/bridge: lt9611: simplify video timings programming
@ 2023-01-11 10:56 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:56 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Inline calculated values to simplify the calculation in
> lt9611_mipi_video_setup().
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 7f9be74acf0d..1396ab081f61 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -155,12 +155,12 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
> hactive = mode->hdisplay;
> hsync_len = mode->hsync_end - mode->hsync_start;
> hfront_porch = mode->hsync_start - mode->hdisplay;
> - hsync_porch = hsync_len + mode->htotal - mode->hsync_end;
> + hsync_porch = mode->htotal - mode->hsync_start;
>
> vactive = mode->vdisplay;
> vsync_len = mode->vsync_end - mode->vsync_start;
> vfront_porch = mode->vsync_start - mode->vdisplay;
> - vsync_porch = vsync_len + mode->vtotal - mode->vsync_end;
> + vsync_porch = mode->vtotal - mode->vsync_start;
>
> regmap_write(lt9611->regmap, 0x830d, (u8)(v_total / 256));
> regmap_write(lt9611->regmap, 0x830e, (u8)(v_total % 256));
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-11 10:57 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:57 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The lt9611 bridge can support different modes, it makes no sense to list
> them in the table. Drop the table and check the number of interfaces
> using the fixed value.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
> 1 file changed, 4 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 82af1f954cc6..df9f015aa3a0 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -84,24 +84,6 @@ static const struct regmap_config lt9611_regmap_config = {
> .num_ranges = ARRAY_SIZE(lt9611_ranges),
> };
>
> -struct lt9611_mode {
> - u16 hdisplay;
> - u16 vdisplay;
> - u8 vrefresh;
> - u8 lanes;
> - u8 intfs;
> -};
> -
> -static struct lt9611_mode lt9611_modes[] = {
> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
> - { 1920, 1080, 24, 3, 1 },
> - { 720, 480, 60, 4, 1 },
> - { 720, 576, 50, 2, 1 },
> - { 640, 480, 60, 2, 1 },
> -};
> -
> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
> {
> return container_of(bridge, struct lt9611, bridge);
> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611)
> return 0;
> }
>
> -static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
> -{
> - int i;
> -
> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
> - lt9611_modes[i].vdisplay == mode->vdisplay &&
> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
> - return <9611_modes[i];
> - }
> - }
> -
> - return NULL;
> -}
> -
> static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> @@ -832,12 +799,12 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> const struct drm_display_info *info,
> const struct drm_display_mode *mode)
> {
> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>
> - if (!lt9611_mode)
> - return MODE_BAD;
> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
Isn't 31 a typo ?
> + return MODE_CLOCK_HIGH;
> +
> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
> return MODE_PANEL;
> else
> return MODE_OK;
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
@ 2023-01-11 10:57 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-11 10:57 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The lt9611 bridge can support different modes, it makes no sense to list
> them in the table. Drop the table and check the number of interfaces
> using the fixed value.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
> 1 file changed, 4 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 82af1f954cc6..df9f015aa3a0 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -84,24 +84,6 @@ static const struct regmap_config lt9611_regmap_config = {
> .num_ranges = ARRAY_SIZE(lt9611_ranges),
> };
>
> -struct lt9611_mode {
> - u16 hdisplay;
> - u16 vdisplay;
> - u8 vrefresh;
> - u8 lanes;
> - u8 intfs;
> -};
> -
> -static struct lt9611_mode lt9611_modes[] = {
> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
> - { 1920, 1080, 24, 3, 1 },
> - { 720, 480, 60, 4, 1 },
> - { 720, 576, 50, 2, 1 },
> - { 640, 480, 60, 2, 1 },
> -};
> -
> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
> {
> return container_of(bridge, struct lt9611, bridge);
> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611)
> return 0;
> }
>
> -static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
> -{
> - int i;
> -
> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
> - lt9611_modes[i].vdisplay == mode->vdisplay &&
> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
> - return <9611_modes[i];
> - }
> - }
> -
> - return NULL;
> -}
> -
> static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> @@ -832,12 +799,12 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> const struct drm_display_info *info,
> const struct drm_display_mode *mode)
> {
> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>
> - if (!lt9611_mode)
> - return MODE_BAD;
> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
Isn't 31 a typo ?
> + return MODE_CLOCK_HIGH;
> +
> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
> return MODE_PANEL;
> else
> return MODE_OK;
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
2023-01-11 10:57 ` Neil Armstrong
@ 2023-01-11 15:37 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-11 15:37 UTC (permalink / raw)
To: neil.armstrong, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 11/01/2023 12:57, Neil Armstrong wrote:
> On 08/01/2023 17:56, Dmitry Baryshkov wrote:
>> The lt9611 bridge can support different modes, it makes no sense to list
>> them in the table. Drop the table and check the number of interfaces
>> using the fixed value.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
>> 1 file changed, 4 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c
>> b/drivers/gpu/drm/bridge/lontium-lt9611.c
>> index 82af1f954cc6..df9f015aa3a0 100644
>> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
>> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
>> @@ -84,24 +84,6 @@ static const struct regmap_config
>> lt9611_regmap_config = {
>> .num_ranges = ARRAY_SIZE(lt9611_ranges),
>> };
>> -struct lt9611_mode {
>> - u16 hdisplay;
>> - u16 vdisplay;
>> - u8 vrefresh;
>> - u8 lanes;
>> - u8 intfs;
>> -};
>> -
>> -static struct lt9611_mode lt9611_modes[] = {
>> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
>> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
>> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
>> - { 1920, 1080, 24, 3, 1 },
>> - { 720, 480, 60, 4, 1 },
>> - { 720, 576, 50, 2, 1 },
>> - { 640, 480, 60, 2, 1 },
>> -};
>> -
>> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
>> {
>> return container_of(bridge, struct lt9611, bridge);
>> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611
>> *lt9611)
>> return 0;
>> }
>> -static struct lt9611_mode *lt9611_find_mode(const struct
>> drm_display_mode *mode)
>> -{
>> - int i;
>> -
>> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
>> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
>> - lt9611_modes[i].vdisplay == mode->vdisplay &&
>> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
>> - return <9611_modes[i];
>> - }
>> - }
>> -
>> - return NULL;
>> -}
>> -
>> static enum drm_connector_status lt9611_bridge_detect(struct
>> drm_bridge *bridge)
>> {
>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>> @@ -832,12 +799,12 @@ static enum drm_mode_status
>> lt9611_bridge_mode_valid(struct drm_bridge *bridge,
>> const struct drm_display_info *info,
>> const struct drm_display_mode *mode)
>> {
>> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>> - if (!lt9611_mode)
>> - return MODE_BAD;
>> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
>> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
>
> Isn't 31 a typo ?
Maybe I should change that to drm_mode_vrefresh(mode) > 30. The chip
supports 3840x2160-30, but doesn't promise to support anything above that.
>
>> + return MODE_CLOCK_HIGH;
>> +
>> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
>> return MODE_PANEL;
>> else
>> return MODE_OK;
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
@ 2023-01-11 15:37 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-11 15:37 UTC (permalink / raw)
To: neil.armstrong, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 11/01/2023 12:57, Neil Armstrong wrote:
> On 08/01/2023 17:56, Dmitry Baryshkov wrote:
>> The lt9611 bridge can support different modes, it makes no sense to list
>> them in the table. Drop the table and check the number of interfaces
>> using the fixed value.
>>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> ---
>> drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
>> 1 file changed, 4 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c
>> b/drivers/gpu/drm/bridge/lontium-lt9611.c
>> index 82af1f954cc6..df9f015aa3a0 100644
>> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
>> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
>> @@ -84,24 +84,6 @@ static const struct regmap_config
>> lt9611_regmap_config = {
>> .num_ranges = ARRAY_SIZE(lt9611_ranges),
>> };
>> -struct lt9611_mode {
>> - u16 hdisplay;
>> - u16 vdisplay;
>> - u8 vrefresh;
>> - u8 lanes;
>> - u8 intfs;
>> -};
>> -
>> -static struct lt9611_mode lt9611_modes[] = {
>> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
>> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
>> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
>> - { 1920, 1080, 24, 3, 1 },
>> - { 720, 480, 60, 4, 1 },
>> - { 720, 576, 50, 2, 1 },
>> - { 640, 480, 60, 2, 1 },
>> -};
>> -
>> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
>> {
>> return container_of(bridge, struct lt9611, bridge);
>> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611
>> *lt9611)
>> return 0;
>> }
>> -static struct lt9611_mode *lt9611_find_mode(const struct
>> drm_display_mode *mode)
>> -{
>> - int i;
>> -
>> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
>> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
>> - lt9611_modes[i].vdisplay == mode->vdisplay &&
>> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
>> - return <9611_modes[i];
>> - }
>> - }
>> -
>> - return NULL;
>> -}
>> -
>> static enum drm_connector_status lt9611_bridge_detect(struct
>> drm_bridge *bridge)
>> {
>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>> @@ -832,12 +799,12 @@ static enum drm_mode_status
>> lt9611_bridge_mode_valid(struct drm_bridge *bridge,
>> const struct drm_display_info *info,
>> const struct drm_display_mode *mode)
>> {
>> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>> - if (!lt9611_mode)
>> - return MODE_BAD;
>> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
>> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
>
> Isn't 31 a typo ?
Maybe I should change that to drm_mode_vrefresh(mode) > 30. The chip
supports 3840x2160-30, but doesn't promise to support anything above that.
>
>> + return MODE_CLOCK_HIGH;
>> +
>> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
>> return MODE_PANEL;
>> else
>> return MODE_OK;
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
2023-01-11 15:37 ` Dmitry Baryshkov
@ 2023-01-12 8:43 ` neil.armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: neil.armstrong @ 2023-01-12 8:43 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 11/01/2023 16:37, Dmitry Baryshkov wrote:
> On 11/01/2023 12:57, Neil Armstrong wrote:
>> On 08/01/2023 17:56, Dmitry Baryshkov wrote:
>>> The lt9611 bridge can support different modes, it makes no sense to list
>>> them in the table. Drop the table and check the number of interfaces
>>> using the fixed value.
>>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>> drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
>>> 1 file changed, 4 insertions(+), 37 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>> index 82af1f954cc6..df9f015aa3a0 100644
>>> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
>>> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>> @@ -84,24 +84,6 @@ static const struct regmap_config lt9611_regmap_config = {
>>> .num_ranges = ARRAY_SIZE(lt9611_ranges),
>>> };
>>> -struct lt9611_mode {
>>> - u16 hdisplay;
>>> - u16 vdisplay;
>>> - u8 vrefresh;
>>> - u8 lanes;
>>> - u8 intfs;
>>> -};
>>> -
>>> -static struct lt9611_mode lt9611_modes[] = {
>>> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
>>> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
>>> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
>>> - { 1920, 1080, 24, 3, 1 },
>>> - { 720, 480, 60, 4, 1 },
>>> - { 720, 576, 50, 2, 1 },
>>> - { 640, 480, 60, 2, 1 },
>>> -};
>>> -
>>> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
>>> {
>>> return container_of(bridge, struct lt9611, bridge);
>>> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611)
>>> return 0;
>>> }
>>> -static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
>>> -{
>>> - int i;
>>> -
>>> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
>>> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
>>> - lt9611_modes[i].vdisplay == mode->vdisplay &&
>>> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
>>> - return <9611_modes[i];
>>> - }
>>> - }
>>> -
>>> - return NULL;
>>> -}
>>> -
>>> static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
>>> {
>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>> @@ -832,12 +799,12 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
>>> const struct drm_display_info *info,
>>> const struct drm_display_mode *mode)
>>> {
>>> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>> - if (!lt9611_mode)
>>> - return MODE_BAD;
>>> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
>>> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
>>
>> Isn't 31 a typo ?
>
> Maybe I should change that to drm_mode_vrefresh(mode) > 30. The chip supports 3840x2160-30, but doesn't promise to support anything above that.
Yep >= 31 is valid, but > 30 seems more logical.
Concerning the hdisplay check, shouldn't be separate ?
You should switch to:
if (mode->hdisplay > 3840)
return MODE_BAD_WIDTH;
if (mode->hdisplay == 3840 && drm_mode_vrefresh(mode) > 30)
return MODE_CLOCK_HIGH;
Isn't there limits on vdisplay aswell ?
Neil
>
>>
>>> + return MODE_CLOCK_HIGH;
>>> +
>>> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
>>> return MODE_PANEL;
>>> else
>>> return MODE_OK;
>>
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
@ 2023-01-12 8:43 ` neil.armstrong
0 siblings, 0 replies; 60+ messages in thread
From: neil.armstrong @ 2023-01-12 8:43 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 11/01/2023 16:37, Dmitry Baryshkov wrote:
> On 11/01/2023 12:57, Neil Armstrong wrote:
>> On 08/01/2023 17:56, Dmitry Baryshkov wrote:
>>> The lt9611 bridge can support different modes, it makes no sense to list
>>> them in the table. Drop the table and check the number of interfaces
>>> using the fixed value.
>>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>> ---
>>> drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++----------------------
>>> 1 file changed, 4 insertions(+), 37 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>> index 82af1f954cc6..df9f015aa3a0 100644
>>> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
>>> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>> @@ -84,24 +84,6 @@ static const struct regmap_config lt9611_regmap_config = {
>>> .num_ranges = ARRAY_SIZE(lt9611_ranges),
>>> };
>>> -struct lt9611_mode {
>>> - u16 hdisplay;
>>> - u16 vdisplay;
>>> - u8 vrefresh;
>>> - u8 lanes;
>>> - u8 intfs;
>>> -};
>>> -
>>> -static struct lt9611_mode lt9611_modes[] = {
>>> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
>>> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
>>> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
>>> - { 1920, 1080, 24, 3, 1 },
>>> - { 720, 480, 60, 4, 1 },
>>> - { 720, 576, 50, 2, 1 },
>>> - { 640, 480, 60, 2, 1 },
>>> -};
>>> -
>>> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
>>> {
>>> return container_of(bridge, struct lt9611, bridge);
>>> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611)
>>> return 0;
>>> }
>>> -static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode)
>>> -{
>>> - int i;
>>> -
>>> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
>>> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
>>> - lt9611_modes[i].vdisplay == mode->vdisplay &&
>>> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
>>> - return <9611_modes[i];
>>> - }
>>> - }
>>> -
>>> - return NULL;
>>> -}
>>> -
>>> static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge)
>>> {
>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>> @@ -832,12 +799,12 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
>>> const struct drm_display_info *info,
>>> const struct drm_display_mode *mode)
>>> {
>>> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>> - if (!lt9611_mode)
>>> - return MODE_BAD;
>>> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
>>> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
>>
>> Isn't 31 a typo ?
>
> Maybe I should change that to drm_mode_vrefresh(mode) > 30. The chip supports 3840x2160-30, but doesn't promise to support anything above that.
Yep >= 31 is valid, but > 30 seems more logical.
Concerning the hdisplay check, shouldn't be separate ?
You should switch to:
if (mode->hdisplay > 3840)
return MODE_BAD_WIDTH;
if (mode->hdisplay == 3840 && drm_mode_vrefresh(mode) > 30)
return MODE_CLOCK_HIGH;
Isn't there limits on vdisplay aswell ?
Neil
>
>>
>>> + return MODE_CLOCK_HIGH;
>>> +
>>> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
>>> return MODE_PANEL;
>>> else
>>> return MODE_OK;
>>
>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
2023-01-12 8:43 ` neil.armstrong
@ 2023-01-12 9:19 ` Dmitry Baryshkov
-1 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-12 9:19 UTC (permalink / raw)
To: neil.armstrong, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 12/01/2023 10:43, neil.armstrong@linaro.org wrote:
> On 11/01/2023 16:37, Dmitry Baryshkov wrote:
>> On 11/01/2023 12:57, Neil Armstrong wrote:
>>> On 08/01/2023 17:56, Dmitry Baryshkov wrote:
>>>> The lt9611 bridge can support different modes, it makes no sense to
>>>> list
>>>> them in the table. Drop the table and check the number of interfaces
>>>> using the fixed value.
>>>>
>>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>>> ---
>>>> drivers/gpu/drm/bridge/lontium-lt9611.c | 41
>>>> +++----------------------
>>>> 1 file changed, 4 insertions(+), 37 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> index 82af1f954cc6..df9f015aa3a0 100644
>>>> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> @@ -84,24 +84,6 @@ static const struct regmap_config
>>>> lt9611_regmap_config = {
>>>> .num_ranges = ARRAY_SIZE(lt9611_ranges),
>>>> };
>>>> -struct lt9611_mode {
>>>> - u16 hdisplay;
>>>> - u16 vdisplay;
>>>> - u8 vrefresh;
>>>> - u8 lanes;
>>>> - u8 intfs;
>>>> -};
>>>> -
>>>> -static struct lt9611_mode lt9611_modes[] = {
>>>> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
>>>> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
>>>> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
>>>> - { 1920, 1080, 24, 3, 1 },
>>>> - { 720, 480, 60, 4, 1 },
>>>> - { 720, 576, 50, 2, 1 },
>>>> - { 640, 480, 60, 2, 1 },
>>>> -};
>>>> -
>>>> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
>>>> {
>>>> return container_of(bridge, struct lt9611, bridge);
>>>> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct
>>>> lt9611 *lt9611)
>>>> return 0;
>>>> }
>>>> -static struct lt9611_mode *lt9611_find_mode(const struct
>>>> drm_display_mode *mode)
>>>> -{
>>>> - int i;
>>>> -
>>>> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
>>>> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
>>>> - lt9611_modes[i].vdisplay == mode->vdisplay &&
>>>> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
>>>> - return <9611_modes[i];
>>>> - }
>>>> - }
>>>> -
>>>> - return NULL;
>>>> -}
>>>> -
>>>> static enum drm_connector_status lt9611_bridge_detect(struct
>>>> drm_bridge *bridge)
>>>> {
>>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>>> @@ -832,12 +799,12 @@ static enum drm_mode_status
>>>> lt9611_bridge_mode_valid(struct drm_bridge *bridge,
>>>> const struct drm_display_info *info,
>>>> const struct drm_display_mode *mode)
>>>> {
>>>> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
>>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>>> - if (!lt9611_mode)
>>>> - return MODE_BAD;
>>>> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
>>>> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
>>>
>>> Isn't 31 a typo ?
>>
>> Maybe I should change that to drm_mode_vrefresh(mode) > 30. The chip
>> supports 3840x2160-30, but doesn't promise to support anything above
>> that.
>
> Yep >= 31 is valid, but > 30 seems more logical.
>
> Concerning the hdisplay check, shouldn't be separate ?
>
> You should switch to:
> if (mode->hdisplay > 3840)
> return MODE_BAD_WIDTH;
>
> if (mode->hdisplay == 3840 && drm_mode_vrefresh(mode) > 30)
> return MODE_CLOCK_HIGH;
Good idea, I'll adapt it for v3.
>
> Isn't there limits on vdisplay aswell ?
I don't see any special limit in the datasheet. HDMI 1.4, 4k@30, that's
all. I think I'll just add vdisply > 2160 check next to hdisplay.
>
> Neil
>
>>
>>>
>>>> + return MODE_CLOCK_HIGH;
>>>> +
>>>> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
>>>> return MODE_PANEL;
>>>> else
>>>> return MODE_OK;
>>>
>>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table
@ 2023-01-12 9:19 ` Dmitry Baryshkov
0 siblings, 0 replies; 60+ messages in thread
From: Dmitry Baryshkov @ 2023-01-12 9:19 UTC (permalink / raw)
To: neil.armstrong, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 12/01/2023 10:43, neil.armstrong@linaro.org wrote:
> On 11/01/2023 16:37, Dmitry Baryshkov wrote:
>> On 11/01/2023 12:57, Neil Armstrong wrote:
>>> On 08/01/2023 17:56, Dmitry Baryshkov wrote:
>>>> The lt9611 bridge can support different modes, it makes no sense to
>>>> list
>>>> them in the table. Drop the table and check the number of interfaces
>>>> using the fixed value.
>>>>
>>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>>>> ---
>>>> drivers/gpu/drm/bridge/lontium-lt9611.c | 41
>>>> +++----------------------
>>>> 1 file changed, 4 insertions(+), 37 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> index 82af1f954cc6..df9f015aa3a0 100644
>>>> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
>>>> @@ -84,24 +84,6 @@ static const struct regmap_config
>>>> lt9611_regmap_config = {
>>>> .num_ranges = ARRAY_SIZE(lt9611_ranges),
>>>> };
>>>> -struct lt9611_mode {
>>>> - u16 hdisplay;
>>>> - u16 vdisplay;
>>>> - u8 vrefresh;
>>>> - u8 lanes;
>>>> - u8 intfs;
>>>> -};
>>>> -
>>>> -static struct lt9611_mode lt9611_modes[] = {
>>>> - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */
>>>> - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */
>>>> - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */
>>>> - { 1920, 1080, 24, 3, 1 },
>>>> - { 720, 480, 60, 4, 1 },
>>>> - { 720, 576, 50, 2, 1 },
>>>> - { 640, 480, 60, 2, 1 },
>>>> -};
>>>> -
>>>> static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge)
>>>> {
>>>> return container_of(bridge, struct lt9611, bridge);
>>>> @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct
>>>> lt9611 *lt9611)
>>>> return 0;
>>>> }
>>>> -static struct lt9611_mode *lt9611_find_mode(const struct
>>>> drm_display_mode *mode)
>>>> -{
>>>> - int i;
>>>> -
>>>> - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) {
>>>> - if (lt9611_modes[i].hdisplay == mode->hdisplay &&
>>>> - lt9611_modes[i].vdisplay == mode->vdisplay &&
>>>> - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) {
>>>> - return <9611_modes[i];
>>>> - }
>>>> - }
>>>> -
>>>> - return NULL;
>>>> -}
>>>> -
>>>> static enum drm_connector_status lt9611_bridge_detect(struct
>>>> drm_bridge *bridge)
>>>> {
>>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>>> @@ -832,12 +799,12 @@ static enum drm_mode_status
>>>> lt9611_bridge_mode_valid(struct drm_bridge *bridge,
>>>> const struct drm_display_info *info,
>>>> const struct drm_display_mode *mode)
>>>> {
>>>> - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode);
>>>> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
>>>> - if (!lt9611_mode)
>>>> - return MODE_BAD;
>>>> - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1)
>>>> + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31)
>>>
>>> Isn't 31 a typo ?
>>
>> Maybe I should change that to drm_mode_vrefresh(mode) > 30. The chip
>> supports 3840x2160-30, but doesn't promise to support anything above
>> that.
>
> Yep >= 31 is valid, but > 30 seems more logical.
>
> Concerning the hdisplay check, shouldn't be separate ?
>
> You should switch to:
> if (mode->hdisplay > 3840)
> return MODE_BAD_WIDTH;
>
> if (mode->hdisplay == 3840 && drm_mode_vrefresh(mode) > 30)
> return MODE_CLOCK_HIGH;
Good idea, I'll adapt it for v3.
>
> Isn't there limits on vdisplay aswell ?
I don't see any special limit in the datasheet. HDMI 1.4, 4k@30, that's
all. I think I'll just add vdisply > 2160 check next to hdisplay.
>
> Neil
>
>>
>>>
>>>> + return MODE_CLOCK_HIGH;
>>>> +
>>>> + if (mode->hdisplay > 2000 && !lt9611->dsi1_node)
>>>> return MODE_PANEL;
>>>> else
>>>> return MODE_OK;
>>>
>>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 01/13] drm/bridge: lt9611: fix sleep mode setup
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 9:24 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:24 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> On atomic_post_disable the bridge goes to the low power state. However
> the code disables too much of the chip, so the HPD event is not being
> detected and delivered to the host. Reduce the power saving in order to
> get the HPD event.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 7c0a99173b39..2714184cc53f 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -448,12 +448,11 @@ static void lt9611_sleep_setup(struct lt9611 *lt9611)
> { 0x8023, 0x01 },
> { 0x8157, 0x03 }, /* set addr pin as output */
> { 0x8149, 0x0b },
> - { 0x8151, 0x30 }, /* disable IRQ */
> +
> { 0x8102, 0x48 }, /* MIPI Rx power down */
> { 0x8123, 0x80 },
> { 0x8130, 0x00 },
> - { 0x8100, 0x01 }, /* bandgap power down */
> - { 0x8101, 0x00 }, /* system clk power down */
> + { 0x8011, 0x0a },
> };
>
> regmap_multi_reg_write(lt9611->regmap,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 01/13] drm/bridge: lt9611: fix sleep mode setup
@ 2023-01-12 9:24 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:24 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> On atomic_post_disable the bridge goes to the low power state. However
> the code disables too much of the chip, so the HPD event is not being
> detected and delivered to the host. Reduce the power saving in order to
> get the HPD event.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 7c0a99173b39..2714184cc53f 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -448,12 +448,11 @@ static void lt9611_sleep_setup(struct lt9611 *lt9611)
> { 0x8023, 0x01 },
> { 0x8157, 0x03 }, /* set addr pin as output */
> { 0x8149, 0x0b },
> - { 0x8151, 0x30 }, /* disable IRQ */
> +
> { 0x8102, 0x48 }, /* MIPI Rx power down */
> { 0x8123, 0x80 },
> { 0x8130, 0x00 },
> - { 0x8100, 0x01 }, /* bandgap power down */
> - { 0x8101, 0x00 }, /* system clk power down */
> + { 0x8011, 0x0a },
> };
>
> regmap_multi_reg_write(lt9611->regmap,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 02/13] drm/bridge: lt9611: fix HPD reenablement
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 9:24 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:24 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The driver will reset the bridge in the atomic_pre_enable(). However
> this will also drop the HPD interrupt state. Instead of resetting the
> bridge, properly wake it up. This fixes the HPD interrupt delivery after
> the disable/enable cycle.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 2714184cc53f..58f39b279217 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -856,12 +856,18 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> + static const struct reg_sequence reg_cfg[] = {
> + { 0x8102, 0x12 },
> + { 0x8123, 0x40 },
> + { 0x8130, 0xea },
> + { 0x8011, 0xfa },
> + };
>
> if (!lt9611->sleep)
> return;
>
> - lt9611_reset(lt9611);
> - regmap_write(lt9611->regmap, 0x80ee, 0x01);
> + regmap_multi_reg_write(lt9611->regmap,
> + reg_cfg, ARRAY_SIZE(reg_cfg));
>
> lt9611->sleep = false;
> }
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 02/13] drm/bridge: lt9611: fix HPD reenablement
@ 2023-01-12 9:24 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:24 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> The driver will reset the bridge in the atomic_pre_enable(). However
> this will also drop the HPD interrupt state. Instead of resetting the
> bridge, properly wake it up. This fixes the HPD interrupt delivery after
> the disable/enable cycle.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 2714184cc53f..58f39b279217 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -856,12 +856,18 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,
> static void lt9611_bridge_pre_enable(struct drm_bridge *bridge)
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> + static const struct reg_sequence reg_cfg[] = {
> + { 0x8102, 0x12 },
> + { 0x8123, 0x40 },
> + { 0x8130, 0xea },
> + { 0x8011, 0xfa },
> + };
>
> if (!lt9611->sleep)
> return;
>
> - lt9611_reset(lt9611);
> - regmap_write(lt9611->regmap, 0x80ee, 0x01);
> + regmap_multi_reg_write(lt9611->regmap,
> + reg_cfg, ARRAY_SIZE(reg_cfg));
>
> lt9611->sleep = false;
> }
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 03/13] drm/bridge: lt9611: fix polarity programming
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 9:26 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:26 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Fix programming of hsync and vsync polarities
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 58f39b279217..deb503ca956a 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -207,7 +207,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
>
> /* stage 2 */
> { 0x834a, 0x40 },
> - { 0x831d, 0x10 },
>
> /* MK limit */
> { 0x832d, 0x38 },
> @@ -222,11 +221,19 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> { 0x8325, 0x00 },
> { 0x832a, 0x01 },
> { 0x834a, 0x10 },
> - { 0x831d, 0x10 },
> - { 0x8326, 0x37 },
> };
> + u8 pol = 0x10;
>
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> + if (mode->flags & DRM_MODE_FLAG_NHSYNC)
> + pol |= 0x2;
> + if (mode->flags & DRM_MODE_FLAG_NVSYNC)
> + pol |= 0x1;
> + regmap_write(lt9611->regmap, 0x831d, pol);
> +
> + if (mode->hdisplay == 3840)
> + regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
> + else
> + regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
>
> switch (mode->hdisplay) {
> case 640:
> @@ -236,7 +243,7 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> regmap_write(lt9611->regmap, 0x8326, 0x37);
> break;
> case 3840:
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
> + regmap_write(lt9611->regmap, 0x8326, 0x37);
> break;
> }
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 03/13] drm/bridge: lt9611: fix polarity programming
@ 2023-01-12 9:26 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:26 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Fix programming of hsync and vsync polarities
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 58f39b279217..deb503ca956a 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -207,7 +207,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
>
> /* stage 2 */
> { 0x834a, 0x40 },
> - { 0x831d, 0x10 },
>
> /* MK limit */
> { 0x832d, 0x38 },
> @@ -222,11 +221,19 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> { 0x8325, 0x00 },
> { 0x832a, 0x01 },
> { 0x834a, 0x10 },
> - { 0x831d, 0x10 },
> - { 0x8326, 0x37 },
> };
> + u8 pol = 0x10;
>
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> + if (mode->flags & DRM_MODE_FLAG_NHSYNC)
> + pol |= 0x2;
> + if (mode->flags & DRM_MODE_FLAG_NVSYNC)
> + pol |= 0x1;
> + regmap_write(lt9611->regmap, 0x831d, pol);
> +
> + if (mode->hdisplay == 3840)
> + regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
> + else
> + regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
>
> switch (mode->hdisplay) {
> case 640:
> @@ -236,7 +243,7 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> regmap_write(lt9611->regmap, 0x8326, 0x37);
> break;
> case 3840:
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
> + regmap_write(lt9611->regmap, 0x8326, 0x37);
> break;
> }
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 04/13] drm/bridge: lt9611: fix programming of video modes
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 9:27 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:27 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Program the upper part of the hfront_porch into the proper register.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index deb503ca956a..f377052a45a4 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -187,7 +187,8 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
>
> regmap_write(lt9611->regmap, 0x8319, (u8)(hfront_porch % 256));
>
> - regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256));
> + regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256) |
> + ((hfront_porch / 256) << 4));
> regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
> }
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 04/13] drm/bridge: lt9611: fix programming of video modes
@ 2023-01-12 9:27 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:27 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Program the upper part of the hfront_porch into the proper register.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index deb503ca956a..f377052a45a4 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -187,7 +187,8 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
>
> regmap_write(lt9611->regmap, 0x8319, (u8)(hfront_porch % 256));
>
> - regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256));
> + regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256) |
> + ((hfront_porch / 256) << 4));
> regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
> }
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 05/13] drm/bridge: lt9611: fix clock calculation
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 9:28 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:28 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Instead of having several fixed values for the pcr register, calculate
> it before programming. This allows the bridge to support most of the
> display modes.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 32 +++++++++++--------------
> 1 file changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index f377052a45a4..e2799a0df8f8 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -192,8 +192,9 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
> regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
> }
>
> -static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
> +static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int postdiv)
> {
> + unsigned int pcr_m = mode->clock * 5 * postdiv / 27000;
> const struct reg_sequence reg_cfg[] = {
> { 0x830b, 0x01 },
> { 0x830c, 0x10 },
> @@ -236,24 +237,14 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> else
> regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
>
> - switch (mode->hdisplay) {
> - case 640:
> - regmap_write(lt9611->regmap, 0x8326, 0x14);
> - break;
> - case 1920:
> - regmap_write(lt9611->regmap, 0x8326, 0x37);
> - break;
> - case 3840:
> - regmap_write(lt9611->regmap, 0x8326, 0x37);
> - break;
> - }
> + regmap_write(lt9611->regmap, 0x8326, pcr_m);
>
> /* pcr rst */
> regmap_write(lt9611->regmap, 0x8011, 0x5a);
> regmap_write(lt9611->regmap, 0x8011, 0xfa);
> }
>
> -static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
> +static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int *postdiv)
> {
> unsigned int pclk = mode->clock;
> const struct reg_sequence reg_cfg[] = {
> @@ -271,12 +262,16 @@ static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode
>
> regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
>
> - if (pclk > 150000)
> + if (pclk > 150000) {
> regmap_write(lt9611->regmap, 0x812d, 0x88);
> - else if (pclk > 70000)
> + *postdiv = 1;
> + } else if (pclk > 70000) {
> regmap_write(lt9611->regmap, 0x812d, 0x99);
> - else
> + *postdiv = 2;
> + } else {
> regmap_write(lt9611->regmap, 0x812d, 0xaa);
> + *postdiv = 4;
> + }
>
> /*
> * first divide pclk by 2 first
> @@ -895,14 +890,15 @@ static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> struct hdmi_avi_infoframe avi_frame;
> + unsigned int postdiv;
> int ret;
>
> lt9611_bridge_pre_enable(bridge);
>
> lt9611_mipi_input_digital(lt9611, mode);
> - lt9611_pll_setup(lt9611, mode);
> + lt9611_pll_setup(lt9611, mode, &postdiv);
> lt9611_mipi_video_setup(lt9611, mode);
> - lt9611_pcr_setup(lt9611, mode);
> + lt9611_pcr_setup(lt9611, mode, postdiv);
>
> ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> <9611->connector,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 05/13] drm/bridge: lt9611: fix clock calculation
@ 2023-01-12 9:28 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:28 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Instead of having several fixed values for the pcr register, calculate
> it before programming. This allows the bridge to support most of the
> display modes.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 32 +++++++++++--------------
> 1 file changed, 14 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index f377052a45a4..e2799a0df8f8 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -192,8 +192,9 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611,
> regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256));
> }
>
> -static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
> +static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int postdiv)
> {
> + unsigned int pcr_m = mode->clock * 5 * postdiv / 27000;
> const struct reg_sequence reg_cfg[] = {
> { 0x830b, 0x01 },
> { 0x830c, 0x10 },
> @@ -236,24 +237,14 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> else
> regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
>
> - switch (mode->hdisplay) {
> - case 640:
> - regmap_write(lt9611->regmap, 0x8326, 0x14);
> - break;
> - case 1920:
> - regmap_write(lt9611->regmap, 0x8326, 0x37);
> - break;
> - case 3840:
> - regmap_write(lt9611->regmap, 0x8326, 0x37);
> - break;
> - }
> + regmap_write(lt9611->regmap, 0x8326, pcr_m);
>
> /* pcr rst */
> regmap_write(lt9611->regmap, 0x8011, 0x5a);
> regmap_write(lt9611->regmap, 0x8011, 0xfa);
> }
>
> -static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode)
> +static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int *postdiv)
> {
> unsigned int pclk = mode->clock;
> const struct reg_sequence reg_cfg[] = {
> @@ -271,12 +262,16 @@ static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode
>
> regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
>
> - if (pclk > 150000)
> + if (pclk > 150000) {
> regmap_write(lt9611->regmap, 0x812d, 0x88);
> - else if (pclk > 70000)
> + *postdiv = 1;
> + } else if (pclk > 70000) {
> regmap_write(lt9611->regmap, 0x812d, 0x99);
> - else
> + *postdiv = 2;
> + } else {
> regmap_write(lt9611->regmap, 0x812d, 0xaa);
> + *postdiv = 4;
> + }
>
> /*
> * first divide pclk by 2 first
> @@ -895,14 +890,15 @@ static void lt9611_bridge_mode_set(struct drm_bridge *bridge,
> {
> struct lt9611 *lt9611 = bridge_to_lt9611(bridge);
> struct hdmi_avi_infoframe avi_frame;
> + unsigned int postdiv;
> int ret;
>
> lt9611_bridge_pre_enable(bridge);
>
> lt9611_mipi_input_digital(lt9611, mode);
> - lt9611_pll_setup(lt9611, mode);
> + lt9611_pll_setup(lt9611, mode, &postdiv);
> lt9611_mipi_video_setup(lt9611, mode);
> - lt9611_pcr_setup(lt9611, mode);
> + lt9611_pcr_setup(lt9611, mode, postdiv);
>
> ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> <9611->connector,
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 06/13] drm/bridge: lt9611: pass a pointer to the of node
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 9:28 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:28 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Pass a pointer to the OF node while registering lt9611 MIPI device.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index e2799a0df8f8..3b77238ca4af 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -769,7 +769,7 @@ static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
> static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
> struct device_node *dsi_node)
> {
> - const struct mipi_dsi_device_info info = { "lt9611", 0, NULL };
> + const struct mipi_dsi_device_info info = { "lt9611", 0, lt9611->dev->of_node};
> struct mipi_dsi_device *dsi;
> struct mipi_dsi_host *host;
> struct device *dev = lt9611->dev;
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 06/13] drm/bridge: lt9611: pass a pointer to the of node
@ 2023-01-12 9:28 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:28 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Pass a pointer to the OF node while registering lt9611 MIPI device.
>
> Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge")
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index e2799a0df8f8..3b77238ca4af 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -769,7 +769,7 @@ static const struct drm_connector_funcs lt9611_bridge_connector_funcs = {
> static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
> struct device_node *dsi_node)
> {
> - const struct mipi_dsi_device_info info = { "lt9611", 0, NULL };
> + const struct mipi_dsi_device_info info = { "lt9611", 0, lt9611->dev->of_node};
> struct mipi_dsi_device *dsi;
> struct mipi_dsi_host *host;
> struct device *dev = lt9611->dev;
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 09/13] drm/bridge: lt9611: fix sync polarity for DVI output
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 9:28 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:28 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Attaching DVI sink to the lt9611 requires different setup. Fix the
> register write to make the DVI displays sync onto the correct sync
> pulse.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 773d7a56f86f..7f9be74acf0d 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -352,13 +352,16 @@ static int lt9611_video_check(struct lt9611 *lt9611)
> return temp;
> }
>
> -static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611)
> +static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
> {
> regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
> regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
> regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
>
> - regmap_write(lt9611->regmap, 0x82d6, 0x8c);
> + if (is_hdmi)
> + regmap_write(lt9611->regmap, 0x82d6, 0x8c);
> + else
> + regmap_write(lt9611->regmap, 0x82d6, 0x0c);
> regmap_write(lt9611->regmap, 0x82d7, 0x04);
> }
>
> @@ -719,7 +722,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> }
>
> lt9611_mipi_input_analog(lt9611);
> - lt9611_hdmi_tx_digital(lt9611);
> + lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
> lt9611_hdmi_tx_phy(lt9611);
>
> msleep(500);
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 09/13] drm/bridge: lt9611: fix sync polarity for DVI output
@ 2023-01-12 9:28 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 9:28 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Attaching DVI sink to the lt9611 requires different setup. Fix the
> register write to make the DVI displays sync onto the correct sync
> pulse.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 773d7a56f86f..7f9be74acf0d 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -352,13 +352,16 @@ static int lt9611_video_check(struct lt9611 *lt9611)
> return temp;
> }
>
> -static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611)
> +static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
> {
> regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
> regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
> regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
>
> - regmap_write(lt9611->regmap, 0x82d6, 0x8c);
> + if (is_hdmi)
> + regmap_write(lt9611->regmap, 0x82d6, 0x8c);
> + else
> + regmap_write(lt9611->regmap, 0x82d6, 0x0c);
> regmap_write(lt9611->regmap, 0x82d7, 0x04);
> }
>
> @@ -719,7 +722,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> }
>
> lt9611_mipi_input_analog(lt9611);
> - lt9611_hdmi_tx_digital(lt9611);
> + lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
> lt9611_hdmi_tx_phy(lt9611);
>
> msleep(500);
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 13/13] drm/bridge: lt9611: properly program the dual host mode
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 13:51 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 13:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> If the bridge is connected using both DSI ports, the driver should use
> both of them all the time. Correct programming sequence to always use
> dual-port mode if both dsi0 and dsi1 are connected.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 28 ++++++++++++-------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index df9f015aa3a0..561da6bd2698 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -118,7 +118,7 @@ static int lt9611_mipi_input_digital(struct lt9611 *lt9611,
> { 0x8306, 0x0a },
> };
>
> - if (mode->hdisplay == 3840)
> + if (lt9611->dsi1_node)
> reg_cfg[1].def = 0x03;
>
> return regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> @@ -191,16 +191,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> { 0x832d, 0x38 },
> { 0x8331, 0x08 },
> };
> - const struct reg_sequence reg_cfg2[] = {
> - { 0x830b, 0x03 },
> - { 0x830c, 0xd0 },
> - { 0x8348, 0x03 },
> - { 0x8349, 0xe0 },
> - { 0x8324, 0x72 },
> - { 0x8325, 0x00 },
> - { 0x832a, 0x01 },
> - { 0x834a, 0x10 },
> - };
> u8 pol = 0x10;
>
> if (mode->flags & DRM_MODE_FLAG_NHSYNC)
> @@ -209,10 +199,18 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> pol |= 0x1;
> regmap_write(lt9611->regmap, 0x831d, pol);
>
> - if (mode->hdisplay == 3840)
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
> - else
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> + regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> + if (lt9611->dsi1_node) {
> + unsigned int hact = mode->hdisplay;
> +
> + hact >>= 2;
> + hact += 0x50;
> + hact = min(hact, 0x3e0U);
> + regmap_write(lt9611->regmap, 0x830b, hact / 256);
> + regmap_write(lt9611->regmap, 0x830c, hact % 256);
> + regmap_write(lt9611->regmap, 0x8348, hact / 256);
> + regmap_write(lt9611->regmap, 0x8349, hact % 256);
> + }
>
> regmap_write(lt9611->regmap, 0x8326, pcr_m);
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 13/13] drm/bridge: lt9611: properly program the dual host mode
@ 2023-01-12 13:51 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 13:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> If the bridge is connected using both DSI ports, the driver should use
> both of them all the time. Correct programming sequence to always use
> dual-port mode if both dsi0 and dsi1 are connected.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 28 ++++++++++++-------------
> 1 file changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index df9f015aa3a0..561da6bd2698 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -118,7 +118,7 @@ static int lt9611_mipi_input_digital(struct lt9611 *lt9611,
> { 0x8306, 0x0a },
> };
>
> - if (mode->hdisplay == 3840)
> + if (lt9611->dsi1_node)
> reg_cfg[1].def = 0x03;
>
> return regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> @@ -191,16 +191,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> { 0x832d, 0x38 },
> { 0x8331, 0x08 },
> };
> - const struct reg_sequence reg_cfg2[] = {
> - { 0x830b, 0x03 },
> - { 0x830c, 0xd0 },
> - { 0x8348, 0x03 },
> - { 0x8349, 0xe0 },
> - { 0x8324, 0x72 },
> - { 0x8325, 0x00 },
> - { 0x832a, 0x01 },
> - { 0x834a, 0x10 },
> - };
> u8 pol = 0x10;
>
> if (mode->flags & DRM_MODE_FLAG_NHSYNC)
> @@ -209,10 +199,18 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod
> pol |= 0x1;
> regmap_write(lt9611->regmap, 0x831d, pol);
>
> - if (mode->hdisplay == 3840)
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2));
> - else
> - regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> + regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg));
> + if (lt9611->dsi1_node) {
> + unsigned int hact = mode->hdisplay;
> +
> + hact >>= 2;
> + hact += 0x50;
> + hact = min(hact, 0x3e0U);
> + regmap_write(lt9611->regmap, 0x830b, hact / 256);
> + regmap_write(lt9611->regmap, 0x830c, hact % 256);
> + regmap_write(lt9611->regmap, 0x8348, hact / 256);
> + regmap_write(lt9611->regmap, 0x8349, hact % 256);
> + }
>
> regmap_write(lt9611->regmap, 0x8326, pcr_m);
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 11/13] drm/bridge: lt9611: rework infoframes handling
2023-01-08 16:56 ` Dmitry Baryshkov
@ 2023-01-12 13:51 ` Neil Armstrong
-1 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 13:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: David Airlie, Daniel Vetter, dri-devel, freedreno, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Rework handling infoframes:
> - Write full HDMI AVI infoframe instead of just fixing the VIC value
> - Also send the HDMI Vendor Specific infoframe, as recommended by the
> HDMI spec.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 57 +++++++++++++++++++------
> 1 file changed, 44 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 1396ab081f61..82af1f954cc6 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -59,7 +59,6 @@ struct lt9611 {
> enum drm_connector_status status;
>
> u8 edid_buf[EDID_SEG_SIZE];
> - u32 vic;
> };
>
> #define LT9611_PAGE_CONTROL 0xff
> @@ -352,12 +351,51 @@ static int lt9611_video_check(struct lt9611 *lt9611)
> return temp;
> }
>
> -static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
> +static void lt9611_hdmi_set_infoframes(struct lt9611 *lt9611,
> + struct drm_connector *connector,
> + struct drm_display_mode *mode)
> {
> - regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
> - regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
> - regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
> + union hdmi_infoframe infoframe;
> + ssize_t len;
> + u8 iframes = 0x0a; /* UD1 infoframe */
> + u8 buf[32];
> + int ret;
> + int i;
> +
> + ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi,
> + connector,
> + mode);
> + if (ret < 0)
> + goto out;
> +
> + len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
> + if (len < 0)
> + goto out;
> +
> + for (i = 0; i < len; i++)
> + regmap_write(lt9611->regmap, 0x8440 + i, buf[i]);
> +
> + ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi,
> + connector,
> + mode);
> + if (ret < 0)
> + goto out;
> +
> + len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
> + if (len < 0)
> + goto out;
>
> + for (i = 0; i < len; i++)
> + regmap_write(lt9611->regmap, 0x8474 + i, buf[i]);
> +
> + iframes |= 0x20;
> +
> +out:
> + regmap_write(lt9611->regmap, 0x843d, iframes); /* UD1 infoframe */
> +}
> +
> +static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
> +{
> if (is_hdmi)
> regmap_write(lt9611->regmap, 0x82d6, 0x8c);
> else
> @@ -687,9 +725,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> struct drm_connector_state *conn_state;
> struct drm_crtc_state *crtc_state;
> struct drm_display_mode *mode;
> - struct hdmi_avi_infoframe avi_frame;
> unsigned int postdiv;
> - int ret;
>
> connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
> if (WARN_ON(!connector))
> @@ -710,18 +746,13 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> lt9611_mipi_video_setup(lt9611, mode);
> lt9611_pcr_setup(lt9611, mode, postdiv);
>
> - ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> - connector,
> - mode);
> - if (!ret)
> - lt9611->vic = avi_frame.video_code;
> -
> if (lt9611_power_on(lt9611)) {
> dev_err(lt9611->dev, "power on failed\n");
> return;
> }
>
> lt9611_mipi_input_analog(lt9611);
> + lt9611_hdmi_set_infoframes(lt9611, connector, mode);
> lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
> lt9611_hdmi_tx_phy(lt9611);
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
* Re: [PATCH v2 11/13] drm/bridge: lt9611: rework infoframes handling
@ 2023-01-12 13:51 ` Neil Armstrong
0 siblings, 0 replies; 60+ messages in thread
From: Neil Armstrong @ 2023-01-12 13:51 UTC (permalink / raw)
To: Dmitry Baryshkov, Vinod Koul, Andrzej Hajda, Robert Foss,
Laurent Pinchart, Jonas Karlman, Jernej Skrabec
Cc: freedreno, dri-devel, linux-arm-msm
On 08/01/2023 17:56, Dmitry Baryshkov wrote:
> Rework handling infoframes:
> - Write full HDMI AVI infoframe instead of just fixing the VIC value
> - Also send the HDMI Vendor Specific infoframe, as recommended by the
> HDMI spec.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> ---
> drivers/gpu/drm/bridge/lontium-lt9611.c | 57 +++++++++++++++++++------
> 1 file changed, 44 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c
> index 1396ab081f61..82af1f954cc6 100644
> --- a/drivers/gpu/drm/bridge/lontium-lt9611.c
> +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c
> @@ -59,7 +59,6 @@ struct lt9611 {
> enum drm_connector_status status;
>
> u8 edid_buf[EDID_SEG_SIZE];
> - u32 vic;
> };
>
> #define LT9611_PAGE_CONTROL 0xff
> @@ -352,12 +351,51 @@ static int lt9611_video_check(struct lt9611 *lt9611)
> return temp;
> }
>
> -static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
> +static void lt9611_hdmi_set_infoframes(struct lt9611 *lt9611,
> + struct drm_connector *connector,
> + struct drm_display_mode *mode)
> {
> - regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic);
> - regmap_write(lt9611->regmap, 0x8447, lt9611->vic);
> - regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */
> + union hdmi_infoframe infoframe;
> + ssize_t len;
> + u8 iframes = 0x0a; /* UD1 infoframe */
> + u8 buf[32];
> + int ret;
> + int i;
> +
> + ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi,
> + connector,
> + mode);
> + if (ret < 0)
> + goto out;
> +
> + len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
> + if (len < 0)
> + goto out;
> +
> + for (i = 0; i < len; i++)
> + regmap_write(lt9611->regmap, 0x8440 + i, buf[i]);
> +
> + ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi,
> + connector,
> + mode);
> + if (ret < 0)
> + goto out;
> +
> + len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf));
> + if (len < 0)
> + goto out;
>
> + for (i = 0; i < len; i++)
> + regmap_write(lt9611->regmap, 0x8474 + i, buf[i]);
> +
> + iframes |= 0x20;
> +
> +out:
> + regmap_write(lt9611->regmap, 0x843d, iframes); /* UD1 infoframe */
> +}
> +
> +static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi)
> +{
> if (is_hdmi)
> regmap_write(lt9611->regmap, 0x82d6, 0x8c);
> else
> @@ -687,9 +725,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> struct drm_connector_state *conn_state;
> struct drm_crtc_state *crtc_state;
> struct drm_display_mode *mode;
> - struct hdmi_avi_infoframe avi_frame;
> unsigned int postdiv;
> - int ret;
>
> connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
> if (WARN_ON(!connector))
> @@ -710,18 +746,13 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge,
> lt9611_mipi_video_setup(lt9611, mode);
> lt9611_pcr_setup(lt9611, mode, postdiv);
>
> - ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame,
> - connector,
> - mode);
> - if (!ret)
> - lt9611->vic = avi_frame.video_code;
> -
> if (lt9611_power_on(lt9611)) {
> dev_err(lt9611->dev, "power on failed\n");
> return;
> }
>
> lt9611_mipi_input_analog(lt9611);
> + lt9611_hdmi_set_infoframes(lt9611, connector, mode);
> lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi);
> lt9611_hdmi_tx_phy(lt9611);
>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
^ permalink raw reply [flat|nested] 60+ messages in thread
end of thread, other threads:[~2023-01-12 13:52 UTC | newest]
Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-08 16:56 [PATCH v2 00/13] drm/bridge: lt9611: several fixes and improvements Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-08 16:56 ` [PATCH v2 01/13] drm/bridge: lt9611: fix sleep mode setup Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 9:24 ` Neil Armstrong
2023-01-12 9:24 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 02/13] drm/bridge: lt9611: fix HPD reenablement Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 9:24 ` Neil Armstrong
2023-01-12 9:24 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 03/13] drm/bridge: lt9611: fix polarity programming Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 9:26 ` Neil Armstrong
2023-01-12 9:26 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 04/13] drm/bridge: lt9611: fix programming of video modes Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 9:27 ` Neil Armstrong
2023-01-12 9:27 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 05/13] drm/bridge: lt9611: fix clock calculation Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 9:28 ` Neil Armstrong
2023-01-12 9:28 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 06/13] drm/bridge: lt9611: pass a pointer to the of node Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 9:28 ` Neil Armstrong
2023-01-12 9:28 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 07/13] drm/bridge: lt9611: rework the mode_set function Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-11 10:53 ` Neil Armstrong
2023-01-11 10:53 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 08/13] drm/bridge: lt9611: attach to the next bridge Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-11 10:56 ` Neil Armstrong
2023-01-11 10:56 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 09/13] drm/bridge: lt9611: fix sync polarity for DVI output Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 9:28 ` Neil Armstrong
2023-01-12 9:28 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 10/13] drm/bridge: lt9611: simplify video timings programming Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-11 10:56 ` Neil Armstrong
2023-01-11 10:56 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 11/13] drm/bridge: lt9611: rework infoframes handling Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 13:51 ` Neil Armstrong
2023-01-12 13:51 ` Neil Armstrong
2023-01-08 16:56 ` [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-11 10:57 ` Neil Armstrong
2023-01-11 10:57 ` Neil Armstrong
2023-01-11 15:37 ` Dmitry Baryshkov
2023-01-11 15:37 ` Dmitry Baryshkov
2023-01-12 8:43 ` neil.armstrong
2023-01-12 8:43 ` neil.armstrong
2023-01-12 9:19 ` Dmitry Baryshkov
2023-01-12 9:19 ` Dmitry Baryshkov
2023-01-08 16:56 ` [PATCH v2 13/13] drm/bridge: lt9611: properly program the dual host mode Dmitry Baryshkov
2023-01-08 16:56 ` Dmitry Baryshkov
2023-01-12 13:51 ` Neil Armstrong
2023-01-12 13:51 ` Neil Armstrong
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.