From patchwork Fri Apr 8 16:20:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1903 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 569373F066 for ; Fri, 8 Apr 2022 18:22:27 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id y37-20020a056a001ca500b004fe3eccd4e4sf5399189pfw.16 for ; Fri, 08 Apr 2022 09:22:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1649434946; cv=pass; d=google.com; s=arc-20160816; b=zvLnarKqAGIS8uFLxvt9kPvVjvgQ3KWXhfis8MCsAk9eSNRHFQyJs8jE+71255HTCE s5/ffX00RZygjlqRbIq7ba+2mQXZ5aq1pWn7M2qa0FMBoDjVDjuL79B8F0uXnvY++2na /jzW95xQsVEE4+kD2n2BYFpsZHPK5SkSv9TL3n4YDXTJUUMJz/Tn9FXJCwT8kymwzylg D3pX5MrzZjO7cW8eEU8/6jrBNn1KpWlLWF9yMJzQx2jZ/rU03eHqVszFu8l8hLFflq61 rt3edzTrR7XZTvWCGm6YkWajWB4rLtzliIYWpC4toIgYsOzH56kzq7hXDQ/KRya8t7QX 8wxw== 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=k0HQsEDABWBBswInwDqoLlEV174g3hE+mgMyX+w8Y/U=; b=UhDD5UEc2Ui8Ekxptrg4Fs5xUTmZuzYy1U5dN3fkyutAa5oTQuB4/wLG/eRCvrtgUc pF3s3QaaofMG06eX9r8s0MqPKUvb8p4XCwGlXiGlq/L4ro29mXN31viCi3aD2PA+Gwt+ vzo/1pZi4nl3uuxwUbkL74ZgiJjsxsvPk+rFntrPKpa57V3I58Uck0Y954/h+NbbxIId F0fqaBVm9akyrsNeu8X+o3tjPzc7Nn6G18Z8PEBOflbIufD/FB6YIqtBcL9mFlqss6fj Jw0WAcDxw8kvnmjf5GRRZCV5drdFC6S8IoaHGPsfkOnL3qM26BC24QmfxYVPCuwWdsz/ 4CFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=aBaLEom+; 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=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=k0HQsEDABWBBswInwDqoLlEV174g3hE+mgMyX+w8Y/U=; b=UoJBkG9gcQqhnc8HqmfklKGamgjN9Zlw5/PQ71o/PVzVHHFJtgwdlscFdUOpvOR1h+ +sioTMsdGnWfIqAbgFL7qSm/zlwKjz1GflUURMYLuG/nRLA6u7aYufkxqygFXDk+J5ix AsMzJoOds7oAvBXQqHJULTFcVMhmcOq7ob43E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=k0HQsEDABWBBswInwDqoLlEV174g3hE+mgMyX+w8Y/U=; b=ChjuodLeh4NPm+XCTLC6Qk82A4tPJouLGWQFwpa5rLExffM5MP//BW6J7y4cj7CGbN DWv0ihE4bjN6NwcihfSrD2tf6OztAbKznvZdoNI8nH8Lyzt8K7LsuIBoifjwe5Fy/ip5 /mdIaW/DByOMetLgZOYzEUHYEgOjI5esBVCWLu4ZB5dg5rqSHKrMKUeMvlY0UXGzjCsp 7ncT6Vt2w3UQBArUbIvtIlE6IK6A1YZyDruVdz86J7fenC5iyCxYA7oj30JXjOUvAdA6 nSXXz50CnNkwKx22fU84+DPnznVK/9yNeoTx4IwlSEzocWk7Nd1l1UD3+bXovKPlkWHw M/KQ== X-Gm-Message-State: AOAM530i7szbOJqJ+Jpaad5QbTqH1Oar1+V9z0QV2c6+Z043b8JaMMCz oQA+IFBSO0ihpPuUfbXzqU5sXCYC X-Google-Smtp-Source: ABdhPJy688hb8gftmQm2lCUstxfEVUjVQOhk/pzdLxJqQgLj9PD9bu0CHVwf8FEM7fM/ApRQi9JOtA== X-Received: by 2002:a05:6a00:1506:b0:4fb:2d19:b6ab with SMTP id q6-20020a056a00150600b004fb2d19b6abmr20273138pfu.86.1649434946142; Fri, 08 Apr 2022 09:22:26 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:3fcc:b0:1ca:3b18:c791 with SMTP id u12-20020a17090a3fcc00b001ca3b18c791ls2106295pjm.2.gmail; Fri, 08 Apr 2022 09:22:25 -0700 (PDT) X-Received: by 2002:a17:90b:38c7:b0:1c7:6afb:fac6 with SMTP id nn7-20020a17090b38c700b001c76afbfac6mr22590703pjb.198.1649434945401; Fri, 08 Apr 2022 09:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649434945; cv=none; d=google.com; s=arc-20160816; b=CLKk21gvnCxrpRbt8cyOYXoN/3KPz6D3nkcis5obVP3gAY986x0pVmNXtxGx143Dt2 il+IOtNBRA4ZFGFwBCwvrAYCcS8XgPBKjRRvwkyk5D6QKb7jY+WzSYZGA5s+tkrMl0xa yIkuU7A05+1U1NGVLzt/b3nVIatVk6zxPm8ThiSu5Wo1p8TiN5l3DmeWppUn7bvAkAhR 0U7x9LtRMeJmW/6h8FKJNra/0Nio2qvX7MFiGgvVjVDQdeUPEsCZoDJ7cNt+t/4NQiAF 9W3iS1mmOMlNJrdZD1jqFKDs3oF4S2mvbGilofuwsyzH9QtSLE1aakJlYVYYag6A/9s5 5ynQ== 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=F25FQfPSS7j5Jl6aKgoVhvmm2u3Vlj8tvVo3HS+kjyo=; b=ZyvEAWECdsANumw8A7Oub+UQkI8c4A4VpHSQtXY0eelA2pLqUTdeTknAiz3waRkk17 SGo9ieZmwoKM1m1YzpM5O0vXxD6xTYRoWjoGLIQC43o+KH36x8g7Xu4j3A/ennlaW8oD 8OsDlsX9oJOPoRvgM7MoDpP1VPgOgpeyTNpVZEDPvRjkqRSVQd0PXUY+A8T8FsJkTheJ OKcFPp83QL+4/cTufPe315czytQ5vw3wSKKfMvM6+5lXDTag2J/ZwmbisnIYlXylcSwD ls7xhyweRhbUe2G3oSdmHtn5oSt6c38qSsygdiL4OgWLUC73EEQbL/Xa7lsuikGiau7d RiWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=aBaLEom+; 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 a11-20020a170902b58b00b00156bb47295bsor741718pls.56.2022.04.08.09.22.25 for (Google Transport Security); Fri, 08 Apr 2022 09:22:25 -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:902:6acc:b0:149:8f60:a526 with SMTP id i12-20020a1709026acc00b001498f60a526mr20139884plt.25.1649434945090; Fri, 08 Apr 2022 09:22:25 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id n18-20020a056a0007d200b004fdac35672fsm24929863pfu.68.2022.04.08.09.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:22:24 -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 , Rob Herring 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: [PATCH 02/11] drm: bridge: samsung-dsim: Handle platform init via driver_data Date: Fri, 8 Apr 2022 21:50:59 +0530 Message-Id: <20220408162108.184583-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220408162108.184583-1-jagan@amarulasolutions.com> References: <20220408162108.184583-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=aBaLEom+; 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 and invocation in the form of platform_init flag in driver_data. So, the platforms which enable platform_init 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 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 | 20 ++++++++++++++++---- include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index ee5d7e5518a6..0e6a5d1c7e4e 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -370,6 +370,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .platform_init = true, }; static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { @@ -382,6 +383,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .platform_init = true, }; static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { @@ -392,6 +394,7 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .platform_init = true, }; static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { @@ -403,6 +406,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, + .platform_init = true, }; static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { @@ -414,6 +418,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, + .platform_init = true, }; static const struct of_device_id samsung_dsim_of_match[] = { @@ -1565,12 +1570,16 @@ static int samsung_dsim_probe(struct platform_device *pdev) dsi->bridge.of_node = dev->of_node; dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; - dsi->plat_data = samsung_dsim_plat_probe(dsi); - if (IS_ERR(dsi->plat_data)) { + if (dsi->driver_data->platform_init) { + dsi->plat_data = samsung_dsim_plat_probe(dsi); ret = PTR_ERR(dsi->plat_data); - goto err_disable_runtime; + } else { + ret = mipi_dsi_host_register(&dsi->dsi_host); } + if (ret) + goto err_disable_runtime; + return 0; err_disable_runtime: @@ -1585,7 +1594,10 @@ static int samsung_dsim_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); - samsung_dsim_plat_remove(dsi); + if (dsi->driver_data->platform_init) + 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 59a43f9c4477..eca7eacb5910 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -39,6 +39,7 @@ struct samsung_dsim_driver_data { unsigned int wait_for_reset; unsigned int num_bits_resol; const unsigned int *reg_values; + bool platform_init; }; struct samsung_dsim_host_ops {