Hi, could I get some feedback on this patch, please?<div><br></div><div>Simon<br><div><br><div class="gmail_quote">On Fri, Oct 14, 2011 at 4:46 PM, Simon Que <span dir="ltr"><<a href="mailto:sque@chromium.org">sque@chromium.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">In the native backlight driver, use 4096 (0x1000) as the default backlight<br>
period, and use the period as the default max brightness.<br>
<br>
The default brightness is defined in a separate function that can be<br>
expanded to allow for different defaults on different systems in the<br>
future.<br>
<br>
Change-Id: Ie783b53dd034dcd7bf42e24ffc911cf2f10a5676<br>
Signed-off-by: Simon Que <<a href="mailto:sque@chromium.org">sque@chromium.org</a>><br>
---<br>
drivers/gpu/drm/i915/i915_reg.h | 1 +<br>
drivers/gpu/drm/i915/intel_panel.c | 22 ++++++++++++++++++----<br>
2 files changed, 19 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h<br>
index 5d5def7..a832028 100644<br>
--- a/drivers/gpu/drm/i915/i915_reg.h<br>
+++ b/drivers/gpu/drm/i915/i915_reg.h<br>
@@ -3275,6 +3275,7 @@<br>
#define PWM_POLARITY_ACTIVE_HIGH2 (0 << 28)<br>
<br>
#define BLC_PWM_PCH_CTL2 0xc8254<br>
+#define BLC_PWM_PCH_FREQ_SHIFT 16<br>
<br>
#define PCH_PP_STATUS 0xc7200<br>
#define PCH_PP_CONTROL 0xc7204<br>
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c<br>
index 05f500c..8205945 100644<br>
--- a/drivers/gpu/drm/i915/intel_panel.c<br>
+++ b/drivers/gpu/drm/i915/intel_panel.c<br>
@@ -161,6 +161,12 @@ static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)<br>
return val;<br>
}<br>
<br>
+static u32 intel_panel_get_default_backlight_period(struct drm_device *dev)<br>
+{<br>
+ /* The default number of clock cycles in one backlight PWM period. */<br>
+ return 0x1000;<br>
+}<br>
+<br>
u32 intel_panel_get_max_backlight(struct drm_device *dev)<br>
{<br>
struct drm_i915_private *dev_priv = dev->dev_private;<br>
@@ -168,11 +174,19 @@ u32 intel_panel_get_max_backlight(struct drm_device *dev)<br>
<br>
max = i915_read_blc_pwm_ctl(dev_priv);<br>
if (max == 0) {<br>
- /* XXX add code here to query mode clock or hardware clock<br>
- * and program max PWM appropriately.<br>
+ /* If no max backlight was found, use the default PWM period as<br>
+ * the max backlight value.<br>
*/<br>
- printk_once(KERN_WARNING "fixme: max PWM is zero.\n");<br>
- return 1;<br>
+ max = intel_panel_get_default_backlight_period(dev);<br>
+ if (HAS_PCH_SPLIT(dev_priv->dev)) {<br>
+ u32 val = max << BLC_PWM_PCH_FREQ_SHIFT;<br>
+ I915_WRITE(BLC_PWM_PCH_CTL2, val);<br>
+ } else {<br>
+ u32 val = max << BACKLIGHT_MODULATION_FREQ_SHIFT;<br>
+ I915_WRITE(BLC_PWM_CTL, val);<br>
+ }<br>
+<br>
+ return max;<br>
}<br>
<br>
if (HAS_PCH_SPLIT(dev)) {<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.2.3<br>
<br>
</font></span></blockquote></div><br></div></div>