All of lore.kernel.org
 help / color / mirror / Atom feed
From: "AnilKumar, Chimata" <anilkumar-l0cyMroinI0@public.gmane.org>
To: "AnilKumar, Chimata" <anilkumar-l0cyMroinI0@public.gmane.org>,
	"Bedia, Vaibhav" <vaibhav.bedia-l0cyMroinI0@public.gmane.org>,
	"a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org"
	<a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org>,
	"sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org"
	<sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	"tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org"
	<tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: Colin Foe-Parker
	<colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org>,
	"rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org"
	<rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>,
	"devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	"rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org"
	<rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
	<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>
Subject: RE: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
Date: Fri, 16 Nov 2012 10:47:29 +0000	[thread overview]
Message-ID: <331ABD5ECB02734CA317220B2BBEABC13EA6D62E@DBDE01.ent.ti.com> (raw)
In-Reply-To: B5906170F1614E41A8A28DE3B8D121433EC04226@DBDE01.ent.ti.com

On Fri, Nov 16, 2012 at 11:43:36, AnilKumar, Chimata wrote:
> On Mon, Nov 12, 2012 at 15:17:48, AnilKumar, Chimata wrote:
> > On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> > > On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> > > [...]
> > > >  
> > > > +#define SHUTDOWN_TIME_SEC		2
> > > > +#define SECS_IN_MIN			60
> > > > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > > > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > > > +
> > > >  static void __iomem	*rtc_base;
> > > >  
> > > [...]
> > > > +
> > > > +	/* Wait few seconds instead of rollover */
> > > > +	do {
> > > > +		omap_rtc_read_time(NULL, &tm);
> > > > +		if (WAIT_AFTER <= tm.tm_sec)
> > > > +			mdelay(WAIT_TIME_MS);
> > > > +	} while (WAIT_AFTER <= tm.tm_sec);
> > > 
> > > This hardcoded wait for rollover doesn't look good. I see some
> > > helper functions in rtc-lib.c which probably could be used for
> > > converting the current time to elapsed seconds, add the delay and
> > > then convert it back to the time to be programmed in RTC without
> > > worrying about rollover. Why not use that?
> > 
> > I am not aware of those APIs, can you point some?
> 
> I have gone through rtc-lib.c, these are the API's I am seeing
> in the library
> 
> 1. rtc_time_to_tm: Convert seconds since 01-01-1970 00:00:00 to
> Gregorian date
> 2. rtc_tm_to_time: Convert Gregorian date to seconds since
> 01-01-1970 00:00:00
> 
> Steps I followed:-
> ================
> 1: unsigned long time;
> 2: omap_rtc_read_time(NULL, &tm);
> 3: rtc_tm_to_time(tm, &time);
> 4: pr_info("Time 1 %lu\n", time);
> 5: time += 2; /* (2sec) */
> 6: rtc_time_to_tm(time, tm);
> 7: rtc_tm_to_time(tm, &time); /* Only for printing time value */
> 8: pr_info("Time 2 %lu\n", time); 
> 
> With the above steps I am seeing completely two different time
> values at step4 and step8
> 

Nevermind it working now.

Thanks
AnilKumar

WARNING: multiple messages have this Message-ID (diff)
From: anilkumar@ti.com (AnilKumar, Chimata)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver
Date: Fri, 16 Nov 2012 10:47:29 +0000	[thread overview]
Message-ID: <331ABD5ECB02734CA317220B2BBEABC13EA6D62E@DBDE01.ent.ti.com> (raw)
In-Reply-To: B5906170F1614E41A8A28DE3B8D121433EC04226@DBDE01.ent.ti.com

On Fri, Nov 16, 2012 at 11:43:36, AnilKumar, Chimata wrote:
> On Mon, Nov 12, 2012 at 15:17:48, AnilKumar, Chimata wrote:
> > On Tue, Nov 06, 2012 at 11:15:34, Bedia, Vaibhav wrote:
> > > On Mon, Nov 05, 2012 at 15:12:27, AnilKumar, Chimata wrote:
> > > [...]
> > > >  
> > > > +#define SHUTDOWN_TIME_SEC		2
> > > > +#define SECS_IN_MIN			60
> > > > +#define WAIT_AFTER			(SECS_IN_MIN - SHUTDOWN_TIME_SEC)
> > > > +#define WAIT_TIME_MS			(SHUTDOWN_TIME_SEC * 1000)
> > > > +
> > > >  static void __iomem	*rtc_base;
> > > >  
> > > [...]
> > > > +
> > > > +	/* Wait few seconds instead of rollover */
> > > > +	do {
> > > > +		omap_rtc_read_time(NULL, &tm);
> > > > +		if (WAIT_AFTER <= tm.tm_sec)
> > > > +			mdelay(WAIT_TIME_MS);
> > > > +	} while (WAIT_AFTER <= tm.tm_sec);
> > > 
> > > This hardcoded wait for rollover doesn't look good. I see some
> > > helper functions in rtc-lib.c which probably could be used for
> > > converting the current time to elapsed seconds, add the delay and
> > > then convert it back to the time to be programmed in RTC without
> > > worrying about rollover. Why not use that?
> > 
> > I am not aware of those APIs, can you point some?
> 
> I have gone through rtc-lib.c, these are the API's I am seeing
> in the library
> 
> 1. rtc_time_to_tm: Convert seconds since 01-01-1970 00:00:00 to
> Gregorian date
> 2. rtc_tm_to_time: Convert Gregorian date to seconds since
> 01-01-1970 00:00:00
> 
> Steps I followed:-
> ================
> 1: unsigned long time;
> 2: omap_rtc_read_time(NULL, &tm);
> 3: rtc_tm_to_time(tm, &time);
> 4: pr_info("Time 1 %lu\n", time);
> 5: time += 2; /* (2sec) */
> 6: rtc_time_to_tm(time, tm);
> 7: rtc_tm_to_time(tm, &time); /* Only for printing time value */
> 8: pr_info("Time 2 %lu\n", time); 
> 
> With the above steps I am seeing completely two different time
> values at step4 and step8
> 

