From patchwork Sun Jul 4 09:02:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6434BC07E96 for ; Sun, 4 Jul 2021 09:04:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4B8B561935 for ; Sun, 4 Jul 2021 09:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229535AbhGDJGv (ORCPT ); Sun, 4 Jul 2021 05:06:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbhGDJGu (ORCPT ); Sun, 4 Jul 2021 05:06:50 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1EAEC061762 for ; Sun, 4 Jul 2021 02:04:15 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id u14so15014975pga.11 for ; Sun, 04 Jul 2021 02:04:15 -0700 (PDT) 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:content-transfer-encoding; bh=ULOrrFdhV/JTWgnzBXDJOCdsNgP87Dvucp1qYGDm5tE=; b=mVez0iKrR8JkDZCsuuGyPUIeJfGRmnxaLG48W8d3iMV2JtJ75Sit1vKpGLre6AYJMX +xi/XL2hfIAHmw9N/c9n4jfSgE5UB1G4S+k9vYY7sh0Zdo/LPYSTL16rkcLHDo8Sy1Nj 3pjYB0B3O8/s0bH08IAFNcb2iMShNT6pPVrwE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ULOrrFdhV/JTWgnzBXDJOCdsNgP87Dvucp1qYGDm5tE=; b=QJ8roKRCQ0l3bPoqfDIShpsYVOkVD8CACCAe6Grnu6iWFujW61+7ZFscFgSwiZJHgP uKdTw3ooFgTmSJEwhk4vPhYFPskgX+M5GMX07/luq2AR+ok0zSxMM7rJAVCnFBw09262 eFm5yOOjgYPOK+tMreLT4ylXgL0LCa1bvDiSl0V1MicWPK1U4kWi07xgRejlCNwy78FA ffxY2/32ITksGKwLIMTLepQei0+sqc7lDLBY8NzZIYkXcieiYONQh2vyNnKaCAISjMvP jMa+OVutqsr35A75XLroEOyLp2aLxXztwf5c2C3z71L49R5/WdGWwG+9ENIJqrawNVP1 Ubzw== X-Gm-Message-State: AOAM530+oqXoCWVX2oYohXLYKq0Zr4No5rNdDdaQRP6SuLXtbgWqz2vL 5Wb+3c5DRLIAoEP1evol8CHzoA== X-Google-Smtp-Source: ABdhPJw2Aj31gRqGFn/A6dWgX//TnNexKTHNHi9LK+Y07kgH9PAhz1sT2jvQ/AGUmlJHXDM9lT0+iQ== X-Received: by 2002:a63:f44e:: with SMTP id p14mr9404229pgk.143.1625389455525; Sun, 04 Jul 2021 02:04:15 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:04:15 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 01/17] drm/exynos: dsi: Convert to bridge driver Date: Sun, 4 Jul 2021 14:32:14 +0530 Message-Id: <20210704090230.26489-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org DRM bridge drivers have built-in handling of treating all display pipeline components as bridges. Convert exynos_drm_dsi to a bridge driver with built-in encoder support for compatibility with existing component drivers. This keeps switching the driver into the bridge in a more feasible manner. Signed-off-by: Jagan Teki --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 57 +++++++++++++++++-------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 1d777d8c1a83..90d2ce2c3055 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,9 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) } } -static void exynos_dsi_enable(struct drm_encoder *encoder) +static void exynos_dsi_bridge_enable(struct drm_bridge *bridge) { - struct exynos_dsi *dsi = encoder_to_dsi(encoder); + struct exynos_dsi *dsi = bridge_to_dsi(bridge); struct drm_bridge *iter; int ret; @@ -1429,9 +1430,9 @@ 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_bridge_disable(struct drm_bridge *bridge) { - 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)) @@ -1494,9 +1495,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 +1523,16 @@ 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_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + return 0; +} + +static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { + .enable = exynos_dsi_bridge_enable, + .disable = exynos_dsi_bridge_disable, + .attach = exynos_dsi_bridge_attach, }; MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); @@ -1543,7 +1551,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 +1604,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_bridge_disable(&dsi->bridge); dsi->panel = NULL; dsi->connector.status = connector_status_disconnected; mutex_unlock(&drm->mode_config.mutex); @@ -1702,12 +1710,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 +1735,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_bridge_disable(&dsi->bridge); + drm_encoder_cleanup(&dsi->encoder); mipi_dsi_host_unregister(&dsi->dsi_host); } @@ -1821,6 +1832,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; @@ -1835,6 +1852,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 Sun Jul 4 09:02:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDEB1C07E95 for ; Sun, 4 Jul 2021 09:04:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C59CA61090 for ; Sun, 4 Jul 2021 09:04:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbhGDJHE (ORCPT ); Sun, 4 Jul 2021 05:07:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbhGDJHD (ORCPT ); Sun, 4 Jul 2021 05:07:03 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0992C061762 for ; Sun, 4 Jul 2021 02:04:28 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id b5so8440727plg.2 for ; Sun, 04 Jul 2021 02:04:28 -0700 (PDT) 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:content-transfer-encoding; bh=YYvjehx8GEd3VqeKDnJWcND/IGzW5rqaRSV1TBb6rec=; b=FpsLt0e/gEh/TsvI+PQqq8HHbShAeGPxizZN1+ZrblR37mi0TM659pulHef70Ns14S 8X6vyrvesg7AHKh9ZkUfZQLV+XDG+dM/yFMJEMsjOLyxGmNfyi0qiWcJgiLXNfkY89It 8TjMAPrpk1Rhy9wwxEHf5x5z/iXdENX7zmQXE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YYvjehx8GEd3VqeKDnJWcND/IGzW5rqaRSV1TBb6rec=; b=C1pgl/ru5mdn7gsKBIRUezR/pA+pDrfoDXPRO3qM7veepF9+xTw/mYaUmET0nTORWh kzPQHJrWP14C4cFmtScnEE/s0QkHD4WKDOQuWo7FlJI5hBsvl+3EI/9kqOMh+bRQCjf5 tQBTJSJRnXTb33xcvz6NSCXJNA6WrVUULcrwtgOqGVPSkNWPRhowMW3r7cuB18wW3aCg 6VAozLm3plRwTv7VL9pWanwsO/A28PcKm7bE2luawH/BhW1wFHMB2QRIaB36BKkGDinr Iuk58+SN2lBJa1T2fCRE5CmXuk1TZMrgQCs68/vpYNO5JDYzf+Ke5r4UegvGrjM90fPY 13Dw== X-Gm-Message-State: AOAM531oBiWa3Ck3akvyCCk7mhRh8o4lqcFd0pHSh3wEvks8t9WD9IJv f9ShUAUGJGhoVmSYaZc0PhwUTg== X-Google-Smtp-Source: ABdhPJyNCzxsA9x9Vp0nNEO5H/xrDOauiajqjc3ZOIcheU67qLC4rDoFfVlAWPvVqLulg93qjiTGfg== X-Received: by 2002:a17:90a:7843:: with SMTP id y3mr8584990pjl.190.1625389468533; Sun, 04 Jul 2021 02:04:28 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.04.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:04:28 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 03/17] drm/exynos: dsi: Use the drm_panel_bridge API Date: Sun, 4 Jul 2021 14:32:16 +0530 Message-Id: <20210704090230.26489-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Use drm_panel_bridge to replace manual panel and bridge_chain handling code. This makes the driver simpler to allow all components in the display pipeline to be treated as bridges by cleaning the way to generic connector handling. Signed-off-by: Jagan Teki --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 167 ++++-------------------- 1 file changed, 23 insertions(+), 144 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index d7d60aee465b..24f0b082ac6d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -254,9 +254,6 @@ struct exynos_dsi_driver_data { struct exynos_dsi { struct drm_encoder encoder; struct mipi_dsi_host dsi_host; - struct drm_connector connector; - struct drm_panel *panel; - struct list_head bridge_chain; struct drm_bridge bridge; struct drm_bridge *out_bridge; struct drm_device *drm; @@ -287,7 +284,6 @@ 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 *bridge_to_dsi(struct drm_bridge *b) { @@ -1379,7 +1375,6 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) static void exynos_dsi_bridge_enable(struct drm_bridge *bridge) { struct exynos_dsi *dsi = bridge_to_dsi(bridge); - struct drm_bridge *iter; int ret; if (dsi->state & DSIM_STATE_ENABLED) @@ -1393,134 +1388,51 @@ static void exynos_dsi_bridge_enable(struct drm_bridge *bridge) dsi->state |= DSIM_STATE_ENABLED; - if (dsi->panel) { - ret = drm_panel_prepare(dsi->panel); - if (ret < 0) - goto err_put_sync; - } else { - list_for_each_entry_reverse(iter, &dsi->bridge_chain, - chain_node) { - if (iter->funcs->pre_enable) - iter->funcs->pre_enable(iter); - } - } - exynos_dsi_set_display_mode(dsi); exynos_dsi_set_display_enable(dsi, true); - if (dsi->panel) { - ret = drm_panel_enable(dsi->panel); - if (ret < 0) - goto err_display_disable; - } else { - list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->enable) - iter->funcs->enable(iter); - } - } - dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE; return; - -err_display_disable: - exynos_dsi_set_display_enable(dsi, false); - drm_panel_unprepare(dsi->panel); - -err_put_sync: - dsi->state &= ~DSIM_STATE_ENABLED; - pm_runtime_put(dsi->dev); } static void exynos_dsi_bridge_disable(struct drm_bridge *bridge) { struct exynos_dsi *dsi = bridge_to_dsi(bridge); - struct drm_bridge *iter; if (!(dsi->state & DSIM_STATE_ENABLED)) return; dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; - drm_panel_disable(dsi->panel); - - list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->disable) - iter->funcs->disable(iter); - } - exynos_dsi_set_display_enable(dsi, false); - drm_panel_unprepare(dsi->panel); - - list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->post_disable) - iter->funcs->post_disable(iter); - } dsi->state &= ~DSIM_STATE_ENABLED; pm_runtime_put_sync(dsi->dev); } -static enum drm_connector_status -exynos_dsi_detect(struct drm_connector *connector, bool force) -{ - return connector->status; -} - -static void exynos_dsi_connector_destroy(struct drm_connector *connector) +static int exynos_dsi_panel_or_bridge(struct exynos_dsi *dsi, + struct device_node *node) { - drm_connector_unregister(connector); - drm_connector_cleanup(connector); - connector->dev = NULL; -} - -static const struct drm_connector_funcs exynos_dsi_connector_funcs = { - .detect = exynos_dsi_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = exynos_dsi_connector_destroy, - .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 int exynos_dsi_get_modes(struct drm_connector *connector) -{ - struct exynos_dsi *dsi = connector_to_dsi(connector); - - if (dsi->panel) - return drm_panel_get_modes(dsi->panel, connector); - - return 0; -} + struct drm_bridge *panel_bridge; + struct drm_panel *panel; -static const struct drm_connector_helper_funcs exynos_dsi_connector_helper_funcs = { - .get_modes = exynos_dsi_get_modes, -}; + panel_bridge = of_drm_find_bridge(node); + if (!panel_bridge) { + panel = of_drm_find_panel(node); + if (!IS_ERR(panel)) { + panel_bridge = drm_panel_bridge_add(panel); + if (IS_ERR(panel_bridge)) + return PTR_ERR(panel_bridge); + } + } -static int exynos_dsi_create_connector(struct exynos_dsi *dsi, - struct drm_device *drm) -{ - struct drm_encoder *encoder = &dsi->encoder; - struct drm_connector *connector = &dsi->connector; - int ret; + of_node_put(node); - connector->polled = DRM_CONNECTOR_POLL_HPD; + dsi->out_bridge = panel_bridge; - ret = drm_connector_init(drm, connector, &exynos_dsi_connector_funcs, - DRM_MODE_CONNECTOR_DSI); - if (ret) { - DRM_DEV_ERROR(dsi->dev, - "Failed to initialize connector with drm\n"); - return ret; - } + if (!dsi->out_bridge) + return -EPROBE_DEFER; - connector->status = connector_status_disconnected; - drm_connector_helper_add(connector, &exynos_dsi_connector_helper_funcs); - drm_connector_attach_encoder(connector, encoder); - if (!drm->registered) - return 0; - - connector->funcs->reset(connector); - drm_connector_register(connector); return 0; } @@ -1531,7 +1443,8 @@ static int exynos_dsi_bridge_attach(struct drm_bridge *bridge, dsi->drm = bridge->dev; - return 0; + return drm_bridge_attach(bridge->encoder, dsi->out_bridge, bridge, + flags); } static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { @@ -1546,32 +1459,12 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct exynos_dsi *dsi = host_to_dsi(host); - struct drm_encoder *encoder = &dsi->encoder; struct drm_device *drm = dsi->drm; - struct drm_bridge *out_bridge; - - out_bridge = of_drm_find_bridge(device->dev.of_node); - if (out_bridge) { - drm_bridge_attach(encoder, out_bridge, NULL, 0); - dsi->out_bridge = out_bridge; - list_splice_init(&encoder->bridge_chain, &dsi->bridge_chain); - } else { - int ret = exynos_dsi_create_connector(dsi, drm); - - if (ret) { - DRM_DEV_ERROR(dsi->dev, - "failed to create connector ret = %d\n", - ret); - drm_encoder_cleanup(encoder); - return ret; - } + int ret; - dsi->panel = of_drm_find_panel(device->dev.of_node); - if (IS_ERR(dsi->panel)) - dsi->panel = NULL; - else - dsi->connector.status = connector_status_connected; - } + ret = exynos_dsi_panel_or_bridge(dsi, device->dev.of_node); + if (ret) + return ret; /* * This is a temporary solution and should be made by more generic way. @@ -1607,19 +1500,6 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host, struct exynos_dsi *dsi = host_to_dsi(host); struct drm_device *drm = dsi->drm; - if (dsi->panel) { - mutex_lock(&drm->mode_config.mutex); - exynos_dsi_bridge_disable(&dsi->bridge); - dsi->panel = NULL; - dsi->connector.status = connector_status_disconnected; - mutex_unlock(&drm->mode_config.mutex); - } else { - if (dsi->out_bridge->funcs->detach) - dsi->out_bridge->funcs->detach(dsi->out_bridge); - dsi->out_bridge = NULL; - INIT_LIST_HEAD(&dsi->bridge_chain); - } - if (drm->mode_config.poll_enabled) drm_kms_helper_hotplug_event(drm); @@ -1770,7 +1650,6 @@ static int exynos_dsi_probe(struct platform_device *pdev) init_completion(&dsi->completed); spin_lock_init(&dsi->transfer_lock); INIT_LIST_HEAD(&dsi->transfer_list); - INIT_LIST_HEAD(&dsi->bridge_chain); dsi->dsi_host.ops = &exynos_dsi_ops; dsi->dsi_host.dev = dev; From patchwork Sun Jul 4 09:02:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9BC7C07E95 for ; Sun, 4 Jul 2021 09:04:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C2A59608FC for ; Sun, 4 Jul 2021 09:04:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbhGDJHQ (ORCPT ); Sun, 4 Jul 2021 05:07:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbhGDJHP (ORCPT ); Sun, 4 Jul 2021 05:07:15 -0400 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE9DCC061764 for ; Sun, 4 Jul 2021 02:04:40 -0700 (PDT) Received: by mail-pj1-x102c.google.com with SMTP id x21-20020a17090aa395b029016e25313bfcso9479654pjp.2 for ; Sun, 04 Jul 2021 02:04:40 -0700 (PDT) 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:content-transfer-encoding; bh=4/t/yuyJpK03/e85JwmT4sPri76hH2e7sinXKHn6Jm4=; b=PBfEFr1BFMVjj3B+E0cmJ2WWmRzElaTVeIW2FUDP67VEsqTV2t4doQ/laPx33w01ZZ QLkKZPLV88HMSQWHmWGqufXpWw6dHjL2B6Zf4xwMHSm8DB1Rh0y3enlxGz/w/DcGkIip tjR3OU0WtVrMK2ooLVJLQc1P87TGWNHy+uWHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4/t/yuyJpK03/e85JwmT4sPri76hH2e7sinXKHn6Jm4=; b=SZoGaiHUiLaREPNv0FeRqLTKwsfR5GBJB58olgh3Rg+2dzV23T2VYA45QUsh2PDvF/ ZZitM7q+1kcci25+HKQSDt+NM4035R7orLOlgsZ5Uv4WU2P9uI47cIrHhcWONaGntKWD WmUJBXqvLun/eSDMBl+b5EIg291MADEkrmdmqoONKKE8vTJe91/8tJya8khjILmjsDoI VbwwTxltvP7OvIQaHGYfQRDptdxW/T5lsK+kqVkAp85P30q40yCqCmtdBrsEOnLoVwIC zvk6rK6mW67mHp/+AJX86ls/itOem9vEN4PRvj53ODfFGKwcLokYLkroy72pS5Zfrpqe L4Dg== X-Gm-Message-State: AOAM532NamGwgIU99omHlHO4yjwUkpXYHqBLtgteVjsBcX0wy6E58I8f BPnIPidkF4/UwRHocE+tCbgPbw== X-Google-Smtp-Source: ABdhPJy77aPWv0aLk8PVV9lGvo6WZzNRAOw/jXfAWvLysS/qv7rPpqLNr9aOcMxLgr7szCl4Cxz56A== X-Received: by 2002:a17:90a:d598:: with SMTP id v24mr8316714pju.185.1625389480337; Sun, 04 Jul 2021 02:04:40 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:04:39 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 05/17] drm/exynos: dsi: Get the mode from bridge Date: Sun, 4 Jul 2021 14:32:18 +0530 Message-Id: <20210704090230.26489-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Now the exynos dsi driver is fully aware of bridge handling, so get the display mode from bridge, mode_set API instead of legacy encoder crtc. This makes bridge usage more efficient instead of relying on encoder stack. Add mode_set in drm_bridge_funcs. Signed-off-by: Jagan Teki --- 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 d828be07c325..99a1b8c22313 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -275,6 +275,7 @@ struct exynos_dsi { u32 format; int state; + struct drm_display_mode mode; struct drm_property *brightness; struct completion completed; @@ -881,7 +882,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; @@ -1411,6 +1412,15 @@ static void exynos_dsi_bridge_disable(struct drm_bridge *bridge) pm_runtime_put_sync(dsi->dev); } +static void exynos_dsi_bridge_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_panel_or_bridge(struct exynos_dsi *dsi, struct device_node *node) { @@ -1451,6 +1461,7 @@ static int exynos_dsi_bridge_attach(struct drm_bridge *bridge, static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { .enable = exynos_dsi_bridge_enable, .disable = exynos_dsi_bridge_disable, + .mode_set = exynos_dsi_bridge_mode_set, .attach = exynos_dsi_bridge_attach, }; From patchwork Sun Jul 4 09:02:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-23.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28499C07E95 for ; Sun, 4 Jul 2021 09:04:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0FDD661090 for ; Sun, 4 Jul 2021 09:04:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbhGDJH3 (ORCPT ); Sun, 4 Jul 2021 05:07:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbhGDJH2 (ORCPT ); Sun, 4 Jul 2021 05:07:28 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB106C061762 for ; Sun, 4 Jul 2021 02:04:53 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id n11so9579984pjo.1 for ; Sun, 04 Jul 2021 02:04:53 -0700 (PDT) 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:content-transfer-encoding; bh=x8DbojDoEb5uY2A25IR0p63F/P/5IlsfDnb3J5qKSYc=; b=rEorpVedLG1oQSRSSrGYnCBfnLDbabcwXssx1B6hMLIqKt69o4ff788l87rMdxf/pp pwDtiBvQJtdNdVn/k8VG9HVHce/GFm8U/2ylCENloi5gRCYHqPLAN42Ji5H/paBAAaMr LXScI9ZNQLzeSwjkN8Sxf64eJQtK5noK3fuu0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x8DbojDoEb5uY2A25IR0p63F/P/5IlsfDnb3J5qKSYc=; b=pMY5HFaqiY+plqCDwSSzl2FCloFrreIEkgDgEGEvVwV2OQlVflq6YSTO3oIABaABIA gJrSWguJCnpf3RbLRqfRfJw+jaxTzFEAzs8mkgb7WZqAgLPhFjB6RGtPuKBH/T7q9HXQ Ksji9I26Ig+0vfBvLzSXxblSEfzrviTLNOEkB555XoliQB4HN/LYdWQZ4Am4xMQMTwjK VeIWjUZJds0XOzgNUDAg8t8QPBCN/Nay97Cz2xOc06/ySIgW5NBHtez9ZV2BTZz46DsI n2pcM5ckRDnsiTuiCilB74ouCvlkejb8yhzcxhDbxCCsu4BSvjEfx3kDUzy17IyzUX+s YukA== X-Gm-Message-State: AOAM531fmSC63HmFFdfmAiyE6l91axF3PxXmo3GpQQmedme/cwm0h1dC kiYFrd6He0r4uaOlb2ybkaBjkA== X-Google-Smtp-Source: ABdhPJzYYBARwzR5yMlFsILzXaBPaBOK0zUuORaq+uVPg1s53a5rVb2Ko/Qi+cQQksrJdZ+L3SbLmA== X-Received: by 2002:a17:90a:1d43:: with SMTP id u3mr8833730pju.121.1625389493174; Sun, 04 Jul 2021 02:04:53 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:04:52 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 07/17] drm: bridge: Move exynos_drm_dsi into bridges Date: Sun, 4 Jul 2021 14:32:20 +0530 Message-Id: <20210704090230.26489-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The MIPI DSI IP used in Exynos and i.MX8MM are based Samsung MIPI DSIM bridge.     In order to access the common bridge between platforms the ideal way to push the driver into the bridge area.     So, this patch will move the exynos_drm_dsi.c driver into samsung-dsim.c and do the necessary function name changes.     This would help to improve the bridge driver in future patches in order to make use of different SoC families and platforms. The bridge now support two implementations, A. With component_ops and exynos specific code exclusively for exynos dsi drivers and it's legacy bindings. B. Without componenet_ops for newly implemented bridges and its users like i.MX8MM. The future plan is to fix the implementation A) by dropping component_ops and fixing exynos specific code in order to make the bridge more mature to use. Updated MAINTAINERS file for this bridge with exynos drm maintainers along with Andrzej as he is the original author. Tomasz Figa has been not included in MAINTAINERS as he is not available via samsung.com. Signed-off-by: Jagan Teki --- MAINTAINERS | 11 + drivers/gpu/drm/bridge/Kconfig | 15 + drivers/gpu/drm/bridge/Makefile | 1 + .../samsung-dsim.c} | 433 +++++++++--------- drivers/gpu/drm/exynos/Kconfig | 9 - drivers/gpu/drm/exynos/Makefile | 1 - 6 files changed, 246 insertions(+), 224 deletions(-) rename drivers/gpu/drm/{exynos/exynos_drm_dsi.c => bridge/samsung-dsim.c} (77%) diff --git a/MAINTAINERS b/MAINTAINERS index cae0c6148590..733c2ebc0393 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5864,6 +5864,17 @@ T: git git://anongit.freedesktop.org/drm/drm-misc F: Documentation/devicetree/bindings/display/panel/samsung,lms397kf04.yaml F: drivers/gpu/drm/panel/panel-samsung-db7430.c +DRM DRIVER FOR SAMSUNG MIPI DSIM BRIDGE +M: Inki Dae +M: Joonyoung Shim +M: Seung-Woo Kim +M: Kyungmin Park +M: Andrzej Hajda +M: Jagan Teki +S: Maintained +T: git git://anongit.freedesktop.org/drm/drm-misc +F: drivers/gpu/drm/bridge/samsung-dsim.c + DRM DRIVER FOR SITRONIX ST7703 PANELS M: Guido Günther R: Purism Kernel Team diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 4de6dbb8821b..c8a3b13f730b 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -190,6 +190,21 @@ config DRM_PARADE_PS8640 The PS8640 is a high-performance and low-power MIPI DSI to eDP converter +config DRM_SAMSUNG_DSIM + tristate "Samsung MIPI DSIM bridge driver" + depends on DRM + depends on COMMON_CLK + depends on OF && HAS_IOMEM + depends on DRM_EXYNOS_FIMD || DRM_EXYNOS5433_DECON || DRM_EXYNOS7_DECON + select DRM_KMS_HELPER + select DRM_MIPI_DSI + select DRM_PANEL_BRIDGE + select REGMAP_MMIO + help + This enables the Samsung MIPI DSIM bridge controller driver. + This MIPI DSIM bridge can be found it on Exynos and NXP's + i.MX8M Mini and Nano SoC's. + config DRM_SIL_SII8620 tristate "Silicon Image SII8620 HDMI/MHL bridge" depends on OF diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index ec2b9fa2699e..1eb04e4857e5 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o obj-$(CONFIG_DRM_PARADE_PS8640) += parade-ps8640.o +obj-$(CONFIG_DRM_SAMSUNG_DSIM) += samsung-dsim.o obj-$(CONFIG_DRM_SIL_SII8620) += sil-sii8620.o obj-$(CONFIG_DRM_SII902X) += sii902x.o obj-$(CONFIG_DRM_SII9234) += sii9234.o diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/bridge/samsung-dsim.c similarity index 77% rename from drivers/gpu/drm/exynos/exynos_drm_dsi.c rename to drivers/gpu/drm/bridge/samsung-dsim.c index 53d878d4d2d7..eed6b3ffdea7 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1,11 +1,15 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Samsung SoC MIPI DSI Master driver. + * Samsung MIPI DSIM bridge driver. * + * Copyright (C) 2021 Amarula Solutions(India) * Copyright (c) 2014 Samsung Electronics Co., Ltd * - * Contacts: Tomasz Figa -*/ + * TODO: + * - Move or handle exynos specifics in exynos drm drivers stack. + * - Try to drop component_ops, but it indeed require to change + * exynos drm drivers stack. + */ #include #include @@ -33,8 +37,8 @@ #include #include -#include "exynos_drm_crtc.h" -#include "exynos_drm_drv.h" +#include "../exynos/exynos_drm_crtc.h" +#include "../exynos/exynos_drm_drv.h" /* returns true iff both arguments logically differs */ #define NEQV(a, b) (!(a) ^ !(b)) @@ -217,12 +221,12 @@ static const char *const clk_names[5] = { "bus_clk", "sclk_mipi", "phyclk_mipidphy0_bitclkdiv8", "phyclk_mipidphy0_rxclkesc0", "sclk_rgb_vclk_to_dsim0" }; -enum exynos_dsi_transfer_type { +enum samsung_dsim_transfer_type { EXYNOS_DSI_TX, EXYNOS_DSI_RX, }; -struct exynos_dsi_transfer { +struct samsung_dsim_transfer { struct list_head list; struct completion completed; int result; @@ -240,7 +244,7 @@ struct exynos_dsi_transfer { #define DSIM_STATE_CMD_LPM BIT(2) #define DSIM_STATE_VIDOUT_AVAILABLE BIT(3) -struct exynos_dsi_driver_data { +struct samsung_dsim_driver_data { const unsigned int *reg_ofs; unsigned int plltmr_reg; unsigned int has_freqband:1; @@ -253,7 +257,7 @@ struct exynos_dsi_driver_data { bool exynos_specific; }; -struct exynos_dsi { +struct samsung_dsim { struct drm_encoder encoder; struct mipi_dsi_host dsi_host; struct drm_bridge bridge; @@ -283,14 +287,14 @@ struct exynos_dsi { spinlock_t transfer_lock; /* protects transfer_list */ struct list_head transfer_list; - const struct exynos_dsi_driver_data *driver_data; + const struct samsung_dsim_driver_data *driver_data; }; -#define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host) +#define host_to_dsi(host) container_of(host, struct samsung_dsim, dsi_host) -static inline struct exynos_dsi *bridge_to_dsi(struct drm_bridge *b) +static inline struct samsung_dsim *bridge_to_dsi(struct drm_bridge *b) { - return container_of(b, struct exynos_dsi, bridge); + return container_of(b, struct samsung_dsim, bridge); } enum reg_idx { @@ -318,14 +322,14 @@ enum reg_idx { NUM_REGS }; -static inline void exynos_dsi_write(struct exynos_dsi *dsi, enum reg_idx idx, - u32 val) +static inline void samsung_dsim_write(struct samsung_dsim *dsi, enum reg_idx idx, + u32 val) { writel(val, dsi->reg_base + dsi->driver_data->reg_ofs[idx]); } -static inline u32 exynos_dsi_read(struct exynos_dsi *dsi, enum reg_idx idx) +static inline u32 samsung_dsim_read(struct samsung_dsim *dsi, enum reg_idx idx) { return readl(dsi->reg_base + dsi->driver_data->reg_ofs[idx]); } @@ -450,7 +454,7 @@ static const unsigned int exynos5433_reg_values[] = { [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), }; -static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = { +static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .reg_ofs = exynos_reg_ofs, .plltmr_reg = 0x50, .has_freqband = 1, @@ -463,7 +467,7 @@ static const struct exynos_dsi_driver_data exynos3_dsi_driver_data = { .exynos_specific = true, }; -static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = { +static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .reg_ofs = exynos_reg_ofs, .plltmr_reg = 0x50, .has_freqband = 1, @@ -476,7 +480,7 @@ static const struct exynos_dsi_driver_data exynos4_dsi_driver_data = { .exynos_specific = true, }; -static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = { +static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .reg_ofs = exynos_reg_ofs, .plltmr_reg = 0x58, .num_clks = 2, @@ -487,7 +491,7 @@ static const struct exynos_dsi_driver_data exynos5_dsi_driver_data = { .exynos_specific = true, }; -static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = { +static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { .reg_ofs = exynos5433_reg_ofs, .plltmr_reg = 0xa0, .has_clklane_stop = 1, @@ -499,7 +503,7 @@ static const struct exynos_dsi_driver_data exynos5433_dsi_driver_data = { .exynos_specific = true, }; -static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = { +static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .reg_ofs = exynos5433_reg_ofs, .plltmr_reg = 0xa0, .has_clklane_stop = 1, @@ -511,7 +515,7 @@ static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = { .exynos_specific = true, }; -static const struct of_device_id exynos_dsi_of_match[] = { +static const struct of_device_id samsung_dsim_of_match[] = { { .compatible = "samsung,exynos3250-mipi-dsi", .data = &exynos3_dsi_driver_data }, { .compatible = "samsung,exynos4210-mipi-dsi", @@ -525,7 +529,7 @@ static const struct of_device_id exynos_dsi_of_match[] = { { } }; -static void exynos_dsi_wait_for_reset(struct exynos_dsi *dsi) +static void samsung_dsim_wait_for_reset(struct samsung_dsim *dsi) { if (wait_for_completion_timeout(&dsi->completed, msecs_to_jiffies(300))) return; @@ -533,22 +537,22 @@ static void exynos_dsi_wait_for_reset(struct exynos_dsi *dsi) dev_err(dsi->dev, "timeout waiting for reset\n"); } -static void exynos_dsi_reset(struct exynos_dsi *dsi) +static void samsung_dsim_reset(struct samsung_dsim *dsi) { u32 reset_val = dsi->driver_data->reg_values[RESET_TYPE]; reinit_completion(&dsi->completed); - exynos_dsi_write(dsi, DSIM_SWRST_REG, reset_val); + samsung_dsim_write(dsi, DSIM_SWRST_REG, reset_val); } #ifndef MHZ #define MHZ (1000*1000) #endif -static unsigned long exynos_dsi_pll_find_pms(struct exynos_dsi *dsi, +static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi, unsigned long fin, unsigned long fout, u8 *p, u16 *m, u8 *s) { - const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; unsigned long best_freq = 0; u32 min_delta = 0xffffffff; u8 p_min, p_max; @@ -599,10 +603,10 @@ static unsigned long exynos_dsi_pll_find_pms(struct exynos_dsi *dsi, return best_freq; } -static unsigned long exynos_dsi_set_pll(struct exynos_dsi *dsi, - unsigned long freq) +static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi, + unsigned long freq) { - const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; unsigned long fin, fout; int timeout; u8 p, s; @@ -610,7 +614,7 @@ static unsigned long exynos_dsi_set_pll(struct exynos_dsi *dsi, u32 reg; fin = dsi->pll_clk_rate; - fout = exynos_dsi_pll_find_pms(dsi, fin, freq, &p, &m, &s); + fout = samsung_dsim_pll_find_pms(dsi, fin, freq, &p, &m, &s); if (!fout) { dev_err(dsi->dev, "failed to find PLL PMS for requested frequency\n"); @@ -641,7 +645,7 @@ static unsigned long exynos_dsi_set_pll(struct exynos_dsi *dsi, reg |= DSIM_FREQ_BAND(band); } - exynos_dsi_write(dsi, DSIM_PLLCTRL_REG, reg); + samsung_dsim_write(dsi, DSIM_PLLCTRL_REG, reg); timeout = 1000; do { @@ -649,19 +653,19 @@ static unsigned long exynos_dsi_set_pll(struct exynos_dsi *dsi, dev_err(dsi->dev, "PLL failed to stabilize\n"); return 0; } - reg = exynos_dsi_read(dsi, DSIM_STATUS_REG); + reg = samsung_dsim_read(dsi, DSIM_STATUS_REG); } while ((reg & DSIM_PLL_STABLE) == 0); return fout; } -static int exynos_dsi_enable_clock(struct exynos_dsi *dsi) +static int samsung_dsim_enable_clock(struct samsung_dsim *dsi) { unsigned long hs_clk, byte_clk, esc_clk; unsigned long esc_div; u32 reg; - hs_clk = exynos_dsi_set_pll(dsi, dsi->burst_clk_rate); + hs_clk = samsung_dsim_set_pll(dsi, dsi->burst_clk_rate); if (!hs_clk) { dev_err(dsi->dev, "failed to configure DSI PLL\n"); return -EFAULT; @@ -679,7 +683,7 @@ static int exynos_dsi_enable_clock(struct exynos_dsi *dsi) dev_dbg(dsi->dev, "hs_clk = %lu, byte_clk = %lu, esc_clk = %lu\n", hs_clk, byte_clk, esc_clk); - reg = exynos_dsi_read(dsi, DSIM_CLKCTRL_REG); + reg = samsung_dsim_read(dsi, DSIM_CLKCTRL_REG); reg &= ~(DSIM_ESC_PRESCALER_MASK | DSIM_LANE_ESC_CLK_EN_CLK | DSIM_LANE_ESC_CLK_EN_DATA_MASK | DSIM_PLL_BYPASS | DSIM_BYTE_CLK_SRC_MASK); @@ -689,14 +693,14 @@ static int exynos_dsi_enable_clock(struct exynos_dsi *dsi) | DSIM_LANE_ESC_CLK_EN_DATA(BIT(dsi->lanes) - 1) | DSIM_BYTE_CLK_SRC(0) | DSIM_TX_REQUEST_HSCLK; - exynos_dsi_write(dsi, DSIM_CLKCTRL_REG, reg); + samsung_dsim_write(dsi, DSIM_CLKCTRL_REG, reg); return 0; } -static void exynos_dsi_set_phy_ctrl(struct exynos_dsi *dsi) +static void samsung_dsim_set_phy_ctrl(struct samsung_dsim *dsi) { - const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; const unsigned int *reg_values = driver_data->reg_values; u32 reg; @@ -706,7 +710,7 @@ static void exynos_dsi_set_phy_ctrl(struct exynos_dsi *dsi) /* B D-PHY: D-PHY Master & Slave Analog Block control */ reg = reg_values[PHYCTRL_ULPS_EXIT] | reg_values[PHYCTRL_VREG_LP] | reg_values[PHYCTRL_SLEW_UP]; - exynos_dsi_write(dsi, DSIM_PHYCTRL_REG, reg); + samsung_dsim_write(dsi, DSIM_PHYCTRL_REG, reg); /* * T LPX: Transmitted length of any Low-Power state period @@ -714,7 +718,7 @@ static void exynos_dsi_set_phy_ctrl(struct exynos_dsi *dsi) * burst */ reg = reg_values[PHYTIMING_LPX] | reg_values[PHYTIMING_HS_EXIT]; - exynos_dsi_write(dsi, DSIM_PHYTIMING_REG, reg); + samsung_dsim_write(dsi, DSIM_PHYTIMING_REG, reg); /* * T CLK-PREPARE: Time that the transmitter drives the Clock Lane LP-00 @@ -734,7 +738,7 @@ static void exynos_dsi_set_phy_ctrl(struct exynos_dsi *dsi) reg_values[PHYTIMING_CLK_POST] | reg_values[PHYTIMING_CLK_TRAIL]; - exynos_dsi_write(dsi, DSIM_PHYTIMING1_REG, reg); + samsung_dsim_write(dsi, DSIM_PHYTIMING1_REG, reg); /* * T HS-PREPARE: Time that the transmitter drives the Data Lane LP-00 @@ -747,47 +751,47 @@ static void exynos_dsi_set_phy_ctrl(struct exynos_dsi *dsi) */ reg = reg_values[PHYTIMING_HS_PREPARE] | reg_values[PHYTIMING_HS_ZERO] | reg_values[PHYTIMING_HS_TRAIL]; - exynos_dsi_write(dsi, DSIM_PHYTIMING2_REG, reg); + samsung_dsim_write(dsi, DSIM_PHYTIMING2_REG, reg); } -static void exynos_dsi_disable_clock(struct exynos_dsi *dsi) +static void samsung_dsim_disable_clock(struct samsung_dsim *dsi) { u32 reg; - reg = exynos_dsi_read(dsi, DSIM_CLKCTRL_REG); + reg = samsung_dsim_read(dsi, DSIM_CLKCTRL_REG); reg &= ~(DSIM_LANE_ESC_CLK_EN_CLK | DSIM_LANE_ESC_CLK_EN_DATA_MASK | DSIM_ESC_CLKEN | DSIM_BYTE_CLKEN); - exynos_dsi_write(dsi, DSIM_CLKCTRL_REG, reg); + samsung_dsim_write(dsi, DSIM_CLKCTRL_REG, reg); - reg = exynos_dsi_read(dsi, DSIM_PLLCTRL_REG); + reg = samsung_dsim_read(dsi, DSIM_PLLCTRL_REG); reg &= ~DSIM_PLL_EN; - exynos_dsi_write(dsi, DSIM_PLLCTRL_REG, reg); + samsung_dsim_write(dsi, DSIM_PLLCTRL_REG, reg); } -static void exynos_dsi_enable_lane(struct exynos_dsi *dsi, u32 lane) +static void samsung_dsim_enable_lane(struct samsung_dsim *dsi, u32 lane) { - u32 reg = exynos_dsi_read(dsi, DSIM_CONFIG_REG); + u32 reg = samsung_dsim_read(dsi, DSIM_CONFIG_REG); reg |= (DSIM_NUM_OF_DATA_LANE(dsi->lanes - 1) | DSIM_LANE_EN_CLK | DSIM_LANE_EN(lane)); - exynos_dsi_write(dsi, DSIM_CONFIG_REG, reg); + samsung_dsim_write(dsi, DSIM_CONFIG_REG, reg); } -static int exynos_dsi_init_link(struct exynos_dsi *dsi) +static int samsung_dsim_init_link(struct samsung_dsim *dsi) { - const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; int timeout; u32 reg; u32 lanes_mask; /* Initialize FIFO pointers */ - reg = exynos_dsi_read(dsi, DSIM_FIFOCTRL_REG); + reg = samsung_dsim_read(dsi, DSIM_FIFOCTRL_REG); reg &= ~0x1f; - exynos_dsi_write(dsi, DSIM_FIFOCTRL_REG, reg); + samsung_dsim_write(dsi, DSIM_FIFOCTRL_REG, reg); usleep_range(9000, 11000); reg |= 0x1f; - exynos_dsi_write(dsi, DSIM_FIFOCTRL_REG, reg); + samsung_dsim_write(dsi, DSIM_FIFOCTRL_REG, reg); usleep_range(9000, 11000); /* DSI configuration */ @@ -856,10 +860,10 @@ static int exynos_dsi_init_link(struct exynos_dsi *dsi) dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) { reg |= DSIM_CLKLANE_STOP; } - exynos_dsi_write(dsi, DSIM_CONFIG_REG, reg); + samsung_dsim_write(dsi, DSIM_CONFIG_REG, reg); lanes_mask = BIT(dsi->lanes) - 1; - exynos_dsi_enable_lane(dsi, lanes_mask); + samsung_dsim_enable_lane(dsi, lanes_mask); /* Check clock and data lane state are stop state */ timeout = 100; @@ -869,24 +873,24 @@ static int exynos_dsi_init_link(struct exynos_dsi *dsi) return -EFAULT; } - reg = exynos_dsi_read(dsi, DSIM_STATUS_REG); + reg = samsung_dsim_read(dsi, DSIM_STATUS_REG); if ((reg & DSIM_STOP_STATE_DAT(lanes_mask)) != DSIM_STOP_STATE_DAT(lanes_mask)) continue; } while (!(reg & (DSIM_STOP_STATE_CLK | DSIM_TX_READY_HS_CLK))); - reg = exynos_dsi_read(dsi, DSIM_ESCMODE_REG); + reg = samsung_dsim_read(dsi, DSIM_ESCMODE_REG); reg &= ~DSIM_STOP_STATE_CNT_MASK; reg |= DSIM_STOP_STATE_CNT(driver_data->reg_values[STOP_STATE_CNT]); - exynos_dsi_write(dsi, DSIM_ESCMODE_REG, reg); + samsung_dsim_write(dsi, DSIM_ESCMODE_REG, reg); reg = DSIM_BTA_TIMEOUT(0xff) | DSIM_LPDR_TIMEOUT(0xffff); - exynos_dsi_write(dsi, DSIM_TIMEOUT_REG, reg); + samsung_dsim_write(dsi, DSIM_TIMEOUT_REG, reg); return 0; } -static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi) +static void samsung_dsim_set_display_mode(struct samsung_dsim *dsi) { struct drm_display_mode *m = &dsi->mode; unsigned int num_bits_resol = dsi->driver_data->num_bits_resol; @@ -896,42 +900,42 @@ static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi) reg = DSIM_CMD_ALLOW(0xf) | DSIM_STABLE_VFP(m->vsync_start - m->vdisplay) | DSIM_MAIN_VBP(m->vtotal - m->vsync_end); - exynos_dsi_write(dsi, DSIM_MVPORCH_REG, reg); + samsung_dsim_write(dsi, DSIM_MVPORCH_REG, reg); reg = DSIM_MAIN_HFP(m->hsync_start - m->hdisplay) | DSIM_MAIN_HBP(m->htotal - m->hsync_end); - exynos_dsi_write(dsi, DSIM_MHPORCH_REG, reg); + samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) | DSIM_MAIN_HSA(m->hsync_end - m->hsync_start); - exynos_dsi_write(dsi, DSIM_MSYNC_REG, reg); + samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); } reg = DSIM_MAIN_HRESOL(m->hdisplay, num_bits_resol) | DSIM_MAIN_VRESOL(m->vdisplay, num_bits_resol); - exynos_dsi_write(dsi, DSIM_MDRESOL_REG, reg); + samsung_dsim_write(dsi, DSIM_MDRESOL_REG, reg); dev_dbg(dsi->dev, "LCD size = %dx%d\n", m->hdisplay, m->vdisplay); } -static void exynos_dsi_set_display_enable(struct exynos_dsi *dsi, bool enable) +static void samsung_dsim_set_display_enable(struct samsung_dsim *dsi, bool enable) { u32 reg; - reg = exynos_dsi_read(dsi, DSIM_MDRESOL_REG); + reg = samsung_dsim_read(dsi, DSIM_MDRESOL_REG); if (enable) reg |= DSIM_MAIN_STAND_BY; else reg &= ~DSIM_MAIN_STAND_BY; - exynos_dsi_write(dsi, DSIM_MDRESOL_REG, reg); + samsung_dsim_write(dsi, DSIM_MDRESOL_REG, reg); } -static int exynos_dsi_wait_for_hdr_fifo(struct exynos_dsi *dsi) +static int samsung_dsim_wait_for_hdr_fifo(struct samsung_dsim *dsi) { int timeout = 2000; do { - u32 reg = exynos_dsi_read(dsi, DSIM_FIFOCTRL_REG); + u32 reg = samsung_dsim_read(dsi, DSIM_FIFOCTRL_REG); if (!(reg & DSIM_SFR_HEADER_FULL)) return 0; @@ -943,27 +947,27 @@ static int exynos_dsi_wait_for_hdr_fifo(struct exynos_dsi *dsi) return -ETIMEDOUT; } -static void exynos_dsi_set_cmd_lpm(struct exynos_dsi *dsi, bool lpm) +static void samsung_dsim_set_cmd_lpm(struct samsung_dsim *dsi, bool lpm) { - u32 v = exynos_dsi_read(dsi, DSIM_ESCMODE_REG); + u32 v = samsung_dsim_read(dsi, DSIM_ESCMODE_REG); if (lpm) v |= DSIM_CMD_LPDT_LP; else v &= ~DSIM_CMD_LPDT_LP; - exynos_dsi_write(dsi, DSIM_ESCMODE_REG, v); + samsung_dsim_write(dsi, DSIM_ESCMODE_REG, v); } -static void exynos_dsi_force_bta(struct exynos_dsi *dsi) +static void samsung_dsim_force_bta(struct samsung_dsim *dsi) { - u32 v = exynos_dsi_read(dsi, DSIM_ESCMODE_REG); + u32 v = samsung_dsim_read(dsi, DSIM_ESCMODE_REG); v |= DSIM_FORCE_BTA; - exynos_dsi_write(dsi, DSIM_ESCMODE_REG, v); + samsung_dsim_write(dsi, DSIM_ESCMODE_REG, v); } -static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi, - struct exynos_dsi_transfer *xfer) +static void samsung_dsim_send_to_fifo(struct samsung_dsim *dsi, + struct samsung_dsim_transfer *xfer) { struct device *dev = dsi->dev; struct mipi_dsi_packet *pkt = &xfer->packet; @@ -983,7 +987,7 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi, /* Send payload */ while (length >= 4) { reg = get_unaligned_le32(payload); - exynos_dsi_write(dsi, DSIM_PAYLOAD_REG, reg); + samsung_dsim_write(dsi, DSIM_PAYLOAD_REG, reg); payload += 4; length -= 4; } @@ -998,7 +1002,7 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi, fallthrough; case 1: reg |= payload[0]; - exynos_dsi_write(dsi, DSIM_PAYLOAD_REG, reg); + samsung_dsim_write(dsi, DSIM_PAYLOAD_REG, reg); break; } @@ -1007,25 +1011,25 @@ static void exynos_dsi_send_to_fifo(struct exynos_dsi *dsi, return; reg = get_unaligned_le32(pkt->header); - if (exynos_dsi_wait_for_hdr_fifo(dsi)) { + if (samsung_dsim_wait_for_hdr_fifo(dsi)) { dev_err(dev, "waiting for header FIFO timed out\n"); return; } if (NEQV(xfer->flags & MIPI_DSI_MSG_USE_LPM, dsi->state & DSIM_STATE_CMD_LPM)) { - exynos_dsi_set_cmd_lpm(dsi, xfer->flags & MIPI_DSI_MSG_USE_LPM); + samsung_dsim_set_cmd_lpm(dsi, xfer->flags & MIPI_DSI_MSG_USE_LPM); dsi->state ^= DSIM_STATE_CMD_LPM; } - exynos_dsi_write(dsi, DSIM_PKTHDR_REG, reg); + samsung_dsim_write(dsi, DSIM_PKTHDR_REG, reg); if (xfer->flags & MIPI_DSI_MSG_REQ_ACK) - exynos_dsi_force_bta(dsi); + samsung_dsim_force_bta(dsi); } -static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi, - struct exynos_dsi_transfer *xfer) +static void samsung_dsim_read_from_fifo(struct samsung_dsim *dsi, + struct samsung_dsim_transfer *xfer) { u8 *payload = xfer->rx_payload + xfer->rx_done; bool first = !xfer->rx_done; @@ -1034,7 +1038,7 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi, u32 reg; if (first) { - reg = exynos_dsi_read(dsi, DSIM_RXFIFO_REG); + reg = samsung_dsim_read(dsi, DSIM_RXFIFO_REG); switch (reg & 0x3f) { case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE: @@ -1073,7 +1077,7 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi, /* Receive payload */ while (length >= 4) { - reg = exynos_dsi_read(dsi, DSIM_RXFIFO_REG); + reg = samsung_dsim_read(dsi, DSIM_RXFIFO_REG); payload[0] = (reg >> 0) & 0xff; payload[1] = (reg >> 8) & 0xff; payload[2] = (reg >> 16) & 0xff; @@ -1083,7 +1087,7 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi, } if (length) { - reg = exynos_dsi_read(dsi, DSIM_RXFIFO_REG); + reg = samsung_dsim_read(dsi, DSIM_RXFIFO_REG); switch (length) { case 3: payload[2] = (reg >> 16) & 0xff; @@ -1102,16 +1106,16 @@ static void exynos_dsi_read_from_fifo(struct exynos_dsi *dsi, clear_fifo: length = DSI_RX_FIFO_SIZE / 4; do { - reg = exynos_dsi_read(dsi, DSIM_RXFIFO_REG); + reg = samsung_dsim_read(dsi, DSIM_RXFIFO_REG); if (reg == DSI_RX_FIFO_EMPTY) break; } while (--length); } -static void exynos_dsi_transfer_start(struct exynos_dsi *dsi) +static void samsung_dsim_transfer_start(struct samsung_dsim *dsi) { unsigned long flags; - struct exynos_dsi_transfer *xfer; + struct samsung_dsim_transfer *xfer; bool start = false; again: @@ -1123,7 +1127,7 @@ static void exynos_dsi_transfer_start(struct exynos_dsi *dsi) } xfer = list_first_entry(&dsi->transfer_list, - struct exynos_dsi_transfer, list); + struct samsung_dsim_transfer, list); spin_unlock_irqrestore(&dsi->transfer_lock, flags); @@ -1132,7 +1136,7 @@ static void exynos_dsi_transfer_start(struct exynos_dsi *dsi) /* waiting for RX */ return; - exynos_dsi_send_to_fifo(dsi, xfer); + samsung_dsim_send_to_fifo(dsi, xfer); if (xfer->packet.payload_length || xfer->rx_len) return; @@ -1151,9 +1155,9 @@ static void exynos_dsi_transfer_start(struct exynos_dsi *dsi) goto again; } -static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) +static bool samsung_dsim_transfer_finish(struct samsung_dsim *dsi) { - struct exynos_dsi_transfer *xfer; + struct samsung_dsim_transfer *xfer; unsigned long flags; bool start = true; @@ -1165,7 +1169,7 @@ static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) } xfer = list_first_entry(&dsi->transfer_list, - struct exynos_dsi_transfer, list); + struct samsung_dsim_transfer, list); spin_unlock_irqrestore(&dsi->transfer_lock, flags); @@ -1178,7 +1182,7 @@ static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) return true; if (xfer->rx_done != xfer->rx_len) - exynos_dsi_read_from_fifo(dsi, xfer); + samsung_dsim_read_from_fifo(dsi, xfer); if (xfer->rx_done != xfer->rx_len) return true; @@ -1197,8 +1201,8 @@ static bool exynos_dsi_transfer_finish(struct exynos_dsi *dsi) return start; } -static void exynos_dsi_remove_transfer(struct exynos_dsi *dsi, - struct exynos_dsi_transfer *xfer) +static void samsung_dsim_remove_transfer(struct samsung_dsim *dsi, + struct samsung_dsim_transfer *xfer) { unsigned long flags; bool start; @@ -1207,12 +1211,12 @@ static void exynos_dsi_remove_transfer(struct exynos_dsi *dsi, if (!list_empty(&dsi->transfer_list) && xfer == list_first_entry(&dsi->transfer_list, - struct exynos_dsi_transfer, list)) { + struct samsung_dsim_transfer, list)) { list_del_init(&xfer->list); start = !list_empty(&dsi->transfer_list); spin_unlock_irqrestore(&dsi->transfer_lock, flags); if (start) - exynos_dsi_transfer_start(dsi); + samsung_dsim_transfer_start(dsi); return; } @@ -1221,8 +1225,8 @@ static void exynos_dsi_remove_transfer(struct exynos_dsi *dsi, spin_unlock_irqrestore(&dsi->transfer_lock, flags); } -static int exynos_dsi_transfer(struct exynos_dsi *dsi, - struct exynos_dsi_transfer *xfer) +static int samsung_dsim_transfer(struct samsung_dsim *dsi, + struct samsung_dsim_transfer *xfer) { unsigned long flags; bool stopped; @@ -1240,13 +1244,13 @@ static int exynos_dsi_transfer(struct exynos_dsi *dsi, spin_unlock_irqrestore(&dsi->transfer_lock, flags); if (stopped) - exynos_dsi_transfer_start(dsi); + samsung_dsim_transfer_start(dsi); wait_for_completion_timeout(&xfer->completed, msecs_to_jiffies(DSI_XFER_TIMEOUT_MS)); if (xfer->result == -ETIMEDOUT) { struct mipi_dsi_packet *pkt = &xfer->packet; - exynos_dsi_remove_transfer(dsi, xfer); + samsung_dsim_remove_transfer(dsi, xfer); dev_err(dsi->dev, "xfer timed out: %*ph %*ph\n", 4, pkt->header, (int)pkt->payload_length, pkt->payload); return -ETIMEDOUT; @@ -1256,25 +1260,25 @@ static int exynos_dsi_transfer(struct exynos_dsi *dsi, return xfer->result; } -static irqreturn_t exynos_dsi_irq(int irq, void *dev_id) +static irqreturn_t samsung_dsim_irq(int irq, void *dev_id) { - struct exynos_dsi *dsi = dev_id; + struct samsung_dsim *dsi = dev_id; u32 status; - status = exynos_dsi_read(dsi, DSIM_INTSRC_REG); + status = samsung_dsim_read(dsi, DSIM_INTSRC_REG); if (!status) { static unsigned long int j; if (printk_timed_ratelimit(&j, 500)) dev_warn(dsi->dev, "spurious interrupt\n"); return IRQ_HANDLED; } - exynos_dsi_write(dsi, DSIM_INTSRC_REG, status); + samsung_dsim_write(dsi, DSIM_INTSRC_REG, status); if (status & DSIM_INT_SW_RST_RELEASE) { u32 mask = ~(DSIM_INT_RX_DONE | DSIM_INT_SFR_FIFO_EMPTY | DSIM_INT_SFR_HDR_FIFO_EMPTY | DSIM_INT_RX_ECC_ERR | DSIM_INT_SW_RST_RELEASE); - exynos_dsi_write(dsi, DSIM_INTMSK_REG, mask); + samsung_dsim_write(dsi, DSIM_INTMSK_REG, mask); complete(&dsi->completed); return IRQ_HANDLED; } @@ -1283,15 +1287,15 @@ static irqreturn_t exynos_dsi_irq(int irq, void *dev_id) DSIM_INT_PLL_STABLE))) return IRQ_HANDLED; - if (exynos_dsi_transfer_finish(dsi)) - exynos_dsi_transfer_start(dsi); + if (samsung_dsim_transfer_finish(dsi)) + samsung_dsim_transfer_start(dsi); return IRQ_HANDLED; } -static irqreturn_t exynos_dsi_te_irq_handler(int irq, void *dev_id) +static irqreturn_t samsung_dsim_te_irq_handler(int irq, void *dev_id) { - struct exynos_dsi *dsi = (struct exynos_dsi *)dev_id; + struct samsung_dsim *dsi = (struct samsung_dsim *)dev_id; struct drm_encoder *encoder = &dsi->encoder; if (dsi->state & DSIM_STATE_VIDOUT_AVAILABLE) @@ -1300,7 +1304,7 @@ static irqreturn_t exynos_dsi_te_irq_handler(int irq, void *dev_id) return IRQ_HANDLED; } -static void exynos_dsi_enable_irq(struct exynos_dsi *dsi) +static void samsung_dsim_enable_irq(struct samsung_dsim *dsi) { enable_irq(dsi->irq); @@ -1308,7 +1312,7 @@ static void exynos_dsi_enable_irq(struct exynos_dsi *dsi) enable_irq(gpio_to_irq(dsi->te_gpio)); } -static void exynos_dsi_disable_irq(struct exynos_dsi *dsi) +static void samsung_dsim_disable_irq(struct samsung_dsim *dsi) { if (gpio_is_valid(dsi->te_gpio)) disable_irq(gpio_to_irq(dsi->te_gpio)); @@ -1316,27 +1320,27 @@ static void exynos_dsi_disable_irq(struct exynos_dsi *dsi) disable_irq(dsi->irq); } -static int exynos_dsi_init(struct exynos_dsi *dsi) +static int samsung_dsim_init(struct samsung_dsim *dsi) { - const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; - exynos_dsi_reset(dsi); - exynos_dsi_enable_irq(dsi); + samsung_dsim_reset(dsi); + samsung_dsim_enable_irq(dsi); if (driver_data->reg_values[RESET_TYPE] == DSIM_FUNCRST) - exynos_dsi_enable_lane(dsi, BIT(dsi->lanes) - 1); + samsung_dsim_enable_lane(dsi, BIT(dsi->lanes) - 1); - exynos_dsi_enable_clock(dsi); + samsung_dsim_enable_clock(dsi); if (driver_data->wait_for_reset) - exynos_dsi_wait_for_reset(dsi); - exynos_dsi_set_phy_ctrl(dsi); - exynos_dsi_init_link(dsi); + samsung_dsim_wait_for_reset(dsi); + samsung_dsim_set_phy_ctrl(dsi); + samsung_dsim_init_link(dsi); return 0; } -static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, - struct device *panel) +static int samsung_dsim_register_te_irq(struct samsung_dsim *dsi, + struct device *panel) { int ret; int te_gpio_irq; @@ -1359,7 +1363,7 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, te_gpio_irq = gpio_to_irq(dsi->te_gpio); - ret = request_threaded_irq(te_gpio_irq, exynos_dsi_te_irq_handler, NULL, + ret = request_threaded_irq(te_gpio_irq, samsung_dsim_te_irq_handler, NULL, IRQF_TRIGGER_RISING | IRQF_NO_AUTOEN, "TE", dsi); if (ret) { dev_err(dsi->dev, "request interrupt failed with %d\n", ret); @@ -1371,7 +1375,7 @@ static int exynos_dsi_register_te_irq(struct exynos_dsi *dsi, return ret; } -static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) +static void samsung_dsim_unregister_te_irq(struct samsung_dsim *dsi) { if (gpio_is_valid(dsi->te_gpio)) { free_irq(gpio_to_irq(dsi->te_gpio), dsi); @@ -1380,9 +1384,9 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) } } -static void exynos_dsi_bridge_enable(struct drm_bridge *bridge) +static void samsung_dsim_bridge_enable(struct drm_bridge *bridge) { - struct exynos_dsi *dsi = bridge_to_dsi(bridge); + struct samsung_dsim *dsi = bridge_to_dsi(bridge); int ret; if (dsi->state & DSIM_STATE_ENABLED) @@ -1396,39 +1400,39 @@ static void exynos_dsi_bridge_enable(struct drm_bridge *bridge) dsi->state |= DSIM_STATE_ENABLED; - exynos_dsi_set_display_mode(dsi); - exynos_dsi_set_display_enable(dsi, true); + samsung_dsim_set_display_mode(dsi); + samsung_dsim_set_display_enable(dsi, true); dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE; return; } -static void exynos_dsi_bridge_disable(struct drm_bridge *bridge) +static void samsung_dsim_bridge_disable(struct drm_bridge *bridge) { - struct exynos_dsi *dsi = bridge_to_dsi(bridge); + struct samsung_dsim *dsi = bridge_to_dsi(bridge); if (!(dsi->state & DSIM_STATE_ENABLED)) return; dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; - exynos_dsi_set_display_enable(dsi, false); + samsung_dsim_set_display_enable(dsi, false); dsi->state &= ~DSIM_STATE_ENABLED; pm_runtime_put_sync(dsi->dev); } -static void exynos_dsi_bridge_mode_set(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - const struct drm_display_mode *adjusted_mode) +static void samsung_dsim_bridge_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); + struct samsung_dsim *dsi = bridge_to_dsi(bridge); drm_mode_copy(&dsi->mode, adjusted_mode); } -static int exynos_dsi_panel_or_bridge(struct exynos_dsi *dsi, - struct device_node *node) +static int samsung_dsim_panel_or_bridge(struct samsung_dsim *dsi, + struct device_node *node) { struct drm_bridge *panel_bridge; struct drm_panel *panel; @@ -1453,10 +1457,10 @@ static int exynos_dsi_panel_or_bridge(struct exynos_dsi *dsi, return 0; } -static int exynos_dsi_bridge_attach(struct drm_bridge *bridge, - enum drm_bridge_attach_flags flags) +static int samsung_dsim_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) { - struct exynos_dsi *dsi = bridge_to_dsi(bridge); + struct samsung_dsim *dsi = bridge_to_dsi(bridge); dsi->drm = bridge->dev; @@ -1464,23 +1468,23 @@ static int exynos_dsi_bridge_attach(struct drm_bridge *bridge, flags); } -static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { - .enable = exynos_dsi_bridge_enable, - .disable = exynos_dsi_bridge_disable, - .mode_set = exynos_dsi_bridge_mode_set, - .attach = exynos_dsi_bridge_attach, +static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = { + .enable = samsung_dsim_bridge_enable, + .disable = samsung_dsim_bridge_disable, + .mode_set = samsung_dsim_bridge_mode_set, + .attach = samsung_dsim_bridge_attach, }; -MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); +MODULE_DEVICE_TABLE(of, samsung_dsim_of_match); -static int exynos_dsi_host_attach(struct mipi_dsi_host *host, - struct mipi_dsi_device *device) +static int samsung_dsim_host_attach(struct mipi_dsi_host *host, + struct mipi_dsi_device *device) { - struct exynos_dsi *dsi = host_to_dsi(host); + struct samsung_dsim *dsi = host_to_dsi(host); struct drm_device *drm = dsi->drm; int ret; - ret = exynos_dsi_panel_or_bridge(dsi, device->dev.of_node); + ret = samsung_dsim_panel_or_bridge(dsi, device->dev.of_node); if (ret) return ret; @@ -1492,7 +1496,7 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, */ if (dsi->driver_data->exynos_specific && !(device->mode_flags & MIPI_DSI_MODE_VIDEO)) { - int ret = exynos_dsi_register_te_irq(dsi, &device->dev); + int ret = samsung_dsim_register_te_irq(dsi, &device->dev); if (ret) return ret; } @@ -1514,33 +1518,33 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, return 0; } -static int exynos_dsi_host_detach(struct mipi_dsi_host *host, - struct mipi_dsi_device *device) +static int samsung_dsim_host_detach(struct mipi_dsi_host *host, + struct mipi_dsi_device *device) { - struct exynos_dsi *dsi = host_to_dsi(host); + struct samsung_dsim *dsi = host_to_dsi(host); struct drm_device *drm = dsi->drm; if (drm->mode_config.poll_enabled) drm_kms_helper_hotplug_event(drm); if (dsi->driver_data->exynos_specific) - exynos_dsi_unregister_te_irq(dsi); + samsung_dsim_unregister_te_irq(dsi); return 0; } -static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host, - const struct mipi_dsi_msg *msg) +static ssize_t samsung_dsim_host_transfer(struct mipi_dsi_host *host, + const struct mipi_dsi_msg *msg) { - struct exynos_dsi *dsi = host_to_dsi(host); - struct exynos_dsi_transfer xfer; + struct samsung_dsim *dsi = host_to_dsi(host); + struct samsung_dsim_transfer xfer; int ret; if (!(dsi->state & DSIM_STATE_ENABLED)) return -EINVAL; if (!(dsi->state & DSIM_STATE_INITIALIZED)) { - ret = exynos_dsi_init(dsi); + ret = samsung_dsim_init(dsi); if (ret) return ret; dsi->state |= DSIM_STATE_INITIALIZED; @@ -1554,18 +1558,18 @@ static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host, xfer.rx_payload = msg->rx_buf; xfer.flags = msg->flags; - ret = exynos_dsi_transfer(dsi, &xfer); + ret = samsung_dsim_transfer(dsi, &xfer); return (ret < 0) ? ret : xfer.rx_done; } -static const struct mipi_dsi_host_ops exynos_dsi_ops = { - .attach = exynos_dsi_host_attach, - .detach = exynos_dsi_host_detach, - .transfer = exynos_dsi_host_transfer, +static const struct mipi_dsi_host_ops samsung_dsim_ops = { + .attach = samsung_dsim_host_attach, + .detach = samsung_dsim_host_detach, + .transfer = samsung_dsim_host_transfer, }; -static int exynos_dsi_of_read_u32(const struct device_node *np, - const char *propname, u32 *out_value) +static int samsung_dsim_of_read_u32(const struct device_node *np, + const char *propname, u32 *out_value) { int ret = of_property_read_u32(np, propname, out_value); @@ -1580,23 +1584,23 @@ enum { DSI_PORT_OUT }; -static int exynos_dsi_parse_dt(struct exynos_dsi *dsi) +static int samsung_dsim_parse_dt(struct samsung_dsim *dsi) { struct device *dev = dsi->dev; struct device_node *node = dev->of_node; int ret; - ret = exynos_dsi_of_read_u32(node, "samsung,pll-clock-frequency", + ret = samsung_dsim_of_read_u32(node, "samsung,pll-clock-frequency", &dsi->pll_clk_rate); if (ret < 0) return ret; - ret = exynos_dsi_of_read_u32(node, "samsung,burst-clock-frequency", + ret = samsung_dsim_of_read_u32(node, "samsung,burst-clock-frequency", &dsi->burst_clk_rate); if (ret < 0) return ret; - ret = exynos_dsi_of_read_u32(node, "samsung,esc-clock-frequency", + ret = samsung_dsim_of_read_u32(node, "samsung,esc-clock-frequency", &dsi->esc_clk_rate); if (ret < 0) return ret; @@ -1604,10 +1608,10 @@ static int exynos_dsi_parse_dt(struct exynos_dsi *dsi) return 0; } -static int exynos_dsi_bind(struct device *dev, struct device *master, - void *data) +static int samsung_dsim_bind(struct device *dev, struct device *master, + void *data) { - struct exynos_dsi *dsi = dev_get_drvdata(dev); + struct samsung_dsim *dsi = dev_get_drvdata(dev); struct drm_encoder *encoder = &dsi->encoder; struct drm_device *drm_dev = data; struct device_node *in_bridge_node; @@ -1650,26 +1654,26 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, return mipi_dsi_host_register(&dsi->dsi_host); } -static void exynos_dsi_unbind(struct device *dev, struct device *master, +static void samsung_dsim_unbind(struct device *dev, struct device *master, void *data) { - struct exynos_dsi *dsi = dev_get_drvdata(dev); + struct samsung_dsim *dsi = dev_get_drvdata(dev); - exynos_dsi_bridge_disable(&dsi->bridge); + samsung_dsim_bridge_disable(&dsi->bridge); drm_encoder_cleanup(&dsi->encoder); mipi_dsi_host_unregister(&dsi->dsi_host); } -static const struct component_ops exynos_dsi_component_ops = { - .bind = exynos_dsi_bind, - .unbind = exynos_dsi_unbind, +static const struct component_ops samsung_dsim_component_ops = { + .bind = samsung_dsim_bind, + .unbind = samsung_dsim_unbind, }; -static int exynos_dsi_probe(struct platform_device *pdev) +static int samsung_dsim_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct resource *res; - struct exynos_dsi *dsi; + struct samsung_dsim *dsi; int ret, i; dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); @@ -1683,7 +1687,7 @@ static int exynos_dsi_probe(struct platform_device *pdev) spin_lock_init(&dsi->transfer_lock); INIT_LIST_HEAD(&dsi->transfer_list); - dsi->dsi_host.ops = &exynos_dsi_ops; + dsi->dsi_host.ops = &samsung_dsim_ops; dsi->dsi_host.dev = dev; dsi->dev = dev; @@ -1734,7 +1738,7 @@ static int exynos_dsi_probe(struct platform_device *pdev) return dsi->irq; ret = devm_request_threaded_irq(dev, dsi->irq, NULL, - exynos_dsi_irq, + samsung_dsim_irq, IRQF_ONESHOT | IRQF_NO_AUTOEN, dev_name(dev), dsi); if (ret) { @@ -1742,7 +1746,7 @@ static int exynos_dsi_probe(struct platform_device *pdev) return ret; } - ret = exynos_dsi_parse_dt(dsi); + ret = samsung_dsim_parse_dt(dsi); if (ret) return ret; @@ -1759,14 +1763,14 @@ static int exynos_dsi_probe(struct platform_device *pdev) pm_runtime_enable(dev); - dsi->bridge.funcs = &exynos_dsi_bridge_funcs; + dsi->bridge.funcs = &samsung_dsim_bridge_funcs; dsi->bridge.of_node = dev->of_node; dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; drm_bridge_add(&dsi->bridge); if (dsi->driver_data->exynos_specific) { - ret = component_add(dev, &exynos_dsi_component_ops); + ret = component_add(dev, &samsung_dsim_component_ops); if (ret) goto err_disable_runtime; } @@ -1779,24 +1783,24 @@ static int exynos_dsi_probe(struct platform_device *pdev) return ret; } -static int exynos_dsi_remove(struct platform_device *pdev) +static int samsung_dsim_remove(struct platform_device *pdev) { - struct exynos_dsi *dsi = platform_get_drvdata(pdev); + struct samsung_dsim *dsi = platform_get_drvdata(pdev); drm_bridge_remove(&dsi->bridge); pm_runtime_disable(&pdev->dev); if (dsi->driver_data->exynos_specific) - component_del(&pdev->dev, &exynos_dsi_component_ops); + component_del(&pdev->dev, &samsung_dsim_component_ops); return 0; } -static int __maybe_unused exynos_dsi_suspend(struct device *dev) +static int __maybe_unused samsung_dsim_suspend(struct device *dev) { - struct exynos_dsi *dsi = dev_get_drvdata(dev); - const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + struct samsung_dsim *dsi = dev_get_drvdata(dev); + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; int ret, i; usleep_range(10000, 20000); @@ -1804,9 +1808,9 @@ static int __maybe_unused exynos_dsi_suspend(struct device *dev) if (dsi->state & DSIM_STATE_INITIALIZED) { dsi->state &= ~DSIM_STATE_INITIALIZED; - exynos_dsi_disable_clock(dsi); + samsung_dsim_disable_clock(dsi); - exynos_dsi_disable_irq(dsi); + samsung_dsim_disable_irq(dsi); } dsi->state &= ~DSIM_STATE_CMD_LPM; @@ -1823,10 +1827,10 @@ static int __maybe_unused exynos_dsi_suspend(struct device *dev) return 0; } -static int __maybe_unused exynos_dsi_resume(struct device *dev) +static int __maybe_unused samsung_dsim_resume(struct device *dev) { - struct exynos_dsi *dsi = dev_get_drvdata(dev); - const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + struct samsung_dsim *dsi = dev_get_drvdata(dev); + const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; int ret, i; ret = regulator_bulk_enable(ARRAY_SIZE(dsi->supplies), dsi->supplies); @@ -1857,24 +1861,25 @@ static int __maybe_unused exynos_dsi_resume(struct device *dev) return ret; } -static const struct dev_pm_ops exynos_dsi_pm_ops = { - SET_RUNTIME_PM_OPS(exynos_dsi_suspend, exynos_dsi_resume, NULL) +static const struct dev_pm_ops samsung_dsim_pm_ops = { + SET_RUNTIME_PM_OPS(samsung_dsim_suspend, samsung_dsim_resume, NULL) SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) }; struct platform_driver dsi_driver = { - .probe = exynos_dsi_probe, - .remove = exynos_dsi_remove, + .probe = samsung_dsim_probe, + .remove = samsung_dsim_remove, .driver = { - .name = "exynos-dsi", + .name = "samsung-dsim", .owner = THIS_MODULE, - .pm = &exynos_dsi_pm_ops, - .of_match_table = exynos_dsi_of_match, + .pm = &samsung_dsim_pm_ops, + .of_match_table = samsung_dsim_of_match, }, }; MODULE_AUTHOR("Tomasz Figa "); MODULE_AUTHOR("Andrzej Hajda "); -MODULE_DESCRIPTION("Samsung SoC MIPI DSI Master"); +MODULE_AUTHOR("Jagan Teki "); +MODULE_DESCRIPTION("Samsung MIPI DSIM bridge"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 6a251e3aa779..6bcd0fe03c70 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig @@ -53,15 +53,6 @@ config DRM_EXYNOS_DPI help This enables support for Exynos parallel output. -config DRM_EXYNOS_DSI - bool "MIPI-DSI host" - depends on DRM_EXYNOS_FIMD || DRM_EXYNOS5433_DECON || DRM_EXYNOS7_DECON - select DRM_MIPI_DSI - select DRM_PANEL - default n - help - This enables support for Exynos MIPI-DSI device. - config DRM_EXYNOS_DP bool "Exynos specific extensions for Analogix DP driver" depends on DRM_EXYNOS_FIMD || DRM_EXYNOS7_DECON diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 2fd2f3ee4fcf..04832f92051d 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile @@ -11,7 +11,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_FIMD) += exynos_drm_fimd.o exynosdrm-$(CONFIG_DRM_EXYNOS5433_DECON) += exynos5433_drm_decon.o exynosdrm-$(CONFIG_DRM_EXYNOS7_DECON) += exynos7_drm_decon.o exynosdrm-$(CONFIG_DRM_EXYNOS_DPI) += exynos_drm_dpi.o -exynosdrm-$(CONFIG_DRM_EXYNOS_DSI) += exynos_drm_dsi.o exynosdrm-$(CONFIG_DRM_EXYNOS_DP) += exynos_dp.o exynosdrm-$(CONFIG_DRM_EXYNOS_MIXER) += exynos_mixer.o exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o From patchwork Sun Jul 4 09:02:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E1B5C07E96 for ; Sun, 4 Jul 2021 09:05:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1CB4661090 for ; Sun, 4 Jul 2021 09:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbhGDJHm (ORCPT ); Sun, 4 Jul 2021 05:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbhGDJHm (ORCPT ); Sun, 4 Jul 2021 05:07:42 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58E11C061762 for ; Sun, 4 Jul 2021 02:05:06 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id n11so9580123pjo.1 for ; Sun, 04 Jul 2021 02:05:06 -0700 (PDT) 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:content-transfer-encoding; bh=LDJhbX+YMl3evTa07XA+cYBo4VfmU7H6Kne/zU0MCxI=; b=MzU6XoPBmW8oZc8sFFtNdNj7nBMBEITvj347sE61nkA/4LHtDJQ/adSkdZsxF9I6f5 7RCsUnSCy7i0MBKTALe5RQAyETtpQd3atLLGO8KGGRj4fqfxhS6HRWy3OjweDv3VKVtL +syAh8R08cMBsMYbrksHRa2cPU+yJ0uDgfU9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LDJhbX+YMl3evTa07XA+cYBo4VfmU7H6Kne/zU0MCxI=; b=MHtH9putagxVAi509M8hey0UeRjXPNO68zlYz4yC7ZxQonjee5pP+UJzdcCZv9tK71 ko690zs4HezJWTZlf14c1FtKc3mrm3X1nHxb71MrOIIw0BsCv6g09OYkWJxoupEarJh8 UEbMO0RNnzV9SnPX/FihUsiOOzQeqZ1c9lpJKm3ZmRHQ6MFzHv9i4jFtdQOT3ch49ilF /78/CminjPi1OJ5+9Ae3PFw0R/7LnmVMpjEnaY9yKoK8UGE3/JrMq2UARTY8Ks9rY6Hr pka+S1D1znOWczneSw+PRc4/YnPzTjArZYGgIm3Lq1eNsyiMkZFPpO44eB9cxtgxMuX6 yeqw== X-Gm-Message-State: AOAM530eS7/AoRuZEAlFP8PHBM8hzs1+JZKYyUrI8IhfnPSkdNAlek9E VCdyYtJHaSWa/xU8ALRmeAhrpg== X-Google-Smtp-Source: ABdhPJzIvvEMjIP/hh218sspQf7V0ep9uHZnLxmS0/zXxCMUJE2GejzApTBKIzS2W7ykhYnyWrTqcQ== X-Received: by 2002:a17:902:c00b:b029:129:c3:aeb7 with SMTP id v11-20020a170902c00bb029012900c3aeb7mr7305352plx.39.1625389505903; Sun, 04 Jul 2021 02:05:05 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.05.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:05:05 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 09/17] drm: bridge: samsung-dsim: Add module init, exit Date: Sun, 4 Jul 2021 14:32:22 +0530 Message-Id: <20210704090230.26489-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Add module init and exit functions for the bridge to register and unregister dsi_driver. Exynos drm driver stack will register the platform_driver separately in the common of it's exynos_drm_drv.c including dsi_driver. Register again would return -EBUSY, so return 0 for such cases as dsi_driver is already registered. Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index eed6b3ffdea7..627580abd6df 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1878,6 +1878,28 @@ struct platform_driver dsi_driver = { }, }; +static int __init samsung_mipi_dsim_init(void) +{ + int ret; + + ret = platform_driver_register(&dsi_driver); + + /** + * Exynos drm driver stack will register the platform_driver + * separately in the common of it's exynos_drm_drv.c including + * dsi_driver. Register again would return -EBUSY, so return 0 + * for such cases as dsi_driver is already registered. + */ + return ret == -EBUSY ? 0 : ret; +} +module_init(samsung_mipi_dsim_init); + +static void __exit samsung_mipi_dsim_exit(void) +{ + platform_driver_unregister(&dsi_driver); +} +module_exit(samsung_mipi_dsim_exit); + MODULE_AUTHOR("Tomasz Figa "); MODULE_AUTHOR("Andrzej Hajda "); MODULE_AUTHOR("Jagan Teki "); From patchwork Sun Jul 4 09:02:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29BE7C07E95 for ; Sun, 4 Jul 2021 09:05:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DBCD60241 for ; Sun, 4 Jul 2021 09:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229728AbhGDJHx (ORCPT ); Sun, 4 Jul 2021 05:07:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbhGDJHx (ORCPT ); Sun, 4 Jul 2021 05:07:53 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30F4AC061762 for ; Sun, 4 Jul 2021 02:05:18 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id u19so8437299plc.3 for ; Sun, 04 Jul 2021 02:05:18 -0700 (PDT) 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:content-transfer-encoding; bh=hL+MLrJHBCEnouqDulLM6emOyYNPKN/7WWcJffUZVgI=; b=Ox7OeoxRhsCb8+mFylAYS173jFpOscjCTjnvDIGRdJMYounC5wKIgTpSP7XnVg6xAC raQssnG27OHHwoo4hz6T2qjygVeAqh3HXvS+HJMRwVeeW5DhzGewSdUD7BEygrqp0kmC oVtikcLRGUxzib5wVnpfq3lHqX/Oe7x+NPzK8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hL+MLrJHBCEnouqDulLM6emOyYNPKN/7WWcJffUZVgI=; b=CtoiEDQhslfwN90bUyyaY0IcuN4wt5kyP0MIoG8HSciBsoO4dj3eWgnZvhdi0Ao7mS ojn095xYekkC6XcrDAkXGyJh8TLIsDObLv1T5kQyoFKZidfdA2B7cA/++NzdOHwViTaP DKxTEnRfWja1S1qy/p41t9gl0hT4RwV1EcHUnkt/QdnpnhI3CMzTIOM6mqujdSS1XJj/ LSVqdDF5FSxQRHMc2uCofkdgwHBhrRKThCkSOPztyULRfMnRyuscJUuwSq1WXSVQDwxZ /C5DQBLAKrdU0h+dsgiIKkiY8Go52NTAn8Ltv7W7FCdbGeotpq7ur4RiDMET9jo4Vpd7 0VXQ== X-Gm-Message-State: AOAM530I1PHWgNthOA15pkbpk81F63pdJgUtSwGswebg3mprqkv3+k5/ +Xe6NAlyk9Kj9tCTecmJRusxXA== X-Google-Smtp-Source: ABdhPJyVk/7w3gX4oYTDufJRP1VggAbeuygq98DTjeKrWXsuGHlnrvYPSoR5wfCpShhHU3GcMAL8IQ== X-Received: by 2002:a17:90b:14a:: with SMTP id em10mr8827443pjb.154.1625389517778; Sun, 04 Jul 2021 02:05:17 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:05:17 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 11/17] drm: bridge: samsung-dsim: Find the possible DSI devices Date: Sun, 4 Jul 2021 14:32:24 +0530 Message-Id: <20210704090230.26489-12-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Finding panel_or_bridge might vary based on associated DSI device drivers like DSI panel, bridge, and I2C based DSI bridge. All of these DSI drivers will invoke the DSI host in order to find the panel_or_bridge from probe to host attach and bridge_attach to host bridge attach. So, in order to handle all these cases of finding the panel_or_bridge invoke the finding API in host attach and bridge attach with the DSIM_STATE_DEVICE_FOUND flag. This way we can handle all possible cases of finding the DSI devices. Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 2222c27feffd..9a2df1212d0f 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -248,6 +248,7 @@ struct samsung_dsim_transfer { #define DSIM_STATE_INITIALIZED BIT(1) #define DSIM_STATE_CMD_LPM BIT(2) #define DSIM_STATE_VIDOUT_AVAILABLE BIT(3) +#define DSIM_STATE_DEVICE_FOUND BIT(4) struct samsung_dsim_driver_data { const unsigned int *reg_ofs; @@ -1475,6 +1476,15 @@ static int samsung_dsim_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { struct samsung_dsim *dsi = bridge_to_dsi(bridge); + int ret; + + if (!(dsi->state & DSIM_STATE_DEVICE_FOUND)) { + ret = samsung_dsim_panel_or_bridge(dsi, dsi->dev->of_node); + if (ret) + return ret; + + dsi->state |= DSIM_STATE_DEVICE_FOUND; + } dsi->drm = bridge->dev; @@ -1498,9 +1508,13 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host, struct drm_device *drm = dsi->drm; int ret; - ret = samsung_dsim_panel_or_bridge(dsi, device->dev.of_node); - if (ret) - return ret; + if (!(dsi->state & DSIM_STATE_DEVICE_FOUND)) { + ret = samsung_dsim_panel_or_bridge(dsi, device->dev.of_node); + if (ret) + return ret; + + dsi->state |= DSIM_STATE_DEVICE_FOUND; + } /* * This is a temporary solution and should be made by more generic way. From patchwork Sun Jul 4 09:02:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DBD1C07E95 for ; Sun, 4 Jul 2021 09:05:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C546610CC for ; Sun, 4 Jul 2021 09:05:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229739AbhGDJIF (ORCPT ); Sun, 4 Jul 2021 05:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229700AbhGDJIF (ORCPT ); Sun, 4 Jul 2021 05:08:05 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94494C061762 for ; Sun, 4 Jul 2021 02:05:30 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id s13so5331773plg.12 for ; Sun, 04 Jul 2021 02:05:30 -0700 (PDT) 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:content-transfer-encoding; bh=bHcsvEUVCxZAmQsc7mXrBSFPs2QDRsjgJq87Ua6YvE0=; b=YIEo3EAzws95+IRORqWvpcXbV6x+MOJaaacvQr5+CIYnIbotgC1K01lc+0XQVzvVeP CDGnx5fLmmE0HtWWKwMK/Sl6wpQf2OdXOTh5NcDiDha/4hHoxnVscR7LM8hmgOg2N1A6 ClLcDGFTXq3pNOiNo7IpjsbyLUUwzcC1t2Myk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bHcsvEUVCxZAmQsc7mXrBSFPs2QDRsjgJq87Ua6YvE0=; b=ZIBtU2zgyWx1kh0IQE4lFe2NjqZwA+ITSUyNTUqHDuDkrK65RB4j4ECjQ+6eU2JmY/ NstlyngY82ITo5utEKOINiKxxj0SVFZPJETTISPgkEVzLmDWHGzqrCEooUvpIe5ZkYxO h0rArbKrPT8QUO9YjXTzg1tXfMRaOMmikdSaGk0f2OhEa0leerefYolDyVHZi6Ppub5h b89yuXDM+ERxeh4oVV8ofn+TRakWEr99vn14pLvJo5SvryxklP2msJWhekOhQpiTiSbB kss8FHkqncXTtvrHU66y2p/grSquQU0bmcg8j5ZB/W+hQQ+c9irLSlWOe6XmLXiFISc5 Vbrg== X-Gm-Message-State: AOAM530QRb8UghLb42dZPky6NHkTfeWpUM7bDv8+pvzV9ZCdGC0eT+NM BtnlGUWJgPjqEJPuYUFZQfAlWw== X-Google-Smtp-Source: ABdhPJwhx0sFvMYc5Td8Aj1SfnBuNMkOOb9TDo52OwhHAPrn9XOZK7rsA7ADAxUeClmDb8m2Ykg4Fw== X-Received: by 2002:a17:902:f243:b029:129:5706:3c4b with SMTP id j3-20020a170902f243b029012957063c4bmr7357866plc.83.1625389530178; Sun, 04 Jul 2021 02:05:30 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:05:29 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 13/17] drm: bridge: samsung-dsim: Add i.MX8MM support Date: Sun, 4 Jul 2021 14:32:26 +0530 Message-Id: <20210704090230.26489-14-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Samsung MIPI DSIM bridge can also be found in i.MX8MM SoC. Add compatible and associated driver_data it. Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 9a2df1212d0f..ea379cb0cc32 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -460,6 +460,24 @@ static const unsigned int exynos5433_reg_values[] = { [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), }; +static const unsigned int imx8mm_dsim_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = 0, + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x26), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x08), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .reg_ofs = exynos_reg_ofs, .plltmr_reg = 0x50, @@ -521,6 +539,17 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .exynos_specific = true, }; +static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 2100, + .wait_for_reset = 0, + .num_bits_resol = 12, + .reg_values = imx8mm_dsim_reg_values, +}; + static const struct of_device_id samsung_dsim_of_match[] = { { .compatible = "samsung,exynos3250-mipi-dsi", .data = &exynos3_dsi_driver_data }, @@ -532,6 +561,8 @@ static const struct of_device_id samsung_dsim_of_match[] = { .data = &exynos5422_dsi_driver_data }, { .compatible = "samsung,exynos5433-mipi-dsi", .data = &exynos5433_dsi_driver_data }, + { .compatible = "fsl,imx8mm-mipi-dsim", + .data = &imx8mm_dsi_driver_data }, { } }; From patchwork Sun Jul 4 09:02:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470128 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEE80C07E95 for ; Sun, 4 Jul 2021 09:05:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B94EC61879 for ; Sun, 4 Jul 2021 09:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229749AbhGDJIS (ORCPT ); Sun, 4 Jul 2021 05:08:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbhGDJIR (ORCPT ); Sun, 4 Jul 2021 05:08:17 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97BCEC061764 for ; Sun, 4 Jul 2021 02:05:42 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id h6so7298888plf.11 for ; Sun, 04 Jul 2021 02:05:42 -0700 (PDT) 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:content-transfer-encoding; bh=5qWzL2bKwutF1snBeXJY/GnIGl0Ar3EOZLIKhQCIAh4=; b=Oo3Nk58YdvdURePtE0A7QW6obKZfXKex7+wBc9i8v5TQENN/LUYRIJUSlbNHgEnkON abd5uo+wxuBwtinmgxUVoLRV0Ho70wBjkOtlvN+rYI/1SGCkcEZcqR3J3Rr1QWXSdjJI n/0NwutFDWwsnfswCl28VErN0Y6ONWtmdprzc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5qWzL2bKwutF1snBeXJY/GnIGl0Ar3EOZLIKhQCIAh4=; b=c9R2vbryTSML8BscXpMRhWt4B2yujJm+BNw1WkdgP9DfQjqXz58KzkfP7A6G0K8Hbi ovqMrS2zW5GkaHu3hr/FTX2mylqweF3Ss1hf53biOrQtCBFwCq06uaHfPq/kQpNsfvfW oKvw450zD7b7whPsDKkLSIoWdF0W+UCBwYrEQFw9TlRGuflcz+hbgFpMGsHciLzhbrz4 q8OxEY/9tLyf3zUL0l1nEGiINKC76QIO2MkXQZwPt/Ac1/6CHluIcdiHOHCKgKxn3afn lUF+KauFDrR+eyond0wOx+ggf1NTxNyFdSSMkz+s5uY1ILQ1mixNIVE2Z7c8ZrzLYMOP Dmlg== X-Gm-Message-State: AOAM533xJ8jxGlWrTUuSWRG9eTAkZiNa8oR6g9Rrfoedz9z3G92QSZGF nfbofG62moDJlH4EWos1G+BKew== X-Google-Smtp-Source: ABdhPJwrr2bLufFMR1N9V6dDMRURHUV45B3uXg9T7mcdXyFKlOG+lid6Z/lIEpZKE9V5Cq0fISQDEw== X-Received: by 2002:a17:902:b210:b029:11a:bf7b:1a83 with SMTP id t16-20020a170902b210b029011abf7b1a83mr7353036plr.84.1625389542152; Sun, 04 Jul 2021 02:05:42 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:05:41 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 15/17] drm: bridge: samsung-dsim: Move DSI init in bridge enable Date: Sun, 4 Jul 2021 14:32:28 +0530 Message-Id: <20210704090230.26489-16-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Host transfer in DSI master will invoke only when the DSI commands sent from DSI devices like DSI Panel or DSI bridges and this host transfer wouldn't invoke I2C based DSI bridge drivers. Handling DSI host initialization in transfer calls might miss the controller setup for I2C based DSI bridges. So, move the DSI initialization from transfer to bridge enable as the bridge enable API as it is common across all classes of DSI device drivers. Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index bc845ae100d4..54767cbf231c 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1437,6 +1437,13 @@ static void samsung_dsim_bridge_enable(struct drm_bridge *bridge) dsi->state |= DSIM_STATE_ENABLED; + if (!(dsi->state & DSIM_STATE_INITIALIZED)) { + ret = samsung_dsim_init(dsi); + if (ret) + return; + dsi->state |= DSIM_STATE_INITIALIZED; + } + samsung_dsim_set_display_mode(dsi); samsung_dsim_set_display_enable(dsi, true); @@ -1602,13 +1609,6 @@ static ssize_t samsung_dsim_host_transfer(struct mipi_dsi_host *host, if (!(dsi->state & DSIM_STATE_ENABLED)) return -EINVAL; - if (!(dsi->state & DSIM_STATE_INITIALIZED)) { - ret = samsung_dsim_init(dsi); - if (ret) - return ret; - dsi->state |= DSIM_STATE_INITIALIZED; - } - ret = mipi_dsi_create_packet(&xfer.packet, msg); if (ret < 0) return ret; From patchwork Sun Jul 4 09:02:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 470127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9A1CC07E95 for ; Sun, 4 Jul 2021 09:05:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0BD26162A for ; Sun, 4 Jul 2021 09:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbhGDJIa (ORCPT ); Sun, 4 Jul 2021 05:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbhGDJI3 (ORCPT ); Sun, 4 Jul 2021 05:08:29 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064E7C061764 for ; Sun, 4 Jul 2021 02:05:55 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id v7so15078777pgl.2 for ; Sun, 04 Jul 2021 02:05:55 -0700 (PDT) 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:content-transfer-encoding; bh=NPJDGg5FUIlGKxFIr3cHBiKXJApkbS5HOtFGL2ZFtnI=; b=Y5vOqA5VOi+FrwY2NKDcz7f743/FfVMilz2a7ydOaqlPDwHXGJjXCnQvNZTUZG/VAJ 0BEywGa25xiOVnSMvFN7wTdpafQeHwxBu142wKYTkUutW6p/tf4wc4vO4Nx3curO3sw1 +8tiTqWBXHMVJq18XEJ+M59Ivjsq64+kwcAeQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NPJDGg5FUIlGKxFIr3cHBiKXJApkbS5HOtFGL2ZFtnI=; b=Um/rJhBHZgGwSTBju6oecZ/Jn1GHHzIof8WV0cAtNCHP+CnxQTbnWbjBfa3o4Bwty4 UbzIfwM6jkK10qXtZtlSRHdru22r7yM7zLzHr9ykFXFCqPXoCwVmBhzBP5WY9M7vkMeH 85FKCMvFyevOqgjMFqjRWVpnPpjrJJ5swmbzF5eGtGnWBmhUXoSwJ+70EetsoNv91rdj nGvi3fzjE/q4jXL2tWdpkvq6paejV5t212SU6D9TDQC1gy8Go5mN0wh9ttzGYg9pKjsZ TI8EcLP03pnPySQSvsfg8gMU7sYfGAhEx3Jcr6qU9gHOuGaAguD/wkz3zoMn9byzbeKa Y4ww== X-Gm-Message-State: AOAM5325j38Ayhoi8Zw9ceit3RLQCv4ie5+hMoNZ3JXkJQ0rxYDBT7Mq 9QyJpK7LtLay/JQioqmR63RL4A== X-Google-Smtp-Source: ABdhPJzkHWVdOK7EaakstBIyQU5sd1VI/Q64M2LP26zyXubUC+ZrLsxppnNHkOOSw62DRzm7TEhTUg== X-Received: by 2002:a63:4b23:: with SMTP id y35mr9529467pga.179.1625389554638; Sun, 04 Jul 2021 02:05:54 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:05:54 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 17/17] drm: bridge: samsung-dsim: Add bridge mode_fixup Date: Sun, 4 Jul 2021 14:32:30 +0530 Message-Id: <20210704090230.26489-18-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Fixing up the mode flags are required in order to correlate the correct sync flags in i.MX8MM eLCDIF. So, handle the mode flags via bridge, mode_fixup. Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 0ed218f5eefc..c2a76ee5ac4e 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1474,6 +1474,16 @@ static void samsung_dsim_bridge_disable(struct drm_bridge *bridge) pm_runtime_put_sync(dsi->dev); } +static bool samsung_dsim_bridge_mode_fixup(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + adjusted_mode->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); + adjusted_mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); + + return true; +} + static void samsung_dsim_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode) @@ -1542,6 +1552,7 @@ static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = { .enable = samsung_dsim_bridge_enable, .disable = samsung_dsim_bridge_disable, .mode_set = samsung_dsim_bridge_mode_set, + .mode_fixup = samsung_dsim_bridge_mode_fixup, .attach = samsung_dsim_bridge_attach, };