Split personality device driver?
by cosimo193 from LinuxQuestions.org on (#4VHZA)
I've been given some hardware that uses a M41ST87W combined i2c RTC and tamper detect chip. The intention is to use the RTC part as the Linux RTC, and the tamper detect and RAM storage separately.
I've defined the RTC in the device tree with compatible = "m41t80", and it's detected and works fine as an RTC. However, when I try to use the device by opening the i2c device and set the slave address, I get an error that it's unavailable as it's locked by the RTC driver.
Is there an easy way round this?
Alternatively, if there isn't an easy solution, would it be necessary to write a driver that registers both as an RTC driver and some other type of character driver for reading the other registers etc? Is it even possible to do that and, if so, can someone please point me at an example?
Many thanks


I've defined the RTC in the device tree with compatible = "m41t80", and it's detected and works fine as an RTC. However, when I try to use the device by opening the i2c device and set the slave address, I get an error that it's unavailable as it's locked by the RTC driver.
Is there an easy way round this?
Alternatively, if there isn't an easy solution, would it be necessary to write a driver that registers both as an RTC driver and some other type of character driver for reading the other registers etc? Is it even possible to do that and, if so, can someone please point me at an example?
Many thanks