RE: [PATCH v6 1/2] iio: frequency: adrf6780: add support for ADRF6780
From: "Miclaus, Antoniu" <Antoniu.Miclaus@analog.com>
Date: 2021-07-20 14:15:43
Also in:
linux-iio, lkml
Hello Andy, Thanks for the review:
-----Original Message----- From: Andy Shevchenko <redacted> Sent: Friday, July 16, 2021 5:53 PM To: Miclaus, Antoniu <Antoniu.Miclaus@analog.com> Cc: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org; jic23@kernel.org; devicetree@vger.kernel.org Subject: Re: [PATCH v6 1/2] iio: frequency: adrf6780: add support for ADRF6780 [External] On Fri, Jul 16, 2021 at 2:43 PM Antoniu Miclaus [off-list ref] wrote:quoted
The ADRF6780 is a silicon germanium (SiGe) design, wideband, microwave upconverter optimized for point to point microwave radio designs operating in the 5.9 GHz to 23.6 GHz frequency range.quoted
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADRF6780.pdf Is it one line? If not, please put on one line and drop below the blank line so it will go as a tag.
Yes, it is one line.
quoted
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>First question is why not to use the regmap API (I have heard it has gained support of 17 bit)?
Initially that was the plan, but after this patch: https://github.com/torvalds/linux/commit/4191f19792bf91267835eb090d970e9cd6277a65 the custom write formats for regmap allow the read only via cached registers. Therefore, I preferred using spi transfers for write/read to/from the device.
...quoted
+ depends on COMMON_CLKIs it mandatory for any function inside the device?
Yes. It will serve as LO input to the device.
...quoted
+static int adrf6780_spi_read(struct adrf6780_dev *dev, unsigned int reg, + unsigned int *val) +{ + int ret; + struct spi_transfer t = {0};quoted
+ dev->data[0] = 0x80 | (reg << 1);This 0x80 I guess is pretty much standard and regmap SPI supports it.quoted
+ dev->data[1] = 0x0; + dev->data[2] = 0x0; + + t.rx_buf = &dev->data[0]; + t.tx_buf = &dev->data[0]; + t.len = 3; + + ret = spi_sync_transfer(dev->spi, &t, 1); + if (ret) + return ret; + + *val = (get_unaligned_be24(&dev->data[0]) >> 1) & GENMASK(15, 0); + + return ret; +}...quoted
+ usleep_range(200, 250);Needs a comment.
Will add in next patch version.
-- With Best Regards, Andy Shevchenko
Regards, Antoniu