All of lore.kernel.org
 help / color / mirror / Atom feed
* rtc_[gs]et_time()
@ 2003-04-15  9:02 Geert Uytterhoeven
  2003-04-15  9:09 ` rtc_[gs]et_time() Brian Murphy
  2003-04-15 18:33 ` rtc_[gs]et_time() Jun Sun
  0 siblings, 2 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2003-04-15  9:02 UTC (permalink / raw)
  To: Linux/MIPS Development

	Hi,

Is there any specific reason why the function pointers rtc_[gs]et_time() use
seconds instead of struct rtc_time? Most RTCs store the date and time in a
format similar to struct rtc_time, so they have to convert from seconds to
struct rtc_time again. I found only 2 exceptions, namely the vr4181 RTC and the
Lasat ds1630 RTC (BTW, I found no RTC driver for vr41xx, since
vr41xx_rtc_get_time() is nowhere defined).

This makes it more complex to make drivers/char/genrtc.c work on MIPS, since 
usually the date and time have to be converted twice: once from struct rtc_time
to seconds in <asm/rtc.h>, and once from seconds to struct rtc_time in each RTC
driver.

Is it OK to make rtc_[gs]et_time() always use struct rtc_time?

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rtc_[gs]et_time()
  2003-04-15  9:02 rtc_[gs]et_time() Geert Uytterhoeven
@ 2003-04-15  9:09 ` Brian Murphy
  2003-04-15  9:12   ` rtc_[gs]et_time() Ladislav Michl
  2003-04-15 18:33 ` rtc_[gs]et_time() Jun Sun
  1 sibling, 1 reply; 5+ messages in thread
From: Brian Murphy @ 2003-04-15  9:09 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux/MIPS Development

Geert Uytterhoeven wrote:

>This makes it more complex to make drivers/char/genrtc.c work on MIPS, since 
>usually the date and time have to be converted twice: once from struct rtc_time
>to seconds in <asm/rtc.h>, and once from seconds to struct rtc_time in each RTC
>driver.
>
>Is it OK to make rtc_[gs]et_time() always use struct rtc_time?
>
>  
>
I quite like it the way it is ;-).

/Brian

LASAT port maintainer.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rtc_[gs]et_time()
  2003-04-15  9:09 ` rtc_[gs]et_time() Brian Murphy
@ 2003-04-15  9:12   ` Ladislav Michl
  2003-04-15 12:52     ` rtc_[gs]et_time() Maciej W. Rozycki
  0 siblings, 1 reply; 5+ messages in thread
From: Ladislav Michl @ 2003-04-15  9:12 UTC (permalink / raw)
  To: Brian Murphy; +Cc: Geert Uytterhoeven, Linux/MIPS Development

On Tue, Apr 15, 2003 at 11:09:43AM +0200, Brian Murphy wrote:
> Geert Uytterhoeven wrote:
> 
> >This makes it more complex to make drivers/char/genrtc.c work on MIPS, since 
> >usually the date and time have to be converted twice: once from struct rtc_time
> >to seconds in <asm/rtc.h>, and once from seconds to struct rtc_time in each RTC
> >driver.
> >
> >Is it OK to make rtc_[gs]et_time() always use struct rtc_time?
> >
> I quite like it the way it is ;-)

While I would like to see rtc_[gs]et_time() always use struct rtc_time ;)

	ladis

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rtc_[gs]et_time()
  2003-04-15  9:12   ` rtc_[gs]et_time() Ladislav Michl
@ 2003-04-15 12:52     ` Maciej W. Rozycki
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2003-04-15 12:52 UTC (permalink / raw)
  To: Ladislav Michl; +Cc: Brian Murphy, Geert Uytterhoeven, Linux/MIPS Development

On Tue, 15 Apr 2003, Ladislav Michl wrote:

> > >This makes it more complex to make drivers/char/genrtc.c work on MIPS, since 
> > >usually the date and time have to be converted twice: once from struct rtc_time
> > >to seconds in <asm/rtc.h>, and once from seconds to struct rtc_time in each RTC
> > >driver.
> > >
> > >Is it OK to make rtc_[gs]et_time() always use struct rtc_time?
> > >
> > I quite like it the way it is ;-)
> 
> While I would like to see rtc_[gs]et_time() always use struct rtc_time ;)

 Note that the system time is always a monotonic count of seconds (plus a
fractional part), but the format stored in RTC chips varies.  So I think
it should be passed unchanged and the convertion left up to specific
drivers, possibly with an aid for ones that closely match 'struct
rtc_time' by means of library or inline helper functions. 

 E.g. one of the yet unsupported DECstations uses a 32bit register
counting 10ms intervals as its RTC (or actually TOY).  So maybe it's
'struct timespec' that should really be passed... 

-- 
+  Maciej W. Rozycki, Technical University of Gdansk, Poland   +
+--------------------------------------------------------------+
+        e-mail: macro@ds2.pg.gda.pl, PGP key available        +

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: rtc_[gs]et_time()
  2003-04-15  9:02 rtc_[gs]et_time() Geert Uytterhoeven
  2003-04-15  9:09 ` rtc_[gs]et_time() Brian Murphy
@ 2003-04-15 18:33 ` Jun Sun
  1 sibling, 0 replies; 5+ messages in thread
From: Jun Sun @ 2003-04-15 18:33 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux/MIPS Development, jsun

On Tue, Apr 15, 2003 at 11:02:35AM +0200, Geert Uytterhoeven wrote:
> 	Hi,
> 
> Is there any specific reason why the function pointers rtc_[gs]et_time() use
> seconds instead of struct rtc_time? Most RTCs store the date and time in a
> format similar to struct rtc_time, so they have to convert from seconds to
> struct rtc_time again. I found only 2 exceptions, namely the vr4181 RTC and the
> Lasat ds1630 RTC (BTW, I found no RTC driver for vr41xx, since
> vr41xx_rtc_get_time() is nowhere defined).
>

This interface is designed to 1) satisfy rtc need by system timer (see
arch/mips/kernel/time.c) and 2) provide abstract for vastly different 
RTC hardwares.  Using "second" is a nature choice to interface with xtime

There are quite a few different RTCs.  And I am sure there are others coming.
vr4181_rtc_get_time() is another example (which you missed :0)

Extending this interface to support user rtc driver (/dev/rtc) is desirable.
Since rtc driver is not called frequently, converting twice is not much a concern.

BTW, I think the wrapping function done in PPC for genrtc should just work
for MIPS. :)

Once genrtc is done for MIPS, we should remove mips_rtc driver.

Jun

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-04-15 18:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-15  9:02 rtc_[gs]et_time() Geert Uytterhoeven
2003-04-15  9:09 ` rtc_[gs]et_time() Brian Murphy
2003-04-15  9:12   ` rtc_[gs]et_time() Ladislav Michl
2003-04-15 12:52     ` rtc_[gs]et_time() Maciej W. Rozycki
2003-04-15 18:33 ` rtc_[gs]et_time() Jun Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.