From patchwork Fri Mar 3 14:51:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2767 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 960A344AA6 for ; Fri, 3 Mar 2023 15:52:39 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id i7-20020a626d07000000b005d29737db06sf1466020pfc.15 for ; Fri, 03 Mar 2023 06:52:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677855158; cv=pass; d=google.com; s=arc-20160816; b=fh0L41utSMaI5HqSJ2ffvhyWJ7aiDf0MSqoBwSgoyK+oRnNElEScX15O3nivDcobCh 0N1p+I0LqbKAKI3qzA8cJzulcGFKBgWY3xVnKrjH4b6tDWSNLpxmQifwYN5oUz2Nhl9Q lGKIC2RtOpG4/WgLwSUXqxAbVxv/aj09lxOR8hVtx54DP46/pDkYiN2MX/92vNMMTCax KtrT5kfdpXhcAWDZvkwpVI2Lsgr8wu9q6hiYT7fbCq8sccB6UfYooRnrsXiFcw2I/0r1 oTZKiWgtjNLJMZu8U00c6efzLB3o+zx0oq/AvtUIKBW+4lhHA9UKX6TZOHnJh+owl8VK y2gw== 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=w9oTgxbno2bIIYVZCK4FpELF4/vbcrjO4n4QYy9HxPg=; b=Gc3setvyRMGI1rMVt/2E3rRp7tlIdG//2fxCBnmM6ERxih6ixPrU56VnOwJWULF0ss eoRycmD2RyAogVIejNHBDvtRoj1ZQEdGGJtC1nVpfPzG6PF8npjzQy/GhGiw1D0hmOxv rknRFpoRy0i+C7YSMgRdHpzR4NgJ7JYoS8ofAyF4iCYm1MAGGJsiaJuvYs3ldm9XRXLw y8f3vZNp9cJlZPu929FqBG90HtAVg7QlBRm1Rsr46J+2YytakzTLrFwa0pMZpZiKP/Ow wbE4qRw8uBQKXzdqwvxRMRT2u5J3ysboYjunBWwKsSIG+NgbEEmJ7+aeqOWUQcKIcilx fydA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qry+BcDj; 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; t=1677855158; 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=w9oTgxbno2bIIYVZCK4FpELF4/vbcrjO4n4QYy9HxPg=; b=CWOSJZ57HP/4+OV7OHR5FzXIm/pqj+m3IPqiESoxvwv39T6oAmDV23k4zdEfH3xWi7 uxlDT0R//ph316eNaDFvYQV07z1sOE1VFEVL/akXPm/W/9ad1OCiBUtgjINH2lgPK+k5 3vla+/PJa1BAYhZ5i0U07xFi444lAtxSk2U/g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677855158; 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=w9oTgxbno2bIIYVZCK4FpELF4/vbcrjO4n4QYy9HxPg=; b=ERvy49030ZfqOWWKbDJHX6o0jUF27HkgkUm/4qtWvY/O1p2xSnfmqQyHlY3PxVk37v AI6Zq98A7JX8YtFjnzVvuNhvu1ZY6P2JHH2zcMMasHBH5oY18qtqsHufVz2G6Nqmy2Fk +4QLeo/8O5ad8AkoeIhU+klfjMJZFX8TloPYaqU1QauzLcE+QK9Lk4Rl15ET6kZ+3XeF UiqQ79MJcc629EYd9qke2O2zabdjR6k5IfypW1Fg9UXykn1kqhVS4BTg05UG+DbVh5Gj kPAmM716ANMse0begG4v4KiwtfVsYrZuKyHGUqR9RO2Htolsoys6k/hYKrvDg8ej4ZHe Gy7A== X-Gm-Message-State: AO0yUKX7NbqqKqqL2COgjcFCXaBjFgwgJxkOVkTSkhUOEKW7quIiRZda dXQqxLsJFPlHEI8ietchsMtuh0wg X-Google-Smtp-Source: AK7set9E+Hmyph2L1eUPYSrtf68+UcBy3azjANvup8KubID2PmJy4GF9X6vNAwp5hISzK9dtFJIoGA== X-Received: by 2002:a17:902:ef92:b0:19a:8259:c754 with SMTP id iz18-20020a170902ef9200b0019a8259c754mr822177plb.0.1677855158214; Fri, 03 Mar 2023 06:52:38 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:e5d0:b0:198:ddfb:494 with SMTP id u16-20020a170902e5d000b00198ddfb0494ls3174711plf.8.-pod-prod-gmail; Fri, 03 Mar 2023 06:52:37 -0800 (PST) X-Received: by 2002:a17:902:d4cf:b0:19e:500b:517a with SMTP id o15-20020a170902d4cf00b0019e500b517amr2399430plg.69.1677855156963; Fri, 03 Mar 2023 06:52:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677855156; cv=none; d=google.com; s=arc-20160816; b=zdkcL36BHHqIHIP5l3WVnJKEvpQDPGB3dGPXs40C+/ik3v5CW+o5hQH/obBUmCCd+T pXQkx+Cj7edtrM0rM2ik4u6mFClOexPwMIqblzsgtvCNd6fcBas+DlA0yIoh49Bd1Wpd VI7VWlW7qtOil4xvPA9bMlnPnXmtNYg5M78uZfCYWIGlRORlnagb25iiXLmj+2Umclu/ n+RAhvZ3Q0b1mFn6WiW6aLxI4CHEQD3ltiTL4ZhKQqA4/yY5z61QUJprLfde7dyiRvVz d5oq7ID7ckuy1I5E85/1RdFh9wO3Lvo3LUe4KHZsq4qxspYD3OJO0Nmdz6nH+Z+6KFAX ftTA== 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=legzZg2LI260N51ZPIAg5x5sq5D7Y2TMttdY9F/D8O0=; b=y0jfS9Ja/YSnIAp8dhK7qA29wcu6FJFZ0cFuqaP8DfzDn6RkC/knLI0OeSDf5EDqb5 Ypen5IVrOYecvbosKGLDQRubXAnQbo8RJaP7/KkWe2djrl5zQRF7qM5HtCea7pB1faSV 57JCvXvwoIab8qIXZOIGc69IO66DJ5ugPW8MzAYFXgi1ZGe60S3hU5OzJW03wAkiFgsf yKakHxYQeyeT9EOxjWCsdp/Fw1KJ7IRPSCFUg0w5TU8w1VtzyaypxN/nPI+NycrNIsA6 7zoKODW7e5fZTO01Xj/A7KUtb/DEQdatUZC2PN15QFkSxzVLCA7cN90Urd5GuDi214zq EfSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qry+BcDj; 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 l2-20020a170903120200b0019c9a655e8esor1034121plh.93.2023.03.03.06.52.36 for (Google Transport Security); Fri, 03 Mar 2023 06:52:36 -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:a05:6a20:8e02:b0:ce:ca9:ab56 with SMTP id y2-20020a056a208e0200b000ce0ca9ab56mr2921382pzj.34.1677855156554; Fri, 03 Mar 2023 06:52:36 -0800 (PST) Received: from localhost.localdomain ([183.83.137.89]) by smtp.gmail.com with ESMTPSA id z4-20020a63e544000000b00502fd70b0bdsm1660856pgj.52.2023.03.03.06.52.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:52:35 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Neil Armstrong , Marek Vasut , Maxime Ripard Cc: Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH v15 04/16] drm: exynos: dsi: Add platform PLL_P (PMS_P) offset Date: Fri, 3 Mar 2023 20:21:26 +0530 Message-Id: <20230303145138.29233-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303145138.29233-1-jagan@amarulasolutions.com> References: <20230303145138.29233-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=qry+BcDj; 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 Reviewed-by: Marek Vasut Signed-off-by: Frieder Schrempf Signed-off-by: Jagan Teki --- Changes for v15, v13, v12, v11, v10, v9: - none Changes for v8: - updated commit message for 8M Nano/Plus Changes for v7, v6: - none Changes for v5: - updated clear commit message Changes for v4, v3, v2: - none Changes for v1: - updated commit message - add downstream driver link drivers/gpu/drm/exynos/exynos_drm_dsi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index af16af404e87..603fed107fd1 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -194,7 +194,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) @@ -263,6 +263,7 @@ struct exynos_dsi_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; }; @@ -471,6 +472,7 @@ static const struct exynos_dsi_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, }; @@ -483,6 +485,7 @@ static const struct exynos_dsi_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, }; @@ -493,6 +496,7 @@ static const struct exynos_dsi_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, }; @@ -504,6 +508,7 @@ static const struct exynos_dsi_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, }; @@ -515,6 +520,7 @@ static const struct exynos_dsi_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, }; @@ -628,7 +634,8 @@ static unsigned long exynos_dsi_set_pll(struct exynos_dsi *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[] = {