Thread (29 messages) 29 messages, 7 authors, 2025-10-21

Re: [PATCH v2 02/11] dt-bindings: hwmon: Add Apple System Management Controller hwmon schema

From: James Calligeros <hidden>
Date: 2025-09-28 00:46:28
Also in: asahi, linux-devicetree, linux-hwmon, linux-input, linux-rtc, lkml

Hi Rob,

On Friday, 26 September 2025 7:43:23 am Australian Eastern Standard Time Rob 
Herring wrote:
On Thu, Sep 25, 2025 at 3:49 PM Janne Grunau [off-list ref] wrote:
quoted
On Fri, Aug 29, 2025 at 11:40:57AM -0500, Rob Herring wrote:
quoted
This should be something like this:

"^current-[A-Za-z0-9]{4}$":
  $ref: "#/$defs/sensor"
  unevaluatedProperties: false

With the $defs/sensor being:

$defs:
  sensor:
    type: object
    
    properties:
      apple,key-id:
        $ref: /schemas/types.yaml#/definitions/string
        pattern: "^[A-Za-z0-9]{4}$"
        
        description:
          The SMC FourCC key of the desired sensor. Must match the
          node's suffix.
      
      label:
        description: Human-readable name for the sensor
    
    required:
      - apple,key-id
      - label

Though in general, 'label' should never be required being just for human
convenience.
That does not sound as it would be compatible with skipping nodes in the
driver if the node misses label. The driver could of course fall back
to create a hwmon sensors without labels.
The driver absolutely should.
The original submission (and our downstream version) do this, but I changed
it for v2 per Sven's feedback [1]. Outside of development/experimentation,
we will (should) never have a sensor in the Devicetree of uknown utility.
If we know what a sensor is for, then we should have a label for it.
quoted
I looks to me it would be a
stretch to call the presence of the labels human convenience.
Then it is an abuse of 'label". "label" is supposed to be literally
that. Matching a sticker on a port of a device.

If you need to associate a sensor with some other piece of h/w, then
that should be via a phandle or something.
I don't think doing so is particularly useful for this platform. Few of
the sensors that we know about are directly related to any one piece of 
hardware.
It's pretty much just the CPU cores and Broadcom module. The rest are things
like fans, palm rest area temperature sensors, ammeters and voltmeters for 
entire
rails, etc.

Even where we can reliably associate a sensor to a piece of hardware,
(e.g. the WiFi/BT board), doing so does not by itself do anything useful. We
still need to write a human-readable label for the sensor.

I was trying to avoid yet another vendor property, but would something like
'apple,sensor-label' work here?
Rob
James

[1]: https://lore.kernel.org/asahi/4a95cbf3-b3ae-4b26-8db2-dd5cf14a4c0c@kernel.org/ (local)


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