Re: [PATCH] iio: light: stk3310: add chip id for STK3311-X variant

From: Jonathan Cameron
Date: Sat Jul 18 2020 - 12:29:46 EST


On Tue, 14 Jul 2020 12:44:41 +0200
OndÅej Jirman <megous@xxxxxxxxxx> wrote:

> Hello Jonathan,
>
> On Sat, Jul 04, 2020 at 05:29:16PM +0100, Jonathan Cameron wrote:
> > On Fri, 3 Jul 2020 21:44:05 +0200
> > Ondrej Jirman <megous@xxxxxxxxxx> wrote:
> >
> > > From: Icenowy Zheng <icenowy@xxxxxxx>
> > >
> > > The STK3311 chip has a variant called STK3311-X, which has a different
> > > chip id of 0x12.
> > >
> > > Add the chip id to the driver.
> > >
> > > Signed-off-by: Icenowy Zheng <icenowy@xxxxxxx>
> > > Signed-off-by: Ondrej Jirman <megous@xxxxxxxxxx>
> >
> > Given this is clearly not quite compatible with the stk3311 probably
> > best to also add a an id to the of id table. Any idea what else
> > is different?
>
> I've looked at it more, and there's no stk3311 either. It always has
> some suffix, like -sa -9 -a -wv -x, .... So I don't think a new
> ID in the table is neccessary. The driver can differentiate based on
> chip id, in case it will ever become necessary.
>
Thanks for info. In that case, applied to the togreg branch of iio.git
and pushed out as testing for the autobuilders to poke at it.

Thanks,

Jonathan

> regards,
> o.
>
> > Thanks,
> >
> > Jonathan
> >
> > > ---
> > > drivers/iio/light/stk3310.c | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> > > index 185c24a75ae6..1a8401d198a4 100644
> > > --- a/drivers/iio/light/stk3310.c
> > > +++ b/drivers/iio/light/stk3310.c
> > > @@ -37,6 +37,7 @@
> > >
> > > #define STK3310_CHIP_ID_VAL 0x13
> > > #define STK3311_CHIP_ID_VAL 0x1D
> > > +#define STK3311X_CHIP_ID_VAL 0x12
> > > #define STK3335_CHIP_ID_VAL 0x51
> > > #define STK3310_PSINT_EN 0x01
> > > #define STK3310_PS_MAX_VAL 0xFFFF
> > > @@ -453,6 +454,7 @@ static int stk3310_init(struct iio_dev *indio_dev)
> > >
> > > if (chipid != STK3310_CHIP_ID_VAL &&
> > > chipid != STK3311_CHIP_ID_VAL &&
> > > + chipid != STK3311X_CHIP_ID_VAL &&
> > > chipid != STK3335_CHIP_ID_VAL) {
> > > dev_err(&client->dev, "invalid chip id: 0x%x\n", chipid);
> > > return -ENODEV;
> >