Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1428177

Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave and timers as default

From Alexandre Belloni <alexandre.belloni@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave and timers as default
Date 2016-06-21 23:20 +0200
Message-ID <rMBfs-2Hb-29@gated-at.bofh.it> (permalink)
References <rMoid-2I5-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 21/06/2016 at 00:22:35 -0700, Andrey Smirnov wrote :
> Disable square wave and timers as default for DS1337/39/41 and
> DS3231. The rationale being that configuring a chip this way puts it
> into a known state with lower power consumption. While it is not very
> likely it is still possible that the code controlling RTCs that ran
> before this driver configured it to produce square wave and left it in
> such a state.
> 

The main issue being that if it has been configured that way (from the
bootloader for example). It is probably necessary for the board. There
may be users of that clock and this patch definitively breaks them.
The proper way of doing that is to add CCF support in the driver. See:
http://patchwork.ozlabs.org/patch/576201/

> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/rtc/rtc-ds1307.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index 7e65e2e..c618c22 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -1320,19 +1320,17 @@ static int ds1307_probe(struct i2c_client *client,
>  			ds1307->regs[0] &= ~DS1337_BIT_nEOSC;
>  
>  		/*
> -		 * Using IRQ or defined as wakeup-source?
>  		 * Disable the square wave and both alarms.
>  		 * For some variants, be sure alarms can trigger when we're
>  		 * running on Vbackup (BBSQI/BBSQW)
>  		 */
> -		if (chip->alarm && (ds1307->client->irq > 0 ||
> -						ds1307_can_wakeup_device)) {
> -			ds1307->regs[0] |= DS1337_BIT_INTCN
> -					| bbsqi_bitpos[ds1307->type];
> -			ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
> +		ds1307->regs[0] |= DS1337_BIT_INTCN
> +			| bbsqi_bitpos[ds1307->type];
> +		ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
>  
> +		if (chip->alarm && (ds1307->client->irq > 0 ||
> +				    ds1307_can_wakeup_device))
>  			want_irq = true;
> -		}
>  
>  		i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
>  							ds1307->regs[0]);
> -- 
> 2.5.5
> 

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 02/17] RTC: ds1307: Disable square wave and timers as default Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-06-21 09:30 +0200
  [PATCH v2 13/17] RTC: ds1307: Report oscillator problems more intelligently Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-06-21 09:30 +0200
    Re: [PATCH v2 13/17] RTC: ds1307: Report oscillator problems more  intelligently Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-21 23:30 +0200
      Re: [PATCH v2 13/17] RTC: ds1307: Report oscillator problems more intelligently Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-06-22 01:10 +0200
  [PATCH v2 10/17] RTC: ds1307: Constify struct ds1307 where possible Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-06-21 09:30 +0200
  Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave and timers as  default Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-21 23:20 +0200
    Re: [PATCH v2 02/17] RTC: ds1307: Disable square wave and timers as default Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-06-22 01:50 +0200

csiph-web