lkml.org 
[lkml]   [2022]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 1/2] drm/mediatek: Config orientation property if panel provides it
    Date
    Panel orientation property should be set before drm_dev_register().
    Mediatek drm driver calls drm_dev_register() in .bind(). However, most
    panels sets orientation property relatively late, mostly in .get_modes()
    callback, since this is when they are able to get the connector and
    binds the orientation property to it, though the value should be known
    when the panel is probed.

    Let the drm driver check if the remote end point is a panel and if it
    contains the orientation property. If it does, set it before
    drm_dev_register() is called.

    Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
    ---
    This patch is to solve the same problem as [1]
    [1] https://patchwork.kernel.org/project/linux-mediatek/patch/20220530081910.3947168-2-hsinyi@chromium.org/
    ---
    drivers/gpu/drm/mediatek/mtk_dsi.c | 13 +++++++++++++
    1 file changed, 13 insertions(+)

    diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
    index d9f10a33e6fa..091107f97ccc 100644
    --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
    +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
    @@ -198,6 +198,7 @@ struct mtk_dsi {

    unsigned long mode_flags;
    enum mipi_dsi_pixel_format format;
    + enum drm_panel_orientation orientation;
    unsigned int lanes;
    struct videomode vm;
    struct mtk_phy_timing phy_timing;
    @@ -822,6 +823,10 @@ static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi)
    ret = PTR_ERR(dsi->connector);
    goto err_cleanup_encoder;
    }
    +
    + if (dsi->orientation != DRM_MODE_PANEL_ORIENTATION_UNKNOWN)
    + drm_connector_set_panel_orientation(dsi->connector, dsi->orientation);
    +
    drm_connector_attach_encoder(dsi->connector, &dsi->encoder);

    return 0;
    @@ -836,6 +841,14 @@ static int mtk_dsi_bind(struct device *dev, struct device *master, void *data)
    int ret;
    struct drm_device *drm = data;
    struct mtk_dsi *dsi = dev_get_drvdata(dev);
    + struct drm_panel *panel;
    +
    + /* Read panel orientation if existed */
    + dsi->orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
    + ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, &panel, NULL);
    + if (!ret && panel && panel->dev) {
    + of_drm_get_panel_orientation(panel->dev->of_node, &dsi->orientation);
    + }

    ret = mtk_dsi_encoder_init(drm, dsi);
    if (ret)
    --
    2.36.1.124.g0e6072fb45-goog
    \
     
     \ /
      Last update: 2022-05-30 13:33    [W:3.296 / U:0.132 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site