From patchwork Thu Jan 26 14:44:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2679 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5B5AB3F046 for ; Thu, 26 Jan 2023 15:45:57 +0100 (CET) Received: by mail-pj1-f70.google.com with SMTP id h6-20020a17090aa88600b00223fccff2efsf2784531pjq.6 for ; Thu, 26 Jan 2023 06:45:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674744356; cv=pass; d=google.com; s=arc-20160816; b=JIbdXSfb3zL/39G1sFaI3uyXUvFOYZUvuuF7kqN1Ay3vO7sOtpkjcZH1BuzLFN1Thd ITlOqqzVnAjSvKyV1SCo6Hb1N90tZs7pND/DM42GESnoP/BReetaM65wnp7udhAqaLs3 VulVdnJ3bc5Y7If5izEiq9FFHWz/ezh2kk7ktGu1iH+ZGUqvCXE8lhpAd3indmaxGQkU fg/SYRZprMjaor/E5BVv61pUyokFm+UJ6UQ2dYOcXi6ceo53TAQ5xX3dwMzes0CD61QX pQdvlHUoJ+HyoOnjje+lCmmkzbxYUCOmRNJhl9VhoYVAHnHFyZ2Y9EMPTYU5NpMzleNN tB1A== 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=9UjrpAG3DfqfSeIRX7Vr9i0YTgESlI0JzOUiU8wHhxo=; b=qjOcEqeo/GvJgiB4y+OcL+PE+6AXjl/nKJPpsRTvZbS68S2hrTq3b7KsZHf2rikjBd Shb45TE9bTql1DHxmX5VCwBVBHxjUtq3IcYkH02pQAeid/bs5LaHoIMfEtA4kytTtuks 3YmwCfEafLzCKY6SWGZ8UkSaFNSQDQ2+UYytRT0DeZoG0n8Xb2H1iHWYv0HPG4b8OnXt +N7VfcIkk4aOWuh18ckj1vLEcmXoqaAGjYIUju5T1maOPOzFJDD3BHWTSnO38GeQP3Fa ZvQl1zpBNBb8ini5YpjdwyFfL/yJIAnYtdW6vTUgprXiJHeslAyVsfhtPNgkkCkNFN+r kxpQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rOfFYHAK; 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=9UjrpAG3DfqfSeIRX7Vr9i0YTgESlI0JzOUiU8wHhxo=; b=TDJ3NNoJg1HX9AO26JYy0Tbys1ne+WEebrE9kKEB/17XTKiLbUWuu/M4KpZg4ahRGA bC+TNJ0W0Rf01Y3qCuci5wkn9qN9Zju+xPuc2YEXSlEqJop2s2fzvw/dy64fekd7IubX knoQGPjP+vmuuHWnKbWr3aOQCpVkaWpJiuFaQ= 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=9UjrpAG3DfqfSeIRX7Vr9i0YTgESlI0JzOUiU8wHhxo=; b=I9V3Ca4NnK+bFG9hmUWk2rTvVYI2lf2oiJpIOwvIpjKNCFM6m1zdfmxXM6RIJ5PQLG LRCHBMp1gM6G7Z4edlYswa1/SNSpGEwHBf7OGAlxBeEZzNWjoUKQ8x7WjnVKDDLKwjpN vTfMg5opbWk14MLmJ0BTAAgxzomfWq3O0jnnMAgmUc/qv4CnFy8wpk96TE8jsBdbQy8+ TMjq1DybL2zqDfEil8ZDT4IqmzGJMypOZ/y1l2/xUdussLTqTgVC+241qfg4SKyOG9T7 m/Ujd7kcsc9V0Wq/fvfmNnNHlvVK6oECyLWSoP2GKm86SwG8K2qm3Raqgb0rngLGWnbX sHHg== X-Gm-Message-State: AFqh2kqVqWIqIr0S6KjqsJusplC81+fILE1sWb7wcHmNICHeX9aV3xf/ MpZMJPW/VlGfyK0BYwh+Y+H7JT8c X-Google-Smtp-Source: AMrXdXuHEv4SbJd5x3vH1PAR0MzJLYfdMhUEDW7opuBVglYIZkhc0idWzSpBcmos5quBeRXa7AJW+g== X-Received: by 2002:a17:90b:686:b0:229:7638:4499 with SMTP id m6-20020a17090b068600b0022976384499mr4363818pjz.167.1674744356197; Thu, 26 Jan 2023 06:45:56 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:d80e:b0:22b:eeb8:fd6a with SMTP id a14-20020a17090ad80e00b0022beeb8fd6als2661201pjv.1.-pod-control-gmail; Thu, 26 Jan 2023 06:45:55 -0800 (PST) X-Received: by 2002:a17:903:2405:b0:194:5116:c3ee with SMTP id e5-20020a170903240500b001945116c3eemr39735660plo.37.1674744355286; Thu, 26 Jan 2023 06:45:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674744355; cv=none; d=google.com; s=arc-20160816; b=ER9rxjntQoDklqRyzJYBxqKcYQDqgQHD0wHcPnPOkE6J0I/PoWyCd77siefA9LL2CR 4MqfsxKPKGcQkKiy7lfdBreJB/H7HHH7nEenjgVI3KfBzz+7bVcKJ0o7pqWdDxRWfcen PHK4g/vJjTwuGPAlj60GpnxgX+gLUBWuLWcl5KNBQyoiaBQ45LXWRC5fASWV/10oFTXP qMlXKhiCYTwcZrhsNUoFK01zQl2D1iL2xk+/QPp7YRZYILAfSDrYtVS7YTeumFLNrGGO Sg3gHmkSextFhUUpoz/mSrgrnzrUmfIDDICVFuKCowVQEVZ1JXplcKwP3lLrj8bcwkr7 5NUA== 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=fCKziNtWsgASij+dWWGaDpyDhpD6z6/DqCOerXlFmzI=; b=F9sjZBAUc/wKUtYy87BpcOrjhIBRBy46PDZkKIDA28eiAvuKbabPdUS/PdPLpVoEm5 NH17EwfumavMSiU8m32y8wzT/ndQyqcfEci2Lr5aNxUAC/NRXiJebFzO4bAclm9IUy8T guc03lB3Kmx+7OdC9CxOX/BdCovPCdJ1H4Yl/TF+SiA5vMMg/jGZmTd2ddYziqarRRW0 Nc+pOLj/OeUxvibg6DkupM+wdync3si6TCwsXkDwPH46TpXgE8LjegRnNn9FM3aadD2o hiEFkK+yrWYAIQKJG0hMXnx3LHuABpL2/ofjqCp3nYZ8SZpwSN9vdzD6GU9SvqUxix6h fKEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rOfFYHAK; 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 l5-20020a170903244500b0019607072b23sor708123pls.109.2023.01.26.06.45.55 for (Google Transport Security); Thu, 26 Jan 2023 06:45:55 -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:8f0d:b0:a3:6f97:e658 with SMTP id b13-20020a056a208f0d00b000a36f97e658mr50988661pzk.58.1674744354967; Thu, 26 Jan 2023 06:45:54 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a238:3cb1:2156:ef87:8af5]) by smtp.gmail.com with ESMTPSA id d197-20020a6336ce000000b0042988a04bfdsm823660pga.9.2023.01.26.06.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 06:45:54 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Robert Foss , Laurent Pinchart , 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 v12 06/18] drm: exynos: dsi: Add platform PLL_P (PMS_P) offset Date: Thu, 26 Jan 2023 20:14:15 +0530 Message-Id: <20230126144427.607098-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126144427.607098-1-jagan@amarulasolutions.com> References: <20230126144427.607098-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=rOfFYHAK; 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 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 5918d31127aa..7a845badb1b2 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[] = {