Nevermind it working now.

Thanks
AnilKumar

  parent reply	other threads:[~2012-11-16 10:47 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-05  9:42 [PATCH 0/4] pm: Add power off control AnilKumar Ch
2012-11-05  9:42 ` AnilKumar Ch
2012-11-05  9:42 ` [PATCH 1/4] mfd: tps65217: Set PMIC to shutdowm on PWR_EN toggle AnilKumar Ch
2012-11-05  9:42   ` AnilKumar Ch
     [not found]   ` <1352108549-9341-2-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-05 16:59     ` Benoit Cousson
2012-11-05 16:59       ` Benoit Cousson
     [not found]       ` <5097F078.50701-l0cyMroinI0@public.gmane.org>
2012-11-06  5:13         ` AnilKumar, Chimata
2012-11-06  5:13           ` AnilKumar, Chimata
2012-11-14  2:23       ` Mark Brown
2012-11-14  2:23         ` Mark Brown
     [not found]         ` <20121114022341.GM4415-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-14  5:10           ` AnilKumar, Chimata
2012-11-14  5:10             ` AnilKumar, Chimata
2012-11-14  6:11         ` AnilKumar, Chimata
2012-11-14  6:11           ` AnilKumar, Chimata
2012-11-14  6:21           ` Mark Brown
2012-11-14  6:21             ` Mark Brown
     [not found]             ` <20121114062117.GC7407-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-14  6:49               ` AnilKumar, Chimata
2012-11-14  6:49                 ` AnilKumar, Chimata
2012-11-14  7:00                 ` Mark Brown
2012-11-14  7:00                   ` Mark Brown
     [not found]                   ` <20121114070046.GE7407-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-14 10:08                     ` Benoit Cousson
2012-11-14 10:08                       ` Benoit Cousson
2012-11-14 10:24                       ` Mark Brown
2012-11-14 10:24                         ` Mark Brown
     [not found]                         ` <20121114102452.GI7407-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-16  6:16                           ` AnilKumar, Chimata
2012-11-16  6:16                             ` AnilKumar, Chimata
2012-11-05  9:42 ` [PATCH 2/4] rtc: OMAP: Add system pm_power_off to rtc driver AnilKumar Ch
2012-11-05  9:42   ` AnilKumar Ch
     [not found]   ` <1352108549-9341-3-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-05 16:43     ` Benoit Cousson
2012-11-05 16:43       ` Benoit Cousson
     [not found]       ` <5097ECAD.9010101-l0cyMroinI0@public.gmane.org>
2012-11-05 17:39         ` Colin FoeParker
2012-11-05 17:39           ` Colin FoeParker
2012-11-06  5:07       ` AnilKumar, Chimata
2012-11-06  5:07         ` AnilKumar, Chimata
2012-11-06 16:56         ` Benoit Cousson
2012-11-06 16:56           ` Benoit Cousson
     [not found]           ` <50994156.4080305-l0cyMroinI0@public.gmane.org>
2012-11-12  9:47             ` AnilKumar, Chimata
2012-11-12  9:47               ` AnilKumar, Chimata
2012-11-14  5:01           ` AnilKumar, Chimata
2012-11-14  5:01             ` AnilKumar, Chimata
2012-11-14  5:21             ` Mark Brown
2012-11-14  5:21               ` Mark Brown
2012-11-14  5:50           ` AnilKumar, Chimata
2012-11-14  5:50             ` AnilKumar, Chimata
2012-11-14  6:00             ` Mark Brown
2012-11-14  6:00               ` Mark Brown
2012-11-06  5:45   ` Bedia, Vaibhav
2012-11-06  5:45     ` Bedia, Vaibhav
     [not found]     ` <B5906170F1614E41A8A28DE3B8D121433EC04226-Er742YJ7I/eIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2012-11-12  9:47       ` AnilKumar, Chimata
2012-11-12  9:47         ` AnilKumar, Chimata
2012-11-16  6:13     ` AnilKumar, Chimata
2012-11-16  6:13       ` AnilKumar, Chimata
2012-11-16 10:47     ` AnilKumar, Chimata [this message]
2012-11-16 10:47       ` AnilKumar, Chimata
2012-11-05  9:42 ` [PATCH 3/4] ARM: dts: AM33XX: Set pmic-shutdown-controller for BeagleBone AnilKumar Ch
2012-11-05  9:42   ` AnilKumar Ch
     [not found] ` <1352108549-9341-1-git-send-email-anilkumar-l0cyMroinI0@public.gmane.org>
2012-11-05  9:42   ` [PATCH 4/4] ARM: dts: AM33XX: Enable system power off control in am335x-bone AnilKumar Ch
2012-11-05  9:42     ` AnilKumar Ch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=331ABD5ECB02734CA317220B2BBEABC13EA6D62E@DBDE01.ent.ti.com \
    --to=anilkumar-l0cymroini0@public.gmane.org \
    --cc=a.zummo-BfzFCNDTiLLj+vYz1yj4TQ@public.gmane.org \
    --cc=colin.foeparker-L+YfUVVR8+RBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=rtc-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=vaibhav.bedia-l0cyMroinI0@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.