Re: [PATCH 1/4] iio: proximity: vcnl3020: add periodic mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2021-05-02 at 19:00 +0100, Jonathan Cameron wrote:
> On Fri, 30 Apr 2021 18:24:16 +0300
> Ivan Mikhaylov <i.mikhaylov@xxxxxxxxx> wrote:
> 
> > Add the possibility to run proximity sensor in periodic measurement
> > mode.
> 
> Without an interrupt?  Unusual and perhaps best left to userspace.

Do you mean without interrupt handler in driver for this particular interrupt?
If it's need to be added here, I can add it. In this patch I just added trigger
to enable/disable periodic measurement mode without interrupt handler.

> 
> > +		if (rc)
> > +			return rc;
> > +
> > +		/* Enable periodic measurement of proximity data. */
> > +		cmd = VCNL_PS_EN | VCNL_PS_SELFTIMED_EN;
> > +
> > +		/*
> > +		 * Enable interrupts on threshold, for proximity data by
> > +		 * default.
> > +		 */
> > +		icr = VCNL_ICR_THRES_EN;
> > +	} else {
> > +		if (!vcnl3020_is_thr_enabled(data))
> > +			return 0;
> > +
> > +		cmd = 0;
> > +		icr = 0;
> > +		isr = 0;
> > +	}
> > +
> > +	rc = regmap_write(data->regmap, VCNL_COMMAND, cmd);
> > +	if (rc)
> > +		goto end;
> > +
> > +	rc = regmap_write(data->regmap, VCNL_PS_ICR, icr);
> > +	if (rc)
> > +		goto end;
> > +
> > +	if (!state)
> > +		/* Clear interrupts */
> 
> Given you don't seem to have an interrupt. I guess this is clearing
> a status flag?

Yes, it is clearing flag in interrupt status register.

> 
> > +		rc = regmap_write(data->regmap, VCNL_ISR, isr);
> > +
> > +end:
> > +	if (state)
> > +		iio_device_release_direct_mode(indio_dev);
> 





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux