Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757667AbcLAAcZ (ORCPT ); Wed, 30 Nov 2016 19:32:25 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:45634 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755752AbcLAAcY (ORCPT ); Wed, 30 Nov 2016 19:32:24 -0500 Date: Thu, 1 Dec 2016 01:32:22 +0100 From: Alexandre Belloni To: Meng Yi Cc: "a.zummo@towertech.it" , "rtc-linux@googlegroups.com" , "linux-kernel@vger.kernel.org" Subject: Re: [RFC PATCH] rtc/nxp: add FTM alarm driver as the wakeup source Message-ID: <20161201003222.ih3lxuyfv7xyaget@piout.net> References: <1477273336-48449-1-git-send-email-meng.yi@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20161104 (1.7.1) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 952 Lines: 37 On 02/11/2016 at 08:23:32 +0000, Meng Yi wrote : > > + > > +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? > No, that seems fine to me. I'll review the rest of the driver. -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com