#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#define DS1390_REG_100THS 0x00
#define DS1390_REG_SECONDS 0x01
#define DS1390_REG_MINUTES 0x02
#define DS1390_REG_HOURS 0x03
#define DS1390_REG_DAY 0x04
#define DS1390_REG_DATE 0x05
#define DS1390_REG_MONTH_CENT 0x06
#define DS1390_REG_YEAR 0x07
#define DS1390_REG_ALARM_100THS 0x08
#define DS1390_REG_ALARM_SECONDS 0x09
#define DS1390_REG_ALARM_MINUTES 0x0A
#define DS1390_REG_ALARM_HOURS 0x0B
#define DS1390_REG_ALARM_DAY_DATE 0x0C
#define DS1390_REG_CONTROL 0x0D
#define DS1390_REG_STATUS 0x0E
#define DS1390_REG_TRICKLE 0x0F
#define DS1390_TRICKLE_CHARGER_ENABLE 0xA0
#define DS1390_TRICKLE_CHARGER_250_OHM 0x01
#define DS1390_TRICKLE_CHARGER_2K_OHM 0x02
#define DS1390_TRICKLE_CHARGER_4K_OHM 0x03
#define DS1390_TRICKLE_CHARGER_NO_DIODE 0x04
#define DS1390_TRICKLE_CHARGER_DIODE 0x08
static void ds1390_set_reg(struct device *dev, unsigned char address,
struct spi_device *spi = to_spi_device(dev);
static int ds1390_get_reg(struct device *dev, unsigned char address,
struct spi_device *spi = to_spi_device(dev);
struct ds1390 *chip = dev_get_drvdata(dev);
chip->txrx_buf[0] = address & 0x7f;
status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 1);
*data = chip->txrx_buf[0];
static void ds1390_trickle_of_init(struct spi_device *spi)