RTC for 7.1

Subsystem:
  - add data_race() in rtc_dev_poll()
 
 Drivers:
  - remove i2c_match_id usage
  - abx80x: Disable alarm feature if no interrupt attached
  - ti-k3: support resuming from IO DDR low power mode
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEBqsFVZXh8s/0O5JiY6TcMGxwOjIFAmntBg4ACgkQY6TcMGxw
 OjL+5A/7BHJ1q8BCJwhHHa0XRQcwB4afZehSB0qasNbbAqJFgzrwZfg6mVXhXO3Y
 hry0SjzmFkCL9h6jckye2hPFjJsiaBC0Tauvmun6litrPnOrK+IK+P+Q7iKPap3Q
 5bSy+tDJXx3F3f+6LgDSVnrQFI3Q+nMHY/b1IWJkGW9Jpg/QlhU3UazN1kwu9Hyn
 nBvCczHyTYlSqaDSFUkQRXLfzXiMU16/iHzwsJZmOU03HNb1IF0Ngi8fIrPf1OIK
 2ZoyLzH0O0u+k10M+Sq/A2LKsgjnBOlu/L4iJUOKlhuq3Ze4/SY+C3IP+XbMyYF5
 EZ7pxPz66/WLzOpVx1xaSLpFiRBcCgbvwT2TY3P7e8A09AGye+AB+cqdKF9r9mX2
 p57cv2ZkZs/bGEjee2rSs7TTT4vZUhaa4SS6C4xrKIIoymFyKlh6E5fzWNUk4zua
 oN0djSSbtdIpSErIrlxp5xiITCIjSTZMVQKccs3qV5QhzNH8zsUPwwCM1cDawALC
 /HP6KnYmt6fTx3PS4BPVnMCQqSu425tvMhy5nvjbgdFVPd+CgOEAW6qO82nI3UFY
 KDNP4O224CVuOeX2WAU6+gOCTwqxg6rbjASAGGFOl6ox8eW555wpedVls0Y8oUQm
 z0O+gK33L/0hrw5Qnhh2If4S7gyNwWwVif2Gosf5ODRQ6LM5UOg=
 =mY/t
 -----END PGP SIGNATURE-----

Merge tag 'rtc-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux

Pull RTC updates from Alexandre Belloni:
 "Subsystem:
   - add data_race() in rtc_dev_poll()

  Drivers:
   - remove i2c_match_id usage
   - abx80x: Disable alarm feature if no interrupt attached
   - ti-k3: support resuming from IO DDR low power mode"

* tag 'rtc-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
  rtc: abx80x: Disable alarm feature if no interrupt attached
  rtc: ntxec: fix OF node reference imbalance
  rtc: pic32: allow driver to be compiled with COMPILE_TEST
  rtc: ti-k3: Add support to resume from IO DDR low power mode
  rtc: cmos: Use platform_get_irq_optional() in cmos_platform_probe()
  dt-bindings: rtc: add olpc,xo1-rtc to trivial-rtc
  dt-bindings: rtc: sc2731: Add compatible for SC2730
  rtc: add data_race() in rtc_dev_poll()
  rtc: armada38x: zalloc + calloc to single allocation
  dt-bindings: rtc: isl12026: convert to YAML schema
  dt-bindings: rtc: microcrystal,rv3028: Allow to specify vdd-supply
  rtc: max77686: convert to i2c_new_ancillary_device
  dt-bindings: rtc: mpfs-rtc: permit resets
  rtc: rx8025: Remove use of i2c_match_id()
  rtc: rv8803: Remove use of i2c_match_id()
  rtc: rs5c372: Remove use of i2c_match_id()
  rtc: pcf2127: Remove use of i2c_match_id()
  rtc: m41t80: Remove use of i2c_match_id()
  rtc: abx80x: Remove use of i2c_match_id()
This commit is contained in:
Linus Torvalds 2026-04-25 16:39:03 -07:00
commit 211d593314
20 changed files with 132 additions and 90 deletions

View File

@ -1,28 +0,0 @@
ISL12026 I2C RTC/EEPROM
ISL12026 is an I2C RTC/EEPROM combination device. The RTC and control
registers respond at bus address 0x6f, and the EEPROM array responds
at bus address 0x57. The canonical "reg" value will be for the RTC portion.
Required properties supported by the device:
- "compatible": must be "isil,isl12026"
- "reg": I2C bus address of the device (always 0x6f)
Optional properties:
- "isil,pwr-bsw": If present PWR.BSW bit must be set to the specified
value for proper operation.
- "isil,pwr-sbib": If present PWR.SBIB bit must be set to the specified
value for proper operation.
Example:
rtc@6f {
compatible = "isil,isl12026";
reg = <0x6f>;
isil,pwr-bsw = <0>;
isil,pwr-sbib = <1>;
}

View 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/isil,isl12026.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Intersil ISL12026 I2C RTC/EEPROM
maintainers:
- Piyush Patle <piyushpatle228@gmail.com>
description:
The ISL12026 is a combination RTC and EEPROM device connected via I2C.
The RTC and control registers respond at address 0x6f, while the EEPROM
array responds at address 0x57. The "reg" property refers to the RTC
portion of the device.
allOf:
- $ref: rtc.yaml#
properties:
compatible:
const: isil,isl12026
reg:
maxItems: 1
description: I2C address of the RTC portion (must be 0x6f)
isil,pwr-bsw:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1 ]
description:
Value written to the PWR.BSW bit for proper device operation.
isil,pwr-sbib:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1 ]
description:
Value written to the PWR.SBIB bit for proper device operation.
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
rtc@6f {
compatible = "isil,isl12026";
reg = <0x6f>;
isil,pwr-bsw = <0>;
isil,pwr-sbib = <1>;
};
};

View File

@ -47,6 +47,9 @@ properties:
- const: rtc
- const: rtcref
resets:
maxItems: 1
required:
- compatible
- reg

View File

@ -32,6 +32,8 @@ properties:
- 9000
- 15000
vdd-supply: true
required:
- compatible
- reg

View File

@ -1,5 +0,0 @@
OLPC XO-1 RTC
~~~~~~~~~~~~~
Required properties:
- compatible : "olpc,xo1-rtc"

View File

@ -13,7 +13,12 @@ maintainers:
properties:
compatible:
const: sprd,sc2731-rtc
oneOf:
- items:
- enum:
- sprd,sc2730-rtc
- const: sprd,sc2731-rtc
- const: sprd,sc2731-rtc
reg:
maxItems: 1

View File

@ -65,6 +65,8 @@ properties:
- microcrystal,rv3029
# Real Time Clock
- microcrystal,rv8523
# OLPC XO-1 RTC
- olpc,xo1-rtc
# I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC
- ricoh,r2025sd
# I2C bus SERIAL INTERFACE REAL-TIME CLOCK IC

View File

@ -1986,7 +1986,7 @@ config RTC_DRV_XGENE
config RTC_DRV_PIC32
tristate "Microchip PIC32 RTC"
depends on MACH_PIC32
depends on MACH_PIC32 || COMPILE_TEST
default y
help
If you say yes here you get support for the PIC32 RTC module.

View File

@ -195,7 +195,16 @@ static __poll_t rtc_dev_poll(struct file *file, poll_table *wait)
poll_wait(file, &rtc->irq_queue, wait);
data = rtc->irq_data;
/*
* This read can race with the write in rtc_handle_legacy_irq().
*
* - If this check misses a zero to non-zero transition the next check
* will pick it up (rtc_handle_legacy_irq() wakes up rtc->irq_queue).
* - Non-zero to non-zero transition misses do not change return value.
* - And a non-zero to zero transition is unlikely to be missed, since
* it occurs on rtc_dev_read(), during which polling is not expected.
*/
data = data_race(rtc->irq_data);
return (data != 0) ? (EPOLLIN | EPOLLRDNORM) : 0;
}

View File

@ -772,8 +772,7 @@ static int abx80x_probe(struct i2c_client *client)
struct abx80x_priv *priv;
int i, data, err, trickle_cfg = -EINVAL;
char buf[7];
const struct i2c_device_id *id = i2c_match_id(abx80x_id, client);
unsigned int part = id->driver_data;
unsigned int part = (uintptr_t)i2c_get_match_data(client);
unsigned int partnumber;
unsigned int majrev, minrev;
unsigned int lot;
@ -933,6 +932,8 @@ static int abx80x_probe(struct i2c_client *client)
client->irq = 0;
}
}
if (client->irq <= 0)
clear_bit(RTC_FEATURE_ALARM, priv->rtc->features);
err = rtc_add_group(priv->rtc, &rtc_calib_attr_group);
if (err) {

View File

@ -72,8 +72,8 @@ struct armada38x_rtc {
spinlock_t lock;
int irq;
bool initialized;
struct value_to_freq *val_to_freq;
const struct armada38x_rtc_data *data;
struct value_to_freq val_to_freq[];
};
#define ALARM1 0
@ -490,18 +490,13 @@ static __init int armada38x_rtc_probe(struct platform_device *pdev)
{
struct armada38x_rtc *rtc;
rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc),
rtc = devm_kzalloc(&pdev->dev, struct_size(rtc, val_to_freq, SAMPLE_NR),
GFP_KERNEL);
if (!rtc)
return -ENOMEM;
rtc->data = of_device_get_match_data(&pdev->dev);
rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR,
sizeof(struct value_to_freq), GFP_KERNEL);
if (!rtc->val_to_freq)
return -ENOMEM;
spin_lock_init(&rtc->lock);
rtc->regs = devm_platform_ioremap_resource_byname(pdev, "rtc");

View File

@ -1429,9 +1429,18 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
resource = platform_get_resource(pdev, IORESOURCE_IO, 0);
else
resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (irq < 0)
irq = platform_get_irq_optional(pdev, 0);
if (irq < 0) {
irq = -1;
#ifdef CONFIG_X86
/*
* On some x86 systems, the IRQ is not defined, but it should
* always be safe to hardcode it on systems with a legacy PIC.
*/
if (nr_legacy_irqs())
irq = RTC_IRQ;
#endif
}
return cmos_do_probe(&pdev->dev, resource, irq);
}

View File

@ -924,13 +924,7 @@ static int m41t80_probe(struct i2c_client *client)
return -ENOMEM;
m41t80_data->client = client;
if (client->dev.of_node) {
m41t80_data->features = (unsigned long)
of_device_get_match_data(&client->dev);
} else {
const struct i2c_device_id *id = i2c_match_id(m41t80_id, client);
m41t80_data->features = id->driver_data;
}
m41t80_data->features = (unsigned long)i2c_get_match_data(client);
i2c_set_clientdata(client, m41t80_data);
m41t80_data->rtc = devm_rtc_allocate_device(&client->dev);

View File

@ -686,6 +686,11 @@ static int max77686_rtc_init_reg(struct max77686_rtc_info *info)
return ret;
}
static void max77686_rtc_release_dev(void *client)
{
i2c_unregister_device(client);
}
static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
{
struct device *parent = info->dev->parent;
@ -713,12 +718,17 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
goto add_rtc_irq;
}
client = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
client = i2c_new_ancillary_device(parent_i2c, "rtc",
info->drv_data->rtc_i2c_addr);
if (IS_ERR(client))
return dev_err_probe(info->dev, PTR_ERR(client),
"Failed to allocate I2C device for RTC\n");
ret = devm_add_action_or_reset(info->dev, max77686_rtc_release_dev,
client);
if (ret)
return ret;
info->rtc_regmap = devm_regmap_init_i2c(client,
info->drv_data->regmap_config);
if (IS_ERR(info->rtc_regmap))

View File

@ -110,7 +110,7 @@ static int ntxec_rtc_probe(struct platform_device *pdev)
struct rtc_device *dev;
struct ntxec_rtc *rtc;
pdev->dev.of_node = pdev->dev.parent->of_node;
device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL);
if (!rtc)

