From patchwork Wed Jul 20 15:52:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2194 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 40A413F03E for ; Wed, 20 Jul 2022 17:53:22 +0200 (CEST) Received: by mail-pj1-f70.google.com with SMTP id 7-20020a17090a08c700b001f225490835sf451300pjn.7 for ; Wed, 20 Jul 2022 08:53:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658332401; cv=pass; d=google.com; s=arc-20160816; b=w7YRXYKyygnZe8qQSjVMpx9scap19W02Sfmv26/EIxhXKXb1LmZOFJVryoxAHipsxs Hf0WPmP5NgKxmiznB2vvXLYJ48lSlGtkU1Xbuj/wFWnl6v1wg1ZcNb6rby8GVl+Q58KK fw02NJfU/HHPsEKKm4TvZJhsIC8t1zqicQZmyQZhRWyzV23pvyYbBUjMHrrJZXsgNzcS cTbHLYBfTdd+JUxH4Sk7ScC/LCAjuZvySAruQ3iXKJHXn8GW7uLb7QVvnFTCuI/Daoc0 ZrP/9M1SghU0ES22QDQF46NQyU7mlNKjLXSPSvsg10XhcDsNLeH8FpQ8eZqjpROCH2Fg ENuA== 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=jn6D3uIC1ooRK+Ll9haZ6PUMdQ7IhLkdyXsw55S4kMc=; b=wvRo58eSjz/tFfYGaT4p7ZNtPymwxuqilV4Ayn3hb9SXPUPpH/6U6DFq8F+y4pAaoH i5LEazWVjlazWAJtsjzulIPKttGnlyHXEIcu+QAHZdF+C1upIMJwCnIWB5j9RjoX7+VP KMot+fFNa+DL8MqzdHeylty/Q+n2YdcCq1KthpTbYq17jUxBPmhEzY131chvOVXmjBY6 scWSBt5Fpjt4xZRUOVjLxcakaoutcns7YvJK1yMm9oKZGfvKih1mlBLh7oaYyHgkMEd6 vEu5sboDjRkY7JeUYc4WLlE+kEzPU7lL/irbIEj8D9NGLsNuKUAE54QBqXb5dStZgGv1 +HBg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GkZXTRM+; 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=jn6D3uIC1ooRK+Ll9haZ6PUMdQ7IhLkdyXsw55S4kMc=; b=pOYsRFdhK5KOXTEI1iFpxPbPfobTX3GnI9dhR9JdW7/Qq63wsaahKyWEk3bw1eYWdE rwYw0Bwmrszijvv6OKlKFPrNSlkvc1++XV58Fum3rguN5ODF7vh5qgbaA7UeGWWiu6Q3 ovn/Eb/jcZsra3uDoOYNIJ9kaQ+vULkUeGmn8= 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=jn6D3uIC1ooRK+Ll9haZ6PUMdQ7IhLkdyXsw55S4kMc=; b=IvEH98qE1OFrDkSjbk/Z/Ca0KTDKvHIl5nChNvuEqz0jYbuTmcaBQmzDubpk8rSqkP kLoNvUEqf8MoxWY6rNfAjRbQsXqekug6B1bnxYhYEvDf0oqThGcbvwpVbckt51Jwilu3 /qyRGha9kQES+nXv8ViJo8cLT4PRY3BnglLNu4DET0W7kVqL0/a5f7UFjPVUwNl8jYkB e5C7yq3riv39dQqU+B6dNnzArRgS2KADeZfWNTFgpIJ2GDpGK0aOdlGsYo8Zs07QgOze K9jSUdiY4ZG+MYGJs8zP0bEnce7zi+a8nCZ8xJ6K1vTtwGVp1kTGhe6Nwff5CsruK9hh 2a9w== X-Gm-Message-State: AJIora+O+3wAwmcF0hh0EZrsP7yOJ3mTJMHlyMopNVGuj1iuvAWeR9z/ udmYNWvekzEAmWwAJxuR0xX503uy X-Google-Smtp-Source: AGRyM1sqDJwgKKkBNNmV0Xaon+QoxnxUihDaegCp06h0XFIodqPkR0PjKV9KXqeY8vjKXrGCuT4SqA== X-Received: by 2002:a17:90b:3c07:b0:1f0:eab4:79e4 with SMTP id pb7-20020a17090b3c0700b001f0eab479e4mr6095050pjb.186.1658332401119; Wed, 20 Jul 2022 08:53:21 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8646:b0:16c:1db:3665 with SMTP id y6-20020a170902864600b0016c01db3665ls909869plt.10.-pod-prod-gmail; Wed, 20 Jul 2022 08:53:20 -0700 (PDT) X-Received: by 2002:a17:902:788b:b0:16c:dbb2:2c02 with SMTP id q11-20020a170902788b00b0016cdbb22c02mr23097486pll.13.1658332400291; Wed, 20 Jul 2022 08:53:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658332400; cv=none; d=google.com; s=arc-20160816; b=W5AYoW1qPLcmqEM70Mg0WPmaf0yipT+8VvRM0i7FU9Nl/ulAdxGjPd7JUTBXxCLp6k WUck7hFt/kskOY59m6IpA7DRS0RzPAzm7Z1kqjAgBuJAqVemoeyC2xSYE84+uXVVy0+y 6/WO0WWVxQHMFXmaRVikNFQG53KgOpNZb53tIux3ABsvyRSQDHY7RX6S6c+gTzqYeiPx YOtOzs2VYsjQjf36/hKKJCkyqcpx2k0+smCuHBgUxozNhu/hnJbVGJzieC2YQaD2nMjM MIm8Q7a/Im5mPxYUrmmxj7WnXWkiwvoP9wvDfwGJv1b1M2T4zdK3GxlR+Uk+lZlj4ckS OOcQ== 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=QxR6CUOwwWEjMcW3mif4HEJmZlAI1+6I4LruC075u5Y=; b=Pn2tu+Z5VLE+Y1WY7WxOYmUT44dF3eOcshuK1rq9PN7oy8VQjnHKRqAIcXbTDs3CH3 j4aUivWbf+/1qcBjnVYl0MvjLcqrRcPHRugzNGhAEb6UJ5RYKyIJs6jseWSQPuHArl2W dy1FRM3kXhP1UIlOqTuR1nhM+R0SL9xCNIl2wwQS/NpO79MICzaA6StvhkXHpNVKTqcb 1FOJj5dzNAcUOmHPbHNiPxD/ya38bPer12vmmyUZwWVo2HBlJFSYHdZgEbr2PGKJlSAY x0TdqvEKf+SU/MVXFHrJhk+mkitCZObfu1fNGEl57Ikt4uFDpnTO4eCNDFVJzvbE7OAV 3JXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GkZXTRM+; 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 12-20020a17090a08cc00b001f228094a6esor177343pjn.7.2022.07.20.08.53.20 for (Google Transport Security); Wed, 20 Jul 2022 08:53:20 -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:90b:1e53:b0:1f0:2a08:e101 with SMTP id pi19-20020a17090b1e5300b001f02a08e101mr6356268pjb.208.1658332399980; Wed, 20 Jul 2022 08:53:19 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:d177:d5:aee:4f03]) by smtp.gmail.com with ESMTPSA id a8-20020a170902710800b0015e8d4eb1d7sm13919198pll.33.2022.07.20.08.53.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:53:19 -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 , 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 v3 07/13] drm: bridge: samsung-dsim: Fix PLL_P (PMS_P) offset Date: Wed, 20 Jul 2022 21:22:04 +0530 Message-Id: <20220720155210.365977-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220720155210.365977-1-jagan@amarulasolutions.com> References: <20220720155210.365977-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=GkZXTRM+; 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 v3, 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 b07909a52f2d..5eb594ea0bdf 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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -381,6 +382,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -392,6 +394,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -404,6 +407,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -416,6 +420,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -563,7 +568,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 97fdee5ef5df..c852d7b9981e 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -46,6 +46,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; enum samsung_dsim_quirks quirks; };