Re: question about firmware RTC design (for rtcwake)

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

 



On 08/06/2023 11:05:57+0200, Marek Behún wrote:
> On Wed, 7 Jun 2023 10:28:28 +0200
> Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx> wrote:
> 
> > On 22/05/2023 23:14:54+0200, Marek Behún wrote:
> > > > You probably need to look at rtc-meson-vrtc.c, rtc-fsl-ftm-alarm.c and
> > > > rtc-brcmstb-waketimer.c which implement something similar.
> > > > 
> > > > Honestly, I would go for an in-between proposal where you would store
> > > > the requested alarm time (or more likely countdown) on
> > > > set_alarm/alarm_irq_enable so you would get .read_alarm working.
> > > > 
> > > > However, my main concern is that this is yet another custom protocol. We
> > > > can't possibly have a driver for everyone implementing a timer in their
> > > > FPGA/CPLD/cortexM.
> > > > 
> > > > How will you communicate with the MCU, can't you use an already existing
> > > > driver?  
> > > 
> > > The MCU exposes a command interface over I2C. There already are
> > > existing commands, which needs to stay for backwards compatibility.
> > > 
> > > It is theoretically possible to simulate an existing RTC device on
> > > another I2C address, but I would need to study them, because the boards
> > > are shipped with three different MCUs (STM32, GD32, NXP's MKL81) and
> > > they sometimes have a little different I2C slave behavior.
> > > 
> > > But I will need to create a platform/mfd driver anyway for the system
> > > off handler and GPIO controller. If I am going to create a new driver
> > > anyway, why not add the RTC functionality as well?  
> > 
> > No, this is not how MFD is working, you will be writing a separate RTC
> > driver or reusing an existing one. Have a look at the recent isl1208
> 
> THX for the reply.
> I have one I2C client through which I need to implement RTC, GPIO and
> system power off. I thought such drivers live in drivers/mfd... Am I
> wrong?

You are not wrong but the code doesn't necessarily live in drivers/mfd
but is in the subsystems instead.

> 
> Marek
> 
> 
> > series:
> > 
> > https://lore.kernel.org/linux-rtc/OS0PR01MB5922DAC377266672ADA9FC28864DA@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#mab0a75187abf7d8aada2c3517ebfdf7241f4bc7a
> > 
> > This patch adds supports for the isl1208 on board of a PMIC, as you can
> > see, this is a very small change versus a full blown RTC driver.
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux