All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Sysfs attribute to specify device range
@ 2010-10-02 11:56 Jonathan Cameron
  2010-10-02 12:03 ` Jonathan Cameron
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jonathan Cameron @ 2010-10-02 11:56 UTC (permalink / raw)
  To: lm-sensors

Hi All,

This question is actually motivated by a light sensor driver
proposed for IIO, but given we don't have an answer in our
current abi and the problem seems a common one I thought
I would ask you guys.  Firstly I'm not sure if you already
have an interface for this!

We have a multi range sensor, to simplify the discussion, let us
call it an adc.  So it's range can be configured to say 0-1V, 0-2V, 0-4V.
We would like to be able to control this via a sysfs attribute and
have been trying to work out what to call it.

in1_max is out because I believe that is used for alarms (whilst we have
different, more general, naming for those, we don't want to muddy the
waters by reusing the name).

in1_range is a bit non specific as it isn't clear how to specify future
devices that support say 1-2V range.  We could allow a pair of values
to specify the range (fine as single conceptual entity).  If only one
is present then assume the minimum is 0? 

Pointers to drivers which are already handling this case, bits of the
hwmon abi that I missed or suggestions all welcome.

Thanks,

Jonathan

_______________________________________________
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] Sysfs attribute to specify device range
  2010-10-02 11:56 [lm-sensors] Sysfs attribute to specify device range Jonathan Cameron
@ 2010-10-02 12:03 ` Jonathan Cameron
  2010-10-02 13:08 ` Guenter Roeck
  2010-10-02 15:57 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2010-10-02 12:03 UTC (permalink / raw)
  To: lm-sensors

On 10/02/10 12:56, Jonathan Cameron wrote:
> Hi All,
> 
> This question is actually motivated by a light sensor driver
> proposed for IIO, but given we don't have an answer in our
> current abi and the problem seems a common one I thought
> I would ask you guys.  Firstly I'm not sure if you already
> have an interface for this!
> 
> We have a multi range sensor, to simplify the discussion, let us
> call it an adc.  So it's range can be configured to say 0-1V, 0-2V, 0-4V.
> We would like to be able to control this via a sysfs attribute and
> have been trying to work out what to call it.
> 
> in1_max is out because I believe that is used for alarms (whilst we have
> different, more general, naming for those, we don't want to muddy the
> waters by reusing the name).
> 
> in1_range is a bit non specific as it isn't clear how to specify future
> devices that support say 1-2V range.  We could allow a pair of values
> to specify the range (fine as single conceptual entity).  If only one
> is present then assume the minimum is 0? 
> 
> Pointers to drivers which are already handling this case, bits of the
> hwmon abi that I missed or suggestions all welcome.
> 
Actually from our point of view it occurs to me that we can just treat this
case as an on chip calibration scale factor so we do have an interface for
this in IIO _calibscale. I was clearly half asleep this morning.  Still,
I would be interested to here if there is an equivalent in hwmon. Sorry for
the noise.

Jonathan


_______________________________________________
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] Sysfs attribute to specify device range
  2010-10-02 11:56 [lm-sensors] Sysfs attribute to specify device range Jonathan Cameron
  2010-10-02 12:03 ` Jonathan Cameron
