Skip to contentSkip to conversation

iio: documentation: Document proximity sensor label use

PATCH Superseded Hans de Goede 3 participants 11 messages Feb 7, 2021 – Feb 15, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 iio: documentation: Document proximity sensor label use

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Cc Dmitry Torokhov <[email protected]>
Cc Mark Pearson <[email protected]>
Cc Bastien Nocera <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +41 -0
index 35289d47d6cb..f2f090f8bd2f 100644
@@ -33,6 +33,47 @@ Description:
 		Description of the physical chip / device for device X.
 		Typically a part number.
 
+What:		/sys/bus/iio/devices/iio:deviceX/label
+What:		/sys/bus/iio/devices/iio:deviceX/in_*_label
+What:		/sys/bus/iio/devices/iio:deviceX/out_*_label
+KernelVersion:	5.8
+Contact:	[email protected]
+Description:
+		Optional symbolic label for a device or a channel.
+		This is useful for userspace to be able to better identify an
+		individual device or channel.
+
+		The contents of the label are free-form, but there are some
+		standardized uses:
+
+		For proximity sensors which give the proximity (of a person) to
+		a certain wlan or wwan antenna the following standardized labels
+		are used:
+
+		* "proximity-wifi"
+		* "proximity-lte"
+		* "proximity-wifi-lte"
+		* "proximity-wifi-left"
+		* "proximity-wifi-right"
+
+		These are used to indicate to userspace that these proximity
+		sensors may be used to tune transmit power to ensure that
+		Specific Absorption Rate (SAR) limits are honored.
+		The "-left" and "-right" labels are for devices with multiple
+		antennas.
+
+		In some laptops/tablets the standardized proximity sensor labels
+		instead	indicate proximity to a specific part of the device:
+
+		* "proximity-palmrest" indicates proximity to the keyboard's palmrest
+		* "proximity-palmrest-left" indicates proximity to the left part of the palmrest
+		* "proximity-palmrest-right" indicates proximity to the right part of the palmrest
+		* "proximity-lap" indicates the device is being used on someone's lap
+
+		Note "proximity-lap" is special in that its value may be
+		calculated by firmware from other sensor readings, rather then
+		being a raw sensor reading.
+
 What:		/sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
 KernelVersion:	4.5
 Contact:	[email protected]
Signature · 1 line
2.30.0
#1 lore raw

PATCH 2/2 iio: documentation: Document accelerometer label use

Some 2-in-1 laptops / convertibles with 360° (yoga-style) hinges, have 2 accelerometers, 1 in their base and 1 in their display.

In many cases the kernel can detect the location of each accelerometer based on e.g. information from the ACPI tables.

It is important for userspace to know the location of the 2 accelerometers. Rather then adding a new sysfs-attribute for this we can relay this information to userspace by using standardized label strings for this. This mirrors how this is done for proximity sensors.

This commit documents 2 new standardized label strings for this purpose:
"accel-base"
"accel-display"

Note the "base" and "display" suffixes were chosen to match the values used for the systemd/udev hwdb.d/60-sensor.hwdb file's ACCEL_LOCATION property.

Cc Dmitry Torokhov <[email protected]>
Cc Mark Pearson <[email protected]>
Cc Bastien Nocera <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +7 -0
index f2f090f8bd2f..a39a1c25488e 100644
@@ -74,6 +74,13 @@ Description:
 		calculated by firmware from other sensor readings, rather then
 		being a raw sensor reading.
 
+		For accelerometers used in 2-in-1s with 360° (yoga-style) hinges,
+		which have an accelerometer in both their base and their display,
+		the following standardized labels are used:
+
+		* "accel-base"
+		* "accel-display"
+
 What:		/sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
 KernelVersion:	4.5
 Contact:	[email protected]
Signature · 1 line
2.30.0
#2 lore raw
In reply to Hans de Goede
Quoted 10 lines · Hans de Goede

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

Quoted 8 lines

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Both patches in the series look fine to me.

Is IIO the interface you plan on using to implement the lap detection for the thinkpad_acpi driver?

If so, don't forget to set the "nearlevel" property as well. I'll probably have to write a new iio-sensor-proxy driver for those as well, without the hardware. That'll be interesting ;)

Cheers

#3 lore raw

Hi,

Quoted 16 lines · Bastien Nocera
Quoted 15 lines · Hans de Goede

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

Quoted 5 lines
Quoted 3 lines

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Both patches in the series look fine to me.

Thank you for checking.

Quoted 2 lines

Is IIO the interface you plan on using to implement the lap detection for the thinkpad_acpi driver?

ATM both the lap detection and the palmrest proximity detection are already available using thinkpad_acpi specific sysfs attributes:

[hans@x1 linux]$ cat /sys/bus/platform/devices/thinkpad_acpi/dytc_lapmode 0
[hans@x1 linux]$ cat /sys/bus/platform/devices/thinkpad_acpi/palmsensor 1

Which I think you are already aware of ? These will not be going anywhere since dropping these would be a userspace ABI break.

With that said, yes the plan is to extend the thinkpad_acpi driver to also report lap / palmrest proximity through IIO using these labels.

With the idea being that if other drivers / vendor firmwares also will export similar readings that those will then also use IIO with these labels for this, so that there is one unified / driver independent interface which userspace can use to get these readings.

Quoted 1 line

If so, don't forget to set the "nearlevel" property as well.

Ack, I'll make sure that you are on the Cc when the patches for this get posted.

Regards,

Hans

#4 lore raw
Quoted 40 lines · Hans de Goede

Hi,

Quoted 20 lines · Bastien Nocera
Quoted 19 lines · Hans de Goede

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity
sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors
which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in
this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

Quoted 7 lines
Quoted 5 lines

And the "proximity-palmrest" and "proximity-lap" labels are intended
to be used with the lap and palmrest sensors found in recent Lenovo
ThinkPad models.

Both patches in the series look fine to me.

Thank you for checking.

Quoted 3 lines

Is IIO the interface you plan on using to implement the lap detection
for the thinkpad_acpi driver?

ATM both the lap detection and the palmrest proximity detection are already available using thinkpad_acpi specific sysfs attributes:

Quoted 8 lines

[hans@x1 linux]$ cat /sys/bus/platform/devices/thinkpad_acpi/dytc_lapmode 0
[hans@x1 linux]$ cat /sys/bus/platform/devices/thinkpad_acpi/palmsensor 1

Which I think you are already aware of ?

I didn't know those actually landed upstream (or I didn't remember), I was waiting on the SW_LAP_PROXIMITY input device method to land:
https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/merge_requests/42

That's abandoned, right?

Quoted 6 lines

  These will not be going
anywhere since dropping these would be a userspace ABI break.

With that said, yes the plan is to extend the thinkpad_acpi driver to also report lap / palmrest proximity through IIO using these labels.

OK, good to know.

I've filed:
https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/321
so we can eventually export more than a single proximity sensor through the D-Bus interface in the future.

Cheers

#5 lore raw

Hi,

Quoted 48 lines · Bastien Nocera
Quoted 47 lines · Hans de Goede

Hi,

Quoted 20 lines · Bastien Nocera
Quoted 19 lines · Hans de Goede

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity
sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors
which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in
this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

Quoted 7 lines
Quoted 5 lines

And the "proximity-palmrest" and "proximity-lap" labels are intended
to be used with the lap and palmrest sensors found in recent Lenovo
ThinkPad models.

Both patches in the series look fine to me.

Thank you for checking.

Quoted 3 lines

Is IIO the interface you plan on using to implement the lap detection
for the thinkpad_acpi driver?

ATM both the lap detection and the palmrest proximity detection are already available using thinkpad_acpi specific sysfs attributes:

[hans@x1 linux]$ cat /sys/bus/platform/devices/thinkpad_acpi/dytc_lapmode 0
[hans@x1 linux]$ cat /sys/bus/platform/devices/thinkpad_acpi/palmsensor 1

Quoted 7 lines
Quoted 1 line

Which I think you are already aware of ?

I didn't know those actually landed upstream (or I didn't remember), I was waiting on the SW_LAP_PROXIMITY input device method to land:
https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/merge_requests/42

