Message ID | 20240714173431.54332-3-rayyan@ansari.sh (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | KX022-1020 accel support + inertial sensors on msm8226-microsoft | expand |
Hi, On 7/14/24 7:33 PM, Rayyan Ansari wrote: > Add compatible for the KX022-1020 accelerometer [1] using the > KX022-1023 [2] register map as both have an identical i2c interface. > > [1]: https://kionixfs.azureedge.net/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf > [2]: https://kionixfs.azureedge.net/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf > > Signed-off-by: Rayyan Ansari <rayyan@ansari.sh> Thanks, patch looks good to me: Reviewed-by: Hans de Goede <hdegoede@redhat.com> Regards, Hans > --- > drivers/iio/accel/kxcjk-1013.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c > index 8280d2bef0a3..b76df8816323 100644 > --- a/drivers/iio/accel/kxcjk-1013.c > +++ b/drivers/iio/accel/kxcjk-1013.c > @@ -173,6 +173,7 @@ enum kx_chipset { > KXCJ91008, > KXTJ21009, > KXTF9, > + KX0221020, > KX0231025, > KX_MAX_CHIPS /* this must be last */ > }; > @@ -580,8 +581,8 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *data) > return ret; > } > > - /* On KX023, route all used interrupts to INT1 for now */ > - if (data->chipset == KX0231025 && data->client->irq > 0) { > + /* On KX023 and KX022, route all used interrupts to INT1 for now */ > + if ((data->chipset == KX0231025 || data->chipset == KX0221020) && data->client->irq > 0) { > ret = i2c_smbus_write_byte_data(data->client, KX023_REG_INC4, > KX023_REG_INC4_DRDY1 | > KX023_REG_INC4_WUFI1); > @@ -1507,6 +1508,7 @@ static int kxcjk1013_probe(struct i2c_client *client) > case KXTF9: > data->regs = &kxtf9_regs; > break; > + case KX0221020: > case KX0231025: > data->regs = &kx0231025_regs; > break; > @@ -1712,6 +1714,7 @@ static const struct i2c_device_id kxcjk1013_id[] = { > {"kxcj91008", KXCJ91008}, > {"kxtj21009", KXTJ21009}, > {"kxtf9", KXTF9}, > + {"kx022-1020", KX0221020}, > {"kx023-1025", KX0231025}, > {"SMO8500", KXCJ91008}, > {} > @@ -1724,6 +1727,7 @@ static const struct of_device_id kxcjk1013_of_match[] = { > { .compatible = "kionix,kxcj91008", }, > { .compatible = "kionix,kxtj21009", }, > { .compatible = "kionix,kxtf9", }, > + { .compatible = "kionix,kx022-1020", }, > { .compatible = "kionix,kx023-1025", }, > { } > };
On Mon, Jul 15, 2024 at 10:30:46AM +0200, Hans de Goede wrote: > On 7/14/24 7:33 PM, Rayyan Ansari wrote: > > Add compatible for the KX022-1020 accelerometer [1] using the > > KX022-1023 [2] register map as both have an identical i2c interface. > > > > [1]: https://kionixfs.azureedge.net/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf > > [2]: https://kionixfs.azureedge.net/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf > > > > Signed-off-by: Rayyan Ansari <rayyan@ansari.sh> > > Thanks, patch looks good to me: > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> Note, this patch broke kx231025 case... > > KXCJ91008, > > KXTJ21009, > > KXTF9, > > + KX0221020, > > KX0231025, > > KX_MAX_CHIPS /* this must be last */ > > }; ...because this enum is used of ODR startup timeout settings which are all moved now to be 0 and new ID inherited the timeouts from the KX0231025 case. Since I have been looking into the driver, and I have a few patches coming, I propose to do the following (as it's still ODR data being missed) to: 1) revert this one; 2) apply my set; 3) re-apply this with the fixed data. Another approach can be done (but probably not by me) is to move the ID to the proper location, add ODR startup timeouts or explain why it's not needed and then apply my patch. But, taking into account that we are almost at -rc5 and I want my stuff not to be postponed, I tend to follow the first approach. Opinions, comments? P.S. FWIW, my set will include switching this driver to use chip_info structure so the similar mistakes won't happen again, that's also why I prefer the first approach I listed above.
On Thu, 24 Oct 2024 17:28:14 +0300 Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > On Mon, Jul 15, 2024 at 10:30:46AM +0200, Hans de Goede wrote: > > On 7/14/24 7:33 PM, Rayyan Ansari wrote: > > > Add compatible for the KX022-1020 accelerometer [1] using the > > > KX022-1023 [2] register map as both have an identical i2c interface. > > > > > > [1]: https://kionixfs.azureedge.net/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf > > > [2]: https://kionixfs.azureedge.net/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf > > > > > > Signed-off-by: Rayyan Ansari <rayyan@ansari.sh> > > > > Thanks, patch looks good to me: > > > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > > Note, this patch broke kx231025 case... > > > > KXCJ91008, > > > KXTJ21009, > > > KXTF9, > > > + KX0221020, > > > KX0231025, > > > KX_MAX_CHIPS /* this must be last */ > > > }; > > ...because this enum is used of ODR startup timeout settings which > are all moved now to be 0 and new ID inherited the timeouts from > the KX0231025 case. > > Since I have been looking into the driver, and I have a few patches > coming, I propose to do the following (as it's still ODR data being > missed) to: > 1) revert this one > 2) apply my set; > 3) re-apply this with the fixed data. > > Another approach can be done (but probably not by me) is to move the ID > to the proper location, add ODR startup timeouts or explain why it's not > needed and then apply my patch. > > But, taking into account that we are almost at -rc5 and I want my stuff > not to be postponed, I tend to follow the first approach. > > Opinions, comments? > > P.S. FWIW, my set will include switching this driver to use chip_info > structure so the similar mistakes won't happen again, that's also why > I prefer the first approach I listed above. > Hmm. Either I want the revert in before the release, or your series to make the merge window (and hence probably hit in first couple of stable releases). Ideal would be revert very soon and chase it in to togreg so your series can go on top, but that would rely on some lucky timing of pull requests and merges that is probably too optimistic. Jonathan
On Thu, Oct 24, 2024 at 7:34 PM Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote: > On Thu, 24 Oct 2024 17:28:14 +0300 > Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > > On Mon, Jul 15, 2024 at 10:30:46AM +0200, Hans de Goede wrote: > > > On 7/14/24 7:33 PM, Rayyan Ansari wrote: > > > > Add compatible for the KX022-1020 accelerometer [1] using the > > > > KX022-1023 [2] register map as both have an identical i2c interface. > > > > > > > > [1]: https://kionixfs.azureedge.net/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf > > > > [2]: https://kionixfs.azureedge.net/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf > > > > > > > > Signed-off-by: Rayyan Ansari <rayyan@ansari.sh> > > > > > > Thanks, patch looks good to me: > > > > > > Reviewed-by: Hans de Goede <hdegoede@redhat.com> > > > > Note, this patch broke kx231025 case... > > > > > > KXCJ91008, > > > > KXTJ21009, > > > > KXTF9, > > > > + KX0221020, > > > > KX0231025, > > > > KX_MAX_CHIPS /* this must be last */ > > > > }; > > > > ...because this enum is used of ODR startup timeout settings which > > are all moved now to be 0 and new ID inherited the timeouts from > > the KX0231025 case. > > > > Since I have been looking into the driver, and I have a few patches > > coming, I propose to do the following (as it's still ODR data being > > missed) to: > > 1) revert this one > > 2) apply my set; > > 3) re-apply this with the fixed data. > > > Another approach can be done (but probably not by me) is to move the ID > > to the proper location, add ODR startup timeouts or explain why it's not > > needed and then apply my patch. > > > > But, taking into account that we are almost at -rc5 and I want my stuff > > not to be postponed, I tend to follow the first approach. > > > > Opinions, comments? > > > > P.S. FWIW, my set will include switching this driver to use chip_info > > structure so the similar mistakes won't happen again, that's also why > > I prefer the first approach I listed above. > > Hmm. Either I want the revert in before the release, or your series > to make the merge window (and hence probably hit in first couple of stable > releases). I have sent the v3 (out of 24 patches) that includes revert and a fix in the I2C ID table. Those two can be backported. > Ideal would be revert very soon and chase it in to togreg so your series > can go on top, but that would rely on some lucky timing of pull requests > and merges that is probably too optimistic. Up to you how to proceed, the patches are available in the mailing list :-)
diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 8280d2bef0a3..b76df8816323 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -173,6 +173,7 @@ enum kx_chipset { KXCJ91008, KXTJ21009, KXTF9, + KX0221020, KX0231025, KX_MAX_CHIPS /* this must be last */ }; @@ -580,8 +581,8 @@ static int kxcjk1013_chip_init(struct kxcjk1013_data *data) return ret; } - /* On KX023, route all used interrupts to INT1 for now */ - if (data->chipset == KX0231025 && data->client->irq > 0) { + /* On KX023 and KX022, route all used interrupts to INT1 for now */ + if ((data->chipset == KX0231025 || data->chipset == KX0221020) && data->client->irq > 0) { ret = i2c_smbus_write_byte_data(data->client, KX023_REG_INC4, KX023_REG_INC4_DRDY1 | KX023_REG_INC4_WUFI1); @@ -1507,6 +1508,7 @@ static int kxcjk1013_probe(struct i2c_client *client) case KXTF9: data->regs = &kxtf9_regs; break; + case KX0221020: case KX0231025: data->regs = &kx0231025_regs; break; @@ -1712,6 +1714,7 @@ static const struct i2c_device_id kxcjk1013_id[] = { {"kxcj91008", KXCJ91008}, {"kxtj21009", KXTJ21009}, {"kxtf9", KXTF9}, + {"kx022-1020", KX0221020}, {"kx023-1025", KX0231025}, {"SMO8500", KXCJ91008}, {} @@ -1724,6 +1727,7 @@ static const struct of_device_id kxcjk1013_of_match[] = { { .compatible = "kionix,kxcj91008", }, { .compatible = "kionix,kxtj21009", }, { .compatible = "kionix,kxtf9", }, + { .compatible = "kionix,kx022-1020", }, { .compatible = "kionix,kx023-1025", }, { } };
Add compatible for the KX022-1020 accelerometer [1] using the KX022-1023 [2] register map as both have an identical i2c interface. [1]: https://kionixfs.azureedge.net/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf [2]: https://kionixfs.azureedge.net/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf Signed-off-by: Rayyan Ansari <rayyan@ansari.sh> --- drivers/iio/accel/kxcjk-1013.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)