From patchwork Wed May 4 11:40:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12837720 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 413F4C433F5 for ; Wed, 4 May 2022 11:42:30 +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=F6MKUNyrZnekxhIF0/PBO7SE194gmsQkJHSDaJtmxK8=; b=RctkvV29LMszQO Emjg9DlgwC+wUbrKwbhwJ+Nqb8rtaD2E/AyPfWnn+5cc2JRJdJtGC/si1T/rjcdIuUmy0AApFivfN /WmX+6r2rwyQXRm1DqYuzqcASn+dpnRWL35Dz1uwh422AOWL71GwjZVGYwH8tBM4mrf4griX780fH hN0fQmD4h8IImHH6DpLII0d4iwuUXZJoa1Zex/pEg+gTe5QC7rDuXkjPUFuRUF3DhZbjRFjNlqwur JET9eh7NlHygxzNVjTDcuSiQOQ/muP6k3EnR3MFAvkQE6W7kLVRG16V0+quqv7Rt0tCr7Ypm2zT5T TzaqGiektYvIjNPKwWpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmDNe-00AV1h-Bk; Wed, 04 May 2022 11:41:18 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmDNR-00AUx4-Ln for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2022 11:41:10 +0000 Received: by mail-pl1-x630.google.com with SMTP id d22so1161255plr.9 for ; Wed, 04 May 2022 04:41:03 -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=VdD/wGuLMDzQpZtAEHDiK9YZwN0IPCd8Y4aW5A9u8PY=; b=hf7zZJvFwJauSkyXVeWkDRtHNkmvKRNwJja0aCJjitVuqn0rZ/G1qRLFVAkk6AQlwq FFbI8JUUJBNr8y/mJ5RvChuZDt/kOBF5Emqi3R/FXybLYjt6DssBfMb7+DkozBN1tua5 d2DgAn3WCVtMAdBLnIlEHwaN5ySulFkbGDWG4= 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=VdD/wGuLMDzQpZtAEHDiK9YZwN0IPCd8Y4aW5A9u8PY=; b=Q+E9/JHivzLwG+BwgkeD1NeA4MaI2Sr5TKlt8n001uhoKRJhyatWcEToFUbQfIFmEY EnvqTQE0/DjFTi7a1ZnttI4UyYYs0yS1GX9VuuJvC6tmw3jCn4ny0gTDbBGvAovAoquR k+CrICkuQnY404cFgb89A13l5Z4pBJNH8xCzUMm5LzojsskqLd3xeWy+2dX0niM/ttsL hqhsGu/chkWl8gqCTfM+RuTyOhNAOaIMUQDUwSkWyAppqD7YFy9RsYRTZ5IvbylMP9AK JQIXeegr7HRrFcLaBzaZqbMqc8bD73llc1N4asrKX4+Pv1Gg2jGoSQm8hV5nMxgxGd0l x1Nw== X-Gm-Message-State: AOAM532RINevfuxeY+MqpeUJMJBXvEmsbjJZFPOvbup1vmp/bf4eZ+r3 IhWQOCGKykJAJmFx4ufbGPlzEg== X-Google-Smtp-Source: ABdhPJxQ/Ey7Ts8xFHKdtBw1BihEPT5ET563AMQiQIldEEXMR01uBieFLEoZXcQajLHNZxRIHNjIMQ== X-Received: by 2002:a17:90a:170c:b0:1dc:20c4:6354 with SMTP id z12-20020a17090a170c00b001dc20c46354mr9874828pjd.113.1651664463136; Wed, 04 May 2022 04:41:03 -0700 (PDT) Received: from localhost.localdomain ([183.83.137.38]) by smtp.gmail.com with ESMTPSA id k15-20020aa790cf000000b0050dc7628174sm8027498pfk.78.2022.05.04.04.40.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 04:41:02 -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 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 v2 03/12] drm: bridge: samsung-dsim: Handle platform init via driver_data Date: Wed, 4 May 2022 17:10:12 +0530 Message-Id: <20220504114021.33265-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220504114021.33265-1-jagan@amarulasolutions.com> References: <20220504114021.33265-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220504_044105_730199_98727214 X-CRM114-Status: GOOD ( 19.96 ) 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 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 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 | 22 +++++++++++++++++----- include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index f23f06d55158..99f80e9c1600 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[] = { @@ -1610,12 +1615,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)) { - ret = PTR_ERR(dsi->plat_data); - goto err_disable_runtime; + if (dsi->driver_data->platform_init) { + dsi->plat_data = samsung_dsim_plat_probe(dsi); + ret = IS_ERR(dsi->plat_data) ? PTR_ERR(dsi->plat_data) : 0; + } else { + ret = mipi_dsi_host_register(&dsi->dsi_host); } + if (ret) + goto err_disable_runtime; + return 0; err_disable_runtime: @@ -1630,7 +1639,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 5cf8570ac978..70224d20414b 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -41,6 +41,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 {