That's abandoned, right?

Yes that has been abandoned, sorry.

Quoted 7 lines
Quoted 6 lines

  These will not be going
anywhere since dropping these would be a userspace ABI break.

With that said, yes the plan is to extend the thinkpad_acpi driver to also report lap / palmrest proximity through IIO using these labels.

Quoted 6 lines

OK, good to know.

I've filed:
https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/321
so we can eventually export more than a single proximity sensor through the D-Bus interface in the future.

Ok.

Regards,

Hans

maintainer
#6 lore raw
In reply to Hans de Goede
Quoted 32 lines · On Sun, 7 Feb 2021 13:37:19 +0100 Hans de Goede <[email protected]> wrote:

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Cc Dmitry Torokhov <[email protected]>
Cc Mark Pearson <[email protected]>
Cc Bastien Nocera <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +0 -0
index 35289d47d6cb..f2f090f8bd2f 100644

Documentation/ABI/testing/sysfs-bus-iio Description: · line 38

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-iio +3 -0
@@ -33,6 +33,47 @@ Description:
 		Description of the physical chip / device for device X.
 		Typically a part number.
 
+What:		/sys/bus/iio/devices/iio:deviceX/label
+What:		/sys/bus/iio/devices/iio:deviceX/in_*_label
+What:		/sys/bus/iio/devices/iio:deviceX/out_*_label

I was a bit in two minds about this from an organizational point of view.
1) Whether to separate the general label where position tends to make sense from the channel labels. May be something we want to do in future but we can probably let that go for now.
2) Whether to allow such broad wild cards for the channels.
Whilst in theory any channel can have a label we normally only document ABI that actually exists (mostly to know what we might break if we change anything :) Still I can't see any way we can change this without breakage so in this one case let's let the broad wild card go in.

This comes unstuck on the fact it overlaps with existing more specific Docs.

So can you pull the channel part out of here for v2. /sys/bus/iio/devices/iio:deviceX/in_voltageY_label /sys/bus/iio/devices/iio:deviceX/in_anglY_label

The reason to keep these separate is that they will often contain a bit more info about specific driver ABI (because of the issues with duplicating ABI documentation in multiple files) so I'd rather we didn't end up with this one item having many pages of info.

Jonathan

Jonathan

Quoted 41 lines
Documentation/ABI/testing/sysfs-bus-iio +38 -0
+KernelVersion:	5.8
+Contact:	[email protected]
+Description:
+		Optional symbolic label for a device or a channel.
+		This is useful for userspace to be able to better identify an
+		individual device or channel.
+
+		The contents of the label are free-form, but there are some
+		standardized uses:
+
+		For proximity sensors which give the proximity (of a person) to
+		a certain wlan or wwan antenna the following standardized labels
+		are used:
+
+		* "proximity-wifi"
+		* "proximity-lte"
+		* "proximity-wifi-lte"
+		* "proximity-wifi-left"
+		* "proximity-wifi-right"
+
+		These are used to indicate to userspace that these proximity
+		sensors may be used to tune transmit power to ensure that
+		Specific Absorption Rate (SAR) limits are honored.
+		The "-left" and "-right" labels are for devices with multiple
+		antennas.
+
+		In some laptops/tablets the standardized proximity sensor labels
+		instead	indicate proximity to a specific part of the device:
+
+		* "proximity-palmrest" indicates proximity to the keyboard's palmrest
+		* "proximity-palmrest-left" indicates proximity to the left part of the palmrest
+		* "proximity-palmrest-right" indicates proximity to the right part of the palmrest
+		* "proximity-lap" indicates the device is being used on someone's lap
+
+		Note "proximity-lap" is special in that its value may be
+		calculated by firmware from other sensor readings, rather then
+		being a raw sensor reading.
+
 What:		/sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
 KernelVersion:	4.5
 Contact:	[email protected]
#7 lore raw

Hi,

