diff for duplicates of <41FFE9EE.3000504@mvista.com> diff --git a/a/1.txt b/N1/1.txt index 35f4400..ca29bd5 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -101,283 +101,3 @@ Mark Signed-off-by: Mark A. Greer <mgreer@mvista.com> -- --------------- next part -------------- -diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig ---- a/drivers/i2c/chips/Kconfig 2005-02-01 13:37:08 -07:00 -+++ b/drivers/i2c/chips/Kconfig 2005-02-01 13:37:08 -07:00 -@@ -371,4 +371,13 @@ - This driver can also be built as a module. If so, the module - will be called isp1301_omap. - -+config SENSORS_M41T00 -+ tristate "ST M41T00 RTC chip" -+ depends on I2C && PPC32 -+ help -+ If you say yes here you get support for the ST M41T00 RTC chip. -+ -+ This driver can also be built as a module. If so, the module -+ will be called m41t00. -+ - endmenu -diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile ---- a/drivers/i2c/chips/Makefile 2005-02-01 13:37:08 -07:00 -+++ b/drivers/i2c/chips/Makefile 2005-02-01 13:37:08 -07:00 -@@ -26,6 +26,7 @@ - obj-$(CONFIG_SENSORS_LM87) += lm87.o - obj-$(CONFIG_SENSORS_LM90) += lm90.o - obj-$(CONFIG_SENSORS_MAX1619) += max1619.o -+obj-$(CONFIG_SENSORS_M41T00) += m41t00.o - obj-$(CONFIG_SENSORS_PC87360) += pc87360.o - obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o - obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o -diff -Nru a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c ---- /dev/null Wed Dec 31 16:00:00 196900 -+++ b/drivers/i2c/chips/m41t00.c 2005-02-01 13:37:08 -07:00 -@@ -0,0 +1,247 @@ -+/* -+ * drivers/i2c/chips/m41t00.c -+ * -+ * I2C client/driver for the ST M41T00 Real-Time Clock chip. -+ * -+ * Author: Mark A. Greer <mgreer@mvista.com> -+ * -+ * 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. -+ */ -+/* -+ * This i2c client/driver wedges between the drivers/char/genrtc.c RTC -+ * interface and the SMBus interface of the i2c subsystem. -+ * It would be more efficient to use i2c msgs/i2c_transfer directly but, as -+ * recommened in .../Documentation/i2c/writing-clients section -+ * "Sending and receiving", using SMBus level communication is preferred. -+ */ -+ -+#include <linux/kernel.h> -+#include <linux/module.h> -+#include <linux/interrupt.h> -+#include <linux/i2c.h> -+#include <linux/rtc.h> -+#include <linux/bcd.h> -+ -+#include <asm/time.h> -+#include <asm/rtc.h> -+ -+#define M41T00_DRV_NAME "m41t00" -+ -+static DECLARE_MUTEX(m41t00_mutex); -+ -+static struct i2c_driver m41t00_driver; -+static struct i2c_client *save_client; -+ -+static unsigned short ignore[] = { I2C_CLIENT_END }; -+static unsigned short normal_addr[] = { 0x68, I2C_CLIENT_END }; -+ -+static struct i2c_client_address_data addr_data = { -+ .normal_i2c = normal_addr, -+ .normal_i2c_range = ignore, -+ .probe = ignore, -+ .probe_range = ignore, -+ .ignore = ignore, -+ .ignore_range = ignore, -+ .force = ignore, -+}; -+ -+ulong -+m41t00_get_rtc_time(void) -+{ -+ s32 sec, min, hour, day, mon, year; -+ s32 sec1, min1, hour1, day1, mon1, year1; -+ ulong limit = 10; -+ -+ sec = min = hour = day = mon = year = 0; -+ sec1 = min1 = hour1 = day1 = mon1 = year1 = 0; -+ -+ down(&m41t00_mutex); -+ do { -+ if (((sec = i2c_smbus_read_byte_data(save_client, 0)) >= 0) -+ && ((min = i2c_smbus_read_byte_data(save_client, 1)) -+ >= 0) -+ && ((hour = i2c_smbus_read_byte_data(save_client, 2)) -+ >= 0) -+ && ((day = i2c_smbus_read_byte_data(save_client, 4)) -+ >= 0) -+ && ((mon = i2c_smbus_read_byte_data(save_client, 5)) -+ >= 0) -+ && ((year = i2c_smbus_read_byte_data(save_client, 6)) -+ >= 0) -+ && ((sec = sec1) && (min = min1) && (hour = hour1) -+ && (day = day1) && (mon = mon1) -+ && (year = year1))) -+ -+ break; -+ -+ sec1 = sec; -+ min1 = min; -+ hour1 = hour; -+ day1 = day; -+ mon1 = mon; -+ year1 = year; -+ } while (--limit > 0); -+ up(&m41t00_mutex); -+ -+ if (limit = 0) { -+ dev_warn(&save_client->dev, -+ "m41t00: can't read rtc chip\n"); -+ sec = min = hour = day = mon = year = 0; -+ } -+ -+ sec &= 0x7f; -+ min &= 0x7f; -+ hour &= 0x3f; -+ day &= 0x3f; -+ mon &= 0x1f; -+ year &= 0xff; -+ -+ BCD_TO_BIN(sec); -+ BCD_TO_BIN(min); -+ BCD_TO_BIN(hour); -+ BCD_TO_BIN(day); -+ BCD_TO_BIN(mon); -+ BCD_TO_BIN(year); -+ -+ year += 1900; -+ if (year < 1970) -+ year += 100; -+ -+ return mktime(year, mon, day, hour, min, sec); -+} -+ -+static void -+m41t00_set_tlet(ulong arg) -+{ -+ struct rtc_time tm; -+ ulong nowtime = *(ulong *)arg; -+ -+ to_tm(nowtime, &tm); -+ tm.tm_year = (tm.tm_year - 1900) % 100; -+ -+ BIN_TO_BCD(tm.tm_sec); -+ BIN_TO_BCD(tm.tm_min); -+ BIN_TO_BCD(tm.tm_hour); -+ BIN_TO_BCD(tm.tm_mon); -+ BIN_TO_BCD(tm.tm_mday); -+ BIN_TO_BCD(tm.tm_year); -+ -+ down(&m41t00_mutex); -+ if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0) -+ || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f) -+ < 0) -+ || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f) -+ < 0) -+ || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f) -+ < 0) -+ || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f) -+ < 0) -+ || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f) -+ < 0)) -+ -+ dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n"); -+ -+ up(&m41t00_mutex); -+ return; -+} -+ -+ulong new_time; -+ -+DECLARE_TASKLET_DISABLED(m41t00_tasklet, m41t00_set_tlet, (ulong)&new_time); -+ -+int -+m41t00_set_rtc_time(ulong nowtime) -+{ -+ new_time = nowtime; -+ -+ if (in_interrupt()) -+ tasklet_schedule(&m41t00_tasklet); -+ else -+ m41t00_set_tlet((ulong)&new_time); -+ -+ return 0; -+} -+ -+/* -+ ***************************************************************************** -+ * -+ * Driver Interface -+ * -+ ***************************************************************************** -+ */ -+static int -+m41t00_probe(struct i2c_adapter *adap, int addr, int kind) -+{ -+ struct i2c_client *client; -+ int rc; -+ -+ client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); -+ if (!client) -+ return -ENOMEM; -+ -+ memset(client, 0, sizeof(struct i2c_client)); -+ strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE); -+ client->id = m41t00_driver.id; -+ client->flags = I2C_DF_NOTIFY; -+ client->addr = addr; -+ client->adapter = adap; -+ client->driver = &m41t00_driver; -+ -+ if ((rc = i2c_attach_client(client)) != 0) { -+ kfree(client); -+ return rc; -+ } -+ -+ save_client = client; -+ return 0; -+} -+ -+static int -+m41t00_attach(struct i2c_adapter *adap) -+{ -+ return i2c_probe(adap, &addr_data, m41t00_probe); -+} -+ -+static int -+m41t00_detach(struct i2c_client *client) -+{ -+ int rc; -+ -+ if ((rc = i2c_detach_client(client)) = 0) { -+ kfree(i2c_get_clientdata(client)); -+ tasklet_kill(&m41t00_tasklet); -+ } -+ return rc; -+} -+ -+static struct i2c_driver m41t00_driver = { -+ .owner = THIS_MODULE, -+ .name = M41T00_DRV_NAME, -+ .id = I2C_DRIVERID_STM41T00, -+ .flags = I2C_DF_NOTIFY, -+ .attach_adapter = m41t00_attach, -+ .detach_client = m41t00_detach, -+}; -+ -+static int __init -+m41t00_init(void) -+{ -+ return i2c_add_driver(&m41t00_driver); -+} -+ -+static void __exit -+m41t00_exit(void) -+{ -+ i2c_del_driver(&m41t00_driver); -+ return; -+} -+ -+module_init(m41t00_init); -+module_exit(m41t00_exit); -+ -+MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>"); -+MODULE_DESCRIPTION("ST Microelectronics M41T00 RTC I2C Client Driver"); -+MODULE_LICENSE("GPL"); diff --git a/N1/2.hdr b/N1/2.hdr new file mode 100644 index 0000000..7800135 --- /dev/null +++ b/N1/2.hdr @@ -0,0 +1,5 @@ +Content-Type: text/plain; + name="m41t00_2.patch" +Content-Transfer-Encoding: 7bit +Content-Disposition: inline; + filename="m41t00_2.patch" diff --git a/N1/2.txt b/N1/2.txt new file mode 100644 index 0000000..76c7131 --- /dev/null +++ b/N1/2.txt @@ -0,0 +1,279 @@ +diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig +--- a/drivers/i2c/chips/Kconfig 2005-02-01 13:37:08 -07:00 ++++ b/drivers/i2c/chips/Kconfig 2005-02-01 13:37:08 -07:00 +@@ -371,4 +371,13 @@ + This driver can also be built as a module. If so, the module + will be called isp1301_omap. + ++config SENSORS_M41T00 ++ tristate "ST M41T00 RTC chip" ++ depends on I2C && PPC32 ++ help ++ If you say yes here you get support for the ST M41T00 RTC chip. ++ ++ This driver can also be built as a module. If so, the module ++ will be called m41t00. ++ + endmenu +diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile +--- a/drivers/i2c/chips/Makefile 2005-02-01 13:37:08 -07:00 ++++ b/drivers/i2c/chips/Makefile 2005-02-01 13:37:08 -07:00 +@@ -26,6 +26,7 @@ + obj-$(CONFIG_SENSORS_LM87) += lm87.o + obj-$(CONFIG_SENSORS_LM90) += lm90.o + obj-$(CONFIG_SENSORS_MAX1619) += max1619.o ++obj-$(CONFIG_SENSORS_M41T00) += m41t00.o + obj-$(CONFIG_SENSORS_PC87360) += pc87360.o + obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o + obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o +diff -Nru a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c +--- /dev/null Wed Dec 31 16:00:00 196900 ++++ b/drivers/i2c/chips/m41t00.c 2005-02-01 13:37:08 -07:00 +@@ -0,0 +1,247 @@ ++/* ++ * drivers/i2c/chips/m41t00.c ++ * ++ * I2C client/driver for the ST M41T00 Real-Time Clock chip. ++ * ++ * Author: Mark A. Greer <mgreer@mvista.com> ++ * ++ * 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. ++ */ ++/* ++ * This i2c client/driver wedges between the drivers/char/genrtc.c RTC ++ * interface and the SMBus interface of the i2c subsystem. ++ * It would be more efficient to use i2c msgs/i2c_transfer directly but, as ++ * recommened in .../Documentation/i2c/writing-clients section ++ * "Sending and receiving", using SMBus level communication is preferred. ++ */ ++ ++#include <linux/kernel.h> ++#include <linux/module.h> ++#include <linux/interrupt.h> ++#include <linux/i2c.h> ++#include <linux/rtc.h> ++#include <linux/bcd.h> ++ ++#include <asm/time.h> ++#include <asm/rtc.h> ++ ++#define M41T00_DRV_NAME "m41t00" ++ ++static DECLARE_MUTEX(m41t00_mutex); ++ ++static struct i2c_driver m41t00_driver; ++static struct i2c_client *save_client; ++ ++static unsigned short ignore[] = { I2C_CLIENT_END }; ++static unsigned short normal_addr[] = { 0x68, I2C_CLIENT_END }; ++ ++static struct i2c_client_address_data addr_data = { ++ .normal_i2c = normal_addr, ++ .normal_i2c_range = ignore, ++ .probe = ignore, ++ .probe_range = ignore, ++ .ignore = ignore, ++ .ignore_range = ignore, ++ .force = ignore, ++}; ++ ++ulong ++m41t00_get_rtc_time(void) ++{ ++ s32 sec, min, hour, day, mon, year; ++ s32 sec1, min1, hour1, day1, mon1, year1; ++ ulong limit = 10; ++ ++ sec = min = hour = day = mon = year = 0; ++ sec1 = min1 = hour1 = day1 = mon1 = year1 = 0; ++ ++ down(&m41t00_mutex); ++ do { ++ if (((sec = i2c_smbus_read_byte_data(save_client, 0)) >= 0) ++ && ((min = i2c_smbus_read_byte_data(save_client, 1)) ++ >= 0) ++ && ((hour = i2c_smbus_read_byte_data(save_client, 2)) ++ >= 0) ++ && ((day = i2c_smbus_read_byte_data(save_client, 4)) ++ >= 0) ++ && ((mon = i2c_smbus_read_byte_data(save_client, 5)) ++ >= 0) ++ && ((year = i2c_smbus_read_byte_data(save_client, 6)) ++ >= 0) ++ && ((sec == sec1) && (min == min1) && (hour == hour1) ++ && (day == day1) && (mon == mon1) ++ && (year == year1))) ++ ++ break; ++ ++ sec1 = sec; ++ min1 = min; ++ hour1 = hour; ++ day1 = day; ++ mon1 = mon; ++ year1 = year; ++ } while (--limit > 0); ++ up(&m41t00_mutex); ++ ++ if (limit == 0) { ++ dev_warn(&save_client->dev, ++ "m41t00: can't read rtc chip\n"); ++ sec = min = hour = day = mon = year = 0; ++ } ++ ++ sec &= 0x7f; ++ min &= 0x7f; ++ hour &= 0x3f; ++ day &= 0x3f; ++ mon &= 0x1f; ++ year &= 0xff; ++ ++ BCD_TO_BIN(sec); ++ BCD_TO_BIN(min); ++ BCD_TO_BIN(hour); ++ BCD_TO_BIN(day); ++ BCD_TO_BIN(mon); ++ BCD_TO_BIN(year); ++ ++ year += 1900; ++ if (year < 1970) ++ year += 100; ++ ++ return mktime(year, mon, day, hour, min, sec); ++} ++ ++static void ++m41t00_set_tlet(ulong arg) ++{ ++ struct rtc_time tm; ++ ulong nowtime = *(ulong *)arg; ++ ++ to_tm(nowtime, &tm); ++ tm.tm_year = (tm.tm_year - 1900) % 100; ++ ++ BIN_TO_BCD(tm.tm_sec); ++ BIN_TO_BCD(tm.tm_min); ++ BIN_TO_BCD(tm.tm_hour); ++ BIN_TO_BCD(tm.tm_mon); ++ BIN_TO_BCD(tm.tm_mday); ++ BIN_TO_BCD(tm.tm_year); ++ ++ down(&m41t00_mutex); ++ if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0) ++ || (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f) ++ < 0) ++ || (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f) ++ < 0) ++ || (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f) ++ < 0) ++ || (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f) ++ < 0) ++ || (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f) ++ < 0)) ++ ++ dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n"); ++ ++ up(&m41t00_mutex); ++ return; ++} ++ ++ulong new_time; ++ ++DECLARE_TASKLET_DISABLED(m41t00_tasklet, m41t00_set_tlet, (ulong)&new_time); ++ ++int ++m41t00_set_rtc_time(ulong nowtime) ++{ ++ new_time = nowtime; ++ ++ if (in_interrupt()) ++ tasklet_schedule(&m41t00_tasklet); ++ else ++ m41t00_set_tlet((ulong)&new_time); ++ ++ return 0; ++} ++ ++/* ++ ***************************************************************************** ++ * ++ * Driver Interface ++ * ++ ***************************************************************************** ++ */ ++static int ++m41t00_probe(struct i2c_adapter *adap, int addr, int kind) ++{ ++ struct i2c_client *client; ++ int rc; ++ ++ client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); ++ if (!client) ++ return -ENOMEM; ++ ++ memset(client, 0, sizeof(struct i2c_client)); ++ strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE); ++ client->id = m41t00_driver.id; ++ client->flags = I2C_DF_NOTIFY; ++ client->addr = addr; ++ client->adapter = adap; ++ client->driver = &m41t00_driver; ++ ++ if ((rc = i2c_attach_client(client)) != 0) { ++ kfree(client); ++ return rc; ++ } ++ ++ save_client = client; ++ return 0; ++} ++ ++static int ++m41t00_attach(struct i2c_adapter *adap) ++{ ++ return i2c_probe(adap, &addr_data, m41t00_probe); ++} ++ ++static int ++m41t00_detach(struct i2c_client *client) ++{ ++ int rc; ++ ++ if ((rc = i2c_detach_client(client)) == 0) { ++ kfree(i2c_get_clientdata(client)); ++ tasklet_kill(&m41t00_tasklet); ++ } ++ return rc; ++} ++ ++static struct i2c_driver m41t00_driver = { ++ .owner = THIS_MODULE, ++ .name = M41T00_DRV_NAME, ++ .id = I2C_DRIVERID_STM41T00, ++ .flags = I2C_DF_NOTIFY, ++ .attach_adapter = m41t00_attach, ++ .detach_client = m41t00_detach, ++}; ++ ++static int __init ++m41t00_init(void) ++{ ++ return i2c_add_driver(&m41t00_driver); ++} ++ ++static void __exit ++m41t00_exit(void) ++{ ++ i2c_del_driver(&m41t00_driver); ++ return; ++} ++ ++module_init(m41t00_init); ++module_exit(m41t00_exit); ++ ++MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>"); ++MODULE_DESCRIPTION("ST Microelectronics M41T00 RTC I2C Client Driver"); ++MODULE_LICENSE("GPL"); diff --git a/a/content_digest b/N1/content_digest index bb033a0..7903ea3 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,12 +1,12 @@ "ref\041FE7368.1000307@mvista.com\0" "ref\020050131210319.44a69d49.khali@linux-fr.org\0" - "From\0mgreer@mvista.com (Mark A. Greer)\0" - "Subject\0[PATCH][I2C] ST M41T00 I2C RTC chip driver\0" - "Date\0Thu, 19 May 2005 06:25:35 +0000\0" + "From\0Mark A. Greer <mgreer@mvista.com>\0" + "Subject\0Re: [PATCH][I2C] ST M41T00 I2C RTC chip driver\0" + "Date\0Tue, 01 Feb 2005 13:43:26 -0700\0" "To\0LM Sensors <sensors@stimpy.netroedge.com>" " LKML <linux-kernel@vger.kernel.org>\0" "Cc\0Greg KH <greg@kroah.com>\0" - "\00:1\0" + "\01:1\0" "b\0" "Thank you for your comments, Jean.\n" "\n" @@ -110,8 +110,10 @@ "Mark\n" "\n" "Signed-off-by: Mark A. Greer <mgreer@mvista.com>\n" - "--\n" - "-------------- next part --------------\n" + -- + "\01:2\0" + "fn\0m41t00_2.patch\0" + "b\0" "diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig\n" "--- a/drivers/i2c/chips/Kconfig\t2005-02-01 13:37:08 -07:00\n" "+++ b/drivers/i2c/chips/Kconfig\t2005-02-01 13:37:08 -07:00\n" @@ -217,9 +219,9 @@ "+\t\t\t\t>= 0)\n" "+\t\t\t&& ((year = i2c_smbus_read_byte_data(save_client, 6))\n" "+\t\t\t\t>= 0)\n" - "+\t\t\t&& ((sec = sec1) && (min = min1) && (hour = hour1)\n" - "+\t\t\t\t&& (day = day1) && (mon = mon1)\n" - "+\t\t\t\t&& (year = year1)))\n" + "+\t\t\t&& ((sec == sec1) && (min == min1) && (hour == hour1)\n" + "+\t\t\t\t&& (day == day1) && (mon == mon1)\n" + "+\t\t\t\t&& (year == year1)))\n" "+\n" "+\t\t\t\tbreak;\n" "+\n" @@ -232,7 +234,7 @@ "+\t} while (--limit > 0);\n" "+\tup(&m41t00_mutex);\n" "+\n" - "+\tif (limit = 0) {\n" + "+\tif (limit == 0) {\n" "+\t\tdev_warn(&save_client->dev,\n" "+\t\t\t\"m41t00: can't read rtc chip\\n\");\n" "+\t\tsec = min = hour = day = mon = year = 0;\n" @@ -356,7 +358,7 @@ "+{\n" "+\tint\trc;\n" "+\n" - "+\tif ((rc = i2c_detach_client(client)) = 0) {\n" + "+\tif ((rc = i2c_detach_client(client)) == 0) {\n" "+\t\tkfree(i2c_get_clientdata(client));\n" "+\t\ttasklet_kill(&m41t00_tasklet);\n" "+\t}\n" @@ -392,4 +394,4 @@ "+MODULE_DESCRIPTION(\"ST Microelectronics M41T00 RTC I2C Client Driver\");\n" "+MODULE_LICENSE(\"GPL\");" -a0885fcd98933f2d931b898e61863706d002f1b552fe5d3dc88b6c2389bf5d51 +60d760d877d031e73f5bd25d544ed5e838917967d998030b17701532f721f61f
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.