Re: [PATCH v2 3/4] iio: adc: xilinx-xadc: Add I2C interface support
From: Sai Krishna Potthuri
Date: Mon Mar 23 2026 - 08:22:25 EST
Hi Andy Shevchenko,
On 3/23/2026 5:16 PM, Andy Shevchenko wrote:
On Mon, Mar 23, 2026 at 1:32 PM Sai Krishna Potthuri
<sai.krishna.potthuri@xxxxxxx> wrote:
-----Original Message-----
From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Sent: Monday, March 23, 2026 4:22 PM
On Mon, Mar 23, 2026 at 01:15:04PM +0530, Sai Krishna Potthuri wrote:
...
This callback is defined for all other platforms except I2C.int xadc_write_samplerate(struct xadc *xadc, int val) {
- unsigned long clk_rate = xadc_get_dclk_rate(xadc);
+ unsigned long clk_rate;
unsigned int div;
+ if (!xadc->ops->get_dclk_rate)
+ return -EOPNOTSUPP;
+ clk_rate = xadc_get_dclk_rate(xadc);
+
Unneeded blank line.
Also, don't you asked for options?
Currently for I2c interface we are not supporting any configuration, it
is used only to read the channels.
If the callback defined you should use its value and not hardcoded one, right?
Yes, that's the intention.
xadc_get_dclk_rate() - this is a wrapper function to call
xadc->ops->get_dclk_rate(). May be i will remove the wrapper function or
move the if (!xadc->ops->get_dclk_rate) check inside wrapper.
Regards
Sai Krishna
if (!clk_rate)
return -EINVAL;