Quoted 52 lines · Jonathan Cameron
Quoted 32 lines · On Sun, 7 Feb 2021 13:37:19 +0100 Hans de Goede <[email protected]> wrote:

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Cc Dmitry Torokhov <[email protected]>
Cc Mark Pearson <[email protected]>
Cc Bastien Nocera <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +0 -0
index 35289d47d6cb..f2f090f8bd2f 100644

Documentation/ABI/testing/sysfs-bus-iio Description: · line 38

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-iio +3 -0
@@ -33,6 +33,47 @@ Description:
 		Description of the physical chip / device for device X.
 		Typically a part number.
 
+What:		/sys/bus/iio/devices/iio:deviceX/label
+What:		/sys/bus/iio/devices/iio:deviceX/in_*_label
+What:		/sys/bus/iio/devices/iio:deviceX/out_*_label

I was a bit in two minds about this from an organizational point of view.
1) Whether to separate the general label where position tends to make sense from the channel labels. May be something we want to do in future but we can probably let that go for now.
2) Whether to allow such broad wild cards for the channels.
Whilst in theory any channel can have a label we normally only document ABI that actually exists (mostly to know what we might break if we change anything :) Still I can't see any way we can change this without breakage so in this one case let's let the broad wild card go in.

Quoted 5 lines

This comes unstuck on the fact it overlaps with existing more specific Docs.

So can you pull the channel part out of here for v2. /sys/bus/iio/devices/iio:deviceX/in_voltageY_label /sys/bus/iio/devices/iio:deviceX/in_anglY_label

The problem is that these labels may either be used on a whole device, which is certainly the case with the accelerometers in patch 2/2 where the x y and z channels obviously all are either "accel-base" or "accel-display".

Where as for proximity sensors the labels could be either applied at the device level, or at a channel level.

The existing chromebook proximity usage is applying a label for this at the device level.

This does mean that atm all users of this are using device-level labels; and maybe I'm reading too much in your request. I guess that for now I can just drop these lines for v2 :

What: /sys/bus/iio/devices/iio:deviceX/in_*_label
What: /sys/bus/iio/devices/iio:deviceX/out_*_label

Is that what you have in mind ?

Or do you want me to split this up in a proximity sensor case and an accel case, and group both cases together with other proximity / accel sensor attributes ?

Regards,

Hans

Quoted 43 lines

Jonathan

Quoted 41 lines
Documentation/ABI/testing/sysfs-bus-iio +38 -0
+KernelVersion:	5.8
+Contact:	[email protected]
+Description:
+		Optional symbolic label for a device or a channel.
+		This is useful for userspace to be able to better identify an
+		individual device or channel.
+
+		The contents of the label are free-form, but there are some
+		standardized uses:
+
+		For proximity sensors which give the proximity (of a person) to
+		a certain wlan or wwan antenna the following standardized labels
+		are used:
+
+		* "proximity-wifi"
+		* "proximity-lte"
+		* "proximity-wifi-lte"
+		* "proximity-wifi-left"
+		* "proximity-wifi-right"
+
+		These are used to indicate to userspace that these proximity
+		sensors may be used to tune transmit power to ensure that
+		Specific Absorption Rate (SAR) limits are honored.
+		The "-left" and "-right" labels are for devices with multiple
+		antennas.
+
+		In some laptops/tablets the standardized proximity sensor labels
+		instead	indicate proximity to a specific part of the device:
+
+		* "proximity-palmrest" indicates proximity to the keyboard's palmrest
+		* "proximity-palmrest-left" indicates proximity to the left part of the palmrest
+		* "proximity-palmrest-right" indicates proximity to the right part of the palmrest
+		* "proximity-lap" indicates the device is being used on someone's lap
+
+		Note "proximity-lap" is special in that its value may be
+		calculated by firmware from other sensor readings, rather then
+		being a raw sensor reading.
+
 What:		/sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
 KernelVersion:	4.5
 Contact:	[email protected]
maintainer
#8 lore raw
Quoted 66 lines · On Fri, 12 Feb 2021 19:58:47 +0100 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 52 lines · Jonathan Cameron
Quoted 32 lines · On Sun, 7 Feb 2021 13:37:19 +0100 Hans de Goede <[email protected]> wrote:

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Cc Dmitry Torokhov <[email protected]>
Cc Mark Pearson <[email protected]>
Cc Bastien Nocera <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +0 -0
index 35289d47d6cb..f2f090f8bd2f 100644

Documentation/ABI/testing/sysfs-bus-iio Description: · line 38

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-iio +3 -0
@@ -33,6 +33,47 @@ Description:
 		Description of the physical chip / device for device X.
 		Typically a part number.
 
+What:		/sys/bus/iio/devices/iio:deviceX/label
+What:		/sys/bus/iio/devices/iio:deviceX/in_*_label
+What:		/sys/bus/iio/devices/iio:deviceX/out_*_label  

I was a bit in two minds about this from an organizational point of view.
1) Whether to separate the general label where position tends to make sense from the channel labels. May be something we want to do in future but we can probably let that go for now.
2) Whether to allow such broad wild cards for the channels.
Whilst in theory any channel can have a label we normally only document ABI that actually exists (mostly to know what we might break if we change anything :) Still I can't see any way we can change this without breakage so in this one case let's let the broad wild card go in.

Quoted 5 lines

This comes unstuck on the fact it overlaps with existing more specific Docs.

So can you pull the channel part out of here for v2. /sys/bus/iio/devices/iio:deviceX/in_voltageY_label /sys/bus/iio/devices/iio:deviceX/in_anglY_label

The problem is that these labels may either be used on a whole device, which is certainly the case with the accelerometers in patch 2/2 where the x y and z channels obviously all are either "accel-base" or "accel-display".

Quoted 7 lines

Where as for proximity sensors the labels could be either applied at the device level, or at a channel level.

The existing chromebook proximity usage is applying a label for this at the device level.

This does mean that atm all users of this are using device-level labels;

Not at all, but some (possibly all?) are separately documented in two existing entries. The generic version you propose overlaps with them and that is what I'd like to avoid.

We could group these into the same 'catch all' element, but I suspect the text will just grow too large over time, so I'd like to keep them as broken up as possible.

What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_label
What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_label

What: /sys/bus/iio/devices/iio:deviceX/in_anglY_label

Quoted 11 lines

and maybe I'm reading too much in your request. I guess that for now I can just drop these lines for v2 :

What: /sys/bus/iio/devices/iio:deviceX/in_*_label
What: /sys/bus/iio/devices/iio:deviceX/out_*_label

Is that what you have in mind ?

Or do you want me to split this up in a proximity sensor case and an accel case, and group both cases together with other proximity / accel sensor attributes ?

Yes, that would be ideal for the cases where we have separate channel labels, but if we aren't using them today, lets introduce them when they are needed.

Jonathan

Quoted 52 lines

Regards,

Hans

Quoted 43 lines

Jonathan

Quoted 41 lines
Documentation/ABI/testing/sysfs-bus-iio +38 -0
+KernelVersion:	5.8
+Contact:	[email protected]
+Description:
+		Optional symbolic label for a device or a channel.
+		This is useful for userspace to be able to better identify an
+		individual device or channel.
+
+		The contents of the label are free-form, but there are some
+		standardized uses:
+
+		For proximity sensors which give the proximity (of a person) to
+		a certain wlan or wwan antenna the following standardized labels
+		are used:
+
+		* "proximity-wifi"
+		* "proximity-lte"
+		* "proximity-wifi-lte"
+		* "proximity-wifi-left"
+		* "proximity-wifi-right"
+
+		These are used to indicate to userspace that these proximity
+		sensors may be used to tune transmit power to ensure that
+		Specific Absorption Rate (SAR) limits are honored.
+		The "-left" and "-right" labels are for devices with multiple
+		antennas.
+
+		In some laptops/tablets the standardized proximity sensor labels
+		instead	indicate proximity to a specific part of the device:
+
+		* "proximity-palmrest" indicates proximity to the keyboard's palmrest
+		* "proximity-palmrest-left" indicates proximity to the left part of the palmrest
+		* "proximity-palmrest-right" indicates proximity to the right part of the palmrest
+		* "proximity-lap" indicates the device is being used on someone's lap
+
+		Note "proximity-lap" is special in that its value may be
+		calculated by firmware from other sensor readings, rather then
+		being a raw sensor reading.
+
 What:		/sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
 KernelVersion:	4.5
 Contact:	[email protected]  
