Re: [PATCH 3/3] iio: proximity: Add Benewake TF-Luna LiDAR driver

From: Jonathan Cameron

Date: Sun Oct 25 2026 - 22:53:38 EST


On Tue, 20 Oct 2026 00:03:43 +0530
Vidhu Sarwal via B4 Relay <devnull+vidhu.linux.gmail.com@xxxxxxxxxx> wrote:

> From: Vidhu Sarwal <vidhu.linux@xxxxxxxxx>
>
> Add a driver for the Benewake TF-Luna, a single-point time-of-flight
> LiDAR distance sensor with a range of 0.2 m to 8 m, connected over I2C.
>
> The sensor is run in trigger mode. Each read starts one measurement and
> waits for the timestamp register to change before reading the result.
> In continuous mode a read can catch the sensor in the middle of updating
> its result registers unless it is synchronised to the data ready output,
> which this driver does not use yet.
>
> When the signal strength is too low the sensor reports a dummy distance
> of 0, so such readings, as well as overexposed ones, return -ENODATA
> instead of a distance.
>
> The datasheet is available at:
> https://en.benewake.com/uploadfiles/2025/04/20250430174501874.pdf
>
> Signed-off-by: Vidhu Sarwal <vidhu.linux@xxxxxxxxx>
One trivial addition to comments from other reviewers.

> diff --git a/drivers/iio/proximity/tf-luna.c b/drivers/iio/proximity/tf-luna.c
> new file mode 100644
> index 000000000000..b2f6e664b614
> --- /dev/null
> +++ b/drivers/iio/proximity/tf-luna.c



> +
> +static const struct iio_info tf_luna_info = {
> + .read_raw = tf_luna_read_raw,
> +};
> +
> +static const struct iio_chan_spec tf_luna_channels[] = {
> + {
> + .type = IIO_DISTANCE,
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_SCALE),
> + },
> +};
Where there is only ever going to be one channel it is fine
to just not use an array and hard code num_channels = 1.

If you plan to add buffered support (no idea if that makes sense
for this device), then I don't mind you leaving this as an array
to make that step easier later.