Skip to content

Commit

Permalink
drm/i915/quirks: abstract quirks further by making quirk ids an enum
Browse files Browse the repository at this point in the history
Turn the quirk ids to enums instead of bits, and hide the masking inside
intel_quirks.c. Define the enums in intel_quirks.h to declutter
i915_drv.h while at it.

Signed-off-by: Jani Nikula <[email protected]>
Reviewed-by: Lucas De Marchi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/60d8a20e1f8845b0bef53c2e32d524be888e426d.1661779055.git.jani.nikula@intel.com
  • Loading branch information
jnikula committed Aug 31, 2022
1 parent 0c82118 commit deb1415
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 16 deletions.
21 changes: 13 additions & 8 deletions drivers/gpu/drm/i915/display/intel_quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@
#include "intel_display_types.h"
#include "intel_quirks.h"

static void intel_set_quirk(struct drm_i915_private *i915, enum intel_quirk_id quirk)
{
i915->quirks |= BIT(quirk);
}

/*
* Some machines (Lenovo U160) do not work with SSC on LVDS for some reason
*/
static void quirk_ssc_force_disable(struct drm_i915_private *i915)
{
i915->quirks |= QUIRK_LVDS_SSC_DISABLE;
intel_set_quirk(i915, QUIRK_LVDS_SSC_DISABLE);
drm_info(&i915->drm, "applying lvds SSC disable quirk\n");
}

Expand All @@ -24,14 +29,14 @@ static void quirk_ssc_force_disable(struct drm_i915_private *i915)
*/
static void quirk_invert_brightness(struct drm_i915_private *i915)
{
i915->quirks |= QUIRK_INVERT_BRIGHTNESS;
intel_set_quirk(i915, QUIRK_INVERT_BRIGHTNESS);
drm_info(&i915->drm, "applying inverted panel brightness quirk\n");
}

/* Some VBT's incorrectly indicate no backlight is present */
static void quirk_backlight_present(struct drm_i915_private *i915)
{
i915->quirks |= QUIRK_BACKLIGHT_PRESENT;
intel_set_quirk(i915, QUIRK_BACKLIGHT_PRESENT);
drm_info(&i915->drm, "applying backlight present quirk\n");
}

Expand All @@ -40,7 +45,7 @@ static void quirk_backlight_present(struct drm_i915_private *i915)
*/
static void quirk_increase_t12_delay(struct drm_i915_private *i915)
{
i915->quirks |= QUIRK_INCREASE_T12_DELAY;
intel_set_quirk(i915, QUIRK_INCREASE_T12_DELAY);
drm_info(&i915->drm, "Applying T12 delay quirk\n");
}

Expand All @@ -50,13 +55,13 @@ static void quirk_increase_t12_delay(struct drm_i915_private *i915)
*/
static void quirk_increase_ddi_disabled_time(struct drm_i915_private *i915)
{
i915->quirks |= QUIRK_INCREASE_DDI_DISABLED_TIME;
intel_set_quirk(i915, QUIRK_INCREASE_DDI_DISABLED_TIME);
drm_info(&i915->drm, "Applying Increase DDI Disabled quirk\n");
}

static void quirk_no_pps_backlight_power_hook(struct drm_i915_private *i915)
{
i915->quirks |= QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK;
intel_set_quirk(i915, QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK);
drm_info(&i915->drm, "Applying no pps backlight power quirk\n");
}

Expand Down Expand Up @@ -217,7 +222,7 @@ void intel_init_quirks(struct drm_i915_private *i915)
}
}

bool intel_has_quirk(struct drm_i915_private *i915, unsigned long quirk)
bool intel_has_quirk(struct drm_i915_private *i915, enum intel_quirk_id quirk)
{
return i915->quirks & quirk;
return i915->quirks & BIT(quirk);
}
11 changes: 10 additions & 1 deletion drivers/gpu/drm/i915/display/intel_quirks.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@

struct drm_i915_private;

enum intel_quirk_id {
QUIRK_BACKLIGHT_PRESENT,
QUIRK_INCREASE_DDI_DISABLED_TIME,
QUIRK_INCREASE_T12_DELAY,
QUIRK_INVERT_BRIGHTNESS,
QUIRK_LVDS_SSC_DISABLE,
QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK,
};

void intel_init_quirks(struct drm_i915_private *i915);
bool intel_has_quirk(struct drm_i915_private *i915, unsigned long quirk);
bool intel_has_quirk(struct drm_i915_private *i915, enum intel_quirk_id quirk);

#endif /* __INTEL_QUIRKS_H__ */
7 changes: 0 additions & 7 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ struct vlv_s0ix_state;

#define GEM_QUIRK_PIN_SWIZZLED_PAGES BIT(0)

#define QUIRK_LVDS_SSC_DISABLE (1<<1)
#define QUIRK_INVERT_BRIGHTNESS (1<<2)
#define QUIRK_BACKLIGHT_PRESENT (1<<3)
#define QUIRK_INCREASE_T12_DELAY (1<<6)
#define QUIRK_INCREASE_DDI_DISABLED_TIME (1<<7)
#define QUIRK_NO_PPS_BACKLIGHT_POWER_HOOK (1<<8)

struct i915_suspend_saved_registers {
u32 saveDSPARB;
u32 saveSWF0[16];
Expand Down

0 comments on commit deb1415

Please sign in to comment.