All of lore.kernel.org
 help / color / mirror / Atom feed
* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-09  0:02 ` Stuart Longland
  0 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-09  0:02 UTC (permalink / raw)
  To: linux-arm-kernel, linux-kernel

Hi all,

I'm currently writing a driver for an in-house developed sensor
controller device.  This device communicates via I²C, and functions as a
multi-function device incorporating:

- Touchscreen controller
- Keypad/Button controller
- LED driver
- Voltage/current monitor
- Temperature sensor monitor
- Light sensor monitor
- PIR (motion) detection monitor
- Communications interface (for slow serial links like Wiegand)

Our target is a Ka-Ro TX27 module, running their supplied kernel
(2.6.28)... however I'm not afraid to backport things from the latest
kernel, or to forward port any changes for mainline kernel inclusion.
(I've already got an experimental patchset that gets these things
booting kernel 2.6.34.)

The first three on this list, I've got settled pretty nicely using
existing interfaces.  The things I'm not sure about, are the remaining
interfaces, and how to best write a driver for them.

How are voltage *monitors* normally written?  (note, not voltage
*regulators*... this thing does not alter the voltage rails.)  I tried
to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
some document that explains it) to me.  It's hard to be clear on what is
the *right* way to report a voltage or current reading to userspace.

For the temperature and light sensing... temperature sensors certainly
exist in the PC world, and maybe I should look closely at how they are
normally done, but I wasn't sure about the light sensor.  I was thinking
maybe an input device with some new absolute value reported?

Likewise with the PIR sensor, I notice there's a "gesture" input
(MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?

The other feature is for things like Wiegand... Looking around I cannot
see any interface in the Linux kernel for Wiegand interfaces.

<http://en.wikipedia.org/wiki/Wiegand_protocol>

Given the likely use of embedded Linux in security systems, it makes
sense to come up with a suitable interface out in the open, rather than
everyone coming up with their own device-specific interfaces.

Apologies if this has been asked before, but I've looked around and
haven't seen anything... so I figured before I get too deep into this,
I'd enquire about the Right Way it should be done. ;-)

Regards,
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-09  0:02 ` Stuart Longland
  0 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-09  0:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi all,

I'm currently writing a driver for an in-house developed sensor
controller device.  This device communicates via I?C, and functions as a
multi-function device incorporating:

- Touchscreen controller
- Keypad/Button controller
- LED driver
- Voltage/current monitor
- Temperature sensor monitor
- Light sensor monitor
- PIR (motion) detection monitor
- Communications interface (for slow serial links like Wiegand)

Our target is a Ka-Ro TX27 module, running their supplied kernel
(2.6.28)... however I'm not afraid to backport things from the latest
kernel, or to forward port any changes for mainline kernel inclusion.
(I've already got an experimental patchset that gets these things
booting kernel 2.6.34.)

The first three on this list, I've got settled pretty nicely using
existing interfaces.  The things I'm not sure about, are the remaining
interfaces, and how to best write a driver for them.

How are voltage *monitors* normally written?  (note, not voltage
*regulators*... this thing does not alter the voltage rails.)  I tried
to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
some document that explains it) to me.  It's hard to be clear on what is
the *right* way to report a voltage or current reading to userspace.

For the temperature and light sensing... temperature sensors certainly
exist in the PC world, and maybe I should look closely at how they are
normally done, but I wasn't sure about the light sensor.  I was thinking
maybe an input device with some new absolute value reported?