#9 lore raw

Hi,

Quoted 98 lines · Jonathan Cameron
Quoted 66 lines · On Fri, 12 Feb 2021 19:58:47 +0100 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 52 lines · Jonathan Cameron
Quoted 32 lines · On Sun, 7 Feb 2021 13:37:19 +0100 Hans de Goede <[email protected]> wrote:

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Cc Dmitry Torokhov <[email protected]>
Cc Mark Pearson <[email protected]>
Cc Bastien Nocera <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +0 -0
index 35289d47d6cb..f2f090f8bd2f 100644

Documentation/ABI/testing/sysfs-bus-iio Description: · line 38

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-iio +3 -0
@@ -33,6 +33,47 @@ Description:
 		Description of the physical chip / device for device X.
 		Typically a part number.
 
+What:		/sys/bus/iio/devices/iio:deviceX/label
+What:		/sys/bus/iio/devices/iio:deviceX/in_*_label
+What:		/sys/bus/iio/devices/iio:deviceX/out_*_label  

I was a bit in two minds about this from an organizational point of view.
1) Whether to separate the general label where position tends to make sense from the channel labels. May be something we want to do in future but we can probably let that go for now.
2) Whether to allow such broad wild cards for the channels.
Whilst in theory any channel can have a label we normally only document ABI that actually exists (mostly to know what we might break if we change anything :) Still I can't see any way we can change this without breakage so in this one case let's let the broad wild card go in.

Quoted 5 lines

This comes unstuck on the fact it overlaps with existing more specific Docs.

So can you pull the channel part out of here for v2. /sys/bus/iio/devices/iio:deviceX/in_voltageY_label /sys/bus/iio/devices/iio:deviceX/in_anglY_label

The problem is that these labels may either be used on a whole device, which is certainly the case with the accelerometers in patch 2/2 where the x y and z channels obviously all are either "accel-base" or "accel-display".

Quoted 7 lines

Where as for proximity sensors the labels could be either applied at the device level, or at a channel level.

The existing chromebook proximity usage is applying a label for this at the device level.

This does mean that atm all users of this are using device-level labels;

Not at all, but some (possibly all?) are separately documented in two existing entries. The generic version you propose overlaps with them and that is what I'd like to avoid.

We could group these into the same 'catch all' element, but I suspect the text will just grow too large over time, so I'd like to keep them as broken up as possible.

What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_label
What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_label

What: /sys/bus/iio/devices/iio:deviceX/in_anglY_label

Quoted 8 lines

and maybe I'm reading too much in your request. I guess that for now I can just drop these lines for v2 :

What: /sys/bus/iio/devices/iio:deviceX/in_*_label
What: /sys/bus/iio/devices/iio:deviceX/out_*_label

Is that what you have in mind ?

Quoted 7 lines
Quoted 3 lines

Or do you want me to split this up in a proximity sensor case and an accel case, and group both cases together with other proximity / accel sensor attributes ?

Yes, that would be ideal for the cases where we have separate channel labels, but if we aren't using them today, lets introduce them when they are needed.

Right, so atm we do not have any channel labels only device labels, which means there is only 1 "What:".

What: /sys/bus/iio/devices/iio:deviceX/label

For which v1 (this version) of this series adds a single large text block which covers both proximity and accelerometers.

So just to be clear, you want me to split this, resulting in 2 entries with identical "What:" labels:

What: /sys/bus/iio/devices/iio:deviceX/label

And then group the 2 text blocks together with other proximity sensor attributes, resp. other accelerometer attributes ?

Regards,

Hans

Quoted 57 lines

Jonathan

Quoted 52 lines

Regards,

Hans

Quoted 43 lines

Jonathan

