Message ID | 20240209-iio-backend-v10-0-3ed842064318@analog.com (mailing list archive) |
---|---|
Headers | show |
Series | iio: add new backend framework | expand |
On Fri, Feb 9, 2024 at 5:26 PM Nuno Sa <nuno.sa@analog.com> wrote: > > Move to the IIO backend framework. Devices supported by adi-axi-adc now > register themselves as backend devices. ... > -#include <linux/iio/iio.h> > -#include <linux/iio/sysfs.h> > -#include <linux/iio/buffer.h> > -#include <linux/iio/buffer-dmaengine.h> > - > #include <linux/fpga/adi-axi-common.h> > -#include <linux/iio/adc/adi-axi-adc.h> + Blank line? > +#include <linux/iio/backend.h> > +#include <linux/iio/buffer-dmaengine.h> > +#include <linux/iio/buffer.h> > +#include <linux/iio/iio.h> ... > +static int axi_adc_enable(struct iio_backend *back) > { > + struct adi_axi_adc_state *st = iio_backend_get_priv(back); > int ret; > > + ret = regmap_set_bits(st->regmap, ADI_AXI_REG_RSTN, > + ADI_AXI_REG_RSTN_MMCM_RSTN); > + if (ret) > + return ret; > + fsleep(10); Would be nice to have a comment that probably the datasheet defines the minimum timeout for reset. Ah and you decreased it 1000x times, why? > + return regmap_set_bits(st->regmap, ADI_AXI_REG_RSTN, > + ADI_AXI_REG_RSTN_RSTN | ADI_AXI_REG_RSTN_MMCM_RSTN); > } ... > + expected_ver = (unsigned int *)device_get_match_data(&pdev->dev); expected_ver should have const and you can drop the casting IIUC. > + if (!expected_ver) > + return -ENODEV;
On Fri, Feb 9, 2024 at 5:25 PM Nuno Sa <nuno.sa@analog.com> wrote: > Changes in v10: > - Patch 5 > * Removed meaningless @ in function names; > * Added ascii diagram for the typicaly HW setup (Andy request); > * Add missing period; > * Use of dev_err_probe() in APIs meant to be called during probe(). > - Patch 6 > * Removed unneeded blank line; > * Fixed some English in the commit message. Thanks for the update! I found it nice, only one (kinda important) finding is the 1000x reset timeout decrease. It might justify v11. If so, consider other comments as well.
On Fri, 2024-02-09 at 18:45 +0200, Andy Shevchenko wrote: > On Fri, Feb 9, 2024 at 5:26 PM Nuno Sa <nuno.sa@analog.com> wrote: > > > > Move to the IIO backend framework. Devices supported by adi-axi-adc now > > register themselves as backend devices. > > ... > > > -#include <linux/iio/iio.h> > > -#include <linux/iio/sysfs.h> > > -#include <linux/iio/buffer.h> > > -#include <linux/iio/buffer-dmaengine.h> > > - > > #include <linux/fpga/adi-axi-common.h> > > -#include <linux/iio/adc/adi-axi-adc.h> > > + Blank line? > can be... > > +#include <linux/iio/backend.h> > > +#include <linux/iio/buffer-dmaengine.h> > > +#include <linux/iio/buffer.h> > > +#include <linux/iio/iio.h> > > ... > > > +static int axi_adc_enable(struct iio_backend *back) > > { > > + struct adi_axi_adc_state *st = iio_backend_get_priv(back); > > int ret; > > > > + ret = regmap_set_bits(st->regmap, ADI_AXI_REG_RSTN, > > + ADI_AXI_REG_RSTN_MMCM_RSTN); > > + if (ret) > > + return ret; > > > + fsleep(10); > > Would be nice to have a comment that probably the datasheet defines > the minimum timeout for reset. Ah and you decreased it 1000x times, > why? > Arghh, always forget that fsleep() is us... That said, there's no minimum timeout specified in the docs. I guess the original developer has the sleeps out of habit or some "hidden" knowledge. In my testing I did not noticed anything weird with the 10us. I'll move back to the original timeout though. I can then check and make sure 10us is enough and send a follow up patch. > > + return regmap_set_bits(st->regmap, ADI_AXI_REG_RSTN, > > + ADI_AXI_REG_RSTN_RSTN | > > ADI_AXI_REG_RSTN_MMCM_RSTN); > > } > > ... > > > + expected_ver = (unsigned int *)device_get_match_data(&pdev->dev); > > expected_ver should have const and you can drop the casting IIUC. Right... > > > + if (!expected_ver) > > + return -ENODEV; >