Skip to contentSkip to conversation

rtc: rtc-isl12057: fixes and alarm support

PATCH New Arnaud Ebalard 4 participants 20 messages Nov 14, 2014 – Dec 11, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover rtc: rtc-isl12057: fixes and alarm support

Hi,

This series includes six patches for Intersil ISL12057 driver.

- First patch is a fix for masking issues which dates back to driver inclusion. Even if those issues are not critical per se, the patch is a good candidate for stable down to 3.14.

- As suggested by Uwe, second patch adds proper support for century bit provided by the driver. This will allow to use the chip until 2199 if we manage to pass 2038.

- Following another comment by Uwe, third patch corrects the handling of oscillator failure bit.

- fourth patch fixes remaining places where 'isl' is used instead of the expected NASDAQ symbol for Intersil (i.e. isil) after commit 7a6540ca856ae ("ARM: mvebu: Change vendor prefix for Intersil Corporation to isil").

- As suggested by Mark, fifth patch improves failure reports by providing error code in dev_err() code.

- Sixth patch provides alarm support for Intersil ISL12057. This support was not added when the driver was initially pushed in 3.14 kernel due to the inability to check interrupt support. After some soldering, this tests have been performed. More time was also spent on testing.

Comments are welcome,

Cheers,

a+

Changes since v0:

- Kept an "isl,isl12057" compatible string for out-of-tree users w/ a comment this is obsolete as suggested by Mark and Uwe.
- Changed function name from toggle to update for helper as suggested by Uwe and Guenter.
- As suggested by Mark, added a patch to improve error reporting and log the error code
- Driver now handles lack of IRQ correctly by returning -ENOTTY if alarm_irq_enable() handler is called and no IRQ has been provided. Additionally, the device is marked as not supporting UIE when no IRQ is available.
- Following comments from Mark, added a local copy of IRQ (or lack of) in driver's private structure
- Following comments from Mark, removed a useless call to free_irq() (driver makes use of devm_request_threaded_irq() which makes the call pointless)
- Following report from Uwe, added a patch to handle oscillator failure bit properly
- Following suggestions from Uwe, added a patch to handle the century bit the device provides

Arnaud Ebalard (6):
rtc: rtc-isl12057: fix masking of register values
rtc: rtc-isl12057: add support for century bit
rtc: rtc-isl12057: add proper handling of oscillator failure bit
rtc: rtc-isl12057: fix isil vs isl naming for intersil
rtc: rtc-isl12057: report error code upon failure in dev_err() calls
rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver

 .../devicetree/bindings/i2c/trivial-devices.txt    |   2 +-
 .../devicetree/bindings/vendor-prefixes.txt        |   2 +-
 drivers/rtc/rtc-isl12057.c                         | 408 +++++++++++++++++++--
 3 files changed, 377 insertions(+), 35 deletions(-)
Signature · 1 line
2.1.1
#1 lore raw

PATCH 1/6 rtc: rtc-isl12057: fix masking of register values

When Intersil ISL12057 support was added by commit 70e123373c05 ("rtc:
Add support for Intersil ISL12057 I2C RTC chip"), two masks for time registers values imported from the device were either wrong or omitted, leading to additional bits from those registers to impact read values:

- mask for hour register value when reading it in AM/PM mode. As AM/PM mode is not the usual mode used by the driver, this error would only have an impact on an externally configured RTC hour later read by the driver.
- mask for month value. The lack of masking would provide an erroneous value if century bit is set.

This patch fixes those two masks.

Fixes 70e123373c05 ("rtc: Add support for Intersil ISL12057 I2C RTC chip")
---
 drivers/rtc/rtc-isl12057.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-isl12057.c +2 -2
index 455b601d731d..8c3f60737df8 100644
@@ -88,7 +88,7 @@ static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs)
 	tm->tm_min = bcd2bin(regs[ISL12057_REG_RTC_MN]);
 
 	if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_MIL) { /* AM/PM */
-		tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x0f);
+		tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x1f);
 		if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_PM)
 			tm->tm_hour += 12;
 	} else {					    /* 24 hour mode */
@@ -97,7 +97,7 @@ static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs)
 
 	tm->tm_mday = bcd2bin(regs[ISL12057_REG_RTC_DT]);
 	tm->tm_wday = bcd2bin(regs[ISL12057_REG_RTC_DW]) - 1; /* starts at 1 */
-	tm->tm_mon  = bcd2bin(regs[ISL12057_REG_RTC_MO]) - 1; /* starts at 1 */
+	tm->tm_mon  = bcd2bin(regs[ISL12057_REG_RTC_MO] & 0x1f) - 1; /* ditto */
 	tm->tm_year = bcd2bin(regs[ISL12057_REG_RTC_YR]) + 100;
 }
 
Signature · 1 line
2.1.1
#2 lore raw

PATCH 2/6 rtc: rtc-isl12057: add support for century bit

In reply to Arnaud Ebalard

The month register of ISL12057 RTC chip includes a century bit which reports overflow of year register from 99 to 0. This bit can also be written, which allows using it to extend the time interval the chip can support from 99 to 199 years.

This patch adds support for century overflow bit in tm to regs and regs to tm helpers in ISL12057 driver.

This was tested by putting a device 100 years in the future (using a specific kernel due to the inability of userland tools such as date or hwclock to pass year 2038), rebooting on a kernel w/ this patch applied and verifying the device was still 100 years in the future.

---
 drivers/rtc/rtc-isl12057.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/rtc/rtc-isl12057.c +16 -4
index 8c3f60737df8..b538fabfcfd3 100644
@@ -41,6 +41,7 @@
 #define ISL12057_REG_RTC_DW	0x03	/* Day of the Week */
 #define ISL12057_REG_RTC_DT	0x04	/* Date */
 #define ISL12057_REG_RTC_MO	0x05	/* Month */
+#define ISL12057_REG_RTC_MO_CEN	BIT(7)	/* Century bit */
 #define ISL12057_REG_RTC_YR	0x06	/* Year */
 #define ISL12057_RTC_SEC_LEN	7
 
@@ -99,24 +100,35 @@ static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs)
 	tm->tm_wday = bcd2bin(regs[ISL12057_REG_RTC_DW]) - 1; /* starts at 1 */
 	tm->tm_mon  = bcd2bin(regs[ISL12057_REG_RTC_MO] & 0x1f) - 1; /* ditto */
 	tm->tm_year = bcd2bin(regs[ISL12057_REG_RTC_YR]) + 100;
