[PATCH v7 2/3] rtc: sophgo: add rtc support for Sophgo CV1800 SoC

Alexandre Belloni alexandre.belloni at bootlin.com
Mon Jan 22 01:15:11 PST 2024


On 22/01/2024 16:34:00+0800, Jingbao Qiu wrote:
> On Mon, Jan 22, 2024 at 4:17 PM Alexandre Belloni
> <alexandre.belloni at bootlin.com> wrote:
> >
> > On 22/01/2024 16:06:30+0800, Jingbao Qiu wrote:
> > > Implement the RTC driver for CV1800, which able to provide time alarm
> > > and calibrate functionality.
> > >
> > > Signed-off-by: Jingbao Qiu <qiujingbao.dlmu at gmail.com>
> > > ---
> > >
> > > Depends on https://lore.kernel.org/all/IA1PR20MB4953C774D41EDF1EADB6EC18BB6D2@IA1PR20MB4953.namprd20.prod.outlook.com/
> >
> > What is the dependency?
> >
> 
> Thank you, this driver requires support from the CLK driver.
> I will add an explanation in the next version.
> 
> >
> > Also, please fix the checkpatch.pl --strict warnings
> 
> I will use the -- strict option for testing.
> 
> >
> > > +/**
> > > + * cv1800_rtc_32k_coarse_val_calib() - Using an external
> > > + * clock to coarse calibrate the crystal oscillator
> > > + * @info: the device of calibrated
> > > + *
> > > + * @return 0 on success, or -1 on fail
> > > + *
> > > + * This RTC has an independent 32KHz oscillator. However,
> > > + * the accuracy of this oscillator is easily affected by
> > > + * external environmental interference,resulting in lower
> > > + * accuracy than the internal oscillator.Therefore, a 25M
> > > + * crystal oscillator is used as a reference source to
> > > + * calibrate the RTC and improve its accuracy.Calibration
> > > + * is completed through two steps, namely rough calibration
> > > + * and fine calibration.
> > > + */
> > > +static int cv1800_rtc_32k_coarse_val_calib(struct cv1800_rtc_priv *info)
> >
> > This is still not working as well as you think it is. You should
> > Implement the offset callbacks instead.
> >
> I'm sorry, I don't quite understand offset callbacks.
> Do you mean that this function needs to be executed periodically.

I mean implement read_offset and set_offset here:
https://elixir.bootlin.com/linux/v6.7/source/include/linux/rtc.h#L67


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



More information about the linux-riscv mailing list