Quoted 41 lines
Documentation/ABI/testing/sysfs-bus-iio +38 -0
+KernelVersion:	5.8
+Contact:	[email protected]
+Description:
+		Optional symbolic label for a device or a channel.
+		This is useful for userspace to be able to better identify an
+		individual device or channel.
+
+		The contents of the label are free-form, but there are some
+		standardized uses:
+
+		For proximity sensors which give the proximity (of a person) to
+		a certain wlan or wwan antenna the following standardized labels
+		are used:
+
+		* "proximity-wifi"
+		* "proximity-lte"
+		* "proximity-wifi-lte"
+		* "proximity-wifi-left"
+		* "proximity-wifi-right"
+
+		These are used to indicate to userspace that these proximity
+		sensors may be used to tune transmit power to ensure that
+		Specific Absorption Rate (SAR) limits are honored.
+		The "-left" and "-right" labels are for devices with multiple
+		antennas.
+
+		In some laptops/tablets the standardized proximity sensor labels
+		instead	indicate proximity to a specific part of the device:
+
+		* "proximity-palmrest" indicates proximity to the keyboard's palmrest
+		* "proximity-palmrest-left" indicates proximity to the left part of the palmrest
+		* "proximity-palmrest-right" indicates proximity to the right part of the palmrest
+		* "proximity-lap" indicates the device is being used on someone's lap
+
+		Note "proximity-lap" is special in that its value may be
+		calculated by firmware from other sensor readings, rather then
+		being a raw sensor reading.
+
 What:		/sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
 KernelVersion:	4.5
 Contact:	[email protected]  
maintainer
#10 lore raw
Quoted 117 lines · On Mon, 15 Feb 2021 13:55:09 +0100 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 98 lines · Jonathan Cameron
Quoted 66 lines · On Fri, 12 Feb 2021 19:58:47 +0100 Hans de Goede <[email protected]> wrote:

Hi,

Quoted 52 lines · Jonathan Cameron
Quoted 32 lines · On Sun, 7 Feb 2021 13:37:19 +0100 Hans de Goede <[email protected]> wrote:

Add an entry to Documentation/ABI/testing/sysfs-bus-iio for the new device and channel label sysfs-attribute support.

And document the standardized labels which may be used with proximity sensors to hint userspace about the intended use of the sensor.

Using labels to differentiate between the multiple proximity sensors which a modern laptop/tablet may have was discussed in this thread:
https://lore.kernel.org/linux-iio/[email protected]/

As mentioned the "proximity-wifi*" labels are already being used in this manner on some chromebooks, see e.g.:
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi arch/arm64/boot/dts/qcom/sc7180-trogdor-lte-sku.dtsi

And the "proximity-palmrest" and "proximity-lap" labels are intended to be used with the lap and palmrest sensors found in recent Lenovo ThinkPad models.

Cc Dmitry Torokhov <[email protected]>
Cc Mark Pearson <[email protected]>
Cc Bastien Nocera <[email protected]>
---
 Documentation/ABI/testing/sysfs-bus-iio | 41 +++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
Documentation/ABI/testing/sysfs-bus-iio +0 -0
index 35289d47d6cb..f2f090f8bd2f 100644

Documentation/ABI/testing/sysfs-bus-iio Description: · line 38

Quoted 6 lines
Documentation/ABI/testing/sysfs-bus-iio +3 -0
@@ -33,6 +33,47 @@ Description:
 		Description of the physical chip / device for device X.
 		Typically a part number.
 
+What:		/sys/bus/iio/devices/iio:deviceX/label
+What:		/sys/bus/iio/devices/iio:deviceX/in_*_label
+What:		/sys/bus/iio/devices/iio:deviceX/out_*_label    

I was a bit in two minds about this from an organizational point of view.
1) Whether to separate the general label where position tends to make sense from the channel labels. May be something we want to do in future but we can probably let that go for now.
2) Whether to allow such broad wild cards for the channels.
Whilst in theory any channel can have a label we normally only document ABI that actually exists (mostly to know what we might break if we change anything :) Still I can't see any way we can change this without breakage so in this one case let's let the broad wild card go in.

Quoted 5 lines

This comes unstuck on the fact it overlaps with existing more specific Docs.

So can you pull the channel part out of here for v2. /sys/bus/iio/devices/iio:deviceX/in_voltageY_label /sys/bus/iio/devices/iio:deviceX/in_anglY_label

