From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 2/4] drm/i915: add vlv_pipe_to_phy() helper to replace DPIO_PHY()
Date: Tue, 14 Nov 2023 11:04:54 +0200 [thread overview]
Message-ID: <ZVM4Nsm3mdhi5L1J@intel.com> (raw)
In-Reply-To: <20231113164711.4100548-2-jani.nikula@intel.com>
On Mon, Nov 13, 2023 at 06:47:09PM +0200, Jani Nikula wrote:
> Add a helper with better typing and handing for bogus input, and better
> in line with vlv_dig_port_to_channel(), vlv_dig_port_to_phy(), and
> vlv_pipe_to_channel().
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_dpio_phy.c | 14 ++++++++++++++
> drivers/gpu/drm/i915/display/intel_dpio_phy.h | 5 +++++
> drivers/gpu/drm/i915/display/intel_pps.c | 2 +-
> drivers/gpu/drm/i915/i915_reg.h | 2 --
> drivers/gpu/drm/i915/vlv_sideband.c | 6 ++++--
> 5 files changed, 24 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_dpio_phy.c b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
> index 62b93d097e44..d6af46e33424 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpio_phy.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpio_phy.c
> @@ -666,6 +666,20 @@ enum dpio_phy vlv_dig_port_to_phy(struct intel_digital_port *dig_port)
> }
> }
>
> +enum dpio_phy vlv_pipe_to_phy(enum pipe pipe)
> +{
> + switch (pipe) {
> + default:
> + MISSING_CASE(pipe);
> + fallthrough;
> + case PIPE_A:
> + case PIPE_B:
> + return DPIO_PHY0;
> + case PIPE_C:
> + return DPIO_PHY1;
> + }
> +}
> +
> enum dpio_channel vlv_pipe_to_channel(enum pipe pipe)
> {
> switch (pipe) {
> diff --git a/drivers/gpu/drm/i915/display/intel_dpio_phy.h b/drivers/gpu/drm/i915/display/intel_dpio_phy.h
> index 4d43dbbdf81c..9adc4e8c1738 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpio_phy.h
> +++ b/drivers/gpu/drm/i915/display/intel_dpio_phy.h
> @@ -44,6 +44,7 @@ u8 bxt_ddi_phy_get_lane_lat_optim_mask(struct intel_encoder *encoder);
>
> enum dpio_channel vlv_dig_port_to_channel(struct intel_digital_port *dig_port);
> enum dpio_phy vlv_dig_port_to_phy(struct intel_digital_port *dig_port);
> +enum dpio_phy vlv_pipe_to_phy(enum pipe pipe);
> enum dpio_channel vlv_pipe_to_channel(enum pipe pipe);
>
> void chv_set_phy_signal_level(struct intel_encoder *encoder,
> @@ -116,6 +117,10 @@ static inline enum dpio_phy vlv_dig_port_to_phy(struct intel_digital_port *dig_p
> {
> return DPIO_PHY0;
> }
> +static inline enum dpio_phy vlv_pipe_to_phy(enum pipe pipe)
> +{
> + return DPIO_PHY0;
> +}
> static inline enum dpio_channel vlv_pipe_to_channel(enum pipe pipe)
> {
> return DPIO_CH0;
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
> index 73f0f1714b37..a8fa3a20990e 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -90,7 +90,7 @@ vlv_power_sequencer_kick(struct intel_dp *intel_dp)
> struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
> enum pipe pipe = intel_dp->pps.pps_pipe;
> bool pll_enabled, release_cl_override = false;
> - enum dpio_phy phy = DPIO_PHY(pipe);
> + enum dpio_phy phy = vlv_pipe_to_phy(pipe);
> enum dpio_channel ch = vlv_pipe_to_channel(pipe);
> u32 DP;
>
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index 135e8d8dbdf0..27dc903f0553 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -195,8 +195,6 @@
> #define DPIO_SFR_BYPASS (1 << 1)
> #define DPIO_CMNRST (1 << 0)
>
> -#define DPIO_PHY(pipe) ((pipe) >> 1)
> -
> /*
> * Per pipe/PLL DPIO regs
> */
> diff --git a/drivers/gpu/drm/i915/vlv_sideband.c b/drivers/gpu/drm/i915/vlv_sideband.c
> index b98dec3ad817..f7df55217845 100644
> --- a/drivers/gpu/drm/i915/vlv_sideband.c
> +++ b/drivers/gpu/drm/i915/vlv_sideband.c
> @@ -229,7 +229,8 @@ static u32 vlv_dpio_phy_iosf_port(struct drm_i915_private *i915, enum dpio_phy p
>
> u32 vlv_dpio_read(struct drm_i915_private *i915, enum pipe pipe, int reg)
> {
> - u32 port = vlv_dpio_phy_iosf_port(i915, DPIO_PHY(pipe));
> + enum dpio_phy phy = vlv_pipe_to_phy(pipe);
> + u32 port = vlv_dpio_phy_iosf_port(i915, phy);
> u32 val = 0;
>
> vlv_sideband_rw(i915, DPIO_DEVFN, port, SB_MRD_NP, reg, &val);
> @@ -248,7 +249,8 @@ u32 vlv_dpio_read(struct drm_i915_private *i915, enum pipe pipe, int reg)
> void vlv_dpio_write(struct drm_i915_private *i915,
> enum pipe pipe, int reg, u32 val)
> {
> - u32 port = vlv_dpio_phy_iosf_port(i915, DPIO_PHY(pipe));
> + enum dpio_phy phy = vlv_pipe_to_phy(pipe);
> + u32 port = vlv_dpio_phy_iosf_port(i915, phy);
>
> vlv_sideband_rw(i915, DPIO_DEVFN, port, SB_MWR_NP, reg, &val);
> }
> --
> 2.39.2
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2023-11-14 9:05 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 16:47 [Intel-gfx] [PATCH 1/4] drm/i915: move *_crtc_clock_get() to intel_dpll.c Jani Nikula
2023-11-13 16:47 ` [Intel-gfx] [PATCH 2/4] drm/i915: add vlv_pipe_to_phy() helper to replace DPIO_PHY() Jani Nikula
2023-11-14 9:04 ` Ville Syrjälä [this message]
2023-11-13 16:47 ` [Intel-gfx] [PATCH 3/4] drm/i915: convert vlv_dpio_read()/write() from pipe to phy Jani Nikula
2023-11-14 9:13 ` Ville Syrjälä
2023-11-14 10:26 ` Jani Nikula
2023-11-13 16:47 ` [Intel-gfx] [PATCH 4/4] drm/i915: move sideband regs to vlv_sideband_reg.h Jani Nikula
2023-11-14 9:19 ` Ville Syrjälä
2023-11-14 10:29 ` Jani Nikula
2023-11-13 21:57 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915: move *_crtc_clock_get() to intel_dpll.c Patchwork
2023-11-13 21:57 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-11-13 22:16 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " Patchwork
2023-11-14 9:02 ` [Intel-gfx] [PATCH 1/4] " Ville Syrjälä
2023-11-14 15:35 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915: move *_crtc_clock_get() to intel_dpll.c (rev2) Patchwork
2023-11-14 15:35 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-11-14 15:54 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-11-16 0:15 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " 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=ZVM4Nsm3mdhi5L1J@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.