Thread (28 messages) 28 messages, 7 authors, 2020-11-23

Re: [External] Using IIO to export laptop palm-sensor and lap-mode info to userspace?

From: Hans de Goede <hidden>
Date: 2020-11-23 12:16:37
Also in: linux-iio

Hi,

On 11/20/20 10:59 AM, Jonathan Cameron wrote:
On Thu, 19 Nov 2020 16:39:07 +0100
Hans de Goede [off-list ref] wrote:
quoted
quoted
quoted
quoted
quoted
quoted
quoted
On 2020-10-03 10:02 a.m., Hans de Goede wrote:  
quoted
Hi All,

Modern laptops can have various sensors which are kinda
like proximity sensors, but not really (they are more
specific in which part of the laptop the user is
proximate to).

Specifically modern Thinkpad's have 2 readings which we
want to export to userspace, and I'm wondering if we
could use the IIO framework for this since these readings
are in essence sensor readings:

1. These laptops have a sensor in the palm-rests to
check if a user is physically proximate to the device's
palm-rests. This info will be used by userspace for WWAN
functionality to control the transmission level safely.

A patch adding a thinkpad_acpi specific sysfs API for this
is currently pending:
https://patchwork.kernel.org/patch/11722127/

But I'm wondering if it would not be better to use
IIO to export this info.  
<snip>
quoted
quoted
On newer ARM we use "label" attribute in DTS:

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi

        ap_sar_sensor: proximity@28 {
                compatible = "semtech,sx9310";
                reg = <0x28>;
                #io-channel-cells = <1>;
                pinctrl-names = "default";
                pinctrl-0 = <&p_sensor_int_l>;

                interrupt-parent = <&tlmm>;
                interrupts = <24 IRQ_TYPE_LEVEL_LOW>;

                vdd-supply = <&pp3300_a>;
                svdd-supply = <&pp1800_prox>;

                status = "disabled";
                label = "proximity-wifi";
        };  
Hmm, interesting. I did not know iio-devices could
have a label sysfs attribute (nor that that could be
set through device-tree). I was thinking about adding
an in_proximity_location sysfs attribute. But using
labels (and standardizing a set of label names) will
work nicely too.
It's fairly new.   Note we also have per channel labels
though they are 'very new'.  Might be handy if the sensors
appear as a single device despite being spread over the
laptop.
Interesting, the thinkpad_acpi stuff currently has 2
proximity(ish) sensors:

1. Laptop is close to (on) someones lap
2. Someone's arms are resting on or close to the palmrest

Ideally we would indeed register 1 iio-dev with separate
channels for this, rather then having to register 2
(and the future maybe even more) iio-devs for this.

Can you give a pointer to docs / examples of using a
label per channel ?
quoted
Is there a know set of labels which ChromeOS is currently
using? If we are going to use labels for this it would
be good IMHO to define a set of standard labels for
this in say Documentation/ABI/testing/sysfs-bus-iio-labels.
If you do want to do this, please just put it under sysfs-bus-iio
doc.  I want this to be in the top level doc.
Ok, ack.

Dmitry, can you perhaps dig up a full-list of labels
which ChromeOS is currently using to identify
proximity sensors for e.g. SAR related use?

Regards,

Hans
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help