Skip to contentSkip to conversation

rtc: add ht1380 driver

PATCH In review Sergei Antonov 3 participants 3 messages Dec 9, 2022 – Jan 3, 2023 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 rtc: add ht1380 driver

Support Holtek HT1380/HT1381 Serial Timekeeper Chip. It provides seconds , minutes, hours, day of the week, date, month and year information.

Datasheet:
https://www.holtek.com.tw/documents/10179/11842/ht1380_1v130.pdf

---

v3:
Suggested by Simon Glass:
* remove extra brackets
* pass GPIOD_IS_OUT to gpio_request_by_name() and drop the extra code below
* add text to Kconfig: how it is connected, i.e. three GPIOs
* rename dts names to plural: rst/clk/dat-gpios
Suggested by Tom Rini:
* enable on sandbox so that it gets build tested

v2:
* The RESET pin is now to be described as ACTIVE_LOW in dts. Changes suggested by Simon Glass:
* a more detailed driver description in Kconfig
* multi-line comments' style
* enum for 0x80 and the 0x20 at top of file
* lower-case hex constants
* function comments for ht1380_reset_on/off
* blank line before returns

 configs/sandbox_defconfig |   1 +
 drivers/rtc/Kconfig       |   9 ++
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/ht1380.c      | 329 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 340 insertions(+)
 create mode 100644 drivers/rtc/ht1380.c
configs/sandbox_defconfig +1 -0
index 404e4a3324a2..f9c996b4299d 100644
@@ -334,3 +334,4 @@ CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
 CONFIG_IPV6=y
+CONFIG_RTC_HT1380=y
drivers/rtc/Kconfig +9 -0
index 23963271928a..04ca2914f1be 100644
@@ -220,4 +220,13 @@ config RTC_ZYNQMP
 	  Say "yes" here to support the on chip real time clock
 	  present on Xilinx ZynqMP SoC.
 
+config RTC_HT1380
+	bool "Enable Holtek HT1380/HT1381 RTC driver"
+	depends on DM_RTC && DM_GPIO
+	help
+	  Say "yes" here to get support for Holtek HT1380/HT1381
+	  Serial Timekeeper IC which provides seconds, minutes, hours,
+	  day of the week, date, month and year information. It is to be
+	  connected via 3 GPIO pins which work as reset, clock, and data.
+
 endmenu
drivers/rtc/Makefile +1 -0
index 009dd9d28c95..f3164782b605 100644
@@ -24,6 +24,7 @@ obj-$(CONFIG_RTC_DS3231) += ds3231.o
 obj-$(CONFIG_RTC_DS3232) += ds3232.o
 obj-$(CONFIG_RTC_EMULATION) += emul_rtc.o
 obj-$(CONFIG_RTC_FTRTC010) += ftrtc010.o
+obj-$(CONFIG_RTC_HT1380) += ht1380.o
 obj-$(CONFIG_SANDBOX) += i2c_rtc_emul.o
 obj-$(CONFIG_RTC_IMXDI) += imxdi.o
 obj-$(CONFIG_RTC_ISL1208) += isl1208.o
drivers/rtc/ht1380.c new file +329 -0

329 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 29 lines · Sergei Antonov

Support Holtek HT1380/HT1381 Serial Timekeeper Chip. It provides seconds , minutes, hours, day of the week, date, month and year information.

Datasheet:
https://www.holtek.com.tw/documents/10179/11842/ht1380_1v130.pdf

---

v3:
Suggested by Simon Glass:
* remove extra brackets
* pass GPIOD_IS_OUT to gpio_request_by_name() and drop the extra code below
* add text to Kconfig: how it is connected, i.e. three GPIOs
* rename dts names to plural: rst/clk/dat-gpios
Suggested by Tom Rini:
* enable on sandbox so that it gets build tested

v2:
* The RESET pin is now to be described as ACTIVE_LOW in dts. Changes suggested by Simon Glass:
* a more detailed driver description in Kconfig
* multi-line comments' style
* enum for 0x80 and the 0x20 at top of file
* lower-case hex constants
* function comments for ht1380_reset_on/off
* blank line before returns

Quoted 6 lines
 configs/sandbox_defconfig |   1 +
 drivers/rtc/Kconfig       |   9 ++
 drivers/rtc/Makefile      |   1 +
 drivers/rtc/ht1380.c      | 329 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 340 insertions(+)
 create mode 100644 drivers/rtc/ht1380.c