From patchwork Tue Oct 8 22:38:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13827120 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0ED202256D0 for ; Tue, 8 Oct 2024 22:39:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=85.214.62.61 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728427144; cv=none; b=GFCPmpQsWqpbAgk+rRNYhgV8GvL4BHtHThffTixd+sfGcvDI0jp1f4OQdxaM9qGMNCPrz4yLuzGFFn8k1+8coqY0DGVVCVNYJMxqB+UB5PMu1QN5gU6XV82/+fsEURe/40fxj/Y3P+PMDBpSQYnYPSVjoB8gcDCErxMsUeX8ep8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728427144; c=relaxed/simple; bh=n0hmVuKS+65jnLE7/e+S9qGHmaCcMaHaqNLgzz+3vzk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HjgwnmOuV+lKGhyrvSu4NVhB8vCbmsNvaJIMrOvQEyS8T5lUoUTgatLO9Mzg2tujbpyERk4zz0f4nVQjdxQdbV7gORy71ZjYqB2ztnIDXHFEDyj+KbVQ31nyrmVDTKn7bKAxw6qmyiLUNotWET2G/+nOvQ3MUeMuHgS+QPACLvo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de; spf=pass smtp.mailfrom=denx.de; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b=MGpBHb/I; arc=none smtp.client-ip=85.214.62.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=denx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b="MGpBHb/I" Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9144588D8F; Wed, 9 Oct 2024 00:38:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1728427139; bh=hbGKo8cn7sM7/EYzSCB5grPZ7Igp1Tz0FfX/nbnW3jI=; h=From:To:Cc:Subject:Date:From; b=MGpBHb/IRODDTNqOxJiMtE21G1rU12UlYsf6gPSDgz0UCyY0hqdpFPON5z9RgoGXw wwlB3KifJa6HQ/5nYWsCDG/8rAFatUYya9OYC4RQU42kAq8j0zAoDrHef2J0WV5VI+ tKXY4qFWvWpRJTAFlAOXaAdNedN2hW5hJjGn4HDf2rmW+0icuZ3nxZRsocddbG+DhX 3tXz3grUUKNVd5W1RlsioucqmjArHTfmwO8KJE5gDbsqo9fGcNlXgSR81adRNQ0EOZ hzxAAXkNCTdSJO4TiyKeU/MfhcZ+/pj7jB6FgrxUHJabi+vNUZ9cpjgVAMvLw6ZVNf CZKSpH51CXKQQ== From: Marek Vasut To: dri-devel@lists.freedesktop.org Cc: Marek Vasut , Abel Vesa , Andrzej Hajda , David Airlie , Fabio Estevam , Isaac Scott , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Michael Turquette , Neil Armstrong , Peng Fan , Pengutronix Kernel Team , Robert Foss , Sascha Hauer , Shawn Guo , Simona Vetter , Stephen Boyd , Thomas Zimmermann , imx@lists.linux.dev, kernel@dh-electronics.com, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Subject: [PATCH 1/2] clk: imx: clk-imx8mp: Allow LDB serializer clock reconfigure parent rate Date: Wed, 9 Oct 2024 00:38:19 +0200 Message-ID: <20241008223846.337162-1-marex@denx.de> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The media_ldb_root_clk supply LDB serializer. These clock are usually shared with the LCDIFv3 pixel clock and supplied by the Video PLL on i.MX8MP, but the LDB clock run at either x7 or x14 rate of the LCDIFv3 pixel clock. Allow the LDB to reconfigure Video PLL as needed, as that results in accurate serializer clock. Signed-off-by: Marek Vasut Reviewed-by: Abel Vesa --- Cc: Abel Vesa Cc: Andrzej Hajda Cc: David Airlie Cc: Fabio Estevam Cc: Isaac Scott Cc: Jernej Skrabec Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Michael Turquette Cc: Neil Armstrong Cc: Peng Fan Cc: Pengutronix Kernel Team Cc: Robert Foss Cc: Sascha Hauer Cc: Shawn Guo Cc: Simona Vetter Cc: Stephen Boyd Cc: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org Cc: imx@lists.linux.dev Cc: kernel@dh-electronics.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-clk@vger.kernel.org --- drivers/clk/imx/clk-imx8mp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c index 516dbd170c8a3..2e61d340b8ab7 100644 --- a/drivers/clk/imx/clk-imx8mp.c +++ b/drivers/clk/imx/clk-imx8mp.c @@ -611,7 +611,7 @@ static int imx8mp_clocks_probe(struct platform_device *pdev) hws[IMX8MP_CLK_MEDIA_MIPI_PHY1_REF] = imx8m_clk_hw_composite("media_mipi_phy1_ref", imx8mp_media_mipi_phy1_ref_sels, ccm_base + 0xbd80); hws[IMX8MP_CLK_MEDIA_DISP1_PIX] = imx8m_clk_hw_composite_bus_flags("media_disp1_pix", imx8mp_media_disp_pix_sels, ccm_base + 0xbe00, CLK_SET_RATE_PARENT); hws[IMX8MP_CLK_MEDIA_CAM2_PIX] = imx8m_clk_hw_composite("media_cam2_pix", imx8mp_media_cam2_pix_sels, ccm_base + 0xbe80); - hws[IMX8MP_CLK_MEDIA_LDB] = imx8m_clk_hw_composite("media_ldb", imx8mp_media_ldb_sels, ccm_base + 0xbf00); + hws[IMX8MP_CLK_MEDIA_LDB] = imx8m_clk_hw_composite_bus_flags("media_ldb", imx8mp_media_ldb_sels, ccm_base + 0xbf00, CLK_SET_RATE_PARENT); hws[IMX8MP_CLK_MEMREPAIR] = imx8m_clk_hw_composite_critical("mem_repair", imx8mp_memrepair_sels, ccm_base + 0xbf80); hws[IMX8MP_CLK_MEDIA_MIPI_TEST_BYTE] = imx8m_clk_hw_composite("media_mipi_test_byte", imx8mp_media_mipi_test_byte_sels, ccm_base + 0xc100); hws[IMX8MP_CLK_ECSPI3] = imx8m_clk_hw_composite("ecspi3", imx8mp_ecspi3_sels, ccm_base + 0xc180); From patchwork Tue Oct 8 22:38:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13827119 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3331217915 for ; Tue, 8 Oct 2024 22:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=85.214.62.61 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728427144; cv=none; b=pN+pmlohPzwaikh+ucA5ji9S35zJBN1ZDJm1Qm/0BbfyIh0I8po07eae0Kg9uQtecThI6Bt1s/SYK8pq3rQmm74h31CpSe3xdsz6dNNhhKG9lGsx+vBsc/4VjBJR4M7dWuxdxEEXGF0sIRwxWvx1GAc2Ujq9uZVAKAqxIaGPqIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728427144; c=relaxed/simple; bh=soNkqk5Z7MS8zG0Vv+pSepZv9b94/acwTkfgSUT1QVc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8/xN9lUm/0j4ZAOhfoAl06yPk0Fw561rivAt0s4bcMbIT9XtsUFmflGi+dKyZNLNkRBZQNSOPDgR3YKjYdb3Zd/q1jDrdsJH3xbzmvCV3GGeG+uejA2uoPYiIjY3EQ+qr46VAVv4doaPRUciQRxbN6F0G/MReYVS+M4qyZ/sRA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de; spf=pass smtp.mailfrom=denx.de; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b=Ho8P2zPG; arc=none smtp.client-ip=85.214.62.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=denx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=denx.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=denx.de header.i=@denx.de header.b="Ho8P2zPG" Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 5175688F4B; Wed, 9 Oct 2024 00:38:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1728427139; bh=KJKH/WpYHcVDKhYFQkulqQ+jQNo550/ZRk57bNzhqsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ho8P2zPGsvkWVTq6nno9yUYUNYZAeiKD0pHx3LTu8uLRqwux4wXbpbpuOsVT76RmB cgrXrgUgyHGXgbtR0HTE/BuE1osAo12f883QukUgk8HMPk5+CnZq9gKKTa8xRPpRDy aInZNMB0dcY06lGFF2xQsqjbf+nLskckktP9uBvvuefOO5Z5GAYGV/y+CnSSExcZ7Q IBRy/veAZ2/SRtNpodtdqsJoFPegju8NyeUve0ixY/Jfw6FqUT9E8P9ZeXLkQp3WYI AVtBX3chfvi5SX6zDorSDh5VbsjewK7Tnyxcejj2xfFb3gqSSseCdWVgWMm/JmEvtU mBB2Ikbv8Pk+Q== From: Marek Vasut To: dri-devel@lists.freedesktop.org Cc: Marek Vasut , Abel Vesa , Andrzej Hajda , David Airlie , Fabio Estevam , Isaac Scott , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Michael Turquette , Neil Armstrong , Peng Fan , Pengutronix Kernel Team , Robert Foss , Sascha Hauer , Shawn Guo , Simona Vetter , Stephen Boyd , Thomas Zimmermann , imx@lists.linux.dev, kernel@dh-electronics.com, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org Subject: [PATCH 2/2] drm: bridge: ldb: Configure LDB clock in .mode_set Date: Wed, 9 Oct 2024 00:38:20 +0200 Message-ID: <20241008223846.337162-2-marex@denx.de> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241008223846.337162-1-marex@denx.de> References: <20241008223846.337162-1-marex@denx.de> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The LDB serializer clock operate at either x7 or x14 rate of the input LCDIFv3 scanout engine clock. Make sure the serializer clock and their upstream Video PLL are configured early in .mode_set to the x7 or x14 rate of pixel clock, before LCDIFv3 .atomic_enable is called which would configure the Video PLL to low x1 rate, which is unusable. With this patch in place, the clock tree is correctly configured. The example below is for a 71.1 MHz pixel clock panel, the LDB serializer clock is then 497.7 MHz: video_pll1_ref_sel 1 1 0 24000000 0 0 50000 video_pll1 1 1 0 497700000 0 0 50000 video_pll1_bypass 1 1 0 497700000 0 0 50000 video_pll1_out 2 2 0 497700000 0 0 50000 media_ldb 1 1 0 497700000 0 0 50000 media_ldb_root_clk 1 1 0 497700000 0 0 50000 media_disp2_pix 1 1 0 71100000 0 0 50000 media_disp2_pix_root_clk 1 1 0 71100000 0 0 50000 Signed-off-by: Marek Vasut Tested-by: Isaac Scott --- Cc: Abel Vesa Cc: Andrzej Hajda Cc: David Airlie Cc: Fabio Estevam Cc: Isaac Scott Cc: Jernej Skrabec Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Michael Turquette Cc: Neil Armstrong Cc: Peng Fan Cc: Pengutronix Kernel Team Cc: Robert Foss Cc: Sascha Hauer Cc: Shawn Guo Cc: Simona Vetter Cc: Stephen Boyd Cc: Thomas Zimmermann Cc: dri-devel@lists.freedesktop.org Cc: imx@lists.linux.dev Cc: kernel@dh-electronics.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-clk@vger.kernel.org --- drivers/gpu/drm/bridge/fsl-ldb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/bridge/fsl-ldb.c b/drivers/gpu/drm/bridge/fsl-ldb.c index 0e4bac7dd04ff..a3a31467fcc85 100644 --- a/drivers/gpu/drm/bridge/fsl-ldb.c +++ b/drivers/gpu/drm/bridge/fsl-ldb.c @@ -278,6 +278,16 @@ fsl_ldb_mode_valid(struct drm_bridge *bridge, return MODE_OK; } +static void fsl_ldb_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adj) +{ + struct fsl_ldb *fsl_ldb = to_fsl_ldb(bridge); + unsigned long requested_link_freq = fsl_ldb_link_frequency(fsl_ldb, mode->clock); + + clk_set_rate(fsl_ldb->clk, requested_link_freq); +} + static const struct drm_bridge_funcs funcs = { .attach = fsl_ldb_attach, .atomic_enable = fsl_ldb_atomic_enable, @@ -287,6 +297,7 @@ static const struct drm_bridge_funcs funcs = { .atomic_get_input_bus_fmts = fsl_ldb_atomic_get_input_bus_fmts, .atomic_reset = drm_atomic_helper_bridge_reset, .mode_valid = fsl_ldb_mode_valid, + .mode_set = fsl_ldb_mode_set, }; static int fsl_ldb_probe(struct platform_device *pdev)