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: 1932 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B01093F067 for ; Wed, 4 May 2022 13:41:05 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id k2-20020a170902ba8200b0015613b12004sf601289pls.22 for ; Wed, 04 May 2022 04:41:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651664464; cv=pass; d=google.com; s=arc-20160816; b=BT51RE2oRKPPEfgK6FEu25IwayL8eSJc9q/tHxx6DVfp6jhQwYau9YFFKMb5qYnp0S dS1p+XCgFTjVPaFXToRR4Q9lb7hzYCF5LUJ87M3IGcq05kNIyd9Ge9yc53Pq3Dukv2Cs 9Qctd314iYb2nZoGgaqI0i4BCtGK5nb1FO/AY6v1skh2nFwXV6ZQwoOVxQvruhUooe65 rXtT1lVGKZu4PLBHoA66yxE6Rf0EHT//1ni+COJX0k+z6SbqtPEEieUSuoTdbvqUUI36 pByOBJIMA4K7aJP+DnLNAh9OkmH+Pr9LOTMaGGPHx/uXdpassQRwpV2LXr/dx6ydsego bvsQ== 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=I7XWGL7AdGj3EeaVr4eOfciFFa3FeeClKO8nrmhPhDE=; b=I3eALBKnlebbyD0J2DQOLK4eN7HfPtb6m2ot3tVpZeb2fbu0xz8otCFGhrKcYLVLQb BOevQlErTvQ8U/CN4sario8rMUAbdCSwGo/T8EiuxB9jLMB53bz3jhi+1kldy7A2lNMT C5miMpvuEtAfwkXhT6iuPaJuY6Xi+7UhKwL0jUnTVZznQH/ZrLQHKuwVHXTiGUPDrih9 BJLlciNHuJUpqwKziTQiYEOtG0UMMgL6sLyUuB1qQzTy0+YYC0QD7BgYCT8GZBL4d6YJ 5F23c3/oMNQnJ/l17gTlfPDi4Nn7fEc2nDNFoD5DP9kIE4qQ3Mg2LAFf1pUY/sOMwdVl lPXA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hf7zZJvF; 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=I7XWGL7AdGj3EeaVr4eOfciFFa3FeeClKO8nrmhPhDE=; b=VH7JnZWfu03NLXLvq1jo/7OhsNl8C3OIKkoAjLCd22SJwTDI2XBOYmktlsiWTmjvVH 3n6gH3iNKqBSrnufzFRePMnZXLirpWzunKI4v+m6autpME7Q2gtinJwNqy4od33Z8Jfj eLxf3Af5m1Zj2vE1hFkVXJlnjE9Jrm44QHGDE= 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=I7XWGL7AdGj3EeaVr4eOfciFFa3FeeClKO8nrmhPhDE=; b=zAgWl3BvX9CKKZ1lZdaeTkWr0Bgo0g/+RoNzGrwTqzn5Xi51Mq+VPRtUcAsK9gLrD2 qWk26x7uKzd0+68VpFVhMk45IeAAgFraghBHuvvjMMOInj97kgqQNhvv/LeYycCuvG1s il4SjObuYcawKjWvawCBrVHP6PKYWQWHqTTTNCR7aP6oivjQ0BtLpimXz1bj+qVZKx3u sttlmnjod+fUrE6DCnqGZyZAPORinF7bNRXsy082e4TcNzjUF+e4635nT/HDIjs19seI YR/J51b4JUGdUpDu9KyoxMM8ArJ7g6NvVRS/NYeQJRMqZr63XAB1WHY4YI5KVwmB76DC neWA== X-Gm-Message-State: AOAM5320VH9IG+RDVzNaAyslK1npPotIkwtaZ5c2U3frN3HP51qb3elX X4V1PJudnkEO91vWuQEhctqPKHSH X-Google-Smtp-Source: ABdhPJycxO0NBHaTtiezAzpq3ujpCd8loikDkk9kylvGXWMgvZHiVTPfRVr+9jwtjf54jnuFC4m5Kw== X-Received: by 2002:a17:90a:4983:b0:1d9:ef5:29f with SMTP id d3-20020a17090a498300b001d90ef5029fmr10009094pjh.67.1651664464493; Wed, 04 May 2022 04:41:04 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:be0e:b0:1da:2690:904d with SMTP id a14-20020a17090abe0e00b001da2690904dls1443884pjs.2.gmail; Wed, 04 May 2022 04:41:04 -0700 (PDT) X-Received: by 2002:a17:902:9349:b0:158:a6f7:e280 with SMTP id g9-20020a170902934900b00158a6f7e280mr20804986plp.155.1651664463710; Wed, 04 May 2022 04:41:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651664463; cv=none; d=google.com; s=arc-20160816; b=P6qK8MBpQ9AC3UlWR33JlZnM2sO3N5yFsWMLDRSdSllRpzXcUuhHw1XMn68cvGj3DP nj1Pwka1xpsPCEO4vnSoatVVTccnv0aOnj61o/fyBQHknD2ZhbrnHSlf7TQb6MQqpVI0 C1Z6aYnF/9p5lUjbGkl3oAVhfAv0SMkYIE5RZptVFFAXR+xNaHscOM74sY5umzGcEYG/ RxR0mqJPxEFJlY5KKa0gimTcr5AxUns2G4PHYMLmBdLVlqIBv5ih4SLtFKM3cMBxmC9c UgUyG/Y1AZKz7fpwbAd2iF6N92VH9LKvs3xJbuFFHYUgCVjfHbPdaFMqWZireJpv9j5u 6giA== 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=VdD/wGuLMDzQpZtAEHDiK9YZwN0IPCd8Y4aW5A9u8PY=; b=Pu2kUlYNStEtRQ74GAsgEF2oHY/O2+9MOJYpWdvgCeRW6oHhL8tUoUuZ8iUqGvp1UB HSXUf9rrcH8XdjokZqLjHAZaX+gFBHmc2AJSIn/VWh9iWTxLcmvUMGjSrWpNPE/G580f ur+/4XkxUKsCCImJKZBVuN/g5OruLyNk1n5HXumcjkGnziFlQWsScqGPFgBDPoP1o3Lg hdH5frs4E5QnbXRcNEglW0SGKjivePKpw4jav/CR1pQAtLApnOU9E4cEowUaphLC2oLi LPdZaDFtlxxE+NkMhWBcN9lgtZ+1ZAM7BkbHVxy1g+x/SjkgvNuUtxkmQ8IAGRx9dqAz C/iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hf7zZJvF; 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 o22-20020a17090a169600b001d95e86eb16sor1894630pja.6.2022.05.04.04.41.03 for (Google Transport Security); Wed, 04 May 2022 04:41:03 -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: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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hf7zZJvF; 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 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 {