All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] adt7475 driver: PWM invert configuration bit
@ 2014-12-03  4:12 Curt Brune
  2014-12-03  5:29 ` Guenter Roeck
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Curt Brune @ 2014-12-03  4:12 UTC (permalink / raw)
  To: lm-sensors

Hello,

I have a system where I need to change the "PWM invert" bit (bit 4) in
the PWM configuration register (offset 0x5C).  The description of this
configuration bit from the data sheet:

  This bit inverts the PWM output. The default is 0, which corresponds
  to a logic high output for 100% duty cycle. Setting this bit to 1
  inverts the PWM output, so 100% duty cycle corresponds to a logic
  low output.

I noticed the adt7475.c driver does not expose this bit in sysfs.
Before hacking away I am curious to know why this configuration bit is
not exposed already.  Some reasons I could think of:

- expect the power on default to be correct
- expect some other software (boot loader or BIOS) has already set it
- just never needed it

If it was just never needed then I am proposing to add 3 read/write
files to sysfs:

   pwm1_invert
   pwm2_invert
   pwm3_invert

The values of 0 and 1 would have the same meaning as the "PWM invert"
bit (bit 4) in the PWM configuration register (offset 0x5C).  Any
other value would be treated as -EINVAL.

Cheers,
Curt

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [lm-sensors] adt7475 driver: PWM invert configuration bit
  2014-12-03  4:12 [lm-sensors] adt7475 driver: PWM invert configuration bit Curt Brune
@ 2014-12-03  5:29 ` Guenter Roeck
  2014-12-04  0:18 ` Curt Brune
  2014-12-04  1:10 ` Guenter Roeck
  2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2014-12-03  5:29 UTC (permalink / raw)
  To: lm-sensors

On 12/02/2014 08:12 PM, Curt Brune wrote:
> Hello,
>
> I have a system where I need to change the "PWM invert" bit (bit 4) in
> the PWM configuration register (offset 0x5C).  The description of this
> configuration bit from the data sheet:
>
>    This bit inverts the PWM output. The default is 0, which corresponds
>    to a logic high output for 100% duty cycle. Setting this bit to 1
>    inverts the PWM output, so 100% duty cycle corresponds to a logic
>    low output.
>
> I noticed the adt7475.c driver does not expose this bit in sysfs.
> Before hacking away I am curious to know why this configuration bit is
> not exposed already.  Some reasons I could think of:
>
> - expect the power on default to be correct
> - expect some other software (boot loader or BIOS) has already set it
> - just never needed it
>
> If it was just never needed then I am proposing to add 3 read/write
> files to sysfs:
>
>     pwm1_invert
>     pwm2_invert
>     pwm3_invert
>
> The values of 0 and 1 would have the same meaning as the "PWM invert"
> bit (bit 4) in the PWM configuration register (offset 0x5C).  Any
> other value would be treated as -EINVAL.
>

This is usually a system attribute, not something to configure at
runtime. As such, expectation would be that it is set either with
platform data and/or with a devicetree property, not with a sysfs
attribute.

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [lm-sensors] adt7475 driver: PWM invert configuration bit
  2014-12-03  4:12 [lm-sensors] adt7475 driver: PWM invert configuration bit Curt Brune
  2014-12-03  5:29 ` Guenter Roeck
@ 2014-12-04  0:18 ` Curt Brune
  2014-12-04  1:10 ` Guenter Roeck
  2 siblings, 0 replies; 4+ messages in thread
From: Curt Brune @ 2014-12-04  0:18 UTC (permalink / raw)
  To: lm-sensors

Hello Guenter,

On Tue Dec 02 21:29, Guenter Roeck wrote:
> 
> This is usually a system attribute, not something to configure at
> runtime. As such, expectation would be that it is set either with
> platform data and/or with a devicetree property, not with a sysfs
> attribute.
> 

Thanks for the input.  I will consider the platform data and/or
devicetree property approach.

Cheers,
Curt

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [lm-sensors] adt7475 driver: PWM invert configuration bit
  2014-12-03  4:12 [lm-sensors] adt7475 driver: PWM invert configuration bit Curt Brune
  2014-12-03  5:29 ` Guenter Roeck
  2014-12-04  0:18 ` Curt Brune
@ 2014-12-04  1:10 ` Guenter Roeck
  2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2014-12-04  1:10 UTC (permalink / raw)
  To: lm-sensors

On Wed, Dec 03, 2014 at 04:18:45PM -0800, Curt Brune wrote:
> Hello Guenter,
> 
> On Tue Dec 02 21:29, Guenter Roeck wrote:
> > 
> > This is usually a system attribute, not something to configure at
> > runtime. As such, expectation would be that it is set either with
> > platform data and/or with a devicetree property, not with a sysfs
> > attribute.
> > 
> 
> Thanks for the input.  I will consider the platform data and/or
> devicetree property approach.
> 
Hi Curt,

Patches are welcome ...

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-12-04  1:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-03  4:12 [lm-sensors] adt7475 driver: PWM invert configuration bit Curt Brune
2014-12-03  5:29 ` Guenter Roeck
2014-12-04  0:18 ` Curt Brune
2014-12-04  1:10 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.