From patchwork Mon Aug 29 18:40:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2322 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 86AC940F47 for ; Mon, 29 Aug 2022 20:41:25 +0200 (CEST) Received: by mail-pj1-f71.google.com with SMTP id m11-20020a17090a3f8b00b001fabfce6a26sf3705125pjc.4 for ; Mon, 29 Aug 2022 11:41:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661798484; cv=pass; d=google.com; s=arc-20160816; b=Ux9INJ369vmtWxV0UFf0fPaw+yeKt6p32/rpb6aNMKFV0lySEwYkSD3M+EjMIECdKl /RWyf5QZO2txIhE3prYpr1gR7HKlU0Ael91ePxRz3Wik0EZkXdq2scBA/zvoUl7wvnYb Qkoaw9APwl4hddyV2IYDVFCyoOMifpndAxcVUD73rDr9GPAjF/q/IH8bgkCDGpVzXn+3 D0GecbSI2vMFVHdungq6nXlwBrl3NX/ei44wcen8/JL342FcaNaKj4DEtfXpmA/y94Tr oVwx+AsaTLxhmPC+MXq4kNxPndeJ/hAft4Jix4yQ3fSlrwfuvQJMBFtKXywbQPif9Xho WgZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=hmKP6eneNkmtAB6QdQ4lKGwcmRTH9uyU4hcSbsHTL6Y=; b=off4nfJnDlWxmoR3GY62OHuXQFjvv6n0aX3YyFjZKJEVApipUmmzsWb4gs6vPo9+o3 BEgQRaNaJOivZ2YYFYWrHfreC+jvA9Dkdj49kR9O/8p0xEfT29dXwC60NlTk19u8GvD2 0hd6LDZEK7sDpM7HFdH7S920v7kpPtpTjjyHMzeI+Nn0GFBoBW0WlRys9YDNQ0/0nxv6 iN+CPJS6djN3qoFcUTp5tAsZ7R0mqf4FWy4J0qcbgFTRe0eHXxTo4q9VGDqyw9vhGZba wxnYoZBOBZwvL2Fch9Wf4kiDN/r6gsIk8AURNDJwA+m2rRbOdMdsdmM5+rTGT4aW5yfY DEog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QhLJ26UK; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc; bh=hmKP6eneNkmtAB6QdQ4lKGwcmRTH9uyU4hcSbsHTL6Y=; b=kt84LMlPHwC2/nB+OcUaSr7GaJH0IQWarACjGKGWuxXuO00/rxOQwxK4I4z0dZDkUt JAKDZM8Ai1zqtLvC/9zTUn6oT+QVrypJDjb0YR7okB38ModDxYLPWnw8cJlisoR/xfBj xEJMYnptKC9bXrlcMKGcPXkd8VIZl+zQFtS5A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc; bh=hmKP6eneNkmtAB6QdQ4lKGwcmRTH9uyU4hcSbsHTL6Y=; b=vgKq7dgl0lmch6LOqC2Y0NjoEwZ+jSC4pmM4q4KjC/aS3vnDrTJLlxt+F34XuyLWHh BP6ePZhHWlXXAtg2D7Cjk3Txst3x6AhfVgjaYPBUaJLoUvi6EpT2ldOTEjcBZN/19Z9E rWLj8/endf6zfJp1by+rmQ/4ZXhxY4FRMYNmY1bd0qOvGqcV6VTS+HyZmlRU5usbA8HY ESBgp0wc7IHNb8b14r6CufAP+T3/hFmUjyFvEOcF25JdiTkOYQ0e99VUSAA5RFcPPoHo c9ghpXdu/v3b37o6H/mUR5rXg4/2uygIixFEjDojxOqEWzDJzxpt8dJJq95F+Xaai0qh pscg== X-Gm-Message-State: ACgBeo3LA9XQt+LvfVVvzz6F2SpdhAaiKa2mM0Kqr7iai8cVYwb6OlRV tlQIBzeElCzvHviM8m7RN2V51Tzq X-Google-Smtp-Source: AA6agR6uGrMvEJRZebnSzXwBTga5iwC+ZDIJtlXzwcubmYwwcbbPDtqyDzghiUNMQds0EeqfXUvuaw== X-Received: by 2002:a63:d3:0:b0:42a:88e6:7e44 with SMTP id 202-20020a6300d3000000b0042a88e67e44mr15457070pga.234.1661798484200; Mon, 29 Aug 2022 11:41:24 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:428e:b0:538:2c07:9c98 with SMTP id bx14-20020a056a00428e00b005382c079c98ls1820681pfb.6.-pod-prod-gmail; Mon, 29 Aug 2022 11:41:23 -0700 (PDT) X-Received: by 2002:a63:6683:0:b0:42b:34a5:e66f with SMTP id a125-20020a636683000000b0042b34a5e66fmr15433312pgc.117.1661798483292; Mon, 29 Aug 2022 11:41:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661798483; cv=none; d=google.com; s=arc-20160816; b=UUzaV6daKzO2R+8tfzfGm/JVow9IF0u65kXJRQ2qOb0izqXYSOl2tyL3Oefl8MmnCN MbM1m2hZXDmz8kwjEj5QzEWw6Cukibkl4Kvf6piwMrgiP0ndVDOWkLk58nShCuRB68DM 0b4IBEOF1Uk84c2W7fw3s8V2N0GDuCGm9ityEGKE2BkMgi/Eyg5Q0kc64eveeHnXAtuP dgCNL8hQy3Zs3V1X5yzGebTzNo6YWHz6AIrO5wy/qeqO+QYxDeuMeeNj2qn2V8eKPT7V kt3nPQ2SK0HwmnOHtjAghUNzit97EVnAI/mS8ZFApLexTmTiUJFOXUtb99/bFI2Y1rYF emrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=PPlEiJ1s7VViC3D9HvOY78/ATyLjYX2n1j74zd4YcKk=; b=aW6qaCXigymF3tvPTMxYUfM3JV3LAoMACVKXwCIasCH1qothTAg3tlpnKC28iqUImJ 1e6NmTomrMhrVgfOu/teMUw+ohZQkpn3HQKsU6jjsHSXE/Oz70YPWzAkhXGpK3INLs6x uH8YSsMhuTi+CsR+TcFiYYLonLx8FPLRvTIT83VNBaBWnD6FDwFtZMMocuejZVxAuFpH 7kYRzEVEKcle+PHi269BBkip4hoVvct38Zqv9K6rmGv+70lcsPvEPFYUS3MtCjxWbfxj sIuZ7BII1tJKt68E0zsHrAJy93XHq18ii+F0NpmOVBKaUBlVWe7LxZH8BQWt3abCFzIN x0kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QhLJ26UK; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id g15-20020a17090a300f00b001fde8afb0afsor916984pjb.25.2022.08.29.11.41.23 for (Google Transport Security); Mon, 29 Aug 2022 11:41:23 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90b:2c12:b0:1fd:78fa:5ea7 with SMTP id rv18-20020a17090b2c1200b001fd78fa5ea7mr16325155pjb.29.1661798482992; Mon, 29 Aug 2022 11:41:22 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41:22 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [PATCH v4 04/12] drm: bridge: samsung-dsim: Handle platform init via driver_data Date: Tue, 30 Aug 2022 00:10:23 +0530 Message-Id: <20220829184031.1863663-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QhLJ26UK; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In order to make a common Samsung DSIM bridge driver some platform specific glue code needs to maintain separately as it is hard to maintain platform specific glue and conventional component_ops on the drm bridge drivers side. This patch is trying to support that glue code initialization based on the DSIM_QUIRK_PLAT_DATA set from respective driver_data. So, the platforms which enable DSIM_QUIRK_PLAT_DATA flags will handle all platform specific initialization via samsung_dsim_plat_probe. The platform probe is responsible to - initialize samsung_dsim_plat_data and install hooks - initialize component_ops - preserve samsung_dsim structure pointer v4: * none v3: * update samsung_dsim_plat_probe return value * add plat_data quirk to handle platform init v2: * fix samsung_dsim_plat_probe return pointer v1: * use platform_init instead of exynos_specific * handle component_ops in glue code Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 16 ++++++++++++++-- include/drm/bridge/samsung-dsim.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 8130845750ac..76dc7687857a 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -369,6 +369,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { @@ -381,6 +382,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { @@ -391,6 +393,7 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { @@ -402,6 +405,7 @@ static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { .wait_for_reset = 0, .num_bits_resol = 12, .reg_values = exynos5433_reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { @@ -413,6 +417,7 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 12, .reg_values = exynos5422_reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct of_device_id samsung_dsim_of_match[] = { @@ -1609,7 +1614,11 @@ static int samsung_dsim_probe(struct platform_device *pdev) dsi->bridge.of_node = dev->of_node; dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; - ret = samsung_dsim_plat_probe(dsi); + if (dsi->driver_data->quirks & DSIM_QUIRK_PLAT_DATA) + ret = samsung_dsim_plat_probe(dsi); + else + ret = mipi_dsi_host_register(&dsi->dsi_host); + if (ret) goto err_disable_runtime; @@ -1627,7 +1636,10 @@ static int samsung_dsim_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); - samsung_dsim_plat_remove(dsi); + if (dsi->driver_data->quirks & DSIM_QUIRK_PLAT_DATA) + samsung_dsim_plat_remove(dsi); + else + mipi_dsi_host_unregister(&dsi->dsi_host); return 0; } diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 2e245bffd1b6..97fdee5ef5df 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -33,6 +33,10 @@ struct samsung_dsim_transfer { u16 rx_done; }; +enum samsung_dsim_quirks { + DSIM_QUIRK_PLAT_DATA = BIT(0), +}; + struct samsung_dsim_driver_data { const unsigned int *reg_ofs; unsigned int plltmr_reg; @@ -43,6 +47,7 @@ struct samsung_dsim_driver_data { unsigned int wait_for_reset; unsigned int num_bits_resol; const unsigned int *reg_values; + enum samsung_dsim_quirks quirks; }; struct samsung_dsim_host_ops {