* [PATCH] i915: Don't register backlight when max PWM value is unknown
@ 2012-09-14 15:34 Grant Likely
2012-09-14 16:18 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2012-09-14 15:34 UTC (permalink / raw)
To: dri-devel, linux-kernel
Cc: Grant Likely, Daniel Vetter, David Airlie, Matthew Garrett,
David Woodhouse
When a backlight isn't connected to the i915 it doesn't make any sense
to register the backlight device, but the driver currently tries to limp
along using a max brightness value of 1. Instead, this patch makes it so
that if the maximum PWM value cannot be determined, then the backlight
will not be registered.
Tested on MacbookPro8,3.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Matthew Garrett <mjg@redhat.com>
Cc: David Woodhouse <dwmw2@infradead.org>
---
drivers/gpu/drm/i915/intel_panel.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 3df4f5f..f410c6e 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -168,13 +168,8 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev)
u32 max;
max = i915_read_blc_pwm_ctl(dev_priv);
- if (max == 0) {
- /* XXX add code here to query mode clock or hardware clock
- * and program max PWM appropriately.
- */
- pr_warn_once("fixme: max PWM is zero\n");
- return 1;
- }
+ if (max == 0)
+ return 0; /* Cannot read max PWM. Assume no backlight */
if (HAS_PCH_SPLIT(dev)) {
max >>= 16;
@@ -413,6 +408,12 @@ int intel_panel_setup_backlight(struct drm_device *dev)
struct backlight_properties props;
struct drm_connector *connector;
+ /* Is there a backlight present? max will be zero if not */
+ if (intel_panel_get_max_backlight(dev) == 0) {
+ DRM_INFO("i915 doesn't seem to be connected to backlight\n");
+ return 0;
+ }
+
intel_panel_init_backlight(dev);
if (dev_priv->int_lvds_connector)
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i915: Don't register backlight when max PWM value is unknown
2012-09-14 15:34 [PATCH] i915: Don't register backlight when max PWM value is unknown Grant Likely
@ 2012-09-14 16:18 ` Daniel Vetter
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2012-09-14 16:18 UTC (permalink / raw)
To: Grant Likely
Cc: dri-devel, linux-kernel, Daniel Vetter, David Airlie,
Matthew Garrett, David Woodhouse
On Fri, Sep 14, 2012 at 04:34:28PM +0100, Grant Likely wrote:
> When a backlight isn't connected to the i915 it doesn't make any sense
> to register the backlight device, but the driver currently tries to limp
> along using a max brightness value of 1. Instead, this patch makes it so
> that if the maximum PWM value cannot be determined, then the backlight
> will not be registered.
>
> Tested on MacbookPro8,3.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Matthew Garrett <mjg@redhat.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
I've already merged a rather similar patch from Jani Nikula
commit 28dcc2d60cb570d9f549c329b2f51400553412a1
Author: Jani Nikula <jani.nikula@intel.com>
Date: Mon Sep 3 16:25:12 2012 +0300
drm/i915: do not expose a dysfunctional backlight interface to
userspace
Should land in 3.6 rsn.
-Daniel
> ---
> drivers/gpu/drm/i915/intel_panel.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
> index 3df4f5f..f410c6e 100644
> --- a/drivers/gpu/drm/i915/intel_panel.c
> +++ b/drivers/gpu/drm/i915/intel_panel.c
> @@ -168,13 +168,8 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev)
> u32 max;
>
> max = i915_read_blc_pwm_ctl(dev_priv);
> - if (max == 0) {
> - /* XXX add code here to query mode clock or hardware clock
> - * and program max PWM appropriately.
> - */
> - pr_warn_once("fixme: max PWM is zero\n");
> - return 1;
> - }
> + if (max == 0)
> + return 0; /* Cannot read max PWM. Assume no backlight */
>
> if (HAS_PCH_SPLIT(dev)) {
> max >>= 16;
> @@ -413,6 +408,12 @@ int intel_panel_setup_backlight(struct drm_device *dev)
> struct backlight_properties props;
> struct drm_connector *connector;
>
> + /* Is there a backlight present? max will be zero if not */
> + if (intel_panel_get_max_backlight(dev) == 0) {
> + DRM_INFO("i915 doesn't seem to be connected to backlight\n");
> + return 0;
> + }
> +
> intel_panel_init_backlight(dev);
>
> if (dev_priv->int_lvds_connector)
> --
> 1.7.9.5
>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] i915: Don't register backlight when max PWM value is unknown
@ 2012-09-21 9:31 Eugene Markow
0 siblings, 0 replies; 3+ messages in thread
From: Eugene Markow @ 2012-09-21 9:31 UTC (permalink / raw)
To: Linux Kernel Mailing List
In reference to:
-----
commit 28dcc2d60cb570d9f549c329b2f51400553412a1
Author: Jani Nikula <jani.nikula@...com>
Date: Mon Sep 3 16:25:12 2012 +0300
drm/i915: do not expose a dysfunctional backlight interface to userspace
-----
Using kernel snapshot 3.6.0-rc6 commit 4651afb (Mon, 17 Sep 2012), dmesg is showing:
[5.764086] [drm:intel_panel_setup_backlight] *ERROR* Failed to get maximum backlight value
Regards,
Eugene Markow
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-21 9:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-14 15:34 [PATCH] i915: Don't register backlight when max PWM value is unknown Grant Likely
2012-09-14 16:18 ` Daniel Vetter
2012-09-21 9:31 Eugene Markow
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®