[i2c] [PATCH] DS1339: oscillator code added.

David Brownell david-b at pacbell.net
Tue Jun 26 11:14:45 CEST 2007


On Tuesday 26 June 2007, Rodolfo Giometti wrote:
> On Mon, Jun 25, 2007 at 10:40:31AM -0700, David Brownell wrote:
> >  	case ds_1337:
> >  	case ds_1339:
> > -		ds1307->type = ds_1337;
> > -

i.e. just a couple lines after it was correctly set, remove
a line which clobbers the type ...


> If you remove this setting, are you sure that here:
> 
>         /* assume 20YY not 19YY */
>         tmp = t->tm_year - 100;
>         buf[DS1307_REG_YEAR] = BIN2BCD(tmp);
> 
>         if (ds1307->type == ds_1337)
>                 buf[DS1307_REG_MONTH] |= DS1337_BIT_CENTURY;
>         else if (ds1307->type == ds_1340)
>                 buf[DS1307_REG_HOUR] |= DS1340_BIT_CENTURY_EN
>                                 | DS1340_BIT_CENTURY;
> 
> the century bit is correct?

That should clearly be switch(type) ... though near-term, I don't
see much trouble if the leap-century stuff is done wrong.  The
next iteration of this patch will fix that.


Any other comments on that patch?

- Dave



More information about the i2c mailing list