Skip to content

rtc: ds1307: factor out more stuff from ds1307_probe and improve ds1307_set_time

Heiner Kallweit linux-rtc 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5rtc: ds1307: factor out determining the chip typedrivers/rtc/rtc-ds1307.c+20 -170 replies
2/5rtc: ds1307: factor out trickle charger initializationdrivers/rtc/rtc-ds1307.c+28 -200 replies
3/5rtc: ds1307: factor out fixing the weekdaydrivers/rtc/rtc-ds1307.c+25 -170 replies
4/5rtc: ds1307: introduce constants for the timekeeping register masksdrivers/rtc/rtc-ds1307.c+34 -290 replies
5/5rtc: ds1307: improve ds1307_set_time to respect config flag bitsdrivers/rtc/rtc-ds1307.c+34 -340 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/5] rtc: ds1307: factor out more stuff from ds1307_probe and improve ds1307_set_time

Final goal of the refactoring is to abstract everything that the chips have in common and handle it in generic code. Then we can get rid of all the "switch (chip)" and "if (chip == xxx)" code.

To give one example:
A lot of chips have a bit for setting 12hr / 24hr mode. However some chips have this config bit in the timekeeping registers, others in a config register, and on some chips it's inverted.
But the functionality of the bit is always the same.

Ultimately adding support for a chip just requires to add one config structure member.

The way to reach this goal is a long one and to faciliate reviewing the patches I'll split them into series of 5 to 10 patches.

Heiner Kallweit (5):
rtc: ds1307: factor out determining the chip type
rtc: ds1307: factor out trickle charger initialization
rtc: ds1307: factor out fixing the weekday
rtc: ds1307: introduce constants for the timekeeping register masks
rtc: ds1307: improve ds1307_set_time to respect config flag bits

 drivers/rtc/rtc-ds1307.c | 256 ++++++++++++++++++++++++++---------------------
 1 file changed, 140 insertions(+), 116 deletions(-)
Signature · 1 line
2.14.1