Skip to content

Commit

Permalink
Merge tag 'rtc-5.4' 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:
 "Two new drivers and the new pcf2127 feature make the bulk of the
  additions. The rest are the usual fixes and new features.

  Subsystem:
   - add debug message when registration fails

  New drivers:
   - Amlogic Virtual Wake
   - Freescale FlexTimer Module alarm

  Drivers:
   - remove superfluous error messages
   - convert to i2c_new_dummy_device and devm_i2c_new_dummy_device
   - Remove dev_err() usage after platform_get_irq()
   - Set RTC range for: pcf2123, pcf8563, snvs.
   - pcf2127: tamper detection and watchdog support
   - pcf85363: fix regmap issue
   - sun6i: H6 support
   - remove w90x900/nuc900 driver"

* tag 'rtc-5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (51 commits)
  rtc: meson: mark PM functions as __maybe_unused
  rtc: sc27xx: Remove clearing SPRD_RTC_POWEROFF_ALM_FLAG flag
  dt-bindings: rtc: ds1307: add rx8130 compatible
  rtc: sun6i: Allow using as wakeup source from suspend
  rtc: pcf8563: let the core handle range offsetting
  rtc: pcf8563: remove useless indirection
  rtc: pcf8563: convert to devm_rtc_allocate_device
  rtc: pcf8563: add Microcrystal RV8564 compatible
  rtc: pcf8563: add Epson RTC8564 compatible
  rtc: s35390a: convert to devm_i2c_new_dummy_device()
  rtc: max77686: convert to devm_i2c_new_dummy_device()
  rtc: pcf85363/pcf85263: fix regmap error in set_time
  rtc: snvs: switch to rtc_time64_to_tm/rtc_tm_to_time64
  rtc: snvs: set range
  rtc: snvs: fix possible race condition
  rtc: pcf2127: bugfix: watchdog build dependency
  rtc: pcf2127: add tamper detection support
  rtc: pcf2127: add watchdog feature support
  rtc: pcf2127: bugfix: read rtc disables watchdog
  rtc: pcf2127: cleanup register and bit defines
  ...
  • Loading branch information
torvalds committed Sep 22, 2019
2 parents 379bb04 + b99a312 commit 9dbd83f
Show file tree
Hide file tree
Showing 66 changed files with 1,214 additions and 727 deletions.
13 changes: 13 additions & 0 deletions Documentation/devicetree/bindings/rtc/allwinner,sun6i-a31-rtc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ properties:
- items:
- const: allwinner,sun50i-a64-rtc
- const: allwinner,sun8i-h3-rtc
- const: allwinner,sun50i-h6-rtc

reg:
maxItems: 1
Expand Down Expand Up @@ -92,6 +93,18 @@ allOf:
minItems: 3
maxItems: 3

- if:
properties:
compatible:
contains:
const: allwinner,sun50i-h6-rtc

then:
properties:
clock-output-names:
minItems: 3
maxItems: 3

- if:
properties:
compatible:
Expand Down
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/rtc/nxp,rtc-2123.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NXP PCF2123 SPI Real Time Clock

Required properties:
- compatible: should be: "nxp,rtc-pcf2123"
- compatible: should be: "nxp,pcf2123"
or "microcrystal,rv2123"
- reg: should be the SPI slave chipselect address

Expand All @@ -11,7 +11,7 @@ Optional properties:
Example:

pcf2123: rtc@3 {
compatible = "nxp,rtc-pcf2123"
compatible = "nxp,pcf2123"
reg = <3>
spi-cs-high;
};
4 changes: 3 additions & 1 deletion Documentation/devicetree/bindings/rtc/pcf8563.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Philips PCF8563/Epson RTC8564 Real Time Clock

Required properties:
- compatible: Should contain "nxp,pcf8563".
- compatible: Should contain "nxp,pcf8563",
"epson,rtc8564" or
"microcrystal,rv8564"
- reg: I2C address for chip.

Optional property:
Expand Down
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/rtc/rtc-ds1307.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Required properties:
"pericom,pt7c4338",
"epson,rx8025",
"isil,isl12057"
"epson,rx8130"
- reg: I2C bus address of the device

Optional properties:
Expand Down
36 changes: 36 additions & 0 deletions Documentation/devicetree/bindings/rtc/rtc-fsl-ftm-alarm.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Freescale FlexTimer Module (FTM) Alarm

Required properties:
- compatible : Should be "fsl,<chip>-ftm-alarm", the
supported chips include
"fsl,ls1012a-ftm-alarm"
"fsl,ls1021a-ftm-alarm"
"fsl,ls1028a-ftm-alarm"
"fsl,ls1043a-ftm-alarm"
"fsl,ls1046a-ftm-alarm"
"fsl,ls1088a-ftm-alarm"
"fsl,ls208xa-ftm-alarm"
"fsl,lx2160a-ftm-alarm"
- reg : Specifies base physical address and size of the register sets for the
FlexTimer Module.
- interrupts : Should be the FlexTimer Module interrupt.
- fsl,rcpm-wakeup property and rcpm node : Please refer
Documentation/devicetree/bindings/soc/fsl/rcpm.txt

Optional properties:
- big-endian: If the host controller is big-endian mode, specify this property.
The default endian mode is little-endian.

Example:
rcpm: rcpm@1e34040 {
compatible = "fsl,ls1088a-rcpm", "fsl,qoriq-rcpm-2.1+";
reg = <0x0 0x1e34040 0x0 0x18>;
#fsl,rcpm-wakeup-cells = <6>;
};

ftm_alarm0: timer@2800000 {
compatible = "fsl,ls1088a-ftm-alarm";
reg = <0x0 0x2800000 0x0 0x10000>;
fsl,rcpm-wakeup = <&rcpm 0x0 0x0 0x0 0x0 0x4000 0x0>;
interrupts = <0 44 4>;
};
22 changes: 22 additions & 0 deletions Documentation/devicetree/bindings/rtc/rtc-meson-vrtc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
* Amlogic Virtual RTC (VRTC)

This is a Linux interface to an RTC managed by firmware, hence it's
virtual from a Linux perspective. The interface is 1 register where
an alarm time (in seconds) is to be written.

Required properties:
- compatible: should be "amlogic,meson-vrtc"
- reg: physical address for the alarm register

The alarm register is a simple scratch register shared between the
application processors (AP) and the secure co-processor (SCP.) When
the AP suspends, the SCP will use the value of this register to
program an always-on timer before going sleep. When the timer expires,
the SCP will wake up and will then wake the AP.

Example:

vrtc: rtc@0a8 {
compatible = "amlogic,meson-vrtc";
reg = <0x0 0x000a8 0x0 0x4>;
};
2 changes: 0 additions & 2 deletions Documentation/devicetree/bindings/rtc/trivial-rtc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ properties:
- nxp,pcf2127
# Real-time clock
- nxp,pcf2129
# Real-time clock/calendar
- nxp,pcf8563
# Real-time Clock Module
- pericom,pt7c4338
# I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1466,6 +1466,7 @@ F: arch/arm64/boot/dts/amlogic/
F: drivers/pinctrl/meson/
F: drivers/mmc/host/meson*
F: drivers/soc/amlogic/
F: drivers/rtc/rtc-meson*
N: meson

ARM/Amlogic Meson SoC Sound Drivers
Expand Down
42 changes: 34 additions & 8 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,17 @@ config RTC_DRV_MAX77686
This driver can also be built as a module. If so, the module
will be called rtc-max77686.

config RTC_DRV_MESON_VRTC
tristate "Amlogic Meson Virtual RTC"
depends on ARCH_MESON || COMPILE_TEST
default m if ARCH_MESON
help
If you say yes here you will get support for the
Virtual RTC of Amlogic SoCs.

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

config RTC_DRV_RK808
tristate "Rockchip RK805/RK808/RK809/RK817/RK818 RTC"
depends on MFD_RK808
Expand Down Expand Up @@ -500,6 +511,7 @@ config RTC_DRV_M41T80_WDT
watchdog timer in the ST M41T60 and M41T80 RTC chips series.
config RTC_DRV_BD70528
tristate "ROHM BD70528 PMIC RTC"
depends on MFD_ROHM_BD70528 && (BD70528_WATCHDOG || !BD70528_WATCHDOG)
help
If you say Y here you will get support for the RTC
on ROHM BD70528 Power Management IC.
Expand Down Expand Up @@ -874,9 +886,15 @@ config RTC_DRV_DS3232_HWMON
config RTC_DRV_PCF2127
tristate "NXP PCF2127"
depends on RTC_I2C_AND_SPI
select WATCHDOG_CORE if WATCHDOG
help
If you say yes here you get support for the NXP PCF2127/29 RTC
chips.
chips with integrated quartz crystal for industrial applications.
Both chips also have watchdog timer and tamper switch detection
features.

PCF2127 has an additional feature of 512 bytes battery backed
memory that's accessible using nvmem interface.

This driver can also be built as a module. If so, the module
will be called rtc-pcf2127.
Expand Down Expand Up @@ -1247,13 +1265,6 @@ config RTC_DRV_AB8500
Select this to enable the ST-Ericsson AB8500 power management IC RTC
support. This chip contains a battery- and capacitor-backed RTC.

config RTC_DRV_NUC900
tristate "NUC910/NUC920 RTC driver"
depends on ARCH_W90X900 || COMPILE_TEST
help
If you say yes here you get support for the RTC subsystem of the
NUC910/NUC920 used in embedded systems.

config RTC_DRV_OPAL
tristate "IBM OPAL RTC driver"
depends on PPC_POWERNV
Expand Down Expand Up @@ -1323,6 +1334,21 @@ config RTC_DRV_IMXDI
This driver can also be built as a module, if so, the module
will be called "rtc-imxdi".

config RTC_DRV_FSL_FTM_ALARM
tristate "Freescale FlexTimer alarm timer"
depends on ARCH_LAYERSCAPE || SOC_LS1021A
select FSL_RCPM
default y
help
For the FlexTimer in LS1012A, LS1021A, LS1028A, LS1043A, LS1046A,
LS1088A, LS208xA, we can use FTM as the wakeup source.

Say y here to enable FTM alarm support. The FTM alarm provides
alarm functions for wakeup system from deep sleep.

This driver can also be built as a module, if so, the module
will be called "rtc-fsl-ftm-alarm".

config RTC_DRV_MESON
tristate "Amlogic Meson RTC"
depends on (ARM && ARCH_MESON) || COMPILE_TEST
Expand Down
3 changes: 2 additions & 1 deletion drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ obj-$(CONFIG_RTC_DRV_EFI) += rtc-efi.o
obj-$(CONFIG_RTC_DRV_EM3027) += rtc-em3027.o
obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o
obj-$(CONFIG_RTC_DRV_FM3130) += rtc-fm3130.o
obj-$(CONFIG_RTC_DRV_FSL_FTM_ALARM) += rtc-fsl-ftm-alarm.o
obj-$(CONFIG_RTC_DRV_FTRTC010) += rtc-ftrtc010.o
obj-$(CONFIG_RTC_DRV_GENERIC) += rtc-generic.o
obj-$(CONFIG_RTC_DRV_GOLDFISH) += rtc-goldfish.o
Expand Down Expand Up @@ -102,6 +103,7 @@ obj-$(CONFIG_RTC_DRV_MAX8907) += rtc-max8907.o
obj-$(CONFIG_RTC_DRV_MAX8925) += rtc-max8925.o
obj-$(CONFIG_RTC_DRV_MAX8997) += rtc-max8997.o
obj-$(CONFIG_RTC_DRV_MAX8998) += rtc-max8998.o
obj-$(CONFIG_RTC_DRV_MESON_VRTC)+= rtc-meson-vrtc.o
obj-$(CONFIG_RTC_DRV_MC13XXX) += rtc-mc13xxx.o
obj-$(CONFIG_RTC_DRV_MCP795) += rtc-mcp795.o
obj-$(CONFIG_RTC_DRV_MESON) += rtc-meson.o
Expand All @@ -113,7 +115,6 @@ obj-$(CONFIG_RTC_DRV_MT7622) += rtc-mt7622.o
obj-$(CONFIG_RTC_DRV_MV) += rtc-mv.o
obj-$(CONFIG_RTC_DRV_MXC) += rtc-mxc.o
obj-$(CONFIG_RTC_DRV_MXC_V2) += rtc-mxc_v2.o
obj-$(CONFIG_RTC_DRV_NUC900) += rtc-nuc900.o
obj-$(CONFIG_RTC_DRV_OMAP) += rtc-omap.o
obj-$(CONFIG_RTC_DRV_OPAL) += rtc-opal.o
obj-$(CONFIG_RTC_DRV_PALMAS) += rtc-palmas.o
Expand Down
4 changes: 3 additions & 1 deletion drivers/rtc/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,10 @@ int __rtc_register_device(struct module *owner, struct rtc_device *rtc)
struct rtc_wkalrm alrm;
int err;

if (!rtc->ops)
if (!rtc->ops) {
dev_dbg(&rtc->dev, "no ops set\n");
return -EINVAL;
}

rtc->owner = owner;
rtc_device_get_offset(rtc);
Expand Down
6 changes: 2 additions & 4 deletions drivers/rtc/rtc-88pm80x.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ static int pm80x_rtc_probe(struct platform_device *pdev)
return -ENOMEM;
info->irq = platform_get_irq(pdev, 0);
if (info->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
ret = -EINVAL;
goto out;
}
Expand Down Expand Up @@ -296,10 +295,9 @@ static int pm80x_rtc_probe(struct platform_device *pdev)
info->rtc_dev->range_max = U32_MAX;

ret = rtc_register_device(info->rtc_dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
if (ret)
goto out_rtc;
}

/*
* enable internal XO instead of internal 3.25MHz clock since it can
* free running in PMIC power-down state.
Expand Down
4 changes: 1 addition & 3 deletions drivers/rtc/rtc-88pm860x.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,8 @@ static int pm860x_rtc_probe(struct platform_device *pdev)
if (!info)
return -ENOMEM;
info->irq = platform_get_irq(pdev, 0);
if (info->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource!\n");
if (info->irq < 0)
return info->irq;
}

info->chip = chip;
info->i2c = (chip->id == CHIP_PM8607) ? chip->client : chip->companion;
Expand Down
24 changes: 8 additions & 16 deletions drivers/rtc/rtc-ab-eoz9.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,50 +390,42 @@ static int abeoz9_probe(struct i2c_client *client,

if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C |
I2C_FUNC_SMBUS_BYTE_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK)) {
ret = -ENODEV;
goto err;
}
I2C_FUNC_SMBUS_I2C_BLOCK))
return -ENODEV;

regmap = devm_regmap_init_i2c(client, &abeoz9_rtc_regmap_config);
if (IS_ERR(regmap)) {
ret = PTR_ERR(regmap);
dev_err(dev, "regmap allocation failed: %d\n", ret);
goto err;
return ret;
}

data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data) {
ret = -ENOMEM;
goto err;
}
if (!data)
return -ENOMEM;

data->regmap = regmap;
dev_set_drvdata(dev, data);

ret = abeoz9_rtc_setup(dev, client->dev.of_node);
if (ret)
goto err;
return ret;

data->rtc = devm_rtc_allocate_device(dev);
ret = PTR_ERR_OR_ZERO(data->rtc);
if (ret)
goto err;
return ret;

data->rtc->ops = &rtc_ops;
data->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
data->rtc->range_max = RTC_TIMESTAMP_END_2099;

ret = rtc_register_device(data->rtc);
if (ret)
goto err;
return ret;

abeoz9_hwmon_register(dev, data);
return 0;

err:
dev_err(dev, "unable to register RTC device (%d)\n", ret);
return ret;
}

#ifdef CONFIG_OF
Expand Down
14 changes: 2 additions & 12 deletions drivers/rtc/rtc-ac100.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,8 @@ static int ac100_rtc_probe(struct platform_device *pdev)
chip->regmap = ac100->regmap;

chip->irq = platform_get_irq(pdev, 0);
if (chip->irq < 0) {
dev_err(&pdev->dev, "No IRQ resource\n");
if (chip->irq < 0)
return chip->irq;
}

chip->rtc = devm_rtc_allocate_device(&pdev->dev);
if (IS_ERR(chip->rtc))
Expand Down Expand Up @@ -612,15 +610,7 @@ static int ac100_rtc_probe(struct platform_device *pdev)
if (ret)
return ret;

ret = rtc_register_device(chip->rtc);
if (ret) {
dev_err(&pdev->dev, "unable to register device\n");
return ret;
}

dev_info(&pdev->dev, "RTC enabled\n");

return 0;
return rtc_register_device(chip->rtc);
}

static int ac100_rtc_remove(struct platform_device *pdev)
Expand Down
Loading

0 comments on commit 9dbd83f

Please sign in to comment.