mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-08 12:52:40 -04:00
drm/i915/display: add platform member to struct intel_display
Facilitate using display->platform.haswell and display->platform.haswell_ult etc. for identifying platforms and subplatforms. Merge the platform and subplatform bitmaps together, and check that there's no overlap. v4: - Lower case, s/is/platform/ v3: - Fix sanity check on display->is after merging subplatform members v2: - Use bitmap ops - Add some sanity checks with warnings Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/2ae79637390372903a9808b5adc4d2dcf2c5959b.1730144869.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
@@ -284,6 +284,9 @@ struct intel_display {
|
||||
/* drm device backpointer */
|
||||
struct drm_device *drm;
|
||||
|
||||
/* Platform (and subplatform, if any) identification */
|
||||
struct intel_display_platforms platform;
|
||||
|
||||
/* Display functions */
|
||||
struct {
|
||||
/* Top level crtc-ish functions */
|
||||
|
||||
@@ -1526,6 +1526,25 @@ static enum intel_step get_pre_gmdid_step(struct intel_display *display,
|
||||
return step;
|
||||
}
|
||||
|
||||
/* Size of the entire bitmap, not the number of platforms */
|
||||
static unsigned int display_platforms_num_bits(void)
|
||||
{
|
||||
return sizeof(((struct intel_display_platforms *)0)->bitmap) * BITS_PER_BYTE;
|
||||
}
|
||||
|
||||
/* Number of platform bits set */
|
||||
static unsigned int display_platforms_weight(const struct intel_display_platforms *p)
|
||||
{
|
||||
return bitmap_weight(p->bitmap, display_platforms_num_bits());
|
||||
}
|
||||
|
||||
/* Merge the subplatform information from src to dst */
|
||||
static void display_platforms_or(struct intel_display_platforms *dst,
|
||||
const struct intel_display_platforms *src)
|
||||
{
|
||||
bitmap_or(dst->bitmap, dst->bitmap, src->bitmap, display_platforms_num_bits());
|
||||
}
|
||||
|
||||
void intel_display_device_probe(struct drm_i915_private *i915)
|
||||
{
|
||||
struct intel_display *display = &i915->display;
|
||||
@@ -1565,13 +1584,25 @@ void intel_display_device_probe(struct drm_i915_private *i915)
|
||||
&DISPLAY_INFO(i915)->__runtime_defaults,
|
||||
sizeof(*DISPLAY_RUNTIME_INFO(i915)));
|
||||
|
||||
drm_WARN_ON(&i915->drm, !desc->platform || !desc->name);
|
||||
drm_WARN_ON(&i915->drm, !desc->platform || !desc->name ||
|
||||
!display_platforms_weight(&desc->platforms));
|
||||
DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
|
||||
|
||||
display->platform = desc->platforms;
|
||||
|
||||
subdesc = find_subplatform_desc(pdev, desc);
|
||||
if (subdesc) {
|
||||
drm_WARN_ON(&i915->drm, !subdesc->subplatform || !subdesc->name);
|
||||
drm_WARN_ON(&i915->drm, !subdesc->subplatform || !subdesc->name ||
|
||||
!display_platforms_weight(&subdesc->platforms));
|
||||
DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
|
||||
|
||||
display_platforms_or(&display->platform, &subdesc->platforms);
|
||||
|
||||
/* Ensure platform and subplatform are distinct */
|
||||
drm_WARN_ON(&i915->drm,
|
||||
display_platforms_weight(&display->platform) !=
|
||||
display_platforms_weight(&desc->platforms) +
|
||||
display_platforms_weight(&subdesc->platforms));
|
||||
}
|
||||
|
||||
if (ip_ver.ver || ip_ver.rel || ip_ver.step) {
|
||||
|
||||
Reference in New Issue
Block a user