mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'rtc-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni:
"Mostly documentation/comment changes and non urgent fixes.
- add or fix SPDX identifiers
- NXP pcf*: fix datasheet URLs
- imxdi: add wakeup support
- pcf2127: handle timestamp interrupts, this fixes a possible
interrupt storm
- bd70528: Drop BD70528 support"
* tag 'rtc-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (33 commits)
rtc: pcf8523: rename register and bit defines
rtc: pcf2127: handle timestamp interrupts
rtc: at91sam9: Remove unnecessary offset variable checks
rtc: s5m: Check return value of s5m_check_peding_alarm_interrupt()
rtc: spear: convert to SPDX identifier
rtc: tps6586x: convert to SPDX identifier
rtc: tps80031: convert to SPDX identifier
rtc: rtd119x: Fix format of SPDX identifier
rtc: sc27xx: Fix format of SPDX identifier
rtc: palmas: convert to SPDX identifier
rtc: max6900: convert to SPDX identifier
rtc: ds1374: convert to SPDX identifier
rtc: au1xxx: convert to SPDX identifier
rtc: pcf85063: Update the PCF85063A datasheet revision
dt-bindings: rtc: ti,bq32k: take maintainership
rtc: pcf8563: Fix the datasheet URL
rtc: pcf85063: Fix the datasheet URL
rtc: pcf2127: Fix the datasheet URL
dt-bindings: rtc: ti,bq32k: Convert to json-schema
dt-bindings: rtc: rx8900: Convert to YAML schema
...
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
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;
|
||||
};
|
||||
49
Documentation/devicetree/bindings/rtc/epson,rx8900.yaml
Normal file
49
Documentation/devicetree/bindings/rtc/epson,rx8900.yaml
Normal file
@@ -0,0 +1,49 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/rtc/epson,rx8900.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: EPSON RX8900 / Microcrystal RV8803 Real-Time Clock DT bindings
|
||||
|
||||
maintainers:
|
||||
- Marek Vasut <marex@denx.de>
|
||||
|
||||
allOf:
|
||||
- $ref: rtc.yaml#
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
enum:
|
||||
- epson,rx8900
|
||||
- microcrystal,rv8803
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
epson,vdet-disable:
|
||||
type: boolean
|
||||
description: |
|
||||
Disable voltage detector. Should be set if no backup battery is used.
|
||||
|
||||
trickle-diode-disable: true
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
rtc@32 {
|
||||
compatible = "epson,rx8900";
|
||||
reg = <0x32>;
|
||||
epson,vdet-disable;
|
||||
trickle-diode-disable;
|
||||
};
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
* Faraday Technology FTRTC010 Real Time Clock
|
||||
|
||||
This RTC appears in for example the Storlink Gemini family of
|
||||
SoCs.
|
||||
|
||||
Required properties:
|
||||
- compatible : Should be one of:
|
||||
"faraday,ftrtc010"
|
||||
"cortina,gemini-rtc", "faraday,ftrtc010"
|
||||
|
||||
Optional properties:
|
||||
- clocks: when present should contain clock references to the
|
||||
PCLK and EXTCLK clocks. Faraday calls the later CLK1HZ and
|
||||
says the clock should be 1 Hz, but implementers actually seem
|
||||
to choose different clocks here, like Cortina who chose
|
||||
32768 Hz (a typical low-power clock).
|
||||
- clock-names: should name the clocks "PCLK" and "EXTCLK"
|
||||
respectively.
|
||||
|
||||
Examples:
|
||||
|
||||
rtc@45000000 {
|
||||
compatible = "cortina,gemini-rtc";
|
||||
reg = <0x45000000 0x100>;
|
||||
interrupts = <17 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&foo 0>, <&foo 1>;
|
||||
clock-names = "PCLK", "EXTCLK";
|
||||
};
|
||||
59
Documentation/devicetree/bindings/rtc/faraday,ftrtc010.yaml
Normal file
59
Documentation/devicetree/bindings/rtc/faraday,ftrtc010.yaml
Normal file
@@ -0,0 +1,59 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/rtc/faraday,ftrtc010.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: Faraday Technology FTRTC010 Real Time Clock
|
||||
|
||||
maintainers:
|
||||
- Linus Walleij <linus.walleij@linaro.org>
|
||||
|
||||
description: |
|
||||
This RTC appears in for example the Storlink Gemini family of SoCs.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
oneOf:
|
||||
- const: faraday,ftrtc010
|
||||
- items:
|
||||
- const: cortina,gemini-rtc
|
||||
- const: faraday,ftrtc010
|
||||
|
||||
resets:
|
||||
maxItems: 1
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
minItems: 2
|
||||
items:
|
||||
- description: PCLK clocks
|
||||
- description: EXTCLK clocks. Faraday calls it CLK1HZ and says the clock
|
||||
should be 1 Hz, but implementers actually seem to choose different
|
||||
clocks here, like Cortina who chose 32768 Hz (a typical low-power clock).
|
||||
|
||||
clock-names:
|
||||
items:
|
||||
- const: "PCLK"
|
||||
- const: "EXTCLK"
|
||||
|
||||
required:
|
||||
- compatible
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/interrupt-controller/irq.h>
|
||||
rtc@45000000 {
|
||||
compatible = "cortina,gemini-rtc", "faraday,ftrtc010";
|
||||
reg = <0x45000000 0x100>;
|
||||
interrupts = <17 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&foo 0>, <&foo 1>;
|
||||
clock-names = "PCLK", "EXTCLK";
|
||||
};
|
||||
@@ -21,10 +21,19 @@ Optional properties:
|
||||
clock name
|
||||
- wakeup-source: Enables wake up of host system on alarm
|
||||
|
||||
Optional child node:
|
||||
- clock: Provide this if the square wave pin is used as boot-enabled fixed clock.
|
||||
|
||||
Example:
|
||||
rtc@68 {
|
||||
compatible = "st,m41t80";
|
||||
reg = <0x68>;
|
||||
interrupt-parent = <&UIC0>;
|
||||
interrupts = <0x9 0x8>;
|
||||
|
||||
clock {
|
||||
compatible = "fixed-clock";
|
||||
#clock-cells = <0>;
|
||||
clock-frequency = <32768>;
|
||||
};
|
||||
};
|
||||
|
||||
49
Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
Normal file
49
Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
Normal file
@@ -0,0 +1,49 @@
|
||||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/rtc/ti,bq32000.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: TI BQ32000 I2C Serial Real-Time Clock
|
||||
|
||||
maintainers:
|
||||
- Alexandre Belloni <alexandre.belloni@bootlin.com>
|
||||
|
||||
allOf:
|
||||
- $ref: rtc.yaml#
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: ti,bq32000
|
||||
|
||||
reg:
|
||||
const: 0x68
|
||||
|
||||
interrupts:
|
||||
maxItems: 1
|
||||
|
||||
start-year: true
|
||||
|
||||
trickle-resistor-ohms:
|
||||
enum: [ 1120, 20180 ]
|
||||
|
||||
trickle-diode-disable: true
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
i2c {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
bq32000: rtc@68 {
|
||||
compatible = "ti,bq32000";
|
||||
reg = <0x68>;
|
||||
trickle-resistor-ohms = <1120>;
|
||||
};
|
||||
};
|
||||
@@ -1,18 +0,0 @@
|
||||
* TI BQ32000 I2C Serial Real-Time Clock
|
||||
|
||||
Required properties:
|
||||
- compatible: Should contain "ti,bq32000".
|
||||
- reg: I2C address for chip
|
||||
|
||||
Optional properties:
|
||||
- trickle-resistor-ohms : Selected resistor for trickle charger
|
||||
Values usable are 1120 and 20180
|
||||
Should be given if trickle charger should be enabled
|
||||
- trickle-diode-disable : Do not use internal trickle charger diode
|
||||
Should be given if internal trickle charger diode should be disabled
|
||||
Example:
|
||||
bq32000: rtc@68 {
|
||||
compatible = "ti,bq32000";
|
||||
trickle-resistor-ohms = <1120>;
|
||||
reg = <0x68>;
|
||||
};
|
||||
@@ -501,11 +501,11 @@ config RTC_DRV_M41T80_WDT
|
||||
watchdog timer in the ST M41T60 and M41T80 RTC chips series.
|
||||
|
||||
config RTC_DRV_BD70528
|
||||
tristate "ROHM BD70528, BD71815 and BD71828 PMIC RTC"
|
||||
depends on MFD_ROHM_BD71828 || MFD_ROHM_BD70528 && (BD70528_WATCHDOG || !BD70528_WATCHDOG)
|
||||
tristate "ROHM BD71815 and BD71828 PMIC RTC"
|
||||
depends on MFD_ROHM_BD71828
|
||||
help
|
||||
If you say Y here you will get support for the RTC
|
||||
block on ROHM BD70528, BD71815 and BD71828 Power Management IC.
|
||||
block on ROHM BD71815 and BD71828 Power Management IC.
|
||||
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called rtc-bd70528.
|
||||
|
||||
@@ -23,8 +23,8 @@ static bool is_rtc_hctosys(struct rtc_device *rtc)
|
||||
int size;
|
||||
char name[NAME_SIZE];
|
||||
|
||||
size = scnprintf(name, NAME_SIZE, "rtc%d", rtc->id);
|
||||
if (size > NAME_SIZE)
|
||||
size = snprintf(name, NAME_SIZE, "rtc%d", rtc->id);
|
||||
if (size >= NAME_SIZE)
|
||||
return false;
|
||||
|
||||
return !strncmp(name, CONFIG_RTC_HCTOSYS_DEVICE, NAME_SIZE);
|
||||
|
||||
@@ -184,7 +184,7 @@ static int at91_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
|
||||
return -EILSEQ;
|
||||
|
||||
memset(alrm, 0, sizeof(*alrm));
|
||||
if (alarm != ALARM_DISABLED && offset != 0) {
|
||||
if (alarm != ALARM_DISABLED) {
|
||||
rtc_time64_to_tm(offset + alarm, tm);
|
||||
|
||||
dev_dbg(dev, "%s: %ptR\n", __func__, tm);
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Au1xxx counter0 (aka Time-Of-Year counter) RTC interface driver.
|
||||
*
|
||||
* Copyright (C) 2008 Manuel Lauss <mano@roarinelk.homelinux.net>
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
/* All current Au1xxx SoCs have 2 counters fed by an external 32.768 kHz
|
||||
|
||||
@@ -2,10 +2,9 @@
|
||||
//
|
||||
// Copyright (C) 2018 ROHM Semiconductors
|
||||
//
|
||||
// RTC driver for ROHM BD70528 PMIC
|
||||
// RTC driver for ROHM BD71828 and BD71815 PMIC
|
||||
|
||||
#include <linux/bcd.h>
|
||||
#include <linux/mfd/rohm-bd70528.h>
|
||||
#include <linux/mfd/rohm-bd71815.h>
|
||||
#include <linux/mfd/rohm-bd71828.h>
|
||||
#include <linux/module.h>
|
||||
@@ -39,11 +38,6 @@ struct bd70528_rtc_data {
|
||||
u8 year;
|
||||
} __packed;
|
||||
|
||||
struct bd70528_rtc_wake {
|
||||
struct bd70528_rtc_day time;
|
||||
u8 ctrl;
|
||||
} __packed;
|
||||
|
||||
struct bd71828_rtc_alm {
|
||||
struct bd70528_rtc_data alm0;
|
||||
struct bd70528_rtc_data alm1;
|
||||
@@ -51,141 +45,14 @@ struct bd71828_rtc_alm {
|
||||
u8 alm1_mask;
|
||||
} __packed;
|
||||
|
||||
struct bd70528_rtc_alm {
|
||||
struct bd70528_rtc_data data;
|
||||
u8 alm_mask;
|
||||
u8 alm_repeat;
|
||||
} __packed;
|
||||
|
||||
struct bd70528_rtc {
|
||||
struct rohm_regmap_dev *parent;
|
||||
struct regmap *regmap;
|
||||
struct device *dev;
|
||||
u8 reg_time_start;
|
||||
u8 bd718xx_alm_block_start;
|
||||
bool has_rtc_timers;
|
||||
};
|
||||
|
||||
static int bd70528_set_wake(struct rohm_regmap_dev *bd70528,
|
||||
int enable, int *old_state)
|
||||
{
|
||||
int ret;
|
||||
unsigned int ctrl_reg;
|
||||
|
||||
ret = regmap_read(bd70528->regmap, BD70528_REG_WAKE_EN, &ctrl_reg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (old_state) {
|
||||
if (ctrl_reg & BD70528_MASK_WAKE_EN)
|
||||
*old_state |= BD70528_WAKE_STATE_BIT;
|
||||
else
|
||||
*old_state &= ~BD70528_WAKE_STATE_BIT;
|
||||
|
||||
if (!enable == !(*old_state & BD70528_WAKE_STATE_BIT))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (enable)
|
||||
ctrl_reg |= BD70528_MASK_WAKE_EN;
|
||||
else
|
||||
ctrl_reg &= ~BD70528_MASK_WAKE_EN;
|
||||
|
||||
return regmap_write(bd70528->regmap, BD70528_REG_WAKE_EN,
|
||||
ctrl_reg);
|
||||
}
|
||||
|
||||
static int bd70528_set_elapsed_tmr(struct rohm_regmap_dev *bd70528,
|
||||
int enable, int *old_state)
|
||||
{
|
||||
int ret;
|
||||
unsigned int ctrl_reg;
|
||||
|
||||
/*
|
||||
* TBD
|
||||
* What is the purpose of elapsed timer ?
|
||||
* Is the timeout registers counting down, or is the disable - re-enable
|
||||
* going to restart the elapsed-time counting? If counting is restarted
|
||||
* the timeout should be decreased by the amount of time that has
|
||||
* elapsed since starting the timer. Maybe we should store the monotonic
|
||||
* clock value when timer is started so that if RTC is set while timer
|
||||
* is armed we could do the compensation. This is a hack if RTC/system
|
||||
* clk are drifting. OTOH, RTC controlled via I2C is in any case
|
||||
* inaccurate...
|
||||
*/
|
||||
ret = regmap_read(bd70528->regmap, BD70528_REG_ELAPSED_TIMER_EN,
|
||||
&ctrl_reg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (old_state) {
|
||||
if (ctrl_reg & BD70528_MASK_ELAPSED_TIMER_EN)
|
||||
*old_state |= BD70528_ELAPSED_STATE_BIT;
|
||||
else
|
||||
*old_state &= ~BD70528_ELAPSED_STATE_BIT;
|
||||
|
||||
if ((!enable) == (!(*old_state & BD70528_ELAPSED_STATE_BIT)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (enable)
|
||||
ctrl_reg |= BD70528_MASK_ELAPSED_TIMER_EN;
|
||||
else
|
||||
ctrl_reg &= ~BD70528_MASK_ELAPSED_TIMER_EN;
|
||||
|
||||
return regmap_write(bd70528->regmap, BD70528_REG_ELAPSED_TIMER_EN,
|
||||
ctrl_reg);
|
||||
}
|
||||
|
||||
static int bd70528_set_rtc_based_timers(struct bd70528_rtc *r, int new_state,
|
||||
int *old_state)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bd70528_wdt_set(r->parent, new_state & BD70528_WDT_STATE_BIT,
|
||||
old_state);
|
||||
if (ret) {
|
||||
dev_err(r->dev,
|
||||
"Failed to disable WDG for RTC setting (%d)\n", ret);
|
||||
return ret;
|
||||
}
|
||||
ret = bd70528_set_elapsed_tmr(r->parent,
|
||||
new_state & BD70528_ELAPSED_STATE_BIT,
|
||||
old_state);
|
||||
if (ret) {
|
||||
dev_err(r->dev,
|
||||
"Failed to disable 'elapsed timer' for RTC setting\n");
|
||||
return ret;
|
||||
}
|
||||
ret = bd70528_set_wake(r->parent, new_state & BD70528_WAKE_STATE_BIT,
|
||||
old_state);
|
||||
if (ret) {
|
||||
dev_err(r->dev,
|
||||
"Failed to disable 'wake timer' for RTC setting\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bd70528_re_enable_rtc_based_timers(struct bd70528_rtc *r,
|
||||
int old_state)
|
||||
{
|
||||
if (!r->has_rtc_timers)
|
||||
return 0;
|
||||
|
||||
return bd70528_set_rtc_based_timers(r, old_state, NULL);
|
||||
}
|
||||
|
||||
static int bd70528_disable_rtc_based_timers(struct bd70528_rtc *r,
|
||||
int *old_state)
|
||||
{
|
||||
if (!r->has_rtc_timers)
|
||||
return 0;
|
||||
|
||||
return bd70528_set_rtc_based_timers(r, 0, old_state);
|
||||
}
|
||||
|
||||
static inline void tmday2rtc(struct rtc_time *t, struct bd70528_rtc_day *d)
|
||||
{
|
||||
d->sec &= ~BD70528_MASK_RTC_SEC;
|
||||
@@ -267,52 +134,6 @@ static int bd71828_set_alarm(struct device *dev, struct rtc_wkalrm *a)
|
||||
|
||||
}
|
||||
|
||||
static int bd70528_set_alarm(struct device *dev, struct rtc_wkalrm *a)
|
||||
{
|
||||
struct bd70528_rtc_wake wake;
|
||||
struct bd70528_rtc_alm alm;
|
||||
int ret;
|
||||
struct bd70528_rtc *r = dev_get_drvdata(dev);
|
||||
|
||||
ret = regmap_bulk_read(r->regmap, BD70528_REG_RTC_WAKE_START, &wake,
|
||||
sizeof(wake));
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to read wake regs\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = regmap_bulk_read(r->regmap, BD70528_REG_RTC_ALM_START, &alm,
|
||||
sizeof(alm));
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to read alarm regs\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
tm2rtc(&a->time, &alm.data);
|
||||
tmday2rtc(&a->time, &wake.time);
|
||||
|
||||
if (a->enabled) {
|
||||
alm.alm_mask &= ~BD70528_MASK_ALM_EN;
|
||||
wake.ctrl |= BD70528_MASK_WAKE_EN;
|
||||
} else {
|
||||
alm.alm_mask |= BD70528_MASK_ALM_EN;
|
||||
wake.ctrl &= ~BD70528_MASK_WAKE_EN;
|
||||
}
|
||||
|
||||
ret = regmap_bulk_write(r->regmap, BD70528_REG_RTC_WAKE_START, &wake,
|
||||
sizeof(wake));
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to set wake time\n");
|
||||
return ret;
|
||||
}
|
||||
ret = regmap_bulk_write(r->regmap, BD70528_REG_RTC_ALM_START, &alm,
|
||||
sizeof(alm));
|
||||
if (ret)
|
||||
dev_err(dev, "Failed to set alarm time\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bd71828_read_alarm(struct device *dev, struct rtc_wkalrm *a)
|
||||
{
|
||||
int ret;
|
||||
@@ -336,75 +157,25 @@ static int bd71828_read_alarm(struct device *dev, struct rtc_wkalrm *a)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bd70528_read_alarm(struct device *dev, struct rtc_wkalrm *a)
|
||||
static int bd71828_set_time(struct device *dev, struct rtc_time *t)
|
||||
{
|
||||
struct bd70528_rtc_alm alm;
|
||||
int ret;
|
||||
struct bd70528_rtc *r = dev_get_drvdata(dev);
|
||||
|
||||
ret = regmap_bulk_read(r->regmap, BD70528_REG_RTC_ALM_START, &alm,
|
||||
sizeof(alm));
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to read alarm regs\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
rtc2tm(&alm.data, &a->time);
|
||||
a->time.tm_mday = -1;
|
||||
a->time.tm_mon = -1;
|
||||
a->time.tm_year = -1;
|
||||
a->enabled = !(alm.alm_mask & BD70528_MASK_ALM_EN);
|
||||
a->pending = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bd70528_set_time_locked(struct device *dev, struct rtc_time *t)
|
||||
{
|
||||
int ret, tmpret, old_states;
|
||||
struct bd70528_rtc_data rtc_data;
|
||||
struct bd70528_rtc *r = dev_get_drvdata(dev);
|
||||
|
||||
ret = bd70528_disable_rtc_based_timers(r, &old_states);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
tmpret = regmap_bulk_read(r->regmap, r->reg_time_start, &rtc_data,
|
||||
sizeof(rtc_data));
|
||||
if (tmpret) {
|
||||
ret = regmap_bulk_read(r->regmap, r->reg_time_start, &rtc_data,
|
||||
sizeof(rtc_data));
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to read RTC time registers\n");
|
||||
goto renable_out;
|
||||
return ret;
|
||||
}
|
||||
tm2rtc(t, &rtc_data);
|
||||
|
||||
tmpret = regmap_bulk_write(r->regmap, r->reg_time_start, &rtc_data,
|
||||
sizeof(rtc_data));
|
||||
if (tmpret) {
|
||||
ret = regmap_bulk_write(r->regmap, r->reg_time_start, &rtc_data,
|
||||
sizeof(rtc_data));
|
||||
if (ret)
|
||||
dev_err(dev, "Failed to set RTC time\n");
|
||||
goto renable_out;
|
||||
}
|
||||
|
||||
renable_out:
|
||||
ret = bd70528_re_enable_rtc_based_timers(r, old_states);
|
||||
if (tmpret)
|
||||
ret = tmpret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bd71828_set_time(struct device *dev, struct rtc_time *t)
|
||||
{
|
||||
return bd70528_set_time_locked(dev, t);
|
||||
}
|
||||
|
||||
static int bd70528_set_time(struct device *dev, struct rtc_time *t)
|
||||
{
|
||||
int ret;
|
||||
struct bd70528_rtc *r = dev_get_drvdata(dev);
|
||||
|
||||
bd70528_wdt_lock(r->parent);
|
||||
ret = bd70528_set_time_locked(dev, t);
|
||||
bd70528_wdt_unlock(r->parent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -427,31 +198,6 @@ static int bd70528_get_time(struct device *dev, struct rtc_time *t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bd70528_alm_enable(struct device *dev, unsigned int enabled)
|
||||
{
|
||||
int ret;
|
||||
unsigned int enableval = BD70528_MASK_ALM_EN;
|
||||
struct bd70528_rtc *r = dev_get_drvdata(dev);
|
||||
|
||||
if (enabled)
|
||||
enableval = 0;
|
||||
|
||||
bd70528_wdt_lock(r->parent);
|
||||
ret = bd70528_set_wake(r->parent, enabled, NULL);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to change wake state\n");
|
||||
goto out_unlock;
|
||||
}
|
||||
ret = regmap_update_bits(r->regmap, BD70528_REG_RTC_ALM_MASK,
|
||||
BD70528_MASK_ALM_EN, enableval);
|
||||
if (ret)
|
||||
dev_err(dev, "Failed to change alarm state\n");
|
||||
|
||||
out_unlock:
|
||||
bd70528_wdt_unlock(r->parent);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int bd71828_alm_enable(struct device *dev, unsigned int enabled)
|
||||
{
|
||||
int ret;
|
||||
@@ -470,14 +216,6 @@ static int bd71828_alm_enable(struct device *dev, unsigned int enabled)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct rtc_class_ops bd70528_rtc_ops = {
|
||||
.read_time = bd70528_get_time,
|
||||
.set_time = bd70528_set_time,
|
||||
.read_alarm = bd70528_read_alarm,
|
||||
.set_alarm = bd70528_set_alarm,
|
||||
.alarm_irq_enable = bd70528_alm_enable,
|
||||
};
|
||||
|
||||
static const struct rtc_class_ops bd71828_rtc_ops = {
|
||||
.read_time = bd70528_get_time,
|
||||
.set_time = bd71828_set_time,
|
||||
@@ -503,7 +241,6 @@ static int bd70528_probe(struct platform_device *pdev)
|
||||
struct rtc_device *rtc;
|
||||
int irq;
|
||||
unsigned int hr;
|
||||
bool enable_main_irq = false;
|
||||
u8 hour_reg;
|
||||
enum rohm_chip_type chip = platform_get_device_id(pdev)->driver_data;
|
||||
|
||||
@@ -518,21 +255,9 @@ static int bd70528_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
bd_rtc->dev = &pdev->dev;
|
||||
rtc_ops = &bd71828_rtc_ops;
|
||||
|
||||
switch (chip) {
|
||||
case ROHM_CHIP_TYPE_BD70528:
|
||||
bd_rtc->parent = dev_get_drvdata(pdev->dev.parent);
|
||||
if (!bd_rtc->parent) {
|
||||
dev_err(&pdev->dev, "No MFD data\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
irq_name = "bd70528-rtc-alm";
|
||||
bd_rtc->has_rtc_timers = true;
|
||||
bd_rtc->reg_time_start = BD70528_REG_RTC_START;
|
||||
hour_reg = BD70528_REG_RTC_HOUR;
|
||||
enable_main_irq = true;
|
||||
rtc_ops = &bd70528_rtc_ops;
|
||||
break;
|
||||
case ROHM_CHIP_TYPE_BD71815:
|
||||
irq_name = "bd71815-rtc-alm-0";
|
||||
bd_rtc->reg_time_start = BD71815_REG_RTC_START;
|
||||
@@ -549,14 +274,12 @@ static int bd70528_probe(struct platform_device *pdev)
|
||||
*/
|
||||
bd_rtc->bd718xx_alm_block_start = BD71815_REG_RTC_ALM_START;
|
||||
hour_reg = BD71815_REG_HOUR;
|
||||
rtc_ops = &bd71828_rtc_ops;
|
||||
break;
|
||||
case ROHM_CHIP_TYPE_BD71828:
|
||||
irq_name = "bd71828-rtc-alm-0";
|
||||
bd_rtc->reg_time_start = BD71828_REG_RTC_START;
|
||||
bd_rtc->bd718xx_alm_block_start = BD71828_REG_RTC_ALM_START;
|
||||
hour_reg = BD71828_REG_RTC_HOUR;
|
||||
rtc_ops = &bd71828_rtc_ops;
|
||||
break;
|
||||
default:
|
||||
dev_err(&pdev->dev, "Unknown chip\n");
|
||||
@@ -611,27 +334,10 @@ static int bd70528_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* BD70528 irq controller is not touching the main mask register.
|
||||
* So enable the RTC block interrupts at main level. We can just
|
||||
* leave them enabled as irq-controller should disable irqs
|
||||
* from sub-registers when IRQ is disabled or freed.
|
||||
*/
|
||||
if (enable_main_irq) {
|
||||
ret = regmap_update_bits(bd_rtc->regmap,
|
||||
BD70528_REG_INT_MAIN_MASK,
|
||||
BD70528_INT_RTC_MASK, 0);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "Failed to enable RTC interrupts\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return devm_rtc_register_device(rtc);
|
||||
}
|
||||
|
||||
static const struct platform_device_id bd718x7_rtc_id[] = {
|
||||
{ "bd70528-rtc", ROHM_CHIP_TYPE_BD70528 },
|
||||
{ "bd71828-rtc", ROHM_CHIP_TYPE_BD71828 },
|
||||
{ "bd71815-rtc", ROHM_CHIP_TYPE_BD71815 },
|
||||
{ },
|
||||
@@ -649,6 +355,6 @@ static struct platform_driver bd70528_rtc = {
|
||||
module_platform_driver(bd70528_rtc);
|
||||
|
||||
MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
|
||||
MODULE_DESCRIPTION("ROHM BD70528 and BD71828 PMIC RTC driver");
|
||||
MODULE_DESCRIPTION("ROHM BD71828 and BD71815 PMIC RTC driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("platform:bd70528-rtc");
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* RTC client/driver for the Maxim/Dallas DS1374 Real-Time Clock over I2C
|
||||
*
|
||||
@@ -6,11 +7,7 @@
|
||||
*
|
||||
* Copyright (C) 2014 Rose Technology
|
||||
* Copyright (C) 2006-2007 Freescale Semiconductor
|
||||
*
|
||||
* 2005 (c) MontaVista Software, Inc. This file is licensed under
|
||||
* the terms of the GNU General Public License version 2. This program
|
||||
* is licensed "as is" without any warranty of any kind, whether express
|
||||
* or implied.
|
||||
* Copyright (c) 2005 MontaVista Software, Inc.
|
||||
*/
|
||||
/*
|
||||
* It would be more efficient to use i2c msgs/i2c_transfer directly but, as
|
||||
|
||||
@@ -280,7 +280,6 @@ static struct platform_driver efi_rtc_driver = {
|
||||
|
||||
module_platform_driver_probe(efi_rtc_driver, efi_rtc_probe);
|
||||
|
||||
MODULE_ALIAS("platform:rtc-efi");
|
||||
MODULE_AUTHOR("dann frazier <dannf@dannf.org>");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("EFI RTC driver");
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_wakeirq.h>
|
||||
#include <linux/rtc.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/spinlock.h>
|
||||
@@ -811,6 +812,9 @@ static int __init dryice_rtc_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, imxdi);
|
||||
|
||||
device_init_wakeup(&pdev->dev, true);
|
||||
dev_pm_set_wake_irq(&pdev->dev, norm_irq);
|
||||
|
||||
imxdi->rtc->ops = &dryice_rtc_ops;
|
||||
imxdi->rtc->range_max = U32_MAX;
|
||||
|
||||
|
||||
@@ -544,10 +544,22 @@ static struct clk *m41t80_sqw_register_clk(struct m41t80_data *m41t80)
|
||||
{
|
||||
struct i2c_client *client = m41t80->client;
|
||||
struct device_node *node = client->dev.of_node;
|
||||
struct device_node *fixed_clock;
|
||||
struct clk *clk;
|
||||
struct clk_init_data init;
|
||||
int ret;
|
||||
|
||||
fixed_clock = of_get_child_by_name(node, "clock");
|
||||
if (fixed_clock) {
|
||||
/*
|
||||
* skip registering square wave clock when a fixed
|
||||
* clock has been registered. The fixed clock is
|
||||
* registered automatically when being referenced.
|
||||
*/
|
||||
of_node_put(fixed_clock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* First disable the clock */
|
||||
ret = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_MON);
|
||||
if (ret < 0)
|
||||
@@ -599,10 +611,8 @@ static unsigned long wdt_is_open;
|
||||
static int boot_flag;
|
||||
|
||||
/**
|
||||
* wdt_ping:
|
||||
*
|
||||
* Reload counter one with the watchdog timeout. We don't bother reloading
|
||||
* the cascade counter.
|
||||
* wdt_ping - Reload counter one with the watchdog timeout.
|
||||
* We don't bother reloading the cascade counter.
|
||||
*/
|
||||
static void wdt_ping(void)
|
||||
{
|
||||
@@ -638,9 +648,7 @@ static void wdt_ping(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* wdt_disable:
|
||||
*
|
||||
* disables watchdog.
|
||||
* wdt_disable - disables watchdog.
|
||||
*/
|
||||
static void wdt_disable(void)
|
||||
{
|
||||
@@ -677,7 +685,7 @@ static void wdt_disable(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* wdt_write:
|
||||
* wdt_write - write to watchdog.
|
||||
* @file: file handle to the watchdog
|
||||
* @buf: buffer to write (unused as data does not matter here
|
||||
* @count: count of bytes
|
||||
@@ -703,7 +711,7 @@ static ssize_t wdt_read(struct file *file, char __user *buf,
|
||||
}
|
||||
|
||||
/**
|
||||
* wdt_ioctl:
|
||||
* wdt_ioctl - ioctl handler to set watchdog.
|
||||
* @file: file handle to the device
|
||||
* @cmd: watchdog command
|
||||
* @arg: argument pointer
|
||||
@@ -778,7 +786,7 @@ static long wdt_unlocked_ioctl(struct file *file, unsigned int cmd,
|
||||
}
|
||||
|
||||
/**
|
||||
* wdt_open:
|
||||
* wdt_open - open a watchdog.
|
||||
* @inode: inode of device
|
||||
* @file: file handle to device
|
||||
*
|
||||
@@ -802,7 +810,7 @@ static int wdt_open(struct inode *inode, struct file *file)
|
||||
}
|
||||
|
||||
/**
|
||||
* wdt_close:
|
||||
* wdt_release - release a watchdog.
|
||||
* @inode: inode to board
|
||||
* @file: file handle to board
|
||||
*
|
||||
@@ -815,7 +823,7 @@ static int wdt_release(struct inode *inode, struct file *file)
|
||||
}
|
||||
|
||||
/**
|
||||
* notify_sys:
|
||||
* wdt_notify_sys - notify to watchdog.
|
||||
* @this: our notifier block
|
||||
* @code: the event being reported
|
||||
* @unused: unused
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* rtc class driver for the Maxim MAX6900 chip
|
||||
*
|
||||
* Copyright (c) 2007 MontaVista, Software, Inc.
|
||||
*
|
||||
* Author: Dale Farnsworth <dale@farnsworth.org>
|
||||
*
|
||||
* based on previously existing rtc class drivers
|
||||
*
|
||||
* 2007 (c) MontaVista, Software, Inc. This file is licensed under
|
||||
* the terms of the GNU General Public License version 2. This program
|
||||
* is licensed "as is" without any warranty of any kind, whether express
|
||||
* or implied.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
@@ -717,8 +717,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
|
||||
|
||||
add_rtc_irq:
|
||||
ret = regmap_add_irq_chip(info->rtc_regmap, info->rtc_irq,
|
||||
IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
|
||||
IRQF_SHARED, 0, info->drv_data->rtc_irq_chip,
|
||||
IRQF_ONESHOT | IRQF_SHARED,
|
||||
0, info->drv_data->rtc_irq_chip,
|
||||
&info->rtc_irq_data);
|
||||
if (ret < 0) {
|
||||
dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret);
|
||||
|
||||
@@ -372,6 +372,7 @@ static const struct of_device_id mxc_ids[] = {
|
||||
{ .compatible = "fsl,imx53-rtc", },
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, mxc_ids);
|
||||
|
||||
static struct platform_driver mxc_rtc_driver = {
|
||||
.driver = {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* rtc-palmas.c -- Palmas Real Time Clock driver.
|
||||
|
||||
@@ -7,20 +8,6 @@
|
||||
* Copyright (c) 2012, NVIDIA Corporation.
|
||||
*
|
||||
* Author: Laxman Dewangan <ldewangan@nvidia.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation version 2.
|
||||
*
|
||||
* This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
|
||||
* whether express or implied; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* 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/bcd.h>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user