The problem is that these labels may either be used on a whole device, which is certainly the case with the accelerometers in patch 2/2 where the x y and z channels obviously all are either "accel-base" or "accel-display".

Quoted 7 lines

Where as for proximity sensors the labels could be either applied at the device level, or at a channel level.

The existing chromebook proximity usage is applying a label for this at the device level.

This does mean that atm all users of this are using device-level labels;

Not at all, but some (possibly all?) are separately documented in two existing entries. The generic version you propose overlaps with them and that is what I'd like to avoid.

We could group these into the same 'catch all' element, but I suspect the text will just grow too large over time, so I'd like to keep them as broken up as possible.

What: /sys/bus/iio/devices/iio:deviceX/in_voltageY_label
What: /sys/bus/iio/devices/iio:deviceX/out_voltageY_label

What: /sys/bus/iio/devices/iio:deviceX/in_anglY_label

Quoted 8 lines

and maybe I'm reading too much in your request. I guess that for now I can just drop these lines for v2 :

What: /sys/bus/iio/devices/iio:deviceX/in_*_label
What: /sys/bus/iio/devices/iio:deviceX/out_*_label

Is that what you have in mind ?

Quoted 7 lines
Quoted 3 lines

Or do you want me to split this up in a proximity sensor case and an accel case, and group both cases together with other proximity / accel sensor attributes ?

Yes, that would be ideal for the cases where we have separate channel labels, but if we aren't using them today, lets introduce them when they are needed.

Right, so atm we do not have any channel labels only device labels, which means there is only 1 "What:".

What: /sys/bus/iio/devices/iio:deviceX/label

For which v1 (this version) of this series adds a single large text block which covers both proximity and accelerometers.

Quoted 7 lines

So just to be clear, you want me to split this, resulting in 2 entries with identical "What:" labels:

What: /sys/bus/iio/devices/iio:deviceX/label

And then group the 2 text blocks together with other proximity sensor attributes, resp. other accelerometer attributes ?

No, sorry I wasn't clear.

1 entry only for the /label version (as we can't have repeats without breaking inclusion in the html docs).

For the ones where we can be more specific keep them separate when we add them.
i.e. in_proximityX_label vs in_accel_x_label

Jonathan

Quoted 69 lines

Regards,

Hans

Quoted 57 lines

Jonathan

Quoted 52 lines

Regards,

Hans

Quoted 43 lines

Jonathan

Quoted 41 lines
Documentation/ABI/testing/sysfs-bus-iio +38 -0
+KernelVersion:	5.8
+Contact:	[email protected]
+Description:
+		Optional symbolic label for a device or a channel.
+		This is useful for userspace to be able to better identify an
+		individual device or channel.
+
+		The contents of the label are free-form, but there are some
+		standardized uses:
+
+		For proximity sensors which give the proximity (of a person) to
+		a certain wlan or wwan antenna the following standardized labels
+		are used:
+
+		* "proximity-wifi"
+		* "proximity-lte"
+		* "proximity-wifi-lte"
+		* "proximity-wifi-left"
+		* "proximity-wifi-right"
+
+		These are used to indicate to userspace that these proximity
+		sensors may be used to tune transmit power to ensure that
+		Specific Absorption Rate (SAR) limits are honored.
+		The "-left" and "-right" labels are for devices with multiple
+		antennas.
+
+		In some laptops/tablets the standardized proximity sensor labels
+		instead	indicate proximity to a specific part of the device:
+
+		* "proximity-palmrest" indicates proximity to the keyboard's palmrest
+		* "proximity-palmrest-left" indicates proximity to the left part of the palmrest
+		* "proximity-palmrest-right" indicates proximity to the right part of the palmrest
+		* "proximity-lap" indicates the device is being used on someone's lap
+
+		Note "proximity-lap" is special in that its value may be
+		calculated by firmware from other sensor readings, rather then
+		being a raw sensor reading.
+
 What:		/sys/bus/iio/devices/iio:deviceX/current_timestamp_clock
 KernelVersion:	4.5
 Contact:	[email protected]