Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers/rtc/rtc-isl12022.c: device tree support

Add 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
};

Signed-off-by: Stuart Longland <stuartl@vrt.com.au>
Cc: Roman Fietze <roman.fietze@telemotive.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Stuart Longland and committed by
Linus Torvalds
db04d628 ede3e9d4

+12
+12
drivers/rtc/rtc-isl12022.c
··· 17 17 #include <linux/slab.h> 18 18 #include <linux/module.h> 19 19 #include <linux/err.h> 20 + #include <linux/of.h> 21 + #include <linux/of_device.h> 20 22 21 23 #define DRV_VERSION "0.1" 22 24 ··· 273 271 return PTR_ERR_OR_ZERO(isl12022->rtc); 274 272 } 275 273 274 + #ifdef CONFIG_OF 275 + static struct of_device_id isl12022_dt_match[] = { 276 + { .compatible = "isl,isl12022" }, 277 + { }, 278 + }; 279 + #endif 280 + 276 281 static const struct i2c_device_id isl12022_id[] = { 277 282 { "isl12022", 0 }, 278 283 { } ··· 289 280 static struct i2c_driver isl12022_driver = { 290 281 .driver = { 291 282 .name = "rtc-isl12022", 283 + #ifdef CONFIG_OF 284 + .of_match_table = of_match_ptr(isl12022_dt_match), 285 + #endif 292 286 }, 293 287 .probe = isl12022_probe, 294 288 .id_table = isl12022_id,