From patchwork Thu Oct 29 04:58:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alim Akhtar X-Patchwork-Id: 7516421 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 52991BEEA4 for ; Thu, 29 Oct 2015 04:58:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 556A220797 for ; Thu, 29 Oct 2015 04:58:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C07120783 for ; Thu, 29 Oct 2015 04:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965036AbbJ2E6l (ORCPT ); Thu, 29 Oct 2015 00:58:41 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:53116 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964921AbbJ2E6j (ORCPT ); Thu, 29 Oct 2015 00:58:39 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NWY01KA7TTLRU40@mailout3.samsung.com>; Thu, 29 Oct 2015 13:58:33 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.123]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id CF.4B.05342.977A1365; Thu, 29 Oct 2015 13:58:33 +0900 (KST) X-AuditID: cbfee690-f794e6d0000014de-33-5631a779f449 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 1C.A1.23663.877A1365; Thu, 29 Oct 2015 13:58:33 +0900 (KST) Received: from exypnos.sisodomain.com ([107.108.73.28]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NWY00F9NTRIY290@mmp2.samsung.com>; Thu, 29 Oct 2015 13:58:32 +0900 (KST) From: Alim Akhtar To: lee.jones@linaro.org, broonie@kernel.org Cc: k.kozlowski@samsung.com, linux-samsung-soc@vger.kernel.org, rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, Alexandre Belloni Subject: [PATCH v4 4/4] drivers/rtc/rtc-s5m.c: add support for S2MPS15 RTC Date: Thu, 29 Oct 2015 10:28:41 +0530 Message-id: <1446094723-6212-5-git-send-email-alim.akhtar@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1446094723-6212-1-git-send-email-alim.akhtar@samsung.com> References: <1446094723-6212-1-git-send-email-alim.akhtar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDLMWRmVeSWpSXmKPExsWyRsSkWrdyuWGYwZSpvBYd1xYzWUx9+ITN 4vULQ4v7X48yWlzeNYfNYsb5fUwW+zs7GB3YPZ5susjosWfiSTaPTas62TzuXNvD5tG3ZRWj x+dNcgFsUVw2Kak5mWWpRfp2CVwZ21ddYStYo1lx9e8hpgbG34pdjBwcEgImErd77boYOYFM MYkL99azdTFycQgJrGCUOHhnNjNMzaoN4iA1QgKzGCVu/c+CqPnJKPHk0xw2kASbgLbE3elb mEDqRQR0JK7fSAepYRbYxijx/Oh3ZpAaYQEviU07XrOC2CwCqhLfbkxiAbF5BdwkGm4uYIY4 QlGi+9kEsJmcAu4Sk7d8YYNY7Cbxfu0aJoiaZewSrR9cIeYISHybfIgF4k5ZiU0HoMZIShxc cYNlAqPwAkaGVYyiqQXJBcVJ6UUmesWJucWleel6yfm5mxiBgX7637MJOxjvHbA+xCjAwajE w7vAyDBMiDWxrLgy9xCjKdCGicxSosn5wHjKK4k3NDYzsjA1MTU2Mrc0UxLnfS31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fXWz4PuT6b7bFAXCGdcLTNZdiqzGe+zFmXxc55XnecrsRRnJBpqMRcVJwIA 1i1x3L4CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP RTC found in s2mps15 is almost same as one found on s2mps14/13 with few differences in RTC_UPDATE register fields, like bit fields are changed for WUDR and AUDR. This patch add required changes to enable s2mps15 rtc timer. Cc: Alexandre Belloni Signed-off-by: Alim Akhtar --- drivers/rtc/rtc-s5m.c | 20 ++++++++++++++++++-- include/linux/mfd/samsung/rtc.h | 4 ++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-s5m.c b/drivers/rtc/rtc-s5m.c index f2504b4eef34..0d106a99958f 100644 --- a/drivers/rtc/rtc-s5m.c +++ b/drivers/rtc/rtc-s5m.c @@ -188,6 +188,7 @@ static inline int s5m_check_peding_alarm_interrupt(struct s5m_rtc_info *info, ret = regmap_read(info->regmap, S5M_RTC_STATUS, &val); val &= S5M_ALARM0_STATUS; break; + case S2MPS15X: case S2MPS14X: case S2MPS13X: ret = regmap_read(info->s5m87xx->regmap_pmic, S2MPS14_REG_ST2, @@ -223,6 +224,9 @@ static inline int s5m8767_rtc_set_time_reg(struct s5m_rtc_info *info) if (info->device_type == S5M8763X || info->device_type == S5M8767X) data |= S5M_RTC_TIME_EN_MASK; + if (info->device_type == S2MPS15X) + data |= S2MPS15_RTC_WUDR_MASK; + ret = regmap_write(info->regmap, info->regs->rtc_udr_update, data); if (ret < 0) { dev_err(info->dev, "failed to write update reg(%d)\n", ret); @@ -252,6 +256,9 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) case S5M8767X: data &= ~S5M_RTC_TIME_EN_MASK; break; + case S2MPS15X: + data |= S2MPS15_RTC_AUDR_MASK; + break; case S2MPS14X: data |= S2MPS_RTC_RUDR_MASK; break; @@ -275,7 +282,6 @@ static inline int s5m8767_rtc_set_alarm_reg(struct s5m_rtc_info *info) if (info->device_type == S2MPS13X) regmap_update_bits(info->regmap, info->regs->rtc_udr_update, S2MPS13_RTC_AUDR_MASK, 0); - return ret; } @@ -317,7 +323,8 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm) u8 data[info->regs->regs_count]; int ret; - if (info->device_type == S2MPS14X || info->device_type == S2MPS13X) { + if (info->device_type == S2MPS15X || info->device_type == S2MPS14X || + info->device_type == S2MPS13X) { ret = regmap_update_bits(info->regmap, info->regs->rtc_udr_update, S2MPS_RTC_RUDR_MASK, S2MPS_RTC_RUDR_MASK); @@ -339,6 +346,7 @@ static int s5m_rtc_read_time(struct device *dev, struct rtc_time *tm) break; case S5M8767X: + case S2MPS15X: case S2MPS14X: case S2MPS13X: s5m8767_data_to_tm(data, tm, info->rtc_24hr_mode); @@ -366,6 +374,7 @@ static int s5m_rtc_set_time(struct device *dev, struct rtc_time *tm) s5m8763_tm_to_data(tm, data); break; case S5M8767X: + case S2MPS15X: case S2MPS14X: case S2MPS13X: ret = s5m8767_tm_to_data(tm, data); @@ -414,6 +423,7 @@ static int s5m_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) break; case S5M8767X: + case S2MPS15X: case S2MPS14X: case S2MPS13X: s5m8767_data_to_tm(data, &alrm->time, info->rtc_24hr_mode); @@ -463,6 +473,7 @@ static int s5m_rtc_stop_alarm(struct s5m_rtc_info *info) break; case S5M8767X: + case S2MPS15X: case S2MPS14X: case S2MPS13X: for (i = 0; i < info->regs->regs_count; i++) @@ -508,6 +519,7 @@ static int s5m_rtc_start_alarm(struct s5m_rtc_info *info) break; case S5M8767X: + case S2MPS15X: case S2MPS14X: case S2MPS13X: data[RTC_SEC] |= ALARM_ENABLE_MASK; @@ -548,6 +560,7 @@ static int s5m_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) break; case S5M8767X: + case S2MPS15X: case S2MPS14X: case S2MPS13X: s5m8767_tm_to_data(&alrm->time, data); @@ -631,6 +644,7 @@ static int s5m8767_rtc_init_reg(struct s5m_rtc_info *info) ret = regmap_raw_write(info->regmap, S5M_ALARM0_CONF, data, 2); break; + case S2MPS15X: case S2MPS14X: case S2MPS13X: data[0] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT); @@ -679,6 +693,7 @@ static int s5m_rtc_probe(struct platform_device *pdev) return -ENOMEM; switch (platform_get_device_id(pdev)->driver_data) { + case S2MPS15X: case S2MPS14X: case S2MPS13X: regmap_cfg = &s2mps14_rtc_regmap_config; @@ -805,6 +820,7 @@ static const struct platform_device_id s5m_rtc_id[] = { { "s5m-rtc", S5M8767X }, { "s2mps13-rtc", S2MPS13X }, { "s2mps14-rtc", S2MPS14X }, + { "s2mps15-rtc", S2MPS15X }, { }, }; MODULE_DEVICE_TABLE(platform, s5m_rtc_id); diff --git a/include/linux/mfd/samsung/rtc.h b/include/linux/mfd/samsung/rtc.h index 29c30ac36020..0be45fccc52b 100644 --- a/include/linux/mfd/samsung/rtc.h +++ b/include/linux/mfd/samsung/rtc.h @@ -107,6 +107,10 @@ enum s2mps_rtc_reg { #define S2MPS_RTC_WUDR_MASK (1 << S2MPS_RTC_WUDR_SHIFT) #define S2MPS13_RTC_AUDR_SHIFT 1 #define S2MPS13_RTC_AUDR_MASK (1 << S2MPS13_RTC_AUDR_SHIFT) +#define S2MPS15_RTC_AUDR_SHIFT 4 +#define S2MPS15_RTC_AUDR_MASK (1 << S2MPS15_RTC_AUDR_SHIFT) +#define S2MPS15_RTC_WUDR_SHIFT 1 +#define S2MPS15_RTC_WUDR_MASK (1 << S2MPS15_RTC_WUDR_SHIFT) #define S2MPS_RTC_RUDR_SHIFT 0 #define S2MPS_RTC_RUDR_MASK (1 << S2MPS_RTC_RUDR_SHIFT) #define RTC_TCON_SHIFT 1