rtc-ds3232.c (f01387d2693813eb5271a3448e6a082322c7d75d) rtc-ds3232.c (a737e835e5769ef22897179ed7f82b1fc50bfa58)
1/*
2 * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C
3 *
4 * Copyright (C) 2009-2011 Freescale Semiconductor.
5 * Author: Jack Lan <jack.lan@freescale.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12/*
13 * It would be more efficient to use i2c msgs/i2c_transfer directly but, as
14 * recommened in .../Documentation/i2c/writing-clients section
15 * "Sending and receiving", using SMBus level communication is preferred.
16 */
17
1/*
2 * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C
3 *
4 * Copyright (C) 2009-2011 Freescale Semiconductor.
5 * Author: Jack Lan <jack.lan@freescale.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12/*
13 * It would be more efficient to use i2c msgs/i2c_transfer directly but, as
14 * recommened in .../Documentation/i2c/writing-clients section
15 * "Sending and receiving", using SMBus level communication is preferred.
16 */
17
18#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
19
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/interrupt.h>
21#include <linux/i2c.h>
22#include <linux/rtc.h>
23#include <linux/bcd.h>
24#include <linux/workqueue.h>
25#include <linux/slab.h>

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

368
369 stat = i2c_smbus_read_byte_data(client, DS3232_REG_SR);
370 if (stat < 0)
371 goto unlock;
372
373 if (stat & DS3232_REG_SR_A1F) {
374 control = i2c_smbus_read_byte_data(client, DS3232_REG_CR);
375 if (control < 0) {
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/interrupt.h>
23#include <linux/i2c.h>
24#include <linux/rtc.h>
25#include <linux/bcd.h>
26#include <linux/workqueue.h>
27#include <linux/slab.h>

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

370
371 stat = i2c_smbus_read_byte_data(client, DS3232_REG_SR);
372 if (stat < 0)
373 goto unlock;
374
375 if (stat & DS3232_REG_SR_A1F) {
376 control = i2c_smbus_read_byte_data(client, DS3232_REG_CR);
377 if (control < 0) {
376 pr_warn("Read DS3232 Control Register error."
377 "Disable IRQ%d.\n", client->irq);
378 pr_warn("Read Control Register error - Disable IRQ%d\n",
379 client->irq);
378 } else {
379 /* disable alarm1 interrupt */
380 control &= ~(DS3232_REG_CR_A1IE);
381 i2c_smbus_write_byte_data(client, DS3232_REG_CR,
382 control);
383
384 /* clear the alarm pend flag */
385 stat &= ~DS3232_REG_SR_A1F;

--- 128 unchanged lines hidden ---
380 } else {
381 /* disable alarm1 interrupt */
382 control &= ~(DS3232_REG_CR_A1IE);
383 i2c_smbus_write_byte_data(client, DS3232_REG_CR,
384 control);
385
386 /* clear the alarm pend flag */
387 stat &= ~DS3232_REG_SR_A1F;

--- 128 unchanged lines hidden ---