rtc-max6900.c (c1f3ee120bb61045b1c0a3ead620d1d65af47130) rtc-max6900.c (2a4e2b8780c6df42b19c053243dada7fa4d311ee)
1/*
2 * rtc class driver for the Maxim MAX6900 chip
3 *
4 * Author: Dale Farnsworth <dale@farnsworth.org>
5 *
6 * based on previously existing rtc class drivers
7 *
8 * 2007 (c) MontaVista, Software, Inc. This file is licensed under

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

93 .buf = &buf[MAX6900_REG_CENTURY]
94 }
95 };
96 int rc;
97
98 rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
99 if (rc != ARRAY_SIZE(msgs)) {
100 dev_err(&client->dev, "%s: register read failed\n",
1/*
2 * rtc class driver for the Maxim MAX6900 chip
3 *
4 * Author: Dale Farnsworth <dale@farnsworth.org>
5 *
6 * based on previously existing rtc class drivers
7 *
8 * 2007 (c) MontaVista, Software, Inc. This file is licensed under

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

93 .buf = &buf[MAX6900_REG_CENTURY]
94 }
95 };
96 int rc;
97
98 rc = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
99 if (rc != ARRAY_SIZE(msgs)) {
100 dev_err(&client->dev, "%s: register read failed\n",
101 __FUNCTION__);
101 __func__);
102 return -EIO;
103 }
104 return 0;
105}
106
107static int max6900_i2c_write_regs(struct i2c_client *client, u8 const *buf)
108{
109 u8 i2c_century_buf[1 + 1] = { MAX6900_REG_CENTURY_WRITE };

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

145 if (rc != ARRAY_SIZE(burst_msgs))
146 goto write_failed;
147 msleep(MAX6900_IDLE_TIME_AFTER_WRITE);
148
149 return 0;
150
151write_failed:
152 dev_err(&client->dev, "%s: register write failed\n",
102 return -EIO;
103 }
104 return 0;
105}
106
107static int max6900_i2c_write_regs(struct i2c_client *client, u8 const *buf)
108{
109 u8 i2c_century_buf[1 + 1] = { MAX6900_REG_CENTURY_WRITE };

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

145 if (rc != ARRAY_SIZE(burst_msgs))
146 goto write_failed;
147 msleep(MAX6900_IDLE_TIME_AFTER_WRITE);
148
149 return 0;
150
151write_failed:
152 dev_err(&client->dev, "%s: register write failed\n",
153 __FUNCTION__);
153 __func__);
154 return -EIO;
155}
156
157static int max6900_i2c_validate_client(struct i2c_client *client)
158{
159 u8 regs[MAX6900_REG_LEN];
160 u8 zero_mask[] = {
161 0x80, /* seconds */

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

209}
210
211static int max6900_i2c_clear_write_protect(struct i2c_client *client)
212{
213 int rc;
214 rc = i2c_smbus_write_byte_data (client, MAX6900_REG_CONTROL_WRITE, 0);
215 if (rc < 0) {
216 dev_err(&client->dev, "%s: control register write failed\n",
154 return -EIO;
155}
156
157static int max6900_i2c_validate_client(struct i2c_client *client)
158{
159 u8 regs[MAX6900_REG_LEN];
160 u8 zero_mask[] = {
161 0x80, /* seconds */

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

209}
210
211static int max6900_i2c_clear_write_protect(struct i2c_client *client)
212{
213 int rc;
214 rc = i2c_smbus_write_byte_data (client, MAX6900_REG_CONTROL_WRITE, 0);
215 if (rc < 0) {
216 dev_err(&client->dev, "%s: control register write failed\n",
217 __FUNCTION__);
217 __func__);
218 return -EIO;
219 }
220 return 0;
221}
222
223static int max6900_i2c_set_time(struct i2c_client *client,
224 struct rtc_time const *tm)
225{

--- 134 unchanged lines hidden ---
218 return -EIO;
219 }
220 return 0;
221}
222
223static int max6900_i2c_set_time(struct i2c_client *client,
224 struct rtc_time const *tm)
225{

--- 134 unchanged lines hidden ---