rtc-max8997.c (4ba24fef3eb3b142197135223b90ced2f319cd53) | rtc-max8997.c (a737e835e5769ef22897179ed7f82b1fc50bfa58) |
---|---|
1/* 2 * RTC driver for Maxim MAX8997 3 * 4 * Copyright (C) 2013 Samsung Electronics Co.Ltd 5 * 6 * based on rtc-max8998.c 7 * 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License as published by the 10 * Free Software Foundation; either version 2 of the License, or (at your 11 * option) any later version. 12 * 13 */ 14 | 1/* 2 * RTC driver for Maxim MAX8997 3 * 4 * Copyright (C) 2013 Samsung Electronics Co.Ltd 5 * 6 * based on rtc-max8998.c 7 * 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License as published by the 10 * Free Software Foundation; either version 2 of the License, or (at your 11 * option) any later version. 12 * 13 */ 14 |
15#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 16 |
|
15#include <linux/slab.h> 16#include <linux/rtc.h> 17#include <linux/delay.h> 18#include <linux/mutex.h> 19#include <linux/module.h> 20#include <linux/platform_device.h> 21#include <linux/mfd/max8997-private.h> 22#include <linux/irqdomain.h> --- 79 unchanged lines hidden (view full) --- 102 data[RTC_MIN] = tm->tm_min; 103 data[RTC_HOUR] = tm->tm_hour; 104 data[RTC_WEEKDAY] = 1 << tm->tm_wday; 105 data[RTC_DATE] = tm->tm_mday; 106 data[RTC_MONTH] = tm->tm_mon + 1; 107 data[RTC_YEAR] = tm->tm_year > 100 ? (tm->tm_year - 100) : 0; 108 109 if (tm->tm_year < 100) { | 17#include <linux/slab.h> 18#include <linux/rtc.h> 19#include <linux/delay.h> 20#include <linux/mutex.h> 21#include <linux/module.h> 22#include <linux/platform_device.h> 23#include <linux/mfd/max8997-private.h> 24#include <linux/irqdomain.h> --- 79 unchanged lines hidden (view full) --- 104 data[RTC_MIN] = tm->tm_min; 105 data[RTC_HOUR] = tm->tm_hour; 106 data[RTC_WEEKDAY] = 1 << tm->tm_wday; 107 data[RTC_DATE] = tm->tm_mday; 108 data[RTC_MONTH] = tm->tm_mon + 1; 109 data[RTC_YEAR] = tm->tm_year > 100 ? (tm->tm_year - 100) : 0; 110 111 if (tm->tm_year < 100) { |
110 pr_warn("%s: MAX8997 RTC cannot handle the year %d." 111 "Assume it's 2000.\n", __func__, 1900 + tm->tm_year); | 112 pr_warn("RTC cannot handle the year %d. Assume it's 2000.\n", 113 1900 + tm->tm_year); |
112 return -EINVAL; 113 } 114 return 0; 115} 116 117static inline int max8997_rtc_set_update_reg(struct max8997_rtc_info *info) 118{ 119 int ret; --- 299 unchanged lines hidden (view full) --- 419 __func__, ret); 420 return; 421 } 422 423 max8997_rtc_set_update_reg(info); 424 425 val = 0; 426 max8997_read_reg(info->rtc, MAX8997_RTC_WTSR_SMPL, &val); | 114 return -EINVAL; 115 } 116 return 0; 117} 118 119static inline int max8997_rtc_set_update_reg(struct max8997_rtc_info *info) 120{ 121 int ret; --- 299 unchanged lines hidden (view full) --- 421 __func__, ret); 422 return; 423 } 424 425 max8997_rtc_set_update_reg(info); 426 427 val = 0; 428 max8997_read_reg(info->rtc, MAX8997_RTC_WTSR_SMPL, &val); |
427 pr_info("%s: WTSR_SMPL(0x%02x)\n", __func__, val); | 429 pr_info("WTSR_SMPL(0x%02x)\n", val); |
428} 429 430static int max8997_rtc_init_reg(struct max8997_rtc_info *info) 431{ 432 u8 data[2]; 433 int ret; 434 435 /* Set RTC control register : Binary mode, 24hour mdoe */ --- 101 unchanged lines hidden --- | 430} 431 432static int max8997_rtc_init_reg(struct max8997_rtc_info *info) 433{ 434 u8 data[2]; 435 int ret; 436 437 /* Set RTC control register : Binary mode, 24hour mdoe */ --- 101 unchanged lines hidden --- |