From: Jani Nikula <jani.nikula@linux.intel.com>
To: Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
Matt Roper <matthew.d.roper@intel.com>,
Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com>,
Clint Taylor <Clinton.A.Taylor@intel.com>,
Gustavo Sousa <gustavo.sousa@intel.com>
Subject: Re: [PATCH v3 08/21] drm/i915/xe2hpd: Add new C20 PHY SRAM address
Date: Mon, 15 Apr 2024 18:32:41 +0300 [thread overview]
Message-ID: <87bk6a1w12.fsf@intel.com> (raw)
In-Reply-To: <20240415081423.495834-9-balasubramani.vivekanandan@intel.com>
On Mon, 15 Apr 2024, Balasubramani Vivekanandan <balasubramani.vivekanandan@intel.com> wrote:
> diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> index bdd0c8c4ef97..23a79e911972 100644
> --- a/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h
> @@ -254,24 +254,67 @@
> #define PHY_C20_VDR_CUSTOM_WIDTH 0xD02
> #define PHY_C20_CUSTOM_WIDTH_MASK REG_GENMASK(1, 0)
> #define PHY_C20_CUSTOM_WIDTH(val) REG_FIELD_PREP8(PHY_C20_CUSTOM_WIDTH_MASK, val)
> -#define PHY_C20_A_TX_CNTX_CFG(idx) (0xCF2E - (idx))
> -#define PHY_C20_B_TX_CNTX_CFG(idx) (0xCF2A - (idx))
The style absolutely everywhere is to define the values with prefix
underscore right above the macro that uses them. Please just look
around. Look at the big comment near the top of i915_reg.h.
No need for the _ADDR suffix.
Please also add a helper to choose which one to use instead of
duplicating absolutely everywhere.
Something like this:
#define _IS_XE2HPD_C20(i915) (DISPLAY_VER_FULL(i915) == IP_VER(14, 1))
#define _MTL_C20_A_TX_CNTX_CFG 0xcf2e
#define _XE2HPD_C20_A_TX_CNTX_CFG 0xcf5e
#define PHY_C20_A_TX_CNTX_CFG(i915, idx) \
((_IS_XE2HPD_C20(i915) ? _XE2HPD_C20_A_TX_CNTX_CFG : _MTL_C20_A_TX_CNTX_CFG) - (idx))
And that's enough wrapping, no need to split across four lines.
BR,
Jani.
> +
> +#define PHY_C20_A_TX_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_A_TX_CNTX_CFG_ADDR : MTL_C20_A_TX_CNTX_CFG_ADDR) - \
> + (idx))
> +#define PHY_C20_B_TX_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_B_TX_CNTX_CFG_ADDR : MTL_C20_B_TX_CNTX_CFG_ADDR) - \
> + (idx))
> #define C20_PHY_TX_RATE REG_GENMASK(2, 0)
> -#define PHY_C20_A_CMN_CNTX_CFG(idx) (0xCDAA - (idx))
> -#define PHY_C20_B_CMN_CNTX_CFG(idx) (0xCDA5 - (idx))
> -#define PHY_C20_A_MPLLA_CNTX_CFG(idx) (0xCCF0 - (idx))
> -#define PHY_C20_B_MPLLA_CNTX_CFG(idx) (0xCCE5 - (idx))
> +#define PHY_C20_A_CMN_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_A_CMN_CNTX_CFG_ADDR : MTL_C20_A_CMN_CNTX_CFG_ADDR) - \
> + (idx))
> +#define PHY_C20_B_CMN_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_B_CMN_CNTX_CFG_ADDR : MTL_C20_B_CMN_CNTX_CFG_ADDR) - \
> + (idx))
> +#define PHY_C20_A_MPLLA_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_A_MPLLA_CFG_ADDR : MTL_C20_A_MPLLA_CFG_ADDR) - \
> + (idx))
> +#define PHY_C20_B_MPLLA_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_B_MPLLA_CFG_ADDR : MTL_C20_B_MPLLA_CFG_ADDR) - \
> + (idx))
> #define C20_MPLLA_FRACEN REG_BIT(14)
> #define C20_FB_CLK_DIV4_EN REG_BIT(13)
> #define C20_MPLLA_TX_CLK_DIV_MASK REG_GENMASK(10, 8)
> -#define PHY_C20_A_MPLLB_CNTX_CFG(idx) (0xCB5A - (idx))
> -#define PHY_C20_B_MPLLB_CNTX_CFG(idx) (0xCB4E - (idx))
> +#define PHY_C20_A_MPLLB_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_A_MPLLB_CFG_ADDR : MTL_C20_A_MPLLB_CFG_ADDR) - \
> + (idx))
> +#define PHY_C20_B_MPLLB_CNTX_CFG(i915, idx) \
> + (((DISPLAY_VER_FULL(i915) == IP_VER(14, 1)) ? \
> + XE2HPD_C20_B_MPLLB_CFG_ADDR : MTL_C20_B_MPLLB_CFG_ADDR) - \
> + (idx))
> #define C20_MPLLB_TX_CLK_DIV_MASK REG_GENMASK(15, 13)
> #define C20_MPLLB_FRACEN REG_BIT(13)
> #define C20_REF_CLK_MPLLB_DIV_MASK REG_GENMASK(12, 10)
> #define C20_MULTIPLIER_MASK REG_GENMASK(11, 0)
> #define C20_PHY_USE_MPLLB REG_BIT(7)
>
> +#define MTL_C20_A_TX_CNTX_CFG_ADDR 0xCF2E
> +#define MTL_C20_B_TX_CNTX_CFG_ADDR 0xCF2A
> +#define MTL_C20_A_CMN_CNTX_CFG_ADDR 0xCDAA
> +#define MTL_C20_B_CMN_CNTX_CFG_ADDR 0xCDA5
> +#define MTL_C20_A_MPLLA_CFG_ADDR 0xCCF0
> +#define MTL_C20_B_MPLLA_CFG_ADDR 0xCCE5
> +#define MTL_C20_A_MPLLB_CFG_ADDR 0xCB5A
> +#define MTL_C20_B_MPLLB_CFG_ADDR 0xCB4E
> +
> +#define XE2HPD_C20_A_TX_CNTX_CFG_ADDR 0xCF5E
> +#define XE2HPD_C20_B_TX_CNTX_CFG_ADDR 0xCF5A
> +#define XE2HPD_C20_A_CMN_CNTX_CFG_ADDR 0xCE8E
> +#define XE2HPD_C20_B_CMN_CNTX_CFG_ADDR 0xCE89
> +#define XE2HPD_C20_A_MPLLA_CFG_ADDR 0xCE58
> +#define XE2HPD_C20_B_MPLLA_CFG_ADDR 0xCE4D
> +#define XE2HPD_C20_A_MPLLB_CFG_ADDR 0xCCC2
> +#define XE2HPD_C20_B_MPLLB_CFG_ADDR 0xCCB6
> +
> /* C20 Phy VSwing Masks */
> #define C20_PHY_VSWING_PREEMPH_MASK REG_GENMASK8(5, 0)
> #define C20_PHY_VSWING_PREEMPH(val) REG_FIELD_PREP8(C20_PHY_VSWING_PREEMPH_MASK, val)
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-04-15 15:32 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 8:14 [PATCH v3 00/21] Enable display support for Battlemage Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 01/21] drm/xe/display: Lane reversal requires writes to both context lanes Balasubramani Vivekanandan
2024-04-15 15:05 ` Matt Roper
2024-04-15 8:14 ` [PATCH v3 02/21] drm/i915/display: Enable RM timeout detection Balasubramani Vivekanandan
2024-04-15 15:49 ` Matt Roper
2024-04-15 8:14 ` [PATCH v3 03/21] drm/i915/bmg: Define IS_BATTLEMAGE macro Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 04/21] drm/i915/xe2hpd: Skip CCS modifiers Balasubramani Vivekanandan
2024-04-15 16:06 ` Matt Roper
2024-04-16 11:15 ` Juha-Pekka Heikkila
2024-04-15 8:14 ` [PATCH v3 05/21] drm/i915/xe2hpd: Initial cdclk table Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 06/21] drm/i915/bmg: Extend DG2 tc check to future Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 07/21] drm/i915/xe2hpd: Properly disable power in port A Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 08/21] drm/i915/xe2hpd: Add new C20 PHY SRAM address Balasubramani Vivekanandan
2024-04-15 15:32 ` Jani Nikula [this message]
2024-04-15 8:14 ` [PATCH v3 09/21] drm/i915/xe2hpd: Add support for eDP PLL configuration Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 10/21] drm/i915/xe2hpd: update pll values in sync with Bspec Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 11/21] drm/i915/xe2hpd: Add display info Balasubramani Vivekanandan
2024-04-15 16:22 ` Matt Roper
2024-04-15 8:14 ` [PATCH v3 12/21] drm/i915/xe2hpd: Configure CHICKEN_MISC_2 before enabling planes Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 13/21] drm/i915/xe2hpd: Add max memory bandwidth algorithm Balasubramani Vivekanandan
2024-04-15 19:52 ` Sripada, Radhakrishna
2024-04-15 8:14 ` [PATCH v3 14/21] drm/i915/xe2hpd: Do not program MBUS_DBOX BW credits Balasubramani Vivekanandan
2024-04-15 16:25 ` Matt Roper
2024-04-15 8:14 ` [PATCH v3 15/21] drm/i915/bmg: BMG should re-use MTL's south display logic Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 16/21] Revert "drm/i915/dgfx: DGFX uses direct VBT pin mapping" Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 17/21] drm/i915/xe2hpd: Set maximum DP rate to UHBR13.5 Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 18/21] drm/xe/gt_print: add xe_gt_err_once() Balasubramani Vivekanandan
2024-04-15 8:14 ` [PATCH v3 19/21] drm/xe/device: implement transient flush Balasubramani Vivekanandan
2024-04-15 17:00 ` Matt Roper
2024-04-15 8:14 ` [PATCH v3 20/21] drm/i915/display: perform " Balasubramani Vivekanandan
2024-04-15 17:07 ` Matt Roper
2024-04-15 18:14 ` Matt Roper
2024-04-16 7:40 ` Matthew Auld
2024-04-15 20:55 ` Nirmoy Das
2024-04-15 8:14 ` [PATCH v3 21/21] drm/xe/bmg: Enable the display support Balasubramani Vivekanandan
2024-04-15 20:58 ` ✗ Fi.CI.CHECKPATCH: warning for Enable display support for Battlemage Patchwork
2024-04-15 20:58 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-04-15 21:14 ` ✓ Fi.CI.BAT: success " Patchwork
2024-04-16 8:31 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bk6a1w12.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=Clinton.A.Taylor@intel.com \
--cc=balasubramani.vivekanandan@intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.d.roper@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox