Source
static int bq32k_write(struct device *dev, void *data, uint8_t off, uint8_t len)
/*
* Driver for TI BQ32000 RTC.
*
* Copyright (C) 2009 Semihalf.
* Copyright (C) 2014 Pavel Machek <pavel@denx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* You can get hardware description at
* http://www.ti.com/lit/ds/symlink/bq32000.pdf
*/
/* Seconds register address */
/* Mask over seconds value */
/* Oscillator Stop flat */
/* Minutes register address */
/* Mask over minutes value */
/* Oscillator Failure flag */
/* Mask over hours value */
/* Century flag */
/* Century flag enable bit */
/* CAL_CFG1, calibration and control */
/* Trickle charge enable */
/* Trickle charger control */
/* Trickle charge FET bypass */
/* Maximum number of consecutive
* register for this particular RTC.
*/
struct bq32k_regs {
uint8_t seconds;
uint8_t minutes;
uint8_t cent_hours;
uint8_t day;
uint8_t date;
uint8_t month;
uint8_t years;
};
static struct i2c_driver bq32k_driver;
static int bq32k_read(struct device *dev, void *data, uint8_t off, uint8_t len)
{
struct i2c_client *client = to_i2c_client(dev);
struct i2c_msg msgs[] = {
{
.addr = client->addr,
.flags = 0,
.len = 1,
.buf = &off,