View File

@ -1449,10 +1449,10 @@ static const struct regmap_bus pcf2127_i2c_regmap = {
static struct i2c_driver pcf2127_i2c_driver;
static const struct i2c_device_id pcf2127_i2c_id[] = {
{ "pcf2127", PCF2127 },
{ "pcf2129", PCF2129 },
{ "pca2129", PCF2129 },
{ "pcf2131", PCF2131 },
{ "pcf2127", (kernel_ulong_t)&pcf21xx_cfg[PCF2127] },
{ "pcf2129", (kernel_ulong_t)&pcf21xx_cfg[PCF2129] },
{ "pca2129", (kernel_ulong_t)&pcf21xx_cfg[PCF2129] },
{ "pcf2131", (kernel_ulong_t)&pcf21xx_cfg[PCF2131] },
{ }
};
MODULE_DEVICE_TABLE(i2c, pcf2127_i2c_id);
@ -1469,18 +1469,9 @@ static int pcf2127_i2c_probe(struct i2c_client *client)
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -ENODEV;
if (client->dev.of_node) {
variant = of_device_get_match_data(&client->dev);
variant = i2c_get_match_data(client);
if (!variant)
return -ENODEV;
} else {
enum pcf21xx_type type =
i2c_match_id(pcf2127_i2c_id, client)->driver_data;
if (type >= PCF21XX_LAST_ID)
return -ENODEV;
variant = &pcf21xx_cfg[type];
}
config.max_register = variant->max_register,

View File

@ -825,12 +825,7 @@ static int rs5c372_probe(struct i2c_client *client)
rs5c372->client = client;
i2c_set_clientdata(client, rs5c372);
if (client->dev.of_node) {
rs5c372->type = (uintptr_t)of_device_get_match_data(&client->dev);
} else {
const struct i2c_device_id *id = i2c_match_id(rs5c372_id, client);
rs5c372->type = id->driver_data;
}
rs5c372->type = (uintptr_t)i2c_get_match_data(client);
/* we read registers 0x0f then 0x00-0x0f; skip the first one */
rs5c372->regs = &rs5c372->buf[1];

View File

@ -667,13 +667,7 @@ static int rv8803_probe(struct i2c_client *client)
mutex_init(&rv8803->flags_lock);
rv8803->client = client;
if (client->dev.of_node) {
rv8803->type = (uintptr_t)of_device_get_match_data(&client->dev);
} else {
const struct i2c_device_id *id = i2c_match_id(rv8803_id, client);
rv8803->type = id->driver_data;
}
rv8803->type = (uintptr_t)i2c_get_match_data(client);
i2c_set_clientdata(client, rv8803);
flags = rv8803_read_reg(client, RV8803_FLAG);

View File

@ -522,7 +522,6 @@ static const struct attribute_group rx8025_attr_group = {
static int rx8025_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_match_id(rx8025_id, client);
struct i2c_adapter *adapter = client->adapter;
struct rx8025_data *rx8025;
int err = 0;
@ -540,8 +539,7 @@ static int rx8025_probe(struct i2c_client *client)
i2c_set_clientdata(client, rx8025);
if (id)
rx8025->model = id->driver_data;
rx8025->model = (uintptr_t)i2c_get_match_data(client);
err = rx8025_init_client(client);
if (err)

View File

@ -640,10 +640,18 @@ static int __maybe_unused ti_k3_rtc_suspend(struct device *dev)
static int __maybe_unused ti_k3_rtc_resume(struct device *dev)
{
struct ti_k3_rtc *priv = dev_get_drvdata(dev);
int ret = 0;
if (k3rtc_check_unlocked(priv)) {
/* RTC locked implies low power mode exit where RTC loses context */
ret = k3rtc_configure(dev);
if (ret)
return ret;
}
if (device_may_wakeup(dev))
disable_irq_wake(priv->irq);
return 0;
return ret;
}
static SIMPLE_DEV_PM_OPS(ti_k3_rtc_pm_ops, ti_k3_rtc_suspend, ti_k3_rtc_resume);