Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751729AbcKBLz7 (ORCPT ); Wed, 2 Nov 2016 07:55:59 -0400 Received: from mail-db5eur01on0081.outbound.protection.outlook.com ([104.47.2.81]:33024 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750845AbcKBLz4 (ORCPT ); Wed, 2 Nov 2016 07:55:56 -0400 From: Meng Yi To: Meng Yi , "a.zummo@towertech.it" , "alexandre.belloni@free-electrons.com" CC: "rtc-linux@googlegroups.com" , "linux-kernel@vger.kernel.org" Subject: RE: [RFC PATCH] rtc/nxp: add FTM alarm driver as the wakeup source Thread-Topic: [RFC PATCH] rtc/nxp: add FTM alarm driver as the wakeup source Thread-Index: AQHSLZmfOcr+I159UUKSnEgqrnRCnaDFZ7Ew Date: Wed, 2 Nov 2016 08:23:32 +0000 Message-ID: References: <1477273336-48449-1-git-send-email-meng.yi@nxp.com> In-Reply-To: <1477273336-48449-1-git-send-email-meng.yi@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=meng.yi@nxp.com; x-originating-ip: [192.158.241.86] x-ms-office365-filtering-correlation-id: 7acd7bc3-8ab1-4aac-1184-08d402f98856 x-microsoft-exchange-diagnostics: 1;DB6PR0401MB2632;7:E1i5vKHSf/ZwcILmrsIHvFqFo2AX628LbBLwI/cYAelyFqkgBmFBJquUVQA8Vwr0BFuSJ7hRSjE77bTj2WMWyViErkWeHS/HL2TBbSlSv4FfU/6yKf0sDYT7G1KI5ZkLMCpPcNGHHrol3ngUP7UVztfNAIuYtJqGXl9gTogEGCcALrrbe99Upf891jp1azqAP/91wBWRNP4oQAqP1NuSkXKeniokBNX8NWMYze9y2+HuH8+pjQD0TLeL9QLBVNsD24Bz4oXkDg6XfSUqU2tFCUczQxTgzi2LYsIFKx+9rjZ4UqU9eaYaF1f/c9C8vf13SkBihmjghhSO/ZYiswNfbN1kwPcgAjXtd8zH6Lfyhtg= x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0401MB2632; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6045074)(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6046074)(6072074);SRVR:DB6PR0401MB2632;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0401MB2632; x-forefront-prvs: 0114FF88F6 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(6009001)(7916002)(189002)(199003)(66066001)(54356999)(2950100002)(97736004)(3280700002)(2906002)(7696004)(50986999)(5002640100001)(105586002)(106356001)(106116001)(76176999)(5660300001)(3660700001)(8676002)(92566002)(74316002)(101416001)(2900100001)(76576001)(7846002)(33656002)(7736002)(8936002)(77096005)(4326007)(86362001)(586003)(2201001)(11100500001)(68736007)(6116002)(5001770100001)(305945005)(9686002)(3846002)(102836003)(189998001)(10400500002)(2501003)(87936001)(122556002)(81156014)(81166006);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0401MB2632;H:DB6PR0401MB2631.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Nov 2016 08:23:32.2285 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0401MB2632 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uA2Buv5i008257 Content-Length: 684 Lines: 29 > + > +static int ftm_alarm_irq_enable(struct device *dev, unsigned int > +enabled) { > + if (enabled) > + ftm_irq_enable(true); > + else > + ftm_irq_enable(false); > + > + return 0; > +} > + > +static int nxp_ftm_rtc_read_time(struct device *dev, struct rtc_time > +*tm) { > + struct timeval time; > + unsigned long local_time; > + > + do_gettimeofday(&time); > + local_time = (u32)(time.tv_sec - (sys_tz.tz_minuteswest * 60)); > + rtc_time_to_tm(local_time, tm); > + > + return 0; > +} > + This is not really getting time from the RTC since FTM is not a RTC device, But we need to get the time to setup alarm, so we are using system time for now. Anybody have better idea? Meng