Received: by 10.213.65.68 with SMTP id h4csp10461imn; Sat, 24 Mar 2018 11:55:55 -0700 (PDT) X-Google-Smtp-Source: AG47ELuYB0aa9PmXj2ahPOAewZJ4hf90l2M3jKjN1aWLtcvGIzjhZ0fe2AUJngPTmTva6qIhoRgS X-Received: by 2002:a17:902:b943:: with SMTP id h3-v6mr12670575pls.1.1521917755299; Sat, 24 Mar 2018 11:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521917755; cv=none; d=google.com; s=arc-20160816; b=T1iWkP2YTzs4diCeeuGERmCSEUSXxqYg5+23uaCz4gjegSpF0LWFcQJwuPnaod5rM0 5coCKl4pTpPIdN7vztn8Oqc9iFr/hMbu5K18PuLTgOapon8Q2u8n3z8YUDABOXI2my8d 6ro2cLYH6Jysq5FJQuiNucMf80baLRG08+dKVmq+Zd8Np71lrGJK8b5h5ZXHmo5fm9fU E6uclegWR+ok3zJOCz4c0ziWOkPxc9CYK3Xf2+QK25Iq4hbLwWZK/5y3pTAJXrdr904r J5W6Ul/li5xdiVwYotiGshC2pNRY1VJ0arQC6t0sisSNBwiUyV8WswT08qvB2F6rtd1+ tMQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=1eENQOc5JFLVGL3Hj880OBHmoWjSBwiLdxv2T2X+Dks=; b=eloZDkffTHtj8Y+dI/9+7UKHJOZnhmJk/F/Rs6S+icPn96zZ1ypBO1n3G051ISv30X NXnXg7c45MKYvnkaL0RF4tH/xRtVMAfAGbVfsdUm+zoesoZeKOHv69xRBxjIBf/zH28u eKb1ScBRd7j5LMiZVjlGekNYzwM/uct4dY9xo83MBNQIs9whH8yb02ZYHFrm9beConeL OILZpyDCi2uDfQ4/fObv92BQ4nzCZi6sd7dYAZBiLh5j1OH2euNxDS1RPbIglPrQGQRA JcXPfzAdOcmKAAvqHRyTaqLHz8Hm7Y8uX3tx61M8jFbetYBn+hsg2ZYKP0qewNi04Lee kOoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si8625446pfn.243.2018.03.24.11.55.40; Sat, 24 Mar 2018 11:55:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752826AbeCXSyt (ORCPT + 99 others); Sat, 24 Mar 2018 14:54:49 -0400 Received: from mail.bootlin.com ([62.4.15.54]:47197 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752579AbeCXSyr (ORCPT ); Sat, 24 Mar 2018 14:54:47 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 5877D20725; Sat, 24 Mar 2018 19:54:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [84.6.226.78]) by mail.bootlin.com (Postfix) with ESMTPSA id B95DA206A0; Sat, 24 Mar 2018 19:54:33 +0100 (CET) Date: Sat, 24 Mar 2018 19:54:30 +0100 From: Alexandre Belloni To: Sean Wang Cc: robh+dt@kernel.org, mark.rutland@arm.com, sre@kernel.org, lee.jones@linaro.org, a.zummo@towertech.it, eddie.huang@mediatek.com, devicetree@vger.kernel.org, linux-rtc@vger.kernel.org, linux-pm@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 11/16] rtc: mediatek: move the declaration into a globally visible header file Message-ID: <20180324185430.GP3417@piout.net> References: <53afbe8172fb1afd809ce9ba1afeda924b9ea705.1521794177.git.sean.wang@mediatek.com> <20180323095740.GD3417@piout.net> <1521876709.28226.34.camel@mtkswgap22> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1521876709.28226.34.camel@mtkswgap22> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/03/2018 at 15:31:49 +0800, Sean Wang wrote: > On Fri, 2018-03-23 at 10:57 +0100, Alexandre Belloni wrote: > > On 23/03/2018 at 17:15:08 +0800, sean.wang@mediatek.com wrote: > > > From: Sean Wang > > > > > > This is in preparation for allowing other drivers can share the > > > declaration, so move the declaration into a globally visible header file. > > > > > > Signed-off-by: Sean Wang > > > --- > > > drivers/rtc/rtc-mt6397.c | 53 +--------------------------------- > > > include/linux/rtc/mt6397.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++ > > > > This should go in include/linux/mfd/ > > include/linux/mfd/mt6397 is present, so include/linux/mfd/mt6397/rtc.h > seems a nice place to keep these declarations for the pmic rtc. > Yes, this seems good to me. > > > 2 files changed, 73 insertions(+), 52 deletions(-) > > > create mode 100644 include/linux/rtc/mt6397.h > > > > > > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c > > > index d133d1f..015609d 100644 > > > --- a/drivers/rtc/rtc-mt6397.c > > > +++ b/drivers/rtc/rtc-mt6397.c > > > @@ -19,63 +19,12 @@ > > > #include > > > #include > > > #include > > > -#include > > > #include > > > #include > > > #include > > > #include > > > #include > > > - > > > -#define RTC_BBPU 0x0000 > > > -#define RTC_BBPU_CBUSY BIT(6) > > > - > > > -#define RTC_WRTGR 0x003c > > > - > > > -#define RTC_IRQ_STA 0x0002 > > > -#define RTC_IRQ_STA_AL BIT(0) > > > -#define RTC_IRQ_STA_LP BIT(3) > > > - > > > -#define RTC_IRQ_EN 0x0004 > > > -#define RTC_IRQ_EN_AL BIT(0) > > > -#define RTC_IRQ_EN_ONESHOT BIT(2) > > > -#define RTC_IRQ_EN_LP BIT(3) > > > -#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) > > > - > > > -#define RTC_AL_MASK 0x0008 > > > -#define RTC_AL_MASK_DOW BIT(4) > > > - > > > -#define RTC_TC_SEC 0x000a > > > -/* Min, Hour, Dom... register offset to RTC_TC_SEC */ > > > -#define RTC_OFFSET_SEC 0 > > > -#define RTC_OFFSET_MIN 1 > > > -#define RTC_OFFSET_HOUR 2 > > > -#define RTC_OFFSET_DOM 3 > > > -#define RTC_OFFSET_DOW 4 > > > -#define RTC_OFFSET_MTH 5 > > > -#define RTC_OFFSET_YEAR 6 > > > -#define RTC_OFFSET_COUNT 7 > > > - > > > -#define RTC_AL_SEC 0x0018 > > > - > > > -#define RTC_PDN2 0x002e > > > -#define RTC_PDN2_PWRON_ALARM BIT(4) > > > - > > > -#define RTC_MIN_YEAR 1968 > > > -#define RTC_BASE_YEAR 1900 > > > -#define RTC_NUM_YEARS 128 > > > -#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR) > > > - > > > -#define MTK_RTC_POLL_DELAY_US 10 > > > -#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ)) > > > - > > > -struct mt6397_rtc { > > > - struct device *dev; > > > - struct rtc_device *rtc_dev; > > > - struct mutex lock; > > > - struct regmap *regmap; > > > - int irq; > > > - u32 addr_base; > > > -}; > > > +#include > > > > > > static int mtk_rtc_write_trigger(struct mt6397_rtc *rtc) > > > { > > > diff --git a/include/linux/rtc/mt6397.h b/include/linux/rtc/mt6397.h > > > new file mode 100644 > > > index 0000000..4b19f51 > > > --- /dev/null > > > +++ b/include/linux/rtc/mt6397.h > > > @@ -0,0 +1,72 @@ > > > + > > > > Unnecessary empty line > > > > will remove the unnecessary empty line > > > > +// SPDX-License-Identifier: GPL-2.0 > > > +/* > > > + * Copyright (C) 2014-2018 MediaTek Inc. > > > + * > > > + * Author: Tianping.Fang > > > + * Sean Wang > > > + */ > > > + > > > +#ifndef _LINUX_RTC_MT6397_H_ > > > +#define _LINUX_RTC_MT6397_H_ > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#define RTC_BBPU 0x0000 > > > +#define RTC_BBPU_CBUSY BIT(6) > > > + > > > +#define RTC_WRTGR 0x003c > > > + > > > +#define RTC_IRQ_STA 0x0002 > > > +#define RTC_IRQ_STA_AL BIT(0) > > > +#define RTC_IRQ_STA_LP BIT(3) > > > + > > > +#define RTC_IRQ_EN 0x0004 > > > +#define RTC_IRQ_EN_AL BIT(0) > > > +#define RTC_IRQ_EN_ONESHOT BIT(2) > > > +#define RTC_IRQ_EN_LP BIT(3) > > > +#define RTC_IRQ_EN_ONESHOT_AL (RTC_IRQ_EN_ONESHOT | RTC_IRQ_EN_AL) > > > + > > > +#define RTC_AL_MASK 0x0008 > > > +#define RTC_AL_MASK_DOW BIT(4) > > > + > > > +#define RTC_TC_SEC 0x000a > > > +/* Min, Hour, Dom... register offset to RTC_TC_SEC */ > > > +#define RTC_OFFSET_SEC 0 > > > +#define RTC_OFFSET_MIN 1 > > > +#define RTC_OFFSET_HOUR 2 > > > +#define RTC_OFFSET_DOM 3 > > > +#define RTC_OFFSET_DOW 4 > > > +#define RTC_OFFSET_MTH 5 > > > +#define RTC_OFFSET_YEAR 6 > > > +#define RTC_OFFSET_COUNT 7 > > > + > > > +#define RTC_AL_SEC 0x0018 > > > + > > > +#define RTC_PDN2 0x002e > > > +#define RTC_PDN2_PWRON_ALARM BIT(4) > > > + > > > +#define RTC_MIN_YEAR 1968 > > > +#define RTC_BASE_YEAR 1900 > > > +#define RTC_NUM_YEARS 128 > > > +#define RTC_MIN_YEAR_OFFSET (RTC_MIN_YEAR - RTC_BASE_YEAR) > > > + > > > +#define MTK_RTC_POLL_DELAY_US 10 > > > +#define MTK_RTC_POLL_TIMEOUT (jiffies_to_usecs(HZ)) > > > + > > > +struct mt6397_rtc { > > > + struct device *dev; > > > + struct rtc_device *rtc_dev; > > > + > > > + /* protect registers accessing */ > > > + struct mutex lock; > > > + struct regmap *regmap; > > > + int irq; > > > + u32 addr_base; > > > +}; > > > + > > > +#endif /* _LINUX_RTC_MT6397_H_ */ > > > + > > > -- > > > 2.7.4 > > > > > > > -- Alexandre Belloni, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com