From patchwork Wed Jul 20 15:52:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12924257 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3968FC43334 for ; Wed, 20 Jul 2022 15:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1Wa06zCQeu4iOC3SJfMq43egaIFORsj4iLGIGgeQNTg=; b=1f+Dogs0uswrBY QGOolwM52YIDhTgyAUwZ5cSf2+98MuYbuImtEpD/RZD5IM0Wn8/9fDPh9zs8uks3UqEM/edkPNOaF Z2abrC4b7DZKjn7Ko+OGKj33jsgpzM1uQwT0PA51rqbH4zwNNyly8K/QcaV8BF8xC3qDx59Dswf5R Fqnl6ZkwmqWGcQesqTvQe+AjRqmBJhcr8oro3scW0vUju7x0cB4uLRjX6c77tl74i5iw0FhWffBG7 OiT9IqrzMdxr4la9gGHn1sknTCBUUcpNv7iTRUSmgWo5YQUDQ5PDi7kfcqOMv9Krgj3E8+IVE0psz gYiO//f6oYPUDo3bho4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEC0f-007oYP-1b; Wed, 20 Jul 2022 15:53:13 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEC0U-007oP5-Qo for linux-arm-kernel@lists.infradead.org; Wed, 20 Jul 2022 15:53:04 +0000 Received: by mail-pg1-x532.google.com with SMTP id h132so16736981pgc.10 for ; Wed, 20 Jul 2022 08:52:59 -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=SvFqcqX31Dpa8PvnhTvPWiOoGd8kdnJv5vFHkC7+/vs=; b=QE+SPnmp4wbiuLSFkmZsG5U+MAI3e/QdhycDXv08PMkqVNGs8Fr+e+Q2V5P0lrrqLI pBVw/V7B3qPgLboGzoKxKKFUp4MW+SkFY/XW6aHb5qIpbwu5DUmuDTxP9FWZr1MZt9+d BqQTZTZn7wikI19yqYTZEyQFe9cU5kS/IpCxE= 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:content-transfer-encoding; bh=SvFqcqX31Dpa8PvnhTvPWiOoGd8kdnJv5vFHkC7+/vs=; b=tEpPUjiDP+ZiNjtACWCgJEt9EpC9O8eU5uUS8OKtGSeroonP+n6oczXORgfmFlo309 3SjjmKPb8/N83HHQ7RQV9BBNe/Lo7wP7xb/CtTPD1iaHZWFDvPYMRi5HRMSjN5l3EOyA UKCv+q8Zx9YBpbYnAGBCPpuGZ8aymX/Eb8PxtHacY/K3G51X4i2KkE36JQTqaK2USb0w isV6KUJ0R5dePLEmqdnqpu9rHJZv5Z+Xs9RnNcS9mccLiwm/9b0KAi1c/CVSBI0jLRTQ KQV/5LkmZwBvnuyVbBkEwMB0Dfm7/+FA4P1j8My0YWykHJWfVIyGIPHKwN6j3qzt99vu E/Ng== X-Gm-Message-State: AJIora9LWssuoZ+XePI5HxIaPqD1e3J3DX5GS+EEa4YXF/A1hTeck1Kb D9doJLqMt9ATwk9D6ALBdY4g/g== X-Google-Smtp-Source: AGRyM1vicfWCxIXbcN0f/ncIRNCwbSCZvrYENdtXR/lRQ+tls5Pg6hbXs6p36dHMLcFDobbVVNNzVA== X-Received: by 2002:a63:5cc:0:b0:412:b2ea:c6fe with SMTP id 195-20020a6305cc000000b00412b2eac6femr34992899pgf.596.1658332379069; Wed, 20 Jul 2022 08:52:59 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:d177:d5:aee:4f03]) by smtp.gmail.com with ESMTPSA id a8-20020a170902710800b0015e8d4eb1d7sm13919198pll.33.2022.07.20.08.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:52:58 -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 v3 04/13] drm: bridge: samsung-dsim: Handle platform init via driver_data Date: Wed, 20 Jul 2022 21:22:01 +0530 Message-Id: <20220720155210.365977-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220720155210.365977-1-jagan@amarulasolutions.com> References: <20220720155210.365977-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220720_085302_877997_DA8A0F70 X-CRM114-Status: GOOD ( 18.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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 20db345abf8b..4d5f72de2240 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 {