From nobody Fri Dec 19 10:47:43 2025 Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) (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 E61D32D02E for ; Tue, 3 Sep 2024 01:31:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327092; cv=none; b=Og/ASvuLJ1r+XzBX7ujGDhY0vLKpCuXrUabwvtPOArdo8de7Gm3CCkPREfmnJT4w3DoxWQeSuap0wZ7xvUjwISwfV+rtK+hLJp9ZuNK8OV+v9DJo33gOa5v5cL1wt6uKaXTRTn7naKosqefxrsfhcciYIYo0dLf/QzB02kBPZGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327092; c=relaxed/simple; bh=A9xZZCSU6fkdy8sTU8fS1ZD+DOcMaJ5We/b+jIAI9Ug=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L6IJHarsCLVh4AKpGr9GZabbsYwh9KyYEMueT5EfoU2HqOjlSN157/FkODIRjtpFNXUene6/AbB3Oqj8kJdefS85i9pJI5FeauG95wNadO4TqBO2dfs+uCNf7n2yNyojk/wqkKmZnYi331fIDvGg7EY5qMNHOsHD4j3lvV/tNVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J7CuMuas; arc=none smtp.client-ip=209.85.166.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J7CuMuas" Received: by mail-io1-f45.google.com with SMTP id ca18e2360f4ac-82a205810ccso232615639f.2 for ; Mon, 02 Sep 2024 18:31:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725327090; x=1725931890; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zU/UINi6mzJhHAotxEQQcl3IUxqOyO5QeCFKI62Aqus=; b=J7CuMuassczvUL/qgUpFpqS+imYohtjLhjfE+BVbFzN0Y7Iq/LJvWCXXnzBERg5iza 4xn7tvLF07bXDHg6HWgebUUc8lJm6EuwG6bnrT4OImQ7ucX/whzK6kntiW0jb55qj9nX cCtsJYr5hBLnc5zswNCimt40yTQ/8UQKUjmmV4M1KW6nUzouxwK9NDSc/Oa9n5wBW0cG JsJbJ8zdE7jxGiWy1DIPnbE2JDxARsMFdQm46mthDkdXRm8cINudd0wNzQI+RKT48Iu8 RXWJC2L9GDG0vZx1Q7WKPe9l4c9/ivtesnBRnItZPXZZG/rMjKvQ56syL6GXjeQ3oeJy Bu6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725327090; x=1725931890; h=content-transfer-encoding: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=zU/UINi6mzJhHAotxEQQcl3IUxqOyO5QeCFKI62Aqus=; b=pHjx+pm/bSPSPJ39Y/It8Uaxj0gBrgtTBzQCUBbORnP6i4H7KUC0myE3ZhOnoHu5ka 1JP+0AD8nKW+Xd3NEl2y4DJv4jnAms1JwQJCRf9jTaOiuBeIYx0J/dXB5kSU7K+oIFit dXDgoWw+wT77soFHQcaEklHDxR3Nr9sAXaXzzTzB8P2Ul145HIVi++m7ZKJYpXoc44f9 n906mkL8p1kdGMhpWJJoEnJb56fwtnmZA6a7s0aX3AJsbS1xj3Qm/NGAzKvkSxSe2GdY 9Fn0DtLY0rF+RkAzr7pgukDn39roj4sakF2jGU3cQUDr7BXnoUVGlYwbwmCQ3Q1q32ss sYdg== X-Forwarded-Encrypted: i=1; AJvYcCW0JlKBmy3dva/AII0+Foq2CbRa0zXRs/mvdEdj5jqAOw+Ic9AYC6/TSC+jVs84Q9Zer3o3qd13EKAzfPw=@vger.kernel.org X-Gm-Message-State: AOJu0YwNfEXukmQqV9VgdivTpZTcxkBSxXKgGBpXiBXjHULysiekaDHK YR1LzaiKivk1i6nC0G4cMGz66Y9TL6DQsx57bMsQZ/0f2f0gJr95 X-Google-Smtp-Source: AGHT+IGCbek5rkXOeRzwCk76ektRzxd63et2tHgSqfS/fs+mB7RuA0hEkmF4+HMtKeMXQ0UAaO5unQ== X-Received: by 2002:a05:6e02:1949:b0:38b:48c9:55d5 with SMTP id e9e14a558f8ab-39f4f52a8e5mr101279385ab.13.1725327089863; Mon, 02 Sep 2024 18:31:29 -0700 (PDT) Received: from aford-System-Version.lan (c-75-72-166-104.hsd1.mn.comcast.net. [75.72.166.104]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39f3b059c32sm28466715ab.75.2024.09.02.18.31.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 18:31:29 -0700 (PDT) From: Adam Ford To: linux-phy@lists.infradead.org Cc: dominique.martinet@atmark-techno.com, linux-imx@nxp.com, festevam@gmail.com, frieder.schrempf@kontron.de, aford@beaconembedded.com, Sandor.yu@nxp.com, Adam Ford , Vinod Koul , Kishon Vijay Abraham I , Marco Felsch , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Lucas Stach , linux-kernel@vger.kernel.org Subject: [PATCH V4 1/5] phy: freescale: fsl-samsung-hdmi: Replace register defines with macro Date: Mon, 2 Sep 2024 20:30:43 -0500 Message-ID: <20240903013113.139698-2-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903013113.139698-1-aford173@gmail.com> References: <20240903013113.139698-1-aford173@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There are 47 registers defined as PHY_REG_xx were xx goes from 00 to 47. Simplify this by replacing them all with a macro which is passed the register number to return the proper register offset. Signed-off-by: Adam Ford Reviewed-by: Marco Felsch --- drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 138 ++++++------------- 1 file changed, 41 insertions(+), 97 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/fre= escale/phy-fsl-samsung-hdmi.c index 9048cdc760c2..bc5d3625ece6 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -14,76 +14,20 @@ #include #include =20 -#define PHY_REG_00 0x00 -#define PHY_REG_01 0x04 -#define PHY_REG_02 0x08 -#define PHY_REG_08 0x20 -#define PHY_REG_09 0x24 -#define PHY_REG_10 0x28 -#define PHY_REG_11 0x2c - -#define PHY_REG_12 0x30 -#define REG12_CK_DIV_MASK GENMASK(5, 4) - -#define PHY_REG_13 0x34 -#define REG13_TG_CODE_LOW_MASK GENMASK(7, 0) - -#define PHY_REG_14 0x38 -#define REG14_TOL_MASK GENMASK(7, 4) -#define REG14_RP_CODE_MASK GENMASK(3, 1) -#define REG14_TG_CODE_HIGH_MASK GENMASK(0, 0) - -#define PHY_REG_15 0x3c -#define PHY_REG_16 0x40 -#define PHY_REG_17 0x44 -#define PHY_REG_18 0x48 -#define PHY_REG_19 0x4c -#define PHY_REG_20 0x50 - -#define PHY_REG_21 0x54 -#define REG21_SEL_TX_CK_INV BIT(7) -#define REG21_PMS_S_MASK GENMASK(3, 0) - -#define PHY_REG_22 0x58 -#define PHY_REG_23 0x5c -#define PHY_REG_24 0x60 -#define PHY_REG_25 0x64 -#define PHY_REG_26 0x68 -#define PHY_REG_27 0x6c -#define PHY_REG_28 0x70 -#define PHY_REG_29 0x74 -#define PHY_REG_30 0x78 -#define PHY_REG_31 0x7c -#define PHY_REG_32 0x80 - -/* - * REG33 does not match the ref manual. According to Sandor Yu from NXP, - * "There is a doc issue on the i.MX8MP latest RM" - * REG33 is being used per guidance from Sandor - */ - -#define PHY_REG_33 0x84 -#define REG33_MODE_SET_DONE BIT(7) -#define REG33_FIX_DA BIT(1) - -#define PHY_REG_34 0x88 -#define REG34_PHY_READY BIT(7) -#define REG34_PLL_LOCK BIT(6) -#define REG34_PHY_CLK_READY BIT(5) - -#define PHY_REG_35 0x8c -#define PHY_REG_36 0x90 -#define PHY_REG_37 0x94 -#define PHY_REG_38 0x98 -#define PHY_REG_39 0x9c -#define PHY_REG_40 0xa0 -#define PHY_REG_41 0xa4 -#define PHY_REG_42 0xa8 -#define PHY_REG_43 0xac -#define PHY_REG_44 0xb0 -#define PHY_REG_45 0xb4 -#define PHY_REG_46 0xb8 -#define PHY_REG_47 0xbc +#define PHY_REG(reg) (reg * 4) + +#define REG12_CK_DIV_MASK GENMASK(5, 4) +#define REG13_TG_CODE_LOW_MASK GENMASK(7, 0) +#define REG14_TOL_MASK GENMASK(7, 4) +#define REG14_RP_CODE_MASK GENMASK(3, 1) +#define REG14_TG_CODE_HIGH_MASK GENMASK(0, 0) +#define REG21_SEL_TX_CK_INV BIT(7) +#define REG21_PMS_S_MASK GENMASK(3, 0) +#define REG33_MODE_SET_DONE BIT(7) +#define REG33_FIX_DA BIT(1) +#define REG34_PHY_READY BIT(7) +#define REG34_PLL_LOCK BIT(6) +#define REG34_PHY_CLK_READY BIT(5) =20 #define PHY_PLL_DIV_REGS_NUM 6 =20 @@ -369,29 +313,29 @@ struct reg_settings { }; =20 static const struct reg_settings common_phy_cfg[] =3D { - { PHY_REG_00, 0x00 }, { PHY_REG_01, 0xd1 }, - { PHY_REG_08, 0x4f }, { PHY_REG_09, 0x30 }, - { PHY_REG_10, 0x33 }, { PHY_REG_11, 0x65 }, + { PHY_REG(0), 0x00 }, { PHY_REG(1), 0xd1 }, + { PHY_REG(8), 0x4f }, { PHY_REG(9), 0x30 }, + { PHY_REG(10), 0x33 }, { PHY_REG(11), 0x65 }, /* REG12 pixclk specific */ /* REG13 pixclk specific */ /* REG14 pixclk specific */ - { PHY_REG_15, 0x80 }, { PHY_REG_16, 0x6c }, - { PHY_REG_17, 0xf2 }, { PHY_REG_18, 0x67 }, - { PHY_REG_19, 0x00 }, { PHY_REG_20, 0x10 }, + { PHY_REG(15), 0x80 }, { PHY_REG(16), 0x6c }, + { PHY_REG(17), 0xf2 }, { PHY_REG(18), 0x67 }, + { PHY_REG(19), 0x00 }, { PHY_REG(20), 0x10 }, /* REG21 pixclk specific */ - { PHY_REG_22, 0x30 }, { PHY_REG_23, 0x32 }, - { PHY_REG_24, 0x60 }, { PHY_REG_25, 0x8f }, - { PHY_REG_26, 0x00 }, { PHY_REG_27, 0x00 }, - { PHY_REG_28, 0x08 }, { PHY_REG_29, 0x00 }, - { PHY_REG_30, 0x00 }, { PHY_REG_31, 0x00 }, - { PHY_REG_32, 0x00 }, { PHY_REG_33, 0x80 }, - { PHY_REG_34, 0x00 }, { PHY_REG_35, 0x00 }, - { PHY_REG_36, 0x00 }, { PHY_REG_37, 0x00 }, - { PHY_REG_38, 0x00 }, { PHY_REG_39, 0x00 }, - { PHY_REG_40, 0x00 }, { PHY_REG_41, 0xe0 }, - { PHY_REG_42, 0x83 }, { PHY_REG_43, 0x0f }, - { PHY_REG_44, 0x3E }, { PHY_REG_45, 0xf8 }, - { PHY_REG_46, 0x00 }, { PHY_REG_47, 0x00 } + { PHY_REG(22), 0x30 }, { PHY_REG(23), 0x32 }, + { PHY_REG(24), 0x60 }, { PHY_REG(25), 0x8f }, + { PHY_REG(26), 0x00 }, { PHY_REG(27), 0x00 }, + { PHY_REG(28), 0x08 }, { PHY_REG(29), 0x00 }, + { PHY_REG(30), 0x00 }, { PHY_REG(31), 0x00 }, + { PHY_REG(32), 0x00 }, { PHY_REG(33), 0x80 }, + { PHY_REG(34), 0x00 }, { PHY_REG(35), 0x00 }, + { PHY_REG(36), 0x00 }, { PHY_REG(37), 0x00 }, + { PHY_REG(38), 0x00 }, { PHY_REG(39), 0x00 }, + { PHY_REG(40), 0x00 }, { PHY_REG(41), 0xe0 }, + { PHY_REG(42), 0x83 }, { PHY_REG(43), 0x0f }, + { PHY_REG(44), 0x3E }, { PHY_REG(45), 0xf8 }, + { PHY_REG(46), 0x00 }, { PHY_REG(47), 0x00 } }; =20 struct fsl_samsung_hdmi_phy { @@ -442,7 +386,7 @@ fsl_samsung_hdmi_phy_configure_pixclk(struct fsl_samsun= g_hdmi_phy *phy, } =20 writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, div), - phy->regs + PHY_REG_21); + phy->regs + PHY_REG(21)); } =20 static void @@ -469,7 +413,7 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_= samsung_hdmi_phy *phy, break; } =20 - writeb(FIELD_PREP(REG12_CK_DIV_MASK, ilog2(div)), phy->regs + PHY_REG_12); + writeb(FIELD_PREP(REG12_CK_DIV_MASK, ilog2(div)), phy->regs + PHY_REG(12)= ); =20 /* * Calculation for the frequency lock detector target code (fld_tg_code) @@ -489,11 +433,11 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fs= l_samsung_hdmi_phy *phy, =20 /* FLD_TOL and FLD_RP_CODE taken from downstream driver */ writeb(FIELD_PREP(REG13_TG_CODE_LOW_MASK, fld_tg_code), - phy->regs + PHY_REG_13); + phy->regs + PHY_REG(13)); writeb(FIELD_PREP(REG14_TOL_MASK, 2) | FIELD_PREP(REG14_RP_CODE_MASK, 2) | FIELD_PREP(REG14_TG_CODE_HIGH_MASK, fld_tg_code >> 8), - phy->regs + PHY_REG_14); + phy->regs + PHY_REG(14)); } =20 static int fsl_samsung_hdmi_phy_configure(struct fsl_samsung_hdmi_phy *phy, @@ -503,7 +447,7 @@ static int fsl_samsung_hdmi_phy_configure(struct fsl_sa= msung_hdmi_phy *phy, u8 val; =20 /* HDMI PHY init */ - writeb(REG33_FIX_DA, phy->regs + PHY_REG_33); + writeb(REG33_FIX_DA, phy->regs + PHY_REG(33)); =20 /* common PHY registers */ for (i =3D 0; i < ARRAY_SIZE(common_phy_cfg); i++) @@ -511,14 +455,14 @@ static int fsl_samsung_hdmi_phy_configure(struct fsl_= samsung_hdmi_phy *phy, =20 /* set individual PLL registers PHY_REG2 ... PHY_REG7 */ for (i =3D 0; i < PHY_PLL_DIV_REGS_NUM; i++) - writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG_02 + i * 4); + writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG(2) + i * 4); =20 fsl_samsung_hdmi_phy_configure_pixclk(phy, cfg); fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg); =20 - writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG_33); + writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG(33)); =20 - ret =3D readb_poll_timeout(phy->regs + PHY_REG_34, val, + ret =3D readb_poll_timeout(phy->regs + PHY_REG(34), val, val & REG34_PLL_LOCK, 50, 20000); if (ret) dev_err(phy->dev, "PLL failed to lock\n"); --=20 2.43.0 From nobody Fri Dec 19 10:47:43 2025 Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (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 E77A01CCEFD for ; Tue, 3 Sep 2024 01:31:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327097; cv=none; b=XXNQ04kucE+VzFcuzQScFva+m13H5r4qP2obq4WEyk2nlWG0bXzgU7j7oayxdA2V8m57uIw6bIRiHkC23j+BWivz8WiHFPcYNYl1wOgEN8mTvM6njUoNBboDPY/45gZviHPV+/evevR6u0/F+ct5GFtFLADSzeS2XOdxrRQiu8E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327097; c=relaxed/simple; bh=2KEsNWSHB9EcLDWaALj0R/0FWZ3PB+ji0y2f+6UTdmM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UVi1p8pnC8O0xy7tCwco7Tg1GB0wjFh2wPf0hlIZp71ap6kf68qzach2JVsdoqezgET3zVN3P+gPSpubNC2fOqZG2XcufO/ThtsDDfDfa/72A96jbgAzhaphwCCZztcrRPIHZl3ugza3d01foow30PKrVYYpKMI0vwhH8LUthJU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TsPLrnUI; arc=none smtp.client-ip=209.85.166.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TsPLrnUI" Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-39d47a9ffb9so17567805ab.1 for ; Mon, 02 Sep 2024 18:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725327095; x=1725931895; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9wVQDkoBZtHEQkKMZT4UIQ8IV+tatzzx9ZIraz0AFHI=; b=TsPLrnUICVJzxSEbJETi0nkuAE6KXbsgswIP81e+d593DRaTmMvby4gd5DgF/ZX/TU wkgBU6/gKbFSKfg7Uvd5n/5D2ZUIUdUOdyW+9nkvy1brAGeCj2UVjLl7fAjWlTs1GkTN IsiXIEa4neetvqa/3K2IXIfsMPP1UQI2U44kVc5b/FoAvvjQAKiOYdSWdJHjj0ZWsByo +/O5LvXxrShXXLYU81sc9mIN99EwlSHninxkfeAnAjdRwqlIzG0YJp93Ca2RP0hhjTkl LSfgdJmisjkiYvFNDLZXgf3QkKsWPl+phfBMeCSIyUMHL3rAmmoHhqJRPbAMuyTb69C+ FbBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725327095; x=1725931895; h=content-transfer-encoding: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=9wVQDkoBZtHEQkKMZT4UIQ8IV+tatzzx9ZIraz0AFHI=; b=reiIDIjfsy9MIkCLz5nr1RpDFEwnj0ssU/bc23vEhil+WxQ/ePAcv8lZhAKHVJt31/ XkoFX8IwjvCQa7wi/azWqrTuS5ZDbCIb/cukVuD45hckFcbhtECRlB8negxMV5qczi2A EveFxWi1lqCccCQtW3F9Lq8FfoHt8f5H1CIlJ74FNcNyVmtqBEZoIzPmyHuQr3tyvCoY YAbYCN7VvjS4C2GICxcL6T9TKDwDoeWNlnJ8Mlt+N5xA+vFtTSAieQ6rVR/w1rut3ltR 0+cQUBv8cvlj4y0dQ+xHAmD/wketT7eEb5SZbTDxG522nCd4y9du1gZHMEAm3xbRK2q5 VVeQ== X-Forwarded-Encrypted: i=1; AJvYcCW8wN3UJJPOAdhDapwxYTJxnWJP06TuzJ6TrxNAl8P1BJ7sIrOJhydEpzqhNqUwymoblEyTTLqaoQoLtOY=@vger.kernel.org X-Gm-Message-State: AOJu0YxAwarwBHhabpzBZRrrxG8ceDEeGsPAjeBrsi2yvowTk9/huYnc CfCbmbT6nZc5EE7JsYDp/uNgL1T4PxAe4ShUncc4v5WEymJ59kn1 X-Google-Smtp-Source: AGHT+IE0MGF4aNsgfVs4SXY+HfrnvzcV+aUNnWbo1l7pAkhO8tS/DkTg/rkSwfteXsUIx2VFq8s2kQ== X-Received: by 2002:a05:6e02:1a29:b0:39f:61e4:1ad8 with SMTP id e9e14a558f8ab-39f61e48be4mr46839095ab.26.1725327094959; Mon, 02 Sep 2024 18:31:34 -0700 (PDT) Received: from aford-System-Version.lan (c-75-72-166-104.hsd1.mn.comcast.net. [75.72.166.104]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39f3b059c32sm28466715ab.75.2024.09.02.18.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 18:31:34 -0700 (PDT) From: Adam Ford To: linux-phy@lists.infradead.org Cc: dominique.martinet@atmark-techno.com, linux-imx@nxp.com, festevam@gmail.com, frieder.schrempf@kontron.de, aford@beaconembedded.com, Sandor.yu@nxp.com, Adam Ford , Vinod Koul , Kishon Vijay Abraham I , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Lucas Stach , Marco Felsch , linux-kernel@vger.kernel.org Subject: [PATCH V4 2/5] phy: freescale: fsl-samsung-hdmi: Simplify REG21_PMS_S_MASK lookup Date: Mon, 2 Sep 2024 20:30:44 -0500 Message-ID: <20240903013113.139698-3-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903013113.139698-1-aford173@gmail.com> References: <20240903013113.139698-1-aford173@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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/fre= escale/phy-fsl-samsung-hdmi.c index bc5d3625ece6..a700a300dc6f 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -355,40 +355,6 @@ to_fsl_samsung_hdmi_phy(struct clk_hw *hw) return container_of(hw, struct fsl_samsung_hdmi_phy, hw); } =20 -static void -fsl_samsung_hdmi_phy_configure_pixclk(struct fsl_samsung_hdmi_phy *phy, - const struct phy_config *cfg) -{ - u8 div =3D 0x1; - - switch (cfg->pixclk) { - case 22250000 ... 33750000: - div =3D 0xf; - break; - case 35000000 ... 40000000: - div =3D 0xb; - break; - case 43200000 ... 47500000: - div =3D 0x9; - break; - case 50349650 ... 63500000: - div =3D 0x7; - break; - case 67500000 ... 90000000: - div =3D 0x5; - break; - case 94000000 ... 148500000: - div =3D 0x3; - break; - case 154000000 ... 297000000: - div =3D 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 *p= hy, const struct phy_config *cfg) @@ -457,7 +423,10 @@ static int fsl_samsung_hdmi_phy_configure(struct fsl_s= amsung_hdmi_phy *phy, for (i =3D 0; i < PHY_PLL_DIV_REGS_NUM; i++) writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG(2) + i * 4); =20 - fsl_samsung_hdmi_phy_configure_pixclk(phy, cfg); + /* High nibble of pll_div_regs[1] contains S which also gets written to R= EG21 */ + 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); =20 writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG(33)); --=20 2.43.0 From nobody Fri Dec 19 10:47:43 2025 Received: from mail-io1-f48.google.com (mail-io1-f48.google.com [209.85.166.48]) (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 220A61CCEFD for ; Tue, 3 Sep 2024 01:31:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327103; cv=none; b=jGiZvM9GGoN0Izw2r2t3yo/N5B3fUPzbwKja0OlAuHXARZbhpqThEN7SF7+rWwObHRTHsLSLPZ462jCNr2f9HWXgiqXKlxzrHuea9RtmQd5XPP7yQpCEqNi3vZrfdlG72WRsWY36LtsAQ+t++95BLSefNsX9t5DAPTdMXf8m9k4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327103; c=relaxed/simple; bh=6QlnKLBbCh/VSoZHnfYGU+yfXt4uxAMVveccMu1IrSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NZjgHUZ9HgP+gznjpYQn3vB9gGVqEerfMvo97ejpmJ0CnCKbo/JrshXdZVw7lbDxT86uQuzk4K7It8gtE0yOer2Qil4jghcpJ6OnalvUzyfjG4BW1tYKcD0zMK/ijyPQJ73rRJbnDhWBW++aTfYakoLLkCnVniVrGkt13hXaam8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hdw5r15E; arc=none smtp.client-ip=209.85.166.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hdw5r15E" Received: by mail-io1-f48.google.com with SMTP id ca18e2360f4ac-82a1741aa31so276132139f.1 for ; Mon, 02 Sep 2024 18:31:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725327100; x=1725931900; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8sEWNOyX4JEhPKXKzebKs60n4QKdhi/iAd4E2D6hdhk=; b=hdw5r15EELtBwSv21yqwus6TG7HtOoinVoMdE8H30JsnOcqQ8WeZK7lR4pYhwdfi7V epwOPatfwgp8G/5Lc5WZmfEQK6oZVKl/tuOZtjOxc3ZVxVzybfE+gFLToGaRSvcwoStp JUhdKADOlhkZxbLa8kSM2EKCb3iF5gt+SoAmEYLjvbefAviZfUduIGQ11tXt8ic347Al aNZYeEi7+VT2mMKFI0IZjD1X/GiPEy25HqpuPktW5dWz1EwHQz1z53guMN7PbW3sF1VY Gy971PnhM+HcAjXKQlO+NyumQsoc1h0JimamKtNZXWXnk2WwDBVGKAYH/RmCk1AVngid wI9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725327100; x=1725931900; h=content-transfer-encoding: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=8sEWNOyX4JEhPKXKzebKs60n4QKdhi/iAd4E2D6hdhk=; b=deEpPdazvMloanzCZW6kz74MV0kWyrbF72QwitcPKa05bAvk3EUY+DT7e/+FGIsJcZ BO5D735tFITNK/n7iCYKeifFHIh8aQkLkU/sRyPdw3FStwmzU+QuViTQZCp7+Q1JA33X w0C4IpMCyWg6o29gg4blqPBwGmeYZuWcqbciklJgqK6xW7h10v/6+gxsUspYVhS0YAi2 2dfIE1EA5esLzJEYXicG96CzYozLt7l78br69W2OJm+fXjStW6osX6PWVKjRuD0RdCVR XeMXV6bm/wmrk3990pAQTOHgLfpRguKHth4vyDcNU1FA4XlGDV+Ib8fGXF+JJYl8SCq+ 6kdQ== X-Forwarded-Encrypted: i=1; AJvYcCVMQxsFNQEYYbyQAdLtdV2vlBGyQ3w5gJbp8Mx0a98GGUgcsX1HCIShp70+e06h0bZl5GbVPJWjJZHU6zU=@vger.kernel.org X-Gm-Message-State: AOJu0YwgpXxnhFiM7BOJj0F5CuDkM2B9xq7rEyy+84YCef5K5JxVT+A4 4l/Rw1QPICS2Lz9MYHrC4KEyH7IUX5syQMdrNkamE1D26i+ylBY5 X-Google-Smtp-Source: AGHT+IGjJi7h4OtqyyYcxdSznNVXlcKPmAYtUdsgPdISPxx6jnTnY+wn9+cj2wiR73yG6aq2NsLgiA== X-Received: by 2002:a92:c565:0:b0:39a:e984:1caa with SMTP id e9e14a558f8ab-39f3784f79dmr186308785ab.21.1725327100006; Mon, 02 Sep 2024 18:31:40 -0700 (PDT) Received: from aford-System-Version.lan (c-75-72-166-104.hsd1.mn.comcast.net. [75.72.166.104]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39f3b059c32sm28466715ab.75.2024.09.02.18.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 18:31:39 -0700 (PDT) From: Adam Ford To: linux-phy@lists.infradead.org Cc: dominique.martinet@atmark-techno.com, linux-imx@nxp.com, festevam@gmail.com, frieder.schrempf@kontron.de, aford@beaconembedded.com, Sandor.yu@nxp.com, Adam Ford , Vinod Koul , Kishon Vijay Abraham I , Lucas Stach , Marco Felsch , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-kernel@vger.kernel.org Subject: [PATCH V4 3/5] phy: freescale: fsl-samsung-hdmi: Support dynamic integer Date: Mon, 2 Sep 2024 20:30:45 -0500 Message-ID: <20240903013113.139698-4-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903013113.139698-1-aford173@gmail.com> References: <20240903013113.139698-1-aford173@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There is currently a look-up table for a variety of resolutions. Since the phy has the ability to dynamically calculate the values necessary to use the intger divider which should allow more resolutions without having to update the look-up-table. If the lookup table cannot find an exact match, fall back to the dynamic calculator of the integer divider. Previously, the value of P was hard-coded to 1, this required an update to the phy_pll_cfg table to add in the extra value into the table, so if the value of P is calculated to be something else by the PMS calculator, the calculated_phy_pll_cfg structure can be used instead without having to keep track of which method was used. Signed-off-by: Adam Ford --- V3: Change size of pll_div_regs to include PHY_REG01 (P) Create calculated_phy_pll_cfg to containe the values Eliminate the PMS calculation from fsl_samsung_hdmi_phy_configure Make the LUT primary and fall back to integer calculator in phy_clk_round_rate. Check the range right away to ensure it's reaonsable rather than trying to find a clock only to learn it's outside the range. Overall added notes and comments where stuff may not be intuitive. V2: Update phy_clk_round_rate and phy_clk_set_rate to both support the integer clock PMS calculator. --- drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 341 +++++++++++++------ 1 file changed, 235 insertions(+), 106 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/fre= escale/phy-fsl-samsung-hdmi.c index a700a300dc6f..8822029526f0 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -16,6 +16,8 @@ =20 #define PHY_REG(reg) (reg * 4) =20 +#define REG01_PMS_P_MASK GENMASK(3, 0) +#define REG03_PMS_S_MASK GENMASK(7, 4) #define REG12_CK_DIV_MASK GENMASK(5, 4) #define REG13_TG_CODE_LOW_MASK GENMASK(7, 0) #define REG14_TOL_MASK GENMASK(7, 4) @@ -29,281 +31,296 @@ #define REG34_PLL_LOCK BIT(6) #define REG34_PHY_CLK_READY BIT(5) =20 -#define PHY_PLL_DIV_REGS_NUM 6 +#ifndef MHZ +#define MHZ (1000UL * 1000UL) +#endif + +#define PHY_PLL_DIV_REGS_NUM 7 =20 struct phy_config { u32 pixclk; u8 pll_div_regs[PHY_PLL_DIV_REGS_NUM]; }; =20 +/* + * The calculated_phy_pll_cfg only handles integer divider for PMS only, + * meaning the last four entries will be fixed, but the first three will + * be calculated by the PMS calculator + */ +static struct phy_config calculated_phy_pll_cfg =3D { + .pixclk =3D 0, + .pll_div_regs =3D { 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }, +}; + +/* The lookup table contains values for which the fractional divder is use= d */ static const struct phy_config phy_pll_cfg[] =3D { { .pixclk =3D 22250000, - .pll_div_regs =3D { 0x4b, 0xf1, 0x89, 0x88, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x4b, 0xf1, 0x89, 0x88, 0x80, 0x40 }, }, { .pixclk =3D 23750000, - .pll_div_regs =3D { 0x50, 0xf1, 0x86, 0x85, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x50, 0xf1, 0x86, 0x85, 0x80, 0x40 }, }, { .pixclk =3D 24000000, - .pll_div_regs =3D { 0x50, 0xf0, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x50, 0xf0, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 24024000, - .pll_div_regs =3D { 0x50, 0xf1, 0x99, 0x02, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x50, 0xf1, 0x99, 0x02, 0x80, 0x40 }, }, { .pixclk =3D 25175000, - .pll_div_regs =3D { 0x54, 0xfc, 0xcc, 0x91, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x54, 0xfc, 0xcc, 0x91, 0x80, 0x40 }, }, { .pixclk =3D 25200000, - .pll_div_regs =3D { 0x54, 0xf0, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x54, 0xf0, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 26750000, - .pll_div_regs =3D { 0x5a, 0xf2, 0x89, 0x88, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0xf2, 0x89, 0x88, 0x80, 0x40 }, }, { .pixclk =3D 27000000, - .pll_div_regs =3D { 0x5a, 0xf0, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0xf0, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 27027000, - .pll_div_regs =3D { 0x5a, 0xf2, 0xfd, 0x0c, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0xf2, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 29500000, - .pll_div_regs =3D { 0x62, 0xf4, 0x95, 0x08, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x62, 0xf4, 0x95, 0x08, 0x80, 0x40 }, }, { .pixclk =3D 30750000, - .pll_div_regs =3D { 0x66, 0xf4, 0x82, 0x01, 0x88, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x66, 0xf4, 0x82, 0x01, 0x88, 0x45 }, }, { .pixclk =3D 30888000, - .pll_div_regs =3D { 0x66, 0xf4, 0x99, 0x18, 0x88, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x66, 0xf4, 0x99, 0x18, 0x88, 0x45 }, }, { .pixclk =3D 33750000, - .pll_div_regs =3D { 0x70, 0xf4, 0x82, 0x01, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x70, 0xf4, 0x82, 0x01, 0x80, 0x40 }, }, { .pixclk =3D 35000000, - .pll_div_regs =3D { 0x58, 0xb8, 0x8b, 0x88, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x58, 0xb8, 0x8b, 0x88, 0x80, 0x40 }, }, { .pixclk =3D 36000000, - .pll_div_regs =3D { 0x5a, 0xb0, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0xb0, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 36036000, - .pll_div_regs =3D { 0x5a, 0xb2, 0xfd, 0x0c, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0xb2, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 40000000, - .pll_div_regs =3D { 0x64, 0xb0, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x64, 0xb0, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 43200000, - .pll_div_regs =3D { 0x5a, 0x90, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x90, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 43243200, - .pll_div_regs =3D { 0x5a, 0x92, 0xfd, 0x0c, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x92, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 44500000, - .pll_div_regs =3D { 0x5c, 0x92, 0x98, 0x11, 0x84, 0x41 }, + .pll_div_regs =3D { 0xd1, 0x5c, 0x92, 0x98, 0x11, 0x84, 0x41 }, }, { .pixclk =3D 47000000, - .pll_div_regs =3D { 0x62, 0x94, 0x95, 0x82, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x62, 0x94, 0x95, 0x82, 0x80, 0x40 }, }, { .pixclk =3D 47500000, - .pll_div_regs =3D { 0x63, 0x96, 0xa1, 0x82, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x63, 0x96, 0xa1, 0x82, 0x80, 0x40 }, }, { .pixclk =3D 50349650, - .pll_div_regs =3D { 0x54, 0x7c, 0xc3, 0x8f, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x54, 0x7c, 0xc3, 0x8f, 0x80, 0x40 }, }, { .pixclk =3D 50400000, - .pll_div_regs =3D { 0x54, 0x70, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x54, 0x70, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 53250000, - .pll_div_regs =3D { 0x58, 0x72, 0x84, 0x03, 0x82, 0x41 }, + .pll_div_regs =3D { 0xd1, 0x58, 0x72, 0x84, 0x03, 0x82, 0x41 }, }, { .pixclk =3D 53500000, - .pll_div_regs =3D { 0x5a, 0x72, 0x89, 0x88, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x72, 0x89, 0x88, 0x80, 0x40 }, }, { .pixclk =3D 54000000, - .pll_div_regs =3D { 0x5a, 0x70, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x70, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 54054000, - .pll_div_regs =3D { 0x5a, 0x72, 0xfd, 0x0c, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x72, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 59000000, - .pll_div_regs =3D { 0x62, 0x74, 0x95, 0x08, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x62, 0x74, 0x95, 0x08, 0x80, 0x40 }, }, { .pixclk =3D 59340659, - .pll_div_regs =3D { 0x62, 0x74, 0xdb, 0x52, 0x88, 0x47 }, + .pll_div_regs =3D { 0xd1, 0x62, 0x74, 0xdb, 0x52, 0x88, 0x47 }, }, { .pixclk =3D 59400000, - .pll_div_regs =3D { 0x63, 0x70, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x63, 0x70, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 61500000, - .pll_div_regs =3D { 0x66, 0x74, 0x82, 0x01, 0x88, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x66, 0x74, 0x82, 0x01, 0x88, 0x45 }, }, { .pixclk =3D 63500000, - .pll_div_regs =3D { 0x69, 0x74, 0x89, 0x08, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x69, 0x74, 0x89, 0x08, 0x80, 0x40 }, }, { .pixclk =3D 67500000, - .pll_div_regs =3D { 0x54, 0x52, 0x87, 0x03, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x54, 0x52, 0x87, 0x03, 0x80, 0x40 }, }, { .pixclk =3D 70000000, - .pll_div_regs =3D { 0x58, 0x58, 0x8b, 0x88, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x58, 0x58, 0x8b, 0x88, 0x80, 0x40 }, }, { .pixclk =3D 72000000, - .pll_div_regs =3D { 0x5a, 0x50, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x50, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 72072000, - .pll_div_regs =3D { 0x5a, 0x52, 0xfd, 0x0c, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x52, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 74176000, - .pll_div_regs =3D { 0x5d, 0x58, 0xdb, 0xA2, 0x88, 0x41 }, + .pll_div_regs =3D { 0xd1, 0x5d, 0x58, 0xdb, 0xA2, 0x88, 0x41 }, }, { .pixclk =3D 74250000, - .pll_div_regs =3D { 0x5c, 0x52, 0x90, 0x0d, 0x84, 0x41 }, + .pll_div_regs =3D { 0xd1, 0x5c, 0x52, 0x90, 0x0d, 0x84, 0x41 }, }, { .pixclk =3D 78500000, - .pll_div_regs =3D { 0x62, 0x54, 0x87, 0x01, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x62, 0x54, 0x87, 0x01, 0x80, 0x40 }, }, { .pixclk =3D 80000000, - .pll_div_regs =3D { 0x64, 0x50, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x64, 0x50, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 82000000, - .pll_div_regs =3D { 0x66, 0x54, 0x82, 0x01, 0x88, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x66, 0x54, 0x82, 0x01, 0x88, 0x45 }, }, { .pixclk =3D 82500000, - .pll_div_regs =3D { 0x67, 0x54, 0x88, 0x01, 0x90, 0x49 }, + .pll_div_regs =3D { 0xd1, 0x67, 0x54, 0x88, 0x01, 0x90, 0x49 }, }, { .pixclk =3D 89000000, - .pll_div_regs =3D { 0x70, 0x54, 0x84, 0x83, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x70, 0x54, 0x84, 0x83, 0x80, 0x40 }, }, { .pixclk =3D 90000000, - .pll_div_regs =3D { 0x70, 0x54, 0x82, 0x01, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x70, 0x54, 0x82, 0x01, 0x80, 0x40 }, }, { .pixclk =3D 94000000, - .pll_div_regs =3D { 0x4e, 0x32, 0xa7, 0x10, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x4e, 0x32, 0xa7, 0x10, 0x80, 0x40 }, }, { .pixclk =3D 95000000, - .pll_div_regs =3D { 0x50, 0x31, 0x86, 0x85, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x50, 0x31, 0x86, 0x85, 0x80, 0x40 }, }, { .pixclk =3D 98901099, - .pll_div_regs =3D { 0x52, 0x3a, 0xdb, 0x4c, 0x88, 0x47 }, + .pll_div_regs =3D { 0xd1, 0x52, 0x3a, 0xdb, 0x4c, 0x88, 0x47 }, }, { .pixclk =3D 99000000, - .pll_div_regs =3D { 0x52, 0x32, 0x82, 0x01, 0x88, 0x47 }, + .pll_div_regs =3D { 0xd1, 0x52, 0x32, 0x82, 0x01, 0x88, 0x47 }, }, { .pixclk =3D 100699300, - .pll_div_regs =3D { 0x54, 0x3c, 0xc3, 0x8f, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x54, 0x3c, 0xc3, 0x8f, 0x80, 0x40 }, }, { .pixclk =3D 100800000, - .pll_div_regs =3D { 0x54, 0x30, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x54, 0x30, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 102500000, - .pll_div_regs =3D { 0x55, 0x32, 0x8c, 0x05, 0x90, 0x4b }, + .pll_div_regs =3D { 0xd1, 0x55, 0x32, 0x8c, 0x05, 0x90, 0x4b }, }, { .pixclk =3D 104750000, - .pll_div_regs =3D { 0x57, 0x32, 0x98, 0x07, 0x90, 0x49 }, + .pll_div_regs =3D { 0xd1, 0x57, 0x32, 0x98, 0x07, 0x90, 0x49 }, }, { .pixclk =3D 106500000, - .pll_div_regs =3D { 0x58, 0x32, 0x84, 0x03, 0x82, 0x41 }, + .pll_div_regs =3D { 0xd1, 0x58, 0x32, 0x84, 0x03, 0x82, 0x41 }, }, { .pixclk =3D 107000000, - .pll_div_regs =3D { 0x5a, 0x32, 0x89, 0x88, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x32, 0x89, 0x88, 0x80, 0x40 }, }, { .pixclk =3D 108000000, - .pll_div_regs =3D { 0x5a, 0x30, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x30, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 108108000, - .pll_div_regs =3D { 0x5a, 0x32, 0xfd, 0x0c, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x32, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 118000000, - .pll_div_regs =3D { 0x62, 0x34, 0x95, 0x08, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x62, 0x34, 0x95, 0x08, 0x80, 0x40 }, }, { .pixclk =3D 118800000, - .pll_div_regs =3D { 0x63, 0x30, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x63, 0x30, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 123000000, - .pll_div_regs =3D { 0x66, 0x34, 0x82, 0x01, 0x88, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x66, 0x34, 0x82, 0x01, 0x88, 0x45 }, }, { .pixclk =3D 127000000, - .pll_div_regs =3D { 0x69, 0x34, 0x89, 0x08, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x69, 0x34, 0x89, 0x08, 0x80, 0x40 }, }, { .pixclk =3D 135000000, - .pll_div_regs =3D { 0x70, 0x34, 0x82, 0x01, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x70, 0x34, 0x82, 0x01, 0x80, 0x40 }, }, { .pixclk =3D 135580000, - .pll_div_regs =3D { 0x71, 0x39, 0xe9, 0x82, 0x9c, 0x5b }, + .pll_div_regs =3D { 0xd1, 0x71, 0x39, 0xe9, 0x82, 0x9c, 0x5b }, }, { .pixclk =3D 137520000, - .pll_div_regs =3D { 0x72, 0x38, 0x99, 0x10, 0x85, 0x41 }, + .pll_div_regs =3D { 0xd1, 0x72, 0x38, 0x99, 0x10, 0x85, 0x41 }, }, { .pixclk =3D 138750000, - .pll_div_regs =3D { 0x73, 0x35, 0x88, 0x05, 0x90, 0x4d }, + .pll_div_regs =3D { 0xd1, 0x73, 0x35, 0x88, 0x05, 0x90, 0x4d }, }, { .pixclk =3D 140000000, - .pll_div_regs =3D { 0x75, 0x36, 0xa7, 0x90, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x75, 0x36, 0xa7, 0x90, 0x80, 0x40 }, }, { .pixclk =3D 144000000, - .pll_div_regs =3D { 0x78, 0x30, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x78, 0x30, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 148352000, - .pll_div_regs =3D { 0x7b, 0x35, 0xdb, 0x39, 0x90, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x7b, 0x35, 0xdb, 0x39, 0x90, 0x45 }, }, { .pixclk =3D 148500000, - .pll_div_regs =3D { 0x7b, 0x35, 0x84, 0x03, 0x90, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x7b, 0x35, 0x84, 0x03, 0x90, 0x45 }, }, { .pixclk =3D 154000000, - .pll_div_regs =3D { 0x40, 0x18, 0x83, 0x01, 0x00, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x40, 0x18, 0x83, 0x01, 0x00, 0x40 }, }, { .pixclk =3D 157000000, - .pll_div_regs =3D { 0x41, 0x11, 0xa7, 0x14, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x41, 0x11, 0xa7, 0x14, 0x80, 0x40 }, }, { .pixclk =3D 160000000, - .pll_div_regs =3D { 0x42, 0x12, 0xa1, 0x20, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x42, 0x12, 0xa1, 0x20, 0x80, 0x40 }, }, { .pixclk =3D 162000000, - .pll_div_regs =3D { 0x43, 0x18, 0x8b, 0x08, 0x96, 0x55 }, + .pll_div_regs =3D { 0xd1, 0x43, 0x18, 0x8b, 0x08, 0x96, 0x55 }, }, { .pixclk =3D 164000000, - .pll_div_regs =3D { 0x45, 0x11, 0x83, 0x82, 0x90, 0x4b }, + .pll_div_regs =3D { 0xd1, 0x45, 0x11, 0x83, 0x82, 0x90, 0x4b }, }, { .pixclk =3D 165000000, - .pll_div_regs =3D { 0x45, 0x11, 0x84, 0x81, 0x90, 0x4b }, + .pll_div_regs =3D { 0xd1, 0x45, 0x11, 0x84, 0x81, 0x90, 0x4b }, }, { .pixclk =3D 180000000, - .pll_div_regs =3D { 0x4b, 0x10, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x4b, 0x10, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 185625000, - .pll_div_regs =3D { 0x4e, 0x12, 0x9a, 0x95, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x4e, 0x12, 0x9a, 0x95, 0x80, 0x40 }, }, { .pixclk =3D 188000000, - .pll_div_regs =3D { 0x4e, 0x12, 0xa7, 0x10, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x4e, 0x12, 0xa7, 0x10, 0x80, 0x40 }, }, { .pixclk =3D 198000000, - .pll_div_regs =3D { 0x52, 0x12, 0x82, 0x01, 0x88, 0x47 }, + .pll_div_regs =3D { 0xd1, 0x52, 0x12, 0x82, 0x01, 0x88, 0x47 }, }, { .pixclk =3D 205000000, - .pll_div_regs =3D { 0x55, 0x12, 0x8c, 0x05, 0x90, 0x4b }, + .pll_div_regs =3D { 0xd1, 0x55, 0x12, 0x8c, 0x05, 0x90, 0x4b }, }, { .pixclk =3D 209500000, - .pll_div_regs =3D { 0x57, 0x12, 0x98, 0x07, 0x90, 0x49 }, + .pll_div_regs =3D { 0xd1, 0x57, 0x12, 0x98, 0x07, 0x90, 0x49 }, }, { .pixclk =3D 213000000, - .pll_div_regs =3D { 0x58, 0x12, 0x84, 0x03, 0x82, 0x41 }, + .pll_div_regs =3D { 0xd1, 0x58, 0x12, 0x84, 0x03, 0x82, 0x41 }, }, { .pixclk =3D 216000000, - .pll_div_regs =3D { 0x5a, 0x10, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x10, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 216216000, - .pll_div_regs =3D { 0x5a, 0x12, 0xfd, 0x0c, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x5a, 0x12, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 237600000, - .pll_div_regs =3D { 0x63, 0x10, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x63, 0x10, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 254000000, - .pll_div_regs =3D { 0x69, 0x14, 0x89, 0x08, 0x80, 0x40 }, + .pll_div_regs =3D { 0xd1, 0x69, 0x14, 0x89, 0x08, 0x80, 0x40 }, }, { .pixclk =3D 277500000, - .pll_div_regs =3D { 0x73, 0x15, 0x88, 0x05, 0x90, 0x4d }, + .pll_div_regs =3D { 0xd1, 0x73, 0x15, 0x88, 0x05, 0x90, 0x4d }, }, { .pixclk =3D 288000000, - .pll_div_regs =3D { 0x78, 0x10, 0x00, 0x00, 0x80, 0x00 }, + .pll_div_regs =3D { 0xd1, 0x78, 0x10, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 297000000, - .pll_div_regs =3D { 0x7b, 0x15, 0x84, 0x03, 0x90, 0x45 }, + .pll_div_regs =3D { 0xd1, 0x7b, 0x15, 0x84, 0x03, 0x90, 0x45 }, }, }; =20 @@ -313,7 +330,8 @@ struct reg_settings { }; =20 static const struct reg_settings common_phy_cfg[] =3D { - { PHY_REG(0), 0x00 }, { PHY_REG(1), 0xd1 }, + { PHY_REG(0), 0x00 }, + /* PHY_REG(1-7) pix clk specific */ { PHY_REG(8), 0x4f }, { PHY_REG(9), 0x30 }, { PHY_REG(10), 0x33 }, { PHY_REG(11), 0x65 }, /* REG12 pixclk specific */ @@ -406,6 +424,76 @@ fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl= _samsung_hdmi_phy *phy, phy->regs + PHY_REG(14)); } =20 +static unsigned long fsl_samsung_hdmi_phy_find_pms(unsigned long fout, u8 = *p, u16 *m, u8 *s) +{ + unsigned long best_freq =3D 0; + u32 min_delta =3D 0xffffffff; + u8 _p, best_p; + u16 _m, best_m; + u8 _s, best_s; + + /* The ref manual states the values of 'P' range from 1 to 11 */ + for (_p =3D 1; _p <=3D 11; ++_p) { + for (_s =3D 1; _s <=3D 16; ++_s) { + u64 tmp; + u32 delta; + + /* s must be one or even */ + if (_s > 1 && (_s & 0x01) =3D=3D 1) + _s++; + + /* _s cannot be 14 per the TRM */ + if (_s =3D=3D 14) + continue; + + /* + * TODO: Ref Manual doesn't state the range of _m + * so this should be further refined if possible. + * This range was set based on the original values + * in the look-up table + */ + tmp =3D (u64)fout * (_p * _s); + do_div(tmp, 24 * MHZ); + _m =3D tmp; + if (_m < 0x30 || _m > 0x7b) + continue; + + /* + * Rev 2 of the Ref Manual states the + * VCO can range between 750MHz and + * 3GHz. The VCO is assumed to be _m x + * the reference frequency of 24MHz divided + * by the prescaler, _p + */ + tmp =3D (u64)_m * 24 * MHZ; + do_div(tmp, _p); + if (tmp < 750 * MHZ || + tmp > 3000 * MHZ) + continue; + + tmp =3D (u64)_m * 24 * MHZ; + do_div(tmp, _p * _s); + + delta =3D abs(fout - tmp); + if (delta < min_delta) { + best_p =3D _p; + best_s =3D _s; + best_m =3D _m; + min_delta =3D delta; + best_freq =3D tmp; + } + } + } + + if (best_freq) { + *p =3D best_p; + *m =3D best_m; + *s =3D best_s; + } + + return best_freq; +} + static int fsl_samsung_hdmi_phy_configure(struct fsl_samsung_hdmi_phy *phy, const struct phy_config *cfg) { @@ -419,13 +507,13 @@ static int fsl_samsung_hdmi_phy_configure(struct fsl_= samsung_hdmi_phy *phy, for (i =3D 0; i < ARRAY_SIZE(common_phy_cfg); i++) writeb(common_phy_cfg[i].val, phy->regs + common_phy_cfg[i].reg); =20 - /* set individual PLL registers PHY_REG2 ... PHY_REG7 */ + /* set individual PLL registers PHY_REG1 ... PHY_REG7 */ for (i =3D 0; i < PHY_PLL_DIV_REGS_NUM; i++) - writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG(2) + i * 4); + writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG(1) + i * 4); =20 - /* High nibble of pll_div_regs[1] contains S which also gets written to R= EG21 */ + /* High nibble of PHY_REG3 and low nibble of PHY_REG21 both contain 'S' */ writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, - cfg->pll_div_regs[1] >> 4), phy->regs + PHY_REG(21)); + cfg->pll_div_regs[2] >> 4), phy->regs + PHY_REG(21)); =20 fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg); =20 @@ -453,29 +541,70 @@ static unsigned long phy_clk_recalc_rate(struct clk_h= w *hw, static long phy_clk_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *parent_rate) { + u32 int_div_clk; int i; + u16 m; + u8 p, s; + + /* If the clock is out of range return error instead of searching */ + if (rate > 297000000 || rate < 22250000) + return -EINVAL; =20 + /* Check the look-up table */ for (i =3D ARRAY_SIZE(phy_pll_cfg) - 1; i >=3D 0; i--) if (phy_pll_cfg[i].pixclk <=3D rate) - return phy_pll_cfg[i].pixclk; + break; + /* If the rate is an exact match, return it now */ + if (rate =3D=3D phy_pll_cfg[i].pixclk) + return phy_pll_cfg[i].pixclk; + + /* + * The math on the lookup table shows the PMS math yields a + * frequency 5 x pixclk. + * When we check the integer divider against the desired rate, + * multiply the rate x 5 and then divide the outcome by 5. + */ + int_div_clk =3D fsl_samsung_hdmi_phy_find_pms(rate * 5, &p, &m, &s) / 5; =20 - return -EINVAL; + /* If the rate is an exact match, return it now */ + if (int_div_clk =3D=3D rate) + return int_div_clk; + + /* Fall back to the closest value in the LUT */ + return phy_pll_cfg[i].pixclk; } =20 static int phy_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { struct fsl_samsung_hdmi_phy *phy =3D to_fsl_samsung_hdmi_phy(hw); + u32 int_div_clk; int i; - - for (i =3D ARRAY_SIZE(phy_pll_cfg) - 1; i >=3D 0; i--) - if (phy_pll_cfg[i].pixclk <=3D rate) - break; - - if (i < 0) - return -EINVAL; - - phy->cur_cfg =3D &phy_pll_cfg[i]; + u16 m; + u8 p, s; + + /* If the integer divider works, just use it */ + int_div_clk =3D fsl_samsung_hdmi_phy_find_pms(rate * 5, &p, &m, &s) / 5; + if (int_div_clk =3D=3D rate) { + dev_dbg(phy->dev, "fsl_samsung_hdmi_phy: using integer divider\n"); + calculated_phy_pll_cfg.pixclk =3D int_div_clk; + calculated_phy_pll_cfg.pll_div_regs[0] =3D FIELD_PREP(REG01_PMS_P_MASK, = p); + calculated_phy_pll_cfg.pll_div_regs[1] =3D m; + calculated_phy_pll_cfg.pll_div_regs[2] =3D FIELD_PREP(REG03_PMS_S_MASK, = s-1); + /* pll_div_regs 3-6 are fixed and pre-defined already */ + phy->cur_cfg =3D &calculated_phy_pll_cfg; + } else { + /* Otherwise, search the LUT */ + dev_dbg(phy->dev, "fsl_samsung_hdmi_phy: using fractional divider\n"); + for (i =3D ARRAY_SIZE(phy_pll_cfg) - 1; i >=3D 0; i--) + if (phy_pll_cfg[i].pixclk <=3D rate) + break; + + if (i < 0) + return -EINVAL; + + phy->cur_cfg =3D &phy_pll_cfg[i]; + } =20 return fsl_samsung_hdmi_phy_configure(phy, phy->cur_cfg); } --=20 2.43.0 From nobody Fri Dec 19 10:47:43 2025 Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) (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 ECF1C1CCEE7 for ; Tue, 3 Sep 2024 01:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327107; cv=none; b=rLnkk+JjVooKBnIjB4AglBzdKy6VLi8B06DKj6ZwAZiwdlFohajshjo0zfF4yA1uiPoEUo8gb7owLKMB6NiSNp8JCPEF6tLDoKrhnlkSMSiQeL6dR3asrmfZapH3L/ZvFAwMc1Lu9GZz/s9D+tQ8oz2uAmHl5z3ckuPHxlSRlIQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327107; c=relaxed/simple; bh=zpdcJeAxwsn3TRUZFsj3awJYr3xXjM69ZW96AxDTbGI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DqyRtqWpY7B5t4l0jT05+gyQZcbo+yEG/+sHVOoVoPbrqDiOF/DberwPhj2Hz8IZGZaPxatjuu2CFJjtONn4OUE9kOytjYp6q/8OlTmBDy0CtJ08x8N2aM5u7+/bsFH3NHjytLwSiAQSXzOw/YWlp0jXBqkegzJ5RW2ymQK/GCg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DOnCtIVE; arc=none smtp.client-ip=209.85.166.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DOnCtIVE" Received: by mail-il1-f175.google.com with SMTP id e9e14a558f8ab-39f56df0ddbso6080745ab.3 for ; Mon, 02 Sep 2024 18:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725327105; x=1725931905; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dWzyFJBdw6McwAWR/O0zmf3qYdQVBqiXE9WFlnVZSZk=; b=DOnCtIVEVkkALdhy9Gp41vqOYshQWTiS8YGQZ2KxWj2aWIRpxQ/K4ZMkCF2A+JrLz7 8jPcRli494Iz+lVajSo6/21xJ5Lu0Lk+obaWYG5stuvmOc5G2bOVdmaJ5YxDW+TPyfYd yDjDy+NFUyX7M3dngft3WzhdZdPuIGwK+2kUnVgJ2+bLZbQDnqlsKPK4FmJg35eEAz/9 Z6MzXG6/asu7MoQlM/0WI28rWawPDKtdDExWMfjyhykEbMsZ2f6yWGATgjUMAzrg289i Ox+62wqkUmWGCObOEsipDofQOzGXgheu+/EsJVFD2ibRA/7jcmzXHwrJh6vZb+hY+X8n YtUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725327105; x=1725931905; h=content-transfer-encoding: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=dWzyFJBdw6McwAWR/O0zmf3qYdQVBqiXE9WFlnVZSZk=; b=wPVVixNSolDtK5FSHiNJNpNhRoP3lSbjoOPb1yUd2IQoqUN3iSBvLtbJmBlFQJ7WFU JUtNr7MPELNyYTbhKO7WyRDLIIuPtPw5gZ7P5wD2oQUvpUuDks25pQBOhM9p5ZOEx8tY gWONOvEqwZqtKrjTPYTWnJDL9I2LSWbQ7xDx9P3oV6Pp1sJu8tn5getJBnuIG4dZFDBS excf3sfBUnLUjAfgODQyPhGW8nE60Oieum13EEuQezjdIyP/RG49PVHyFnu1+xKnN03F f76NdnDDB8uwiA/jIbDSRvwDXTg0VT4/aVTRgzpIybEhVLigoC7ZJZNnMisqCM5PHQn8 GZ1w== X-Forwarded-Encrypted: i=1; AJvYcCVQU+8bxRYN09XrGhoB+QtAnrgxmSVA+LtQ+64vYb/HfcCemmqgBE375zoS06ZphM1CrgLEfL8ajmfKsuA=@vger.kernel.org X-Gm-Message-State: AOJu0YzhILhCv+Turx1kiuHHUM54KRwfJrl6KOaRU2lILd2GJPPDw9Eg CdnTMac0MRIJJCcCcZxnTgYehc2nyA6db/W5Q4YoFTntsMN1TTI6 X-Google-Smtp-Source: AGHT+IGF7GMRXv9kwC7231QtjJ0oUs1xla4KHNbfeXJyQhSKa72TXj6EujOvyf5b3yOnWq3nK05QaA== X-Received: by 2002:a05:6e02:156c:b0:39b:33b5:5cc1 with SMTP id e9e14a558f8ab-39f37874675mr160259425ab.24.1725327104895; Mon, 02 Sep 2024 18:31:44 -0700 (PDT) Received: from aford-System-Version.lan (c-75-72-166-104.hsd1.mn.comcast.net. [75.72.166.104]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39f3b059c32sm28466715ab.75.2024.09.02.18.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 18:31:44 -0700 (PDT) From: Adam Ford To: linux-phy@lists.infradead.org Cc: dominique.martinet@atmark-techno.com, linux-imx@nxp.com, festevam@gmail.com, frieder.schrempf@kontron.de, aford@beaconembedded.com, Sandor.yu@nxp.com, Adam Ford , Vinod Koul , Kishon Vijay Abraham I , Marco Felsch , Lucas Stach , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-kernel@vger.kernel.org Subject: [PATCH V4 4/5] phy: freescale: fsl-samsung-hdmi: Use closest divider Date: Mon, 2 Sep 2024 20:30:46 -0500 Message-ID: <20240903013113.139698-5-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903013113.139698-1-aford173@gmail.com> References: <20240903013113.139698-1-aford173@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Currently, if the clock values cannot be set to the exact rate, the round_rate and set_rate functions use the closest value found in the look-up-table. In preparation of removing values from the LUT that can be calculated evenly with the integer calculator, it's necessary to ensure to check both the look-up-table and the integer divider clock values to get the closest values to the requested value. It does this by measuring the difference between the requested clock value and the closest value in both integer divider calucator and the fractional clock look-up-table. Which ever has the smallest difference between them is returned as the cloesest rate. Signed-off-by: Adam Ford --- drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 40 +++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/fre= escale/phy-fsl-samsung-hdmi.c index 8822029526f0..0bf526e282a7 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -541,7 +541,7 @@ static unsigned long phy_clk_recalc_rate(struct clk_hw = *hw, static long phy_clk_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *parent_rate) { - u32 int_div_clk; + u32 int_div_clk, delta_int, delta_frac; int i; u16 m; u8 p, s; @@ -554,6 +554,7 @@ static long phy_clk_round_rate(struct clk_hw *hw, for (i =3D ARRAY_SIZE(phy_pll_cfg) - 1; i >=3D 0; i--) if (phy_pll_cfg[i].pixclk <=3D rate) break; + /* If the rate is an exact match, return it now */ if (rate =3D=3D phy_pll_cfg[i].pixclk) return phy_pll_cfg[i].pixclk; @@ -570,15 +571,21 @@ static long phy_clk_round_rate(struct clk_hw *hw, if (int_div_clk =3D=3D rate) return int_div_clk; =20 - /* Fall back to the closest value in the LUT */ - return phy_pll_cfg[i].pixclk; + /* Calculate the differences and use the closest one */ + delta_frac =3D (rate - phy_pll_cfg[i].pixclk); + delta_int =3D (rate - int_div_clk); + + if (delta_int < delta_frac) + return int_div_clk; + else + return phy_pll_cfg[i].pixclk; } =20 static int phy_clk_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { struct fsl_samsung_hdmi_phy *phy =3D to_fsl_samsung_hdmi_phy(hw); - u32 int_div_clk; + u32 int_div_clk, delta_int, delta_frac; int i; u16 m; u8 p, s; @@ -593,19 +600,34 @@ static int phy_clk_set_rate(struct clk_hw *hw, calculated_phy_pll_cfg.pll_div_regs[2] =3D FIELD_PREP(REG03_PMS_S_MASK, = s-1); /* pll_div_regs 3-6 are fixed and pre-defined already */ phy->cur_cfg =3D &calculated_phy_pll_cfg; + goto done; } else { /* Otherwise, search the LUT */ - dev_dbg(phy->dev, "fsl_samsung_hdmi_phy: using fractional divider\n"); - for (i =3D ARRAY_SIZE(phy_pll_cfg) - 1; i >=3D 0; i--) - if (phy_pll_cfg[i].pixclk <=3D rate) + for (i =3D ARRAY_SIZE(phy_pll_cfg) - 1; i >=3D 0; i--) { + if (phy_pll_cfg[i].pixclk =3D=3D rate) { + dev_dbg(phy->dev, "fsl_samsung_hdmi_phy: using fractional divider\n"); + phy->cur_cfg =3D &phy_pll_cfg[i]; + goto done; + } + + if (phy_pll_cfg[i].pixclk < rate) break; + } =20 if (i < 0) return -EINVAL; - - phy->cur_cfg =3D &phy_pll_cfg[i]; } =20 + /* Calculate the differences for each clock against the requested value */ + delta_frac =3D (rate - phy_pll_cfg[i].pixclk); + delta_int =3D (rate - int_div_clk); + + /* Use the value closest to the desired */ + if (delta_int < delta_frac) + phy->cur_cfg =3D &calculated_phy_pll_cfg; + else + phy->cur_cfg =3D &phy_pll_cfg[i]; +done: return fsl_samsung_hdmi_phy_configure(phy, phy->cur_cfg); } =20 --=20 2.43.0 From nobody Fri Dec 19 10:47:43 2025 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 C798B1CDFA6 for ; Tue, 3 Sep 2024 01:31:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327112; cv=none; b=MlvROqTISZUHLphBMDy4QbvgnG5MQ7MLZ+BpZNTZO01K5mE54MlISWRrCyr0aur1V5sfJlmSNOPj5UCdWj33POJ2fg0coI3gYi/s8lzVuhHc2RQ0eHBgYHhMaAx8LCemaOi5hAJ+o1/bGbFui+Urd9f5FKxLN/Q+gpjvLzDeg2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725327112; c=relaxed/simple; bh=xR72qna4avx5b0guljaiboIZTrSYINVE6Vcqe4PLOio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=czVY+2mb35yPJQyvzVFwtIPv4z1oxmKkqbriZWH6VUFlyd2yKk6rdVj/M7rR21fddvBg4kCFBYe2bJyNhfdhjdXNebEv1gQ5ZeGosdSZxyoepkS21k/ywPXXusCBB/HW1IflzpAQ5MGvvAJSqpl0T9y2oycOLzCIIwe/NBvNzYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KgebKNqi; arc=none smtp.client-ip=209.85.166.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KgebKNqi" Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-829e8718502so199452939f.3 for ; Mon, 02 Sep 2024 18:31:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725327110; x=1725931910; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rjDycFG/gwvOYgM+KYAdbKzrZuoPb1hpign8aj2gA/s=; b=KgebKNqiWAAh2ltWgyMP21VButoD24RgMPMq7M05Zhgtiw7F2saTVsbz+ASPhsWtbw rOuOIP/yfg0yh6kP1PpvLqkEAbVYagTLwhKwNNltTdxMrQbs/+iGmpjJAESHv7CJW3kW UZWaX7imKI/a/zNnzx0fakKudoBEt1xubn1qrauh//CNuh2ecMQ81vhdHIDjuHZPfBWu MxjrtKXDv22aypJoQ8QcQmLHmZTTn9SNq5K0MTu2QSoGkOC5hk/43ONC63YFzkL3E1GT nbo+JxLBqDWZuiQ6Vb3BdPmvA40gliuj/O571ElGqBBIAAbq/RFBsDl8QFNo+XlBh8CC HdxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725327110; x=1725931910; h=content-transfer-encoding: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=rjDycFG/gwvOYgM+KYAdbKzrZuoPb1hpign8aj2gA/s=; b=hc2yOuEL9R1SFjS8fKceWguUCh2elAPH7orRcSvZ+6GOF1lqdSOIH3x2u9X08XRjOY lxAANNzKLe4Afwvp+5N90mzqLduuCosCINwx/pKrbtrE3WuETXL4UAGozEv02yRfr/9P l0bHUfx92fM7YIY/O6kd7RuCrqXTPeITmZUQv8fr5lXx+e4ViaJbhKUOCQaEuLxYWF1Q byO//EjhTjXzOBXTl0GiqA0YqjLLMyjbNF5xuxFQLnGYrrM+AiZ/nLyYOgOHyaZDOfhA RFgi/UGzD6IgNHvflQSsvIFtBhwo+/Xbw1/y9s4iF/Ne+aZtHuNP3QQ/0eTTQpo/E/J7 6wdQ== X-Forwarded-Encrypted: i=1; AJvYcCVbmEUJiC2l1qfsCw7Nj8yCfq8/zIR/C/HiqIfG3uQpm7XToX5GqaWsuWiTMI6PhAVSBjySmuGDBuLDTnU=@vger.kernel.org X-Gm-Message-State: AOJu0YwQLdKx0FRW/38eKIQMRR4nxtQRJTNMQZyjzDCPVuQdWlzb+NGi AOBKMP+VY7uk/UcNR1wfGDhw4fr4PV3Tg1tGIsbBZ1uPvxo+pb4P X-Google-Smtp-Source: AGHT+IFBxGp8SaeQqQUz2zloZ4K1h8vgzjf3pkmahMn9NrG4HemfvelUnukoTgxIAlFGA7ZKWawR9A== X-Received: by 2002:a05:6e02:1fcc:b0:39f:36f3:196f with SMTP id e9e14a558f8ab-39f378ea649mr163711435ab.4.1725327109783; Mon, 02 Sep 2024 18:31:49 -0700 (PDT) Received: from aford-System-Version.lan (c-75-72-166-104.hsd1.mn.comcast.net. [75.72.166.104]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39f3b059c32sm28466715ab.75.2024.09.02.18.31.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 18:31:49 -0700 (PDT) From: Adam Ford To: linux-phy@lists.infradead.org Cc: dominique.martinet@atmark-techno.com, linux-imx@nxp.com, festevam@gmail.com, frieder.schrempf@kontron.de, aford@beaconembedded.com, Sandor.yu@nxp.com, Adam Ford , Vinod Koul , Kishon Vijay Abraham I , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Marco Felsch , Lucas Stach , linux-kernel@vger.kernel.org Subject: [PATCH V4 5/5] phy: freescale: fsl-samsung-hdmi: Remove unnecessary LUT entries Date: Mon, 2 Sep 2024 20:30:47 -0500 Message-ID: <20240903013113.139698-6-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903013113.139698-1-aford173@gmail.com> References: <20240903013113.139698-1-aford173@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The lookup table contains entries which use the integer divider instead of just the fractional divider. Since the set and round functions check both the integer divider values and the LUT values, it's no longer necessary to keep the integer divder values in the, as they are able to by dynamically calcuated. Signed-off-by: Adam Ford --- drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 83 +++----------------- 1 file changed, 13 insertions(+), 70 deletions(-) diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/fre= escale/phy-fsl-samsung-hdmi.c index 0bf526e282a7..7cfad4ed94f3 100644 --- a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -60,25 +60,16 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 23750000, .pll_div_regs =3D { 0xd1, 0x50, 0xf1, 0x86, 0x85, 0x80, 0x40 }, - }, { - .pixclk =3D 24000000, - .pll_div_regs =3D { 0xd1, 0x50, 0xf0, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 24024000, .pll_div_regs =3D { 0xd1, 0x50, 0xf1, 0x99, 0x02, 0x80, 0x40 }, }, { .pixclk =3D 25175000, .pll_div_regs =3D { 0xd1, 0x54, 0xfc, 0xcc, 0x91, 0x80, 0x40 }, - }, { - .pixclk =3D 25200000, - .pll_div_regs =3D { 0xd1, 0x54, 0xf0, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 26750000, .pll_div_regs =3D { 0xd1, 0x5a, 0xf2, 0x89, 0x88, 0x80, 0x40 }, - }, { - .pixclk =3D 27000000, - .pll_div_regs =3D { 0xd1, 0x5a, 0xf0, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 27027000, .pll_div_regs =3D { 0xd1, 0x5a, 0xf2, 0xfd, 0x0c, 0x80, 0x40 }, }, { @@ -96,18 +87,9 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 35000000, .pll_div_regs =3D { 0xd1, 0x58, 0xb8, 0x8b, 0x88, 0x80, 0x40 }, - }, { - .pixclk =3D 36000000, - .pll_div_regs =3D { 0xd1, 0x5a, 0xb0, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 36036000, .pll_div_regs =3D { 0xd1, 0x5a, 0xb2, 0xfd, 0x0c, 0x80, 0x40 }, - }, { - .pixclk =3D 40000000, - .pll_div_regs =3D { 0xd1, 0x64, 0xb0, 0x00, 0x00, 0x80, 0x00 }, - }, { - .pixclk =3D 43200000, - .pll_div_regs =3D { 0xd1, 0x5a, 0x90, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 43243200, .pll_div_regs =3D { 0xd1, 0x5a, 0x92, 0xfd, 0x0c, 0x80, 0x40 }, @@ -123,19 +105,13 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 50349650, .pll_div_regs =3D { 0xd1, 0x54, 0x7c, 0xc3, 0x8f, 0x80, 0x40 }, - }, { - .pixclk =3D 50400000, - .pll_div_regs =3D { 0xd1, 0x54, 0x70, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 53250000, .pll_div_regs =3D { 0xd1, 0x58, 0x72, 0x84, 0x03, 0x82, 0x41 }, }, { .pixclk =3D 53500000, .pll_div_regs =3D { 0xd1, 0x5a, 0x72, 0x89, 0x88, 0x80, 0x40 }, - }, { - .pixclk =3D 54000000, - .pll_div_regs =3D { 0xd1, 0x5a, 0x70, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 54054000, .pll_div_regs =3D { 0xd1, 0x5a, 0x72, 0xfd, 0x0c, 0x80, 0x40 }, }, { @@ -144,10 +120,7 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 59340659, .pll_div_regs =3D { 0xd1, 0x62, 0x74, 0xdb, 0x52, 0x88, 0x47 }, - }, { - .pixclk =3D 59400000, - .pll_div_regs =3D { 0xd1, 0x63, 0x70, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 61500000, .pll_div_regs =3D { 0xd1, 0x66, 0x74, 0x82, 0x01, 0x88, 0x45 }, }, { @@ -159,10 +132,7 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 70000000, .pll_div_regs =3D { 0xd1, 0x58, 0x58, 0x8b, 0x88, 0x80, 0x40 }, - }, { - .pixclk =3D 72000000, - .pll_div_regs =3D { 0xd1, 0x5a, 0x50, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 72072000, .pll_div_regs =3D { 0xd1, 0x5a, 0x52, 0xfd, 0x0c, 0x80, 0x40 }, }, { @@ -174,10 +144,7 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 78500000, .pll_div_regs =3D { 0xd1, 0x62, 0x54, 0x87, 0x01, 0x80, 0x40 }, - }, { - .pixclk =3D 80000000, - .pll_div_regs =3D { 0xd1, 0x64, 0x50, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 82000000, .pll_div_regs =3D { 0xd1, 0x66, 0x54, 0x82, 0x01, 0x88, 0x45 }, }, { @@ -204,10 +171,7 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 100699300, .pll_div_regs =3D { 0xd1, 0x54, 0x3c, 0xc3, 0x8f, 0x80, 0x40 }, - }, { - .pixclk =3D 100800000, - .pll_div_regs =3D { 0xd1, 0x54, 0x30, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 102500000, .pll_div_regs =3D { 0xd1, 0x55, 0x32, 0x8c, 0x05, 0x90, 0x4b }, }, { @@ -219,19 +183,13 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 107000000, .pll_div_regs =3D { 0xd1, 0x5a, 0x32, 0x89, 0x88, 0x80, 0x40 }, - }, { - .pixclk =3D 108000000, - .pll_div_regs =3D { 0xd1, 0x5a, 0x30, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 108108000, .pll_div_regs =3D { 0xd1, 0x5a, 0x32, 0xfd, 0x0c, 0x80, 0x40 }, }, { .pixclk =3D 118000000, .pll_div_regs =3D { 0xd1, 0x62, 0x34, 0x95, 0x08, 0x80, 0x40 }, - }, { - .pixclk =3D 118800000, - .pll_div_regs =3D { 0xd1, 0x63, 0x30, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 123000000, .pll_div_regs =3D { 0xd1, 0x66, 0x34, 0x82, 0x01, 0x88, 0x45 }, }, { @@ -252,10 +210,7 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 140000000, .pll_div_regs =3D { 0xd1, 0x75, 0x36, 0xa7, 0x90, 0x80, 0x40 }, - }, { - .pixclk =3D 144000000, - .pll_div_regs =3D { 0xd1, 0x78, 0x30, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 148352000, .pll_div_regs =3D { 0xd1, 0x7b, 0x35, 0xdb, 0x39, 0x90, 0x45 }, }, { @@ -279,9 +234,6 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 165000000, .pll_div_regs =3D { 0xd1, 0x45, 0x11, 0x84, 0x81, 0x90, 0x4b }, - }, { - .pixclk =3D 180000000, - .pll_div_regs =3D { 0xd1, 0x4b, 0x10, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 185625000, .pll_div_regs =3D { 0xd1, 0x4e, 0x12, 0x9a, 0x95, 0x80, 0x40 }, @@ -300,25 +252,16 @@ static const struct phy_config phy_pll_cfg[] =3D { }, { .pixclk =3D 213000000, .pll_div_regs =3D { 0xd1, 0x58, 0x12, 0x84, 0x03, 0x82, 0x41 }, - }, { - .pixclk =3D 216000000, - .pll_div_regs =3D { 0xd1, 0x5a, 0x10, 0x00, 0x00, 0x80, 0x00 }, }, { .pixclk =3D 216216000, .pll_div_regs =3D { 0xd1, 0x5a, 0x12, 0xfd, 0x0c, 0x80, 0x40 }, - }, { - .pixclk =3D 237600000, - .pll_div_regs =3D { 0xd1, 0x63, 0x10, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 254000000, .pll_div_regs =3D { 0xd1, 0x69, 0x14, 0x89, 0x08, 0x80, 0x40 }, }, { .pixclk =3D 277500000, .pll_div_regs =3D { 0xd1, 0x73, 0x15, 0x88, 0x05, 0x90, 0x4d }, - }, { - .pixclk =3D 288000000, - .pll_div_regs =3D { 0xd1, 0x78, 0x10, 0x00, 0x00, 0x80, 0x00 }, - }, { + }, { .pixclk =3D 297000000, .pll_div_regs =3D { 0xd1, 0x7b, 0x15, 0x84, 0x03, 0x90, 0x45 }, }, --=20 2.43.0