drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm value
RFC 1/1 drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm value
In the C20 algorithm for HDMI TMDS, certain fields have been updated in the BSpec to set values for SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1, such as tx_misc and dac_ctrl_range.
This patch covers fields that need to be set based on the platform type. here for xe2lpd, xe2HPD and MTL/ARL platform.
Some SoCs cannot be directly distinguished by their GMD version Id, Specifically to set value of tx_misc, so direct device PCI IDs and PCI Host Bridge IDs are used for differentiation.
Bspec:74165,74491
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 57 ++++++++++++++++--- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 11 ++++ .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 19 ++++++- include/drm/intel/pciids.h | 8 ++- 4 files changed, 82 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +49 -8
@@ -6,6 +6,7 @@#include <linux/log2.h> #include <linux/math64.h> #include "i915_reg.h" +#include <drm/intel/pciids.h> #include "intel_cx0_phy.h" #include "intel_cx0_phy_regs.h" #include "intel_ddi.h"
@@ -2164,9 +2165,55 @@ static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]); } +static bool intel_c20_tx_mics_3_platform (struct drm_i915_private *dev_priv) +{ +u16 devid =INTEL_DEVID (dev_priv); +u16 host_bridge_pci_dev_id; +struct pci_dev *pdev =NULL ; +bool check = false; +/* +* Some SoCs have the same PCI IDs, so differentiate them based +* on the host bridge PCI device ID to use the correct txx_mics value +*/ +while ((pdev =pci_get_class (PCI_CLASS_BRIDGE_HOST <<8 , pdev))) + host_bridge_pci_dev_id = pdev->device; + + check = (pdev && + (IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3 (host_bridge_pci_dev_id))); + +return ((devid ==MTL_TXX_MISC3_PLATFORM_ID ) || + (devid ==ARL_TXX_MISC3_PLATFORM_ID ) || check); +} + +static u16 intel_c20_hdmi_tmds_tx_cgf_1 (struct intel_crtc_state *crtc_state) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc_state->uapi.crtc->dev); +u16 tx_misc; +u16 tx_dcc_cal_dac_ctrl_range =8 ; +u16 tx_dcc_bypass =1 ; +u16 tx_term_ctrl; + +if (IS_BATTLEMAGE (dev_priv)) { + tx_misc =0 ; + tx_term_ctrl =2 ; + + }else if (DISPLAY_VER (dev_priv) >=20 ) { + tx_misc =5 ; + tx_term_ctrl =4 ; + }else if (IS_METEORLAKE (dev_priv)) { +if (intel_c20_tx_mics_3_platform (dev_priv)) + tx_misc =3 ; +else + tx_misc =7 ; + + tx_term_ctrl =2 ; + } +return PHY_C20_A_B_TX_CNTX_CFG_1 (tx_misc, tx_dcc_cal_dac_ctrl_range, + tx_dcc_bypass, tx_term_ctrl); +} +static int intel_c20_compute_hdmi_tmds_pll (struct intel_crtc_state *crtc_state) { -struct intel_display *display =to_intel_display (crtc_state);struct intel_c20pll_state *pll_state = &crtc_state->dpll_hw_state.cx0pll.c20;u64 datarate;u64 mpll_tx_clk_div;
@@ -2176,7 +2223,6 @@ static int intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)u64 mpll_multiplier;u64 mpll_fracn_quot;u64 mpll_fracn_rem; -u16 tx_misc;u8 mpllb_ana_freq_vco;u8 mpll_div_multiplier;
@@ -2196,11 +2242,6 @@ static int intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state) mpll_div_multiplier =min_t (u8,div64_u64 ((vco_freq *16 + (datarate >>1 )), datarate),255 ); -if (DISPLAY_VER (display) >=20 ) - tx_misc =0x5 ; -else - tx_misc =0x0 ; -if (vco_freq <=DATARATE_3000000000 ) mpllb_ana_freq_vco =MPLLB_ANA_FREQ_VCO_3 ;else if (vco_freq <=DATARATE_3500000000 )
@@ -2212,7 +2253,7 @@ static int intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state) pll_state->clock = crtc_state->port_clock; pll_state->tx[0 ] =0xbe88 ; - pll_state->tx[1 ] =0x9800 |C20_PHY_TX_MISC (tx_misc); + pll_state->tx[1 ] =intel_c20_hdmi_tmds_tx_cgf_1 (crtc_state); pll_state->tx[2 ] =0x0000 ; pll_state->cmn[0 ] =0x0500 ; pll_state->cmn[1 ] =0x0005 ;
drivers/gpu/drm/i915/display/intel_cx0_phy.h +11 -0
@@ -9,6 +9,17 @@#include <linux/types.h> #include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/pci.h> + +#define HOST_BRIDGE_PCI_DEV_ID1 0x7D1C +#define HOST_BRIDGE_PCI_DEV_ID2 0x7D2D +#define HOST_BRIDGE_PCI_DEV_ID3 0x7D2E +#define HOST_BRIDGE_PCI_DEV_ID4 0x7D2F +#define IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3 (id) \ + (((id) == HOST_BRIDGE_PCI_DEV_ID1) || \ + ((id) == HOST_BRIDGE_PCI_DEV_ID2) || \ + ((id) == HOST_BRIDGE_PCI_DEV_ID3) || \ + ((id) == HOST_BRIDGE_PCI_DEV_ID4))enum icl_port_dpll_id ;struct drm_i915_private ;
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +16 -3
@@ -279,9 +279,22 @@ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_TX_CNTX_CFG : _MTL_C20_A_TX_CNTX_CFG) - (idx))#define PHY_C20_B_TX_CNTX_CFG (i915, idx) \ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_B_TX_CNTX_CFG : _MTL_C20_B_TX_CNTX_CFG) - (idx)) -#define C20_PHY_TX_RATE REG_GENMASK(2, 0) -#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) -#define C20_PHY_TX_MISC (val) REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val)) +#define C20_PHY_TX_RATE REG_GENMASK(2, 0) +#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) +#define C20_PHY_TX_MISC (val) REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val)) +#define C20_PHY_TX_DCC_CAL_RANGE_MASK REG_GENMASK16(11, 8) +#define C20_PHY_TX_DCC_CAL_RANGE (val) \ + REG_FIELD_PREP16(C20_PHY_TX_DCC_CAL_RANGE_MASK, (val)) +#define C20_PHY_TX_DCC_BYPASS_SET REG_BIT(12) +#define C20_PHY_TX_DCC_BYPASS (val) (val ? C20_PHY_TX_DCC_BYPASS_SET : 0) +#define C20_PHY_TX_TERM_CTL_MASK REG_GENMASK16(15, 13) +#define C20_PHY_TX_TERM_CTL (val) REG_FIELD_PREP16(C20_PHY_TX_TERM_CTL_MASK, (val)) +#define PHY_C20_A_B_TX_CNTX_CFG_1 (tx_misc, tx_dcc_cal_dac_ctrl_range, \ + tx_dcc_bypass, tx_term_ctrl) \ + (C20_PHY_TX_MISC(tx_misc) | \ + C20_PHY_TX_DCC_CAL_RANGE(tx_dcc_cal_dac_ctrl_range) | \ + C20_PHY_TX_DCC_BYPASS(tx_dcc_bypass) | \ + C20_PHY_TX_TERM_CTL(tx_term_ctrl))#define PHY_C20_A_CMN_CNTX_CFG (i915, idx) \ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_CMN_CNTX_CFG : _MTL_C20_A_CMN_CNTX_CFG) - (idx))
include/drm/intel/pciids.h +6 -2
@@ -765,8 +765,12 @@ INTEL_ATS_M75_IDS(MACRO__, ## __VA_ARGS__) /* ARL */ + +#define ARL_TXX_MISC3_PLATFORM_ID 0x7D41 +#define MTL_TXX_MISC3_PLATFORM_ID 0x7D45 +#define INTEL_ARL_IDS (MACRO__ , ...) \ - MACRO__(0x7D41, ## __VA_ARGS__), \ + MACRO__(ARL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D51, ## __VA_ARGS__), \ MACRO__(0x7D67, ## __VA_ARGS__), \ MACRO__(0x7DD1, ## __VA_ARGS__), \
@@ -775,7 +779,7 @@/* MTL */ #define INTEL_MTL_IDS (MACRO__ , ...) \ MACRO__(0x7D40, ## __VA_ARGS__), \ - MACRO__(0x7D45, ## __VA_ARGS__), \ + MACRO__(MTL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D55, ## __VA_ARGS__), \ MACRO__(0x7D60, ## __VA_ARGS__), \ MACRO__(0x7DD5, ## __VA_ARGS__)
Signature · 1 line
2.34.1
Patchwork
CI✗ Fi.CI.BUILD: failure for drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm value
== Series Details ==
== Series Details ==
Series: drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm value
URL : https://patchwork.freedesktop.org/series/141280/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/141280/revisions/1/mbox/ not applied
Applying: drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm value
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_cx0_phy.c
M drivers/gpu/drm/i915/display/intel_cx0_phy.h
M drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
M include/drm/intel/pciids.h
Falling back to patching base and 3-way merge...
Auto-merging include/drm/intel/pciids.h
CONFLICT (content): Merge conflict in include/drm/intel/pciids.h
Auto-merging drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Auto-merging drivers/gpu/drm/i915/display/intel_cx0_phy.h
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_cx0_phy.h Auto-merging drivers/gpu/drm/i915/display/intel_cx0_phy.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm value
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced
Jani Nikula
maintainerQuoted 24 lines · Dnyaneshwar Bhadane
In the C20 algorithm for HDMI TMDS, certain fields have been updated in the BSpec to set values for SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1, such as
tx_miscanddac_ctrl_range.
This patch covers fields that need to be set based on the platform type. here for xe2lpd, xe2HPD and MTL/ARL platform.Some SoCs cannot be directly distinguished by their GMD version Id, Specifically to set value of
tx_misc, so direct device PCI IDs and PCI Host Bridge IDs are used for differentiation.Bspec:74165,74491
Signed-off-by Dnyaneshwar Bhadane <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 57 ++++++++++++++++--- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 11 ++++ .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 19 ++++++- include/drm/intel/pciids.h | 8 ++- 4 files changed, 82 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0
drivers/gpu/drm/i915/display/intel_cx0_phy.c line 9
Quoted 4 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0@@ -6,6 +6,7 @@#include <linux/log2.h> #include <linux/math64.h> #include "i915_reg.h" +#include <drm/intel/pciids.h>
No. Do not look at PCI IDs directly inline.
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2168
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0#include "intel_cx0_phy.h" #include "intel_cx0_phy_regs.h" #include "intel_ddi.h" @@ -2164,9 +2165,55 @@ static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]); } +static bool intel_c20_tx_mics_3_platform (struct drm_i915_private *dev_priv)
No new struct drm_i915_private uses please.
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2170
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+{ +u16 devid =INTEL_DEVID (dev_priv);
No. Do not use INTEL_DEVID() in display code. There are no current users and we intend to keep it that way.
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +6
-0+u16 host_bridge_pci_dev_id; +struct pci_dev *pdev =NULL ; +bool check = false; +/* +* Some SoCs have the same PCI IDs, so differentiate them based +* on the host bridge PCI device ID to use the correct txx_mics value
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2186
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +10
-0+*/ +while ((pdev =pci_get_class (PCI_CLASS_BRIDGE_HOST <<8 , pdev))) + host_bridge_pci_dev_id = pdev->device; + + check = (pdev && + (IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3 (host_bridge_pci_dev_id))); + +return ((devid ==MTL_TXX_MISC3_PLATFORM_ID ) || + (devid ==ARL_TXX_MISC3_PLATFORM_ID ) || check); +}
None of this belongs in cx0 PHY code.
Quoted 73 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +29
-8+ +static u16 intel_c20_hdmi_tmds_tx_cgf_1 (struct intel_crtc_state *crtc_state) +{ +struct drm_i915_private *dev_priv =to_i915 (crtc_state->uapi.crtc->dev); +u16 tx_misc; +u16 tx_dcc_cal_dac_ctrl_range =8 ; +u16 tx_dcc_bypass =1 ; +u16 tx_term_ctrl; + +if (IS_BATTLEMAGE (dev_priv)) { + tx_misc =0 ; + tx_term_ctrl =2 ; + + }else if (DISPLAY_VER (dev_priv) >=20 ) { + tx_misc =5 ; + tx_term_ctrl =4 ; + }else if (IS_METEORLAKE (dev_priv)) { +if (intel_c20_tx_mics_3_platform (dev_priv)) + tx_misc =3 ; +else + tx_misc =7 ; + + tx_term_ctrl =2 ; + } +return PHY_C20_A_B_TX_CNTX_CFG_1 (tx_misc, tx_dcc_cal_dac_ctrl_range, + tx_dcc_bypass, tx_term_ctrl); +} +static int intel_c20_compute_hdmi_tmds_pll (struct intel_crtc_state *crtc_state) { -struct intel_display *display =to_intel_display (crtc_state);struct intel_c20pll_state *pll_state = &crtc_state->dpll_hw_state.cx0pll.c20;u64 datarate;u64 mpll_tx_clk_div;@@ -2176,7 +2223,6 @@ static int intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)u64 mpll_multiplier;u64 mpll_fracn_quot;u64 mpll_fracn_rem; -u16 tx_misc;u8 mpllb_ana_freq_vco;u8 mpll_div_multiplier;@@ -2196,11 +2242,6 @@ static int intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state) mpll_div_multiplier =min_t (u8,div64_u64 ((vco_freq *16 + (datarate >>1 )), datarate),255 ); -if (DISPLAY_VER (display) >=20 ) - tx_misc =0x5 ; -else - tx_misc =0x0 ; -if (vco_freq <=DATARATE_3000000000 ) mpllb_ana_freq_vco =MPLLB_ANA_FREQ_VCO_3 ;else if (vco_freq <=DATARATE_3500000000 )@@ -2212,7 +2253,7 @@ static int intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state) pll_state->clock = crtc_state->port_clock; pll_state->tx[0 ] =0xbe88 ; - pll_state->tx[1 ] =0x9800 |C20_PHY_TX_MISC (tx_misc); + pll_state->tx[1 ] =intel_c20_hdmi_tmds_tx_cgf_1 (crtc_state); pll_state->tx[2 ] =0x0000 ; pll_state->cmn[0 ] =0x0500 ; pll_state->cmn[1 ] =0x0005 ;drivers/gpu/drm/i915/display/intel_cx0_phy.h +2
-0@@ -9,6 +9,17 @@#include <linux/types.h> #include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/pci.h> +
drivers/gpu/drm/i915/display/intel_cx0_phy.h line 23
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +9
-0+#define HOST_BRIDGE_PCI_DEV_ID1 0x7D1C +#define HOST_BRIDGE_PCI_DEV_ID2 0x7D2D +#define HOST_BRIDGE_PCI_DEV_ID3 0x7D2E +#define HOST_BRIDGE_PCI_DEV_ID4 0x7D2F +#define IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3 (id) \ + (((id) == HOST_BRIDGE_PCI_DEV_ID1) || \ + ((id) == HOST_BRIDGE_PCI_DEV_ID2) || \ + ((id) == HOST_BRIDGE_PCI_DEV_ID3) || \ + ((id) == HOST_BRIDGE_PCI_DEV_ID4))
None of this belongs in cx0 PHY code.
Quoted 19 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +0
-0enum icl_port_dpll_id ;struct drm_i915_private ;drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +6
-3@@ -279,9 +279,22 @@ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_TX_CNTX_CFG : _MTL_C20_A_TX_CNTX_CFG) - (idx))#define PHY_C20_B_TX_CNTX_CFG (i915, idx) \ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_B_TX_CNTX_CFG : _MTL_C20_B_TX_CNTX_CFG) - (idx)) -#define C20_PHY_TX_RATE REG_GENMASK(2, 0) -#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) -#define C20_PHY_TX_MISC (val) REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val)) +#define C20_PHY_TX_RATE REG_GENMASK(2, 0) +#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) +#define C20_PHY_TX_MISC (val) REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val)) +#define C20_PHY_TX_DCC_CAL_RANGE_MASK REG_GENMASK16(11, 8) +#define C20_PHY_TX_DCC_CAL_RANGE (val) \ + REG_FIELD_PREP16(C20_PHY_TX_DCC_CAL_RANGE_MASK, (val))
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 297
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +10
-0+#define C20_PHY_TX_DCC_BYPASS_SET REG_BIT(12) +#define C20_PHY_TX_DCC_BYPASS (val) (val ? C20_PHY_TX_DCC_BYPASS_SET : 0) +#define C20_PHY_TX_TERM_CTL_MASK REG_GENMASK16(15, 13) +#define C20_PHY_TX_TERM_CTL (val) REG_FIELD_PREP16(C20_PHY_TX_TERM_CTL_MASK, (val)) +#define PHY_C20_A_B_TX_CNTX_CFG_1 (tx_misc, tx_dcc_cal_dac_ctrl_range, \ + tx_dcc_bypass, tx_term_ctrl) \ + (C20_PHY_TX_MISC(tx_misc) | \ + C20_PHY_TX_DCC_CAL_RANGE(tx_dcc_cal_dac_ctrl_range) | \ + C20_PHY_TX_DCC_BYPASS(tx_dcc_bypass) | \ + C20_PHY_TX_TERM_CTL(tx_term_ctrl))
Explain.
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0#define PHY_C20_A_CMN_CNTX_CFG (i915, idx) \ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_CMN_CNTX_CFG : _MTL_C20_A_CMN_CNTX_CFG) - (idx))include/drm/intel/pciids.h +0
-0
include/drm/intel/pciids.h line 770
Quoted 6 lines
include/drm/intel/pciids.h +3
-0@@ -765,8 +765,12 @@ INTEL_ATS_M75_IDS(MACRO__, ## __VA_ARGS__) /* ARL */ + +#define ARL_TXX_MISC3_PLATFORM_ID 0x7D41 +#define MTL_TXX_MISC3_PLATFORM_ID 0x7D45
No. Look around you. Do you see a single thing like this?
Quoted 16 lines
include/drm/intel/pciids.h +3
-2+#define INTEL_ARL_IDS (MACRO__ , ...) \ - MACRO__(0x7D41, ## __VA_ARGS__), \ + MACRO__(ARL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D51, ## __VA_ARGS__), \ MACRO__(0x7D67, ## __VA_ARGS__), \ MACRO__(0x7DD1, ## __VA_ARGS__), \@@ -775,7 +779,7 @@/* MTL */ #define INTEL_MTL_IDS (MACRO__ , ...) \ MACRO__(0x7D40, ## __VA_ARGS__), \ - MACRO__(0x7D45, ## __VA_ARGS__), \ + MACRO__(MTL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D55, ## __VA_ARGS__), \ MACRO__(0x7D60, ## __VA_ARGS__), \ MACRO__(0x7DD5, ## __VA_ARGS__)
Signature · 1 line
Jani Nikula, Intel
Quoted 10 lines
-----Original Message-----
From: Jani Nikula <[email protected]>
Sent: Wednesday, November 13, 2024 6:34 PM
To: Bhadane, Dnyaneshwar <[email protected]>; intel- [email protected]
Cc: Bhadane, Dnyaneshwar <[email protected]>
Subject: Re: [RFC] drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm value
Quoted 11 lines
Quoted 9 lines · Dnyaneshwar Bhadane
In the C20 algorithm for HDMI TMDS, certain fields have been updated in the BSpec to set values for SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1, such as
tx_miscanddac_ctrl_range.
This patch covers fields that need to be set based on the platform type. here for xe2lpd, xe2HPD and MTL/ARL platform.Some SoCs cannot be directly distinguished by their GMD version Id, Specifically to set value of
tx_misc, so direct device PCI IDs and PCI Host Bridge IDs are used for differentiation.
I will rephrase this as per new changes.
Quoted 10 lines
Quoted 10 lines
Bspec:74165,74491
Signed-off-by Dnyaneshwar Bhadane <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 57 ++++++++++++++++--- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 11 ++++ .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 19 ++++++- include/drm/intel/pciids.h | 8 ++- 4 files changed, 82 insertions(+), 13 deletions(-)
Quoted 12 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c line 9
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0@@ -6,6 +6,7 @@#include <linux/log2.h> #include <linux/math64.h> #include "i915_reg.h" +#include <drm/intel/pciids.h> No. Do not look at PCI IDs directly inline.
#1
Sure, I am removing this does here. The reason was that earlier plan was without using sub platform macros but recently It got introduce in codebase.
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0#include "intel_cx0_phy.h" #include "intel_cx0_phy_regs.h" #include "intel_ddi.h" @@ -2164,9 +2165,55 @@ static void intel_c10pll_dump_hw_state(struct
drm_i915_private*i915,drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2165
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);}
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct · line 2167
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+static bool intel_c20_tx_mics_3_platform (struct drm_i915_private +*dev_priv)No new struct
drm_i915_privateuses please.
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2170
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+{ +u16 devid =INTEL_DEVID (dev_priv);No. Do not use
INTEL_DEVID()in display code. There are no current users and we intend to keep it that way.
This will be removed as part of #1 comment.
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2183
Quoted 13 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +12
-0+u16 host_bridge_pci_dev_id; +struct pci_dev *pdev =NULL ; +bool check = false; +/* +* Some SoCs have the same PCI IDs, so differentiate them based +* on the host bridge PCI device ID to use the correct txx_mics value +*/ +while ((pdev =pci_get_class (PCI_CLASS_BRIDGE_HOST <<8 , pdev))) + host_bridge_pci_dev_id = pdev->device; + + check = (pdev && +(
IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3(host_bridge_pci_dev_id)));
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct · line 2183
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+ + return ((devid == MTL_TXX_MISC3_PLATFORM_ID) ||
Condition will be change with correct macro.
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct · line 2184
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0+ (devid == ARL_TXX_MISC3_PLATFORM_ID) || check); }None of this belongs in cx0 PHY code.
#3
Earlier the c20 TMDS algorithm was display version specific and generic but now we need compare with platform type for selecting correct value for tx_misc , tx_term_ctrl Please suggest correct place not to sure to place here as par of the condition below.
Quoted 84 lines
Quoted 16 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +15
-0+ +static u16 intel_c20_hdmi_tmds_tx_cgf_1 (struct intel_crtc_state +*crtc_state) { +struct drm_i915_private *dev_priv =to_i915 (crtc_state->uapi.crtc- dev); +u16 tx_misc; +u16 tx_dcc_cal_dac_ctrl_range =8 ; +u16 tx_dcc_bypass =1 ; +u16 tx_term_ctrl; + +if (IS_BATTLEMAGE (dev_priv)) { + tx_misc =0 ; + tx_term_ctrl =2 ; + + }else if (DISPLAY_VER (dev_priv) >=20 ) { + tx_misc =5 ;drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915,
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +10
-0+ tx_term_ctrl =4 ; + }else if (IS_METEORLAKE (dev_priv)) { +if (intel_c20_tx_mics_3_platform (dev_priv)) + tx_misc =3 ; +else + tx_misc =7 ; + + tx_term_ctrl =2 ; + } + return PHY_C20_A_B_TX_CNTX_CFG_1(tx_misc,
tx_dcc_cal_dac_ctrl_range,drivers/gpu/drm/i915/display/intel_cx0_phy.c static int
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3
-1+ tx_dcc_bypass, tx_term_ctrl); +} +static int intel_c20_compute_hdmi_tmds_pll (struct intel_crtc_state *crtc_state) { -struct intel_display *display =to_intel_display (crtc_state);struct intel_c20pll_state *pll_state = &crtc_state- dpll_hw_state.cx0pll.c20;u64 datarate;u64 mpll_tx_clk_div;@@ -2176,7 +2223,6 @@ static int
intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)drivers/gpu/drm/i915/display/intel_cx0_phy.c static int
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-1u64 mpll_multiplier;u64 mpll_fracn_quot;u64 mpll_fracn_rem; -u16 tx_misc;u8 mpllb_ana_freq_vco;u8 mpll_div_multiplier;@@ -2196,11 +2242,6 @@ static int
intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)Quoted 28 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-5mpll_div_multiplier =min_t (u8,div64_u64 ((vco_freq *16 + (datarate >1 )), datarate),255 ); -if (DISPLAY_VER (display) >=20 ) - tx_misc =0x5 ; -else - tx_misc =0x0 ; -if (vco_freq <=DATARATE_3000000000 ) mpllb_ana_freq_vco =MPLLB_ANA_FREQ_VCO_3 ;else if (
vco_freq<=DATARATE_3500000000) @@ -2212,7 +2253,7 @@
static intintel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-1pll_state->clock = crtc_state->port_clock; pll_state->tx[0 ] =0xbe88 ; - pll_state->tx[1 ] =0x9800 |C20_PHY_TX_MISC (tx_misc); + pll_state->tx[1 ] =intel_c20_hdmi_tmds_tx_cgf_1 (crtc_state); pll_state->tx[2 ] =0x0000 ; pll_state->cmn[0 ] =0x0500 ; pll_state->cmn[1 ] =0x0005 ;drivers/gpu/drm/i915/display/intel_cx0_phy.h +0
-0drivers/gpu/drm/i915/display/intel_cx0_phy.h line 15
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +4
-0@@ -9,6 +9,17 @@#include <linux/types.h> #include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/pci.h> + +#define HOST_BRIDGE_PCI_DEV_ID1 0x7D1C #define +HOST_BRIDGE_PCI_DEV_ID2 0x7D2D #define HOST_BRIDGE_PCI_DEV_ID3
0x7D2E
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h line 23
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +6
-0+#define HOST_BRIDGE_PCI_DEV_ID4 0x7D2F #define +IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3 (id) \ + (((id) ==HOST_BRIDGE_PCI_DEV_ID1 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID2 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID3 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID4 ))None of this belongs in cx0 PHY code.
Is intel_display_reg_defs.h is good place ?.
Quoted 39 lines
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +0
-0enum icl_port_dpll_id ;struct drm_i915_private ;drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0@@ -279,9 +279,22 @@ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_TX_CNTX_CFG :
_MTL_C20_A_TX_CNTX_CFG) - (idx)) #define
PHY_C20_B_TX_CNTX_CFG(i915, idx)\Quoted 1 line
((
_IS_XE2HPD_C20(i915)?_XE2HPD_C20_B_TX_CNTX_CFG:
_MTL_C20_B_TX_CNTX_CFG) - (idx))drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-3-#define C20_PHY_TX_RATE REG_GENMASK(2, 0) -#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) -#define C20_PHY_TX_MISC (val)REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val))drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +3
-0+#define C20_PHY_TX_RATE REG_GENMASK(2, 0) +#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) +#define C20_PHY_TX_MISC (val)REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val))Quoted 1 line
+#define
C20_PHY_TX_DCC_CAL_RANGE_MASKREG_GENMASK16(11,8)
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_DCC_CAL_RANGE (val) \ + REG_FIELD_PREP16(C20_PHY_TX_DCC_CAL_RANGE_MASK,(val))
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_DCC_BYPASS_SET REG_BIT(12) +#define C20_PHY_TX_DCC_BYPASS (val) (val ?
C20_PHY_TX_DCC_BYPASS_SET: 0)drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_TERM_CTL_MASK REG_GENMASK16(15, 13) +#define C20_PHY_TX_TERM_CTL (val)REG_FIELD_PREP16(C20_PHY_TX_TERM_CTL_MASK, (val))Quoted 1 line
+#define PHY_C20_A_B_TX_CNTX_CFG_1(tx_misc,
tx_dcc_cal_dac_ctrl_range, \drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +3
-0+ tx_dcc_bypass, tx_term_ctrl) \ + (C20_PHY_TX_MISC(tx_misc) | \ + C20_PHY_TX_DCC_CAL_RANGE(tx_dcc_cal_dac_ctrl_range) |\
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0+ C20_PHY_TX_DCC_BYPASS(tx_dcc_bypass) |\drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 297
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0+ C20_PHY_TX_TERM_CTL(tx_term_ctrl))Explain.
Yes,
tx[1] (SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1) field is 16 bit field. With tx_mics mapped to [0:7] bit , txX_dcc_cal_dac_ctrl_range [8:11] txX_dcc_bypass is 12th bit and txX_term_ctrl mapped to [13:15] bit.
I will add this explanation as well in commit message.
Quoted 13 lines
Quoted 4 lines
#define
PHY_C20_A_CMN_CNTX_CFG(i915, idx)\
((_IS_XE2HPD_C20(i915)?_XE2HPD_C20_A_CMN_CNTX_CFG:
Quoted 8 lines
_MTL_C20_A_CMN_CNTX_CFG) - (idx)) diff --gita/include/drm/intel/pciids.hb/include/drm/intel/pciids.hindex7632507af166..d88c58534148100644include/drm/intel/pciids.h +0
-0@@ -765,8 +765,12 @@ INTEL_ATS_M75_IDS(MACRO__, ## __VA_ARGS__)
Quoted 6 lines
include/drm/intel/pciids.h
Quoted 4 lines
include/drm/intel/pciids.h +3
-0/* ARL */ + +#define ARL_TXX_MISC3_PLATFORM_ID 0x7D41 #define +MTL_TXX_MISC3_PLATFORM_ID 0x7D45No. Look around you. Do you see a single thing like this?
It will be removed as per comment #1.
Thank you jani for reviewing.
Dnyaneshwar,
Quoted 20 lines
Quoted 9 lines
include/drm/intel/pciids.h +2
-1+#define INTEL_ARL_IDS (MACRO__ , ...) \ - MACRO__(0x7D41, ## __VA_ARGS__), \ + MACRO__(ARL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D51, ## __VA_ARGS__), \ MACRO__(0x7D67, ## __VA_ARGS__), \ MACRO__(0x7DD1, ## __VA_ARGS__), \include/drm/intel/pciids.h line 785
Quoted 8 lines
include/drm/intel/pciids.h +1
-1@@ -775,7 +779,7 @@/* MTL */ #define INTEL_MTL_IDS (MACRO__ , ...) \ MACRO__(0x7D40, ## __VA_ARGS__), \ - MACRO__(0x7D45, ## __VA_ARGS__), \ + MACRO__(MTL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D55, ## __VA_ARGS__), \ MACRO__(0x7D60, ## __VA_ARGS__), \ MACRO__(0x7DD5, ## __VA_ARGS__)--
Jani Nikula, Intel
Jani Nikula
maintainerQuoted 83 lines · Dnyaneshwar
Quoted 8 lines
-----Original Message-----
From: Jani Nikula <[email protected]>
Sent: Wednesday, November 13, 2024 6:34 PM
To: Bhadane, Dnyaneshwar <[email protected]>; intel- [email protected]
Cc: Bhadane, Dnyaneshwar <[email protected]>
Subject: Re: [RFC] drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm valueQuoted 11 lines
Quoted 9 lines · Dnyaneshwar Bhadane
In the C20 algorithm for HDMI TMDS, certain fields have been updated in the BSpec to set values for SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1, such as
tx_miscanddac_ctrl_range.
This patch covers fields that need to be set based on the platform type. here for xe2lpd, xe2HPD and MTL/ARL platform.Some SoCs cannot be directly distinguished by their GMD version Id, Specifically to set value of
tx_misc, so direct device PCI IDs and PCI Host Bridge IDs are used for differentiation.I will rephrase this as per new changes.
Quoted 10 lines
Quoted 10 lines
Bspec:74165,74491
Signed-off-by Dnyaneshwar Bhadane <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 57 ++++++++++++++++--- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 11 ++++ .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 19 ++++++- include/drm/intel/pciids.h | 8 ++- 4 files changed, 82 insertions(+), 13 deletions(-)Quoted 12 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c line 9
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0@@ -6,6 +6,7 @@#include <linux/log2.h> #include <linux/math64.h> #include "i915_reg.h" +#include <drm/intel/pciids.h> No. Do not look at PCI IDs directly inline.
#1
Sure, I am removing this does here. The reason was that earlier plan was without using sub platform macros but recently It got introduce in codebase.Quoted 14 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct
Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0#include "intel_cx0_phy.h" #include "intel_cx0_phy_regs.h" #include "intel_ddi.h" @@ -2164,9 +2165,55 @@ static void intel_c10pll_dump_hw_state(struct
drm_i915_private*i915,drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2165
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);}
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct · line 2167
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+static bool intel_c20_tx_mics_3_platform (struct drm_i915_private +*dev_priv)No new struct
drm_i915_privateuses please.Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2170
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+{ +u16 devid =INTEL_DEVID (dev_priv);No. Do not use
INTEL_DEVID()in display code. There are no current users and we intend to keep it that way.This will be removed as part of #1 comment.
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2183
Quoted 13 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +12
-0+u16 host_bridge_pci_dev_id; +struct pci_dev *pdev =NULL ; +bool check = false; +/* +* Some SoCs have the same PCI IDs, so differentiate them based +* on the host bridge PCI device ID to use the correct txx_mics value +*/ +while ((pdev =pci_get_class (PCI_CLASS_BRIDGE_HOST <<8 , pdev))) + host_bridge_pci_dev_id = pdev->device; + + check = (pdev && +(
IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3(host_bridge_pci_dev_id)));Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct · line 2183
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+ + return ((devid == MTL_TXX_MISC3_PLATFORM_ID) ||Condition will be change with correct macro.
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct · line 2184
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0+ (devid == ARL_TXX_MISC3_PLATFORM_ID) || check); }None of this belongs in cx0 PHY code.
#3
Earlier the c20 TMDS algorithm was display version specific and generic but now we need compare with platform type for selecting correct value fortx_misc,tx_term_ctrlPlease suggest correct place not to sure to place here as par of the condition below.
The point is, this file is about cx0 PHY implementation, it's not about platform identification. Like, what if there'll be another place that needs this?
The right place *might* be intel_display_device.[ch] but it might be intel_quirks.[ch] too. Or it might be a new file under soc/. Depends.
Is there really no other way than looking at host bridge?
Quoted 94 lines
Quoted 85 lines
Quoted 17 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +15
-0+ +static u16 intel_c20_hdmi_tmds_tx_cgf_1 (struct intel_crtc_state +*crtc_state) { +struct drm_i915_private *dev_priv =to_i915 (crtc_state->uapi.crtc- dev); +u16 tx_misc; +u16 tx_dcc_cal_dac_ctrl_range =8 ; +u16 tx_dcc_bypass =1 ; +u16 tx_term_ctrl; + +if (IS_BATTLEMAGE (dev_priv)) { + tx_misc =0 ; + tx_term_ctrl =2 ; + + }else if (DISPLAY_VER (dev_priv) >=20 ) { + tx_misc =5 ;drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915,
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +10
-0+ tx_term_ctrl =4 ; + }else if (IS_METEORLAKE (dev_priv)) { +if (intel_c20_tx_mics_3_platform (dev_priv)) + tx_misc =3 ; +else + tx_misc =7 ; + + tx_term_ctrl =2 ; + } + return PHY_C20_A_B_TX_CNTX_CFG_1(tx_misc,
tx_dcc_cal_dac_ctrl_range,drivers/gpu/drm/i915/display/intel_cx0_phy.c static int
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3
-1+ tx_dcc_bypass, tx_term_ctrl); +} +static int intel_c20_compute_hdmi_tmds_pll (struct intel_crtc_state *crtc_state) { -struct intel_display *display =to_intel_display (crtc_state);struct intel_c20pll_state *pll_state = &crtc_state- dpll_hw_state.cx0pll.c20;u64 datarate;u64 mpll_tx_clk_div;@@ -2176,7 +2223,6 @@ static int
intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)drivers/gpu/drm/i915/display/intel_cx0_phy.c static int
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-1u64 mpll_multiplier;u64 mpll_fracn_quot;u64 mpll_fracn_rem; -u16 tx_misc;u8 mpllb_ana_freq_vco;u8 mpll_div_multiplier;@@ -2196,11 +2242,6 @@ static int
intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)Quoted 28 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-5mpll_div_multiplier =min_t (u8,div64_u64 ((vco_freq *16 + (datarate >1 )), datarate),255 ); -if (DISPLAY_VER (display) >=20 ) - tx_misc =0x5 ; -else - tx_misc =0x0 ; -if (vco_freq <=DATARATE_3000000000 ) mpllb_ana_freq_vco =MPLLB_ANA_FREQ_VCO_3 ;else if (
vco_freq<=DATARATE_3500000000) @@ -2212,7 +2253,7 @@
static intintel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-1pll_state->clock = crtc_state->port_clock; pll_state->tx[0 ] =0xbe88 ; - pll_state->tx[1 ] =0x9800 |C20_PHY_TX_MISC (tx_misc); + pll_state->tx[1 ] =intel_c20_hdmi_tmds_tx_cgf_1 (crtc_state); pll_state->tx[2 ] =0x0000 ; pll_state->cmn[0 ] =0x0500 ; pll_state->cmn[1 ] =0x0005 ;drivers/gpu/drm/i915/display/intel_cx0_phy.h +0
-0drivers/gpu/drm/i915/display/intel_cx0_phy.h line 15
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +4
-0@@ -9,6 +9,17 @@#include <linux/types.h> #include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/pci.h> + +#define HOST_BRIDGE_PCI_DEV_ID1 0x7D1C #define +HOST_BRIDGE_PCI_DEV_ID2 0x7D2D #define HOST_BRIDGE_PCI_DEV_ID3
0x7D2EQuoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h line 23
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +6
-0+#define HOST_BRIDGE_PCI_DEV_ID4 0x7D2F #define +IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3 (id) \ + (((id) ==HOST_BRIDGE_PCI_DEV_ID1 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID2 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID3 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID4 ))None of this belongs in cx0 PHY code.
Quoted 1 line
Is
intel_display_reg_defs.his good place ?.
No. There's nothing like this in there. And you shouldn't make all the macros be about "TXX MISC 3". Identify the platform in one place, in a generic way, and use that information in another.
Again, what if there's another part of the driver that needs the same identification? It would be really odd to call that "TXX MISC 3".
Quoted 41 lines
Quoted 41 lines
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +0
-0enum icl_port_dpll_id ;struct drm_i915_private ;drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0@@ -279,9 +279,22 @@ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_TX_CNTX_CFG :
_MTL_C20_A_TX_CNTX_CFG) - (idx)) #define
PHY_C20_B_TX_CNTX_CFG(i915, idx)\Quoted 1 line
((
_IS_XE2HPD_C20(i915)?_XE2HPD_C20_B_TX_CNTX_CFG:
_MTL_C20_B_TX_CNTX_CFG) - (idx))drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-3-#define C20_PHY_TX_RATE REG_GENMASK(2, 0) -#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) -#define C20_PHY_TX_MISC (val)REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val))drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +3
-0+#define C20_PHY_TX_RATE REG_GENMASK(2, 0) +#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7, 0) +#define C20_PHY_TX_MISC (val)REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val))Quoted 1 line
+#define
C20_PHY_TX_DCC_CAL_RANGE_MASKREG_GENMASK16(11,8)
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_DCC_CAL_RANGE (val) \ + REG_FIELD_PREP16(C20_PHY_TX_DCC_CAL_RANGE_MASK,(val))
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_DCC_BYPASS_SET REG_BIT(12) +#define C20_PHY_TX_DCC_BYPASS (val) (val ?
C20_PHY_TX_DCC_BYPASS_SET: 0)drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_TERM_CTL_MASK REG_GENMASK16(15, 13) +#define C20_PHY_TX_TERM_CTL (val)REG_FIELD_PREP16(C20_PHY_TX_TERM_CTL_MASK, (val))Quoted 1 line
+#define PHY_C20_A_B_TX_CNTX_CFG_1(tx_misc,
tx_dcc_cal_dac_ctrl_range, \drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +3
-0+ tx_dcc_bypass, tx_term_ctrl) \ + (C20_PHY_TX_MISC(tx_misc) | \ + C20_PHY_TX_DCC_CAL_RANGE(tx_dcc_cal_dac_ctrl_range) |\drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0+ C20_PHY_TX_DCC_BYPASS(tx_dcc_bypass) |\
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 297
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0+ C20_PHY_TX_TERM_CTL(tx_term_ctrl))Explain.
Yes,
tx[1] (SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1) field is 16 bit field. Withtx_micsmapped to [0:7] bit ,txX_dcc_cal_dac_ctrl_range[8:11]txX_dcc_bypassis 12th bit andtxX_term_ctrlmapped to [13:15] bit.
But we only describe the register bits and bitfields here. We don't add macros that group a lot of stuff together. You do that where the information is used.
Pretty much imagine that the register macros could one day be automatically generated, and you'd only have the register fields here, nothing else.
BR,
Jani.
Quoted 46 lines
I will add this explanation as well in commit message.
Quoted 13 lines
Quoted 4 lines
#define
PHY_C20_A_CMN_CNTX_CFG(i915, idx)\
((_IS_XE2HPD_C20(i915)?_XE2HPD_C20_A_CMN_CNTX_CFG:
Quoted 8 lines
_MTL_C20_A_CMN_CNTX_CFG) - (idx)) diff --gita/include/drm/intel/pciids.hb/include/drm/intel/pciids.hindex7632507af166..d88c58534148100644include/drm/intel/pciids.h +0
-0@@ -765,8 +765,12 @@ INTEL_ATS_M75_IDS(MACRO__, ## __VA_ARGS__)Quoted 6 lines
include/drm/intel/pciids.h
Quoted 4 lines
include/drm/intel/pciids.h +3
-0/* ARL */ + +#define ARL_TXX_MISC3_PLATFORM_ID 0x7D41 #define +MTL_TXX_MISC3_PLATFORM_ID 0x7D45No. Look around you. Do you see a single thing like this?
It will be removed as per comment #1.
Thank you jani for reviewing.
Dnyaneshwar,
Quoted 20 lines
Quoted 9 lines
include/drm/intel/pciids.h +2
-1+#define INTEL_ARL_IDS (MACRO__ , ...) \ - MACRO__(0x7D41, ## __VA_ARGS__), \ + MACRO__(ARL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D51, ## __VA_ARGS__), \ MACRO__(0x7D67, ## __VA_ARGS__), \ MACRO__(0x7DD1, ## __VA_ARGS__), \include/drm/intel/pciids.h line 785
Quoted 8 lines
include/drm/intel/pciids.h +1
-1@@ -775,7 +779,7 @@/* MTL */ #define INTEL_MTL_IDS (MACRO__ , ...) \ MACRO__(0x7D40, ## __VA_ARGS__), \ - MACRO__(0x7D45, ## __VA_ARGS__), \ + MACRO__(MTL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D55, ## __VA_ARGS__), \ MACRO__(0x7D60, ## __VA_ARGS__), \ MACRO__(0x7DD5, ## __VA_ARGS__)--
Jani Nikula, Intel
Signature · 1 line
Jani Nikula, Intel
Quoted 108 lines
-----Original Message-----
From: Jani Nikula <[email protected]>
Sent: Thursday, November 14, 2024 2:45 PM
To: Bhadane, Dnyaneshwar <[email protected]>; intel- [email protected]
Subject: RE: [RFC] drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm valueQuoted 9 lines · Dnyaneshwar
Quoted 9 lines
-----Original Message-----
From: Jani Nikula <[email protected]>
Sent: Wednesday, November 13, 2024 6:34 PM
To: Bhadane, Dnyaneshwar <[email protected]>; intel- [email protected]
Cc: Bhadane, Dnyaneshwar <[email protected]>
Subject: Re: [RFC] drm/i915/cx0_phy: Update HDMI TMDS C20 algorithm valueQuoted 5 lines
Quoted 5 lines
Quoted 3 lines · Dnyaneshwar Bhadane
In the C20 algorithm for HDMI TMDS, certain fields have been updated in the BSpec to set values for SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1, such as
tx_miscand
dac_ctrl_range.Quoted 30 lines
Quoted 6 lines
Quoted 6 lines
This patch covers fields that need to be set based on the platform type. here for xe2lpd, xe2HPD and MTL/ARL platform.
Some SoCs cannot be directly distinguished by their GMD version Id, Specifically, to set value of
tx_misc, so direct device PCI IDs and PCI Host Bridge IDs are used for differentiation.I will rephrase this as per new changes.
Quoted 11 lines
Quoted 11 lines
Bspec:74165,74491
Signed-off-by Dnyaneshwar Bhadane <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 57 ++++++++++++++++--- drivers/gpu/drm/i915/display/intel_cx0_phy.h ++++++++++++++++| 11 ++++ .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 19 ++++++- include/drm/intel/pciids.h | 8 ++- 4 files changed, 82 insertions(+), 13 deletions(-)Quoted 12 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c line 9
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0@@ -6,6 +6,7 @@#include <linux/log2.h> #include <linux/math64.h> #include "i915_reg.h" +#include <drm/intel/pciids.h> No. Do not look at PCI IDs directly inline.
Quoted 3 lines
#1
Sure, I am removing this does here. The reason was that earlier plan was without using sub platform macros but recently It got introduce incodebase.
Quoted 39 lines
Quoted 15 lines
Quoted 6 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0#include "intel_cx0_phy.h" #include "intel_cx0_phy_regs.h" #include "intel_ddi.h" @@ -2164,9 +2165,55 @@ static voidintel_c10pll_dump_hw_state(struct
drm_i915_private*i915,Quoted 1 line
i + 2, hw_state->pll[i + 2], i + 3, hw_state->pll[i + 3]);
}
drivers/gpu/drm/i915/display/intel_cx0_phy.c
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+static bool intel_c20_tx_mics_3_platform (struct drm_i915_private +*dev_priv)No new struct
drm_i915_privateuses please.Quoted 5 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2170
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+{ +u16 devid =INTEL_DEVID (dev_priv);No. Do not use
INTEL_DEVID()in display code. There are no current users and we intend to keep it that way.This will be removed as part of #1 comment.
Quoted 14 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915, · line 2183
Quoted 13 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +12
-0+u16 host_bridge_pci_dev_id; +struct pci_dev *pdev =NULL ; +bool check = false; +/* +* Some SoCs have the same PCI IDs, so differentiate them based +* on the host bridge PCI device ID to use the correct txx_mics value +*/ +while ((pdev =pci_get_class (PCI_CLASS_BRIDGE_HOST <<8 , pdev))) + host_bridge_pci_dev_id = pdev->device; + + check = (pdev && +(
IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3(host_bridge_pci_dev_id)));Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+ + return ((devid == MTL_TXX_MISC3_PLATFORM_ID) ||Condition will be change with correct macro.
Quoted 7 lines
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-0+ (devid == ARL_TXX_MISC3_PLATFORM_ID) || check); }None of this belongs in cx0 PHY code.
#3
Earlier the c20 TMDS algorithm was display version specific and generic but now we need compare with platform type for selecting correct value fortx_misc,tx_term_ctrlPlease suggest correct place not tosure to place here as par of the condition below.
Quoted 7 lines
The point is, this file is about cx0 PHY implementation, it's not about platform identification. Like, what if there'll be another place that needs this?
The right place *might* be intel_display_device.[ch] but it might be intel_quirks.[ch] too. Or it might be a new file under soc/. Depends.
Is there really no other way than looking at host bridge?
There were the ways i.e. Adding flag to VBT or Reading SoC MSR or Using other than i915 PCI id that is differentiating SoCs. After a discussion it is decided to use comparing host bridge PCI id when the SoCs having the same GMD version and drm device PCI id.
Quoted 79 lines
Quoted 79 lines
Quoted 79 lines
Quoted 19 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +5
-0+ +static u16 intel_c20_hdmi_tmds_tx_cgf_1 (struct intel_crtc_state +*crtc_state) { +struct drm_i915_private *dev_priv = +to_i915(crtc_state->uapi.crtc-dev);
drivers/gpu/drm/i915/display/intel_cx0_phy.c +11
-0+u16 tx_misc; +u16 tx_dcc_cal_dac_ctrl_range =8 ; +u16 tx_dcc_bypass =1 ; +u16 tx_term_ctrl; + +if (IS_BATTLEMAGE (dev_priv)) { + tx_misc =0 ; + tx_term_ctrl =2 ; + + }else if (DISPLAY_VER (dev_priv) >=20 ) { + tx_misc =5 ;drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c10pll_dump_hw_state(struct drm_i915_private *i915,
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +10
-0+ tx_term_ctrl =4 ; + }else if (IS_METEORLAKE (dev_priv)) { +if (intel_c20_tx_mics_3_platform (dev_priv)) + tx_misc =3 ; +else + tx_misc =7 ; + + tx_term_ctrl =2 ; + } + return PHY_C20_A_B_TX_CNTX_CFG_1(tx_misc,
tx_dcc_cal_dac_ctrl_range,drivers/gpu/drm/i915/display/intel_cx0_phy.c static int
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-0+ tx_dcc_bypass, tx_term_ctrl); } + static int intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state
*crtc_state) {drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-1-struct intel_display *display =to_intel_display (crtc_state); struct intel_c20pll_state *pll_state = &crtc_state-dpll_hw_state.cx0pll.c20;
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0u64 datarate;u64 mpll_tx_clk_div;@@ -2176,7 +2223,6 @@ static int
intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)drivers/gpu/drm/i915/display/intel_cx0_phy.c static int
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-1u64 mpll_multiplier;u64 mpll_fracn_quot;u64 mpll_fracn_rem; -u16 tx_misc;u8 mpllb_ana_freq_vco;u8 mpll_div_multiplier;@@ -2196,11 +2242,6 @@ static int
intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)Quoted 29 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-0mpll_div_multiplier = min_t(u8, div64_u64((vco_freq * 16 +(datarate
Quoted 1 line
1)),
drivers/gpu/drm/i915/display/intel_cx0_phy.c +0
-5datarate), 255); -if (DISPLAY_VER (display) >=20 ) - tx_misc =0x5 ; -else - tx_misc =0x0 ; -if (vco_freq <=DATARATE_3000000000 ) mpllb_ana_freq_vco =MPLLB_ANA_FREQ_VCO_3 ; else if (vco_freq <= DATARATE_3500000000) @@ -2212,7 +2253,7 @@static int
intel_c20_compute_hdmi_tmds_pll(struct intel_crtc_state *crtc_state)drivers/gpu/drm/i915/display/intel_cx0_phy.c +1
-1pll_state->clock = crtc_state->port_clock; pll_state->tx[0 ] =0xbe88 ; - pll_state->tx[1 ] =0x9800 |C20_PHY_TX_MISC (tx_misc); + pll_state->tx[1 ] =intel_c20_hdmi_tmds_tx_cgf_1 (crtc_state); pll_state->tx[2 ] =0x0000 ; pll_state->cmn[0 ] =0x0500 ; pll_state->cmn[1 ] =0x0005 ;drivers/gpu/drm/i915/display/intel_cx0_phy.h +0
-0@@ -9,6 +9,17 @@
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +4
-0#include <linux/types.h> #include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/pci.h> + +#define HOST_BRIDGE_PCI_DEV_ID1 0x7D1C #define +HOST_BRIDGE_PCI_DEV_ID2 0x7D2D #define
HOST_BRIDGE_PCI_DEV_ID3Quoted 1 line
Quoted 1 line
0x7D2E
Does this define to be included in include/linux/pci_ids.h? is it good ?.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +6
-0+#define HOST_BRIDGE_PCI_DEV_ID4 0x7D2F #define +IS_HOST_BRIDGE_PCI_ID_TXX_MICS_3 (id) \ + (((id) ==HOST_BRIDGE_PCI_DEV_ID1 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID2 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID3 ) || \ + ((id) ==HOST_BRIDGE_PCI_DEV_ID4 ))
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
None of this belongs in cx0 PHY code.
Is
intel_display_reg_defs.his good place ?.No. There's nothing like this in there. And you shouldn't make all the macros be about "TXX MISC 3". Identify the platform in one place, in a generic way, and use that information in another.
Yes, updating it as the generic way.
Quoted 51 lines
Again, what if there's another part of the driver that needs the same identification? It would be really odd to call that "TXX MISC 3".
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.h +0
-0enum icl_port_dpll_id ;struct drm_i915_private ;drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0@@ -279,9 +279,22 @@ ((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_TX_CNTX_CFG :
_MTL_C20_A_TX_CNTX_CFG) - (idx)) #define
PHY_C20_B_TX_CNTX_CFG(i915, idx)\Quoted 4 lines
Quoted 4 lines
Quoted 1 line
((
_IS_XE2HPD_C20(i915)?_XE2HPD_C20_B_TX_CNTX_CFG:
_MTL_C20_B_TX_CNTX_CFG) - (idx))drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-2-#define C20_PHY_TX_RATE REG_GENMASK(2, 0) -#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7,0)
Quoted 4 lines
Quoted 4 lines
Quoted 1 line
-#define
C20_PHY_TX_MISC(val)REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val))drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_RATE REG_GENMASK(2, 0) +#define C20_PHY_TX_MISC_MASK REG_GENMASK16(7,0)
Quoted 24 lines
Quoted 24 lines
Quoted 1 line
+#define
C20_PHY_TX_MISC(val)REG_FIELD_PREP16(C20_PHY_TX_MISC_MASK, (val))Quoted 1 line
+#define
C20_PHY_TX_DCC_CAL_RANGE_MASKREG_GENMASK16(11,8)
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_DCC_CAL_RANGE (val) \ + REG_FIELD_PREP16(C20_PHY_TX_DCC_CAL_RANGE_MASK,(val))
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_DCC_BYPASS_SET REG_BIT(12) +#define C20_PHY_TX_DCC_BYPASS (val) (val ?
C20_PHY_TX_DCC_BYPASS_SET: 0)drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 2 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0+#define C20_PHY_TX_TERM_CTL_MASK REG_GENMASK16(15, 13) +#define C20_PHY_TX_TERM_CTL (val)REG_FIELD_PREP16(C20_PHY_TX_TERM_CTL_MASK, (val))Quoted 1 line
+#define PHY_C20_A_B_TX_CNTX_CFG_1(tx_misc,
tx_dcc_cal_dac_ctrl_range, \drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 3 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +3
-0+ tx_dcc_bypass, tx_term_ctrl) \ + (C20_PHY_TX_MISC(tx_misc) | \ + C20_PHY_TX_DCC_CAL_RANGE(tx_dcc_cal_dac_ctrl_range) |\drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0+ C20_PHY_TX_DCC_BYPASS(tx_dcc_bypass) |\drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 297
Quoted 1 line
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0+ C20_PHY_TX_TERM_CTL(tx_term_ctrl))Explain.
Quoted 8 lines
Quoted 4 lines
Yes,
tx[1] (SRAM_GENERIC_<A/B>_TX_CNTX_CFG_1) field is 16 bit field. Withtx_micsmapped to [0:7] bit ,txX_dcc_cal_dac_ctrl_range[8:11]txX_dcc_bypassis 12th bit andtxX_term_ctrlmapped to [13:15] bit.But we only describe the register bits and bitfields here. We don't add macros that group a lot of stuff together. You do that where the information is used.
Understood now, I will use this direct define wherever they are used.
Dnyaneshwar,
Quoted 54 lines
Pretty much imagine that the register macros could one day be automatically generated, and you'd only have the register fields here, nothing else.
BR,
Jani.Quoted 21 lines
I will add this explanation as well in commit message.
Quoted 13 lines
Quoted 4 lines
#define
PHY_C20_A_CMN_CNTX_CFG(i915, idx)\
((_IS_XE2HPD_C20(i915)?_XE2HPD_C20_A_CMN_CNTX_CFG:
Quoted 8 lines
_MTL_C20_A_CMN_CNTX_CFG) - (idx)) diff --gita/include/drm/intel/pciids.hb/include/drm/intel/pciids.hindex7632507af166..d88c58534148100644include/drm/intel/pciids.h +0
-0@@ -765,8 +765,12 @@ INTEL_ATS_M75_IDS(MACRO__, ## __VA_ARGS__)Quoted 6 lines
include/drm/intel/pciids.h
Quoted 4 lines
include/drm/intel/pciids.h +3
-0/* ARL */ + +#define ARL_TXX_MISC3_PLATFORM_ID 0x7D41 #define +MTL_TXX_MISC3_PLATFORM_ID 0x7D45No. Look around you. Do you see a single thing like this?
Quoted 24 lines
It will be removed as per comment #1.
Thank you jani for reviewing.
Dnyaneshwar,
Quoted 19 lines
Quoted 10 lines
include/drm/intel/pciids.h +2
-1+#define INTEL_ARL_IDS (MACRO__ , ...) \ - MACRO__(0x7D41, ## __VA_ARGS__), \ + MACRO__(ARL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D51, ## __VA_ARGS__), \ MACRO__(0x7D67, ## __VA_ARGS__), \ MACRO__(0x7DD1, ## __VA_ARGS__), \ @@ -775,7 +779,7 @@/* MTL */
#defineINTEL_MTL_IDS(MACRO__, ...)\include/drm/intel/pciids.h line 785
Quoted 6 lines
include/drm/intel/pciids.h +1
-1MACRO__(0x7D40, ## __VA_ARGS__), \ - MACRO__(0x7D45, ## __VA_ARGS__), \ + MACRO__(MTL_TXX_MISC3_PLATFORM_ID, ## __VA_ARGS__), \ MACRO__(0x7D55, ## __VA_ARGS__), \ MACRO__(0x7D60, ## __VA_ARGS__), \ MACRO__(0x7DD5, ## __VA_ARGS__)--
Jani Nikula, Intel--
Jani Nikula, Intel