Likewise with the PIR sensor, I notice there's a "gesture" input
(MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?

The other feature is for things like Wiegand... Looking around I cannot
see any interface in the Linux kernel for Wiegand interfaces.

<http://en.wikipedia.org/wiki/Wiegand_protocol>

Given the likely use of embedded Linux in security systems, it makes
sense to come up with a suitable interface out in the open, rather than
everyone coming up with their own device-specific interfaces.

Apologies if this has been asked before, but I've looked around and
haven't seen anything... so I figured before I get too deep into this,
I'd enquire about the Right Way it should be done. ;-)

Regards,
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-09  0:02 ` Stuart Longland
@ 2010-09-09  2:48   ` Ryan Mallon
  -1 siblings, 0 replies; 17+ messages in thread
From: Ryan Mallon @ 2010-09-09  2:48 UTC (permalink / raw)
  To: Stuart Longland; +Cc: linux-arm-kernel, linux-kernel

On 09/09/2010 12:02 PM, Stuart Longland wrote:
> Hi all,
> 
> I'm currently writing a driver for an in-house developed sensor
> controller device.  This device communicates via I²C, and functions as a
> multi-function device incorporating:
> 
> - Touchscreen controller
> - Keypad/Button controller
> - LED driver
> - Voltage/current monitor
> - Temperature sensor monitor
> - Light sensor monitor
> - PIR (motion) detection monitor
> - Communications interface (for slow serial links like Wiegand)

> How are voltage *monitors* normally written?  (note, not voltage
> *regulators*... this thing does not alter the voltage rails.)  I tried
> to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
> some document that explains it) to me.  It's hard to be clear on what is
> the *right* way to report a voltage or current reading to userspace.

Depending on your particular application it might make sense to use the
power supply class (see Documentation/power/power_supply_class.txt) for
the voltage/current monitoring. If the temperature sensor is related to
a power supply monitor, then it could also go there.

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-09  2:48   ` Ryan Mallon
  0 siblings, 0 replies; 17+ messages in thread
From: Ryan Mallon @ 2010-09-09  2:48 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/09/2010 12:02 PM, Stuart Longland wrote:
> Hi all,
> 
> I'm currently writing a driver for an in-house developed sensor
> controller device.  This device communicates via I?C, and functions as a
> multi-function device incorporating:
> 
> - Touchscreen controller
> - Keypad/Button controller
> - LED driver
> - Voltage/current monitor
> - Temperature sensor monitor
> - Light sensor monitor
> - PIR (motion) detection monitor
> - Communications interface (for slow serial links like Wiegand)

> How are voltage *monitors* normally written?  (note, not voltage
> *regulators*... this thing does not alter the voltage rails.)  I tried
> to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
> some document that explains it) to me.  It's hard to be clear on what is
> the *right* way to report a voltage or current reading to userspace.

Depending on your particular application it might make sense to use the
power supply class (see Documentation/power/power_supply_class.txt) for
the voltage/current monitoring. If the temperature sensor is related to
a power supply monitor, then it could also go there.

~Ryan

-- 
Bluewater Systems Ltd - ARM Technology Solution Centre

Ryan Mallon         		5 Amuri Park, 404 Barbadoes St
ryan at bluewatersys.com         	PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com	New Zealand
Phone: +64 3 3779127		Freecall: Australia 1800 148 751
Fax:   +64 3 3779135			  USA 1800 261 2934

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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-09  2:48   ` Ryan Mallon
@ 2010-09-09  5:01     ` Stuart Longland
  -1 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-09  5:01 UTC (permalink / raw)
  To: Ryan Mallon; +Cc: linux-arm-kernel, linux-kernel

On Thu, Sep 09, 2010 at 02:48:26PM +1200, Ryan Mallon wrote:
> On 09/09/2010 12:02 PM, Stuart Longland wrote:
> > How are voltage *monitors* normally written?  (note, not voltage
> > *regulators*... this thing does not alter the voltage rails.)  I tried
> > to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
> > some document that explains it) to me.  It's hard to be clear on what is
> > the *right* way to report a voltage or current reading to userspace.
> 
> Depending on your particular application it might make sense to use the
> power supply class (see Documentation/power/power_supply_class.txt) for
> the voltage/current monitoring. If the temperature sensor is related to
> a power supply monitor, then it could also go there.

Ahh okay, I'll have a look there..  The temperature isn't related to the
power supply, so I might continue a searchfor its rightful place, but
that class of devices seems like a good fit.
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-09  5:01     ` Stuart Longland
  0 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-09  5:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 09, 2010 at 02:48:26PM +1200, Ryan Mallon wrote:
> On 09/09/2010 12:02 PM, Stuart Longland wrote:
> > How are voltage *monitors* normally written?  (note, not voltage
> > *regulators*... this thing does not alter the voltage rails.)  I tried
> > to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
> > some document that explains it) to me.  It's hard to be clear on what is
> > the *right* way to report a voltage or current reading to userspace.
> 
> Depending on your particular application it might make sense to use the
> power supply class (see Documentation/power/power_supply_class.txt) for
> the voltage/current monitoring. If the temperature sensor is related to
> a power supply monitor, then it could also go there.

