linux/drivers/rtc/rtc-rx8025.c
<<
tionv2./spa > v2./form > v2.a tionv2 href="../linux+v3="v2/drivers/rtc/rtc-rx8025.c">tionv2.img src="../.static/gfx/right.png" alt=">>">ti./spa >ti.spa class="lxr_search">tiontionv2.input typionhidden" namionnavtarget" /option">tionv2.input typiontext" namionsearch" idonsearch">tionv2.butt.5Search v2./form > ./spa >ti.spa class="lxr_prefs" > v2.a href="+prefs?return=drivers/rtc/rtc-rx8025.c"tionv2 onclick="return ajax_prefs();">tionv2Prefs> v2./a>ti./spa >onv2 2./div >onv2 2.form ac" ="ajax+*" method="post" onsubmit="return false;">ti.input typionhidden" namionajax_lookup" idonajax_lookup" /option">tonv2 2./form >tonv2 2.div class="headingbott.m">
onv2
onv2 v2 2.div idonsearch_results" class="search_results"> v >onv2 2./div > .div idoncontent">> .div idonfile_contents"
2 21./a>.spa  class="comment">/*./spa  >2 22./a>.spa  class="comment"> * Driver for Epson's RTC module RX-8025 SA/NB./spa  >2 23./a>.spa  class="comment"> *./spa  >2 24./a>.spa  class="comment"> * Copyright (C) 2009 Wolfgang Grandegger <wg@grandegger.com>./spa  >2 25./a>.spa  class="comment"> *./spa  >2 26./a>.spa  class="comment"> * Copyright (C) 2005 by Digi Interna"
	 al Inc../spa  >2 27./a>.spa  class="comment"> * All rights reserved../spa  >2 28./a>.spa  class="comment"> *./spa  >2 29./a>.spa  class="comment"> * Modified by fengjh at rising.com.cn./spa  >2 
	  a>.spa  class="comment"> * <http://lists.lm-sensors.org/mailman/listinfo/lm-sensors>./spa  >2 11./a>.spa  class="comment"> * 200"v1.22spa  >2 12./a>.spa  class="comment"> *22spa  >2 13./a>.spa  class="comment"> * Code cleanup by Sergei Poselenov, <sposelenov@emcraft.com>./spa  >2 14./a>.spa  class="comment"> * Converted to new style by Wolfgang Grandegger <wg@grandegger.com>./spa  >2 15./a>.spa  class="comment"> * Alarm and periodic interrupt added by Dmitry Rakhchev <rda@emcraft.com>./spa  >2 16./a>.spa  class="comment"> *./spa  >2 17./a>.spa  class="comment"> * This program is free software; you ca  redistribute it and/or./spa  >2 18./a>.spa  class="comment"> * modify it under the terms of the GNU General Public License./spa  >2 19./a>.spa  class="comment"> * vers2.5<2 as published by the Free Software Founda"
	 ../spa  >2 2	  a>.spa  class="comment"> */./spa  >2 21./a>#include <linux/kernel.h./a>>>2 22./a>#include <linux/module.h./a>>>2 23./a>#include <linux/slab.h./a>>>2 24./a>#include <linux/init.h./a>>>2 25./a>#include <linux/bcd.h./a>>>2 26./a>#include <linux/i2c.h./a>>>2 27./a>#include <linux/list.h./a>>>2 28./a>#include <linux/rtc.h./a>>>2 29./a>>2 3	  a>.spa  class="comment">/* Register definit
	 s */./spa  >2 31./a>#define2.a href="+code=RX8025_REG_SEC" class="sref">RX8025_REG_SEC./a>          0x00>2 32./a>#define2.a href="+code=RX8025_REG_MIN" class="sref">RX8025_REG_MIN./a>          0x01>2 33./a>#define2.a href="+code=RX8025_REG_HOUR" class="sref">RX8025_REG_HOUR./a>         0x02>2 34./a>#define2.a href="+code=RX8025_REG_WDAY" class="sref">RX8025_REG_WDAY./a>         0x03>2 35./a>#define2.a href="+code=RX8025_REG_MDAY" class="sref">RX8025_REG_MDAY./a>         0x04>2 36./a>#define2.a href="+code=RX8025_REG_MONTH" class="sref">RX8025_REG_MONTH./a>        0x05>2 37./a>#define2.a href="+code=RX8025_REG_YEAR" class="sref">RX8025_REG_YEAR./a>         0x06>2 38./a>#define2.a href="+code=RX8025_REG_DIGOFF" class="sref">RX8025_REG_DIGOFF./a>       0x07>2 39./a>#define2.a href="+code=RX8025_REG_ALWMIN" class="sref">RX8025_REG_ALWMIN./a>       0x08>2 40./a>#define2.a href="+code=RX8025_REG_ALWHOUR" class="sref">RX8025_REG_ALWHOUR./a>      0x09>2 41./a>#define2.a href="+code=RX8025_REG_ALWWDAY" class="sref">RX8025_REG_ALWWDAY./a>      0x0a>2 42./a>#define2.a href="+code=RX8025_REG_ALDMIN" class="sref">RX8025_REG_ALDMIN./a>       0x0b>2 43./a>#define2.a href="+code=RX8025_REG_ALDHOUR" class="sref">RX8025_REG_ALDHOUR./a>      0x0c>2 44./a>.spa  class="comment">/* 0x0d is reserved */./spa  >2 45./a>#define2.a href="+code=RX8025_REG_CTRL1" class="sref">RX8025_REG_CTRL1./a>        0x0e>2 46./a>#define2.a href="+code=RX8025_REG_CTRL2" class="sref">RX8025_REG_CTRL2./a>        0x0f>2 47./a>>2 48./a>#define2.a href="+code=RX8025_BIT_CTRL1_CT" class="sref">RX8025_BIT_CTRL1_CT./a>     (7 << 0)>2 49./a>.spa  class="comment">/* 1 Hz periodic level irq */./spa  >2 50./a>#define2.a href="+code=RX8025_BIT_CTRL1_CT_1HZ" class="sref">RX8025_BIT_CTRL1_CT_1HZ./a> 4>2 51./a>#define2.a href="+code=RX8025_BIT_CTRL1_TEST" class="sref">RX8025_BIT_CTRL1_TEST./a>   (1 << 3)>2 52./a>#define2.a href="+code=RX8025_BIT_CTRL1_1224" class="sref">RX8025_BIT_CTRL1_1224./a>   (1 << 5)>2 53./a>#define2.a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>   (1 << 6)>2 54./a>#define2.a href="+code=RX8025_BIT_CTRL1_WALE" class="sref">RX8025_BIT_CTRL1_WALE./a>   (1 << 7)>2 55./a>>2 56./a>#define2.a href="+code=RX8025_BIT_CTRL2_DAFG" class="sref">RX8025_BIT_CTRL2_DAFG./a>   (1 << 0)>2 57./a>#define2.a href="+code=RX8025_BIT_CTRL2_WAFG" class="sref">RX8025_BIT_CTRL2_WAFG./a>   (1 << 1)>2 58./a>#define2.a href="+code=RX8025_BIT_CTRL2_CTFG" class="sref">RX8025_BIT_CTRL2_CTFG./a>   (1 << 2)>2 59./a>#define2.a href="+code=RX8025_BIT_CTRL2_PON" class="sref">RX8025_BIT_CTRL2_PON./a>    (1 << 4)>2 60./a>#define2.a href="+code=RX8025_BIT_CTRL2_XST" class="sref">RX8025_BIT_CTRL2_XST./a>    (1 << 5)>2 61./a>#define2.a href="+code=RX8025_BIT_CTRL2_VDET" class="sref">RX8025_BIT_CTRL2_VDET./a>   (1 << 6)>2 62./a>>2 63./a>.spa  class="comment">/* Clock precis2.52 64./a>#define2.a href="+code=RX8025_ADJ_RESOLUTION" class="sref">RX8025_ADJ_RESOLUTION./a>   3050 .spa  class="comment">/* in ppb */./spa  >2 65./a>#define2.a href="+code=RX8025_ADJ_DATA_MAX" class="sref">RX8025_ADJ_DATA_MAX./a>     62>2 66./a>#define2.a href="+code=RX8025_ADJ_DATA_MIN" class="sref">RX8025_ADJ_DATA_MIN./a>     -62>2 67./a>>2 68./a>static const struct2.a href="+code=i2c_device_id" class="sref">i2c_device_id./a> .a href="+code=rx8025_id" class="sref">rx8025_id./a>[] = {>2 69./a>        { .spa  class="string">"rx8025"./spa  , 0 },>2 70./a>        { }>2 71./a>};>2 72./a>.a href="+code=MODULE_DEVICE_TABLE" class="sref">MODULE_DEVICE_TABLE./a>(.a href="+code=i2c" class="sref">i2c./a>, .a href="+code=rx8025_id" class="sref">rx8025_id./a>);>2 73./a>>2 74./a>struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> {>2 75./a>        struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>;>2 76./a>        struct2.a href="+code=rtc_device" class="sref">rtc_device./a> *.a href="+code=rtc" class="sref">rtc./a>;>2 77./a>        struct2.a href="+code=work_struct" class="sref">work_struct./a> .a href="+code=work" class="sref">work./a>;>2 78./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=ctrl1" class="sref">ctrl1./a>;>2 79./a>        unsigned .a href="+code=exiting" class="sref">exiting./a>:1;>2 80./a>};>2 81./a>>2 82./a>static int2.a href="+code=rx8025_read_reg" class="sref">rx8025_read_reg./a>(struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>, int2.a href="+code=number" class="sref">number./a>, .a href="+code=u8" class="sref">u8./a> *.a href="+code=/opti" class="sref">/opti./a>)>2 83./a>{>2 84./a>        int2.a href="+code=ret" class="sref">ret./a> =2.a href="+code=i2c_smbus_read_byte_data" class="sref">i2c_smbus_read_byte_data./a>(.a href="+code=client" class="sref">client./a>, (.a href="+code=number" class="sref">number./a> << 4) | 0x08);>2 85./a>>2 86./a>        if (.a href="+code=ret" class="sref">ret./a> < 0) {>2 87./a>                .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"Unable to read register #%d\n"./spa  , .a href="+code=number" class="sref">number./a>);>2 88./a>                return .a href="+code=ret" class="sref">ret./a>;>2 89./a>        }>2 90./a>>2 91./a>        *.a href="+code=/opti" class="sref">/opti./a> =2.a href="+code=ret" class="sref">ret./a>;>2 92./a>        return 0;>2 93./a>}>2 94./a>>2 95./a>static int2.a href="+code=rx8025_read_regs" class="sref">rx8025_read_regs./a>(struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>,>2 96./a>                            int2.a href="+code=number" class="sref">number./a>, .a href="+code=u8" class="sref">u8./a> .a href="+code=length" class="sref">length./a>, .a href="+code=u8" class="sref">u8./a> *.a href="+code=/optis" class="sref">/optis./a>)>2 97./a>{>2 98./a>        int2.a href="+code=ret" class="sref">ret./a> =2.a href="+code=i2c_smbus_read_i2c_block_data" class="sref">i2c_smbus_read_i2c_block_data./a>(.a href="+code=client" class="sref">client./a>, (.a href="+code=number" class="sref">number./a> << 4) | 0x08,>2 99./a>                                                .a href="+code=length" class="sref">length./a>, .a href="+code=/optis" class="sref">/optis./a>);>2100./a>>2101./a>        if (.a href="+code=ret" class="sref">ret./a> !=2.a href="+code=length" class="sref">length./a>) {>2102./a>                .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"Unable to read registers #%d..#%d\n"./spa  ,>2103./a>                        .a href="+code=number" class="sref">number./a>, .a href="+code=number" class="sref">number./a> +2.a href="+code=length" class="sref">length./a> - 1);>2104./a>                return .a href="+code=ret" class="sref">ret./a> < 0 ? .a href="+code=ret" class="sref">ret./a> : -.a href="+code=EIO" class="sref">EIO./a>;>2105./a>        }>2106./a>>2107./a>        return 0;>2108./a>}>2109./a>>21
	  a>static int2.a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>, int2.a href="+code=number" class="sref">number./a>, .a href="+code=u8" class="sref">u8./a> .a href="+code=/opti" class="sref">/opti./a>)>2111./a>{>2112./a>        int2.a href="+code=ret" class="sref">ret./a> =2.a href="+code=i2c_smbus_write_byte_data" class="sref">i2c_smbus_write_byte_data./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=number" class="sref">number./a> << 4, .a href="+code=/opti" class="sref">/opti./a>);>2113./a>>2114./a>        if (.a href="+code=ret" class="sref">ret./a>)>2115./a>                .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"Unable to write register #%d\n"./spa  ,>2116./a>                        .a href="+code=number" class="sref">number./a>);>2117./a>>2118./a>        return .a href="+code=ret" class="sref">ret./a>;>2119./a>}>2120./a>>2121./a>static int2.a href="+code=rx8025_write_regs" class="sref">rx8025_write_regs./a>(struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>,>2122./a>                             int2.a href="+code=number" class="sref">number./a>, .a href="+code=u8" class="sref">u8./a> .a href="+code=length" class="sref">length./a>, .a href="+code=u8" class="sref">u8./a> *.a href="+code=/optis" class="sref">/optis./a>)>2123./a>{>2124./a>        int2.a href="+code=ret" class="sref">ret./a> =2.a href="+code=i2c_smbus_write_i2c_block_data" class="sref">i2c_smbus_write_i2c_block_data./a>(.a href="+code=client" class="sref">client./a>, (.a href="+code=number" class="sref">number./a> << 4) | 0x08,>2125./a>                                                 .a href="+code=length" class="sref">length./a>, .a href="+code=/optis" class="sref">/optis./a>);>2126./a>>2127./a>        if (.a href="+code=ret" class="sref">ret./a>)>2128./a>                .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"Unable to write registers #%d..#%d\n"./spa  ,>2129./a>                        .a href="+code=number" class="sref">number./a>, .a href="+code=number" class="sref">number./a> +2.a href="+code=length" class="sref">length./a> - 1);>2130./a>>2131./a>        return .a href="+code=ret" class="sref">ret./a>;>2132./a>}>2133./a>>2134./a>static .a href="+code=irqreturn_t" class="sref">irqreturn_t./a> .a href="+code=rx8025_irq" class="sref">rx8025_irq./a>(int2.a href="+code=irq" class="sref">irq./a>, void *.a href="+code=dev_id" class="sref">dev_id./a>)>2135./a>{>2136./a>        struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a> =2.a href="+code=dev_id" class="sref">dev_id./a>;>2137./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=i2c_get_clientdata" class="sref">i2c_get_clientdata./a>(.a href="+code=client" class="sref">client./a>);>2138./a>>2139./a>        .a href="+code=disable_irq_nosync" class="sref">disable_irq_nosync./a>(.a href="+code=irq" class="sref">irq./a>);>2140./a>        .a href="+code=schedule_work" class="sref">schedule_work./a>(&.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=work" class="sref">work./a>);>2141./a>        return .a href="+code=IRQ_HANDLED" class="sref">IRQ_HANDLED./a>;>2142./a>}>2143./a>>2144./a>static void .a href="+code=rx8025_work" class="sref">rx8025_work./a>(struct2.a href="+code=work_struct" class="sref">work_struct./a> *.a href="+code=work" class="sref">work./a>)>2145./a>{>2146./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=container_of" class="sref">container_of./a>(.a href="+code=work" class="sref">work./a>, struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a>,>2147./a>                                                  .a href="+code=work" class="sref">work./a>);>2148./a>        struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a> =2.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>;>2149./a>        struct2.a href="+code=mutex" class="sref">mutex./a> *.a href="+code=lock" class="sref">lock./a> =2&.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>->.a href="+code=ops_lock" class="sref">ops_lock./a>;>2150./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=status" class="sref">status./a>;>2151./a>>2152./a>        .a href="+code=mutex_lock" class="sref">mutex_lock./a>(.a href="+code=lock" class="sref">lock./a>);>2153./a>>2154./a>        if (.a href="+code=rx8025_read_reg" class="sref">rx8025_read_reg./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL2" class="sref">RX8025_REG_CTRL2./a>,2&.a href="+code=status" class="sref">status./a>))>2155./a>                goto .a href="+code=out" class="sref">out./a>;>2156./a>>2157./a>        if (!(.a href="+code=status" class="sref">status./a>2&2.a href="+code=RX8025_BIT_CTRL2_XST" class="sref">RX8025_BIT_CTRL2_XST./a>))>2158./a>                .a href="+code=dev_warn" class="sref">dev_warn./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"Oscilla"
	  stop was detected,"./spa  >2159./a>                         .spa  class="string">"you may have to readjust the clock\n"./spa  );>2160./a>>2161./a>        if (.a href="+code=status" class="sref">status./a>2&2.a href="+code=RX8025_BIT_CTRL2_CTFG" class="sref">RX8025_BIT_CTRL2_CTFG./a>) {>2162./a>                .spa  class="comment">/* periodic */./spa  >2163./a>                .a href="+code=status" class="sref">status./a>2&= ~.a href="+code=RX8025_BIT_CTRL2_CTFG" class="sref">RX8025_BIT_CTRL2_CTFG./a>;>2164./a>                .a href="+code=local_irq_disable" class="sref">local_irq_disable./a>();>2165./a>                .a href="+code=rtc_update_irq" class="sref">rtc_update_irq./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>, 1, .a href="+code=RTC_PF" class="sref">RTC_PF./a> | .a href="+code=RTC_IRQF" class="sref">RTC_IRQF./a>);>2166./a>                .a href="+code=local_irq_enable" class="sref">local_irq_enable./a>();>2167./a>        }>2168./a>>2169./a>        if (.a href="+code=status" class="sref">status./a>2&2.a href="+code=RX8025_BIT_CTRL2_DAFG" class="sref">RX8025_BIT_CTRL2_DAFG./a>) {>2170./a>                .spa  class="comment">/* alarm */./spa  >2171./a>                .a href="+code=status" class="sref">status./a>2&= .a href="+code=RX8025_BIT_CTRL2_DAFG" class="sref">RX8025_BIT_CTRL2_DAFG./a>;>2172./a>                if (.a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL1" class="sref">RX8025_REG_CTRL1./a>,>2173./a>                                     .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&2~.a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>))>2174./a>                        goto .a href="+code=out" class="sref">out./a>;>2175./a>                .a href="+code=local_irq_disable" class="sref">local_irq_disable./a>();>2176./a>                .a href="+code=rtc_update_irq" class="sref">rtc_update_irq./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>, 1, .a href="+code=RTC_AF" class="sref">RTC_AF./a> | .a href="+code=RTC_IRQF" class="sref">RTC_IRQF./a>);>2177./a>                .a href="+code=local_irq_enable" class="sref">local_irq_enable./a>();>2178./a>        }>2179./a>>2180./a>        .spa  class="comment">/* acknowledge IRQ */./spa  >2181./a>        .a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL2" class="sref">RX8025_REG_CTRL2./a>,>2182./a>                         .a href="+code=status" class="sref">status./a>2| .a href="+code=RX8025_BIT_CTRL2_XST" class="sref">RX8025_BIT_CTRL2_XST./a>);>2183./a>>2184./a>.a href="+code=out" class="sref">out./a>:>2185./a>        if (!.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=exiting" class="sref">exiting./a>)>2186./a>                .a href="+code=enable_irq" class="sref">enable_irq./a>(.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a>);>2187./a>>2188./a>        .a href="+code=mutex_unlock" class="sref">mutex_unlock./a>(.a href="+code=lock" class="sref">lock./a>);>2189./a>}>2190./a>>2191./a>static int2.a href="+code=rx8025_get_time" class="sref">rx8025_get_time./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>, struct2.a href="+code=rtc_time" class="sref">rtc_time./a> *.a href="+code=dt" class="sref">dt./a>)>2192./a>{>2193./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=dev_get_drvdata" class="sref">dev_get_drvdata./a>(.a href="+code=dev" class="sref">dev./a>);>2194./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=date" class="sref">date./a>[7];>2195./a>        int2.a href="+code=err" class="sref">err./a>;>2196./a>>2197./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_read_regs" class="sref">rx8025_read_regs./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_SEC" class="sref">RX8025_REG_SEC./a>, 7, .a href="+code=date" class="sref">date./a>);>2198./a>        if (.a href="+code=err" class="sref">err./a>)>2199./a>                return .a href="+code=err" class="sref">err./a>;>2200./a>>2201./a>        .a href="+code=dev_dbg" class="sref">dev_dbg./a>(.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"%s: read 0x%02x 0x%02x "./spa  >2202./a>                .spa  class="string">"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n"./spa  , .a href="+code=__func__" class="sref">__func__./a>,>2203./a>                .a href="+code=date" class="sref">date./a>[0], .a href="+code=date" class="sref">date./a>[1], .a href="+code=date" class="sref">date./a>[2], .a href="+code=date" class="sref">date./a>[3], .a href="+code=date" class="sref">date./a>[4],>2204./a>                .a href="+code=date" class="sref">date./a>[5], .a href="+code=date" class="sref">date./a>[6]);>2205./a>>2206./a>        .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_sec" class="sref">tm_sec./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_SEC" class="sref">RX8025_REG_SEC./a>]2&20x7f);>2207./a>        .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_min" class="sref">tm_min./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_MIN" class="sref">RX8025_REG_MIN./a>]2&20x7f);>2208./a>        if (.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&2.a href="+code=RX8025_BIT_CTRL1_1224" class="sref">RX8025_BIT_CTRL1_1224./a>)>2209./a>                .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_hour" class="sref">tm_hour./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_HOUR" class="sref">RX8025_REG_HOUR./a>]2&20x3f);>2210./a>        else>2211./a>                .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_hour" class="sref">tm_hour./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_HOUR" class="sref">RX8025_REG_HOUR./a>]2&20x1f) % 12>2212./a>                        + (.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_HOUR" class="sref">RX8025_REG_HOUR./a>]2&20x20 ? 12 : 0);>2213./a>>2214./a>        .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_mday" class="sref">tm_mday./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_MDAY" class="sref">RX8025_REG_MDAY./a>]2&20x3f);>2215./a>        .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_mon" class="sref">tm_mon./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_MONTH" class="sref">RX8025_REG_MONTH./a>]2&20x1f) - 1;>2216./a>        .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_year" class="sref">tm_year./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_YEAR" class="sref">RX8025_REG_YEAR./a>]);>2217./a>>2218./a>        if (.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_year" class="sref">tm_year./a> < 70)>2219./a>                .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_year" class="sref">tm_year./a> +=2100;>2220./a>>2221./a>        .a href="+code=dev_dbg" class="sref">dev_dbg./a>(.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"%s: date %ds %dm %dh %dmd %dm %dy\n"./spa  , .a href="+code=__func__" class="sref">__func__./a>,>2222./a>                .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_sec" class="sref">tm_sec./a>, .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_min" class="sref">tm_min./a>, .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_hour" class="sref">tm_hour./a>,>2223./a>                .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_mday" class="sref">tm_mday./a>, .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_mon" class="sref">tm_mon./a>, .a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_year" class="sref">tm_year./a>);>2224./a>>2225./a>        return .a href="+code=rtc_valid_tm" class="sref">rtc_valid_tm./a>(.a href="+code=dt" class="sref">dt./a>);>2226./a>}>2227./a>>2228./a>static int2.a href="+code=rx8025_set_time" class="sref">rx8025_set_time./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>, struct2.a href="+code=rtc_time" class="sref">rtc_time./a> *.a href="+code=dt" class="sref">dt./a>)>2229./a>{>2230./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=dev_get_drvdata" class="sref">dev_get_drvdata./a>(.a href="+code=dev" class="sref">dev./a>);>2231./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=date" class="sref">date./a>[7];>2232./a>>2233./a>        .spa  class="comment">/*./spa  >2234./a>.spa  class="comment">         * BUG: The HW assumes every year that is a multiple of 4 to be a leap./spa  >2235./a>.spa  class="comment">         * year.  Next time this is wrong is 2100, which will not be a leap./spa  >2236./a>.spa  class="comment">         * year../spa  >2237./a>.spa  class="comment">         */./spa  >2238./a>>2239./a>        .spa  class="comment">/*./spa  >2240./a>.spa  class="comment">         * Here the read-only bits are written as "0".  I'm not sure if that./spa  >2241./a>.spa  class="comment">         * is sound../spa  >2242./a>.spa  class="comment">         */./spa  >2243./a>        .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_SEC" class="sref">RX8025_REG_SEC./a>]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_sec" class="sref">tm_sec./a>);>2244./a>        .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_MIN" class="sref">RX8025_REG_MIN./a>]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_min" class="sref">tm_min./a>);>2245./a>        if (.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&2.a href="+code=RX8025_BIT_CTRL1_1224" class="sref">RX8025_BIT_CTRL1_1224./a>)>2246./a>                .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_HOUR" class="sref">RX8025_REG_HOUR./a>]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_hour" class="sref">tm_hour./a>);>2247./a>        else>2248./a>                .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_HOUR" class="sref">RX8025_REG_HOUR./a>]2=2(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_hour" class="sref">tm_hour./a> >= 12 ?20x20 : 0)>2249./a>                        | .a href="+code=bin2bcd" class="sref">bin2bcd./a>((.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_hour" class="sref">tm_hour./a> + 11) % 12 + 1);>2250./a>>2251./a>        .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_WDAY" class="sref">RX8025_REG_WDAY./a>]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_wday" class="sref">tm_wday./a>);>2252./a>        .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_MDAY" class="sref">RX8025_REG_MDAY./a>]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_mday" class="sref">tm_mday./a>);>2253./a>        .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_MONTH" class="sref">RX8025_REG_MONTH./a>]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_mon" class="sref">tm_mon./a> + 1);>2254./a>        .a href="+code=date" class="sref">date./a>[.a href="+code=RX8025_REG_YEAR" class="sref">RX8025_REG_YEAR./a>]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=dt" class="sref">dt./a>->.a href="+code=tm_year" class="sref">tm_year./a> % 100);>2255./a>>2256./a>        .a href="+code=dev_dbg" class="sref">dev_dbg./a>(.a href="+code=dev" class="sref">dev./a>,>2257./a>                .spa  class="string">"%s: write 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n"./spa  ,>2258./a>                .a href="+code=__func__" class="sref">__func__./a>,>2259./a>                .a href="+code=date" class="sref">date./a>[0], .a href="+code=date" class="sref">date./a>[1], .a href="+code=date" class="sref">date./a>[2], .a href="+code=date" class="sref">date./a>[3], .a href="+code=date" class="sref">date./a>[4], .a href="+code=date" class="sref">date./a>[5], .a href="+code=date" class="sref">date./a>[6]);>2260./a>>2261./a>        return .a href="+code=rx8025_write_regs" class="sref">rx8025_write_regs./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_SEC" class="sref">RX8025_REG_SEC./a>, 7, .a href="+code=date" class="sref">date./a>);>2262./a>}>2263./a>>2264./a>static int2.a href="+code=rx8025_init_client" class="sref">rx8025_init_client./a>(struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>, int2*.a href="+code=need_reset" class="sref">need_reset./a>)>2265./a>{>2266./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=i2c_get_clientdata" class="sref">i2c_get_clientdata./a>(.a href="+code=client" class="sref">client./a>);>2267./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=ctrl" class="sref">ctrl./a>[2], .a href="+code=ctrl2" class="sref">ctrl2./a>;>2268./a>        int2.a href="+code=need_clear" class="sref">need_clear./a> =20;>2269./a>        int2.a href="+code=err" class="sref">err./a>;>2270./a>>2271./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_read_regs" class="sref">rx8025_read_regs./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL1" class="sref">RX8025_REG_CTRL1./a>, 2, .a href="+code=ctrl" class="sref">ctrl./a>);>2272./a>        if (.a href="+code=err" class="sref">err./a>)>2273./a>                goto .a href="+code=out" class="sref">out./a>;>2274./a>>2275./a>        .spa  class="comment">/* Keep test bit zero ! */./spa  >2276./a>        .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2=2.a href="+code=ctrl" class="sref">ctrl./a>[0]2&2~.a href="+code=RX8025_BIT_CTRL1_TEST" class="sref">RX8025_BIT_CTRL1_TEST./a>;>2277./a>>2278./a>        if (.a href="+code=ctrl" class="sref">ctrl./a>[1]2&2.a href="+code=RX8025_BIT_CTRL2_PON" class="sref">RX8025_BIT_CTRL2_PON./a>) {>2279./a>                .a href="+code=dev_warn" class="sref">dev_warn./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"power-on reset was detected, "./spa  >2280./a>                         .spa  class="string">"you may have to readjust the clock\n"./spa  );>2281./a>                *.a href="+code=need_reset" class="sref">need_reset./a>2=21;>2282./a>        }>2283./a>>2284./a>        if (.a href="+code=ctrl" class="sref">ctrl./a>[1]2&2.a href="+code=RX8025_BIT_CTRL2_VDET" class="sref">RX8025_BIT_CTRL2_VDET./a>) {>2285./a>                .a href="+code=dev_warn" class="sref">dev_warn./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"a power voltage drop was detected, "./spa  >2286./a>                         .spa  class="string">"you may have to readjust the clock\n"./spa  );>2287./a>                *.a href="+code=need_reset" class="sref">need_reset./a>2=21;>2288./a>        }>2289./a>>2290./a>        if (!(.a href="+code=ctrl" class="sref">ctrl./a>[1]2&2.a href="+code=RX8025_BIT_CTRL2_XST" class="sref">RX8025_BIT_CTRL2_XST./a>)) {>2291./a>                .a href="+code=dev_warn" class="sref">dev_warn./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"Oscilla"
	  stop was detected,"./spa  >2292./a>                         .spa  class="string">"you may have to readjust the clock\n"./spa  );>2293./a>                *.a href="+code=need_reset" class="sref">need_reset./a>2=21;>2294./a>        }>2295./a>>2296./a>        if (.a href="+code=ctrl" class="sref">ctrl./a>[1]2&2(.a href="+code=RX8025_BIT_CTRL2_DAFG" class="sref">RX8025_BIT_CTRL2_DAFG./a>2| .a href="+code=RX8025_BIT_CTRL2_WAFG" class="sref">RX8025_BIT_CTRL2_WAFG./a>)) {>2297./a>                .a href="+code=dev_warn" class="sref">dev_warn./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"Alarm was detected\n"./spa  );>2298./a>                .a href="+code=need_clear" class="sref">need_clear./a> =21;>2299./a>        }>2300./a>>2301./a>        if (!(.a href="+code=ctrl" class="sref">ctrl./a>[1]2&2.a href="+code=RX8025_BIT_CTRL2_CTFG" class="sref">RX8025_BIT_CTRL2_CTFG./a>))>2302./a>                .a href="+code=need_clear" class="sref">need_clear./a> =21;>2303./a>>2304./a>        if (*.a href="+code=need_reset" class="sref">need_reset./a>2|| .a href="+code=need_clear" class="sref">need_clear./a>) {>2305./a>                .a href="+code=ctrl2" class="sref">ctrl2./a>2=2.a href="+code=ctrl" class="sref">ctrl./a>[0];>2306./a>                .a href="+code=ctrl2" class="sref">ctrl2./a>2&= ~(.a href="+code=RX8025_BIT_CTRL2_PON" class="sref">RX8025_BIT_CTRL2_PON./a>2| .a href="+code=RX8025_BIT_CTRL2_VDET" class="sref">RX8025_BIT_CTRL2_VDET./a> |>2307./a>                           .a href="+code=RX8025_BIT_CTRL2_CTFG" class="sref">RX8025_BIT_CTRL2_CTFG./a>2| .a href="+code=RX8025_BIT_CTRL2_WAFG" class="sref">RX8025_BIT_CTRL2_WAFG./a> |>2308./a>                           .a href="+code=RX8025_BIT_CTRL2_DAFG" class="sref">RX8025_BIT_CTRL2_DAFG./a>);>2309./a>                .a href="+code=ctrl2" class="sref">ctrl2./a>2|= .a href="+code=RX8025_BIT_CTRL2_XST" class="sref">RX8025_BIT_CTRL2_XST./a>;>2310./a>>2311./a>                .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL2" class="sref">RX8025_REG_CTRL2./a>, .a href="+code=ctrl2" class="sref">ctrl2./a>);>2312./a>        }>2313./a>.a href="+code=out" class="sref">out./a>:>2314./a>        return .a href="+code=err" class="sref">err./a>;>2315./a>}>2316./a>>2317./a>.spa  class="comment">/* Alarm support */./spa  >2318./a>static int2.a href="+code=rx8025_read_alarm" class="sref">rx8025_read_alarm./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>, struct2.a href="+code=rtc_wkalrm" class="sref">rtc_wkalrm./a> *.a href="+code=t" class="sref">t./a>)>2319./a>{>2320./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=dev_get_drvdata" class="sref">dev_get_drvdata./a>(.a href="+code=dev" class="sref">dev./a>);>2321./a>        struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a> =2.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>;>2322./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=ctrl2" class="sref">ctrl2./a>, .a href="+code=ald" class="sref">ald./a>[2];>2323./a>        int2.a href="+code=err" class="sref">err./a>;>2324./a>>2325./a>        if (.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a> <= 0)>2326./a>                return -.a href="+code=EINVAL" class="sref">EINVAL./a>;>2327./a>>2328./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_read_regs" class="sref">rx8025_read_regs./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_ALDMIN" class="sref">RX8025_REG_ALDMIN./a>, 2, .a href="+code=ald" class="sref">ald./a>);>2329./a>        if (.a href="+code=err" class="sref">err./a>)>2330./a>                return .a href="+code=err" class="sref">err./a>;>2331./a>>2332./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_read_reg" class="sref">rx8025_read_reg./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL2" class="sref">RX8025_REG_CTRL2./a>, &.a href="+code=ctrl2" class="sref">ctrl2./a>);>2333./a>        if (.a href="+code=err" class="sref">err./a>)>2334./a>                return .a href="+code=err" class="sref">err./a>;>2335./a>>2336./a>        .a href="+code=dev_dbg" class="sref">dev_dbg./a>(.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"%s: read alarm 0x%02x 0x%02x ctrl2 %02x\n"./spa  ,>2337./a>                .a href="+code=__func__" class="sref">__func__./a>, .a href="+code=ald" class="sref">ald./a>[0], .a href="+code=ald" class="sref">ald./a>[1], .a href="+code=ctrl2" class="sref">ctrl2./a>);>2338./a>>2339./a>        .spa  class="comment">/* Hardware alarms precis
	  is 1 minute! */./spa  >2340./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_sec" class="sref">tm_sec./a> =20;>2341./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_min" class="sref">tm_min./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=ald" class="sref">ald./a>[0]2&20x7f);>2342./a>        if (.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&2.a href="+code=RX8025_BIT_CTRL1_1224" class="sref">RX8025_BIT_CTRL1_1224./a>)>2343./a>                .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_hour" class="sref">tm_hour./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=ald" class="sref">ald./a>[1]2&20x3f);>2344./a>        else>2345./a>                .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_hour" class="sref">tm_hour./a> =2.a href="+code=bcd2bin" class="sref">bcd2bin./a>(.a href="+code=ald" class="sref">ald./a>[1]2&20x1f) % 12>2346./a>                        + (.a href="+code=ald" class="sref">ald./a>[1]2&20x20 ? 12 : 0);>2347./a>>2348./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_wday" class="sref">tm_wday./a> =2-1;>2349./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_mday" class="sref">tm_mday./a> =2-1;>2350./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_mon" class="sref">tm_mon./a> =2-1;>2351./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_year" class="sref">tm_year./a> =2-1;>2352./a>>2353./a>        .a href="+code=dev_dbg" class="sref">dev_dbg./a>(.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"%s: date: %ds %dm %dh %dmd %dm %dy\n"./spa  ,>2354./a>                .a href="+code=__func__" class="sref">__func__./a>,>2355./a>                .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_sec" class="sref">tm_sec./a>, .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_min" class="sref">tm_min./a>, .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_hour" class="sref">tm_hour./a>,>2356./a>                .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_mday" class="sref">tm_mday./a>, .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_mon" class="sref">tm_mon./a>, .a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_year" class="sref">tm_year./a>);>2357./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=enabled" class="sref">enabled./a> =2!!(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&2.a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>);>2358./a>        .a href="+code=t" class="sref">t./a>->.a href="+code=pending" class="sref">pending./a> =2(.a href="+code=ctrl2" class="sref">ctrl2./a>2& .a href="+code=RX8025_BIT_CTRL2_DAFG" class="sref">RX8025_BIT_CTRL2_DAFG./a>)2&& .a href="+code=t" class="sref">t./a>->.a href="+code=enabled" class="sref">enabled./a>;>2359./a>>2360./a>        return .a href="+code=err" class="sref">err./a>;>2361./a>}>2362./a>>2363./a>static int2.a href="+code=rx8025_set_alarm" class="sref">rx8025_set_alarm./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>, struct2.a href="+code=rtc_wkalrm" class="sref">rtc_wkalrm./a> *.a href="+code=t" class="sref">t./a>)>2364./a>{>2365./a>        struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a> =2.a href="+code=to_i2c_client" class="sref">to_i2c_client./a>(.a href="+code=dev" class="sref">dev./a>);>2366./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=dev_get_drvdata" class="sref">dev_get_drvdata./a>(.a href="+code=dev" class="sref">dev./a>);>2367./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=ald" class="sref">ald./a>[2];>2368./a>        int2.a href="+code=err" class="sref">err./a>;>2369./a>>2370./a>        if (.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a> <= 0)>2371./a>                return -.a href="+code=EINVAL" class="sref">EINVAL./a>;>2372./a>>2373./a>        .spa  class="comment">/* Hardware alarm precis
	  is 1 minute! */./spa  >2374./a>        .a href="+code=ald" class="sref">ald./a>[0]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_min" class="sref">tm_min./a>);>2375./a>        if (.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&2.a href="+code=RX8025_BIT_CTRL1_1224" class="sref">RX8025_BIT_CTRL1_1224./a>)>2376./a>                .a href="+code=ald" class="sref">ald./a>[1]2=2.a href="+code=bin2bcd" class="sref">bin2bcd./a>(.a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_hour" class="sref">tm_hour./a>);>2377./a>        else>2378./a>                .a href="+code=ald" class="sref">ald./a>[1]2=2(.a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_hour" class="sref">tm_hour./a> >= 12 ?20x20 : 0)>2379./a>                        | .a href="+code=bin2bcd" class="sref">bin2bcd./a>((.a href="+code=t" class="sref">t./a>->.a href="+code=time" class="sref">time./a>..a href="+code=tm_hour" class="sref">tm_hour./a> + 11) % 12 + 1);>2380./a>>2381./a>        .a href="+code=dev_dbg" class="sref">dev_dbg./a>(.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"%s: write 0x%02x 0x%02x\n"./spa  , .a href="+code=__func__" class="sref">__func__./a>, .a href="+code=ald" class="sref">ald./a>[0], .a href="+code=ald" class="sref">ald./a>[1]);>2382./a>>2383./a>        if (.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&2.a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>) {>2384./a>                .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2&=2~.a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>;>2385./a>                .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL1" class="sref">RX8025_REG_CTRL1./a>,>2386./a>                                       .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>);>2387./a>                if (.a href="+code=err" class="sref">err./a>)>2388./a>                        return .a href="+code=err" class="sref">err./a>;>2389./a>        }>2390./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_write_regs" class="sref">rx8025_write_regs./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_ALDMIN" class="sref">RX8025_REG_ALDMIN./a>, 2, .a href="+code=ald" class="sref">ald./a>);>2391./a>        if (.a href="+code=err" class="sref">err./a>)>2392./a>                return .a href="+code=err" class="sref">err./a>;>2393./a>>2394./a>        if (.a href="+code=t" class="sref">t./a>->.a href="+code=enabled" class="sref">enabled./a>) {>2395./a>                .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2|= .a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>;>2396./a>                .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL1" class="sref">RX8025_REG_CTRL1./a>,>2397./a>                                       .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>);>2398./a>                if (.a href="+code=err" class="sref">err./a>)>2399./a>                        return .a href="+code=err" class="sref">err./a>;>2400./a>        }>2401./a>>2402./a>        return 0;>2403./a>}>2404./a>>2405./a>static int2.a href="+code=rx8025_alarm_irq_enable" class="sref">rx8025_alarm_irq_enable./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>, unsigned int2.a href="+code=enabled" class="sref">enabled./a>)>2406./a>{>2407./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=dev_get_drvdata" class="sref">dev_get_drvdata./a>(.a href="+code=dev" class="sref">dev./a>);>2408./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=ctrl1" class="sref">ctrl1./a>;>2409./a>        int2.a href="+code=err" class="sref">err./a>;>2410./a>>2411./a>        .a href="+code=ctrl1" class="sref">ctrl1./a>2=2.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>;>2412./a>        if (.a href="+code=enabled" class="sref">enabled./a>)>2413./a>                .a href="+code=ctrl1" class="sref">ctrl1./a>2|= .a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>;>2414./a>        else>2415./a>                .a href="+code=ctrl1" class="sref">ctrl1./a>2&=2~.a href="+code=RX8025_BIT_CTRL1_DALE" class="sref">RX8025_BIT_CTRL1_DALE./a>;>2416./a>>2417./a>        if (.a href="+code=ctrl1" class="sref">ctrl1./a>2!=2.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>) {>2418./a>                .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>2=2.a href="+code=ctrl1" class="sref">ctrl1./a>;>2419./a>                .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_CTRL1" class="sref">RX8025_REG_CTRL1./a>,>2420./a>                                       .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=ctrl1" class="sref">ctrl1./a>);>2421./a>                if (.a href="+code=err" class="sref">err./a>)>2422./a>                        return .a href="+code=err" class="sref">err./a>;>2423./a>        }>2424./a>        return 0;>2425./a>}>2426./a>>2427./a>static struct2.a href="+code=rtc_class_ops" class="sref">rtc_class_ops./a> .a href="+code=rx8025_rtc_ops" class="sref">rx8025_rtc_ops./a> =2{>2428./a>        ..a href="+code=read_time" class="sref">read_time./a> =2.a href="+code=rx8025_get_time" class="sref">rx8025_get_time./a>,>2429./a>        ..a href="+code=set_time" class="sref">set_time./a> =2.a href="+code=rx8025_set_time" class="sref">rx8025_set_time./a>,>2430./a>        ..a href="+code=read_alarm" class="sref">read_alarm./a> =2.a href="+code=rx8025_read_alarm" class="sref">rx8025_read_alarm./a>,>2431./a>        ..a href="+code=set_alarm" class="sref">set_alarm./a> =2.a href="+code=rx8025_set_alarm" class="sref">rx8025_set_alarm./a>,>2432./a>        ..a href="+code=alarm_irq_enable" class="sref">alarm_irq_enable./a> =2.a href="+code=rx8025_alarm_irq_enable" class="sref">rx8025_alarm_irq_enable./a>,>2433./a>};>2434./a>>2435./a>.spa  class="comment">/*./spa  >2436./a>.spa  class="comment"> * Clock precis
	  adjustment support./spa  >2437./a>.spa  class="comment"> *./spa  >2438./a>.spa  class="comment"> * According to the RX8025 SA/NB applica"
	  manual the frequency and./spa  >2439./a>.spa  class="comment"> * temperature characteristics ca  be approximated using the following./spa  >2440./a>.spa  class="comment"> * equa"
	 :./spa  >2441./a>.spa  class="comment"> *./spa  >2442./a>.spa  class="comment"> *   df =2a * (ut - t)**2./spa  >2443./a>.spa  class="comment"> *./spa  >2444./a>.spa  class="comment"> *   df: Frequency devia"
	  i  any temperature./spa  >2445./a>.spa  class="comment"> *   a : Coefficient2=2(-35 +-5) * 10**-9./spa  >2446./a>.spa  class="comment"> *   ut: Ultimate temperature i  degree2=2+25 +-5 degree./spa  >2447./a>.spa  class="comment"> *   t : Any temperature i  degree./spa  >2448./a>.spa  class="comment"> *./spa  >2449./a>.spa  class="comment"> * Note that the clock adjustment i  ppb must be entered (which is./spa  >2450./a>.spa  class="comment"> * the nega"
ve value of the devia"
	 )../spa  >2451./a>.spa  class="comment"> */./spa  >2452./a>static int2.a href="+code=rx8025_get_clock_adjust" class="sref">rx8025_get_clock_adjust./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>, int2*.a href="+code=adj" class="sref">adj./a>)>2453./a>{>2454./a>        struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a> =2.a href="+code=to_i2c_client" class="sref">to_i2c_client./a>(.a href="+code=dev" class="sref">dev./a>);>2455./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=digoff" class="sref">digoff./a>;>2456./a>        int2.a href="+code=err" class="sref">err./a>;>2457./a>>2458./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_read_reg" class="sref">rx8025_read_reg./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_DIGOFF" class="sref">RX8025_REG_DIGOFF./a>, &.a href="+code=digoff" class="sref">digoff./a>);>2459./a>        if (.a href="+code=err" class="sref">err./a>)>2460./a>                return .a href="+code=err" class="sref">err./a>;>2461./a>>2462./a>        *.a href="+code=adj" class="sref">adj./a> =2.a href="+code=digoff" class="sref">digoff./a> >= 64 ?2.a href="+code=digoff" class="sref">digoff./a> - 128 : .a href="+code=digoff" class="sref">digoff./a>;>2463./a>        if (*.a href="+code=adj" class="sref">adj./a> > 0)>2464./a>                (*.a href="+code=adj" class="sref">adj./a>)--;>2465./a>        *.a href="+code=adj" class="sref">adj./a> *= -.a href="+code=RX8025_ADJ_RESOLUTION" class="sref">RX8025_ADJ_RESOLUTION./a>;>2466./a>>2467./a>        return 0;>2468./a>}>2469./a>>2470./a>static int2.a href="+code=rx8025_set_clock_adjust" class="sref">rx8025_set_clock_adjust./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>, int2.a href="+code=adj" class="sref">adj./a>)>2471./a>{>2472./a>        struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a> =2.a href="+code=to_i2c_client" class="sref">to_i2c_client./a>(.a href="+code=dev" class="sref">dev./a>);>2473./a>        .a href="+code=u8" class="sref">u8./a> .a href="+code=digoff" class="sref">digoff./a>;>2474./a>        int2.a href="+code=err" class="sref">err./a>;>2475./a>>2476./a>        .a href="+code=adj" class="sref">adj./a> /= -.a href="+code=RX8025_ADJ_RESOLUTION" class="sref">RX8025_ADJ_RESOLUTION./a>;>2477./a>        if (.a href="+code=adj" class="sref">adj./a> > .a href="+code=RX8025_ADJ_DATA_MAX" class="sref">RX8025_ADJ_DATA_MAX./a>)>2478./a>                .a href="+code=adj" class="sref">adj./a> =2.a href="+code=RX8025_ADJ_DATA_MAX" class="sref">RX8025_ADJ_DATA_MAX./a>;>2479./a>        else if (.a href="+code=adj" class="sref">adj./a> < .a href="+code=RX8025_ADJ_DATA_MIN" class="sref">RX8025_ADJ_DATA_MIN./a>)>2480./a>                .a href="+code=adj" class="sref">adj./a> =2.a href="+code=RX8025_ADJ_DATA_MIN" class="sref">RX8025_ADJ_DATA_MIN./a>;>2481./a>        else if (.a href="+code=adj" class="sref">adj./a> > 0)>2482./a>                .a href="+code=adj" class="sref">adj./a>++;>2483./a>        else if (.a href="+code=adj" class="sref">adj./a> < 0)>2484./a>                .a href="+code=adj" class="sref">adj./a> += 128;>2485./a>        .a href="+code=digoff" class="sref">digoff./a> =2.a href="+code=adj" class="sref">adj./a>;>2486./a>>2487./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_write_reg" class="sref">rx8025_write_reg./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=RX8025_REG_DIGOFF" class="sref">RX8025_REG_DIGOFF./a>, .a href="+code=digoff" class="sref">digoff./a>);>2488./a>        if (.a href="+code=err" class="sref">err./a>)>2489./a>                return .a href="+code=err" class="sref">err./a>;>2490./a>>2491./a>        .a href="+code=dev_dbg" class="sref">dev_dbg./a>(.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"%s: write 0x%02x\n"./spa  , .a href="+code=__func__" class="sref">__func__./a>, .a href="+code=digoff" class="sref">digoff./a>);>2492./a>>2493./a>        return 0;>2494./a>}>2495./a>>2496./a>static .a href="+code=ssize_t" class="sref">ssize_t./a> .a href="+code=rx8025_sysfs_show_clock_adjust" class="sref">rx8025_sysfs_show_clock_adjust./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>,>2497./a>                                              struct2.a href="+code=device_attribute" class="sref">device_attribute./a> *.a href="+code=attr" class="sref">attr./a>,>2498./a>                                              char *.a href="+code=buf" class="sref">buf./a>)>2499./a>{>2500./a>        int2.a href="+code=err" class="sref">err./a>, .a href="+code=adj" class="sref">adj./a>;>2501./a>>2502./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_get_clock_adjust" class="sref">rx8025_get_clock_adjust./a>(.a href="+code=dev" class="sref">dev./a>, &.a href="+code=adj" class="sref">adj./a>);>2503./a>        if (.a href="+code=err" class="sref">err./a>)>2504./a>                return .a href="+code=err" class="sref">err./a>;>2505./a>>2506./a>        return .a href="+code=sprintf" class="sref">sprintf./a>(.a href="+code=buf" class="sref">buf./a>, .spa  class="string">"%d\n"./spa  , .a href="+code=adj" class="sref">adj./a>);>2507./a>}>2508./a>>2509./a>static .a href="+code=ssize_t" class="sref">ssize_t./a> .a href="+code=rx8025_sysfs_store_clock_adjust" class="sref">rx8025_sysfs_store_clock_adjust./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>,>2510./a>                                               struct2.a href="+code=device_attribute" class="sref">device_attribute./a> *.a href="+code=attr" class="sref">attr./a>,>2511./a>                                               const char *.a href="+code=buf" class="sref">buf./a>, .a href="+code=size_t" class="sref">size_t./a> .a href="+code=count" class="sref">count./a>)>2512./a>{>2513./a>        int2.a href="+code=adj" class="sref">adj./a>, .a href="+code=err" class="sref">err./a>;>2514./a>>2515./a>        if (.a href="+code=sscanf" class="sref">sscanf./a>(.a href="+code=buf" class="sref">buf./a>, .spa  class="string">"%i"./spa  , &.a href="+code=adj" class="sref">adj./a>)2!=21)>2516./a>                return -.a href="+code=EINVAL" class="sref">EINVAL./a>;>2517./a>>2518./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_set_clock_adjust" class="sref">rx8025_set_clock_adjust./a>(.a href="+code=dev" class="sref">dev./a>, .a href="+code=adj" class="sref">adj./a>);>2519./a>>2520./a>        return .a href="+code=err" class="sref">err./a> ?2.a href="+code=err" class="sref">err./a> : .a href="+code=count" class="sref">count./a>;>2521./a>}>2522./a>>2523./a>static .a href="+code=DEVICE_ATTR" class="sref">DEVICE_ATTR./a>(.a href="+code=clock_adjust_ppb" class="sref">clock_adjust_ppb./a>, .a href="+code=S_IRUGO" class="sref">S_IRUGO./a> | .a href="+code=S_IWUSR" class="sref">S_IWUSR./a>,>2524./a>                   .a href="+code=rx8025_sysfs_show_clock_adjust" class="sref">rx8025_sysfs_show_clock_adjust./a>,>2525./a>                   .a href="+code=rx8025_sysfs_store_clock_adjust" class="sref">rx8025_sysfs_store_clock_adjust./a>);>2526./a>>2527./a>static int2.a href="+code=rx8025_sysfs_register" class="sref">rx8025_sysfs_register./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>)>2528./a>{>2529./a>        return .a href="+code=device_create_file" class="sref">device_create_file./a>(.a href="+code=dev" class="sref">dev./a>, &.a href="+code=dev_attr_clock_adjust_ppb" class="sref">dev_attr_clock_adjust_ppb./a>);>2530./a>}>2531./a>>2532./a>static void2.a href="+code=rx8025_sysfs_unregister" class="sref">rx8025_sysfs_unregister./a>(struct2.a href="+code=device" class="sref">device./a> *.a href="+code=dev" class="sref">dev./a>)>2533./a>{>2534./a>        .a href="+code=device_remove_file" class="sref">device_remove_file./a>(.a href="+code=dev" class="sref">dev./a>, &.a href="+code=dev_attr_clock_adjust_ppb" class="sref">dev_attr_clock_adjust_ppb./a>);>2535./a>}>2536./a>>2537./a>static int2.a href="+code=__devinit" class="sref">__devinit./a> .a href="+code=rx8025_probe" class="sref">rx8025_probe./a>(struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>,>2538./a>                                  const struct2.a href="+code=i2c_device_id" class="sref">i2c_device_id./a> *.a href="+code=id" class="sref">id./a>)>2539./a>{>2540./a>        struct2.a href="+code=i2c_adapter" class="sref">i2c_adapter./a> *.a href="+code=adapter" class="sref">adapter./a> =2.a href="+code=to_i2c_adapter" class="sref">to_i2c_adapter./a>(.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>..a href="+code=parent" class="sref">parent./a>);>2541./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a>;>2542./a>        int2.a href="+code=err" class="sref">err./a>, .a href="+code=need_reset" class="sref">need_reset./a> =20;>2543./a>>2544./a>        if (!.a href="+code=i2c_check_func"
	 ality" class="sref">i2c_check_func"
	 ality./a>(.a href="+code=adapter" class="sref">adapter./a>, .a href="+code=I2C_FUNC_SMBUS_BYTE_DATA" class="sref">I2C_FUNC_SMBUS_BYTE_DATA./a>>2545./a>                                     | .a href="+code=I2C_FUNC_SMBUS_I2C_BLOCK" class="sref">I2C_FUNC_SMBUS_I2C_BLOCK./a>)) {>2546./a>                .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=adapter" class="sref">adapter./a>->.a href="+code=dev" class="sref">dev./a>,>2547./a>                        .spa  class="string">"doesn't support required func"
	 ality\n"./spa  );>2548./a>                .a href="+code=err" class="sref">err./a> =2-.a href="+code=EIO" class="sref">EIO./a>;>2549./a>                goto .a href="+code=errout" class="sref">errout./a>;>2550./a>        }>2551./a>>2552./a>        .a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=kzalloc" class="sref">kzalloc./a>(sizeof(*.a href="+code=rx8025" class="sref">rx8025./a>), .a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL./a>);>2553./a>        if (!.a href="+code=rx8025" class="sref">rx8025./a>) {>2554./a>                .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=adapter" class="sref">adapter./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"failed to alloc memory\n"./spa  );>2555./a>                .a href="+code=err" class="sref">err./a> =2-.a href="+code=ENOMEM" class="sref">ENOMEM./a>;>2556./a>                goto .a href="+code=errout" class="sref">errout./a>;>2557./a>        }>2558./a>>2559./a>        .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=client" class="sref">client./a>2=2.a href="+code=client" class="sref">client./a>;>2560./a>        .a href="+code=i2c_set_clientdata" class="sref">i2c_set_clientdata./a>(.a href="+code=client" class="sref">client./a>, .a href="+code=rx8025" class="sref">rx8025./a>);>2561./a>        .a href="+code=INIT_WORK" class="sref">INIT_WORK./a>(&.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=work" class="sref">work./a>, .a href="+code=rx8025_work" class="sref">rx8025_work./a>);>2562./a>>2563./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_init_client" class="sref">rx8025_init_client./a>(.a href="+code=client" class="sref">client./a>, &.a href="+code=need_reset" class="sref">need_reset./a>);>2564./a>        if (.a href="+code=err" class="sref">err./a>)>2565./a>                goto .a href="+code=errout_free" class="sref">errout_free./a>;>2566./a>>2567./a>        if (.a href="+code=need_reset" class="sref">need_reset./a>) {>2568./a>                struct2.a href="+code=rtc_time" class="sref">rtc_time./a> .a href="+code=tm" class="sref">tm./a>;>2569./a>                .a href="+code=dev_info" class="sref">dev_info./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>,>2570./a>                         .spa  class="string">"bad condi"
	 s detected, resetting date\n"./spa  );>2571./a>                .a href="+code=rtc_time_to_tm" class="sref">rtc_time_to_tm./a>(0, &.a href="+code=tm" class="sref">tm./a>); .spa  class="comment">/* 1970/1/1 */./spa  >2572./a>                .a href="+code=rx8025_set_time" class="sref">rx8025_set_time./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, &.a href="+code=tm" class="sref">tm./a>);>2573./a>        }>2574./a>>2575./a>        .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a> =2.a href="+code=rtc_device_register" class="sref">rtc_device_register./a>(.a href="+code=client" class="sref">client./a>->.a href="+code=nami" class="sref">name./a>, &.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>,>2576./a>                                          &.a href="+code=rx8025_rtc_ops" class="sref">rx8025_rtc_ops./a>, .a href="+code=THIS_MODULE" class="sref">THIS_MODULE./a>);>2577./a>        if (.a href="+code=IS_ERR" class="sref">IS_ERR./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>)) {>2578./a>                .a href="+code=err" class="sref">err./a> =2.a href="+code=PTR_ERR" class="sref">PTR_ERR./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>);>2579./a>                .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"unable to register the class device\n"./spa  );>2580./a>                goto .a href="+code=errout_free" class="sref">errout_free./a>;>2581./a>        }>2582./a>>2583./a>        if (.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a> > 0) {>2584./a>                .a href="+code=dev_info" class="sref">dev_info./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"IRQ %d supplied\n"./spa  , .a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a>);>2585./a>                .a href="+code=err" class="sref">err./a> =2.a href="+code=request_irq" class="sref">request_irq./a>(.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a>, .a href="+code=rx8025_irq" class="sref">rx8025_irq./a>,>2586./a>                                  0, .spa  class="string">"rx8025"./spa  , .a href="+code=client" class="sref">client./a>);>2587./a>                if (.a href="+code=err" class="sref">err./a>) {>2588./a>                        .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"unable to request IRQ\n"./spa  );>2589./a>                        goto .a href="+code=errout_reg" class="sref">errout_reg./a>;>2590./a>                }>2591./a>        }>2592./a>>2593./a>        .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>->.a href="+code=irq_freq" class="sref">irq_freq./a> =21;>2594./a>        .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>->.a href="+code=max_user_freq" class="sref">max_user_freq./a> =21;>2595./a>>2596./a>        .a href="+code=err" class="sref">err./a> =2.a href="+code=rx8025_sysfs_register" class="sref">rx8025_sysfs_register./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>);>2597./a>        if (.a href="+code=err" class="sref">err./a>)>2598./a>                goto .a href="+code=errout_irq" class="sref">errout_irq./a>;>2599./a>>2600./a>        return 0;>2601./a>>2602./a>.a href="+code=errout_irq" class="sref">errout_irq./a>:>2603./a>        if (.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a> > 0)>2604./a>                .a href="+code=free_irq" class="sref">free_irq./a>(.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a>, .a href="+code=client" class="sref">client./a>);>2605./a>>2606./a>.a href="+code=errout_reg" class="sref">errout_reg./a>:>2607./a>        .a href="+code=rtc_device_unregister" class="sref">rtc_device_unregister./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>);>2608./a>>2609./a>.a href="+code=errout_free" class="sref">errout_free./a>:>2610./a>        .a href="+code=kfree" class="sref">kfree./a>(.a href="+code=rx8025" class="sref">rx8025./a>);>2611./a>>2612./a>.a href="+code=errout" class="sref">errout./a>:>2613./a>        .a href="+code=dev_err" class="sref">dev_err./a>(&.a href="+code=adapter" class="sref">adapter./a>->.a href="+code=dev" class="sref">dev./a>, .spa  class="string">"probing for rx8025 failed\n"./spa  );>2614./a>        return .a href="+code=err" class="sref">err./a>;>2615./a>}>2616./a>>2617./a>static int2.a href="+code=__devexit" class="sref">__devexit./a> .a href="+code=rx8025_remove" class="sref">rx8025_remove./a>(struct2.a href="+code=i2c_client" class="sref">i2c_client./a> *.a href="+code=client" class="sref">client./a>)>2618./a>{>2619./a>        struct2.a href="+code=rx8025_data" class="sref">rx8025_data./a> *.a href="+code=rx8025" class="sref">rx8025./a> =2.a href="+code=i2c_get_clientdata" class="sref">i2c_get_clientdata./a>(.a href="+code=client" class="sref">client./a>);>2620./a>        struct2.a href="+code=mutex" class="sref">mutex./a> *.a href="+code=lock" class="sref">lock./a> =2&.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>->.a href="+code=ops_lock" class="sref">ops_lock./a>;>2621./a>>2622./a>        if (.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a> > 0) {>2623./a>                .a href="+code=mutex_lock" class="sref">mutex_lock./a>(.a href="+code=lock" class="sref">lock./a>);>2624./a>                .a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=exiting" class="sref">exiting./a> =21;>2625./a>                .a href="+code=mutex_unlock" class="sref">mutex_unlock./a>(.a href="+code=lock" class="sref">lock./a>);>2626./a>>2627./a>                .a href="+code=free_irq" class="sref">free_irq./a>(.a href="+code=client" class="sref">client./a>->.a href="+code=irq" class="sref">irq./a>, .a href="+code=client" class="sref">client./a>);>2628./a>                .a href="+code=cancel_work_sync" class="sref">cancel_work_sync./a>(&.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=work" class="sref">work./a>);>2629./a>        }>2630./a>>2631./a>        .a href="+code=rx8025_sysfs_unregister" class="sref">rx8025_sysfs_unregister./a>(&.a href="+code=client" class="sref">client./a>->.a href="+code=dev" class="sref">dev./a>);>2632./a>        .a href="+code=rtc_device_unregister" class="sref">rtc_device_unregister./a>(.a href="+code=rx8025" class="sref">rx8025./a>->.a href="+code=rtc" class="sref">rtc./a>);>2633./a>        .a href="+code=kfree" class="sref">kfree./a>(.a href="+code=rx8025" class="sref">rx8025./a>);>2634./a>        return 0;>2635./a>}>2636./a>>2637./a>static struct2.a href="+code=i2c_driver" class="sref">i2c_driver./a> .a href="+code=rx8025_driver" class="sref">rx8025_driver./a> =2{>2638./a>        ..a href="+code=driver" class="sref">driver./a> =2{>2639./a>                ..a href="+code=nami" class="sref">name./a> =2.spa  class="string">"rtc-rx8025"./spa  ,>2640./a>                ..a href="+code=owner" class="sref">owner./a> =2.a href="+code=THIS_MODULE" class="sref">THIS_MODULE./a>,>2641./a>        },>2642./a>        ..a href="+code=probe" class="sref">probe./a>          =2.a href="+code=rx8025_probe" class="sref">rx8025_probe./a>,>2643./a>        ..a href="+code=remove" class="sref">remove./a>         =2.a href="+code=__devexit_p" class="sref">__devexit_p./a>(.a href="+code=rx8025_remove" class="sref">rx8025_remove./a>),>2644./a>        ..a href="+code=id_table" class="sref">id_table./a>       =2.a href="+code=rx8025_id" class="sref">rx8025_id./a>,>2645./a>};>2646./a>>2647./a>.a href="+code=module_i2c_driver" class="sref">module_i2c_driver./a>(.a href="+code=rx8025_driver" class="sref">rx8025_driver./a>);>2648./a>>2649./a>.a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR./a>(.spa  class="string">"Wolfgang Grandegger <wg@grandegger.com>"./spa  );>2650./a>.a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION./a>(.spa  class="string">"RX-8025 SA/NB RTC driver"./spa  );>2651./a>.a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE./a>(.spa  class="string">"GPL"./spa  );>2652./a>
lxr.linux.no kindly hosted by Redpill Linpro AS./a>, provider of Linux consulting and opera" s services since 1995.