+
+	/* Check if years register has overflown from 99 to 00 */
+	if (regs[ISL12057_REG_RTC_MO] & ISL12057_REG_RTC_MO_CEN)
+		tm->tm_year += 100;
 }
 
 static int isl12057_rtc_tm_to_regs(u8 *regs, struct rtc_time *tm)
 {
+	u8 century_bit;
+
 	/*
 	 * The clock has an 8 bit wide bcd-coded register for the year.
+	 * It also has a century bit encoded in MO flag which provides
+	 * information about overflow of year register from 99 to 00.
 	 * tm_year is an offset from 1900 and we are interested in the
-	 * 2000-2099 range, so any value less than 100 is invalid.
+	 * 2000-2199 range, so any value less than 100 or larger than
+	 * 299 is invalid.
 	 */
-	if (tm->tm_year < 100)
+	if (tm->tm_year < 100 || tm->tm_year > 299)
 		return -EINVAL;
 
+	century_bit = (tm->tm_year > 199) ? ISL12057_REG_RTC_MO_CEN : 0;
+
 	regs[ISL12057_REG_RTC_SC] = bin2bcd(tm->tm_sec);
 	regs[ISL12057_REG_RTC_MN] = bin2bcd(tm->tm_min);
 	regs[ISL12057_REG_RTC_HR] = bin2bcd(tm->tm_hour); /* 24-hour format */
 	regs[ISL12057_REG_RTC_DT] = bin2bcd(tm->tm_mday);
-	regs[ISL12057_REG_RTC_MO] = bin2bcd(tm->tm_mon + 1);
-	regs[ISL12057_REG_RTC_YR] = bin2bcd(tm->tm_year - 100);
+	regs[ISL12057_REG_RTC_MO] = bin2bcd(tm->tm_mon + 1) | century_bit;
+	regs[ISL12057_REG_RTC_YR] = bin2bcd(tm->tm_year % 100);
 	regs[ISL12057_REG_RTC_DW] = bin2bcd(tm->tm_wday + 1);
 
 	return 0;
Signature · 1 line
2.1.1
#3 lore raw

PATCH 3/6 rtc: rtc-isl12057: add proper handling of oscillator failure bit

In reply to Arnaud Ebalard

As suggested by Uwe, instead of clearing oscillator failure bit unconditionally at driver load, this patch adds proper handling of the flag. The driver now returns -ENODATA when reading time from the device and oscillator failure bit is set. The flag is now cleared only when the a new time value is pushed to the device.

---
 drivers/rtc/rtc-isl12057.c | 47 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 14 deletions(-)
drivers/rtc/rtc-isl12057.c +33 -14
index b538fabfcfd3..fe562820a54a 100644
@@ -164,17 +164,32 @@ static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
 	struct isl12057_rtc_data *data = dev_get_drvdata(dev);
 	u8 regs[ISL12057_RTC_SEC_LEN];
+	unsigned int sr;
 	int ret;
 
 	mutex_lock(&data->lock);
+	ret = regmap_read(data->regmap, ISL12057_REG_SR, &sr);
+	if (ret) {
+		dev_err(dev, "%s: unable to read oscillator status flag\n",
+			__func__);
+		goto out;
+	} else {
+		if (sr & ISL12057_REG_SR_OSF) {
+			ret = -ENODATA;
+			goto out;
+		}
+	}
+
 	ret = regmap_bulk_read(data->regmap, ISL12057_REG_RTC_SC, regs,
 			       ISL12057_RTC_SEC_LEN);
+	if (ret)
+		dev_err(dev, "%s: unable to read RTC time\n", __func__);
+
+out:
 	mutex_unlock(&data->lock);
 
-	if (ret) {
-		dev_err(dev, "%s: RTC read failed\n", __func__);
+	if (ret)
 		return ret;
-	}
 
 	isl12057_rtc_regs_to_tm(tm, regs);
 
@@ -194,10 +209,22 @@ static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	mutex_lock(&data->lock);
 	ret = regmap_bulk_write(data->regmap, ISL12057_REG_RTC_SC, regs,
 				ISL12057_RTC_SEC_LEN);
-	mutex_unlock(&data->lock);
+	if (ret) {
+		dev_err(dev, "%s: writing RTC time failed\n", __func__);
+		goto out;
+	}
 
-	if (ret)
-		dev_err(dev, "%s: RTC write failed\n", __func__);
+	/*
+	 * Now that RTC time has been updated, let's clear oscillator
+	 * failure flag, if needed.
+	 */
+	ret = regmap_update_bits(data->regmap, ISL12057_REG_SR,
+				 ISL12057_REG_SR_OSF, 0);
+	if (ret < 0)
+		dev_err(dev, "Unable to clear oscillator failure bit\n");
+
+out:
+	mutex_unlock(&data->lock);
 
 	return ret;
 }
@@ -219,14 +246,6 @@ static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap)
 		return ret;
 	}
 
-	/* Clear oscillator failure bit if needed */
-	ret = regmap_update_bits(regmap, ISL12057_REG_SR,
-				 ISL12057_REG_SR_OSF, 0);
-	if (ret < 0) {
-		dev_err(dev, "Unable to clear oscillator failure bit\n");
-		return ret;
-	}
-
 	/* Clear alarm bit if needed */
 	ret = regmap_update_bits(regmap, ISL12057_REG_SR,
 				 ISL12057_REG_SR_A1F, 0);
Signature · 1 line
2.1.1
#4 lore raw

PATCH 4/6 rtc: rtc-isl12057: fix isil vs isl naming for intersil

In reply to Arnaud Ebalard

When Intersil ISL12057 driver was introduced by commit 70e123373c05 ("rtc: Add support for Intersil ISL12057 I2C RTC chip"), the vendor prefix 'isl' was used instead of the expected 'isil' (Intersil NASDAQ symbol). Recently, a patch from Philip Zabel (7a6540ca856a, "ARM: mvebu: Change vendor prefix for Intersil Corporation to isil") fixed that prefix in ReadyNAS devices .dts files (AFAICT, the only users).

That patch completes that work to change the remaining values in:

- Intersil ISL12057 driver (compatible string) and also associated Documentation/devicetree/bindings/i2c/trivial-devices.txt file to reflect the changes introduced by previous commit from Philip
- Documentation/devicetree/bindings/vendor-prefixes.txt files to avoid future mistakes

---
 Documentation/devicetree/bindings/i2c/trivial-devices.txt | 2 +-
 Documentation/devicetree/bindings/vendor-prefixes.txt     | 2 +-
 drivers/rtc/rtc-isl12057.c                                | 3 ++-
 3 files changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/i2c/trivial-devices.txt +1 -1
index fbde415078e6..edac97c0f756 100644
@@ -55,7 +55,7 @@ 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)
-isl,isl12057		Intersil ISL12057 I2C RTC Chip
+isil,isl12057		Intersil ISL12057 I2C RTC Chip
 maxim,ds1050		5 Bit Programmable, Pulse-Width Modulator
 maxim,max1237		Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
 maxim,max6625		9-Bit/12-Bit Temperature Sensors with I?C-Compatible Serial Interface
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -1
index 723999d73744..84193ecdc41c 100644
@@ -77,7 +77,7 @@ innolux	Innolux Corporation
 intel	Intel Corporation
 intercontrol	Inter Control Group
 isee	ISEE 2007 S.L.