Ahh okay, I'll have a look there..  The temperature isn't related to the
power supply, so I might continue a searchfor its rightful place, but
that class of devices seems like a good fit.
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-09  5:01     ` Stuart Longland
@ 2010-09-09  8:29       ` Mark Brown
  -1 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2010-09-09  8:29 UTC (permalink / raw)
  To: Stuart Longland; +Cc: Ryan Mallon, linux-kernel, linux-arm-kernel

On Thu, Sep 09, 2010 at 03:01:37PM +1000, Stuart Longland wrote:

> Ahh okay, I'll have a look there..  The temperature isn't related to the
> power supply, so I might continue a searchfor its rightful place, but
> that class of devices seems like a good fit.

hwmon might be useful also (you can expose the same data via both
interfaces if you like).

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-09  8:29       ` Mark Brown
  0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2010-09-09  8:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 09, 2010 at 03:01:37PM +1000, Stuart Longland wrote:

> Ahh okay, I'll have a look there..  The temperature isn't related to the
> power supply, so I might continue a searchfor its rightful place, but
> that class of devices seems like a good fit.

hwmon might be useful also (you can expose the same data via both
interfaces if you like).

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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-09  0:02 ` Stuart Longland
@ 2010-09-09 12:43   ` Jonathan Cameron
  -1 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2010-09-09 12:43 UTC (permalink / raw)
  To: Stuart Longland; +Cc: linux-arm-kernel, linux-kernel, Dmitry Torokhov

....
> 
> How are voltage *monitors* normally written?  (note, not voltage
> *regulators*... this thing does not alter the voltage rails.)  I tried
> to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
> some document that explains it) to me.  It's hard to be clear on what is
> the *right* way to report a voltage or current reading to userspace.
typically hwmon, documentation is under /Documentation/hwmon/sysfs-interface.
> 
> For the temperature and light sensing... temperature sensors certainly
> exist in the PC world, and maybe I should look closely at how they are
> normally done, but I wasn't sure about the light sensor.  I was thinking
> maybe an input device with some new absolute value reported?
Light sensing options are currently either /misc or /staging/iio/light.

There are several different interfaces unfortunately.  IIO can work with
a bridge (via uinput) to generate input events is that is what you need.
The interface is still a bit unstable, though it is getting cleaned up
at the moment.
> 
> Likewise with the PIR sensor, I notice there's a "gesture" input
> (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
Does it look like a button (e.g. is it a straight on off device with
no control parameters etc)? Dmitry, what would you put this as and would
this be acceptable in input?  

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-09 12:43   ` Jonathan Cameron
  0 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2010-09-09 12:43 UTC (permalink / raw)
  To: linux-arm-kernel

....
> 
> How are voltage *monitors* normally written?  (note, not voltage
> *regulators*... this thing does not alter the voltage rails.)  I tried
> to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
> some document that explains it) to me.  It's hard to be clear on what is
> the *right* way to report a voltage or current reading to userspace.
typically hwmon, documentation is under /Documentation/hwmon/sysfs-interface.
> 
> For the temperature and light sensing... temperature sensors certainly
> exist in the PC world, and maybe I should look closely at how they are
> normally done, but I wasn't sure about the light sensor.  I was thinking
> maybe an input device with some new absolute value reported?
Light sensing options are currently either /misc or /staging/iio/light.

