drm/i915: opregion cleanup
Subsystems (2)
PATCH 3/3 drm/i915: drop code duplication in favor of asle interrupt handler
In reply to Jani NikulaWith the previous work asle and gse interrupt handlers should now be functionally the same. Drop the duplicated code.
--- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_irq.c | 4 ++-- drivers/gpu/drm/i915/intel_opregion.c | 37 --------------------------------- 3 files changed, 2 insertions(+), 40 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -1
@@ -1810,7 +1810,6 @@ extern int intel_opregion_setup(struct drm_device *dev);extern void intel_opregion_init (struct drm_device *dev);extern void intel_opregion_fini (struct drm_device *dev);extern void intel_opregion_asle_intr (struct drm_device *dev); -extern void intel_opregion_gse_intr (struct drm_device *dev);extern void intel_opregion_enable_asle (struct drm_device *dev);#else static inline void intel_opregion_init (struct drm_device *dev) {return ; }
drivers/gpu/drm/i915/i915_irq.c +2 -2
@@ -792,7 +792,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE_IVB ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);for (i =0 ; i <3 ; i++) {if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i)))
@@ -886,7 +886,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);if (de_iir &DE_PIPEA_VBLANK )drm_handle_vblank (dev,0 );
drivers/gpu/drm/i915/intel_opregion.c +0 -37
@@ -224,43 +224,6 @@ void intel_opregion_asle_intr(struct drm_device *dev)iowrite32 (asle_stat, &asle->aslc); } -void intel_opregion_gse_intr (struct drm_device *dev) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -struct opregion_asle __iomem *asle = dev_priv->opregion.asle; -u32 asle_stat =0 ; -u32 asle_req; - -if (!asle) -return ; - - asle_req =ioread32 (&asle->aslc) &ASLE_REQ_MSK ; - -if (!asle_req) { -DRM_DEBUG_DRIVER ("non asle set request??\n" ); -return ; - } - -if (asle_req &ASLE_SET_ALS_ILLUM ) { -DRM_DEBUG_DRIVER ("Illum is not supported\n" ); - asle_stat |=ASLE_ALS_ILLUM_FAILED ; - } - -if (asle_req &ASLE_SET_BACKLIGHT ) - asle_stat |=asle_set_backlight (dev,ioread32 (&asle->bclp)); - -if (asle_req &ASLE_SET_PFIT ) { -DRM_DEBUG_DRIVER ("Pfit is not supported\n" ); - asle_stat |=ASLE_PFIT_FAILED ; - } - -if (asle_req &ASLE_SET_PWM_FREQ ) { -DRM_DEBUG_DRIVER ("PWM freq is not supported\n" ); - asle_stat |=ASLE_PWM_FREQ_FAILED ; - } - -iowrite32 (asle_stat, &asle->aslc); -}#define ASLE_ALS_EN (1<<0)#define ASLE_BLC_EN (1<<1)#define ASLE_PFIT_EN (1<<2)
Signature · 1 line
1.7.9.5
cover drm/i915: opregion cleanup
There's still stuff to do on opregion cleanup, but here are some potentially risky and/or controversial ones...
Jani Nikula (3):
drm/i915: don't pretend we support ASLE ALS, PFIT, or PFMB drm/i915/opregion: don't pretend we did something when we didn't drm/i915: drop code duplication in favor of asle interrupt handler
drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/intel_opregion.c | 60 ++++----------------------------- 3 files changed, 9 insertions(+), 56 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 2/3 drm/i915/opregion: don't pretend we did something when we didn't
In theory, the BIOS should not even request these from us now that we aren't claiming we support these, but when it does anyway, don't pretend it succeeded. It should be the right thing to do, but might confuse the BIOS.
--- drivers/gpu/drm/i915/intel_opregion.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/intel_opregion.c +6 -13
@@ -174,29 +174,22 @@ static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi) {/* alsi is the current ALS reading in lux. 0 indicates below sensor range, 0xffff indicates above sensor range. 1-0xfffe are valid */ -return 0 ; +DRM_DEBUG_DRIVER ("Illum is not supported\n" ); +return ASLE_ALS_ILLUM_FAILED ; }static u32 asle_set_pwm_freq (struct drm_device *dev,u32 pfmb) { -struct drm_i915_private *dev_priv = dev->dev_private; -if (pfmb &ASLE_PFMB_PWM_VALID ) { -u32 blc_pwm_ctl =I915_READ (BLC_PWM_CTL ); -u32 pwm = pfmb &ASLE_PFMB_PWM_MASK ; - blc_pwm_ctl &=BACKLIGHT_DUTY_CYCLE_MASK ; - pwm = pwm >>9 ; -/* FIXME - what do we do with the PWM? */ - } -return 0 ; +DRM_DEBUG_DRIVER ("PWM freq is not supported\n" ); +return ASLE_PWM_FREQ_FAILED ; }static u32 asle_set_pfit (struct drm_device *dev,u32 pfit) {/* Panel fitting is currently controlled by the X code, so this is a noop until modesetting support works fully */ -if (!(pfit &ASLE_PFIT_VALID )) -return ASLE_PFIT_FAILED ; -return 0 ; +DRM_DEBUG_DRIVER ("Pfit is not supported\n" ); +return ASLE_PFIT_FAILED ; }void intel_opregion_asle_intr (struct drm_device *dev)
Signature · 1 line
1.7.9.5
PATCH 1/3 drm/i915: don't pretend we support ASLE ALS, PFIT, or PFMB
In reply to Jani NikulaIn theory, this should prevent the BIOS from requesting them from us, and this should be the right thing.
In practice, this is not always the case, and might surprise the BIOS.
--- drivers/gpu/drm/i915/intel_opregion.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_opregion.c +1 -3
@@ -282,9 +282,7 @@ void intel_opregion_enable_asle(struct drm_device *dev)if (IS_MOBILE (dev))intel_enable_asle (dev); -iowrite32 (ASLE_ALS_EN |ASLE_BLC_EN |ASLE_PFIT_EN | -ASLE_PFMB_EN , - &asle->tche); +iowrite32 (ASLE_BLC_EN , &asle->tche);iowrite32 (1 , &asle->ardy); } }
Signature · 1 line
1.7.9.5
Re: [PATCH 3/3] drm/i915: drop code duplication in favor of asle interrupt handler
In reply to Jani NikulaQuoted 15 lines · Jani Nikula
With the previous work asle and gse interrupt handlers should now be functionally the same. Drop the duplicated code.
Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_irq.c | 4 ++-- drivers/gpu/drm/i915/intel_opregion.c | 37 --------------------------------- 3 files changed, 2 insertions(+), 40 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-0
drivers/gpu/drm/i915/i915_drv.h extern int intel_opregion_setup(struct drm_device *dev); · line 1815
Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.h +0
-1@@ -1810,7 +1810,6 @@ extern int intel_opregion_setup(struct drm_device *dev);extern void intel_opregion_init (struct drm_device *dev);extern void intel_opregion_fini (struct drm_device *dev);extern void intel_opregion_asle_intr (struct drm_device *dev); -extern void intel_opregion_gse_intr (struct drm_device *dev);extern void intel_opregion_enable_asle (struct drm_device *dev);#else static inline void intel_opregion_init (struct drm_device *dev) {return ; }
You also need to drop the intel_opregion_gse_intr() in the !CONFIG_ACPI path.
Quoted 77 lines
drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -792,7 +792,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE_IVB ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);for (i =0 ; i <3 ; i++) {if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i)))@@ -886,7 +886,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);if (de_iir &DE_PIPEA_VBLANK )drm_handle_vblank (dev,0 );drivers/gpu/drm/i915/intel_opregion.c +0
-37@@ -224,43 +224,6 @@ void intel_opregion_asle_intr(struct drm_device *dev)iowrite32 (asle_stat, &asle->aslc); } -void intel_opregion_gse_intr (struct drm_device *dev) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -struct opregion_asle __iomem *asle = dev_priv->opregion.asle; -u32 asle_stat =0 ; -u32 asle_req; - -if (!asle) -return ; - - asle_req =ioread32 (&asle->aslc) &ASLE_REQ_MSK ; - -if (!asle_req) { -DRM_DEBUG_DRIVER ("non asle set request??\n" ); -return ; - } - -if (asle_req &ASLE_SET_ALS_ILLUM ) { -DRM_DEBUG_DRIVER ("Illum is not supported\n" ); - asle_stat |=ASLE_ALS_ILLUM_FAILED ; - } - -if (asle_req &ASLE_SET_BACKLIGHT ) - asle_stat |=asle_set_backlight (dev,ioread32 (&asle->bclp)); - -if (asle_req &ASLE_SET_PFIT ) { -DRM_DEBUG_DRIVER ("Pfit is not supported\n" ); - asle_stat |=ASLE_PFIT_FAILED ; - } - -if (asle_req &ASLE_SET_PWM_FREQ ) { -DRM_DEBUG_DRIVER ("PWM freq is not supported\n" ); - asle_stat |=ASLE_PWM_FREQ_FAILED ; - } - -iowrite32 (asle_stat, &asle->aslc); -}#define ASLE_ALS_EN (1<<0)#define ASLE_BLC_EN (1<<1)#define ASLE_PFIT_EN (1<<2)Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 2 lines · Jani Nikula
There's still stuff to do on opregion cleanup, but here are some potentially risky and/or controversial ones...
With the small fix on patch 3, the whole series is:
This should trigger different code paths in the BIOS, but is legal and what we should do, not supporting the ambient light sensor, the panel fitter requests or the PWM freq and minimal brightness requests from the firmware.
Quoted 18 lines
Jani Nikula (3):
drm/i915: don't pretend we support ASLE ALS, PFIT, or PFMB drm/i915/opregion: don't pretend we did something when we didn't drm/i915: drop code duplication in favor of asle interrupt handlerdrivers/gpu/drm/i915/i915_drv.h | 1 - drivers/gpu/drm/i915/i915_irq.c | 4 +-- drivers/gpu/drm/i915/intel_opregion.c | 60 ++++----------------------------- 3 files changed, 9 insertions(+), 56 deletions(-)Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/3 drm/i915: drop code duplication in favor of asle interrupt handler
In reply to Damien LespiauWith the previous work asle and gse interrupt handlers should now be functionally the same. Drop the duplicated code.
v2: Drop intel_opregion_gse_intr() also in the !CONFIG_ACPI path. (Damien)
--- drivers/gpu/drm/i915/i915_drv.h | 2 -- drivers/gpu/drm/i915/i915_irq.c | 4 ++-- drivers/gpu/drm/i915/intel_opregion.c | 37 --------------------------------- 3 files changed, 2 insertions(+), 41 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +0 -2
@@ -1820,13 +1820,11 @@ extern int intel_opregion_setup(struct drm_device *dev);extern void intel_opregion_init (struct drm_device *dev);extern void intel_opregion_fini (struct drm_device *dev);extern void intel_opregion_asle_intr (struct drm_device *dev); -extern void intel_opregion_gse_intr (struct drm_device *dev);extern void intel_opregion_enable_asle (struct drm_device *dev);#else static inline void intel_opregion_init (struct drm_device *dev) {return ; }static inline void intel_opregion_fini (struct drm_device *dev) {return ; }static inline void intel_opregion_asle_intr (struct drm_device *dev) {return ; } -static inline void intel_opregion_gse_intr (struct drm_device *dev) {return ; }static inline void intel_opregion_enable_asle (struct drm_device *dev) {return ; }#endif
drivers/gpu/drm/i915/i915_irq.c +2 -2
@@ -1205,7 +1205,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE_IVB ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);for (i =0 ; i <3 ; i++) {if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i)))
@@ -1302,7 +1302,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);if (de_iir &DE_PIPEA_VBLANK )drm_handle_vblank (dev,0 );
drivers/gpu/drm/i915/intel_opregion.c +0 -37
@@ -224,43 +224,6 @@ void intel_opregion_asle_intr(struct drm_device *dev)iowrite32 (asle_stat, &asle->aslc); } -void intel_opregion_gse_intr (struct drm_device *dev) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -struct opregion_asle __iomem *asle = dev_priv->opregion.asle; -u32 asle_stat =0 ; -u32 asle_req; - -if (!asle) -return ; - - asle_req =ioread32 (&asle->aslc) &ASLE_REQ_MSK ; - -if (!asle_req) { -DRM_DEBUG_DRIVER ("non asle set request??\n" ); -return ; - } - -if (asle_req &ASLE_SET_ALS_ILLUM ) { -DRM_DEBUG_DRIVER ("Illum is not supported\n" ); - asle_stat |=ASLE_ALS_ILLUM_FAILED ; - } - -if (asle_req &ASLE_SET_BACKLIGHT ) - asle_stat |=asle_set_backlight (dev,ioread32 (&asle->bclp)); - -if (asle_req &ASLE_SET_PFIT ) { -DRM_DEBUG_DRIVER ("Pfit is not supported\n" ); - asle_stat |=ASLE_PFIT_FAILED ; - } - -if (asle_req &ASLE_SET_PWM_FREQ ) { -DRM_DEBUG_DRIVER ("PWM freq is not supported\n" ); - asle_stat |=ASLE_PWM_FREQ_FAILED ; - } - -iowrite32 (asle_stat, &asle->aslc); -}#define ASLE_ALS_EN (1<<0)#define ASLE_BLC_EN (1<<1)#define ASLE_PFIT_EN (1<<2)
Signature · 1 line
1.7.10.4
Re: [PATCH v2 3/3] drm/i915: drop code duplication in favor of asle interrupt handler
This was supposed to be in-reply-to [1] but I screwed up.
Jani.
[1] http://mid.gmane.org/[email protected]
Quoted 102 lines · Jani Nikula
With the previous work asle and gse interrupt handlers should now be functionally the same. Drop the duplicated code.
v2: Drop
intel_opregion_gse_intr()also in the !CONFIG_ACPI path. (Damien)Signed-off-by Jani Nikula <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 2 -- drivers/gpu/drm/i915/i915_irq.c | 4 ++-- drivers/gpu/drm/i915/intel_opregion.c | 37 --------------------------------- 3 files changed, 2 insertions(+), 41 deletions(-)drivers/gpu/drm/i915/i915_drv.h +0
-2@@ -1820,13 +1820,11 @@ extern int intel_opregion_setup(struct drm_device *dev);extern void intel_opregion_init (struct drm_device *dev);extern void intel_opregion_fini (struct drm_device *dev);extern void intel_opregion_asle_intr (struct drm_device *dev); -extern void intel_opregion_gse_intr (struct drm_device *dev);extern void intel_opregion_enable_asle (struct drm_device *dev);#else static inline void intel_opregion_init (struct drm_device *dev) {return ; }static inline void intel_opregion_fini (struct drm_device *dev) {return ; }static inline void intel_opregion_asle_intr (struct drm_device *dev) {return ; } -static inline void intel_opregion_gse_intr (struct drm_device *dev) {return ; }static inline void intel_opregion_enable_asle (struct drm_device *dev) {return ; }#endif drivers/gpu/drm/i915/i915_irq.c +2
-2@@ -1205,7 +1205,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE_IVB ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);for (i =0 ; i <3 ; i++) {if (de_iir & (DE_PIPEA_VBLANK_IVB << (5 * i)))@@ -1302,7 +1302,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)dp_aux_irq_handler (dev);if (de_iir &DE_GSE ) -intel_opregion_gse_intr (dev); +intel_opregion_asle_intr (dev);if (de_iir &DE_PIPEA_VBLANK )drm_handle_vblank (dev,0 );drivers/gpu/drm/i915/intel_opregion.c +0
-37@@ -224,43 +224,6 @@ void intel_opregion_asle_intr(struct drm_device *dev)iowrite32 (asle_stat, &asle->aslc); } -void intel_opregion_gse_intr (struct drm_device *dev) -{ -struct drm_i915_private *dev_priv = dev->dev_private; -struct opregion_asle __iomem *asle = dev_priv->opregion.asle; -u32 asle_stat =0 ; -u32 asle_req; - -if (!asle) -return ; - - asle_req =ioread32 (&asle->aslc) &ASLE_REQ_MSK ; - -if (!asle_req) { -DRM_DEBUG_DRIVER ("non asle set request??\n" ); -return ; - } - -if (asle_req &ASLE_SET_ALS_ILLUM ) { -DRM_DEBUG_DRIVER ("Illum is not supported\n" ); - asle_stat |=ASLE_ALS_ILLUM_FAILED ; - } - -if (asle_req &ASLE_SET_BACKLIGHT ) - asle_stat |=asle_set_backlight (dev,ioread32 (&asle->bclp)); - -if (asle_req &ASLE_SET_PFIT ) { -DRM_DEBUG_DRIVER ("Pfit is not supported\n" ); - asle_stat |=ASLE_PFIT_FAILED ; - } - -if (asle_req &ASLE_SET_PWM_FREQ ) { -DRM_DEBUG_DRIVER ("PWM freq is not supported\n" ); - asle_stat |=ASLE_PWM_FREQ_FAILED ; - } - -iowrite32 (asle_stat, &asle->aslc); -}#define ASLE_ALS_EN (1<<0)#define ASLE_BLC_EN (1<<1)#define ASLE_PFIT_EN (1<<2)Signature · 1 line
1.7.10.4
Re: [PATCH v2 3/3] drm/i915: drop code duplication in favor of asle interrupt handler
In reply to Jani NikulaQuoted 6 lines · Jani Nikula
With the previous work asle and gse interrupt handlers should now be functionally the same. Drop the duplicated code.
v2: Drop
intel_opregion_gse_intr()also in the !CONFIG_ACPI path. (Damien)Signed-off-by Jani Nikula <[email protected]>
To be explicit about it:
Signature · 1 line
Damien
Re: [PATCH v2 3/3] drm/i915: drop code duplication in favor of asle interrupt handler
Quoted 11 lines · Damien Lespiau
Quoted 6 lines · Jani Nikula
With the previous work asle and gse interrupt handlers should now be functionally the same. Drop the duplicated code.
v2: Drop
intel_opregion_gse_intr()also in the !CONFIG_ACPI path. (Damien)Signed-off-by Jani Nikula <[email protected]>To be explicit about it:
Reviewed-by Damien Lespiau <[email protected]>
Merged all three patches, thanks.
-Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch