rtc-ds1672.c (59458f40e25915a355d8b1d701425fe9f4f9ea23) rtc-ds1672.c (11966adc33fa1504c2d9a78e6fc129e5c87bdee1)
1/*
2 * An rtc/i2c driver for the Dallas DS1672
3 * Copyright 2005-06 Tower Technologies
4 *
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 41 unchanged lines hidden (view full) ---

50
51 /* read date registers */
52 if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
53 dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
54 return -EIO;
55 }
56
57 dev_dbg(&client->dev,
1/*
2 * An rtc/i2c driver for the Dallas DS1672
3 * Copyright 2005-06 Tower Technologies
4 *
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as

--- 41 unchanged lines hidden (view full) ---

50
51 /* read date registers */
52 if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
53 dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
54 return -EIO;
55 }
56
57 dev_dbg(&client->dev,
58 "%s: raw read data - counters=%02x,%02x,%02x,%02x\n"
58 "%s: raw read data - counters=%02x,%02x,%02x,%02x\n",
59 __FUNCTION__, buf[0], buf[1], buf[2], buf[3]);
60
61 time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
62
63 rtc_time_to_tm(time, tm);
64
65 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
66 "mday=%d, mon=%d, year=%d, wday=%d\n",

--- 24 unchanged lines hidden (view full) ---

91 return 0;
92}
93
94static int ds1672_set_datetime(struct i2c_client *client, struct rtc_time *tm)
95{
96 unsigned long secs;
97
98 dev_dbg(&client->dev,
59 __FUNCTION__, buf[0], buf[1], buf[2], buf[3]);
60
61 time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
62
63 rtc_time_to_tm(time, tm);
64
65 dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
66 "mday=%d, mon=%d, year=%d, wday=%d\n",

--- 24 unchanged lines hidden (view full) ---

91 return 0;
92}
93
94static int ds1672_set_datetime(struct i2c_client *client, struct rtc_time *tm)
95{
96 unsigned long secs;
97
98 dev_dbg(&client->dev,
99 "%s: secs=%d, mins=%d, hours=%d, ",
99 "%s: secs=%d, mins=%d, hours=%d, "
100 "mday=%d, mon=%d, year=%d, wday=%d\n",
101 __FUNCTION__,
102 tm->tm_sec, tm->tm_min, tm->tm_hour,
103 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
104
105 rtc_tm_to_time(tm, &secs);
106
107 return ds1672_set_mmss(client, secs);

--- 170 unchanged lines hidden ---
100 "mday=%d, mon=%d, year=%d, wday=%d\n",
101 __FUNCTION__,
102 tm->tm_sec, tm->tm_min, tm->tm_hour,
103 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
104
105 rtc_tm_to_time(tm, &secs);
106
107 return ds1672_set_mmss(client, secs);

--- 170 unchanged lines hidden ---