diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/Kconfig | 139 | ||||
-rw-r--r-- | drivers/rtc/Makefile | 39 | ||||
-rw-r--r-- | drivers/rtc/class.c | 5 | ||||
-rw-r--r-- | drivers/rtc/rtc-bfin.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-cmos.c | 33 | ||||
-rw-r--r-- | drivers/rtc/rtc-dev.c | 4 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds1307.c | 300 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds1553.c | 15 | ||||
-rw-r--r-- | drivers/rtc/rtc-ds1742.c | 15 | ||||
-rw-r--r-- | drivers/rtc/rtc-max6900.c | 96 | ||||
-rw-r--r-- | drivers/rtc/rtc-max6902.c | 6 | ||||
-rw-r--r-- | drivers/rtc/rtc-rs5c348.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-rs5c372.c | 95 | ||||
-rw-r--r-- | drivers/rtc/rtc-s3c.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-sh.c | 1 | ||||
-rw-r--r-- | drivers/rtc/rtc-v3020.c | 9 | ||||
-rw-r--r-- | drivers/rtc/rtc-vr41xx.c | 186 | ||||
-rw-r--r-- | drivers/rtc/rtc-x1205.c | 5 |
18 files changed, 553 insertions, 401 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index a4d6987dffec..12947c6abe4e 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -2,16 +2,13 @@ # RTC class/drivers configuration # -menu "Real Time Clock" - depends on !S390 - config RTC_LIB tristate -config RTC_CLASS - tristate "RTC class" - depends on EXPERIMENTAL +menuconfig RTC_CLASS + tristate "Real Time Clock" default n + depends on !S390 select RTC_LIB help Generic RTC class support. If you say yes here, you will @@ -21,6 +18,8 @@ config RTC_CLASS This driver can also be built as a module. If so, the module will be called rtc-class. +if RTC_CLASS + config RTC_HCTOSYS bool "Set system time from RTC on startup and resume" depends on RTC_CLASS = y @@ -39,6 +38,9 @@ config RTC_HCTOSYS_DEVICE clock, usually rtc0. Initialization is done when the system starts up, and when it resumes from a low power state. + The driver for this RTC device must be loaded before late_initcall + functions run, so it must usually be statically linked. + This clock should be battery-backed, so that it reads the correct time when the system boots from a power-off state. Otherwise, your system will need an external clock source (like an NTP server). @@ -56,11 +58,10 @@ config RTC_DEBUG and individual RTC drivers. comment "RTC interfaces" - depends on RTC_CLASS config RTC_INTF_SYSFS boolean "/sys/class/rtc/rtcN (sysfs)" - depends on RTC_CLASS && SYSFS + depends on SYSFS default RTC_CLASS help Say yes here if you want to use your RTCs using sysfs interfaces, @@ -71,7 +72,7 @@ config RTC_INTF_SYSFS config RTC_INTF_PROC boolean "/proc/driver/rtc (procfs for rtc0)" - depends on RTC_CLASS && PROC_FS + depends on PROC_FS default RTC_CLASS help Say yes here if you want to use your first RTC through the proc @@ -83,7 +84,6 @@ config RTC_INTF_PROC config RTC_INTF_DEV boolean "/dev/rtcN (character devices)" - depends on RTC_CLASS default RTC_CLASS help Say yes here if you want to use your RTCs using the /dev @@ -105,7 +105,6 @@ config RTC_INTF_DEV_UIE_EMUL config RTC_DRV_TEST tristate "Test driver/device" - depends on RTC_CLASS help If you say yes here you get support for the RTC test driver. It's a software RTC which can be @@ -119,11 +118,12 @@ config RTC_DRV_TEST will be called rtc-test. comment "I2C RTC drivers" - depends on RTC_CLASS + depends on I2C + +if I2C config RTC_DRV_DS1307 tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00" - depends on RTC_CLASS && I2C help If you say yes here you get support for various compatible RTC chips (often with battery backup) connected with I2C. This driver @@ -141,7 +141,6 @@ config RTC_DRV_DS1307 config RTC_DRV_DS1672 tristate "Dallas/Maxim DS1672" - depends on RTC_CLASS && I2C help If you say yes here you get support for the Dallas/Maxim DS1672 timekeeping chip. @@ -151,7 +150,6 @@ config RTC_DRV_DS1672 config RTC_DRV_MAX6900 tristate "Maxim 6900" - depends on RTC_CLASS && I2C help If you say yes here you will get support for the Maxim MAX6900 I2C RTC chip. @@ -160,18 +158,16 @@ config RTC_DRV_MAX6900 will be called rtc-max6900. config RTC_DRV_RS5C372 - tristate "Ricoh RS5C372A/B" - depends on RTC_CLASS && I2C + tristate "Ricoh RS5C372A/B, RV5C386, RV5C387A" help If you say yes here you get support for the - Ricoh RS5C372A and RS5C372B RTC chips. + Ricoh RS5C372A, RS5C372B, RV5C386, and RV5C387A RTC chips. This driver can also be built as a module. If so, the module will be called rtc-rs5c372. config RTC_DRV_ISL1208 tristate "Intersil 1208" - depends on RTC_CLASS && I2C help If you say yes here you get support for the Intersil 1208 RTC chip. @@ -181,7 +177,6 @@ config RTC_DRV_ISL1208 config RTC_DRV_X1205 tristate "Xicor/Intersil X1205" - depends on RTC_CLASS && I2C help If you say yes here you get support for the Xicor/Intersil X1205 RTC chip. @@ -191,7 +186,6 @@ config RTC_DRV_X1205 config RTC_DRV_PCF8563 tristate "Philips PCF8563/Epson RTC8564" - depends on RTC_CLASS && I2C help If you say yes here you get support for the Philips PCF8563 RTC chip. The Epson RTC8564 @@ -202,7 +196,6 @@ config RTC_DRV_PCF8563 config RTC_DRV_PCF8583 tristate "Philips PCF8583" - depends on RTC_CLASS && I2C help If you say yes here you get support for the Philips PCF8583 RTC chip found on Acorn RiscPCs. This driver supports the @@ -213,12 +206,41 @@ config RTC_DRV_PCF8583 This driver can also be built as a module. If so, the module will be called rtc-pcf8583. +config RTC_DRV_M41T80 + tristate "ST M41T80 series RTC" + help + If you say Y here you will get support for the + ST M41T80 RTC chips series. Currently following chips are + supported: M41T80, M41T81, M41T82, M41T83, M41ST84, M41ST85 + and M41ST87. + + This driver can also be built as a module. If so, the module + will be called rtc-m41t80. + +config RTC_DRV_M41T80_WDT + bool "ST M41T80 series RTC watchdog timer" + depends on RTC_DRV_M41T80 + help + If you say Y here you will get support for the + watchdog timer in ST M41T80 RTC chips series. + +config RTC_DRV_TWL92330 + boolean "TI TWL92330/Menelaus" + depends on MENELAUS + help + If you say yes here you get support for the RTC on the + TWL92330 "Menelaus" power mangement chip, used with OMAP2 + platforms. The support is integrated with the rest of + the Menelaus driver; it's not separate module. + +endif # I2C + comment "SPI RTC drivers" - depends on RTC_CLASS + +if SPI_MASTER config RTC_DRV_RS5C348 tristate "Ricoh RS5C348A/B" - depends on RTC_CLASS && SPI help If you say yes here you get support for the Ricoh RS5C348A and RS5C348B RTC chips. @@ -228,7 +250,6 @@ config RTC_DRV_RS5C348 config RTC_DRV_MAX6902 tristate "Maxim 6902" - depends on RTC_CLASS && SPI help If you say yes here you will get support for the Maxim MAX6902 SPI RTC chip. @@ -236,8 +257,9 @@ config RTC_DRV_MAX6902 This driver can also be built as a module. If so, the module will be called rtc-max6902. +endif # SPI_MASTER + comment "Platform RTC drivers" - depends on RTC_CLASS # this 'CMOS' RTC driver is arch dependent because <asm-generic/rtc.h> # requires <asm/mc146818rtc.h> defining CMOS_READ/CMOS_WRITE, and a @@ -245,8 +267,7 @@ comment "Platform RTC drivers" config RTC_DRV_CMOS tristate "PC-style 'CMOS'" - depends on RTC_CLASS && (X86 || ALPHA || ARM26 || ARM \ - || M32R || ATARI || POWERPC || MIPS) + depends on X86 || ALPHA || ARM || M32R || ATARI || PPC || MIPS help Say "yes" here to get direct support for the real time clock found in every PC or ACPI-based system, and some other boards. @@ -262,9 +283,14 @@ config RTC_DRV_CMOS This driver can also be built as a module. If so, the module will be called rtc-cmos. +config RTC_DRV_DS1216 + tristate "Dallas DS1216" + depends on SNI_RM + help + If you say yes here you get support for the Dallas DS1216 RTC chips. + config RTC_DRV_DS1553 tristate "Dallas DS1553" - depends on RTC_CLASS help If you say yes here you get support for the Dallas DS1553 timekeeping chip. @@ -272,9 +298,18 @@ config RTC_DRV_DS1553 This driver can also be built as a module. If so, the module will be called rtc-ds1553. +config RTC_DRV_STK17TA8 + tristate "Simtek STK17TA8" + depends on RTC_CLASS + help + If you say yes here you get support for the + Simtek STK17TA8 timekeeping chip. + + This driver can also be built as a module. If so, the module + will be called rtc-stk17ta8. + config RTC_DRV_DS1742 tristate "Dallas DS1742/1743" - depends on RTC_CLASS help If you say yes here you get support for the Dallas DS1742/1743 timekeeping chip. @@ -284,7 +319,6 @@ config RTC_DRV_DS1742 config RTC_DRV_M48T86 tristate "ST M48T86/Dallas DS12887" - depends on RTC_CLASS help If you say Y here you will get support for the ST M48T86 and Dallas DS12887 RTC chips. @@ -292,9 +326,17 @@ config RTC_DRV_M48T86 This driver can also be built as a module. If so, the module will be called rtc-m48t86. +config RTC_DRV_M48T59 + tristate "ST M48T59" + help + If you say Y here you will get support for the + ST M48T59 RTC chip. + + This driver can also be built as a module, if so, the module + will be called "rtc-m48t59". + config RTC_DRV_V3020 tristate "EM Microelectronic V3020" - depends on RTC_CLASS help If you say yes here you will get support for the EM Microelectronic v3020 RTC chip. @@ -303,19 +345,17 @@ config RTC_DRV_V3020 will be called rtc-v3020. comment "on-CPU RTC drivers" - depends on RTC_CLASS config RTC_DRV_OMAP tristate "TI OMAP1" - depends on RTC_CLASS && ( \ - ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 ) + depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 help Say "yes" here to support the real time clock on TI OMAP1 chips. This driver can also be built as a module called rtc-omap. config RTC_DRV_S3C tristate "Samsung S3C series SoC RTC" - depends on RTC_CLASS && ARCH_S3C2410 + depends on ARCH_S3C2410 help RTC (Realtime Clock) driver for the clock inbuilt into the Samsung S3C24XX series of SoCs. This can provide periodic @@ -331,7 +371,7 @@ config RTC_DRV_S3C config RTC_DRV_EP93XX tristate "Cirrus Logic EP93XX" - depends on RTC_CLASS && ARCH_EP93XX + depends on ARCH_EP93XX help If you say yes here you get support for the RTC embedded in the Cirrus Logic EP93XX processors. @@ -341,7 +381,7 @@ config RTC_DRV_EP93XX config RTC_DRV_SA1100 tristate "SA11x0/PXA2xx" - depends on RTC_CLASS && (ARCH_SA1100 || ARCH_PXA) + depends on ARCH_SA1100 || ARCH_PXA help If you say Y here you will get access to the real time clock built into your SA11x0 or PXA2xx CPU. @@ -351,7 +391,7 @@ config RTC_DRV_SA1100 config RTC_DRV_SH tristate "SuperH On-Chip RTC" - depends on RTC_CLASS && SUPERH + depends on RTC_CLASS && (CPU_SH3 || CPU_SH4) help Say Y here to enable support for the on-chip RTC found in most SuperH processors. @@ -361,7 +401,7 @@ config RTC_DRV_SH config RTC_DRV_VR41XX tristate "NEC VR41XX" - depends on RTC_CLASS && CPU_VR41XX + depends on CPU_VR41XX help If you say Y here you will get access to the real time clock built into your NEC VR41XX CPU. @@ -371,7 +411,7 @@ config RTC_DRV_VR41XX config RTC_DRV_PL031 tristate "ARM AMBA PL031 RTC" - depends on RTC_CLASS && ARM_AMBA + depends on ARM_AMBA help If you say Y here you will get access to ARM AMBA PrimeCell PL031 RTC found on certain ARM SOCs. @@ -379,15 +419,22 @@ config RTC_DRV_PL031 To compile this driver as a module, choose M here: the module will be called rtc-pl031. +config RTC_DRV_AT32AP700X + tristate "AT32AP700X series RTC" + depends on PLATFORM_AT32AP + help + Driver for the internal RTC (Realtime Clock) on Atmel AVR32 + AT32AP700x family processors. + config RTC_DRV_AT91RM9200 tristate "AT91RM9200" - depends on RTC_CLASS && ARCH_AT91RM9200 + depends on ARCH_AT91RM9200 help Driver for the Atmel AT91RM9200's internal RTC (Realtime Clock). config RTC_DRV_BFIN tristate "Blackfin On-Chip RTC" - depends on RTC_CLASS && BFIN + depends on BFIN help If you say yes here you will get support for the Blackfin On-Chip Real Time Clock. @@ -397,7 +444,7 @@ config RTC_DRV_BFIN config RTC_DRV_RS5C313 tristate "Ricoh RS5C313" - depends on RTC_CLASS && SH_LANDISK + depends on SH_LANDISK help If you say yes here you get support for the Ricoh RS5C313 RTC chips. @@ -407,5 +454,5 @@ config RTC_MXC depends on RTC_CLASS help Support for Freescale RTC MXC - -endmenu + +endif # RTC_CLASS diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 52b53198ede6..256486dcfa29 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -15,30 +15,37 @@ rtc-core-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o rtc-core-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o rtc-core-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o +# Keep the list ordered. + +obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o +obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o +obj-$(CONFIG_RTC_DRV_BFIN) += rtc-bfin.o obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o -obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o -obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o -obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o +obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o obj-$(CONFIG_RTC_DRV_DS1307) += rtc-ds1307.o +obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o +obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o +obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o +obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o +obj-$(CONFIG_RTC_DRV_M48T59) += rtc-m48t59.o +obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o +obj-$(CONFIG_RTC_DRV_MAX6900) += rtc-max6900.o +obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o +obj-$(CONFIG_RTC_MXC) += rtc-mxc.o obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o +obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o +obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o +obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o obj-$(CONFIG_RTC_DRV_S3C) += rtc-s3c.o -obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o -obj-$(CONFIG_RTC_DRV_M48T86) += rtc-m48t86.o -obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o -obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o -obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o -obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o -obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o -obj-$(CONFIG_RTC_DRV_MAX6900) += rtc-max6900.o -obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o -obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o -obj-$(CONFIG_RTC_MXC) += rtc-mxc.o -obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o obj-$(CONFIG_RTC_DRV_SH) += rtc-sh.o -obj-$(CONFIG_RTC_DRV_BFIN) += rtc-bfin.o +obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o +obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o +obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o +obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o +obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 8b3cd31d6a61..10ab3b71ffc6 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c @@ -46,6 +46,7 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) { struct rtc_device *rtc = to_rtc_device(dev); struct rtc_time tm; + struct timespec ts = current_kernel_time(); if (strncmp(rtc->dev.bus_id, CONFIG_RTC_HCTOSYS_DEVICE, @@ -57,8 +58,8 @@ static int rtc_suspend(struct device *dev, pm_message_t mesg) /* RTC precision is 1 second; adjust delta for avg 1/2 sec err */ set_normalized_timespec(&delta, - xtime.tv_sec - oldtime, - xtime.tv_nsec - (NSEC_PER_SEC >> 1)); + ts.tv_sec - oldtime, + ts.tv_nsec - (NSEC_PER_SEC >> 1)); return 0; } diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 260ead959918..1aa709dda0d6 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c @@ -1,6 +1,6 @@ /* * Blackfin On-Chip Real Time Clock Driver - * Supports BF531/BF532/BF533/BF534/BF536/BF537 + * Supports BF53[123]/BF53[467]/BF54[2489] * * Copyright 2004-2007 Analog Devices Inc. * diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index e24ea82dc35b..5d760bb6c2cd 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -235,7 +235,7 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) return 0; } -static int cmos_set_freq(struct device *dev, int freq) +static int cmos_irq_set_freq(struct device *dev, int freq) { struct cmos_rtc *cmos = dev_get_drvdata(dev); int f; @@ -259,6 +259,34 @@ static int cmos_set_freq(struct device *dev, int freq) return 0; } +static int cmos_irq_set_state(struct device *dev, int enabled) +{ + struct cmos_rtc *cmos = dev_get_drvdata(dev); + unsigned char rtc_control, rtc_intr; + unsigned long flags; + + if (!is_valid_irq(cmos->irq)) + return -ENXIO; + + spin_lock_irqsave(&rtc_lock, flags); + rtc_control = CMOS_READ(RTC_CONTROL); + + if (enabled) + rtc_control |= RTC_PIE; + else + rtc_control &= ~RTC_PIE; + + CMOS_WRITE(rtc_control, RTC_CONTROL); + + rtc_intr = CMOS_READ(RTC_INTR_FLAGS); + rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF; + if (is_intr(rtc_intr)) + rtc_update_irq(cmos->rtc, 1, rtc_intr); + + spin_unlock_irqrestore(&rtc_lock, flags); + return 0; +} + #if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE) static int @@ -360,7 +388,8 @@ static const struct rtc_class_ops cmos_rtc_ops = { .read_alarm = cmos_read_alarm, .set_alarm = cmos_set_alarm, .proc = cmos_procfs, - .irq_set_freq = cmos_set_freq, + .irq_set_freq = cmos_irq_set_freq, + .irq_set_state = cmos_irq_set_state, }; /*----------------------------------------------------------------*/ diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index f4e5f0040ff7..005fff3a3508 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c @@ -341,11 +341,15 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, case RTC_IRQP_READ: if (ops->irq_set_freq) err = put_user(rtc->irq_freq, (unsigned long __user *)uarg); + else + err = -ENOTTY; break; case RTC_IRQP_SET: if (ops->irq_set_freq) err = rtc_irq_set_freq(rtc, rtc->irq_task, arg); + else + err = -ENOTTY; break; #if 0 diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 3f0f7b8fa813..db6f3f0d8982 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -24,29 +24,29 @@ * setting the date and time), Linux can ignore the non-clock features. * That's a natural job for a factory or repair bench. * - * If the I2C "force" mechanism is used, we assume the chip is a ds1337. - * (Much better would be board-specific tables of I2C devices, along with - * the platform_data drivers would use to sort such issues out.) + * This is currently a simple no-alarms driver. If your board has the + * alarm irq wired up on a ds1337 or ds1339, and you want to use that, + * then look at the rtc-rs5c372 driver for code to steal... */ enum ds_type { - unknown = 0, - ds_1307, /* or ds1338, ... */ - ds_1337, /* or ds1339, ... */ - ds_1340, /* or st m41t00, ... */ + ds_1307, + ds_1337, + ds_1338, + ds_1339, + ds_1340, + m41t00, // rs5c372 too? different address... }; -static unsigned short normal_i2c[] = { 0x68, I2C_CLIENT_END }; - -I2C_CLIENT_INSMOD; - - /* RTC registers don't differ much, except for the century flag */ #define DS1307_REG_SECS 0x00 /* 00-59 */ # define DS1307_BIT_CH 0x80 +# define DS1340_BIT_nEOSC 0x80 #define DS1307_REG_MIN 0x01 /* 00-59 */ #define DS1307_REG_HOUR 0x02 /* 00-23, or 1-12{am,pm} */ +# define DS1307_BIT_12HR 0x40 /* in REG_HOUR */ +# define DS1307_BIT_PM 0x20 /* in REG_HOUR */ # define DS1340_BIT_CENTURY_EN 0x80 /* in REG_HOUR */ # define DS1340_BIT_CENTURY 0x40 /* in REG_HOUR */ #define DS1307_REG_WDAY 0x03 /* 01-07 */ @@ -56,11 +56,12 @@ I2C_CLIENT_INSMOD; #define DS1307_REG_YEAR 0x06 /* 00-99 */ /* Other registers (control, status, alarms, trickle charge, NVRAM, etc) - * start at 7, and they differ a lot. Only control and status matter for RTC; - * be careful using them. + * start at 7, and they differ a LOT. Only control and status matter for + * basic RTC date and time functionality; be careful using them. */ -#define DS1307_REG_CONTROL 0x07 +#define DS1307_REG_CONTROL 0x07 /* or ds1338 */ # define DS1307_BIT_OUT 0x80 +# define DS1338_BIT_OSF 0x20 # define DS1307_BIT_SQWE 0x10 # define DS1307_BIT_RS1 0x02 # define DS1307_BIT_RS0 0x01 @@ -71,6 +72,13 @@ I2C_CLIENT_INSMOD; # define DS1337_BIT_INTCN 0x04 # define DS1337_BIT_A2IE 0x02 # define DS1337_BIT_A1IE 0x01 +#define DS1340_REG_CONTROL 0x07 +# define DS1340_BIT_OUT 0x80 +# define DS1340_BIT_FT 0x40 +# define DS1340_BIT_CALIB_SIGN 0x20 +# define DS1340_M_CALIBRATION 0x1f +#define DS1340_REG_FLAG 0x09 +# define DS1340_BIT_OSF 0x80 #define DS1337_REG_STATUS 0x0f # define DS1337_BIT_OSF 0x80 # define DS1337_BIT_A2I 0x02 @@ -84,21 +92,63 @@ struct ds1307 { u8 regs[8]; enum ds_type type; struct i2c_msg msg[2]; - struct i2c_client client; + struct i2c_client *client; + struct i2c_client dev; struct rtc_device *rtc; }; +struct chip_desc { + char name[9]; + unsigned nvram56:1; + unsigned alarm:1; + enum ds_type type; +}; + +static const struct chip_desc chips[] = { { + .name = "ds1307", + .type = ds_1307, + .nvram56 = 1, +}, { + .name = "ds1337", + .type = ds_1337, + .alarm = 1, +}, { + .name = "ds1338", + .type = ds_1338, + .nvram56 = 1, +}, { + .name = "ds1339", + .type = ds_1339, + .alarm = 1, +}, { + .name = "ds1340", + .type = ds_1340, +}, { + .name = "m41t00", + .type = m41t00, +}, }; + +static inline const struct chip_desc *find_chip(const char *s) +{ + unsigned i; + + for (i = 0; i < ARRAY_SIZE(chips); i++) + if (strnicmp(s, chips[i].name, sizeof chips[i].name) == 0) + return &chips[i]; + return NULL; +} static int ds1307_get_time(struct device *dev, struct rtc_time *t) { struct ds1307 *ds1307 = dev_get_drvdata(dev); int tmp; - /* read the RTC registers all at once */ + /* read the RTC date and time registers all at once */ ds1307->msg[1].flags = I2C_M_RD; ds1307->msg[1].len = 7; - tmp = i2c_transfer(ds1307->client.adapter, ds1307->msg, 2); + tmp = i2c_transfer(to_i2c_adapter(ds1307->client->dev.parent), + ds1307->msg, 2); if (tmp != 2) { dev_err(dev, "%s error %d\n", "read", tmp); return -EIO; @@ -129,7 +179,8 @@ static int ds1307_get_time(struct device *dev, struct rtc_time *t) t->tm_hour, t->tm_mday, t->tm_mon, t->tm_year, t->tm_wday); - return 0; + /* initial clock setting can be undefined */ + return rtc_valid_tm(t); } static int ds1307_set_time(struct device *dev, struct rtc_time *t) @@ -157,11 +208,18 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) tmp = t->tm_year - 100; buf[DS1307_REG_YEAR] = BIN2BCD(tmp); - if (ds1307->type == ds_1337) + switch (ds1307->type) { + case ds_1337: + case ds_1339: buf[DS1307_REG_MONTH] |= DS1337_BIT_CENTURY; - else if (ds1307->type == ds_1340) + break; + case ds_1340: buf[DS1307_REG_HOUR] |= DS1340_BIT_CENTURY_EN | DS1340_BIT_CENTURY; + break; + default: + break; + } ds1307->msg[1].flags = 0; ds1307->msg[1].len = 8; @@ -170,7 +228,8 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t) "write", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6]); - result = i2c_transfer(ds1307->client.adapter, &ds1307->msg[1], 1); + result = i2c_transfer(to_i2c_adapter(ds1307->client->dev.parent), + &ds1307->msg[1], 1); if (result != 1) { dev_err(dev, "%s error %d\n", "write", tmp); return -EIO; @@ -185,25 +244,29 @@ static const struct rtc_class_ops ds13xx_rtc_ops = { static struct i2c_driver ds1307_driver; -static int __devinit -ds1307_detect(struct i2c_adapter *adapter, int address, int kind) +static int __devinit ds1307_probe(struct i2c_client *client) { struct ds1307 *ds1307; int err = -ENODEV; - struct i2c_client *client; int tmp; - - if (!(ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL))) { - err = -ENOMEM; - goto exit; + const struct chip_desc *chip; + struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); + + chip = find_chip(client->name); + if (!chip) { + dev_err(&client->dev, "unknown chip type '%s'\n", + client->name); + return -ENODEV; } - client = &ds1307->client; - client->addr = address; - client->adapter = adapter; - client->driver = &ds1307_driver; - client->flags = 0; + if (!i2c_check_functionality(adapter, + I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) + return -EIO; + + if (!(ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL))) + return -ENOMEM; + ds1307->client = client; i2c_set_clientdata(client, ds1307); ds1307->msg[0].addr = client->addr; @@ -216,14 +279,16 @@ ds1307_detect(struct i2c_adapter *adapter, int address, int kind) ds1307->msg[1].len = sizeof(ds1307->regs); ds1307->msg[1].buf = ds1307->regs; - /* HACK: "force" implies "needs ds1337-style-oscillator setup" */ - if (kind >= 0) { - ds1307->type = ds_1337; + ds1307->type = chip->type; + switch (ds1307->type) { + case ds_1337: + case ds_1339: ds1307->reg_addr = DS1337_REG_CONTROL; ds1307->msg[1].len = 2; - tmp = i2c_transfer(client->adapter, ds1307->msg, 2); + /* get registers that the "rtc" read below won't read... */ + tmp = i2c_transfer(adapter, ds1307->msg, 2); if (tmp != 2) { pr_debug("read error %d\n", tmp); err = -EIO; @@ -233,19 +298,26 @@ ds1307_detect(struct i2c_adapter *adapter, int address, int kind) ds1307->reg_addr = 0; ds1307->msg[1].len = sizeof(ds1307->regs); - /* oscillator is off; need to turn it on */ - if ((ds1307->regs[0] & DS1337_BIT_nEOSC) - || (ds1307->regs[1] & DS1337_BIT_OSF)) { - printk(KERN_ERR "no ds1337 oscillator code\n"); - goto exit_free; + /* oscillator off? turn it on, so clock can tick. */ + if (ds1307->regs[0] & DS1337_BIT_nEOSC) + i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL, + ds1307->regs[0] & ~DS1337_BIT_nEOSC); + + /* oscillator fault? clear flag, and warn */ + if (ds1307->regs[1] & DS1337_BIT_OSF) { + i2c_smbus_write_byte_data(client, DS1337_REG_STATUS, + ds1307->regs[1] & ~DS1337_BIT_OSF); + dev_warn(&client->dev, "SET TIME!\n"); } - } else - ds1307->type = ds_1307; + break; + default: + break; + } read_rtc: /* read RTC registers */ - tmp = i2c_transfer(client->adapter, ds1307->msg, 2); + tmp = i2c_transfer(adapter, ds1307->msg, 2); if (tmp != 2) { pr_debug("read error %d\n", tmp); err = -EIO; @@ -257,72 +329,80 @@ read_rtc: * still a few values that are clearly out-of-range. */ tmp = ds1307->regs[DS1307_REG_SECS]; - if (tmp & DS1307_BIT_CH) { - if (ds1307->type && ds1307->type != ds_1307) { - pr_debug("not a ds1307?\n"); - goto exit_free; - } - ds1307->type = ds_1307; - - /* this partial initialization should work for ds1307, - * ds1338, ds1340, st m41t00, and more. + switch (ds1307->type) { + case ds_1340: + /* FIXME read register with DS1340_BIT_OSF, use that to + * trigger the "set time" warning (*after* restarting the + * oscillator!) instead of this weaker ds1307/m41t00 test. */ - dev_warn(&client->dev, "oscillator started; SET TIME!\n"); - i2c_smbus_write_byte_data(client, 0, 0); - goto read_rtc; + case ds_1307: + case m41t00: + /* clock halted? turn it on, so clock can tick. */ + if (tmp & DS1307_BIT_CH) { + i2c_smbus_write_byte_data(client, DS1307_REG_SECS, 0); + dev_warn(&client->dev, "SET TIME!\n"); + goto read_rtc; + } + break; + case ds_1338: + /* clock halted? turn it on, so clock can tick. */ + if (tmp & DS1307_BIT_CH) + i2c_smbus_write_byte_data(client, DS1307_REG_SECS, 0); + + /* oscillator fault? clear flag, and warn */ + if (ds1307->regs[DS1307_REG_CONTROL] & DS1338_BIT_OSF) { + i2c_smbus_write_byte_data(client, DS1307_REG_CONTROL, + ds1307->regs[DS1307_REG_CONTROL] + & ~DS1338_BIT_OSF); + dev_warn(&client->dev, "SET TIME!\n"); + goto read_rtc; + } + break; + case ds_1337: + case ds_1339: + break; } + + tmp = ds1307->regs[DS1307_REG_SECS]; tmp = BCD2BIN(tmp & 0x7f); if (tmp > 60) - goto exit_free; + goto exit_bad; tmp = BCD2BIN(ds1307->regs[DS1307_REG_MIN] & 0x7f); if (tmp > 60) - goto exit_free; + goto exit_bad; tmp = BCD2BIN(ds1307->regs[DS1307_REG_MDAY] & 0x3f); if (tmp == 0 || tmp > 31) - goto exit_free; + goto exit_bad; tmp = BCD2BIN(ds1307->regs[DS1307_REG_MONTH] & 0x1f); if (tmp == 0 || tmp > 12) - goto exit_free; + goto exit_bad; - /* force into in 24 hour mode (most chips) or - * disable century bit (ds1340) - */ tmp = ds1307->regs[DS1307_REG_HOUR]; - if (tmp & (1 << 6)) { - if (tmp & (1 << 5)) - tmp = BCD2BIN(tmp & 0x1f) + 12; - else - tmp = BCD2BIN(tmp); - i2c_smbus_write_byte_data(client, - DS1307_REG_HOUR, - BIN2BCD(tmp)); - } - - /* FIXME chips like 1337 can generate alarm irqs too; those are - * worth exposing through the API (especially when the irq is - * wakeup-capable). - */ - switch (ds1307->type) { - case unknown: - strlcpy(client->name, "unknown", I2C_NAME_SIZE); - break; - case ds_1307: - strlcpy(client->name, "ds1307", I2C_NAME_SIZE); - break; - case ds_1337: - strlcpy(client->name, "ds1337", I2C_NAME_SIZE); - break; case ds_1340: - strlcpy(client->name, "ds1340", I2C_NAME_SIZE); + case m41t00: + /* NOTE: ignores century bits; fix before deploying + * systems that will run through year 2100. + */ break; - } + default: + if (!(tmp & DS1307_BIT_12HR)) + break; - /* Tell the I2C layer a new client has arrived */ - if ((err = i2c_attach_client(client))) - goto exit_free; + /* Be sure we're in 24 hour mode. Multi-master systems + * take note... + */ + tmp = BCD2BIN(tmp & 0x1f); + if (tmp == 12) + tmp = 0; + if (ds1307->regs[DS1307_REG_HOUR] & DS1307_BIT_PM) + tmp += 12; + i2c_smbus_write_byte_data(client, + DS1307_REG_HOUR, + BIN2BCD(tmp)); + } ds1307->rtc = rtc_device_register(client->name, &client->dev, &ds13xx_rtc_ops, THIS_MODULE); @@ -330,46 +410,40 @@ read_rtc: err = PTR_ERR(ds1307->rtc); dev_err(&client->dev, "unable to register the class device\n"); - goto exit_detach; + goto exit_free; } return 0; -exit_detach: - i2c_detach_client(client); +exit_bad: + dev_dbg(&client->dev, "%s: %02x %02x %02x %02x %02x %02x %02x\n", + "bogus register", + ds1307->regs[0], ds1307->regs[1], + ds1307->regs[2], ds1307->regs[3], + ds1307->regs[4], ds1307->regs[5], + ds1307->regs[6]); + exit_free: kfree(ds1307); -exit: return err; } -static int __devinit -ds1307_attach_adapter(struct i2c_adapter *adapter) -{ - if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) - return 0; - return i2c_probe(adapter, &addr_data, ds1307_detect); -} - -static int __devexit ds1307_detach_client(struct i2c_client *client) +static int __devexit ds1307_remove(struct i2c_client *client) { - int err; struct ds1307 *ds1307 = i2c_get_clientdata(client); rtc_device_unregister(ds1307->rtc); - if ((err = i2c_detach_client(client))) - return err; kfree(ds1307); return 0; } static struct i2c_driver ds1307_driver = { .driver = { - .name = "ds1307", + .name = "rtc-ds1307", .owner = THIS_MODULE, }, - .attach_adapter = ds1307_attach_adapter, - .detach_client = __devexit_p(ds1307_detach_client), + .probe = ds1307_probe, + .remove = __devexit_p(ds1307_remove), }; static int __init ds1307_init(void) diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index afa64c7fa2e2..5ab3492817d1 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c @@ -61,7 +61,7 @@ struct rtc_plat_data { struct rtc_device *rtc; void __iomem *ioaddr; - unsigned long baseaddr; + resource_size_t baseaddr; unsigned long last_jiffies; int irq; unsigned int irqen; @@ -258,8 +258,9 @@ static const struct rtc_class_ops ds1553_rtc_ops = { .ioctl = ds1553_rtc_ioctl, }; -static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf, - loff_t pos, size_t size) +static ssize_t ds1553_nvram_read(struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t pos, size_t size) { struct platform_device *pdev = to_platform_device(container_of(kobj, struct device, kobj)); @@ -272,8 +273,9 @@ static ssize_t ds1553_nvram_read(struct kobject *kobj, char *buf, return count; } -static ssize_t ds1553_nvram_write(struct kobject *kobj, char *buf, - loff_t pos, size_t size) +static ssize_t ds1553_nvram_write(struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t pos, size_t size) { struct platform_device *pdev = to_platform_device(container_of(kobj, struct device, kobj)); @@ -290,7 +292,6 @@ static struct bin_attribute ds1553_nvram_attr = { .attr = { .name = "nvram", .mode = S_IRUGO | S_IWUGO, - .owner = THIS_MODULE, }, .size = RTC_OFFSET, .read = ds1553_nvram_read, @@ -406,7 +407,7 @@ static __init int ds1553_init(void) static __exit void ds1553_exit(void) { - return platform_driver_unregister(&ds1553_rtc_driver); + platform_driver_unregister(&ds1553_rtc_driver); } module_init(ds1553_init); diff --git a/drivers/rtc/rtc-ds1742.c b/drivers/rtc/rtc-ds1742.c index d68288b389dc..67291b0f8283 100644 --- a/drivers/rtc/rtc-ds1742.c +++ b/drivers/rtc/rtc-ds1742.c @@ -55,7 +55,7 @@ struct rtc_plat_data { void __iomem *ioaddr_rtc; size_t size_nvram; size_t size; - unsigned long baseaddr; + resource_size_t baseaddr; unsigned long last_jiffies; }; @@ -127,8 +127,9 @@ static const struct rtc_class_ops ds1742_rtc_ops = { .set_time = ds1742_rtc_set_time, }; -static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, - loff_t pos, size_t size) +static ssize_t ds1742_nvram_read(struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t pos, size_t size) { struct platform_device *pdev = to_platform_device(container_of(kobj, struct device, kobj)); @@ -141,8 +142,9 @@ static ssize_t ds1742_nvram_read(struct kobject *kobj, char *buf, return count; } -static ssize_t ds1742_nvram_write(struct kobject *kobj, char *buf, - loff_t pos, size_t size) +static ssize_t ds1742_nvram_write(struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t pos, size_t size) { struct platform_device *pdev = to_platform_device(container_of(kobj, struct device, kobj)); @@ -159,7 +161,6 @@ static struct bin_attribute ds1742_nvram_attr = { .attr = { .name = "nvram", .mode = S_IRUGO | S_IWUGO, - .owner = THIS_MODULE, }, .read = ds1742_nvram_read, .write = ds1742_nvram_write, @@ -262,7 +263,7 @@ static __init int ds1742_init(void) static __exit void ds1742_exit(void) { - return platform_driver_unregister(&ds1742_rtc_driver); + platform_driver_unregister(&ds1742_rtc_driver); } module_init(ds1742_init); diff --git a/drivers/rtc/rtc-max6900.c b/drivers/rtc/rtc-max6900.c index eee4ee5bb75a..a1cd448639c9 100644 --- a/drivers/rtc/rtc-max6900.c +++ b/drivers/rtc/rtc-max6900.c @@ -31,17 +31,24 @@ #define MAX6900_REG_DW 5 /* day of week 1-7 */ #define MAX6900_REG_YR 6 /* year 00-99 */ #define MAX6900_REG_CT 7 /* control */ -#define MAX6900_REG_LEN 8 + /* register 8 is undocumented */ +#define MAX6900_REG_CENTURY 9 /* century */ +#define MAX6900_REG_LEN 10 + +#define MAX6900_BURST_LEN 8 /* can burst r/w first 8 regs */ #define MAX6900_REG_CT_WP (1 << 7) /* Write Protect */ + /* * register read/write commands */ #define MAX6900_REG_CONTROL_WRITE 0x8e -#define MAX6900_REG_BURST_READ 0xbf -#define MAX6900_REG_BURST_WRITE 0xbe +#define MAX6900_REG_CENTURY_WRITE 0x92 +#define MAX6900_REG_CENTURY_READ 0x93 #define MAX6900_REG_RESERVED_READ 0x96 +#define MAX6900_REG_BURST_WRITE 0xbe +#define MAX6900_REG_BURST_READ 0xbf #define MAX6900_IDLE_TIME_AFTER_WRITE 3 /* specification says 2.5 mS */ @@ -58,19 +65,32 @@ static int max6900_probe(struct i2c_adapter *adapter, int addr, int kind); static int max6900_i2c_read_regs(struct i2c_client *client, u8 *buf) { - u8 reg_addr[1] = { MAX6900_REG_BURST_READ }; - struct i2c_msg msgs[2] = { + u8 reg_burst_read[1] = { MAX6900_REG_BURST_READ }; + u8 reg_century_read[1] = { MAX6900_REG_CENTURY_READ }; + struct i2c_msg msgs[4] = { { .addr = client->addr, .flags = 0, /* write */ - .len = sizeof(reg_addr), - .buf = reg_addr + .len = sizeof(reg_burst_read), + .buf = reg_burst_read }, { .addr = client->addr, .flags = I2C_M_RD, - .len = MAX6900_REG_LEN, + .len = MAX6900_BURST_LEN, .buf = buf + }, + { + .addr = client->addr, + .flags = 0, /* write */ + .len = sizeof(reg_century_read), + .buf = reg_century_read + }, + { + .addr = client->addr, + .flags = I2C_M_RD, + .len = sizeof(buf[MAX6900_REG_CENTURY]), + .buf = &buf[MAX6900_REG_CENTURY] } }; int rc; @@ -86,33 +106,58 @@ static int max6900_i2c_read_regs(struct i2c_client *client, u8 *buf) static int max6900_i2c_write_regs(struct i2c_client *client, u8 const *buf) { - u8 i2c_buf[MAX6900_REG_LEN + 1] = { MAX6900_REG_BURST_WRITE }; - struct i2c_msg msgs[1] = { + u8 i2c_century_buf[1 + 1] = { MAX6900_REG_CENTURY_WRITE }; + struct i2c_msg century_msgs[1] = { { .addr = client->addr, .flags = 0, /* write */ - .len = MAX6900_REG_LEN + 1, - .buf = i2c_buf + .len = sizeof(i2c_century_buf), + .buf = i2c_century_buf + } + }; + u8 i2c_burst_buf[MAX6900_BURST_LEN + 1] = { MAX6900_REG_BURST_WRITE }; + struct i2c_msg burst_msgs[1] = { + { + .addr = client->addr, + .flags = 0, /* write */ + .len = sizeof(i2c_burst_buf), + .buf = i2c_burst_buf } }; int rc; - memcpy(&i2c_buf[1], buf, MAX6900_REG_LEN); + /* + * We have to make separate calls to i2c_transfer because of + * the need to delay after each write to the chip. Also, + * we write the century byte first, since we set the write-protect + * bit as part of the burst write. + */ + i2c_century_buf[1] = buf[MAX6900_REG_CENTURY]; + rc = i2c_transfer(client->adapter, century_msgs, + ARRAY_SIZE(century_msgs)); + if (rc != ARRAY_SIZE(century_msgs)) + goto write_failed; + msleep(MAX6900_IDLE_TIME_AFTER_WRITE); - rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs)); - if (rc != ARRAY_SIZE(msgs)) { - dev_err(&client->dev, "%s: register write failed\n", - __FUNCTION__); - return -EIO; - } + memcpy(&i2c_burst_buf[1], buf, MAX6900_BURST_LEN); + + rc = i2c_transfer(client->adapter, burst_msgs, ARRAY_SIZE(burst_msgs)); + if (rc != ARRAY_SIZE(burst_msgs)) + goto write_failed; msleep(MAX6900_IDLE_TIME_AFTER_WRITE); + return 0; + +write_failed: + dev_err(&client->dev, "%s: register write failed\n", + __FUNCTION__); + return -EIO; } static int max6900_i2c_validate_client(struct i2c_client *client) { u8 regs[MAX6900_REG_LEN]; - u8 zero_mask[MAX6900_REG_LEN] = { + u8 zero_mask[] = { 0x80, /* seconds */ 0x80, /* minutes */ 0x40, /* hours */ @@ -134,7 +179,7 @@ static int max6900_i2c_validate_client(struct i2c_client *client) if (rc < 0) return rc; - for (i = 0; i < MAX6900_REG_LEN; ++i) { + for (i = 0; i < ARRAY_SIZE(zero_mask); ++i) { if (regs[i] & zero_mask[i]) return -ENODEV; } @@ -156,7 +201,8 @@ static int max6900_i2c_read_time(struct i2c_client *client, struct rtc_time *tm) tm->tm_hour = BCD2BIN(regs[MAX6900_REG_HR] & 0x3f); tm->tm_mday = BCD2BIN(regs[MAX6900_REG_DT]); tm->tm_mon = BCD2BIN(regs[MAX6900_REG_MO]) - 1; - tm->tm_year = BCD2BIN(regs[MAX6900_REG_YR]) + 100; + tm->tm_year = BCD2BIN(regs[MAX6900_REG_YR]) + + BCD2BIN(regs[MAX6900_REG_CENTURY]) * 100 - 1900; tm->tm_wday = BCD2BIN(regs[MAX6900_REG_DW]); return 0; @@ -189,9 +235,11 @@ static int max6900_i2c_set_time(struct i2c_client *client, regs[MAX6900_REG_HR] = BIN2BCD(tm->tm_hour); regs[MAX6900_REG_DT] = BIN2BCD(tm->tm_mday); regs[MAX6900_REG_MO] = BIN2BCD(tm->tm_mon + 1); - regs[MAX6900_REG_YR] = BIN2BCD(tm->tm_year - 100); regs[MAX6900_REG_DW] = BIN2BCD(tm->tm_wday); - regs[MAX6900_REG_CT] = MAX6900_REG_CT_WP; /* set write protect */ + regs[MAX6900_REG_YR] = BIN2BCD(tm->tm_year % 100); + regs[MAX6900_REG_CENTURY] = BIN2BCD((tm->tm_year + 1900) / 100); + /* set write protect */ + regs[MAX6900_REG_CT] = MAX6900_REG_CT_WP; rc = max6900_i2c_write_regs(client, regs); if (rc < 0) diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c index d94170728075..3e183cfee10f 100644 --- a/drivers/rtc/rtc-max6902.c +++ b/drivers/rtc/rtc-max6902.c @@ -13,7 +13,7 @@ * * 24-May-2006: Raphael Assenat <raph@8d.com> * - Major rework - * Converted to rtc_device and uses the SPI layer. + * Converted to rtc_device and uses the SPI layer. * * ??-???-2005: Someone at Compulab * - Initial driver creation. @@ -259,11 +259,11 @@ static int __devexit max6902_remove(struct spi_device *spi) static struct spi_driver max6902_driver = { .driver = { - .name = "max6902", + .name = "rtc-max6902", .bus = &spi_bus_type, .owner = THIS_MODULE, }, - .probe = max6902_probe, + .probe = max6902_probe, .remove = __devexit_p(max6902_remove), }; diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c index f50f3fc353cd..839462659afa 100644 --- a/drivers/rtc/rtc-rs5c348.c +++ b/drivers/rtc/rtc-rs5c348.c @@ -226,7 +226,7 @@ static int __devexit rs5c348_remove(struct spi_device *spi) static struct spi_driver rs5c348_driver = { .driver = { - .name = "rs5c348", + .name = "rtc-rs5c348", .bus = &spi_bus_type, .owner = THIS_MODULE, }, diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 09bbe575647b..6b67b5097927 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c @@ -13,13 +13,7 @@ #include <linux/rtc.h> #include <linux/bcd.h> -#define DRV_VERSION "0.4" - -/* Addresses to scan */ -static unsigned short normal_i2c[] = { /* 0x32,*/ I2C_CLIENT_END }; - -/* Insmod parameters */ -I2C_CLIENT_INSMOD; +#define DRV_VERSION "0.5" /* @@ -88,9 +82,6 @@ struct rs5c372 { unsigned has_irq:1; char buf[17]; char *regs; - - /* on conversion to a "new style" i2c driver, this vanishes */ - struct i2c_client dev; }; static int rs5c_get_regs(struct rs5c372 *rs5c) @@ -483,25 +474,35 @@ static int rs5c_sysfs_register(struct device *dev) return err; } +static void rs5c_sysfs_unregister(struct device *dev) +{ + device_remove_file(dev, &dev_attr_trim); + device_remove_file(dev, &dev_attr_osc); +} + #else static int rs5c_sysfs_register(struct device *dev) { return 0; } + +static void rs5c_sysfs_unregister(struct device *dev) +{ + /* nothing */ +} #endif /* SYSFS */ static struct i2c_driver rs5c372_driver; -static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) +static int rs5c372_probe(struct i2c_client *client) { int err = 0; - struct i2c_client *client; struct rs5c372 *rs5c372; struct rtc_time tm; - dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); + dev_dbg(&client->dev, "%s\n", __FUNCTION__); - if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { + if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { err = -ENODEV; goto exit; } @@ -514,35 +515,22 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) /* we read registers 0x0f then 0x00-0x0f; skip the first one */ rs5c372->regs=&rs5c372->buf[1]; - /* On conversion to a "new style" i2c driver, we'll be handed - * the i2c_client (we won't create it) - */ - client = &rs5c372->dev; rs5c372->client = client; - - /* I2C client */ - client->addr = address; - client->driver = &rs5c372_driver; - client->adapter = adapter; - - strlcpy(client->name, rs5c372_driver.driver.name, I2C_NAME_SIZE); - i2c_set_clientdata(client, rs5c372); - /* Inform the i2c layer */ - if ((err = i2c_attach_client(client))) - goto exit_kfree; - err = rs5c_get_regs(rs5c372); if (err < 0) - goto exit_detach; + goto exit_kfree; - /* For "new style" drivers, irq is in i2c_client and chip type - * info comes from i2c_client.dev.platform_data. Meanwhile: - * - * STICK BOARD-SPECIFIC SETUP CODE RIGHT HERE - */ - if (rs5c372->type == rtc_undef) { + if (strcmp(client->name, "rs5c372a") == 0) + rs5c372->type = rtc_rs5c372a; + else if (strcmp(client->name, "rs5c372b") == 0) + rs5c372->type = rtc_rs5c372b; + else if (strcmp(client->name, "rv5c386") == 0) + rs5c372->type = rtc_rv5c386; + else if (strcmp(client->name, "rv5c387a") == 0) + rs5c372->type = rtc_rv5c387a; + else { rs5c372->type = rtc_rs5c372b; dev_warn(&client->dev, "assuming rs5c372b\n"); } @@ -567,7 +555,7 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) break; default: dev_err(&client->dev, "unknown RTC type\n"); - goto exit_detach; + goto exit_kfree; } /* if the oscillator lost power and no other software (like @@ -601,7 +589,7 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) if ((i2c_master_send(client, buf, 3)) != 3) { dev_err(&client->dev, "setup error\n"); - goto exit_detach; + goto exit_kfree; } rs5c372->regs[RS5C_REG_CTRL1] = buf[1]; rs5c372->regs[RS5C_REG_CTRL2] = buf[2]; @@ -621,14 +609,14 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) rs5c372->time24 ? "24hr" : "am/pm" ); - /* FIXME when client->irq exists, use it to register alarm irq */ + /* REVISIT use client->irq to register alarm irq ... */ rs5c372->rtc = rtc_device_register(rs5c372_driver.driver.name, &client->dev, &rs5c372_rtc_ops, THIS_MODULE); if (IS_ERR(rs5c372->rtc)) { err = PTR_ERR(rs5c372->rtc); - goto exit_detach; + goto exit_kfree; } err = rs5c_sysfs_register(&client->dev); @@ -640,9 +628,6 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) exit_devreg: rtc_device_unregister(rs5c372->rtc); -exit_detach: - i2c_detach_client(client); - exit_kfree: kfree(rs5c372); @@ -650,24 +635,12 @@ exit: return err; } -static int rs5c372_attach(struct i2c_adapter *adapter) +static int rs5c372_remove(struct i2c_client *client) { - return i2c_probe(adapter, &addr_data, rs5c372_probe); -} - -static int rs5c372_detach(struct i2c_client *client) -{ - int err; struct rs5c372 *rs5c372 = i2c_get_clientdata(client); - if (rs5c372->rtc) - rtc_device_unregister(rs5c372->rtc); - - /* REVISIT properly destroy the sysfs files ... */ - - if ((err = i2c_detach_client(client))) - return err; - + rtc_device_unregister(rs5c372->rtc); + rs5c_sysfs_unregister(&client->dev); kfree(rs5c372); return 0; } @@ -676,8 +649,8 @@ static struct i2c_driver rs5c372_driver = { .driver = { .name = "rtc-rs5c372", }, - .attach_adapter = &rs5c372_attach, - .detach_client = &rs5c372_detach, + .probe = rs5c372_probe, + .remove = rs5c372_remove, }; static __init int rs5c372_init(void) diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 54b613053468..8c1012b432bb 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c @@ -29,7 +29,7 @@ #include <asm/mach/time.h> -#include <asm/arch/regs-rtc.h> +#include <asm/plat-s3c/regs-rtc.h> /* I have yet to find an S3C implementation with more than one * of these rtc blocks in */ diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index e0f91dfce0f5..93ee05eeaeba 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c @@ -365,6 +365,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) /* Reset pre-scaler & stop RTC */ tmp = readb(rtc->regbase + RCR2); tmp |= RCR2_RESET; + tmp &= ~RCR2_START; writeb(tmp, rtc->regbase + RCR2); writeb(BIN2BCD(tm->tm_sec), rtc->regbase + RSECCNT); diff --git a/drivers/rtc/rtc-v3020.c b/drivers/rtc/rtc-v3020.c index 3b58d3d5d38a..a6b572978dc0 100644 --- a/drivers/rtc/rtc-v3020.c +++ b/drivers/rtc/rtc-v3020.c @@ -26,6 +26,7 @@ #include <linux/types.h> #include <linux/bcd.h> #include <linux/rtc-v3020.h> +#include <linux/delay.h> #include <asm/io.h> @@ -47,6 +48,7 @@ static void v3020_set_reg(struct v3020 *chip, unsigned char address, for (i = 0; i < 4; i++) { writel((tmp & 1) << chip->leftshift, chip->ioaddress); tmp >>= 1; + udelay(1); } /* Commands dont have data */ @@ -54,6 +56,7 @@ static void v3020_set_reg(struct v3020 *chip, unsigned char address, for (i = 0; i < 8; i++) { writel((data & 1) << chip->leftshift, chip->ioaddress); data >>= 1; + udelay(1); } } } @@ -66,12 +69,14 @@ static unsigned char v3020_get_reg(struct v3020 *chip, unsigned char address) for (i = 0; i < 4; i++) { writel((address & 1) << chip->leftshift, chip->ioaddress); address >>= 1; + udelay(1); } for (i = 0; i < 8; i++) { data >>= 1; if (readl(chip->ioaddress) & (1 << chip->leftshift)) data |= 0x80; + udelay(1); } return data; @@ -95,7 +100,7 @@ static int v3020_read_time(struct device *dev, struct rtc_time *dt) tmp = v3020_get_reg(chip, V3020_MONTH_DAY); dt->tm_mday = BCD2BIN(tmp); tmp = v3020_get_reg(chip, V3020_MONTH); - dt->tm_mon = BCD2BIN(tmp); + dt->tm_mon = BCD2BIN(tmp) - 1; tmp = v3020_get_reg(chip, V3020_WEEK_DAY); dt->tm_wday = BCD2BIN(tmp); tmp = v3020_get_reg(chip, V3020_YEAR); @@ -135,7 +140,7 @@ static int v3020_set_time(struct device *dev, struct rtc_time *dt) v3020_set_reg(chip, V3020_MINUTES, BIN2BCD(dt->tm_min)); v3020_set_reg(chip, V3020_HOURS, BIN2BCD(dt->tm_hour)); v3020_set_reg(chip, V3020_MONTH_DAY, BIN2BCD(dt->tm_mday)); - v3020_set_reg(chip, V3020_MONTH, BIN2BCD(dt->tm_mon)); + v3020_set_reg(chip, V3020_MONTH, BIN2BCD(dt->tm_mon + 1)); v3020_set_reg(chip, V3020_WEEK_DAY, BIN2BCD(dt->tm_wday)); v3020_set_reg(chip, V3020_YEAR, BIN2BCD(dt->tm_year % 100)); diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c index af7596ef29e2..ce2f78de7a80 100644 --- a/drivers/rtc/rtc-vr41xx.c +++ b/drivers/rtc/rtc-vr41xx.c @@ -17,10 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include <linux/err.h> #include <linux/fs.h> #include <linux/init.h> #include <linux/ioport.h> -#include <linux/irq.h> +#include <linux/interrupt.h> #include <linux/module.h> #include <linux/platform_device.h> #include <linux/rtc.h> @@ -30,25 +31,11 @@ #include <asm/div64.h> #include <asm/io.h> #include <asm/uaccess.h> -#include <asm/vr41xx/irq.h> MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>"); MODULE_DESCRIPTION("NEC VR4100 series RTC driver"); MODULE_LICENSE("GPL"); -#define RTC1_TYPE1_START 0x0b0000c0UL -#define RTC1_TYPE1_END 0x0b0000dfUL -#define RTC2_TYPE1_START 0x0b0001c0UL -#define RTC2_TYPE1_END 0x0b0001dfUL - -#define RTC1_TYPE2_START 0x0f000100UL -#define RTC1_TYPE2_END 0x0f00011fUL -#define RTC2_TYPE2_START 0x0f000120UL -#define RTC2_TYPE2_END 0x0f00013fUL - -#define RTC1_SIZE 0x20 -#define RTC2_SIZE 0x20 - /* RTC 1 registers */ #define ETIMELREG 0x00 #define ETIMEMREG 0x02 @@ -98,13 +85,8 @@ static char rtc_name[] = "RTC"; static unsigned long periodic_frequency; static unsigned long periodic_count; static unsigned int alarm_enabled; - -struct resource rtc_resource[2] = { - { .name = rtc_name, - .flags = IORESOURCE_MEM, }, - { .name = rtc_name, - .flags = IORESOURCE_MEM, }, -}; +static int aie_irq = -1; +static int pie_irq = -1; static inline unsigned long read_elapsed_second(void) { @@ -150,8 +132,8 @@ static void vr41xx_rtc_release(struct device *dev) spin_unlock_irq(&rtc_lock); - disable_irq(ELAPSEDTIME_IRQ); - disable_irq(RTCLONG1_IRQ); + disable_irq(aie_irq); + disable_irq(pie_irq); } static int vr41xx_rtc_read_time(struct device *dev, struct rtc_time *time) @@ -209,14 +191,14 @@ static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) spin_lock_irq(&rtc_lock); if (alarm_enabled) - disable_irq(ELAPSEDTIME_IRQ); + disable_irq(aie_irq); rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15)); rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1)); rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17)); if (wkalrm->enabled) - enable_irq(ELAPSEDTIME_IRQ); + enable_irq(aie_irq); alarm_enabled = wkalrm->enabled; @@ -234,7 +216,7 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long spin_lock_irq(&rtc_lock); if (!alarm_enabled) { - enable_irq(ELAPSEDTIME_IRQ); + enable_irq(aie_irq); alarm_enabled = 1; } @@ -244,17 +226,17 @@ static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long spin_lock_irq(&rtc_lock); if (alarm_enabled) { - disable_irq(ELAPSEDTIME_IRQ); + disable_irq(aie_irq); alarm_enabled = 0; } spin_unlock_irq(&rtc_lock); break; case RTC_PIE_ON: - enable_irq(RTCLONG1_IRQ); + enable_irq(pie_irq); break; case RTC_PIE_OFF: - disable_irq(RTCLONG1_IRQ); + disable_irq(pie_irq); break; case RTC_IRQP_READ: return put_user(periodic_frequency, (unsigned long __user *)arg); @@ -331,31 +313,37 @@ static const struct rtc_class_ops vr41xx_rtc_ops = { static int __devinit rtc_probe(struct platform_device *pdev) { + struct resource *res; struct rtc_device *rtc; - unsigned int irq; int retval; - if (pdev->num_resources != 2) + if (pdev->num_resources != 4) return -EBUSY; - rtc1_base = ioremap(pdev->resource[0].start, RTC1_SIZE); - if (rtc1_base == NULL) + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) return -EBUSY; - rtc2_base = ioremap(pdev->resource[1].start, RTC2_SIZE); - if (rtc2_base == NULL) { - iounmap(rtc1_base); - rtc1_base = NULL; + rtc1_base = ioremap(res->start, res->end - res->start + 1); + if (!rtc1_base) return -EBUSY; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + if (!res) { + retval = -EBUSY; + goto err_rtc1_iounmap; + } + + rtc2_base = ioremap(res->start, res->end - res->start + 1); + if (!rtc2_base) { + retval = -EBUSY; + goto err_rtc1_iounmap; } rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE); if (IS_ERR(rtc)) { - iounmap(rtc1_base); - iounmap(rtc2_base); - rtc1_base = NULL; - rtc2_base = NULL; - return PTR_ERR(rtc); + retval = PTR_ERR(rtc); + goto err_iounmap_all; } spin_lock_irq(&rtc_lock); @@ -368,35 +356,50 @@ static int __devinit rtc_probe(struct platform_device *pdev) spin_unlock_irq(&rtc_lock); - irq = ELAPSEDTIME_IRQ; - retval = request_irq(irq, elapsedtime_interrupt, IRQF_DISABLED, - "elapsed_time", pdev); - if (retval == 0) { - irq = RTCLONG1_IRQ; - retval = request_irq(irq, rtclong1_interrupt, IRQF_DISABLED, - "rtclong1", pdev); + aie_irq = platform_get_irq(pdev, 0); + if (aie_irq < 0 || aie_irq >= NR_IRQS) { + retval = -EBUSY; + goto err_device_unregister; } - if (retval < 0) { - printk(KERN_ERR "rtc: IRQ%d is busy\n", irq); - rtc_device_unregister(rtc); - if (irq == RTCLONG1_IRQ) - free_irq(ELAPSEDTIME_IRQ, NULL); - iounmap(rtc1_base); - iounmap(rtc2_base); - rtc1_base = NULL; - rtc2_base = NULL; - return retval; - } + retval = request_irq(aie_irq, elapsedtime_interrupt, IRQF_DISABLED, + "elapsed_time", pdev); + if (retval < 0) + goto err_device_unregister; + + pie_irq = platform_get_irq(pdev, 1); + if (pie_irq < 0 || pie_irq >= NR_IRQS) + goto err_free_irq; + + retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED, + "rtclong1", pdev); + if (retval < 0) + goto err_free_irq; platform_set_drvdata(pdev, rtc); - disable_irq(ELAPSEDTIME_IRQ); - disable_irq(RTCLONG1_IRQ); + disable_irq(aie_irq); + disable_irq(pie_irq); printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n"); return 0; + +err_free_irq: + free_irq(aie_irq, pdev); + +err_device_unregister: + rtc_device_unregister(rtc); + +err_iounmap_all: + iounmap(rtc2_base); + rtc2_base = NULL; + +err_rtc1_iounmap: + iounmap(rtc1_base); + rtc1_base = NULL; + + return retval; } static int __devexit rtc_remove(struct platform_device *pdev) @@ -404,23 +407,21 @@ static int __devexit rtc_remove(struct platform_device *pdev) struct rtc_device *rtc; rtc = platform_get_drvdata(pdev); - if (rtc != NULL) + if (rtc) rtc_device_unregister(rtc); platform_set_drvdata(pdev, NULL); - free_irq(ELAPSEDTIME_IRQ, NULL); - free_irq(RTCLONG1_IRQ, NULL); - if (rtc1_base != NULL) + free_irq(aie_irq, pdev); + free_irq(pie_irq, pdev); + if (rtc1_base) iounmap(rtc1_base); - if (rtc2_base != NULL) + if (rtc2_base) iounmap(rtc2_base); return 0; } -static struct platform_device *rtc_platform_device; - static struct platform_driver rtc_platform_driver = { .probe = rtc_probe, .remove = __devexit_p(rtc_remove), @@ -432,55 +433,12 @@ static struct platform_driver rtc_platform_driver = { static int __init vr41xx_rtc_init(void) { - int retval; - - switch (current_cpu_data.cputype) { - case CPU_VR4111: - case CPU_VR4121: - rtc_resource[0].start = RTC1_TYPE1_START; - rtc_resource[0].end = RTC1_TYPE1_END; - rtc_resource[1].start = RTC2_TYPE1_START; - rtc_resource[1].end = RTC2_TYPE1_END; - break; - case CPU_VR4122: - case CPU_VR4131: - case CPU_VR4133: - rtc_resource[0].start = RTC1_TYPE2_START; - rtc_resource[0].end = RTC1_TYPE2_END; - rtc_resource[1].start = RTC2_TYPE2_START; - rtc_resource[1].end = RTC2_TYPE2_END; - break; - default: - return -ENODEV; - break; - } - - rtc_platform_device = platform_device_alloc("RTC", -1); - if (rtc_platform_device == NULL) - return -ENOMEM; - - retval = platform_device_add_resources(rtc_platform_device, - rtc_resource, ARRAY_SIZE(rtc_resource)); - - if (retval == 0) - retval = platform_device_add(rtc_platform_device); - - if (retval < 0) { - platform_device_put(rtc_platform_device); - return retval; - } - - retval = platform_driver_register(&rtc_platform_driver); - if (retval < 0) - platform_device_unregister(rtc_platform_device); - - return retval; + return platform_driver_register(&rtc_platform_driver); } static void __exit vr41xx_rtc_exit(void) { platform_driver_unregister(&rtc_platform_driver); - platform_device_unregister(rtc_platform_device); } module_init(vr41xx_rtc_init); diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index 513d1a611aab..b3fae357ca49 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c @@ -9,6 +9,9 @@ * * based on a lot of other RTC drivers. * + * Information and datasheet: + * http://www.intersil.com/cda/deviceinfo/0,1477,X1205,00.html + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. @@ -26,7 +29,7 @@ * Two bytes need to be written to read a single register, * while most other chips just require one and take the second * one as the data to be written. To prevent corrupting - * unknown chips, the user must explicitely set the probe parameter. + * unknown chips, the user must explicitly set the probe parameter. */ static unsigned short normal_i2c[] = { I2C_CLIENT_END }; |