From patchwork Fri Mar 22 17:16:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 10866355 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4919214DE for ; Fri, 22 Mar 2019 17:17:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27C722A955 for ; Fri, 22 Mar 2019 17:17:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A7A92A969; Fri, 22 Mar 2019 17:17:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B4A682A955 for ; Fri, 22 Mar 2019 17:17:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Li+j/fuI+OmQwIBrRYTVlGIiJi50AHlemQE7t1xRHpM=; b=Z+xzY781sZVUNh 5tkaFgyDD3slaB7ZLrpOxOXUVqyDlDiv+iqs7Zx2KYFcUJb3JhuhgtUOWzZ5g+wVlTxLUB9bDnV+a lj5V7zwvqaAiRTBGCQIvAGChga6q/LwONAsX4JiA9uG5zcQYYGyt+RiW0Wn1txD6Zdg3/ibR8wHsw apneElg9H1xfnc4kjlIwKRHEPK/wmDlCvn5GtlK1MzXitycqrk+cgW16TH7gYD5eKKxzGczdCSpNA d3BAfaHVw22RonVcRcOraPRW02f9m/zOyhny8hVuAjBeCT13rKKCsQo4pv67zHbbBgidVw35iGEB/ VyHEYKPtC4K88eS5Wm/w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7Nnf-0003K5-Oo; Fri, 22 Mar 2019 17:17:47 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h7Nmw-0002dN-5K for linux-arm-kernel@lists.infradead.org; Fri, 22 Mar 2019 17:17:25 +0000 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2MHGRlI004174; Fri, 22 Mar 2019 12:16:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553274987; bh=PgBTOzI5zbCXhrsAXfG9v/XgIvObQktHAGxLfUxmfiI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=GkE73CX9vAQYtzMT41I/0adNyT389auV/5cJN/CBO7ALwlxRvngjXDkGIM5wYhUds Jmm5c+9knbVdMKLmaS+qpu5somZgbZ/QJOcpp3BXiI32TVqrV5uI2x0B70ZZiFE2IT rAUU8+piWT+xvKvtLJum5LDzWKns9jYTkBG+HTSI= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2MHGRe7041046 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 22 Mar 2019 12:16:27 -0500 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 22 Mar 2019 12:16:26 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Fri, 22 Mar 2019 12:16:27 -0500 Received: from a0393675ula.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2MHGHYL006487; Fri, 22 Mar 2019 12:16:24 -0500 From: Keerthy To: , , , Subject: [PATCH 2/5] rtc: interface: Add power_off_program to rtc_class_ops Date: Fri, 22 Mar 2019 22:46:16 +0530 Message-ID: <20190322171619.4180-3-j-keerthy@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190322171619.4180-1-j-keerthy@ti.com> References: <20190322171619.4180-1-j-keerthy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190322_101703_007995_C2D2825B X-CRM114-Status: GOOD ( 16.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-rtc@vger.kernel.org, d-gerlach@ti.com, j-keerthy@ti.com, ssantosh@kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add an interface function to set up the rtc for a power_off mode. Signed-off-by: Keerthy --- drivers/rtc/interface.c | 12 ++++++++++++ drivers/rtc/rtc-omap.c | 1 + include/linux/rtc.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 28bd767e03a0..3a9141ceb365 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -1065,3 +1065,15 @@ int rtc_set_offset(struct rtc_device *rtc, long offset) trace_rtc_set_offset(offset, ret); return ret; } + +/** + * rtc_power_off_program - Some of the rtc are hooked on to PMIC_EN + * line and can be used to power off the SoC. + * + * Kernel interface to program rtc to power off + */ +int rtc_power_off_program(struct rtc_device *rtc) +{ + return rtc->ops->power_off_program(rtc->dev.parent); +} +EXPORT_SYMBOL_GPL(rtc_power_off_program); diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c index 9b58c933e37d..74cd391eeef7 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -511,6 +511,7 @@ static const struct rtc_class_ops omap_rtc_ops = { .read_alarm = omap_rtc_read_alarm, .set_alarm = omap_rtc_set_alarm, .alarm_irq_enable = omap_rtc_alarm_irq_enable, + .power_off_program = omap_rtc_power_off_program, }; static const struct omap_rtc_device_type omap_rtc_default_type = { diff --git a/include/linux/rtc.h b/include/linux/rtc.h index f89bfbb54902..9be8d97534b4 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -84,6 +84,7 @@ struct rtc_class_ops { int (*alarm_irq_enable)(struct device *, unsigned int enabled); int (*read_offset)(struct device *, long *offset); int (*set_offset)(struct device *, long offset); + int (*power_off_program)(struct device *dev); }; struct rtc_device; @@ -209,6 +210,7 @@ void rtc_timer_cancel(struct rtc_device *rtc, struct rtc_timer *timer); int rtc_read_offset(struct rtc_device *rtc, long *offset); int rtc_set_offset(struct rtc_device *rtc, long offset); void rtc_timer_do_work(struct work_struct *work); +int rtc_power_off_program(struct rtc_device *rtc); static inline bool is_leap_year(unsigned int year) {