@ 2010-10-02 13:08 ` Guenter Roeck
  2010-10-02 15:57 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2010-10-02 13:08 UTC (permalink / raw)
  To: lm-sensors

Jonathan,

On Sat, Oct 02, 2010 at 07:56:32AM -0400, Jonathan Cameron wrote:
> Hi All,
> 
> This question is actually motivated by a light sensor driver
> proposed for IIO, but given we don't have an answer in our
> current abi and the problem seems a common one I thought
> I would ask you guys.  Firstly I'm not sure if you already
> have an interface for this!
> 
Not that I know of.

> We have a multi range sensor, to simplify the discussion, let us
> call it an adc.  So it's range can be configured to say 0-1V, 0-2V, 0-4V.
> We would like to be able to control this via a sysfs attribute and
> have been trying to work out what to call it.
> 
Would that be a dynamic or a static parameter ? Or, in other words, 
would the setting depend on the specific board or on some runtime consideration ?

If it is static, a sysfs attribute would really be the wrong way to go. 
The best option in that case would be to use platform data.
In all instances I can think of, that would be the most appropriate, since 
such settings are typically board dependent.

max6650 uses a "prescale" module parameter. Not really a good solution to use
a module parameter, though, since it applies to all instances of the driver.

> in1_max is out because I believe that is used for alarms (whilst we have
> different, more general, naming for those, we don't want to muddy the
> waters by reusing the name).
> 
> in1_range is a bit non specific as it isn't clear how to specify future
> devices that support say 1-2V range.  We could allow a pair of values
> to specify the range (fine as single conceptual entity).  If only one
> is present then assume the minimum is 0? 
> 
Wonder if inX_anything really applies in the first place. After all, you are 
talking about light, not voltage. Sure, it is measured in volt, but so is current
and pretty much everything else. And it isn't really hw monitoring in the first 
place, so I doubt if the driver should be in hwmon - probaby not.

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

* Re: [lm-sensors] Sysfs attribute to specify device range
  2010-10-02 11:56 [lm-sensors] Sysfs attribute to specify device range Jonathan Cameron
  2010-10-02 12:03 ` Jonathan Cameron
  2010-10-02 13:08 ` Guenter Roeck
@ 2010-10-02 15:57 ` Jonathan Cameron
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2010-10-02 15:57 UTC (permalink / raw)
  To: lm-sensors

On 10/02/10 14:08, Guenter Roeck wrote:
> Jonathan,
> 
> On Sat, Oct 02, 2010 at 07:56:32AM -0400, Jonathan Cameron wrote:
>> Hi All,
>>
>> This question is actually motivated by a light sensor driver
>> proposed for IIO, but given we don't have an answer in our
>> current abi and the problem seems a common one I thought
>> I would ask you guys.  Firstly I'm not sure if you already
>> have an interface for this!
>>
> Not that I know of.
> 
>> We have a multi range sensor, to simplify the discussion, let us
>> call it an adc.  So it's range can be configured to say 0-1V, 0-2V, 0-4V.
>> We would like to be able to control this via a sysfs attribute and
>> have been trying to work out what to call it.
>>
> Would that be a dynamic or a static parameter ? Or, in other words, 
> would the setting depend on the specific board or on some runtime consideration ?
Fully controllable.  Possibly with some userspace code controlling it.
> 
> If it is static, a sysfs attribute would really be the wrong way to go. 
> The best option in that case would be to use platform data.
> In all instances I can think of, that would be the most appropriate, since 
> such settings are typically board dependent.
True enough in hwmon devices, not true for things like light sensors unfortunately.
Guess this explains why hwmon doesn't implement anything similar!
> 
> max6650 uses a "prescale" module parameter. Not really a good solution to use
> a module parameter, though, since it applies to all instances of the driver.
> 
>> in1_max is out because I believe that is used for alarms (whilst we have
>> different, more general, naming for those, we don't want to muddy the
>> waters by reusing the name).
>>
>> in1_range is a bit non specific as it isn't clear how to specify future
>> devices that support say 1-2V range.  We could allow a pair of values
>> to specify the range (fine as single conceptual entity).  If only one
>> is present then assume the minimum is 0? 
>>
> Wonder if inX_anything really applies in the first place. After all, you are 
> talking about light, not voltage. Sure, it is measured in volt, but so is current
> and pretty much everything else. And it isn't really hw monitoring in the first 
> place, so I doubt if the driver should be in hwmon - probaby not.
Sure, I just switched from illuminance0 to in1 so as to cut down on necessary
explanation. As it turns out that was more confusing than if I'd just stuck to
our naming in the first place. Ah well, thanks for clearing up why this
hasn't been an issue in hwmon.  Guess I get to make this one up ;) As my second
email stated, it's pretty much covered by our illuminance0_calibscale parameter
anyway, I just forgot that one could exist this morning!

Jonathan

_______________________________________________
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:[~2010-10-02 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-02 11:56 [lm-sensors] Sysfs attribute to specify device range Jonathan Cameron
2010-10-02 12:03 ` Jonathan Cameron
2010-10-02 13:08 ` Guenter Roeck
2010-10-02 15:57 ` Jonathan Cameron

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.