rtc-ac100.c (bba73071b6f71be0a101658d7c13866e30b264a6) rtc-ac100.c (22652ba72453d35c8a637d5c0f06b3dc29ff9eb0)
1/*
2 * RTC Driver for X-Powers AC100
3 *
4 * Copyright (c) 2016 Chen-Yu Tsai
5 *
6 * Chen-Yu Tsai <wens@csie.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

382 rtc_tm->tm_min = bcd2bin(reg[1] & AC100_RTC_MIN_MASK);
383 rtc_tm->tm_hour = bcd2bin(reg[2] & AC100_RTC_HOU_MASK);
384 rtc_tm->tm_wday = bcd2bin(reg[3] & AC100_RTC_WEE_MASK);
385 rtc_tm->tm_mday = bcd2bin(reg[4] & AC100_RTC_DAY_MASK);
386 rtc_tm->tm_mon = bcd2bin(reg[5] & AC100_RTC_MON_MASK) - 1;
387 rtc_tm->tm_year = bcd2bin(reg[6] & AC100_RTC_YEA_MASK) +
388 AC100_YEAR_OFF;
389
1/*
2 * RTC Driver for X-Powers AC100
3 *
4 * Copyright (c) 2016 Chen-Yu Tsai
5 *
6 * Chen-Yu Tsai <wens@csie.org>
7 *
8 * This program is free software; you can redistribute it and/or modify

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

382 rtc_tm->tm_min = bcd2bin(reg[1] & AC100_RTC_MIN_MASK);
383 rtc_tm->tm_hour = bcd2bin(reg[2] & AC100_RTC_HOU_MASK);
384 rtc_tm->tm_wday = bcd2bin(reg[3] & AC100_RTC_WEE_MASK);
385 rtc_tm->tm_mday = bcd2bin(reg[4] & AC100_RTC_DAY_MASK);
386 rtc_tm->tm_mon = bcd2bin(reg[5] & AC100_RTC_MON_MASK) - 1;
387 rtc_tm->tm_year = bcd2bin(reg[6] & AC100_RTC_YEA_MASK) +
388 AC100_YEAR_OFF;
389
390 return rtc_valid_tm(rtc_tm);
390 return 0;
391}
392
393static int ac100_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
394{
395 struct ac100_rtc_dev *chip = dev_get_drvdata(dev);
396 struct regmap *regmap = chip->regmap;
397 int year;
398 u16 reg[8];

--- 241 unchanged lines hidden ---
391}
392
393static int ac100_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
394{
395 struct ac100_rtc_dev *chip = dev_get_drvdata(dev);
396 struct regmap *regmap = chip->regmap;
397 int year;
398 u16 reg[8];

--- 241 unchanged lines hidden ---