drm/i915: Move {pin, long}_mask initialization to caller from intel_get_hpd_pins()
Move the 0 initialization of pin_mask and long_mask from intel_get_hpd_pins() into each caller. This we we can call intel_get_hpd_pins() multiple times to accumulate more pins from several sources. v2: Add a comment explaining the dangers of intel_get_hpd_pins() (Paulo) Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
195baa0673
commit
42db67d664
|
@ -1292,7 +1292,13 @@ static bool i9xx_port_hotplug_long_detect(enum port port, u32 val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a bit mask of pins that have triggered, and which ones may be long. */
|
/*
|
||||||
|
* Get a bit mask of pins that have triggered, and which ones may be long.
|
||||||
|
* This can be called multiple times with the same masks to accumulate
|
||||||
|
* hotplug detection results from several registers.
|
||||||
|
*
|
||||||
|
* Note that the caller is expected to zero out the masks initially.
|
||||||
|
*/
|
||||||
static void intel_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
|
static void intel_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
|
||||||
u32 hotplug_trigger, u32 dig_hotplug_reg,
|
u32 hotplug_trigger, u32 dig_hotplug_reg,
|
||||||
const u32 hpd[HPD_NUM_PINS],
|
const u32 hpd[HPD_NUM_PINS],
|
||||||
|
@ -1301,9 +1307,6 @@ static void intel_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
|
||||||
enum port port;
|
enum port port;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*pin_mask = 0;
|
|
||||||
*long_mask = 0;
|
|
||||||
|
|
||||||
for_each_hpd_pin(i) {
|
for_each_hpd_pin(i) {
|
||||||
if ((hpd[i] & hotplug_trigger) == 0)
|
if ((hpd[i] & hotplug_trigger) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1544,7 +1547,7 @@ static void i9xx_hpd_irq_handler(struct drm_device *dev)
|
||||||
{
|
{
|
||||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||||
u32 hotplug_status = I915_READ(PORT_HOTPLUG_STAT);
|
u32 hotplug_status = I915_READ(PORT_HOTPLUG_STAT);
|
||||||
u32 pin_mask, long_mask;
|
u32 pin_mask = 0, long_mask = 0;
|
||||||
|
|
||||||
if (!hotplug_status)
|
if (!hotplug_status)
|
||||||
return;
|
return;
|
||||||
|
@ -1673,7 +1676,7 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)
|
||||||
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
|
u32 hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK;
|
||||||
|
|
||||||
if (hotplug_trigger) {
|
if (hotplug_trigger) {
|
||||||
u32 dig_hotplug_reg, pin_mask, long_mask;
|
u32 dig_hotplug_reg, pin_mask = 0, long_mask = 0;
|
||||||
|
|
||||||
dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
|
dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
|
||||||
I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
|
I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
|
||||||
|
@ -1781,7 +1784,7 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)
|
||||||
hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
|
hotplug_trigger = pch_iir & SDE_HOTPLUG_MASK_CPT;
|
||||||
|
|
||||||
if (hotplug_trigger) {
|
if (hotplug_trigger) {
|
||||||
u32 dig_hotplug_reg, pin_mask, long_mask;
|
u32 dig_hotplug_reg, pin_mask = 0, long_mask = 0;
|
||||||
|
|
||||||
dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
|
dig_hotplug_reg = I915_READ(PCH_PORT_HOTPLUG);
|
||||||
I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
|
I915_WRITE(PCH_PORT_HOTPLUG, dig_hotplug_reg);
|
||||||
|
@ -2004,7 +2007,7 @@ static void bxt_hpd_handler(struct drm_device *dev, uint32_t iir_status)
|
||||||
{
|
{
|
||||||
struct drm_i915_private *dev_priv = dev->dev_private;
|
struct drm_i915_private *dev_priv = dev->dev_private;
|
||||||
u32 hp_control, hp_trigger;
|
u32 hp_control, hp_trigger;
|
||||||
u32 pin_mask, long_mask;
|
u32 pin_mask = 0, long_mask = 0;
|
||||||
|
|
||||||
/* Get the status */
|
/* Get the status */
|
||||||
hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
|
hp_trigger = iir_status & BXT_DE_PORT_HOTPLUG_MASK;
|
||||||
|
|
Loading…
Reference in New Issue