projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'fix/hda' into topic/hda
[firefly-linux-kernel-4.4.55.git]
/
drivers
/
rtc
/
rtc-s35390a.c
diff --git
a/drivers/rtc/rtc-s35390a.c
b/drivers/rtc/rtc-s35390a.c
index e8abc90c32c5fe0e82938ad7d4b711807a8c7779..def4d396d0b096cef968a5572f2b5122d92eeb33 100644
(file)
--- a/
drivers/rtc/rtc-s35390a.c
+++ b/
drivers/rtc/rtc-s35390a.c
@@
-34,6
+34,12
@@
#define S35390A_FLAG_RESET 0x80
#define S35390A_FLAG_TEST 0x01
#define S35390A_FLAG_RESET 0x80
#define S35390A_FLAG_TEST 0x01
+static const struct i2c_device_id s35390a_id[] = {
+ { "s35390a", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, s35390a_id);
+
struct s35390a {
struct i2c_client *client[8];
struct rtc_device *rtc;
struct s35390a {
struct i2c_client *client[8];
struct rtc_device *rtc;
@@
-98,12
+104,12
@@
static int s35390a_disable_test_mode(struct s35390a *s35390a)
static char s35390a_hr2reg(struct s35390a *s35390a, int hour)
{
if (s35390a->twentyfourhour)
static char s35390a_hr2reg(struct s35390a *s35390a, int hour)
{
if (s35390a->twentyfourhour)
- return
BIN2BCD
(hour);
+ return
bin2bcd
(hour);
if (hour < 12)
if (hour < 12)
- return
BIN2BCD
(hour);
+ return
bin2bcd
(hour);
- return 0x40 |
BIN2BCD
(hour - 12);
+ return 0x40 |
bin2bcd
(hour - 12);
}
static int s35390a_reg2hr(struct s35390a *s35390a, char reg)
}
static int s35390a_reg2hr(struct s35390a *s35390a, char reg)
@@
-111,9
+117,9
@@
static int s35390a_reg2hr(struct s35390a *s35390a, char reg)
unsigned hour;
if (s35390a->twentyfourhour)
unsigned hour;
if (s35390a->twentyfourhour)
- return
BCD2BIN
(reg & 0x3f);
+ return
bcd2bin
(reg & 0x3f);
- hour =
BCD2BIN
(reg & 0x3f);
+ hour =
bcd2bin
(reg & 0x3f);
if (reg & 0x40)
hour += 12;
if (reg & 0x40)
hour += 12;
@@
-131,13
+137,13
@@
static int s35390a_set_datetime(struct i2c_client *client, struct rtc_time *tm)
tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year,
tm->tm_wday);
tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year,
tm->tm_wday);
- buf[S35390A_BYTE_YEAR] =
BIN2BCD
(tm->tm_year - 100);
- buf[S35390A_BYTE_MONTH] =
BIN2BCD
(tm->tm_mon + 1);
- buf[S35390A_BYTE_DAY] =
BIN2BCD
(tm->tm_mday);
- buf[S35390A_BYTE_WDAY] =
BIN2BCD
(tm->tm_wday);
+ buf[S35390A_BYTE_YEAR] =
bin2bcd
(tm->tm_year - 100);
+ buf[S35390A_BYTE_MONTH] =
bin2bcd
(tm->tm_mon + 1);
+ buf[S35390A_BYTE_DAY] =
bin2bcd
(tm->tm_mday);
+ buf[S35390A_BYTE_WDAY] =
bin2bcd
(tm->tm_wday);
buf[S35390A_BYTE_HOURS] = s35390a_hr2reg(s35390a, tm->tm_hour);
buf[S35390A_BYTE_HOURS] = s35390a_hr2reg(s35390a, tm->tm_hour);
- buf[S35390A_BYTE_MINS] =
BIN2BCD
(tm->tm_min);
- buf[S35390A_BYTE_SECS] =
BIN2BCD
(tm->tm_sec);
+ buf[S35390A_BYTE_MINS] =
bin2bcd
(tm->tm_min);
+ buf[S35390A_BYTE_SECS] =
bin2bcd
(tm->tm_sec);
/* This chip expects the bits of each byte to be in reverse order */
for (i = 0; i < 7; ++i)
/* This chip expects the bits of each byte to be in reverse order */
for (i = 0; i < 7; ++i)
@@
-162,13
+168,13
@@
static int s35390a_get_datetime(struct i2c_client *client, struct rtc_time *tm)
for (i = 0; i < 7; ++i)
buf[i] = bitrev8(buf[i]);
for (i = 0; i < 7; ++i)
buf[i] = bitrev8(buf[i]);
- tm->tm_sec =
BCD2BIN
(buf[S35390A_BYTE_SECS]);
- tm->tm_min =
BCD2BIN
(buf[S35390A_BYTE_MINS]);
+ tm->tm_sec =
bcd2bin
(buf[S35390A_BYTE_SECS]);
+ tm->tm_min =
bcd2bin
(buf[S35390A_BYTE_MINS]);
tm->tm_hour = s35390a_reg2hr(s35390a, buf[S35390A_BYTE_HOURS]);
tm->tm_hour = s35390a_reg2hr(s35390a, buf[S35390A_BYTE_HOURS]);
- tm->tm_wday =
BCD2BIN
(buf[S35390A_BYTE_WDAY]);
- tm->tm_mday =
BCD2BIN
(buf[S35390A_BYTE_DAY]);
- tm->tm_mon =
BCD2BIN
(buf[S35390A_BYTE_MONTH]) - 1;
- tm->tm_year =
BCD2BIN
(buf[S35390A_BYTE_YEAR]) + 100;
+ tm->tm_wday =
bcd2bin
(buf[S35390A_BYTE_WDAY]);
+ tm->tm_mday =
bcd2bin
(buf[S35390A_BYTE_DAY]);
+ tm->tm_mon =
bcd2bin
(buf[S35390A_BYTE_MONTH]) - 1;
+ tm->tm_year =
bcd2bin
(buf[S35390A_BYTE_YEAR]) + 100;
dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, mday=%d, "
"mon=%d, year=%d, wday=%d\n", __func__, tm->tm_sec,
dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, mday=%d, "
"mon=%d, year=%d, wday=%d\n", __func__, tm->tm_sec,
@@
-195,7
+201,8
@@
static const struct rtc_class_ops s35390a_rtc_ops = {
static struct i2c_driver s35390a_driver;
static struct i2c_driver s35390a_driver;
-static int s35390a_probe(struct i2c_client *client)
+static int s35390a_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
{
int err;
unsigned int i;
{
int err;
unsigned int i;
@@
-220,7
+227,7
@@
static int s35390a_probe(struct i2c_client *client)
/* This chip uses multiple addresses, use dummy devices for them */
for (i = 1; i < 8; ++i) {
s35390a->client[i] = i2c_new_dummy(client->adapter,
/* This chip uses multiple addresses, use dummy devices for them */
for (i = 1; i < 8; ++i) {
s35390a->client[i] = i2c_new_dummy(client->adapter,
- client->addr + i
, "rtc-s35390a"
);
+ client->addr + i);
if (!s35390a->client[i]) {
dev_err(&client->dev, "Address %02x unavailable\n",
client->addr + i);
if (!s35390a->client[i]) {
dev_err(&client->dev, "Address %02x unavailable\n",
client->addr + i);
@@
-296,6
+303,7
@@
static struct i2c_driver s35390a_driver = {
},
.probe = s35390a_probe,
.remove = s35390a_remove,
},
.probe = s35390a_probe,
.remove = s35390a_remove,
+ .id_table = s35390a_id,
};
static int __init s35390a_rtc_init(void)
};
static int __init s35390a_rtc_init(void)