From patchwork Thu Jul 12 05:07:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 942806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-rtc-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="j6hEUmUv"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41R3r96Z5Qz9s01 for ; Thu, 12 Jul 2018 15:08:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726344AbeGLFQf (ORCPT ); Thu, 12 Jul 2018 01:16:35 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:49948 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725786AbeGLFQe (ORCPT ); Thu, 12 Jul 2018 01:16:34 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w6C58I2X026624; Thu, 12 Jul 2018 00:08:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1531372098; bh=ERCFShX49ewYo2wZ0l0Tpj8qIsqks8Bisxu8g+DCnpY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=j6hEUmUvpFZMqsqHZl80X1YdCMmXVLIaZv16bGSBBJ7B6y5Lz1lceoulrnkDzSqws bJ6AvBKbkQ+MAtFDuC2dmCMLXwe7jq2tAJXnf1JsB6csoWbAmCnXWPb1VJQM6gdN6M JvItZEOlSJs60VeNqo2AljTOmkHfEhfxs/c29keM= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w6C58I3F007562; Thu, 12 Jul 2018 00:08:18 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Thu, 12 Jul 2018 00:08:17 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Thu, 12 Jul 2018 00:08:17 -0500 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w6C583Mm024383; Thu, 12 Jul 2018 00:08:15 -0500 From: Keerthy To: , CC: , , , , , Subject: [PATCH v4 4/4] rtc: interface: Add power_off_program to rtc_class_ops Date: Thu, 12 Jul 2018 10:37:40 +0530 Message-ID: <1531372060-10532-5-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1531372060-10532-1-git-send-email-j-keerthy@ti.com> References: <1531372060-10532-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-rtc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org 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 6d4012d..c19668b9 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c @@ -1139,3 +1139,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 3610efd..9c9ea44 100644 --- a/drivers/rtc/rtc-omap.c +++ b/drivers/rtc/rtc-omap.c @@ -518,6 +518,7 @@ static void omap_rtc_power_off(void) .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 6268208..3fc640c 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h @@ -85,6 +85,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); }; typedef struct rtc_task { @@ -229,6 +230,7 @@ int rtc_timer_start(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) {