Re: [RFC v5 9/9] drm/i915: Backlight control using CRC PMIC based PWM driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 13, 2015 at 04:30:43PM +0200, Ville Syrjälä wrote:
> On Thu, Mar 12, 2015 at 10:01:33PM +0530, Shobhit Kumar wrote:
> > CC: Samuel Ortiz <sameo@xxxxxxxxxxxxxxx>
> > Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
> > Cc: Alexandre Courbot <gnurou@xxxxxxxxx>
> > Cc: Thierry Reding <thierry.reding@xxxxxxxxx>
> > Signed-off-by: Shobhit Kumar <shobhit.kumar@xxxxxxxxx>
> > ---
> >  drivers/gpu/drm/i915/intel_dsi.c | 25 +++++++++++++++++++++++++
> >  drivers/gpu/drm/i915/intel_dsi.h |  3 +++
> >  2 files changed, 28 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> > index 219421c..511446f 100644
> > --- a/drivers/gpu/drm/i915/intel_dsi.c
> > +++ b/drivers/gpu/drm/i915/intel_dsi.c
> > @@ -32,6 +32,7 @@
> >  #include <drm/drm_mipi_dsi.h>
> >  #include <linux/slab.h>
> >  #include <linux/gpio/consumer.h>
> > +#include <linux/pwm.h>
> >  #include "i915_drv.h"
> >  #include "intel_drv.h"
> >  #include "intel_dsi.h"
> > @@ -402,6 +403,10 @@ static void intel_dsi_enable(struct intel_encoder *encoder)
> >  
> >  		intel_dsi_port_enable(encoder);
> >  	}
> > +
> > +	/* Enable the backlight with default PWM as programmed by BIOS */
> > +	pwm_enable(intel_dsi->pwm);
> > +	pwm_config_alternate(intel_dsi->pwm, 0x7F, 100);
> 
> I suppose we migth want to wrap these in 'if (intel_dsi->pwm)' checks,
> or does the pwm subsystem take care of NULL checks for us?

The PWM core checks for valid PWM devices and will return an error if
you pass in an invalid device. What this is completely missing is any
kind of error checking. But perhaps you don't care about failure here
for this particular platform? It would be useful to debug issues with
black screens and such I can imagine.

Also, though it's admittedly somewhat underdocumented, the typical
sequence of calls should be pwm_config() followed by pwm_enable(). The
reason is that some devices don't support being configured while
enabled. But you may not care about this here since you're always
dealing with a fixed device anyway.

Thierry

Attachment: pgpQ15qUvNz7P.pgp
Description: PGP signature

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux