Skip to content

Commit

Permalink
Merge tag 'rtc-4.14' 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:
 "Subsystem:
   - remove .open() and .release() RTC ops
   - constify i2c_device_id

  New driver:
   - Realtek RTD1295
   - Android emulator (goldfish) RTC

  Drivers:
   - ds1307: Beginning of a huge cleanup
   - s35390a: handle invalid RTC time
   - sun6i: external oscillator gate support"

* tag 'rtc-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (40 commits)
  rtc: ds1307: use octal permissions
  rtc: ds1307: fix braces
  rtc: ds1307: fix alignments and blank lines
  rtc: ds1307: use BIT
  rtc: ds1307: use u32
  rtc: ds1307: use sizeof
  rtc: ds1307: remove regs member
  rtc: Add Realtek RTD1295
  dt-bindings: rtc: Add Realtek RTD1295
  rtc: sun6i: Add support for the external oscillator gate
  rtc: goldfish: Add RTC driver for Android emulator
  dt-bindings: Add device tree binding for Goldfish RTC driver
  rtc: ds1307: add basic support for ds1341 chip
  rtc: ds1307: remove member nvram_offset from struct ds1307
  rtc: ds1307: factor out offset to struct chip_desc
  rtc: ds1307: factor out rtc_ops to struct chip_desc
  rtc: ds1307: factor out irq_handler to struct chip_desc
  rtc: ds1307: improve irq setup
  rtc: ds1307: constify struct chip_desc variables
  rtc: ds1307: improve trickle charger initialization
  ...
  • Loading branch information
torvalds committed Sep 13, 2017
2 parents 2818d0d + b4be271 commit 561a8eb
Show file tree
Hide file tree
Showing 26 changed files with 953 additions and 485 deletions.
9 changes: 4 additions & 5 deletions Documentation/devicetree/bindings/power/wakeup-source.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ List of legacy properties and respective binding document
1. "enable-sdio-wakeup" Documentation/devicetree/bindings/mmc/mmc.txt
2. "gpio-key,wakeup" Documentation/devicetree/bindings/input/gpio-keys{,-polled}.txt
3. "has-tpo" Documentation/devicetree/bindings/rtc/rtc-opal.txt
4. "isil,irq2-can-wakeup-machine" Documentation/devicetree/bindings/rtc/isil,isl12057.txt
5. "linux,wakeup" Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt
4. "linux,wakeup" Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt
Documentation/devicetree/bindings/mfd/tc3589x.txt
Documentation/devicetree/bindings/input/ads7846.txt
6. "linux,keypad-wakeup" Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
7. "linux,input-wakeup" Documentation/devicetree/bindings/input/samsung-keypad.txt
8. "nvidia,wakeup-source" Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt
5. "linux,keypad-wakeup" Documentation/devicetree/bindings/input/qcom,pm8xxx-keypad.txt
6. "linux,input-wakeup" Documentation/devicetree/bindings/input/samsung-keypad.txt
7. "nvidia,wakeup-source" Documentation/devicetree/bindings/input/nvidia,tegra20-kbc.txt

Examples
--------
Expand Down
17 changes: 17 additions & 0 deletions Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Android Goldfish RTC

Android Goldfish RTC device used by Android emulator.

Required properties:

- compatible : should contain "google,goldfish-rtc"
- reg : <registers mapping>
- interrupts : <interrupt mapping>

Example:

goldfish_timer@9020000 {
compatible = "google,goldfish-rtc";
reg = <0x9020000 0x1000>;
interrupts = <0x3>;
};
1 change: 0 additions & 1 deletion Documentation/devicetree/bindings/rtc/isil,isl12057.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Optional properties:

- "wakeup-source": mark the chip as a wakeup source, independently of
the availability of an IRQ line connected to the SoC.
(Legacy property supported: "isil,irq2-can-wakeup-machine")

- "interrupt-parent", "interrupts": for passing the interrupt line
of the SoC connected to IRQ#2 of the RTC chip.
Expand Down
16 changes: 16 additions & 0 deletions Documentation/devicetree/bindings/rtc/realtek,rtd119x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Realtek RTD129x Real-Time Clock
===============================

Required properties:
- compatible : Should be "realtek,rtd1295-rtc"
- reg : Specifies the physical base address and size
- clocks : Specifies the clock gate


Example:

rtc@9801b600 {
compatible = "realtek,rtd1295-clk";
reg = <0x9801b600 0x100>;
clocks = <&clkc RTD1295_CLK_EN_MISC_RTC>;
};
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/rtc/sun6i-rtc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Required properties:

