Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Abhash Jha <abhashkumarjha123@gmail.com>
Cc: linux-iio@vger.kernel.org, lars@metafoo.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: light: apds9960: Add proximity and gesture offset calibration
Date: Sun, 7 Jul 2024 17:13:57 +0100	[thread overview]
Message-ID: <20240707171357.709d9e35@jic23-huawei> (raw)
In-Reply-To: <20240702115648.160511-1-abhashkumarjha123@gmail.com>

On Tue,  2 Jul 2024 17:26:48 +0530
Abhash Jha <abhashkumarjha123@gmail.com> wrote:

> Proximity and gesture offset registers perform offset correction to improve
> cross-talk performance. Add support for reading from and writing to
> proximity and gesture offset registers. Create sysfs attributes for
> them via iio to expose them to userspace.
> 
> Signed-off-by: Abhash Jha <abhashkumarjha123@gmail.com>

All custom ABI needs documentation in
Documentation/ABI/testing/sysfs-bus-iio-* 
where * is appropriate scoped - here probably device.

Key thing is that custom documentation == custom userspace code ==
never used by 99% of users.

So we need to think very hard about whether we can map it to standard
ABI, or if it deserves new standard ABI (which will eventually make it
into userspace tools).

That's a hard discussion to have without documentation

Consider in particular if calibbias can work for these as it sounds
superficially similar to what the datasheet is talking about.



> ---
>  drivers/iio/light/apds9960.c | 245 +++++++++++++++++++++++++++++++++++
>  1 file changed, 245 insertions(+)
> 
> diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c
> index 1065a340b..bccf9a8c7 100644
> --- a/drivers/iio/light/apds9960.c
> +++ b/drivers/iio/light/apds9960.c
> @@ -101,6 +101,10 @@
>  #define APDS9960_MAX_ALS_THRES_VAL	0xffff
>  #define APDS9960_MAX_INT_TIME_IN_US	1000000
>  
> +/* MIN and MAX offset from pg: 26 of the datasheet */
> +#define MIN_OFFSET -127
> +#define MAX_OFFSET 127
S8_MIN, S8_MAX
probably appropriate here.



> +static IIO_DEVICE_ATTR(proximity_offset_ur, S_IRUGO | S_IWUSR, apds9960_proximity_offset_ur_show, apds9960_proximity_offset_ur_store, 0);
> +static IIO_DEVICE_ATTR(proximity_offset_dl, S_IRUGO | S_IWUSR, apds9960_proximity_offset_dl_show, apds9960_proximity_offset_dl_store, 0);
> +static IIO_DEVICE_ATTR(gesture_offset_u, S_IRUGO | S_IWUSR, apds9960_gesture_offset_u_show, apds9960_gesture_offset_u_store, 0);
> +static IIO_DEVICE_ATTR(gesture_offset_d, S_IRUGO | S_IWUSR, apds9960_gesture_offset_d_show, apds9960_gesture_offset_d_store, 0);
> +static IIO_DEVICE_ATTR(gesture_offset_l, S_IRUGO | S_IWUSR, apds9960_gesture_offset_l_show, apds9960_gesture_offset_l_store, 0);
> +static IIO_DEVICE_ATTR(gesture_offset_r, S_IRUGO | S_IWUSR, apds9960_gesture_offset_r_show, apds9960_gesture_offset_r_store, 0);
Very long lines.  Try to keep under 80 chars unless there is a good reason
(readability mainly).  here I'm not seeing one.

Also, the kernel is moving away from symbols for permissions as
checkpatch would I think have told you..

> +
>  static struct attribute *apds9960_attributes[] = {
>  	&iio_const_attr_proximity_scale_available.dev_attr.attr,
>  	&iio_const_attr_intensity_scale_available.dev_attr.attr,
>  	&iio_const_attr_integration_time_available.dev_attr.attr,
> +	&iio_dev_attr_proximity_offset_ur.dev_attr.attr,
> +	&iio_dev_attr_proximity_offset_dl.dev_attr.attr,
> +	&iio_dev_attr_gesture_offset_u.dev_attr.attr,
> +	&iio_dev_attr_gesture_offset_d.dev_attr.attr,
> +	&iio_dev_attr_gesture_offset_l.dev_attr.attr,
> +	&iio_dev_attr_gesture_offset_r.dev_attr.attr,
>  	NULL,
>  };
>  


      reply	other threads:[~2024-07-07 16:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 11:56 [PATCH] iio: light: apds9960: Add proximity and gesture offset calibration Abhash Jha
2024-07-07 16:13 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240707171357.709d9e35@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=abhashkumarjha123@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox