From patchwork Thu Nov 10 18:38:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2473 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D668D3F039 for ; Thu, 10 Nov 2022 19:41:14 +0100 (CET) Received: by mail-pg1-f198.google.com with SMTP id u63-20020a638542000000b004701a0aa835sf1392174pgd.15 for ; Thu, 10 Nov 2022 10:41:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668105673; cv=pass; d=google.com; s=arc-20160816; b=0SuqVIa8LTYHTzc85MKIc/tLaoyMwPtkMMHjM55j5joSHSfMVSEQ0rxt0UrhsB672y J6numJ3ZpplKfDYIDJ7LdHtN+TdW+Jsc/fEYjFHosYIivbHxDxhv96nOBrhlRaUbVBed 6IpblF2PHG4lmlO6OuuPBLD7EYNzqScBcKTmY+esRUdtkaWfoUghnrtC0wV6QmDfDUm4 lPsdkQoUau/BoCxYZoKBW+edDKtSFxzz7eO8AYfxKaXfa+3kQ6AfrsxEC7czZ4IdysFG JYk7NAA9y5pFu/IWQojJX7Z3UyfTVyJKBlCYfYnCbS5ffIayjL3wcUT6qLf8ntCaXAdC HYZQ== 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=GYo5sTy4uhck+b3VOo8YEOBL9X5Jq+RXQjEHV+Ts9Lc=; b=cCbACoqed8RUPKFiPd4/Lxh/qf7CbJHjhJ9keELXlua3RuIjt/BZttVt040JIYkWQV 3G1AMbQPJU2a0SrOvJK9Sj1RnkCULLfPbKzMCBjmHXgLgdKE5R50hboFlrgbcTTeJXWQ jagjIlm5Rgo7h8/kUJcSX15t3wxBjBE2ry5tQbYD7axBVOP59qwAXHfRA5/dFtUpQSi/ qL5/2V7oUPMmBLSM5Xn2aNXuDQrBdU5QAC92t4WuOYmDuX113TjAWXL7y3wWqIfhJEl9 evZGgtlw96aZK8Jn/znVzo6Lk9M3lHXOTfy018lNWefqeheWPSPxDuBqMW8Fxku+u1ui +WWw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IbhJvncD; 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=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=GYo5sTy4uhck+b3VOo8YEOBL9X5Jq+RXQjEHV+Ts9Lc=; b=MDYbMsF7pZSvsRR+vFvrvJl+7AIkI5eHkf0XWVr7yXzFULfiNO6Zn4En78To4Y5D4k nepV16UgTDCuq5YY+Zg0fQRtJa3xMHVatCqhKd/IavVQeBWjFinWIS0LjERWC1Ig1vDX JzhITmeUwm+RJkXS5P3Ve0EnB4k0qeWZlhoa0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=GYo5sTy4uhck+b3VOo8YEOBL9X5Jq+RXQjEHV+Ts9Lc=; b=jn33awVTaL3Hh1zkV6oYDwwa78T01zBe91Z0XmqHnMU15VIpphg0dCa+70OUcPnAUx MIrl7OuHc08y0bJsyLN7ORLSwoTFffawJbP43IZkbGR5T+4rwHkHE9faYXjE+/++4M6e gulAIGHjBicmWFPPr1I0Zjcp6EnrWU0cPmMviuaWPABxEGuLr1yE3jMh4ezAg0xiABp0 6yk4EuH96D0famwu+nd+wkDfh7wu1xhr524nRcDnQdA7cFbO5A/UiUPpHIWMFQLOiS12 PjCksvx+AgKOhQgtB4E7O5XEfUTQoOqKF/ISNWwVAS4MVX/t1M60sYOU2X+h1TZ0j4+9 b3Og== X-Gm-Message-State: ACrzQf2qJhTO0JOE8lxd2o38tXg7sXNoyjJcKd4XKPQDfbfGrChldxCK 8mjQxetM/DB+VO45VKk2EqsXPW0B X-Google-Smtp-Source: AMsMyM6ei3aZ53QPxt/ATzoe0XBoTwffecsS04nAPlMZ7atNqndOlVEQHZ90F48JBYPwvQifUXvOzQ== X-Received: by 2002:a17:90a:1382:b0:213:c2a7:5ad with SMTP id i2-20020a17090a138200b00213c2a705admr62156569pja.193.1668105673701; Thu, 10 Nov 2022 10:41:13 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:64c:0:b0:46e:c77e:ea84 with SMTP id 73-20020a63064c000000b0046ec77eea84ls1424112pgg.3.-pod-prod-gmail; Thu, 10 Nov 2022 10:41:13 -0800 (PST) X-Received: by 2002:a63:305:0:b0:470:15cd:d428 with SMTP id 5-20020a630305000000b0047015cdd428mr2850962pgd.213.1668105672779; Thu, 10 Nov 2022 10:41:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668105672; cv=none; d=google.com; s=arc-20160816; b=VoYtD4wcHRTPHi+2u0IeFIsP7P51huafK83xw1/O42daB0B2eTBJr1DJCDa71gJCxS T3RSOF2IMQqrcbPVhaa+XsGarV/8zbW0JEics45ap70N83uUuzf+do71FNRSrbFN3bV7 88ycqlRghXu7jX9fBj7D8nKnTtvX4kVY2rnUpt5lbjWsGsG3OR1eRcgdG3m6CMZU86Nw 32mj9jpiaYL0xRw1iWdA8VSEJmnWR2wo59ksTSEU/ThwhX8RqA3EX6/+kn0k9OR+ERaS JkkA2WPgq7bNMQkNIaCQA0vq8BH0+nsx4t7k5wfP9bjjONOW1zm5mi2M5PfvfKRWJ22S ntEw== 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=cH5AHZZYCNmnhNvZUMuS6LHcRXOHT4jX43H6MOHuuRQ=; b=RDHwXF4fKD2Bxz+1L41ejT3LA3c5BQ/q5h5p1vpj01bq3RTq9q0yIvqofAfIt+az42 6mAgOK8/L9x/oDslFRM/NJZNJfd/QSs6S8UoTRI3H7GqgNtGaeYInQ+y7hPIQDHXxEyi W8tgg6FO40xqMUxfCV1H2TXyysqAdQLErAX1XneUOjbNKwo2vbtcic5x3YNylfqwBJsp SiMJK2O9d9ItrPTnAVfByMXkwnYKMAeKKlkuM927ygCToXTsOSn1UEmKFmRKVGBCONTX zP5HhJOjmoBCwPitiboywFBpl0z8ZnXmi/ajySeSLlNQtfId06DsNeaqNIc//MqbPK1C JsGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IbhJvncD; 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 s4-20020a17090aba0400b0020b258c1a07sor205555pjr.2.2022.11.10.10.41.12 for (Google Transport Security); Thu, 10 Nov 2022 10:41:12 -0800 (PST) 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:90b:1095:b0:213:ee6a:f268 with SMTP id gj21-20020a17090b109500b00213ee6af268mr54624279pjb.213.1668105672436; Thu, 10 Nov 2022 10:41:12 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a809:b5a4:486a:f07:f67e]) by smtp.gmail.com with ESMTPSA id c2-20020a170903234200b001869efb722csm11635627plh.215.2022.11.10.10.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 10:41:12 -0800 (PST) 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 v8 08/14] drm: bridge: samsung-dsim: Add platform PLL_P (PMS_P) offset Date: Fri, 11 Nov 2022 00:08:47 +0530 Message-Id: <20221110183853.3678209-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221110183853.3678209-1-jagan@amarulasolutions.com> References: <20221110183853.3678209-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=IbhJvncD; 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: , Look like PLL PMS_P offset value varies between platforms that have Samsung DSIM IP. However, there is no clear evidence for it as both Exynos and i.MX 8M Mini Application Processor Reference Manual is still referring the PMS_P offset as 13. The offset 13 is not working for i.MX8M Mini SoCs but the downstream NXP sec-dsim.c driver is using offset 14 for i.MX8M Mini SoC platforms [1] [2]. PMS_P value set in sec_mipi_dsim_check_pll_out using PLLCTRL_SET_P() with offset 13 and then an additional offset of one bit added in sec_mipi_dsim_config_pll via PLLCTRL_SET_PMS(). Not sure whether it is reference manual documentation or something else but this patch trusts the downstream code and handle PLL_P offset via platform driver data so-that imx8mm driver data shall use pll_p_offset to 14. Similar to Mini the i.MX8M Nano/Plus also has P=14, unlike Exynos. [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#n210 [2] 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 v8: * updated commit message for 8M Nano/Plus * collect Marek Ack v7, v6: * none v5: * updated clear commit message v4, v3, v2: * none v1: * updated commit message * add downstream driver link Reviewed-by: Marek Vasut 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 3c0a8580508b..0fe153b29e4f 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -168,7 +168,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) @@ -368,6 +368,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, }; @@ -380,6 +381,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, }; @@ -390,6 +392,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, }; @@ -401,6 +404,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, }; @@ -412,6 +416,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, }; @@ -543,7 +548,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 0c5a905f3de7..df3d030daec6 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -53,6 +53,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; };