There are several different interfaces unfortunately.  IIO can work with
a bridge (via uinput) to generate input events is that is what you need.
The interface is still a bit unstable, though it is getting cleaned up
at the moment.
> 
> Likewise with the PIR sensor, I notice there's a "gesture" input
> (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
Does it look like a button (e.g. is it a straight on off device with
no control parameters etc)? Dmitry, what would you put this as and would
this be acceptable in input?  

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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-09 12:43   ` Jonathan Cameron
@ 2010-09-09 22:46     ` Stuart Longland
  -1 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-09 22:46 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-arm-kernel, linux-kernel, Dmitry Torokhov, Mark Brown

On Thu, Sep 09, 2010 at 01:43:20PM +0100, Jonathan Cameron wrote:
> > For the temperature and light sensing... temperature sensors certainly
> > exist in the PC world, and maybe I should look closely at how they are
> > normally done, but I wasn't sure about the light sensor.  I was thinking
> > maybe an input device with some new absolute value reported?
> Light sensing options are currently either /misc or /staging/iio/light.
> 
> There are several different interfaces unfortunately.  IIO can work with
> a bridge (via uinput) to generate input events is that is what you need.
> The interface is still a bit unstable, though it is getting cleaned up
> at the moment.

That's fine.  Since I'm writing the driver from scratch, now is a good
time to put it in its rightful place first time.  I get a reading back
in lux, showing the ambient light detected by the sensor.

It'll be used for deciding whether to brighten up backlighting or turn
on LEDs on a camera, etc.  No specific interrupts or such like are
reported, but that could change.

This morning I also spotted the 'thermal' class, and thermal zones, that
looks like a good fit for the temperature sensor; which just measures
the temperature inside the chassis... in some cases next to components
to keep it warm at night.

hwmon seems like a good fit too.  I'll have a look.

> > Likewise with the PIR sensor, I notice there's a "gesture" input
> > (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
>
> Does it look like a button (e.g. is it a straight on off device with
> no control parameters etc)? Dmitry, what would you put this as and would
> this be acceptable in input?  

This I'm not sure of... there's a 16-bit field which reports some
numeric value (the doc I have doesn't mention a unit yet)... I think
this part of the controller is still being developed here.  I'll
probably receive an interrupt when movement is detected, and so that
could be a "button" I guess.

If you could imagine an intercom station on a street front, running
embedded Linux... the PIR sensor could alert the application to
someone's presence.  The question is how to best report this to the
application, ideally using standard interfaces that already exist.
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-09 22:46     ` Stuart Longland
  0 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-09 22:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 09, 2010 at 01:43:20PM +0100, Jonathan Cameron wrote:
> > For the temperature and light sensing... temperature sensors certainly
> > exist in the PC world, and maybe I should look closely at how they are
> > normally done, but I wasn't sure about the light sensor.  I was thinking
> > maybe an input device with some new absolute value reported?
> Light sensing options are currently either /misc or /staging/iio/light.
> 
> There are several different interfaces unfortunately.  IIO can work with
> a bridge (via uinput) to generate input events is that is what you need.
> The interface is still a bit unstable, though it is getting cleaned up
> at the moment.

That's fine.  Since I'm writing the driver from scratch, now is a good
time to put it in its rightful place first time.  I get a reading back
in lux, showing the ambient light detected by the sensor.

It'll be used for deciding whether to brighten up backlighting or turn
on LEDs on a camera, etc.  No specific interrupts or such like are
reported, but that could change.

This morning I also spotted the 'thermal' class, and thermal zones, that
looks like a good fit for the temperature sensor; which just measures
the temperature inside the chassis... in some cases next to components
to keep it warm at night.

hwmon seems like a good fit too.  I'll have a look.

> > Likewise with the PIR sensor, I notice there's a "gesture" input
> > (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
>
> Does it look like a button (e.g. is it a straight on off device with
> no control parameters etc)? Dmitry, what would you put this as and would
> this be acceptable in input?  

This I'm not sure of... there's a 16-bit field which reports some
numeric value (the doc I have doesn't mention a unit yet)... I think
this part of the controller is still being developed here.  I'll
probably receive an interrupt when movement is detected, and so that
could be a "button" I guess.

If you could imagine an intercom station on a street front, running
embedded Linux... the PIR sensor could alert the application to
someone's presence.  The question is how to best report this to the
application, ideally using standard interfaces that already exist.
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-09 12:43   ` Jonathan Cameron
@ 2010-09-10  6:32     ` Dmitry Torokhov
  -1 siblings, 0 replies; 17+ messages in thread
From: Dmitry Torokhov @ 2010-09-10  6:32 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: Stuart Longland, linux-arm-kernel, linux-kernel

On Thu, Sep 09, 2010 at 01:43:20PM +0100, Jonathan Cameron wrote:
> ....
> > 
> > Likewise with the PIR sensor, I notice there's a "gesture" input
> > (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
> Does it look like a button (e.g. is it a straight on off device with
> no control parameters etc)? Dmitry, what would you put this as and would
> this be acceptable in input?  

Phone guys made me add SW_FRONT_PROXIMITY at some point which is
supposed to be reported when someone covers phone screen with something
(puts into pocket or talks holding against the cheek). Could be used
here as well...

-- 
Dmitry

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-10  6:32     ` Dmitry Torokhov
  0 siblings, 0 replies; 17+ messages in thread
From: Dmitry Torokhov @ 2010-09-10  6:32 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 09, 2010 at 01:43:20PM +0100, Jonathan Cameron wrote:
> ....
> > 
> > Likewise with the PIR sensor, I notice there's a "gesture" input
> > (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
> Does it look like a button (e.g. is it a straight on off device with
> no control parameters etc)? Dmitry, what would you put this as and would
> this be acceptable in input?  

Phone guys made me add SW_FRONT_PROXIMITY at some point which is
supposed to be reported when someone covers phone screen with something
(puts into pocket or talks holding against the cheek). Could be used
here as well...

-- 
Dmitry

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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-09  5:01     ` Stuart Longland
  (?)
  (?)
@ 2010-09-10 20:47     ` Guenter Roeck
  -1 siblings, 0 replies; 17+ messages in thread
From: Guenter Roeck @ 2010-09-10 20:47 UTC (permalink / raw)
  To: linux-kernel

Stuart Longland <redhatter <at> gentoo.org> writes:

> 
> On Thu, Sep 09, 2010 at 02:48:26PM +1200, Ryan Mallon wrote:
> > On 09/09/2010 12:02 PM, Stuart Longland wrote:
> > > How are voltage *monitors* normally written?  (note, not voltage
> > > *regulators*... this thing does not alter the voltage rails.)  I tried
> > > to make sense of lm-sensors, but that seems very ad-hoc (maybe I missed
> > > some document that explains it) to me.  It's hard to be clear on what is
> > > the *right* way to report a voltage or current reading to userspace.
> > 
> > Depending on your particular application it might make sense to use the
> > power supply class (see Documentation/power/power_supply_class.txt) for
> > the voltage/current monitoring. If the temperature sensor is related to
> > a power supply monitor, then it could also go there.
> 
> Ahh okay, I'll have a look there..  The temperature isn't related to the
> power supply, so I might continue a searchfor its rightful place, but
> that class of devices seems like a good fit.

For voltage, current, and temperature monitoring, you should really look into
using using hwmon. The power supply class doesn't make sense to me, unless you
are actually monitoring a power supply and not a voltage. For multi-function
devices, you might also want to look into mfd for higher level access control.

If you have problems understanding what needs to be done, feel free to get in
touch. If the sysfs ABI is insufficient for your needs, just drop an e-mail to
the lm-sensors mailing list. Easier to extend an existing ABI than to write a
new one.

Guenter



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

* Re: Voltage/current/sensor monitoring interface and Wiegand
  2010-09-10  6:32     ` Dmitry Torokhov
@ 2010-09-13  1:13       ` Stuart Longland
  -1 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-13  1:13 UTC (permalink / raw)
  To: Dmitry Torokhov, Jonathan Cameron; +Cc: linux-arm-kernel, linux-kernel

On Thu, Sep 09, 2010 at 11:32:54PM -0700, Dmitry Torokhov wrote:
> On Thu, Sep 09, 2010 at 01:43:20PM +0100, Jonathan Cameron wrote:
> > ....
> > > 
> > > Likewise with the PIR sensor, I notice there's a "gesture" input
> > > (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
> > Does it look like a button (e.g. is it a straight on off device with
> > no control parameters etc)?

Had a discussion with a few of the people involved on Friday.  For all
intents and purposes, it will look like a "button".  Apparently with the
PIR sensor, nominally the value I get (which is a raw 10-bit reading
from an ADC) will be some high but mostly constant value.  When movement
is detected, it'll shoot up, then down, then settle back to where it
was.

At this point, the sensor controller will send an interrupt.  I can
consider this a "button press"... I suppose I can consider a button
release as being some time after the movement has ceased.  There is a
register that controls sensitivity.  I could make that a
sysfs-adjustable parameter, but ideally if there's a standard interface
for things like trigger sensitivity, I'd like to use that too.

> > Dmitry, what would you put this as and would
> > this be acceptable in input?  
> 
> Phone guys made me add SW_FRONT_PROXIMITY at some point which is
> supposed to be reported when someone covers phone screen with something
> (puts into pocket or talks holding against the cheek). Could be used
> here as well...

I'll have a hunt around for this SW_FRONT_PROXIMITY (it wasn't in kernel
2.6.28) and see if I can bring it in.  The idea here is that when
someone passes this entrance station, it can trigger the LCD/keypad to
light up, turn on security lights...etc.

Thanks for the advice.
Regards,
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

* Voltage/current/sensor monitoring interface and Wiegand
@ 2010-09-13  1:13       ` Stuart Longland
  0 siblings, 0 replies; 17+ messages in thread
From: Stuart Longland @ 2010-09-13  1:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Sep 09, 2010 at 11:32:54PM -0700, Dmitry Torokhov wrote:
> On Thu, Sep 09, 2010 at 01:43:20PM +0100, Jonathan Cameron wrote:
> > ....
> > > 
> > > Likewise with the PIR sensor, I notice there's a "gesture" input
> > > (MSC_GESTURE)... seems appropriate?  Or am I barking up the wrong tree?
> > Does it look like a button (e.g. is it a straight on off device with
> > no control parameters etc)?

Had a discussion with a few of the people involved on Friday.  For all
intents and purposes, it will look like a "button".  Apparently with the
PIR sensor, nominally the value I get (which is a raw 10-bit reading
from an ADC) will be some high but mostly constant value.  When movement
is detected, it'll shoot up, then down, then settle back to where it
was.

At this point, the sensor controller will send an interrupt.  I can
consider this a "button press"... I suppose I can consider a button
release as being some time after the movement has ceased.  There is a
register that controls sensitivity.  I could make that a
sysfs-adjustable parameter, but ideally if there's a standard interface
for things like trigger sensitivity, I'd like to use that too.

> > Dmitry, what would you put this as and would
> > this be acceptable in input?  
> 
> Phone guys made me add SW_FRONT_PROXIMITY at some point which is
> supposed to be reported when someone covers phone screen with something
> (puts into pocket or talks holding against the cheek). Could be used
> here as well...

I'll have a hunt around for this SW_FRONT_PROXIMITY (it wasn't in kernel
2.6.28) and see if I can bring it in.  The idea here is that when
someone passes this entrance station, it can trigger the LCD/keypad to
light up, turn on security lights...etc.

Thanks for the advice.
Regards,
-- 
Stuart Longland (aka Redhatter, VK4MSL)      .'''.
Gentoo Linux/MIPS Cobalt and Docs Developer  '.'` :
. . . . . . . . . . . . . . . . . . . . . .   .'.'
http://dev.gentoo.org/~redhatter             :.'

I haven't lost my mind...
  ...it's backed up on a tape somewhere.

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

end of thread, other threads:[~2010-09-13  1:13 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-09  0:02 Voltage/current/sensor monitoring interface and Wiegand Stuart Longland
2010-09-09  0:02 ` Stuart Longland
2010-09-09  2:48 ` Ryan Mallon
2010-09-09  2:48   ` Ryan Mallon
2010-09-09  5:01   ` Stuart Longland
2010-09-09  5:01     ` Stuart Longland
2010-09-09  8:29     ` Mark Brown
2010-09-09  8:29       ` Mark Brown
2010-09-10 20:47     ` Guenter Roeck
2010-09-09 12:43 ` Jonathan Cameron
2010-09-09 12:43   ` Jonathan Cameron
2010-09-09 22:46   ` Stuart Longland
2010-09-09 22:46     ` Stuart Longland
2010-09-10  6:32   ` Dmitry Torokhov
2010-09-10  6:32     ` Dmitry Torokhov
2010-09-13  1:13     ` Stuart Longland
2010-09-13  1:13       ` Stuart Longland

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.