On Sun, May 1, 2022 at 10:09 AM Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > > On Fri, 29 Apr 2022 15:01:41 -0700 > Gwendal Grignou <gwendal@xxxxxxxxxxxx> wrote: > > > Allow setting the configure the input analog gain. > > > > Signed-off-by: Gwendal Grignou <gwendal@xxxxxxxxxxxx> > > Hi Gwendal. > > So, my immediate thought on this is whether it make sense as a > dt controlled thing or not. It's the sort of thing hardwaregain > is for in the userspace ABI. However, I see that's already > in use for the digital gain. This one also unhelpfully applies > to all changes whereas the digital gain is pair wise. Hence > there is basically no way we can map the two controls to a > single ABI element. > > So, how would we expect a board designer to set this value? > > If the answer is we basically have no idea but some boards do > want it set then I'm fine with this basically being a somewhat magic > value that is in some vague way associated with the antenna setup... More or less :-). All these parameters are set with the help of Semtech application engineers. The input analog gain is directly linked to the antenna design, as it is used by the AFE (Analog Front End). The hardwaregain (aka digital gain) comes second during the digital processing. We could have put all the settings in the device tree, as we don't expect changes once the values are satisfactory to pass regulatory testings, but the hybrid approach still allows some tinkering: I've use to get a sense of the data amplitude when collecting data with /dev/iio:devoceX. > > Jonathan > > > --- > > New in v5. > > > > .../bindings/iio/proximity/semtech,sx9324.yaml | 11 +++++++++++ > > 1 file changed, 11 insertions(+) > > > > diff --git a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml > > index 0be87ac05b97a..d265eb5258c84 100644 > > --- a/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml > > +++ b/Documentation/devicetree/bindings/iio/proximity/semtech,sx9324.yaml > > @@ -143,6 +143,17 @@ properties: > > description: > > Pre-charge input resistance in Ohm. > > > > + semtech,input-analog-gain: > > + $ref: /schemas/types.yaml#/definitions/uint32 > > + minimum: 0 > > + maximum: 3 > > + description: | > > + Defines the input antenna analog gain > > + 0: x1.247 > > + 1: x1 (default) > > + 2: x0.768 > > + 3: x0.552 > > + > > required: > > - compatible > > - reg >