Skip to content

Commit

Permalink
Merge tag 'rtc-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…abelloni/linux

Pull RTC updates from Alexandre Belloni:
 "RTC for 4.9

  Subsystem:
   - delete owner assignment in multiple drivers
   - constify rtc_class_ops structures

  Drivers:
   - ac100: support clock-output-names
   - cmos: properly handle ACPI alarms and quirky BIOSes and other fixes
   - ds1307: fix century bit support while staying comaptible with
     previous behaviour by default
   - ds1347: switch to regmap
   - isl12057 is now handled by ds1307
   - omap: support external wakeup
   - rv8803: allow to disable voltage drop detection"

* tag 'rtc-4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (25 commits)
  rtc: rv8803: set VDETOFF and SWOFF via device tree
  dt/bindings: Add bindings for Micro Crystal rv8803
  devicetree: Add Micro Crystal AG vendor id
  rtc: cmos: avoid unused function warning
  rtc: ac100: Add NULL checking for devm_kzalloc call
  rtc: ds1347: changed raw spi calls to register map calls
  rtc: cmos: Restore alarm after resume
  rtc: cmos: Clear ACPI-driven alarms upon resume
  rtc: omap: Support ext_wakeup configuration
  rtc: cmos: Initialize hpet timer before irq is registered
  rtc: asm9260: rework locking
  rtc: asm9260: allow COMPILE_TEST
  rtc: constify rtc_class_ops structures
  rtc: ac100: support clock-output-names in device tree binding
  rtc: rx6110: remove owner assignment
  rtc: pic32: Delete owner assignment
  rtc: bq32k: Fix handling of oscillator failure flag
  rtc: bq32k: Use correct mask name for 'minutes' register.
  rtc: sysfs: fix a cast removing the const attribute
  Documentation: dt: Intersil isl12057 is not a trivial device
  ...
  • Loading branch information
torvalds committed Oct 14, 2016
2 parents e505014 + 1cd7137 commit 8b70f71
Show file tree
Hide file tree
Showing 37 changed files with 498 additions and 782 deletions.
1 change: 0 additions & 1 deletion Documentation/devicetree/bindings/i2c/trivial-devices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ fsl,sgtl5000 SGTL5000: Ultra Low-Power Audio Codec
gmt,g751 G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire Interface
infineon,slb9635tt Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
infineon,slb9645tt Infineon SLB9645 I2C TPM (new protocol, max 400khz)
isil,isl12057 Intersil ISL12057 I2C RTC Chip
isil,isl29028 Intersil ISL29028 Ambient Light and Proximity Sensor
maxim,ds1050 5 Bit Programmable, Pulse-Width Modulator
maxim,max1237 Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/rtc/dallas,ds1390.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Optional properties:
- trickle-diode-disable : Do not use internal trickle charger diode
Should be given if internal trickle charger diode should be disabled
Example:
ds1390: rtc@68 {
ds1390: rtc@0 {
compatible = "dallas,ds1390";
trickle-resistor-ohms = <250>;
reg = <0>;
Expand Down
22 changes: 22 additions & 0 deletions Documentation/devicetree/bindings/rtc/epson,rx8900.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Real Time Clock driver for:
- Epson RX8900
- Micro Crystal rv8803

Required properties:
- compatible: should be: "microcrystal,rv8803" or "epson,rx8900"
- reg : the I2C address of the device for I2C

Optional properties:
- epson,vdet-disable : boolean, if present will disable voltage detector.
Should be set if no backup battery is used.
- trickle-diode-disable : boolean, if present will disable internal trickle
charger diode

Example:

rtc: rtc@32 {
compatible = "epson,rx8900"
reg = <0x32>;
epson,vdet-disable;
trickle-diode-disable;
};
21 changes: 21 additions & 0 deletions Documentation/devicetree/bindings/rtc/rtc-omap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ Optional properties:
through pmic_power_en
- clocks: Any internal or external clocks feeding in to rtc
- clock-names: Corresponding names of the clocks
- pinctrl-0: a phandle pointing to the pin settings for the device
- pinctrl-names: should be "default"

Optional subnodes:
- generic pinctrl node

Required pinctrl subnodes properties:
- pins - Names of ext_wakeup pins to configure

Optional pinctrl subnodes properties:
- input-enable - Enables ext_wakeup
- ti,active-high - Set input active high (by default active low)

Example:

Expand All @@ -30,4 +42,13 @@ rtc@1c23000 {
system-power-controller;
clocks = <&clk_32k_rtc>, <&clk_32768_ck>;
clock-names = "ext-clk", "int-clk";

pinctrl-0 = <&ext_wakeup>;
pinctrl-names = "default";

ext_wakeup: ext-wakeup {
pins = "ext_wakeup0";
input-enable;
ti,active-high;
};
};
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ melexis Melexis N.V.
merrii Merrii Technology Co., Ltd.
micrel Micrel Inc.
microchip Microchip Technology Inc.
microcrystal Micro Crystal AG
micron Micron Technology Inc.
minix MINIX Technology Ltd.
mitsubishi Mitsubishi Electric Corporation
Expand Down
38 changes: 23 additions & 15 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,14 @@ config RTC_DRV_AS3722
will be called rtc-as3722.

config RTC_DRV_DS1307
tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025"
tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025, ISL12057"
help
If you say yes here you get support for various compatible RTC
chips (often with battery backup) connected with I2C. This driver
should handle DS1307, DS1337, DS1338, DS1339, DS1340, ST M41T00,
EPSON RX-8025 and probably other chips. In some cases the RTC
must already have been initialized (by manufacturing or a
bootloader).
EPSON RX-8025, Intersil ISL12057 and probably other chips. In some
cases the RTC must already have been initialized (by manufacturing or
a bootloader).

The first seven registers on these chips hold an RTC, and other
registers may add features such as NVRAM, a trickle charger for
Expand All @@ -234,6 +234,20 @@ config RTC_DRV_DS1307_HWMON
Say Y here if you want to expose temperature sensor data on
rtc-ds1307 (only DS3231)

config RTC_DRV_DS1307_CENTURY
bool "Century bit support for rtc-ds1307"
depends on RTC_DRV_DS1307
default n
help
The DS1307 driver suffered from a bug where it was enabling the
century bit inconditionnally but never used it when reading the time.
It made the driver unable to support dates beyond 2099.
Setting this option will add proper support for the century bit but if
the time was previously set using a kernel predating this option,
reading the date will return a date in the next century.
To solve that, you could boot a kernel without this option set, set
the RTC date and then boot a kernel with this option set.

config RTC_DRV_DS1374
tristate "Dallas/Maxim DS1374"
help
Expand Down Expand Up @@ -374,16 +388,6 @@ config RTC_DRV_ISL12022
This driver can also be built as a module. If so, the module
will be called rtc-isl12022.

config RTC_DRV_ISL12057
select REGMAP_I2C
tristate "Intersil ISL12057"
help
If you say yes here you get support for the Intersil ISL12057
I2C RTC chip.

This driver can also be built as a module. If so, the module
will be called rtc-isl12057.

config RTC_DRV_X1205
tristate "Xicor/Intersil X1205"
help
Expand Down Expand Up @@ -661,6 +665,7 @@ config RTC_DRV_DS1343
will be called rtc-ds1343.

config RTC_DRV_DS1347
select REGMAP_SPI
tristate "Dallas/Maxim DS1347"
help
If you say yes here you get support for the
Expand Down Expand Up @@ -1201,7 +1206,7 @@ comment "on-CPU RTC drivers"

config RTC_DRV_ASM9260
tristate "Alphascale asm9260 RTC"
depends on MACH_ASM9260
depends on MACH_ASM9260 || COMPILE_TEST
help
If you say yes here you get support for the RTC on the
Alphascale asm9260 SoC.
Expand Down Expand Up @@ -1241,6 +1246,9 @@ config RTC_DRV_IMXDI
config RTC_DRV_OMAP
tristate "TI OMAP Real Time Clock"
depends on ARCH_OMAP || ARCH_DAVINCI || COMPILE_TEST
depends on OF
depends on PINCTRL
select GENERIC_PINCONF
help
Say "yes" here to support the on chip real time clock
present on TI OMAP1, AM33xx, DA8xx/OMAP-L13x, AM43xx and DRA7xx.
Expand Down
1 change: 0 additions & 1 deletion drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o
obj-$(CONFIG_RTC_DRV_HYM8563) += rtc-hym8563.o
obj-$(CONFIG_RTC_DRV_IMXDI) += rtc-imxdi.o
obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o
obj-$(CONFIG_RTC_DRV_ISL12057) += rtc-isl12057.o
obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o
obj-$(CONFIG_RTC_DRV_JZ4740) += rtc-jz4740.o
obj-$(CONFIG_RTC_DRV_LP8788) += rtc-lp8788.o
Expand Down
5 changes: 5 additions & 0 deletions drivers/rtc/rtc-ac100.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ static int ac100_rtc_register_clks(struct ac100_rtc_dev *chip)
.flags = 0,
};

of_property_read_string_index(np, "clock-output-names",
i, &init.name);
clk->regmap = chip->regmap;
clk->offset = AC100_CLKOUT_CTRL1 + i;
clk->hw.init = &init;
Expand Down Expand Up @@ -552,6 +554,9 @@ static int ac100_rtc_probe(struct platform_device *pdev)
int ret;

chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL);
if (!chip)
return -ENOMEM;

platform_set_drvdata(pdev, chip);
chip->dev = &pdev->dev;
chip->regmap = ac100->regmap;
Expand Down
20 changes: 5 additions & 15 deletions drivers/rtc/rtc-asm9260.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ struct asm9260_rtc_priv {
void __iomem *iobase;
struct rtc_device *rtc;
struct clk *clk;
/* io lock */
spinlock_t lock;
};

static irqreturn_t asm9260_rtc_irq(int irq, void *dev_id)
Expand All @@ -122,11 +120,15 @@ static irqreturn_t asm9260_rtc_irq(int irq, void *dev_id)
u32 isr;
unsigned long events = 0;

mutex_lock(&priv->rtc->ops_lock);
isr = ioread32(priv->iobase + HW_CIIR);
if (!isr)
if (!isr) {
mutex_unlock(&priv->rtc->ops_lock);
return IRQ_NONE;
}

iowrite32(0, priv->iobase + HW_CIIR);
mutex_unlock(&priv->rtc->ops_lock);

events |= RTC_AF | RTC_IRQF;

Expand All @@ -139,9 +141,7 @@ static int asm9260_rtc_read_time(struct device *dev, struct rtc_time *tm)
{
struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
u32 ctime0, ctime1, ctime2;
unsigned long irq_flags;

spin_lock_irqsave(&priv->lock, irq_flags);
ctime0 = ioread32(priv->iobase + HW_CTIME0);
ctime1 = ioread32(priv->iobase + HW_CTIME1);
ctime2 = ioread32(priv->iobase + HW_CTIME2);
Expand All @@ -155,7 +155,6 @@ static int asm9260_rtc_read_time(struct device *dev, struct rtc_time *tm)
ctime1 = ioread32(priv->iobase + HW_CTIME1);
ctime2 = ioread32(priv->iobase + HW_CTIME2);
}
spin_unlock_irqrestore(&priv->lock, irq_flags);

tm->tm_sec = (ctime0 >> BM_CTIME0_SEC_S) & BM_CTIME0_SEC_M;
tm->tm_min = (ctime0 >> BM_CTIME0_MIN_S) & BM_CTIME0_MIN_M;
Expand All @@ -174,9 +173,7 @@ static int asm9260_rtc_read_time(struct device *dev, struct rtc_time *tm)
static int asm9260_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
unsigned long irq_flags;

