aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-pcf8563.c58
1 files changed, 0 insertions, 58 deletions
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 748a502a6355..a829f20ad6d6 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -179,58 +179,6 @@ struct pcf8563_limit
179 unsigned char max; 179 unsigned char max;
180}; 180};
181 181
182static int pcf8563_validate_client(struct i2c_client *client)
183{
184 int i;
185
186 static const struct pcf8563_limit pattern[] = {
187 /* register, mask, min, max */
188 { PCF8563_REG_SC, 0x7F, 0, 59 },
189 { PCF8563_REG_MN, 0x7F, 0, 59 },
190 { PCF8563_REG_HR, 0x3F, 0, 23 },
191 { PCF8563_REG_DM, 0x3F, 0, 31 },
192 { PCF8563_REG_MO, 0x1F, 0, 12 },
193 };
194
195 /* check limits (only registers with bcd values) */
196 for (i = 0; i < ARRAY_SIZE(pattern); i++) {
197 int xfer;
198 unsigned char value;
199 unsigned char buf = pattern[i].reg;
200
201 struct i2c_msg msgs[] = {
202 { client->addr, 0, 1, &buf },
203 { client->addr, I2C_M_RD, 1, &buf },
204 };
205
206 xfer = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
207
208 if (xfer != ARRAY_SIZE(msgs)) {
209 dev_err(&client->dev,
210 "%s: could not read register 0x%02X\n",
211 __func__, pattern[i].reg);
212
213 return -EIO;
214 }
215
216 value = BCD2BIN(buf & pattern[i].mask);
217
218 if (value > pattern[i].max ||
219 value < pattern[i].min) {
220 dev_dbg(&client->dev,
221 "%s: pattern=%d, reg=%x, mask=0x%02x, min=%d, "
222 "max=%d, value=%d, raw=0x%02X\n",
223 __func__, i, pattern[i].reg, pattern[i].mask,
224 pattern[i].min, pattern[i].max,
225 value, buf);
226
227 return -ENODEV;
228 }
229 }
230
231 return 0;
232}
233
234static int pcf8563_rtc_read_time(struct device *dev, struct rtc_time *tm) 182static int pcf8563_rtc_read_time(struct device *dev, struct rtc_time *tm)
235{ 183{
236 return pcf8563_get_datetime(to_i2c_client(dev), tm); 184 return pcf8563_get_datetime(to_i2c_client(dev), tm);
@@ -262,12 +210,6 @@ static int pcf8563_probe(struct i2c_client *client,
262 if (!pcf8563) 210 if (!pcf8563)
263 return -ENOMEM; 211 return -ENOMEM;
264 212
265 /* Verify the chip is really an PCF8563 */
266 if (pcf8563_validate_client(client) < 0) {
267 err = -ENODEV;
268 goto exit_kfree;
269 }
270
271 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n"); 213 dev_info(&client->dev, "chip found, driver version " DRV_VERSION "\n");
272 214
273 pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name, 215 pcf8563->rtc = rtc_device_register(pcf8563_driver.driver.name,