From patchwork Wed May 4 11:40:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1935 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 50F093F067 for ; Wed, 4 May 2022 13:41:27 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id j17-20020a62b611000000b004fa6338bd77sf247217pff.10 for ; Wed, 04 May 2022 04:41:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651664486; cv=pass; d=google.com; s=arc-20160816; b=JN9K6z2ARYd0gs80rN0KFFaZ78IQPe8jXg9IGUs4fITdOdF+lKxWv++OFHNo9HyJYM 4cOJDU/ZFOe7HRXmV+nYAcZALPfSilJlvHfSwJhYEUr7ErOYKErxGJybid22PliYh/vF 25eJ1boRej6ln4h/db0bFrQQoXr+L0pp2ZA0p5kCUaXSAZ+I5APVogTIzuiNELdxS9Fw k/IHCI7oMfRH3yicFNJqgZZOHgM8eHAtpFXmOagSR08nhEokmhcrunWb2dAC0v7/ZMkg 1TRNRaRAzn5Bcv9BApZ8Q+0V4NseOc6oelKUZcIn4xtEYiX5lgyWJkkyF0/6m3awSWxi gHOw== 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=7lUQ6XzWUmkQTxn9yw5xGPWMfrp13YArjIEDkcp9LOk=; b=Oi80KNqaR9s6gMe/vRSwuylxYUHe+pC3tO+2hgGh/jSeamqxAVjDoeJIHx7mspbl9G FKHWqUbXEZaIkrMf4XyqLk9Lh7y022ai3lJr89exO64V7dBo7SWyPz1dHHX3YDEdXCUL w94jdR4iIEr61RtREUgG/UwABj1IpfKrV+nMWDsccM2XPqX/eRuJV2OvkpacKOY7DXKx Ualtf8CxDcMZo8ZAi3zaquD6H+2EM81a6EihbRTD+X2YAjMsMXq07hY8ujUmG4eVlVTX WJ8rCIzHhb6X7fI7i7Lt155yMnxB/epv4fSDf97Sfc/Y91tDzMbhHvpT3XFJXvXu2n19 XvUg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rMeI6li5; 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=7lUQ6XzWUmkQTxn9yw5xGPWMfrp13YArjIEDkcp9LOk=; b=h8Xanj9GsdNjKwhIkSPYpC/2eLnVF0MFybTW/pRnXzCz/Ue2KHKR8aWx1rjZOPXm5k z1ao6a5OHPhfpZEbps4Pcx6546CyhfjwbHMxJvbWqdWBxtjZbDN+IVs58yQekZJILDbp xNsnBOGSa8DQvTXkBUVra4n3vXC4QCHUg6JiQ= 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=7lUQ6XzWUmkQTxn9yw5xGPWMfrp13YArjIEDkcp9LOk=; b=32KMVd5EfbI5MelRt2mvucwyDe+H9g2Yxg5CstCQJ+fPSWAt5r2eJyg9gzHCr8Rnx7 08+J53LavHixKZa8ncLZtWE5ZfJp31EaJtbupiarFvPx2zBhjG7y8AMz+R3mrZRm+tFb ndoNQJJY+dtcBtiUijdWqm4WqB3blij2kkT4rjnncGgKTwr3CS9HpN3lpCC7c7inQVR8 cBWkSURfgwKEIm1skqU7WRvUhfyN5E4RLMjYgzWh92NynEA2/8MC5MTSOHQyXZfb3TQx LZI5vMu5pznJurkU0hmFQ9FIPCS3BKk9rcuSOvWAJwB7cSExP3KQLk3OuE8Twa8ngNB+ WaTg== X-Gm-Message-State: AOAM532gbDjfgOUFePOvXjuYJ6wfKNY9zG7OCX2zIAslUygDPL1jtUwJ FsfJZ07ZwwYlnJxumRSl6leJAX2b X-Google-Smtp-Source: ABdhPJxuOlii7azFAFF0nO18MpaG0NX5nSjBgL874uuHAQuGkNg1HgqSYn+SpPgMTmySXqLbBFvGrA== X-Received: by 2002:a05:6a00:1903:b0:4fa:fa9e:42e6 with SMTP id y3-20020a056a00190300b004fafa9e42e6mr20307059pfi.1.1651664486124; Wed, 04 May 2022 04:41:26 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:aa95:b0:15e:9fdb:4846 with SMTP id d21-20020a170902aa9500b0015e9fdb4846ls1194466plr.1.gmail; Wed, 04 May 2022 04:41:25 -0700 (PDT) X-Received: by 2002:a17:902:6acc:b0:149:8f60:a526 with SMTP id i12-20020a1709026acc00b001498f60a526mr21359479plt.25.1651664485388; Wed, 04 May 2022 04:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651664485; cv=none; d=google.com; s=arc-20160816; b=RMh6Qk3ggA3YrPmVMTpjf0NFueO45lqg5xd2cNizlgjgUJ41eIoFlIqFuaK6FbP4NS 4UTwfe4JUCQcnGPpFhhwan5Febm/bDRpVD0OtoMP2lN8DdBsbQ1ta4fXN6usUZUDMXGm n/1UaFBMFAY6r0xvMtThMHOs9wsYR/Jbkcjo/EAsKVWSTJ/dVEOU0SSQ9TewlEtYMihN iKeoj4Mst/iafUXoX9kl7a+/x6l+cM3jXvnCG17uisL6AN1Jt2Rrw7qLmqZb8d7dEqBs rpBlFKpb0axBrLBBDJB/KC6SR68w+fn8bmCBmzU3ikcrxsr7b1+GPDg7Kz//wXkG3XzS Wliw== 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=pnxPwikYcR/jRiJl0SfLW9jDFUFDEElKVltkxR/q3qU=; b=IFFG2tNtorN8TAIP25S9L057BbvE0fqhOPu1Aykyf8b5VC2JjO9b/ZYZGu58CejKlL saO6daWMytvnlPjJu2D+n23oFpCEWTjRTTGFq2blTHvTQcYyYRt/QAUrrA1nwV57w9BB VTojVb5e/uOP22BjIKVbbqe8uy5PTr7ycOWtkwacoO1xCEuqQ8zwRD+Ulolsa5fOUdJT vsb0xaWjbHlYOjxtsX+m6ketH1NOVzRiqwrjDPqgrkT2uaPMp0Dp77JsiTRHLvfaIOqo oTtRZ78re6D5L2w9j96GD03SCBupmlErTrAm/KKiBi/XeJlMbzmL6thixnbHO9VKON7X Yu9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rMeI6li5; 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 n7-20020a17090a2bc700b001bf0b87ef3asor1906707pje.8.2022.05.04.04.41.25 for (Google Transport Security); Wed, 04 May 2022 04:41: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:90a:7acb:b0:1d9:85a5:e1e3 with SMTP id b11-20020a17090a7acb00b001d985a5e1e3mr9731041pjl.172.1651664485044; Wed, 04 May 2022 04:41:25 -0700 (PDT) Received: from localhost.localdomain ([183.83.137.38]) by smtp.gmail.com with ESMTPSA id k15-20020aa790cf000000b0050dc7628174sm8027498pfk.78.2022.05.04.04.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 04:41: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 , 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 06/12] drm: bridge: samsung-dsim: Fix PLL_P (PMS_P) offset Date: Wed, 4 May 2022 17:10:15 +0530 Message-Id: <20220504114021.33265-7-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=rMeI6li5; 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: , The i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 with 13.7.10.1 Master PLL PMS Value setting Register mentioned PMS_P offset range from BIT[18-13] and the upstream driver is using the same offset. However, offset 13 is not working on i.MX8M Mini platforms but downstream NXP driver is using 14 [1] and it is working with i.MX8M Mini SoC. Not sure about whether it is reference manual documentation or something else but this patch trusts the downstream code and fixes the PLL_P offset. [1] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/gpu/drm/bridge/sec-dsim.c?h=imx_5.4.47_2.2.0#n211 v2: * none v1: * updated commit message * add downstream driver link Signed-off-by: Frieder Schrempf Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 10 ++++++++-- include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index b9361af5ef2d..8f9ae16d45bc 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -169,7 +169,7 @@ /* DSIM_PLLCTRL */ #define DSIM_FREQ_BAND(x) ((x) << 24) #define DSIM_PLL_EN (1 << 23) -#define DSIM_PLL_P(x) ((x) << 13) +#define DSIM_PLL_P(x, offset) ((x) << (offset)) #define DSIM_PLL_M(x) ((x) << 4) #define DSIM_PLL_S(x) ((x) << 1) @@ -369,6 +369,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .max_freq = 1000, .wait_for_reset = 1, .num_bits_resol = 11, + .pll_p_offset = 13, .reg_values = reg_values, .platform_init = true, }; @@ -382,6 +383,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .max_freq = 1000, .wait_for_reset = 1, .num_bits_resol = 11, + .pll_p_offset = 13, .reg_values = reg_values, .platform_init = true, }; @@ -393,6 +395,7 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .max_freq = 1000, .wait_for_reset = 1, .num_bits_resol = 11, + .pll_p_offset = 13, .reg_values = reg_values, .platform_init = true, }; @@ -405,6 +408,7 @@ static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { .max_freq = 1500, .wait_for_reset = 0, .num_bits_resol = 12, + .pll_p_offset = 13, .reg_values = exynos5433_reg_values, .platform_init = true, }; @@ -417,6 +421,7 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .max_freq = 1500, .wait_for_reset = 1, .num_bits_resol = 12, + .pll_p_offset = 13, .reg_values = exynos5422_reg_values, .platform_init = true, }; @@ -564,7 +569,8 @@ static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi, writel(driver_data->reg_values[PLL_TIMER], dsi->reg_base + driver_data->plltmr_reg); - reg = DSIM_PLL_EN | DSIM_PLL_P(p) | DSIM_PLL_M(m) | DSIM_PLL_S(s); + reg = DSIM_PLL_EN | DSIM_PLL_P(p, driver_data->pll_p_offset) | + DSIM_PLL_M(m) | DSIM_PLL_S(s); if (driver_data->has_freqband) { static const unsigned long freq_bands[] = { diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 70224d20414b..e5291e105227 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -40,6 +40,7 @@ struct samsung_dsim_driver_data { unsigned int max_freq; unsigned int wait_for_reset; unsigned int num_bits_resol; + unsigned int pll_p_offset; const unsigned int *reg_values; bool platform_init; };