-isl	Intersil
+isil	Intersil
 karo	Ka-Ro electronics GmbH
 keymile	Keymile GmbH
 lacie	LaCie
drivers/rtc/rtc-isl12057.c +2 -1
index fe562820a54a..31eaa6a9c2b2 100644
@@ -310,7 +310,8 @@ static int isl12057_probe(struct i2c_client *client,
 
 #ifdef CONFIG_OF
 static const struct of_device_id isl12057_dt_match[] = {
-	{ .compatible = "isl,isl12057" },
+	{ .compatible = "isl,isl12057" },  /* obsolete */
+	{ .compatible = "isil,isl12057" },
 	{ },
 };
 #endif
Signature · 1 line
2.1.1
#7 lore raw

PATCH 5/6 rtc: rtc-isl12057: report error code upon failure in dev_err() calls

In reply to Arnaud Ebalard

As pointed by Mark, it is generally useful to log the error code when reporting a failure. This patch improves existing calls to dev_err() in ISL12057 driver to also report error code.

---
 drivers/rtc/rtc-isl12057.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/rtc/rtc-isl12057.c +14 -8
index 31eaa6a9c2b2..a783e16cfd2f 100644
@@ -170,8 +170,8 @@ static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	mutex_lock(&data->lock);
 	ret = regmap_read(data->regmap, ISL12057_REG_SR, &sr);
 	if (ret) {
-		dev_err(dev, "%s: unable to read oscillator status flag\n",
-			__func__);
+		dev_err(dev, "%s: unable to read oscillator status flag (%d)\n",
+			__func__, ret);
 		goto out;
 	} else {
 		if (sr & ISL12057_REG_SR_OSF) {
@@ -183,7 +183,8 @@ static int isl12057_rtc_read_time(struct device *dev, struct rtc_time *tm)
 	ret = regmap_bulk_read(data->regmap, ISL12057_REG_RTC_SC, regs,
 			       ISL12057_RTC_SEC_LEN);
 	if (ret)
-		dev_err(dev, "%s: unable to read RTC time\n", __func__);
+		dev_err(dev, "%s: unable to read RTC time section (%d)\n",
+			__func__, ret);
 
 out:
 	mutex_unlock(&data->lock);
@@ -210,7 +211,8 @@ static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	ret = regmap_bulk_write(data->regmap, ISL12057_REG_RTC_SC, regs,
 				ISL12057_RTC_SEC_LEN);
 	if (ret) {
-		dev_err(dev, "%s: writing RTC time failed\n", __func__);
+		dev_err(dev, "%s: unable to write RTC time section (%d)\n",
+			__func__, ret);
 		goto out;
 	}
 
@@ -221,7 +223,8 @@ static int isl12057_rtc_set_time(struct device *dev, struct rtc_time *tm)
 	ret = regmap_update_bits(data->regmap, ISL12057_REG_SR,
 				 ISL12057_REG_SR_OSF, 0);
 	if (ret < 0)
-		dev_err(dev, "Unable to clear oscillator failure bit\n");
+		dev_err(dev, "%s: unable to clear osc. failure bit (%d)\n",
+			__func__, ret);
 
 out:
 	mutex_unlock(&data->lock);
@@ -242,7 +245,8 @@ static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap)
 	ret = regmap_update_bits(regmap, ISL12057_REG_INT,
 				 ISL12057_REG_INT_EOSC, 0);
 	if (ret < 0) {
-		dev_err(dev, "Unable to enable oscillator\n");
+		dev_err(dev, "%s: unable to enable oscillator (%d)\n",
+			__func__, ret);
 		return ret;
 	}
 
@@ -250,7 +254,8 @@ static int isl12057_check_rtc_status(struct device *dev, struct regmap *regmap)
 	ret = regmap_update_bits(regmap, ISL12057_REG_SR,
 				 ISL12057_REG_SR_A1F, 0);
 	if (ret < 0) {
-		dev_err(dev, "Unable to clear alarm bit\n");
+		dev_err(dev, "%s: unable to clear alarm bit (%d)\n",
+			__func__, ret);
 		return ret;
 	}
 
@@ -284,7 +289,8 @@ static int isl12057_probe(struct i2c_client *client,
 	regmap = devm_regmap_init_i2c(client, &isl12057_rtc_regmap_config);
 	if (IS_ERR(regmap)) {
 		ret = PTR_ERR(regmap);
-		dev_err(dev, "regmap allocation failed: %d\n", ret);
+		dev_err(dev, "%s: regmap allocation failed (%d)\n",
+			__func__, ret);
 		return ret;
 	}
 
Signature · 1 line
2.1.1
#8 lore raw

PATCH 6/6 rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver

In reply to Arnaud Ebalard

This patch adds alarm support to Intersil ISL12057 driver. This allows to configure the chip to generate an interrupt when the alarm matches current time value. Alarm can be programmed up to one month in the future and is accurate to the second.

The patch was developed to support two different configurations:
systems w/ and w/o RTC chip IRQ line connected to the main CPU.

The latter is the one found on current 3 kernel users of the chip for which support was initially developed (Netgear ReadyNAS 102, 104 and 2120 NAS). On those devices, the IRQ#2 pin of the chip is not connected to the SoC but to a PMIC. This allows setting an alarm, powering off the device and have it wake up when the alarm rings. To support that configuration the driver does the following:

1. it has alarm_irq_enable() function returns -ENOTTY when no IRQ is passed to the driver.
2. it marks the device as a wakeup source in all cases (whether an IRQ is passed to the driver or not) to have 'wakealarm' sysfs entry created.
3. it marks the device has not supporting UIE mode when no IRQ is passed to the driver (see the commmit message of c9f5c7e7a84f)

This specific configuration was tested on a ReadyNAS 102 by setting an alarm, powering off the device and see it reboot as expected when the alarm rang.

The former configuration was tested on a Netgear ReadyNAS 102 after some soldering of the IRQ#2 pin of the RTC chip to a MPP line of the SoC (the one used usually handles the reset button). The test was performed using a modified .dts file reflecting this change (see below) and rtc-test.c program available in Documentation/rtc.txt. This test program ran as expected, which validates alarm supports, including interrupt support.

As a side note, the ISL12057 remains in the list of trivial devices, i.e. no specific DT binding being added by this patch: i2c core automatically handles extraction of IRQ line info from .dts file. For instance, if one wants to reference the interrupt line for the alarm in its .dts file, adding interrupt and interrupt-parent properties works as expected:

          isl12057: isl12057 at 68 {
                  compatible = "isil,isl12057";
                  interrupt-parent = <&gpio0>;
                  interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
                  reg = <0x68>;
          };

FWIW, if someone is looking for a way to test alarm support on a system on which the chip IRQ line has the ability to boot the system (e.g. ReadyNAS 102, 104, etc):

    # echo 0 > /sys/class/rtc/rtc0/wakealarm
    # echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm
    # shutdown -h now

With the commandes above, after a minute, the system comes back to life.

---
 .../devicetree/bindings/i2c/trivial-devices.txt    |   2 +-
 drivers/rtc/rtc-isl12057.c                         | 324 ++++++++++++++++++++-
 2 files changed, 315 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/i2c/trivial-devices.txt +1 -1
index edac97c0f756..f716e7da44a9 100644
@@ -55,7 +55,7 @@ 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,isl12057		Intersil ISL12057 I2C RTC/Alarm Chip
 maxim,ds1050		5 Bit Programmable, Pulse-Width Modulator
 maxim,max1237		Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
 maxim,max6625		9-Bit/12-Bit Temperature Sensors with I?C-Compatible Serial Interface
drivers/rtc/rtc-isl12057.c +314 -10

394 lines not on this page · raw message

Signature · 1 line
2.1.1
#13 lore raw

cover rtc: rtc-isl12057: fixes and alarm support

In reply to Arnaud Ebalard

Hi Jason and Mark,

Quoted 18 lines · Arnaud Ebalard

This series includes six patches for Intersil ISL12057 driver.

- First patch is a fix for masking issues which dates back to driver inclusion. Even if those issues are not critical per se, the patch is a good candidate for stable down to 3.14.

- As suggested by Uwe, second patch adds proper support for century bit provided by the driver. This will allow to use the chip until 2199 if we manage to pass 2038.

- Following another comment by Uwe, third patch corrects the handling of oscillator failure bit.

- fourth patch fixes remaining places where 'isl' is used instead of the expected NASDAQ symbol for Intersil (i.e. isil) after commit 7a6540ca856ae ("ARM: mvebu: Change vendor prefix for Intersil Corporation to isil").

Quoted 8 lines

- As suggested by Mark, fifth patch improves failure reports by providing error code in dev_err() code.

- Sixth patch provides alarm support for Intersil ISL12057. This support was not added when the driver was initially pushed in 3.14 kernel due to the inability to check interrupt support. After some soldering, this tests have been performed. More time was also spent on testing.

I wonder if you could take a look at this series I sent providing fixes (patches #1-5) and alarm support (patch #6) for ISL12057 RTC Chip. As all people do for RTC patches - due to lack of feedback from maintainer
- I am looking for someone to review the patches (Mark, patch 6 has a sticker w/ regmap-inside ;-)) and then push those upstream if they are ok (Jason, you handled that part for 70e123373c05: "rtc: Add support for Intersil ISL12057 I2C RTC chip" in 2013 for the same reason).

Note that I addressed previous comments and feedback received from Uwe and also spent time to do some soldering in order to support and test the last patch for both my use case (Alarm IRQ signal not routed to the SoC on ReadyNAS RN102, RN104 and RN2120) and the common case.

Do not hesitate to ask if you want me to resend!

Cheers,

a+

Thread: http://thread.gmane.org/gmane.linux.documentation/28237
Patch 1/6: https://patchwork.kernel.org/patch/5310101/raw/
Patch 2/6: https://patchwork.kernel.org/patch/5310111/raw/
Patch 3/6: https://patchwork.kernel.org/patch/5310121/raw/
Patch 4/6: https://patchwork.kernel.org/patch/5310131/raw/
Patch 5/6: https://patchwork.kernel.org/patch/5310141/raw/
Patch 6/6: https://patchwork.kernel.org/patch/5310151/raw/

#14 lore raw

cover rtc: rtc-isl12057: fixes and alarm support

Hello Arnaud,

Quoted 8 lines · Arnaud Ebalard

I wonder if you could take a look at this series I sent providing fixes (patches #1-5) and alarm support (patch #6) for ISL12057 RTC Chip. As all people do for RTC patches - due to lack of feedback from maintainer
- I am looking for someone to review the patches (Mark, patch 6 has a sticker w/ regmap-inside ;-)) and then push those upstream if they are ok (Jason, you handled that part for 70e123373c05: "rtc: Add support for Intersil ISL12057 I2C RTC chip" in 2013 for the same reason).

Quoted 6 lines

Note that I addressed previous comments and feedback received from Uwe and also spent time to do some soldering in order to support and test the last patch for both my use case (Alarm IRQ signal not routed to the SoC on ReadyNAS RN102, RN104 and RN2120) and the common case.

Do not hesitate to ask if you want me to resend!

akpm already applied the series, doesn't he?

I'm about to test the patches, just fighting with my NAS to boot my custom kernel.

Apart from that patches 1 - 5 can have my Ack. Didn't look deep enough into patch 6 yet. @akpm: No need to hurry adding them, I hope to be able to also provide Tested-by:-tags later today.

Best regards
Uwe

#16 lore raw

cover rtc: rtc-isl12057: fixes and alarm support

In reply to Uwe Kleine-König

Hi,

Quoted 9 lines · Uwe Kleine-K?nig
Quoted 8 lines · Arnaud Ebalard

I wonder if you could take a look at this series I sent providing fixes (patches #1-5) and alarm support (patch #6) for ISL12057 RTC Chip. As all people do for RTC patches - due to lack of feedback from maintainer
- I am looking for someone to review the patches (Mark, patch 6 has a sticker w/ regmap-inside ;-)) and then push those upstream if they are ok (Jason, you handled that part for 70e123373c05: "rtc: Add support for Intersil ISL12057 I2C RTC chip" in 2013 for the same reason).

Quoted 7 lines
Quoted 6 lines

Note that I addressed previous comments and feedback received from Uwe and also spent time to do some soldering in order to support and test the last patch for both my use case (Alarm IRQ signal not routed to the SoC on ReadyNAS RN102, RN104 and RN2120) and the common case.

Do not hesitate to ask if you want me to resend!

akpm already applied the series, doesn't he?

I am not really familiar w/ -mm tree workflow. It was not clear to me whether it was sitting in -mm tree waiting for reviewed-by and acked-by.

Quoted 6 lines

I'm about to test the patches, just fighting with my NAS to boot my custom kernel.

Apart from that patches 1 - 5 can have my Ack. Didn't look deep enough into patch 6 yet. @akpm: No need to hurry adding them, I hope to be able to also provide Tested-by:-tags later today.

I'll be happy to handle comments and possible requests for additional changes if needed.

Cheers,

a+

ps: anyway, thanks Andrew!

#19 lore raw

cover rtc: rtc-isl12057: fixes and alarm support

In reply to Uwe Kleine-König
Quoted 17 lines · On Wed, 26 Nov 2014 19:48:54 +0100 Uwe Kleine-K__nig <[email protected]>…

Hello Arnaud,

Quoted 8 lines · Arnaud Ebalard

I wonder if you could take a look at this series I sent providing fixes (patches #1-5) and alarm support (patch #6) for ISL12057 RTC Chip. As all people do for RTC patches - due to lack of feedback from maintainer
- I am looking for someone to review the patches (Mark, patch 6 has a sticker w/ regmap-inside ;-)) and then push those upstream if they are ok (Jason, you handled that part for 70e123373c05: "rtc: Add support for Intersil ISL12057 I2C RTC chip" in 2013 for the same reason).

Quoted 6 lines

Note that I addressed previous comments and feedback received from Uwe and also spent time to do some soldering in order to support and test the last patch for both my use case (Alarm IRQ signal not routed to the SoC on ReadyNAS RN102, RN104 and RN2120) and the common case.

Do not hesitate to ask if you want me to resend!

Quoted 8 lines

akpm already applied the series, doesn't he?

I'm about to test the patches, just fighting with my NAS to boot my custom kernel.

Apart from that patches 1 - 5 can have my Ack. Didn't look deep enough into patch 6 yet. @akpm: No need to hurry adding them, I hope to be able to also provide Tested-by:-tags later today.

Thanks, it really helps.

#17 lore raw

cover rtc: rtc-isl12057: fixes and alarm support

In reply to Arnaud Ebalard
Quoted 18 lines · On Wed, 26 Nov 2014 20:28:53 +0100 arno at natisbad.org (Arnaud Ebalard) wrote:

Hi,

Quoted 14 lines · Uwe Kleine-K__nig
Quoted 13 lines · Arnaud Ebalard

I wonder if you could take a look at this series I sent providing fixes (patches #1-5) and alarm support (patch #6) for ISL12057 RTC Chip. As all people do for RTC patches - due to lack of feedback from maintainer
- I am looking for someone to review the patches (Mark, patch 6 has a sticker w/ regmap-inside ;-)) and then push those upstream if they are ok (Jason, you handled that part for 70e123373c05: "rtc: Add support for Intersil ISL12057 I2C RTC chip" in 2013 for the same reason).

Note that I addressed previous comments and feedback received from Uwe and also spent time to do some soldering in order to support and test the last patch for both my use case (Alarm IRQ signal not routed to the SoC on ReadyNAS RN102, RN104 and RN2120) and the common case.

Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Do not hesitate to ask if you want me to resend!

akpm already applied the series, doesn't he?

I am not really familiar w/ -mm tree workflow. It was not clear to me whether it was sitting in -mm tree waiting for reviewed-by and acked-by.

-mm is a collection of several hundred trees (most of which are empty at a particular time). The workflow depends on which tree we're talking about!

For RTC patches I attempt to review them myself but I'm by no means an expert on RTC, so I'm careful to cc various people who I think might help with review and test. Often people do this. Generally when they don't, the patches are sufficiently obvious for me to proceed under my own steam. If something breaks (this is rare), the number of people who are affected is usually quite small and they tend to be system developers who can fix it up for us anyway.

#18 lore raw

cover rtc: rtc-isl12057: fixes and alarm support

Hi Andrew,

Quoted 10 lines · Andrew Morton
Quoted 5 lines
Quoted 1 line

akpm already applied the series, doesn't he?

I am not really familiar w/ -mm tree workflow. It was not clear to me whether it was sitting in -mm tree waiting for reviewed-by and acked-by.

-mm is a collection of several hundred trees (most of which are empty at a particular time). The workflow depends on which tree we're talking about!

Quoted 7 lines

For RTC patches I attempt to review them myself but I'm by no means an expert on RTC, so I'm careful to cc various people who I think might help with review and test. Often people do this. Generally when they don't, the patches are sufficiently obvious for me to proceed under my own steam. If something breaks (this is rare), the number of people who are affected is usually quite small and they tend to be system developers who can fix it up for us anyway.

Thanks for the explanation.

Cheers,

a+

#9 lore raw

PATCH 6/6 rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver

In reply to Arnaud Ebalard

Hello,

finally I managed to test this series on my (unmodified) rn104.

For patch 1: Maybe point out that the issue with the century bit isn't that critical, because this bit is not expected to be set before year 2100.

For patch 3: This patch adds a few dev_err calls that get later amended in patch 5 to also include an error code. IMHO these should already be added in patch 3. Patch 5 should only add it to the already existing strings (if applicable).

For patch 4: Maybe
s/obsolete/for backwards compatibility, don't use in new code/.

Some further comments inline ...

Quoted 7 lines · Arnaud Ebalard

The latter is the one found on current 3 kernel users of the chip for which support was initially developed (Netgear ReadyNAS 102, 104 and 2120 NAS). On those devices, the IRQ#2 pin of the chip is not connected to the SoC but to a PMIC. This allows setting an alarm, powering off the device and have it wake up when the alarm rings. To support that configuration the driver does the following:

Quoted 5 lines

1. it has alarm_irq_enable() function returns -ENOTTY when no IRQ is passed to the driver.
2. it marks the device as a wakeup source in all cases (whether an IRQ is passed to the driver or not) to have 'wakealarm' sysfs entry created.

This is not pretty, but I don't know if there is a nicer alternative. Maybe this should only be done in the presence of a flag in the device tree (say: can-wakeup-machine, a prefix would be nice, but "isil," feels wrong).

Quoted 6 lines

[...]
FWIW, if someone is looking for a way to test alarm support on a system on which the chip IRQ line has the ability to boot the system (e.g. ReadyNAS 102, 104, etc):

    # echo 0 > /sys/class/rtc/rtc0/wakealarm

Why is this needed?

Quoted 4 lines
    # echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm
    # shutdown -h now

With the commandes above, after a minute, the system comes back to life.

s/commandes/commands/

drivers/rtc/rtc-isl12057.c static int isl12057_i2c_validate_chip(struct regmap *regmap) · line 191

Quoted 9 lines
drivers/rtc/rtc-isl12057.c +9 -0
+	ret = regmap_update_bits(data->regmap, ISL12057_REG_INT,
+				 ISL12057_REG_INT_A1IE,
+				 enable ? ISL12057_REG_INT_A1IE : 0);
+	if (ret)
+		dev_err(dev, "%s: changing alarm interrupt flag failed (%d)\n",
+			__func__, ret);
+
+	return ret;
+}

Maybe point out in the commit log that the first alarm (of two) is used, and the event is signaled on pin $Ididntlookitup.
(IIRC the 2nd alarm register set doesn't support seconds, but in return has year and month field.)

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 563

Quoted 7 lines

[...]

drivers/rtc/rtc-isl12057.c +6 -0
+	/*
+	 * This is needed to have 'wakealarm' sysfs entry available. One
+	 * would expect the device to be marked as a wakeup source only
+	 * when an IRQ pin of the RTC is routed to an interrupt line of the
+	 * CPU. In practice, such an IRQ pin can be connected to a PMIC and
+	 * this allows the device to be powered up when RTC alarm rings.

Maybe add the machines you know of that have this setup to the comment.

Quoted 16 lines
drivers/rtc/rtc-isl12057.c +16 -0
+	 */
+	device_init_wakeup(dev, true);
+
+	data->rtc = devm_rtc_device_register(dev, DRV_NAME, &rtc_ops,
+					     THIS_MODULE);
+	ret = PTR_ERR_OR_ZERO(data->rtc);
+	if (ret) {
+		dev_err(dev, "%s: unable to register RTC device (%d)\n",
+			__func__, ret);
+		goto err;
+	}
+
+	/* We cannot support UIE mode if we do not have an IRQ line */
+	if (!data->irq)
+		data->rtc->uie_unsupported = 1;
+

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 589

Quoted 10 lines
drivers/rtc/rtc-isl12057.c +8 -0
+err:
+	return ret;
 }
 
+static int isl12057_remove(struct i2c_client *client)
+{
+	struct isl12057_rtc_data *rtc_data = dev_get_drvdata(&client->dev);
+
+	if (rtc_data->irq > 0)
+		device_init_wakeup(&client->dev, false);

I didn't check, but I wonder it that could be/is done by the device core already?

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 600

Quoted 11 lines
drivers/rtc/rtc-isl12057.c +11 -0
+
+	return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int isl12057_rtc_suspend(struct device *dev)
+{
+	struct isl12057_rtc_data *rtc_data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		return enable_irq_wake(rtc_data->irq);

Does this need a check for data->irq?

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 610

Quoted 10 lines
drivers/rtc/rtc-isl12057.c +10 -0
+
+	return 0;
+}
+
+static int isl12057_rtc_resume(struct device *dev)
+{
+	struct isl12057_rtc_data *rtc_data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		return disable_irq_wake(rtc_data->irq);

ditto.

Thanks for your efforts to improve my NAS :-)
Uwe

#10 lore raw

PATCH 6/6 rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver

Hi Uwe,

Quoted 12 lines · Uwe Kleine-K?nig

Hello,

finally I managed to test this series on my (unmodified) rn104.

For patch 1: Maybe point out that the issue with the century bit isn't that critical, because this bit is not expected to be set before year 2100.

For patch 3: This patch adds a few dev_err calls that get later amended in patch 5 to also include an error code. IMHO these should already be added in patch 3. Patch 5 should only add it to the already existing strings (if applicable).

Quoted 4 lines

For patch 4: Maybe
s/obsolete/for backwards compatibility, don't use in new code/.

Some further comments inline ...

Thanks for the tests. I'll take a look at your comments this evening.

Cheers,

a+

#11 lore raw

PATCH 6/6 rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver

In reply to Uwe Kleine-König

Hi Uwe,

Quoted 5 lines · Uwe Kleine-K?nig

finally I managed to test this series on my (unmodified) rn104.

For patch 1: Maybe point out that the issue with the century bit isn't that critical, because this bit is not expected to be set before year 2100.

It has:

This was tested by putting a device 100 years in the future (using a specific kernel due to the inability of userland tools such as date or hwclock to pass year 2038), rebooting on a kernel w/ this patch applied and verifying the device was still 100 years in the future.

Quoted 4 lines

For patch 3: This patch adds a few dev_err calls that get later amended in patch 5 to also include an error code. IMHO these should already be added in patch 3. Patch 5 should only add it to the already existing strings (if applicable).

will do that next time.

Quoted 19 lines

For patch 4: Maybe
s/obsolete/for backwards compatibility, don't use in new code/.

Some further comments inline ...

Quoted 7 lines · Arnaud Ebalard

The latter is the one found on current 3 kernel users of the chip for which support was initially developed (Netgear ReadyNAS 102, 104 and 2120 NAS). On those devices, the IRQ#2 pin of the chip is not connected to the SoC but to a PMIC. This allows setting an alarm, powering off the device and have it wake up when the alarm rings. To support that configuration the driver does the following:

Quoted 5 lines

1. it has alarm_irq_enable() function returns -ENOTTY when no IRQ is passed to the driver.
2. it marks the device as a wakeup source in all cases (whether an IRQ is passed to the driver or not) to have 'wakealarm' sysfs entry created.

Quoted 4 lines

This is not pretty, but I don't know if there is a nicer alternative. Maybe this should only be done in the presence of a flag in the device tree (say: can-wakeup-machine, a prefix would be nice, but "isil," feels wrong).

I can prepare a v0 patch for a "can-wakeup-machine" property to mark the device as a wakeup source when the IRQ is absent. Will fix the prefix in a v1.

Quoted 7 lines
Quoted 6 lines

[...]
FWIW, if someone is looking for a way to test alarm support on a system on which the chip IRQ line has the ability to boot the system (e.g. ReadyNAS 102, 104, etc):

    # echo 0 > /sys/class/rtc/rtc0/wakealarm

Why is this needed?

It disable the alarm. It's not required.

Quoted 5 lines
Quoted 4 lines
    # echo `date '+%s' -d '+ 1 minutes'` > /sys/class/rtc/rtc0/wakealarm
    # shutdown -h now

With the commandes above, after a minute, the system comes back to life.

s/commandes/commands/

useless french letter.

Quoted 5 lines
Quoted 5 lines
drivers/rtc/rtc-isl12057.c +5 -0
+	ret = regmap_update_bits(data->regmap, ISL12057_REG_INT,
+				 ISL12057_REG_INT_A1IE,
+				 enable ? ISL12057_REG_INT_A1IE : 0);
+	if (ret)
+		dev_err(dev, "%s: changing alarm interrupt flag failed (%d)\n",
Quoted 8 lines

drivers/rtc/rtc-isl12057.c static int isl12057_i2c_validate_chip(struct regmap *regmap) · line 191

Quoted 4 lines
drivers/rtc/rtc-isl12057.c +4 -0
+			__func__, ret);
+
+	return ret;
+}

Maybe point out in the commit log that the first alarm (of two) is used, and the event is signaled on pin $Ididntlookitup.
(IIRC the 2nd alarm register set doesn't support seconds, but in return has year and month field.)

I can add that in the documentation.

Quoted 9 lines

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 563

Quoted 7 lines

[...]

drivers/rtc/rtc-isl12057.c +6 -0
+	/*
+	 * This is needed to have 'wakealarm' sysfs entry available. One
+	 * would expect the device to be marked as a wakeup source only
+	 * when an IRQ pin of the RTC is routed to an interrupt line of the
+	 * CPU. In practice, such an IRQ pin can be connected to a PMIC and
+	 * this allows the device to be powered up when RTC alarm rings.

Maybe add the machines you know of that have this setup to the comment.

ditto.

Quoted 41 lines
Quoted 16 lines
drivers/rtc/rtc-isl12057.c +16 -0
+	 */
+	device_init_wakeup(dev, true);
+
+	data->rtc = devm_rtc_device_register(dev, DRV_NAME, &rtc_ops,
+					     THIS_MODULE);
+	ret = PTR_ERR_OR_ZERO(data->rtc);
+	if (ret) {
+		dev_err(dev, "%s: unable to register RTC device (%d)\n",
+			__func__, ret);
+		goto err;
+	}
+
+	/* We cannot support UIE mode if we do not have an IRQ line */
+	if (!data->irq)
+		data->rtc->uie_unsupported = 1;
+

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 589

Quoted 10 lines
drivers/rtc/rtc-isl12057.c +8 -0
+err:
+	return ret;
 }
 
+static int isl12057_remove(struct i2c_client *client)
+{
+	struct isl12057_rtc_data *rtc_data = dev_get_drvdata(&client->dev);
+
+	if (rtc_data->irq > 0)
+		device_init_wakeup(&client->dev, false);

I didn't check, but I wonder it that could be/is done by the device core already?

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 600

Quoted 10 lines
drivers/rtc/rtc-isl12057.c +10 -0
+	return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int isl12057_rtc_suspend(struct device *dev)
+{
+	struct isl12057_rtc_data *rtc_data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		return enable_irq_wake(rtc_data->irq);

Does this need a check for data->irq?

Quoted 10 lines

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 610

Quoted 9 lines
drivers/rtc/rtc-isl12057.c +9 -0
+	return 0;
+}
+
+static int isl12057_rtc_resume(struct device *dev)
+{
+	struct isl12057_rtc_data *rtc_data = dev_get_drvdata(dev);
+
+	if (device_may_wakeup(dev))
+		return disable_irq_wake(rtc_data->irq);

ditto.

Hum, I will take a look at those irq vs wakeup cpabilities when adding support for "can-wakeup-machine" property to consolidate the behavior.

Cheers,

a+

#12 lore raw

PATCH 6/6 rtc: rtc-isl12057: add alarm support to Intersil ISL12057 RTC driver

Quoted 6 lines · arno at natisbad.org
Quoted 1 line · Uwe Kleine-K?nig

For patch 1: Maybe point out that the issue with the century bit

isn't

Quoted 2 lines

that critical, because this bit is not expected to be set before year 2100.

Quoted 7 lines

It has:

This was tested by putting a device 100 years in the future (using a
specific kernel due to the inability of userland tools such as date or hwclock to pass year 2038), rebooting on a kernel w/ this patch applied
and verifying the device was still 100 years in the future.

That describes your test, but it doesn't rule out that someone might use the century bit to distinguish 19** and 20**.

Best regards
Uwe

#5 lore raw

PATCH 4/6 rtc: rtc-isl12057: fix isil vs isl naming for intersil

In reply to Arnaud Ebalard
Quoted 50 lines · On Sat, 15 Nov 2014 00:07:05 +0100 Arnaud Ebalard <[email protected]> wrote:

When Intersil ISL12057 driver was introduced by commit 70e123373c05 ("rtc: Add support for Intersil ISL12057 I2C RTC chip"), the vendor prefix 'isl' was used instead of the expected 'isil' (Intersil NASDAQ symbol). Recently, a patch from Philip Zabel (7a6540ca856a, "ARM: mvebu: Change vendor prefix for Intersil Corporation to isil") fixed that prefix in ReadyNAS devices .dts files (AFAICT, the only users).

That patch completes that work to change the remaining values in:

- Intersil ISL12057 driver (compatible string) and also associated Documentation/devicetree/bindings/i2c/trivial-devices.txt file to reflect the changes introduced by previous commit from Philip
- Documentation/devicetree/bindings/vendor-prefixes.txt files to avoid future mistakes

...

Documentation/devicetree/bindings/i2c/trivial-devices.txt +1 -1
index fbde415078e6..edac97c0f756 100644
@@ -55,7 +55,7 @@ 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)
-isl,isl12057		Intersil ISL12057 I2C RTC Chip
+isil,isl12057		Intersil ISL12057 I2C RTC Chip
 maxim,ds1050		5 Bit Programmable, Pulse-Width Modulator
 maxim,max1237		Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
 maxim,max6625		9-Bit/12-Bit Temperature Sensors with I__C-Compatible Serial Interface
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -1
index 723999d73744..84193ecdc41c 100644
@@ -77,7 +77,7 @@ innolux	Innolux Corporation
 intel	Intel Corporation
 intercontrol	Inter Control Group
 isee	ISEE 2007 S.L.
-isl	Intersil
+isil	Intersil
 karo	Ka-Ro electronics GmbH
 keymile	Keymile GmbH
 lacie	LaCie
drivers/rtc/rtc-isl12057.c +0 -0
index fe562820a54a..31eaa6a9c2b2 100644

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 317

Quoted 9 lines
drivers/rtc/rtc-isl12057.c +2 -1
@@ -310,7 +310,8 @@ static int isl12057_probe(struct i2c_client *client,
 
 #ifdef CONFIG_OF
 static const struct of_device_id isl12057_dt_match[] = {
-	{ .compatible = "isl,isl12057" },
+	{ .compatible = "isl,isl12057" },  /* obsolete */
+	{ .compatible = "isil,isl12057" },
 	{ },
 };
 #endif

Your patch conflicts both textually and materially with the two below patches, which are now upstream.

I don't know what to do about this so I'll drop "rtc: rtc-isl12057: fix isil vs isl naming for intersil". Could you folks please sort this all out?

commit 7c75c1d5e72be6736aa558efd33ca2b31d77e425

Author:     Darshana Padmadas <[email protected]>
AuthorDate: Sat Nov 8 22:52:06 2014 +0530
Commit:     Arnd Bergmann <[email protected]>
CommitDate: Thu Nov 20 12:20:18 2014 +0100

dt-bindings: Document deprecated device vendor name to fix related warning

This patch documents deprecated vendor name "isil" to fix warning of undocumented string for device isl29028 as reported while running checkpatch.pl on drivers/staging/iio/light/isl29028.c. This is done to maintain compatibility with older kernels.

Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 723999d..bfbd93e 100644
@@ -77,6 +77,7 @@ innolux	Innolux Corporation
 intel	Intel Corporation
 intercontrol	Inter Control Group
 isee	ISEE 2007 S.L.
+isil    Intersil (deprecated, use isl)
 isl	Intersil
 karo	Ka-Ro electronics GmbH
 keymile	Keymile GmbH

commit b2ea3f82e7984d855c5e61fef18746771d90c73c

Author:     Darshana Padmadas <[email protected]>
AuthorDate: Sat Nov 8 22:52:05 2014 +0530
Commit:     Arnd Bergmann <[email protected]>
CommitDate: Thu Nov 20 12:19:59 2014 +0100

dt-bindings: Document correct and deprecated vendor-prefix with device isl29028

This patch documents the device isl29028 with its vendor-prefix. Undocumented deprecated vendor-prefix found by checkpatch also documented for compatibility reasons.

Documentation/devicetree/bindings/i2c/trivial-devices.txt +2 -0
index fbde415..605dcca 100644
@@ -56,6 +56,8 @@ gmt,g751		G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire In
 infineon,slb9635tt	Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
 infineon,slb9645tt	Infineon SLB9645 I2C TPM (new protocol, max 400khz)
 isl,isl12057		Intersil ISL12057 I2C RTC Chip
+isil,isl29028           (deprecated, use isl)
+isl,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
 maxim,max6625		9-Bit/12-Bit Temperature Sensors with I?C-Compatible Serial Interface
#6 lore raw

PATCH 4/6 rtc: rtc-isl12057: fix isil vs isl naming for intersil

Hi Arnd and Darshana,

Sorry for somehow top-posting, but let me provide some context to what follows. While pushing a set of patches for ISL 12057 RTC chip, I tried and continue what had been started by Philip Zabel (7a6540ca856a, "ARM: mvebu: Change vendor prefix for Intersil Corporation to isil") in one of the patches (see below) by switching the vendor prefix for Intersil from isl to isil. This specific patch was handled by Andrew via his -mm tree and now conflicts with what you pushed upstream.

I do not have a strong advice on what is better and will follow what you decide by providing an updated patch to Andrew but:

- your changes somehow revert what has been done by philip
- three .dts files (those updated by Philip for isil) now have a deprecated prefix
- we now have both isil and isl in vendor-prefixes.txt
- FWIW, isil is the nasdaq symbol

Cheers,

a+

Quoted 132 lines · Andrew Morton
Quoted 50 lines · On Sat, 15 Nov 2014 00:07:05 +0100 Arnaud Ebalard <[email protected]> wrote:

When Intersil ISL12057 driver was introduced by commit 70e123373c05 ("rtc: Add support for Intersil ISL12057 I2C RTC chip"), the vendor prefix 'isl' was used instead of the expected 'isil' (Intersil NASDAQ symbol). Recently, a patch from Philip Zabel (7a6540ca856a, "ARM: mvebu: Change vendor prefix for Intersil Corporation to isil") fixed that prefix in ReadyNAS devices .dts files (AFAICT, the only users).

That patch completes that work to change the remaining values in:

- Intersil ISL12057 driver (compatible string) and also associated Documentation/devicetree/bindings/i2c/trivial-devices.txt file to reflect the changes introduced by previous commit from Philip
- Documentation/devicetree/bindings/vendor-prefixes.txt files to avoid future mistakes

...

Documentation/devicetree/bindings/i2c/trivial-devices.txt +1 -1
index fbde415078e6..edac97c0f756 100644
@@ -55,7 +55,7 @@ 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)
-isl,isl12057		Intersil ISL12057 I2C RTC Chip
+isil,isl12057		Intersil ISL12057 I2C RTC Chip
 maxim,ds1050		5 Bit Programmable, Pulse-Width Modulator
 maxim,max1237		Low-Power, 4-/12-Channel, 2-Wire Serial, 12-Bit ADCs
 maxim,max6625		9-Bit/12-Bit Temperature Sensors with I__C-Compatible Serial Interface
Documentation/devicetree/bindings/vendor-prefixes.txt +1 -1
index 723999d73744..84193ecdc41c 100644
@@ -77,7 +77,7 @@ innolux	Innolux Corporation
 intel	Intel Corporation
 intercontrol	Inter Control Group
 isee	ISEE 2007 S.L.
-isl	Intersil
+isil	Intersil
 karo	Ka-Ro electronics GmbH
 keymile	Keymile GmbH
 lacie	LaCie
drivers/rtc/rtc-isl12057.c +0 -0
index fe562820a54a..31eaa6a9c2b2 100644

drivers/rtc/rtc-isl12057.c static int isl12057_probe(struct i2c_client *client, · line 317

Quoted 9 lines
drivers/rtc/rtc-isl12057.c +2 -1
@@ -310,7 +310,8 @@ static int isl12057_probe(struct i2c_client *client,
 
 #ifdef CONFIG_OF
 static const struct of_device_id isl12057_dt_match[] = {
-	{ .compatible = "isl,isl12057" },
+	{ .compatible = "isl,isl12057" },  /* obsolete */
+	{ .compatible = "isil,isl12057" },
 	{ },
 };
 #endif

Your patch conflicts both textually and materially with the two below patches, which are now upstream.

I don't know what to do about this so I'll drop "rtc: rtc-isl12057: fix isil vs isl naming for intersil". Could you folks please sort this all out?

commit 7c75c1d5e72be6736aa558efd33ca2b31d77e425

Author:     Darshana Padmadas <[email protected]>
AuthorDate: Sat Nov 8 22:52:06 2014 +0530
Commit:     Arnd Bergmann <[email protected]>
CommitDate: Thu Nov 20 12:20:18 2014 +0100

dt-bindings: Document deprecated device vendor name to fix related warning

This patch documents deprecated vendor name "isil" to fix warning of undocumented string for device isl29028 as reported while running checkpatch.pl on drivers/staging/iio/light/isl29028.c. This is done to maintain compatibility with older kernels.

Documentation/devicetree/bindings/vendor-prefixes.txt +1 -0
index 723999d..bfbd93e 100644
@@ -77,6 +77,7 @@ innolux	Innolux Corporation
 intel	Intel Corporation
 intercontrol	Inter Control Group
 isee	ISEE 2007 S.L.
+isil    Intersil (deprecated, use isl)
 isl	Intersil
 karo	Ka-Ro electronics GmbH
 keymile	Keymile GmbH

commit b2ea3f82e7984d855c5e61fef18746771d90c73c

Author:     Darshana Padmadas <[email protected]>
AuthorDate: Sat Nov 8 22:52:05 2014 +0530
Commit:     Arnd Bergmann <[email protected]>
CommitDate: Thu Nov 20 12:19:59 2014 +0100

dt-bindings: Document correct and deprecated vendor-prefix with device isl29028

This patch documents the device isl29028 with its vendor-prefix. Undocumented deprecated vendor-prefix found by checkpatch also documented for compatibility reasons.

Documentation/devicetree/bindings/i2c/trivial-devices.txt +2 -0
index fbde415..605dcca 100644
@@ -56,6 +56,8 @@ gmt,g751		G751: Digital Temperature Sensor and Thermal Watchdog with Two-Wire In
 infineon,slb9635tt	Infineon SLB9635 (Soft-) I2C TPM (old protocol, max 100khz)
 infineon,slb9645tt	Infineon SLB9645 I2C TPM (new protocol, max 400khz)
 isl,isl12057		Intersil ISL12057 I2C RTC Chip
+isil,isl29028           (deprecated, use isl)
+isl,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
 maxim,max6625		9-Bit/12-Bit Temperature Sensors with I?C-Compatible Serial Interface