Re: [PATCH v2 2/2] iio: magnetometer: add ti tmag5273 driver

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

 



On Wed, Nov 23, 2022 at 10:58:47AM +0100, Gerald Loacker wrote:
> Am 21.11.2022 um 15:04 schrieb Andy Shevchenko:
> > On Mon, Nov 21, 2022 at 01:35:42PM +0100, Gerald Loacker wrote:

...

> >> +static const struct {
> >> +	unsigned int scale_int;
> >> +	unsigned int scale_micro;
> > 
> > Can we have a separate patch to define this one eventually in the (one of) IIO
> > generic headers? It's a bit pity that every new driver seems to reinvent the
> > wheel.
> > 
> >> +} tmag5273_scale_table[4][2] = {
> >> +	{ { 0, 0 }, { 0, 0 } },
> >> +	{ { 0, 12200 }, { 0, 24400 } },
> >> +	{ { 0, 40600 }, { 0, 81200 } },
> >> +	{ { 0, 0 }, { 0, 0 } },
> >> +};
> > 
> 
> I'm thinking of defining structs for all similar types of IIO output
> formats in iio.h like this:
> 
> 
> struct iio_val_int_plus_micro {
> 	int val_int;
> 	int val_micro;
> };
> 
> struct iio_val_int_plus_nano {
> 	int val_int;
> 	int val_nano;
> };
> 
> struct iio_val_int_plus_micro_db {
> 	int val_int;
> 	int val_micro_db;
> };

...

> struct iio_val_fractional {
> 	int dividend;
> 	int divisor;
> };

This one...

> struct iio_val_fractional_log2 {
> 	int dividend;
> 	int divisor;
> };

...and this one repeat struct s32_fract (or u32_fract, whatever suits better).

> Do you agree?

Me, yes, but you need a blessing by maintainers of IIO.

-- 
With Best Regards,
Andy Shevchenko





[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