linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Add device tree support to ISL12022 driver
@ 2014-07-16  2:28 Stuart Longland
  2014-07-16  2:28 ` [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support Stuart Longland
  0 siblings, 1 reply; 8+ messages in thread
From: Stuart Longland @ 2014-07-16  2:28 UTC (permalink / raw)
  To: Roman Fietze; +Cc: linux-kernel, devicetree

Hi all,

The attached patch adds support for configuring the ISL12022 real-time clock
via the Device tree framework.  This is based on what I've seen in the related
ISL12057 driver, it has been tested and works on a Technologic Systems TS-7670
device which uses a ISL12020 RTC device, my device tree looks like this:

	apbx@80040000 {
		i2c0: i2c@80058000 {
			pinctrl-names = "default";
			pinctrl-0 = <&i2c0_pins_a>;
			clock-frequency = <400000>;
			status = "okay";

			isl12022@0x6f {
				compatible = "isl,isl12022";
				reg = <0x6f>;
			};
		};
		... etc
	};

Regards,
Stuart Longland


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support
  2014-07-16  2:28 Add device tree support to ISL12022 driver Stuart Longland
@ 2014-07-16  2:28 ` Stuart Longland
  2014-07-16  8:59   ` Mark Rutland
  2014-07-21 23:25   ` [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: Stuart Longland @ 2014-07-16  2:28 UTC (permalink / raw)
  To: Roman Fietze; +Cc: linux-kernel, devicetree, Stuart Longland

Add some support for configuring isl12020/isl12022 devices using the
Device Tree blob.

Signed-off-by: Stuart Longland <stuartl@vrt.com.au>
---
 drivers/rtc/rtc-isl12022.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c
index 03b8911..aa55f08 100644
--- a/drivers/rtc/rtc-isl12022.c
+++ b/drivers/rtc/rtc-isl12022.c
@@ -17,6 +17,8 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #define DRV_VERSION "0.1"
 
@@ -271,6 +273,13 @@ static int isl12022_probe(struct i2c_client *client,
 	return PTR_ERR_OR_ZERO(isl12022->rtc);
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id isl12022_dt_match[] = {
+	{ .compatible = "isl,isl12022" },
+	{ },
+};
+#endif
+
 static const struct i2c_device_id isl12022_id[] = {
 	{ "isl12022", 0 },
 	{ }
@@ -280,6 +289,9 @@ MODULE_DEVICE_TABLE(i2c, isl12022_id);
 static struct i2c_driver isl12022_driver = {
 	.driver		= {
 		.name	= "rtc-isl12022",
+#ifdef CONFIG_OF
+		.of_match_table = of_match_ptr(isl12022_dt_match),
+#endif
 	},
 	.probe		= isl12022_probe,
 	.id_table	= isl12022_id,
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support
  2014-07-16  2:28 ` [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support Stuart Longland
@ 2014-07-16  8:59   ` Mark Rutland
  2014-07-16  9:35     ` Stuart Longland
  2014-07-16 21:31     ` [REVISED PATCH] " Stuart Longland
  2014-07-21 23:25   ` [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support Andrew Morton
  1 sibling, 2 replies; 8+ messages in thread
From: Mark Rutland @ 2014-07-16  8:59 UTC (permalink / raw)
  To: Stuart Longland; +Cc: Roman Fietze, linux-kernel, devicetree

On Wed, Jul 16, 2014 at 03:28:25AM +0100, Stuart Longland wrote:
> Add some support for configuring isl12020/isl12022 devices using the
> Device Tree blob.
> 
> Signed-off-by: Stuart Longland <stuartl@vrt.com.au>

Please document this as with isl,isl12057, in
Documentation/devicetree/bindings/i2c/trivial-devices.txt

The string itself looks fine.

> ---
>  drivers/rtc/rtc-isl12022.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c
> index 03b8911..aa55f08 100644
> --- a/drivers/rtc/rtc-isl12022.c
> +++ b/drivers/rtc/rtc-isl12022.c
> @@ -17,6 +17,8 @@
>  #include <linux/slab.h>
>  #include <linux/module.h>
>  #include <linux/err.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
>  
>  #define DRV_VERSION "0.1"
>  
> @@ -271,6 +273,13 @@ static int isl12022_probe(struct i2c_client *client,
>  	return PTR_ERR_OR_ZERO(isl12022->rtc);
>  }
>  
> +#ifdef CONFIG_OF
> +static struct of_device_id isl12022_dt_match[] = {
> +	{ .compatible = "isl,isl12022" },
> +	{ },
> +};
> +#endif
> +
>  static const struct i2c_device_id isl12022_id[] = {
>  	{ "isl12022", 0 },
>  	{ }
> @@ -280,6 +289,9 @@ MODULE_DEVICE_TABLE(i2c, isl12022_id);
>  static struct i2c_driver isl12022_driver = {
>  	.driver		= {
>  		.name	= "rtc-isl12022",
> +#ifdef CONFIG_OF
> +		.of_match_table = of_match_ptr(isl12022_dt_match),
> +#endif

You can drop the ifdef here, of_match_ptr(x) is NULL if !CONFIG_OF.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support
  2014-07-16  8:59   ` Mark Rutland
@ 2014-07-16  9:35     ` Stuart Longland
  2014-07-16 21:31     ` [REVISED PATCH] " Stuart Longland
  1 sibling, 0 replies; 8+ messages in thread
From: Stuart Longland @ 2014-07-16  9:35 UTC (permalink / raw)
  To: Mark Rutland; +Cc: Roman Fietze, linux-kernel, devicetree

Hi Mark,
On 16/07/14 18:59, Mark Rutland wrote:
> On Wed, Jul 16, 2014 at 03:28:25AM +0100, Stuart Longland wrote:
>> Add some support for configuring isl12020/isl12022 devices using the
>> Device Tree blob.
>>
>> Signed-off-by: Stuart Longland <stuartl@vrt.com.au>
> 
> Please document this as with isl,isl12057, in
> Documentation/devicetree/bindings/i2c/trivial-devices.txt
> 
> The string itself looks fine.

No problems.  I'll do this shortly.

>> +#ifdef CONFIG_OF
>> +		.of_match_table = of_match_ptr(isl12022_dt_match),
>> +#endif
> 
> You can drop the ifdef here, of_match_ptr(x) is NULL if !CONFIG_OF.

Ahh okay, I wasn't sure how of_match_ptr worked, so I thought I'd play
it safe.  A revised patch is coming right up.

Regards,
-- 
Stuart Longland
Systems Engineer
     _ ___
\  /|_) |                           T: +61 7 3535 9619
 \/ | \ |     38b Douglas Street    F: +61 7 3535 9699
   SYSTEMS    Milton QLD 4064       http://www.vrt.com.au



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [REVISED PATCH] drivers/rtc/rtc-isl12022.c: Device tree support
  2014-07-16  8:59   ` Mark Rutland
  2014-07-16  9:35     ` Stuart Longland
@ 2014-07-16 21:31     ` Stuart Longland
  2014-07-16 21:31       ` [PATCH 1/2] " Stuart Longland
  2014-07-16 21:31       ` [PATCH 2/2] devicetree: Document binding for isl12022 driver Stuart Longland
  1 sibling, 2 replies; 8+ messages in thread
From: Stuart Longland @ 2014-07-16 21:31 UTC (permalink / raw)
  To: Roman Fietze; +Cc: linux-kernel, devicetree, Mark Rutland

The following patches are the revised set, incorporating Mark Rutland's
feedback.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] drivers/rtc/rtc-isl12022.c: Device tree support
  2014-07-16 21:31     ` [REVISED PATCH] " Stuart Longland
@ 2014-07-16 21:31       ` Stuart Longland
  2014-07-16 21:31       ` [PATCH 2/2] devicetree: Document binding for isl12022 driver Stuart Longland
  1 sibling, 0 replies; 8+ messages in thread
From: Stuart Longland @ 2014-07-16 21:31 UTC (permalink / raw)
  To: Roman Fietze; +Cc: linux-kernel, devicetree, Mark Rutland, Stuart Longland

Add some support for configuring isl12020/isl12022 devices using the
Device Tree blob.

Signed-off-by: Stuart Longland <stuartl@vrt.com.au>
---
 drivers/rtc/rtc-isl12022.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c
index 03b8911..59b0ea2 100644
--- a/drivers/rtc/rtc-isl12022.c
+++ b/drivers/rtc/rtc-isl12022.c
@@ -17,6 +17,8 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/err.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 
 #define DRV_VERSION "0.1"
 
@@ -271,6 +273,13 @@ static int isl12022_probe(struct i2c_client *client,
 	return PTR_ERR_OR_ZERO(isl12022->rtc);
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id isl12022_dt_match[] = {
+	{ .compatible = "isl,isl12022" },
+	{ },
+};
+#endif
+
 static const struct i2c_device_id isl12022_id[] = {
 	{ "isl12022", 0 },
 	{ }
@@ -280,6 +289,7 @@ MODULE_DEVICE_TABLE(i2c, isl12022_id);
 static struct i2c_driver isl12022_driver = {
 	.driver		= {
 		.name	= "rtc-isl12022",
+		.of_match_table = of_match_ptr(isl12022_dt_match),
 	},
 	.probe		= isl12022_probe,
 	.id_table	= isl12022_id,
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] devicetree: Document binding for isl12022 driver
  2014-07-16 21:31     ` [REVISED PATCH] " Stuart Longland
  2014-07-16 21:31       ` [PATCH 1/2] " Stuart Longland
@ 2014-07-16 21:31       ` Stuart Longland
  1 sibling, 0 replies; 8+ messages in thread
From: Stuart Longland @ 2014-07-16 21:31 UTC (permalink / raw)
  To: Roman Fietze; +Cc: linux-kernel, devicetree, Mark Rutland, Stuart Longland

Signed-off-by: Stuart Longland <stuartl@vrt.com.au>
---
 Documentation/devicetree/bindings/i2c/trivial-devices.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
index bef86e5..17e24e5 100644
--- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt
+++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt
@@ -55,6 +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,isl12022		Intersil ISL12020/ISL12022 I2C RTC Chip
 isl,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
-- 
1.8.5.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support
  2014-07-16  2:28 ` [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support Stuart Longland
  2014-07-16  8:59   ` Mark Rutland
@ 2014-07-21 23:25   ` Andrew Morton
  1 sibling, 0 replies; 8+ messages in thread
From: Andrew Morton @ 2014-07-21 23:25 UTC (permalink / raw)
  To: Stuart Longland; +Cc: Roman Fietze, linux-kernel, devicetree

On Wed, 16 Jul 2014 12:28:25 +1000 Stuart Longland <stuartl@vrt.com.au> wrote:

> Add some support for configuring isl12020/isl12022 devices using the
> Device Tree blob.

checkpatch said

WARNING: DT compatible string "isl,isl12022" appears un-documented -- check ./Documentation/devicetree/bindings/
#50: FILE: drivers/rtc/rtc-isl12022.c:278:
+       { .compatible = "isl,isl12022" },

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-21 23:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-16  2:28 Add device tree support to ISL12022 driver Stuart Longland
2014-07-16  2:28 ` [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support Stuart Longland
2014-07-16  8:59   ` Mark Rutland
2014-07-16  9:35     ` Stuart Longland
2014-07-16 21:31     ` [REVISED PATCH] " Stuart Longland
2014-07-16 21:31       ` [PATCH 1/2] " Stuart Longland
2014-07-16 21:31       ` [PATCH 2/2] devicetree: Document binding for isl12022 driver Stuart Longland
2014-07-21 23:25   ` [PATCH] drivers/rtc/rtc-isl12022.c: Device tree support Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).