Hi Denis, Jonathan On Sun, Oct 1, 2023 at 7:23 PM Denis Benato <benato.denis96@xxxxxxxxx> wrote: > > Hello Jagath, > > On 9/29/23 09:59, Jagath Jog J wrote: > > Hi Denis, > > > > On Thu, Sep 28, 2023 at 2:55 AM Denis Benato <benato.denis96@xxxxxxxxx> wrote: > >> > >> Hello, > >> > >> Some devices (as my asus rog ally) have an ACPI node describing a BOSC0200 sensor. The IC being used in those devices is a bmi323 but as a result of how the ACPI table reports that device, it is detected by the existing kernel module and we have no way of differentiating until after the chip ID probe. > >> > >> The module loaded is bmc150-accel-i2c.c which currently doesn't support the bmi323 and the loading of the module just fails at chip check. > > > > bmc150 driver supports multiple accelerometer sensors such as > > bma222, bma280, bmi055 and all of them are having similar > > register map, but the bmi323 register map is completely different > > from bmc150. > > I apologize for the confusion. > > What I was trying to say is that to have the bmi323 working in those aforementioned devices bmc150 will need to be modified: that is the probe function that ends up being executed, fact that cannot be changed because it depends on the ACPI implementation shipped on those devices. > > Therefore I was asking about the best way of handing control to the new driver and how that should be organized: in my implementation the new bmi323 code was written inside the bmc150-accel-core.c and only shares sleep/suspend, probe and removal functions in addition to checking for the new chip presence before checking for any bmc150 chip as that issues an i2c write, while the check for the bmi323 only requires an i2c read. Means you want to handle control to the standalone driver from bmc150. Sorry, I didn't find any examples. Important thing to handle is the bmi323 private structure and call required exported functions from another driver. Jonathan: Can you suggest any example wrapper drivers which handle that way? > > We also have done duplicate work as I have written a driver for that chip myself, but it's not as good as yours because my hardware didn't come with the IRQ pin connected and so I couldn't develop triggers and I only got the i2c interface working. > > > > > > >> > >> I have solved the problem by expanding the current bmc150-accel-i2c.c and bmc150-accel-core.c files to handle that IC in almost every part: gyroscope, accelerometer and temperature sensor. > >> > >> What is the best way of organizing code to have this module mainlined? Is it correct leaving files called bmc150-accel-* even if it is managing another IC and and not just the accelerometer part anymore? > >> > >> TIA for your time. > >> > >> Best regards, > >> Denis Benato > > > > Regards > > > > Jagath > > TIA for your time. > > Best regards, > Denis Benato Regards Jagath