From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795030708; b=y2QEOEe4XlLcjxciFlEq6LVP6KHWaVAooVKHhXo+xeMOiD6lzBK0/KD3gzdqq/6sW5z4 aDIM0qZ1raF6HXsVi3QXzaD6o03RAJC9ZgMFO6IdJrjfzUrA54duFRrzo8ouZSdZMQUfe aQQESY7vUmeFLWiX/2Zz3crlSJxHlxLjaKFCF3nA1VW07xF1ulAYp8Cyb2QdxYCWTCJZU Toy3aujVhq8P4cVIFwa7owDcDk4u6S8NGtC6bQG01TtueYCOAR1T+epMVUUQjfBcOA+U6 nHiPlO0WAWWrPUb9LVrhZgjRr5xcy7y4cGIfLoESXaUZL7B1ABTwcZ+SU613vPEWCaQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795030708; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=H4Z2ZE4c68Aq4HwZRpxbAFKgI0wb42XJ+mkGztiuaxA=; b=IdXel4ZVcYGd6M1+fIBdbqXfMMgVSIiDue0iriJ3FDR/5xmt8Wapa/5er9RQyeCLyaQn AJ5InndGSCvil8iYJqt1Jgg0BT3WnHkjOkjCOHjEmihAbJemkwoZWXgZZW4aYUTlbIUuN Ini1XxCOQGu9f/lzvVN3iLm7dcBaXKPxI1dU+NjDe9G5kOpBnZJNtUjWlAUlT09oJnZov 6BPqGTNEc0IkzSRV/ROJv8KGoY5bTXiaUyoo7DVy33AH1mfeweAkE1Q6VPLGjuPEfaios 3Unx7BslQKuyF6nD3ah4VmqE/+S8UF8/P2CIfkbo/CkpBNU3w6d9ZR8jjUxEA4Rch5Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YCLgQ30U; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8853D606A333; Wed, 18 Nov 2026 19:38:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YCLgQ30U Received: by smtp.kernel.org (Postfix) with ESMTPSA id E53FA1F000C6; Wed, 18 Nov 2026 19:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795030708; bh=H4Z2ZE4c68Aq4HwZRpxbAFKgI0wb42XJ+mkGztiuaxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YCLgQ30UZ2LnX7zW6dziacGXFHvmzacp0Od7fxZ69dksbiJS/K92zZx233AmIkE1j jK/gu3UjCei0EPQukvmUsm1uDy2H8J76iCmCzmU8MB+POXMywMmWs5dherUl1lUPom On7YbhHXjvyH6+RSZjZdzE/dBJmSHEPDbh1vnadE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Adam Ford , Marco Felsch , Frieder Schrempf , Dominique Martinet , Vinod Koul , Sasha Levin Subject: [PATCH 6.12 0801/1756] phy: freescale: fsl-samsung-hdmi: Simplify REG21_PMS_S_MASK lookup Date: Wed, 18 Nov 2026 15:48:48 +0100 Message-ID: <20261118150041.572333210@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150007.957976754@linuxfoundation.org> References: <20261118150007.957976754@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adam Ford [ Upstream commit 375ee44adb3640099508c5c0c01d86f0bdb16e97 ] The value of 'S' is writen to two places, PHY_REG3[7:4] and PHY_REG21[3:0]. There is a lookup table which contains the value of PHY_REG3. Rather than using a switch statement based on the pixel clock to search for the value of 'S' again, just shift the contents of PHY_REG3[7:4] >> 4 and place the value in PHY_REG21[3:0]. Doing this can eliminate an entire function. Signed-off-by: Adam Ford Reviewed-by: Marco Felsch Reviewed-by: Frieder Schrempf Tested-by: Frieder Schrempf Reviewed-by: Dominique Martinet Tested-by: Dominique Martinet Link: https://lore.kernel.org/r/20240914112816.520224-3-aford173@gmail.com Signed-off-by: Vinod Koul Stable-dep-of: c01ccf91b257 ("phy: freescale: fsl-samsung-hdmi: initialize default rate") Signed-off-by: Sasha Levin --- drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 39 ++------------------ 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c index acea7008aefc5..4f6874226f9ab 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -364,40 +364,6 @@ to_fsl_samsung_hdmi_phy(struct clk_hw *hw) return container_of(hw, struct fsl_samsung_hdmi_phy, hw); } -static void -fsl_samsung_hdmi_phy_configure_pixclk(struct fsl_samsung_hdmi_phy *phy, - const struct phy_config *cfg) -{ - u8 div = 0x1; - - switch (cfg->pixclk) { - case 22250000 ... 33750000: - div = 0xf; - break; - case 35000000 ... 40000000: - div = 0xb; - break; - case 43200000 ... 47500000: - div = 0x9; - break; - case 50349650 ... 63500000: - div = 0x7; - break; - case 67500000 ... 90000000: - div = 0x5; - break; - case 94000000 ... 148500000: - div = 0x3; - break; - case 154000000 ... 297000000: - div = 0x1; - break; - } - - writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, div), - phy->regs + PHY_REG(21)); -} - static void fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy, const struct phy_config *cfg) @@ -466,7 +432,10 @@ static int fsl_samsung_hdmi_phy_configure(struct fsl_samsung_hdmi_phy *phy, for (i = 0; i < PHY_PLL_DIV_REGS_NUM; i++) writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG(2) + i * 4); - fsl_samsung_hdmi_phy_configure_pixclk(phy, cfg); + /* High nibble of pll_div_regs[1] contains S which also gets written to REG21 */ + writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, + cfg->pll_div_regs[1] >> 4), phy->regs + PHY_REG(21)); + fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg); writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG(33)); -- 2.53.0