Required properties for new device trees
- clocks : phandle to the 32kHz external oscillator
- clock-output-names : name of the LOSC clock created
- clock-output-names : names of the LOSC and its external output clocks created
- #clock-cells : must be equals to 1. The RTC provides two clocks: the
LOSC and its external output, with index 0 and 1
respectively.
Expand All @@ -21,7 +21,7 @@ rtc: rtc@01f00000 {
compatible = "allwinner,sun6i-a31-rtc";
reg = <0x01f00000 0x54>;
interrupts = <0 40 4>, <0 41 4>;
clock-output-names = "osc32k";
clock-output-names = "osc32k", "osc32k-out";
clocks = <&ext_osc32k>;
#clock-cells = <1>;
};
6 changes: 6 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,12 @@ S: Supported
F: drivers/android/
F: drivers/staging/android/

ANDROID GOLDFISH RTC DRIVER
M: Miodrag Dinic <[email protected]>
S: Supported
F: Documentation/devicetree/bindings/rtc/google,goldfish-rtc.txt
F: drivers/rtc/rtc-goldfish.c

ANDROID ION DRIVER
M: Laura Abbott <[email protected]>
M: Sumit Semwal <[email protected]>
Expand Down
30 changes: 23 additions & 7 deletions drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,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, ISL12057"
tristate "Dallas/Maxim DS1307/37/38/39/40/41, 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, Intersil ISL12057 and probably other chips. In some
cases the RTC must already have been initialized (by manufacturing or
a bootloader).
should handle DS1307, DS1337, DS1338, DS1339, DS1340, DS1341,
ST M41T00, 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 Down Expand Up @@ -371,11 +371,11 @@ config RTC_DRV_MAX77686
will be called rtc-max77686.

config RTC_DRV_RK808
tristate "Rockchip RK808/RK818 RTC"
tristate "Rockchip RK805/RK808/RK818 RTC"
depends on MFD_RK808
help
If you say yes here you will get support for the
RTC of RK808 and RK818 PMIC.
RTC of RK805, RK808 and RK818 PMIC.

This driver can also be built as a module. If so, the module
will be called rk808-rtc.
Expand Down Expand Up @@ -1765,6 +1765,14 @@ config RTC_DRV_CPCAP
Say y here for CPCAP rtc found on some Motorola phones
and tablets such as Droid 4.

config RTC_DRV_RTD119X
bool "Realtek RTD129x RTC"
depends on ARCH_REALTEK || COMPILE_TEST
default ARCH_REALTEK
help
If you say yes here, you get support for the RTD1295 SoC
Real Time Clock.

comment "HID Sensor RTC drivers"

config RTC_DRV_HID_SENSOR_TIME
Expand All @@ -1780,5 +1788,13 @@ config RTC_DRV_HID_SENSOR_TIME
If this driver is compiled as a module, it will be named
rtc-hid-sensor-time.

config RTC_DRV_GOLDFISH
tristate "Goldfish Real Time Clock"
depends on MIPS && (GOLDFISH || COMPILE_TEST)
help
Say yes to enable RTC driver for the Goldfish based virtual platform.

Goldfish is a code name for the virtual platform developed by Google
for Android emulation.

endif # RTC_CLASS
2 changes: 2 additions & 0 deletions drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c01.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_RTD119X) += rtc-rtd119x.o
obj-$(CONFIG_RTC_DRV_RV3029C2) += rtc-rv3029c2.o
obj-$(CONFIG_RTC_DRV_RV8803) += rtc-rv8803.o
obj-$(CONFIG_RTC_DRV_RX4581) += rtc-rx4581.o
Expand Down Expand Up @@ -170,3 +171,4 @@ obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o
obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o
obj-$(CONFIG_RTC_DRV_XGENE) += rtc-xgene.o
obj-$(CONFIG_RTC_DRV_ZYNQMP) += rtc-zynqmp.o
obj-$(CONFIG_RTC_DRV_GOLDFISH) += rtc-goldfish.o
20 changes: 4 additions & 16 deletions drivers/rtc/rtc-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,19 @@ static dev_t rtc_devt;

static int rtc_dev_open(struct inode *inode, struct file *file)
{
int err;
struct rtc_device *rtc = container_of(inode->i_cdev,
struct rtc_device, char_dev);
const struct rtc_class_ops *ops = rtc->ops;

if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags))
return -EBUSY;

file->private_data = rtc;

err = ops->open ? ops->open(rtc->dev.parent) : 0;
if (err == 0) {
spin_lock_irq(&rtc->irq_lock);
rtc->irq_data = 0;
spin_unlock_irq(&rtc->irq_lock);

return 0;
}
spin_lock_irq(&rtc->irq_lock);
rtc->irq_data = 0;
spin_unlock_irq(&rtc->irq_lock);

/* something has gone wrong */
clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
return err;
return 0;
}

#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
Expand Down Expand Up @@ -438,9 +429,6 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
rtc_update_irq_enable(rtc, 0);
rtc_irq_set_state(rtc, NULL, 0);

if (rtc->ops->release)
rtc->ops->release(rtc->dev.parent);

clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
return 0;
}
Expand Down
Loading

0 comments on commit 561a8eb

Please sign in to comment.