spin_lock_irqsave(&priv->lock, irq_flags);
/*
* make sure SEC counter will not flip other counter on write time,
* real value will be written at the enf of sequence.
Expand All @@ -191,17 +188,14 @@ static int asm9260_rtc_set_time(struct device *dev, struct rtc_time *tm)
iowrite32(tm->tm_hour, priv->iobase + HW_HOUR);
iowrite32(tm->tm_min, priv->iobase + HW_MIN);
iowrite32(tm->tm_sec, priv->iobase + HW_SEC);
spin_unlock_irqrestore(&priv->lock, irq_flags);

return 0;
}

static int asm9260_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
unsigned long irq_flags;

spin_lock_irqsave(&priv->lock, irq_flags);
alrm->time.tm_year = ioread32(priv->iobase + HW_ALYEAR);
alrm->time.tm_mon = ioread32(priv->iobase + HW_ALMON);
alrm->time.tm_mday = ioread32(priv->iobase + HW_ALDOM);
Expand All @@ -213,17 +207,14 @@ static int asm9260_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)

alrm->enabled = ioread32(priv->iobase + HW_AMR) ? 1 : 0;
alrm->pending = ioread32(priv->iobase + HW_CIIR) ? 1 : 0;
spin_unlock_irqrestore(&priv->lock, irq_flags);

return rtc_valid_tm(&alrm->time);
}

static int asm9260_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct asm9260_rtc_priv *priv = dev_get_drvdata(dev);
unsigned long irq_flags;

spin_lock_irqsave(&priv->lock, irq_flags);
iowrite32(alrm->time.tm_year, priv->iobase + HW_ALYEAR);
iowrite32(alrm->time.tm_mon, priv->iobase + HW_ALMON);
iowrite32(alrm->time.tm_mday, priv->iobase + HW_ALDOM);
Expand All @@ -234,7 +225,6 @@ static int asm9260_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
iowrite32(alrm->time.tm_sec, priv->iobase + HW_ALSEC);

iowrite32(alrm->enabled ? 0 : BM_AMR_OFF, priv->iobase + HW_AMR);
spin_unlock_irqrestore(&priv->lock, irq_flags);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/rtc/rtc-at32ap700x.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static irqreturn_t at32_rtc_interrupt(int irq, void *dev_id)
return ret;
}

static struct rtc_class_ops at32_rtc_ops = {
static const struct rtc_class_ops at32_rtc_ops = {
.read_time = at32_rtc_readtime,
.set_time = at32_rtc_settime,
.read_alarm = at32_rtc_readalarm,
Expand Down
16 changes: 10 additions & 6 deletions drivers/rtc/rtc-bq32k.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,15 @@ static int bq32k_rtc_read_time(struct device *dev, struct rtc_time *tm)
if (error)
return error;

/*
* In case of oscillator failure, the register contents should be
* considered invalid. The flag is cleared the next time the RTC is set.
*/
if (regs.minutes & BQ32K_OF)
return -EINVAL;

tm->tm_sec = bcd2bin(regs.seconds & BQ32K_SECONDS_MASK);
tm->tm_min = bcd2bin(regs.minutes & BQ32K_SECONDS_MASK);
tm->tm_min = bcd2bin(regs.minutes & BQ32K_MINUTES_MASK);
tm->tm_hour = bcd2bin(regs.cent_hours & BQ32K_HOURS_MASK);
tm->tm_mday = bcd2bin(regs.date);
tm->tm_wday = bcd2bin(regs.day) - 1;
Expand Down Expand Up @@ -204,13 +211,10 @@ static int bq32k_probe(struct i2c_client *client,

/* Check Oscillator Failure flag */
error = bq32k_read(dev, &reg, BQ32K_MINUTES, 1);
if (!error && (reg & BQ32K_OF)) {
dev_warn(dev, "Oscillator Failure. Check RTC battery.\n");
reg &= ~BQ32K_OF;
error = bq32k_write(dev, &reg, BQ32K_MINUTES, 1);
}
if (error)
return error;
if (reg & BQ32K_OF)
dev_warn(dev, "Oscillator Failure. Check RTC battery.\n");

if (client->dev.of_node)
trickle_charger_of_init(dev, client->dev.of_node);
Expand Down
Loading

0 comments on commit 8b70f71

Please sign in to comment.