Re: [PATCH v3 2/6] iio: frequency: adf41513: driver implementation

From: Andy Shevchenko

Date: Mon Jan 12 2026 - 05:58:03 EST


On Mon, Jan 12, 2026 at 09:56:25AM +0000, Rodrigo Alencar wrote:
> On 26/01/09 08:55PM, Andy Shevchenko wrote:
> > On Thu, Jan 08, 2026 at 12:14:51PM +0000, Rodrigo Alencar via B4 Relay wrote:

...

> > > +/* Specifications */
> > > +#define ADF41510_MAX_RF_FREQ (10000ULL * HZ_PER_MHZ)
> > > +#define ADF41513_MIN_RF_FREQ (1000ULL * HZ_PER_MHZ)
> > > +#define ADF41513_MAX_RF_FREQ (26500ULL * HZ_PER_MHZ)
> >
> > We need HZ_PER_GHZ. I think it's easy to have one be present in units.h.
>
> 26.5 GHz is not going to use HZ_PER_GHZ, so for consistency I think it makes
> sense to keep HZ_PER_MHZ for the others.

It's about readability and less error prone numbers (anything with 3+ 0:s is
already prone to mistakes).

...

> > > +#define ADF41513_MIN_INT_4_5 20
> > > +#define ADF41513_MAX_INT_4_5 511
> > > +#define ADF41513_MIN_INT_8_9 64
> > > +#define ADF41513_MAX_INT_8_9 1023
> >
> > Not sure if we want (BIT(x) - 1) for the limits as we have non-0 minimums.

Any comment on this?

...

> > > +#define ADF41513_MAX_CLK_DIVIDER 4095
> >
> > Sounds like a candidate for (BIT(12) - 1).
>
> limits for INT are taken from the datasheet as is, so I think it makes to leave them
> like this, as for CLK1/CLK2 max divider, indeed I can make it (BIT(12) - 1) as it
> refers to a 12-bit register field.

...

> > > +#define ADF41513_MAX_PHASE_MICRORAD 6283185UL
> >
> > Basically I'm replying to this just for this line. 180° is PI radians, which is
> > something like 31415926... Can we use here (2 * 314...) where PI is provided in
> > one of the used form? This will help to grep and replace in case we will have a
> > common PI constant defined in the kernel (units.h).

Any comment on this?

--
With Best Regards,
Andy Shevchenko