From patchwork Mon Nov 22 07:06:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1788 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0FA953F02E for ; Mon, 22 Nov 2021 08:06:48 +0100 (CET) Received: by mail-pj1-f72.google.com with SMTP id lj10-20020a17090b344a00b001a653d07ad8sf11514103pjb.3 for ; Sun, 21 Nov 2021 23:06:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564806; cv=pass; d=google.com; s=arc-20160816; b=Az3DtcnSn2Bq3HgwaHvTtxfN75dlJjKqQte8VtohEuPMHnO0verBM84oMg6F+XqGxc /pIr/+G/kEIMu2799BAbXVvrd80Yh4q1kKG5aId/1VWRG9kOwi/w4qHm8fwpPNlVgUbC CJpq5b7PGmBzymuihZvNsyUhRbbNVxTke4Wp2PU2D8QkKHRKAg5DhHA18ak6AYJO/XV9 PbiEeeGkQ7wgBumdjUW5ncBrNZaqkVOaCGjfqAAcOksSOWRCok7AfOu8kqfMfv5Peu9E 43/WYbxEcDq1hPEeyZfbwT5wZSiima/KoZDEzyJFxvTlPU5oxXY8kzPdJWqkn0+Wq3L4 Gf4A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=yBB+/3HFOYIz6KydUuPJZPWsGjprkc2b7hTaND/MJxM=; b=hbKY2d7YeI5JVaBYKyXMcYNrvpSwW6+0HG1EQcC6m9kVB7zJRIVuI1mpenzDN24abF aohy7KhKweMXhZBWuBZv3wksddMd5aybve36q2QFlNzhJMVy/gWZj8GCWDxiRC6QGoZy FSbfFq5pk1wzizjMC6JshCz2j2WFS1eAIcq04l1XUAe4cplCvVlBL52K8zm9pjuk760g yplb4EnaQEp4ilDp7VFNv00P+/0ZcwcW57lRFbz4e9V/fQRkzf77kXpn8L1gA4NmcJj7 sOegGUhu3//IAvGwpdasenVxG8JF7d97k78eYfxJQ6hYKyLWl00ZUbTH1TSqDsc1DjHs 69gA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UXfL6OqF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=yBB+/3HFOYIz6KydUuPJZPWsGjprkc2b7hTaND/MJxM=; b=k5ybUOWt87VbiqDZvtKBftrRbroGoEGPSLWyBPwtKC0iCe1PDPHK8lm6p/xuDW5k1m ICusGdkR/QMytNv2RwAmcJLWOzhM7AGfAAKZDBt//QiHbRBGyWlXaPiOf6tQcbi4C2zx uasa1vDxRPqvtzvHw6FrVMLjG1LAPUGhw9VkU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=yBB+/3HFOYIz6KydUuPJZPWsGjprkc2b7hTaND/MJxM=; b=MDf9QFFa6rh+5QO/iImFJsldpDS3QymzlQTcA4+4wK8b4pa/t5eFoDCwRlZLuPKfGT qd/7xvK9P/eTogY+CQB1F2ATxW4kL3kQN5eBxOlL/lFIxyF7I7ZUQrE2CzFxGYf6zyQx Us7xIpQV23wxnNdqAFyZjtfwsUCiaXR1oWNxtDDSboOQXWMp376uee+S8xzqO6ZHGiz1 3QYeL0/wAAEjigXaDLvkgotV/rqb2OE6Z0Zp2dLYbJAVm4KwHEQHllg4b+Md+LvIJYhe QpksS+9dWZ4QIkXsGBtHcT0LtnbVkYqTVX1P209L30dGy7br6D+1mkMuTeTLG0ezuQyh iHmg== X-Gm-Message-State: AOAM532+cFYeov7sgYLe6ungwSl3+lAnE7mCit7i1+OrYmSlMInhDcEN Wg/1ocLZV4H1kD2gL4ltty+uQUtY X-Google-Smtp-Source: ABdhPJxQYS85l4MUkyK2GqH74BHt6k0ilagVgR+3OOleRLNZIQ9bEa3eHBgFfCo11lwLmGM6BGjtww== X-Received: by 2002:a17:90b:314c:: with SMTP id ip12mr28755477pjb.162.1637564806807; Sun, 21 Nov 2021 23:06:46 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:a03:: with SMTP id p3ls2408612pfh.0.gmail; Sun, 21 Nov 2021 23:06:46 -0800 (PST) X-Received: by 2002:a63:3f46:: with SMTP id m67mr32285539pga.179.1637564806116; Sun, 21 Nov 2021 23:06:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564806; cv=none; d=google.com; s=arc-20160816; b=W450MQptAjLngwx7ZVjIgGXmI7Aoep6gYMpMAVKsNQXVLrGvWbg7JmHTNRlxfySPHB hwzhS/u204tGKF/bHN88XgoOKSwVsE9CosNRDByHkVP3du7idsrhLgOp4NdYbjimXO81 KqlkqcxyUDHA22ezR+3O0rj1icb44hXGqf1FUh1kffvYYE+uIa6g3ySct2/wjJLSpxq2 L6uKZq/26P9nishxbxTA/jxyKJSp6I/FhxNdMcFf5YNPaOWe54QE/gM1GbCnTeGLlH0C dSwALeLqb0J9yFe5X6q0AYtU6TQasgSS65VnvP91gzDJSDzCynxgdpExWmShtKTWdQv2 PdAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0XFk49kXXNRFvrMfM7DSwlxpV7kXg9JtcjoCJwRHxZ8=; b=bjpZlyEudBUeDwLkpOEuyhkJI7zVexb2suaeWmIWCb8sttKxMC3E4biX4AdEeJQnv9 8RHffjPB5Hpa4kKZfs4qlpZZ6cSqyCb10GIPi3fo/zvF/awAy9eSGCIWu+ugnHAbVaEz cbKPCVoGySAh1foe5yrnwgeAPtbW16mTd7mMUrAJBpF9dhwsABNhEXjtcZOspB4mvW0R Yj7qNOx3OX+l2daWrk1GbXP5H1uiW/tl+FoGqDJs78oNcd7XMt6C5EWnLh9gJkrhlQ5v 3Ba7SkHNt5QBsNvoMZHrv8RouHqaT8dQvyX2orTwEZQOtI9yiJJlnQWomFdNUU9VVJFf zjJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UXfL6OqF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id jx1sor3631627pjb.36.2021.11.21.23.06.46 for (Google Transport Security); Sun, 21 Nov 2021 23:06:46 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90b:4f86:: with SMTP id qe6mr28359243pjb.198.1637564805820; Sun, 21 Nov 2021 23:06:45 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id s38sm4513088pga.40.2021.11.21.23.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 23:06:45 -0800 (PST) From: Jagan Teki To: Inki Dae , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 1/2] drm: exynos: dsi: Convert to bridge driver Date: Mon, 22 Nov 2021 12:36:32 +0530 Message-Id: <20211122070633.89219-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122070633.89219-1-jagan@amarulasolutions.com> References: <20211122070633.89219-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UXfL6OqF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Some display panels would come up with a non-DSI output, those can have an option to connect the DSI host by means of interface bridge converter. This DSI to non-DSI interface bridge converter would requires DSI Host to handle drm bridge functionalities in order to DSI Host to Interface bridge. This patch convert the existing to a drm bridge driver with a built-in encoder support for compatibility with existing component drivers. Signed-off-by: Jagan Teki --- Note: Hi Marek Szyprowski, Please test this on Panel and Bridge hardware. drivers/gpu/drm/exynos/exynos_drm_dsi.c | 73 +++++++++++++++++-------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 8d137857818c..174590f543c3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -257,6 +257,7 @@ struct exynos_dsi { struct drm_connector connector; struct drm_panel *panel; struct list_head bridge_chain; + struct drm_bridge bridge; struct drm_bridge *out_bridge; struct device *dev; @@ -287,9 +288,9 @@ struct exynos_dsi { #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host) #define connector_to_dsi(c) container_of(c, struct exynos_dsi, connector) -static inline struct exynos_dsi *encoder_to_dsi(struct drm_encoder *e) +static inline struct exynos_dsi *bridge_to_dsi(struct drm_bridge *b) { - return container_of(e, struct exynos_dsi, encoder); + return container_of(b, struct exynos_dsi, bridge); } enum reg_idx { @@ -1374,9 +1375,10 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) } } -static void exynos_dsi_enable(struct drm_encoder *encoder) +static void exynos_dsi_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { - struct exynos_dsi *dsi = encoder_to_dsi(encoder); + struct exynos_dsi *dsi = bridge_to_dsi(bridge); struct drm_bridge *iter; int ret; @@ -1399,7 +1401,8 @@ static void exynos_dsi_enable(struct drm_encoder *encoder) list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->pre_enable) - iter->funcs->pre_enable(iter); + iter->funcs->atomic_pre_enable(iter, + old_bridge_state); } } @@ -1413,7 +1416,7 @@ static void exynos_dsi_enable(struct drm_encoder *encoder) } else { list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->enable) - iter->funcs->enable(iter); + iter->funcs->atomic_enable(iter, old_bridge_state); } } @@ -1429,9 +1432,10 @@ static void exynos_dsi_enable(struct drm_encoder *encoder) pm_runtime_put(dsi->dev); } -static void exynos_dsi_disable(struct drm_encoder *encoder) +static void exynos_dsi_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { - struct exynos_dsi *dsi = encoder_to_dsi(encoder); + struct exynos_dsi *dsi = bridge_to_dsi(bridge); struct drm_bridge *iter; if (!(dsi->state & DSIM_STATE_ENABLED)) @@ -1443,7 +1447,7 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->disable) - iter->funcs->disable(iter); + iter->funcs->atomic_disable(iter, old_bridge_state); } exynos_dsi_set_display_enable(dsi, false); @@ -1451,7 +1455,7 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->post_disable) - iter->funcs->post_disable(iter); + iter->funcs->atomic_post_disable(iter, old_bridge_state); } dsi->state &= ~DSIM_STATE_ENABLED; @@ -1494,9 +1498,9 @@ static const struct drm_connector_helper_funcs exynos_dsi_connector_helper_funcs .get_modes = exynos_dsi_get_modes, }; -static int exynos_dsi_create_connector(struct drm_encoder *encoder) +static int exynos_dsi_create_connector(struct exynos_dsi *dsi) { - struct exynos_dsi *dsi = encoder_to_dsi(encoder); + struct drm_encoder *encoder = &dsi->encoder; struct drm_connector *connector = &dsi->connector; struct drm_device *drm = encoder->dev; int ret; @@ -1522,9 +1526,21 @@ static int exynos_dsi_create_connector(struct drm_encoder *encoder) return 0; } -static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = { - .enable = exynos_dsi_enable, - .disable = exynos_dsi_disable, +static int exynos_dsi_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct exynos_dsi *dsi = bridge_to_dsi(bridge); + + return drm_bridge_attach(bridge->encoder, dsi->out_bridge, NULL, 0); +} + +static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_enable = exynos_dsi_atomic_enable, + .atomic_disable = exynos_dsi_atomic_disable, + .attach = exynos_dsi_attach, }; MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); @@ -1543,7 +1559,7 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, dsi->out_bridge = out_bridge; list_splice_init(&encoder->bridge_chain, &dsi->bridge_chain); } else { - int ret = exynos_dsi_create_connector(encoder); + int ret = exynos_dsi_create_connector(dsi); if (ret) { DRM_DEV_ERROR(dsi->dev, @@ -1596,7 +1612,7 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host, if (dsi->panel) { mutex_lock(&drm->mode_config.mutex); - exynos_dsi_disable(&dsi->encoder); + exynos_dsi_atomic_disable(&dsi->bridge, NULL); dsi->panel = NULL; dsi->connector.status = connector_status_disconnected; mutex_unlock(&drm->mode_config.mutex); @@ -1702,12 +1718,16 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); - drm_encoder_helper_add(encoder, &exynos_dsi_encoder_helper_funcs); - ret = exynos_drm_set_possible_crtcs(encoder, EXYNOS_DISPLAY_TYPE_LCD); if (ret < 0) return ret; + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0); + if (ret) { + drm_encoder_cleanup(&dsi->encoder); + return ret; + } + in_bridge_node = of_graph_get_remote_node(dev->of_node, DSI_PORT_IN, 0); if (in_bridge_node) { in_bridge = of_drm_find_bridge(in_bridge_node); @@ -1723,10 +1743,9 @@ static void exynos_dsi_unbind(struct device *dev, struct device *master, void *data) { struct exynos_dsi *dsi = dev_get_drvdata(dev); - struct drm_encoder *encoder = &dsi->encoder; - - exynos_dsi_disable(encoder); + exynos_dsi_atomic_disable(&dsi->bridge, NULL); + drm_encoder_cleanup(&dsi->encoder); mipi_dsi_host_unregister(&dsi->dsi_host); } @@ -1819,6 +1838,12 @@ static int exynos_dsi_probe(struct platform_device *pdev) pm_runtime_enable(dev); + dsi->bridge.funcs = &exynos_dsi_bridge_funcs; + dsi->bridge.of_node = dev->of_node; + dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; + + drm_bridge_add(&dsi->bridge); + ret = component_add(dev, &exynos_dsi_component_ops); if (ret) goto err_disable_runtime; @@ -1833,6 +1858,10 @@ static int exynos_dsi_probe(struct platform_device *pdev) static int exynos_dsi_remove(struct platform_device *pdev) { + struct exynos_dsi *dsi = platform_get_drvdata(pdev); + + drm_bridge_remove(&dsi->bridge); + pm_runtime_disable(&pdev->dev); component_del(&pdev->dev, &exynos_dsi_component_ops); From patchwork Mon Nov 22 07:06:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1789 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 343943F02E for ; Mon, 22 Nov 2021 08:06:52 +0100 (CET) Received: by mail-pg1-f200.google.com with SMTP id o11-20020a635a0b000000b00320daef2ad6sf1620411pgb.3 for ; Sun, 21 Nov 2021 23:06:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564811; cv=pass; d=google.com; s=arc-20160816; b=F/dbYwm8hULYHMS1AgA1WQSxbTqnMRw9JtdW/Mx2GpKxhYKfyr59iOTVYITa0+X5YI sKaPV67xOwtQi+p6uNLoA1fpLEai2TDzradwPePU8Fortcq6VvC9bMBnidoeXvtGXwYu x4ZHim952keX3LL8F6pS8FRH/P14K8p27KjE5qsBeztMl5p3Kcd2qJp/ECnYIMsdLNqW 8KecEqbjk6kvKzn588LVNxWIW9EKxLZSBqejc5GtsvDNA3nJVGm3aCOaVC+Mmvd99lPM 6NXJKCBUU2c8Hr5d4OaOJ5FrmBCNjqYH6oV9QPiHq/IzSKFEZ3ZRWMTZFccDaXFYUG4c Kbsw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=lm6qWCJxCMQxfilE2CQaptRT97r0I95hAmO4A/CejTM=; b=SIJss+NIyllnVgzhqbRfFWQcO8LTHiNu97z1efFQ5ulOOJwl/FovevaOd4pa8gRleq piWRSDJB81v7e7DgnXHLImYIOzYFpZEE0XKo7ioBp1SutlU06dw0Py5PypMoN4NM9g8d vlzK5MuOGMa3WzS4hD4b/XFVuru+xdUFuksP1GtZB0L9tvSaoTRqiEk7vWFSEDihe6iM HPUrargNJxz9AY0NnKNnj2V6CX6EZmSoDkQUPzSyItq/gJ4JVirM5+Kkqd0OnGQb3ais qD5r5q3a78tCwV/sfDAkJMKj1ytMOvPerSff8SdKqEN73nXne7qP8xtwAyHS3+OtweVq v03A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="CmfVID/j"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=lm6qWCJxCMQxfilE2CQaptRT97r0I95hAmO4A/CejTM=; b=kW3rfMWUS+x8c75HsujMnNf4u+aohWRBGUVvpBbE/aazonSR8+7gtkCM2DiEyP5IMG u1R6WuOrzamElHg12Q27S/IVOGy0N/jZUfVlS3w5dFOpJTHcWSFnMTV8OblFbZ8700ng GhVJSFZk3dxFOs4usYXp3lXP0hPqsHNyiGeA8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=lm6qWCJxCMQxfilE2CQaptRT97r0I95hAmO4A/CejTM=; b=a+LFR4sCr3zvcwnVtL9x3y/+JcARzQ2OJlI4aCJ4JY8ZICZrMzNGF+Bu+q+TukegXf MiMv2gMhuOPuFhnjcNeiZuCERUol24JKYL6qT0pwkHsVKORTGD7+SmSLac22j6vKZU/q dAmEvV/RhGE+sfoUCEg67VFofmuaOmi3wCfbKBsdqdvb891OVhogLecuQ1BYCNMG5Wql iN61qGEnUGEUYr+AKyYI/9hYq+varNLVjUAvQ9Tolrl3MKxHNI6yz4UpdpC98vRAQTiv C6d90Mp+atgmG+GiSPouBqsPPjvzcsyWARIpafD0YoOWM3vys9VELvVPWzCC9qXyukj9 2s8w== X-Gm-Message-State: AOAM533XGA72gsbczB2yCjCpKdqijbZtDqhDE3Oc0gi2h1nMd775C7BP Y21Z8PSJvPM5ymt/GXNu07f+/Qie X-Google-Smtp-Source: ABdhPJwav19SkPK+tC1256myVSZX1oJbp+8wTufv0KUnuEj09DMwPBqTO5xolGSyeccnomynXGfBOA== X-Received: by 2002:a17:902:e302:b0:141:af98:b5ea with SMTP id q2-20020a170902e30200b00141af98b5eamr104503297plc.53.1637564810759; Sun, 21 Nov 2021 23:06:50 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:1a8a:: with SMTP id ng10ls9822795pjb.1.canary-gmail; Sun, 21 Nov 2021 23:06:50 -0800 (PST) X-Received: by 2002:a17:90a:f002:: with SMTP id bt2mr27445168pjb.221.1637564810042; Sun, 21 Nov 2021 23:06:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564810; cv=none; d=google.com; s=arc-20160816; b=a7rRJU1TMcHg/oon93g7Y34Dehqi70xPaQb9IOIAvXcZmG5HiTD52HWb+rs+AVVZyA 478VqkU6FGGpCd6v4muVrcP5waWSg8usWJdLRwdzSawFZHowUYSnzNi+k1KfTRijLESA 6FCQvHfCCTzV4iSSCqZpZVOKmfJoDo/RWR8xSyp/OETEtGa2ahyJHveplRoPFQzaSugA xf692221BjqcacNG+4tTdLMqF7uts7kE7ybcfMJnaCcYzuIYjj81eE9+xL1ddncWXhjI +SYuoFkPlPJs6+VI3oAj72NYri5sA6ZYwzcuHHwVIdnV3wSFAuAI6wIgOdR/64QiGkH9 l5Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=/cqfcIxXfPPStz8jh4GDehcd24IAIui/mi+x2MPB/aQ=; b=iEplmiQStOy9k+0+9qY64YNGHkNpORVv7YkKzR+PRnNXKDihPvxY1UqMmwYqKWuy+t Td8FfEfTdB7KIbBiq8llyfgA1GWJ1GHncvzD1RFM5ekpKcDQyK1h4+DhIgGgriumNocZ znuepuH2OhseV+65M6OELlqbGrRwKPeQ0qjJx5Y0KpS6xMffXV2J/liUkTx4WPt2bdAp 1F5+DsEiDpFMJEfHsfDmZkJ4mzjYEyStJ9bS5yeGPX0MIQ8ZW2BDywDVV7BqGwevQv3L LbPJ4G4iGZ6rwWOW1iffW8DhZcQTgQ/aTtfmreNAT9+qfxqgdryfRS2Fmu3dG/9uujy9 0qRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="CmfVID/j"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 198sor2008222pgc.69.2021.11.21.23.06.49 for (Google Transport Security); Sun, 21 Nov 2021 23:06:49 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a63:600c:: with SMTP id u12mr23978058pgb.16.1637564809393; Sun, 21 Nov 2021 23:06:49 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id s38sm4513088pga.40.2021.11.21.23.06.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 23:06:49 -0800 (PST) From: Jagan Teki To: Inki Dae , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 2/2] drm: exynos: dsi: Add mode_set function Date: Mon, 22 Nov 2021 12:36:33 +0530 Message-Id: <20211122070633.89219-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122070633.89219-1-jagan@amarulasolutions.com> References: <20211122070633.89219-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="CmfVID/j"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Get the display mode settings via mode_set bridge function instead of explicitly de-reference. Signed-off-by: Jagan Teki Reviewed-by: Robert Foss --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 174590f543c3..3d4713346949 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -260,6 +260,7 @@ struct exynos_dsi { struct drm_bridge bridge; struct drm_bridge *out_bridge; struct device *dev; + struct drm_display_mode mode; void __iomem *reg_base; struct phy *phy; @@ -883,7 +884,7 @@ static int exynos_dsi_init_link(struct exynos_dsi *dsi) static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi) { - struct drm_display_mode *m = &dsi->encoder.crtc->state->adjusted_mode; + struct drm_display_mode *m = &dsi->mode; unsigned int num_bits_resol = dsi->driver_data->num_bits_resol; u32 reg; @@ -1526,6 +1527,15 @@ static int exynos_dsi_create_connector(struct exynos_dsi *dsi) return 0; } +static void exynos_dsi_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) +{ + struct exynos_dsi *dsi = bridge_to_dsi(bridge); + + drm_mode_copy(&dsi->mode, adjusted_mode); +} + static int exynos_dsi_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { @@ -1540,6 +1550,7 @@ static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = exynos_dsi_atomic_enable, .atomic_disable = exynos_dsi_atomic_disable, + .mode_set = exynos_dsi_mode_set, .attach = exynos_dsi_attach, };