Re: [PATCH 1/2] dt-bindings: iio: magnetometer: add ti tmag5273 documentation file

From: Michael Riesch
Date: Thu Nov 17 2022 - 12:02:09 EST


Hi Krzysztof,

On 11/17/22 17:17, Krzysztof Kozlowski wrote:
> On 17/11/2022 17:12, Gerald Loacker wrote:
>>>
>>>> +
>>>> + compatible:
>>>> + const: ti,tmag5273
>>>> +
>>>> + reg:
>>>> + maxItems: 1
>>>> +
>>>> + "#io-channel-cells":
>>>> + const: 1
>>>> +
>>>> + ti,angle-enable:
>>>> + description:
>>>> + Enables angle measurement in the selected plane.
>>>> + 0 = OFF
>>>> + 1 = X-Y (default)
>>>> + 2 = Y-Z
>>>> + 3 = X-Z
>>>
>>> This feels like something we should be configuring at runtime rather that
>>> DT, or is it driven by board design or similar?
>>>
>>
>> We use this sensor for a zoom wheel application, there is an EVM from TI
>> for this as well. So this is for setting the mounting position of the wheel.
>
> That's ok, but does not explain why choice of angle measurement should
> be a property of the hardware. I could imagine configuring device to
> measure sometimes X-Y and sometimes X-Z, depending on the use case. Use
> case can change runtime.

If I may chime in here: in our use case the angle channel is used
directly as an input to adc-joystick, so that the combination of the two
is an input device. We feel that in this scenario this angle measurement
setting *has* to be a hardware property because the correct function of
the input device depends on the correct choice of the angle property
(which does not change during runtime, of course).

If we were to create a different input device in which the magnetometer
was tilted by 90° (for example), then the angle property could be easily
changed in the device tree. The user space, on the other hand, couldn't
possibly know the correct angle property.

That said, I agree that there may be use cases in which the angle
property should be changed during runtime. Would it be acceptable to
create an IIO property that is initialized by the device tree property?
(Please note that the implementation of the IIO property may not be in
our scope, though)

Best regards,
Michael