Commit 9ccd24e9 authored by Aditya Swarup's avatar Aditya Swarup Committed by Lucas De Marchi

drm/i915/display: allow to skip certain power wells

This allows us to skip power wells on a platform allowing it to re-use
the table from another one instead of having to create a new table from
scratch that is basically a copy with a few removals.

Cc: Imre Deak <imre.deak@intel.com>
Suggested-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarAditya Swarup <aditya.swarup@intel.com>
[ Adapt ignore logic to be based on pw id rather than adding a new
  field, as suggested by Imre ]
Signed-off-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201014191937.1266226-1-lucas.demarchi@intel.com
parent 24ea098b
...@@ -4554,13 +4554,18 @@ static u32 get_allowed_dc_mask(const struct drm_i915_private *dev_priv, ...@@ -4554,13 +4554,18 @@ static u32 get_allowed_dc_mask(const struct drm_i915_private *dev_priv,
static int static int
__set_power_wells(struct i915_power_domains *power_domains, __set_power_wells(struct i915_power_domains *power_domains,
const struct i915_power_well_desc *power_well_descs, const struct i915_power_well_desc *power_well_descs,
int power_well_count) int power_well_descs_sz, u64 skip_mask)
{ {
struct drm_i915_private *i915 = container_of(power_domains, struct drm_i915_private *i915 = container_of(power_domains,
struct drm_i915_private, struct drm_i915_private,
power_domains); power_domains);
u64 power_well_ids = 0; u64 power_well_ids = 0;
int i; int power_well_count = 0;
int i, plt_idx = 0;
for (i = 0; i < power_well_descs_sz; i++)
if (!(BIT_ULL(power_well_descs[i].id) & skip_mask))
power_well_count++;
power_domains->power_well_count = power_well_count; power_domains->power_well_count = power_well_count;
power_domains->power_wells = power_domains->power_wells =
...@@ -4570,10 +4575,14 @@ __set_power_wells(struct i915_power_domains *power_domains, ...@@ -4570,10 +4575,14 @@ __set_power_wells(struct i915_power_domains *power_domains,
if (!power_domains->power_wells) if (!power_domains->power_wells)
return -ENOMEM; return -ENOMEM;
for (i = 0; i < power_well_count; i++) { for (i = 0; i < power_well_descs_sz; i++) {
enum i915_power_well_id id = power_well_descs[i].id; enum i915_power_well_id id = power_well_descs[i].id;
power_domains->power_wells[i].desc = &power_well_descs[i]; if (BIT_ULL(id) & skip_mask)
continue;
power_domains->power_wells[plt_idx++].desc =
&power_well_descs[i];
if (id == DISP_PW_ID_NONE) if (id == DISP_PW_ID_NONE)
continue; continue;
...@@ -4586,9 +4595,12 @@ __set_power_wells(struct i915_power_domains *power_domains, ...@@ -4586,9 +4595,12 @@ __set_power_wells(struct i915_power_domains *power_domains,
return 0; return 0;
} }
#define set_power_wells(power_domains, __power_well_descs) \ #define set_power_wells_mask(power_domains, __power_well_descs, skip_mask) \
__set_power_wells(power_domains, __power_well_descs, \ __set_power_wells(power_domains, __power_well_descs, \
ARRAY_SIZE(__power_well_descs)) ARRAY_SIZE(__power_well_descs), skip_mask)
#define set_power_wells(power_domains, __power_well_descs) \
set_power_wells_mask(power_domains, __power_well_descs, 0)
/** /**
* intel_power_domains_init - initializes the power domain structures * intel_power_domains_init - initializes the power domain structures
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment