Skip to content

Commit cf70d62

Browse files
vsyrjalagregkh
authored andcommitted
drm/i915/lvds: Use REG_BIT() & co.
[ Upstream commit 9dd56e9 ] Use REG_BIT() & co. for the LVDS port register. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230130180540.8972-4-ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula <jani.nikula@intel.com> Stable-dep-of: 20c2dbf ("drm/i915: Skip some timing checks on BXT/GLK DSI transcoders") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e6d55cf commit cf70d62

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

drivers/gpu/drm/i915/display/intel_lvds.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ bool intel_lvds_port_enabled(struct drm_i915_private *dev_priv,
9292

9393
/* asserts want to know the pipe even if the port is disabled */
9494
if (HAS_PCH_CPT(dev_priv))
95-
*pipe = (val & LVDS_PIPE_SEL_MASK_CPT) >> LVDS_PIPE_SEL_SHIFT_CPT;
95+
*pipe = REG_FIELD_GET(LVDS_PIPE_SEL_MASK_CPT, val);
9696
else
97-
*pipe = (val & LVDS_PIPE_SEL_MASK) >> LVDS_PIPE_SEL_SHIFT;
97+
*pipe = REG_FIELD_GET(LVDS_PIPE_SEL_MASK, val);
9898

9999
return val & LVDS_PORT_EN;
100100
}

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,52 +2681,50 @@
26812681
* Enables the LVDS port. This bit must be set before DPLLs are enabled, as
26822682
* the DPLL semantics change when the LVDS is assigned to that pipe.
26832683
*/
2684-
#define LVDS_PORT_EN (1 << 31)
2684+
#define LVDS_PORT_EN REG_BIT(31)
26852685
/* Selects pipe B for LVDS data. Must be set on pre-965. */
2686-
#define LVDS_PIPE_SEL_SHIFT 30
2687-
#define LVDS_PIPE_SEL_MASK (1 << 30)
2688-
#define LVDS_PIPE_SEL(pipe) ((pipe) << 30)
2689-
#define LVDS_PIPE_SEL_SHIFT_CPT 29
2690-
#define LVDS_PIPE_SEL_MASK_CPT (3 << 29)
2691-
#define LVDS_PIPE_SEL_CPT(pipe) ((pipe) << 29)
2686+
#define LVDS_PIPE_SEL_MASK REG_BIT(30)
2687+
#define LVDS_PIPE_SEL(pipe) REG_FIELD_PREP(LVDS_PIPE_SEL_MASK, (pipe))
2688+
#define LVDS_PIPE_SEL_MASK_CPT REG_GENMASK(30, 29)
2689+
#define LVDS_PIPE_SEL_CPT(pipe) REG_FIELD_PREP(LVDS_PIPE_SEL_MASK_CPT, (pipe))
26922690
/* LVDS dithering flag on 965/g4x platform */
2693-
#define LVDS_ENABLE_DITHER (1 << 25)
2691+
#define LVDS_ENABLE_DITHER REG_BIT(25)
26942692
/* LVDS sync polarity flags. Set to invert (i.e. negative) */
2695-
#define LVDS_VSYNC_POLARITY (1 << 21)
2696-
#define LVDS_HSYNC_POLARITY (1 << 20)
2693+
#define LVDS_VSYNC_POLARITY REG_BIT(21)
2694+
#define LVDS_HSYNC_POLARITY REG_BIT(20)
26972695

26982696
/* Enable border for unscaled (or aspect-scaled) display */
2699-
#define LVDS_BORDER_ENABLE (1 << 15)
2697+
#define LVDS_BORDER_ENABLE REG_BIT(15)
27002698
/*
27012699
* Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
27022700
* pixel.
27032701
*/
2704-
#define LVDS_A0A2_CLKA_POWER_MASK (3 << 8)
2705-
#define LVDS_A0A2_CLKA_POWER_DOWN (0 << 8)
2706-
#define LVDS_A0A2_CLKA_POWER_UP (3 << 8)
2702+
#define LVDS_A0A2_CLKA_POWER_MASK REG_GENMASK(9, 8)
2703+
#define LVDS_A0A2_CLKA_POWER_DOWN REG_FIELD_PREP(LVDS_A0A2_CLKA_POWER_MASK, 0)
2704+
#define LVDS_A0A2_CLKA_POWER_UP REG_FIELD_PREP(LVDS_A0A2_CLKA_POWER_MASK, 3)
27072705
/*
27082706
* Controls the A3 data pair, which contains the additional LSBs for 24 bit
27092707
* mode. Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
27102708
* on.
27112709
*/
2712-
#define LVDS_A3_POWER_MASK (3 << 6)
2713-
#define LVDS_A3_POWER_DOWN (0 << 6)
2714-
#define LVDS_A3_POWER_UP (3 << 6)
2710+
#define LVDS_A3_POWER_MASK REG_GENMASK(7, 6)
2711+
#define LVDS_A3_POWER_DOWN REG_FIELD_PREP(LVDS_A3_POWER_MASK, 0)
2712+
#define LVDS_A3_POWER_UP REG_FIELD_PREP(LVDS_A3_POWER_MASK, 3)
27152713
/*
27162714
* Controls the CLKB pair. This should only be set when LVDS_B0B3_POWER_UP
27172715
* is set.
27182716
*/
2719-
#define LVDS_CLKB_POWER_MASK (3 << 4)
2720-
#define LVDS_CLKB_POWER_DOWN (0 << 4)
2721-
#define LVDS_CLKB_POWER_UP (3 << 4)
2717+
#define LVDS_CLKB_POWER_MASK REG_GENMASK(5, 4)
2718+
#define LVDS_CLKB_POWER_DOWN REG_FIELD_PREP(LVDS_CLKB_POWER_MASK, 0)
2719+
#define LVDS_CLKB_POWER_UP REG_FIELD_PREP(LVDS_CLKB_POWER_MASK, 3)
27222720
/*
27232721
* Controls the B0-B3 data pairs. This must be set to match the DPLL p2
27242722
* setting for whether we are in dual-channel mode. The B3 pair will
27252723
* additionally only be powered up when LVDS_A3_POWER_UP is set.
27262724
*/
2727-
#define LVDS_B0B3_POWER_MASK (3 << 2)
2728-
#define LVDS_B0B3_POWER_DOWN (0 << 2)
2729-
#define LVDS_B0B3_POWER_UP (3 << 2)
2725+
#define LVDS_B0B3_POWER_MASK REG_GENMASK(3, 2)
2726+
#define LVDS_B0B3_POWER_DOWN REG_FIELD_PREP(LVDS_B0B3_POWER_MASK, 0)
2727+
#define LVDS_B0B3_POWER_UP REG_FIELD_PREP(LVDS_B0B3_POWER_MASK, 3)
27302728

27312729
/* Video Data Island Packet control */
27322730
#define VIDEO_DIP_DATA _MMIO(0x61178)
@@ -6461,7 +6459,7 @@
64616459
#define FDI_PLL_CTL_2 _MMIO(0xfe004)
64626460

64636461
#define PCH_LVDS _MMIO(0xe1180)
6464-
#define LVDS_DETECTED (1 << 1)
6462+
#define LVDS_DETECTED REG_BIT(1)
64656463

64666464
#define _PCH_DP_B 0xe4100
64676465
#define PCH_DP_B _MMIO(_PCH_DP_B)

0 commit comments

Comments
 (0)