2020-04-17 15:11:10

by Enric Balletbo i Serra

[permalink] [raw]
Subject: [PATCH v3 0/7] Convert mtk-dsi to drm_bridge API and get EDID for ps8640 bridge

The PS8640 dsi-to-eDP bridge driver is using the panel bridge API,
however, not all the components in the chain have been ported to the
drm_bridge API. Actually, when a panel is attached the default panel's mode
is used, but in some cases we can't get display up if mode getting from
eDP control EDID is not chosen.

This series address that problem, first implements the .get_edid()
callback in the PS8640 driver (which is not used until the conversion is
done) and then, converts the Mediatek DSI driver to use the drm_bridge
API.

As far as I know, we're the only users of the mediatek dsi driver in
mainline, so should be safe to switch to the new chain of drm_bridge API
unconditionally.

The patches has been tested on a Acer Chromebook R13 (Elm) running a
Chrome OS userspace and checking that the valid EDID mode reported by
the bridge is selected.

[1] https://lore.kernel.org/lkml/[email protected]/

Changes in v3:
- Replace s/bridge/next bridge/ for comment. (Laurent Pinchart)
- Add the bridge.type. (Laurent Pinchart)
- Use next_bridge field to store the panel bridge. (Laurent Pinchart)
- Add the bridge.type field. (Laurent Pinchart)
- This patch requires https://lkml.org/lkml/2020/4/16/2080 to work
properly.
- Move the bridge.type line to the patch that adds drm_bridge support. (Laurent Pinchart)

Changes in v2:
- Do not set connector_type for panel here. (Sam Ravnborg)

Enric Balletbo i Serra (7):
drm/bridge: ps8640: Get the EDID from eDP control
drm/bridge_connector: Set default status connected for eDP connectors
drm/mediatek: mtk_dsi: Rename bridge to next_bridge
drm/mediatek: mtk_dsi: Convert to bridge driver
drm/mediatek: mtk_dsi: Use simple encoder
drm/mediatek: mtk_dsi: Use the drm_panel_bridge API
drm/mediatek: mtk_dsi: Create connector for bridges

drivers/gpu/drm/bridge/parade-ps8640.c | 12 ++
drivers/gpu/drm/drm_bridge_connector.c | 1 +
drivers/gpu/drm/mediatek/mtk_dsi.c | 276 ++++++++-----------------
3 files changed, 96 insertions(+), 193 deletions(-)

--
2.25.1


2020-04-17 15:11:18

by Enric Balletbo i Serra

[permalink] [raw]
Subject: [PATCH v3 3/7] drm/mediatek: mtk_dsi: Rename bridge to next_bridge

This is really a cosmetic change just to make a bit more readable the
code after convert the driver to drm_bridge. The bridge variable name
will be used by the encoder drm_bridge, and the chained bridge will be
named next_bridge.

Signed-off-by: Enric Balletbo i Serra <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
---

Changes in v3:
- Replace s/bridge/next bridge/ for comment. (Laurent Pinchart)

Changes in v2: None

drivers/gpu/drm/mediatek/mtk_dsi.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index cfa45d6abd74..37b8d7ffd835 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -182,7 +182,7 @@ struct mtk_dsi {
struct drm_encoder encoder;
struct drm_connector conn;
struct drm_panel *panel;
- struct drm_bridge *bridge;
+ struct drm_bridge *next_bridge;
struct phy *phy;

void __iomem *regs;
@@ -902,9 +902,10 @@ static int mtk_dsi_create_conn_enc(struct drm_device *drm, struct mtk_dsi *dsi)
*/
dsi->encoder.possible_crtcs = 1;

- /* If there's a bridge, attach to it and let it create the connector */
- if (dsi->bridge) {
- ret = drm_bridge_attach(&dsi->encoder, dsi->bridge, NULL, 0);
+ /* If there's a next bridge, attach to it and let it create the connector */
+ if (dsi->next_bridge) {
+ ret = drm_bridge_attach(&dsi->encoder, dsi->next_bridge, NULL,
+ 0);
if (ret) {
DRM_ERROR("Failed to attach bridge to drm\n");
goto err_encoder_cleanup;
@@ -1185,7 +1186,7 @@ static int mtk_dsi_probe(struct platform_device *pdev)
}

ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
- &dsi->panel, &dsi->bridge);
+ &dsi->panel, &dsi->next_bridge);
if (ret)
goto err_unregister_host;

--
2.25.1

2020-04-25 17:29:01

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v3 0/7] Convert mtk-dsi to drm_bridge API and get EDID for ps8640 bridge

On Fri, Apr 17, 2020 at 05:06:07PM +0200, Enric Balletbo i Serra wrote:
> The PS8640 dsi-to-eDP bridge driver is using the panel bridge API,
> however, not all the components in the chain have been ported to the
> drm_bridge API. Actually, when a panel is attached the default panel's mode
> is used, but in some cases we can't get display up if mode getting from
> eDP control EDID is not chosen.
>
> This series address that problem, first implements the .get_edid()
> callback in the PS8640 driver (which is not used until the conversion is
> done) and then, converts the Mediatek DSI driver to use the drm_bridge
> API.
>
> As far as I know, we're the only users of the mediatek dsi driver in
> mainline, so should be safe to switch to the new chain of drm_bridge API
> unconditionally.
>
> The patches has been tested on a Acer Chromebook R13 (Elm) running a
> Chrome OS userspace and checking that the valid EDID mode reported by
> the bridge is selected.
>
> [1] https://lore.kernel.org/lkml/[email protected]/
>
> Changes in v3:
> - Replace s/bridge/next bridge/ for comment. (Laurent Pinchart)
> - Add the bridge.type. (Laurent Pinchart)
> - Use next_bridge field to store the panel bridge. (Laurent Pinchart)
> - Add the bridge.type field. (Laurent Pinchart)
> - This patch requires https://lkml.org/lkml/2020/4/16/2080 to work
> properly.
This patch is now applied to drm-misc-next.
IMO this patchset could go in now.


> - Move the bridge.type line to the patch that adds drm_bridge support. (Laurent Pinchart)
>
> Changes in v2:
> - Do not set connector_type for panel here. (Sam Ravnborg)
>
> Enric Balletbo i Serra (7):
> drm/bridge: ps8640: Get the EDID from eDP control
> drm/bridge_connector: Set default status connected for eDP connectors
> drm/mediatek: mtk_dsi: Rename bridge to next_bridge
> drm/mediatek: mtk_dsi: Convert to bridge driver
> drm/mediatek: mtk_dsi: Use simple encoder
> drm/mediatek: mtk_dsi: Use the drm_panel_bridge API
> drm/mediatek: mtk_dsi: Create connector for bridges
All patches:
Acked-by: Sam Ravnborg <[email protected]>


>
> drivers/gpu/drm/bridge/parade-ps8640.c | 12 ++
> drivers/gpu/drm/drm_bridge_connector.c | 1 +
> drivers/gpu/drm/mediatek/mtk_dsi.c | 276 ++++++++-----------------
> 3 files changed, 96 insertions(+), 193 deletions(-)
>
> --
> 2.25.1
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel