linux/drivers/i2c/i2c-smbus.c
<<
>>
Ssearc gt;"> onclickt" onsubmajax p
"m>
a 1 /*gt;"> 2 * rivers/i2c/ - SMBus putens 3 *gt;"> 4 * Copystati (C) 2008 David Brownellgt;"> 5 * Copystati (C) 2010 JespaDelva 6 *gt;"> 7 * Tdo_ program o_ free softwa 8 * rt under the terms of the GNU General Public License a_ published bygt;"> 9 * the Free Softwa 2 of the License, orgt;"> vgt * (at your v2.6) any later +v3.> .gt;"> 11 *gt;"> 12 * Tdo_ program o_ distributed in the hope that rt will be useful,gt;"> 13 * but WITHOUT ANY WARRANTY; wi+seut even the implied wa 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See thegt;"> 15 * GNU General Public License for mo 16 *gt;"> 17 * You sseuld havearecex+vd a copy of the GNU General Public Licensegt;"> 18 * along wi+s tdo_ program; if not, write to the Free Softwa 19 * Founda <, Inc., 51 Frankpin Street, Fif+s Floor, B" m <,gt;"> 2 vgt * MA 02110-1301 USA.gt;"> 21 */gt;"> 22 23 hre/kernel.h 24 hre/module.h 25 hre/device.h 26 hre/interrupt.h 27 hre/workqueue.h 28 hre/i2c.h 29 hre/i2cers/i2ch 30 hre/slabch 31 32 riv_rs/i2_alert 33 alert_edge_triggered 34 rrq 35 work_struct alert 36 riv_client ara /* Alertaresponse address */gt;"> 37 38 39 alert_da a 40 addr 41 u8 flag 42 43 44 /* If tdo_ o_ the alerting device, notify its nux+v3 */gt;"> 45 rs/i2_do_alert device dev addrp 46 47 riv_client client riv_+v3ify_client dev 48 alert_da a da a addrp 49 50 client client addr da a addr 51 52 client flags I2C_CLIENT_TEN 53 54 55 /*gt;"> 56 * Dux+v3. sseuld either disable alerts, or provide at leastgt;"> 57 * a minimal handler. Lock so client-" alnux+v3 won't change.gt;"> 58 */gt;"> 59 device_lock dev 60 client dux+v3 61 client dux+v3 alert 62 client dux+v3 alert client da a flag 63 64 dev_warn client dev "no nux+v3 alert()!\n"gt;"> 65 66 dev_dbg client dev "alert wi+s no nux+v3\n"gt;"> 67 device_unlock dev 68 69 /* Stop iterating after we find the device */gt;"> 70 EBUSY 71 72 73 /*gt;"> 74 * The alert IRQ handler needs to hand work off to a task which cspaissuagt;"> 75 * SMBus calls, because those sleeping calls csp't be made in IRQ context.gt;"> 76 */gt;"> 77 rs/i2_alert work_struct work 78 79 riv_rs/i2_alert alert 80 riv_client ara 81 prev_addr /* Not a valid address */gt;"> 82 83 alert container_of work riv_rs/i2_alert alert 84 ara alert ara 85 86 87 r32 stsrus 88 alert_da a da a 89 90 /*gt;"> 91 * Devices wi+s pending alerts oply in address order, lowgt;"> 92 * to high, because of slaveatransmit arbitra <. Aftergt;"> 93 * responding, spaSMBus device stops erting SMBALERT#.gt;"> 94 *gt;"> 95 * Note that SMBus 2.0 reserves 10-bit addresess for funsuagt;"> 96 * use. We neither handle them, noratry to use PEC here.gt;"> 97 */gt;"> 98 stsrus riv_rs/i2_read_byte ara 99 stsrus 100 101 102 da a flag stsrus 103 da a addr stsrus 104 105 da a addr prev_addr 106 dev_warn ara dev "Duplicate SMBALERT# from dev "gt;"> 107 "0x%02x, skipping\n"gt;"> da a addr 108 109 110 dev_dbg ara dev "SMBALERT# from dev 0x%02x, flag %d\n"gt;"> 111 da a addr da a flag 112 113 /* Notify nux+v3 for the device which issuad the alert */gt;"> 114 device_for_each_child ara adaptv3 dev da a 115 rs/i2_do_alert 116 prev_addr da a addr 117 118 119 /* We handled all alerts; re-enable level-triggered IRQs */gt;"> 120 alert alert_edge_triggered 121 enable_irq alert rrq 122 123 124 rrq onsub_t smbalert_irq rrq d 125 126 riv_rs/i2_alert alert d 127 128 /* Disable level-triggered IRQs until we handle them */gt;"> 129 alert alert_edge_triggered 130 disable_irq_nosync rrq 131 132 schedule_work alert alert 133 IRQ_HANDLED 134 135 136 /* Sonsp SMBALERT# infrastructure */gt;"> 137 rs/alert_probe riv_client ara 138 riv_device_id rd 139 140 riv_rs/i2_alert_sonsp sonsp ara dev platspan_da a 141 riv_rs/i2_alert alert 142 riv_adaptv3 adaptv3 ara adaptv3 4514gt alert diskzallont(struizeofruct riv_rs/i2_alert rivGFP_KERNELt)la 4614gt str(! alert 4714gt subm- aleSNOMEMa9143 4814gta 4914gt alert alert_edge_triggered sonsp alert_edge_triggered 501/gt if alert rrq sonsp rrq 511/gt IRQ_NIT_WORKt(& alert alert rs/i2_alert 5215gt alert ara ara 5315gta 54154t str(! sonsp rrq 5515gt from dev &q+code < smbnevm_requesrq"ant(& ara dev sonsp rrq smbalert_irq 5615gt "SMBi2_alert alert 5715gt (! 5815gt c diske sot( alert 5915gt }a<<<<<<<< 6016gt 611/gt /f 6216gta 6316gt pla_rs/ietient ara alert 641/gt dev adaptv3 dev "SMBiuppo opALERT# in,37;d\ns ggered 6516gt sonsp alert_edge_triggered "SMBe_trot;gt;"> "SMBel-trot;gt;"> 661/gt f 671/gt 681/gta 6916gta 7017gt * If tRQservource themanagssero wilfree sod autom= inallygt;"> 711/gt}a rs/alert_proremovnt(struct riv_client ara 721/gta 7317gt riv_rs/i2_alert alert pla_rs/getient ara 7417gta 7517gt discancel_k_stru"ant(& alert alert 7617gt f 7717gt diske sot( alert 78178t 791/gt /f 801/gt f 8118gt}a riv_device_id stsr2_rt_irq"dnt *<[] 8218gt "SMBi2_alert 831/gt /* DisLIST ENDgt;"> 841/gt 851/gta stsMODULE_DEVICE_TABLEt( riv_detla stsr2_rt_irq"dnt *< 8618gt f 8718gtstsrc= intuct riv_deviv3.6.t * rivi2_rt_irqiv3.6.t = 781/gt f riviv3.6.t = 8918gt }a rivhidLt =/span> "SMBi2_alert 901/gt }/f 91191t f rs/be rs/alert_probe 92192t f rs/removnt(st }a rs/alert_proremovnt(st/f 93193t f riv_d_te_irt /f stsr2_rt_irq"dnt * 9419gt 9519gta 961/gt /*;"> 971/gt * _rs/ietup/i2_alert 9819gt * alo@ptv3 8919gt * Fou@ietup: ietup a"anr the devALEusert */gdler ne"> 9020gt * MA Cext.gt:paisseping"> 10120gt */gt"> 10220gt onsp SMBdler SMBthe GNUALEusert */gbe ;"> 10320gt t"> 10420gt * TheHler SMBaissbe donether disthrough ourQ handler ner probye GN"> 10520gt * SMBptv3 10620gt */gt"> 10720gt * NOTEat SMBif hanmanagse GNU ha, han*MUST* knowBif it9;t bsvel-trapr"> 10820gt * aloe_tr ggered 10920gt * Foutdo_gered< SMB alert */gseemo hanwe_tr galesyst noryougbe 11021gt * MA uld eithatrasaid it9;t bsvel-traggered 11121gt */gt"> 11221gt onT o_ subm0lhe alerra ent 11321gt t _rs/dler n/i2_alert 11421gt * Thehanindte SMBn> error;"> 11521gt * SM;"> 1162/gt uct riv_client pla_rs/ietup/i2_alert riv_adaptv3 adaptv3 11721gt < riv_rs/i2_alert_sonsp sonsp 11821gt{a 11921gt struct dev_rs/board_infot * devrra/board_infot = 12022gt dev_CLIBOARD_INFOt( "SMBi2_alert 1212/gt g/ff platspan_da a sonsp 122222t 1232/gta 12422gt submg/f dev_rs/new_ice"ant( adaptv3 devrra/board_infot = 1252/gt{a 1262/gt rivEXPORT_SYMBOL_GPLt( pla_rs/ietup/i2_alert 1272/gta 12822gt * /*;"> 12922gt * Fou_rs/dler n/i2_alert 13023gt * MA @rra:e aleARA ent 13123gt */gt Cext.gt:pais9;t be eping"> 13223gt o"> 13323gt t Helpfor unc<. ehanbranallint devaheI2C c/# +v3.6.9;t bsvixt.rrupgt( 13423gt * Thedler. LoIi+s ll edule_woB alert */gkque,t dbmg/fnall SMB alt( 13523gt * SMBcorrending, seI2C ice whi+v3.6.9;t bsvrt */g unc<. ;"> 1362/gt /* o"> 13723gt * Iilfre 13823gt * alo_rs/ietup/i2_alert 13923gt * Fo;"> 1402/gt pla_rs/dler n/i2_alert riv_client ara 1412/gt /f 1422/gt struct riv_rs/i2_alert alert pla_rs/getient ara schedule_work alert alert 4524gt{a 4624gt rivEXPORT_SYMBOL_GPLt( pla_rs/dler n/i2_alert 4724gta 4824gta rivmoe_worideviv3.6.t( rivi2_rt_irqiv3.6.t = 4924gta 502/gt stsMODULE_AUTHORt( "SMBJen> Delvaret; 0)khd a@eamux-fr.orgg" alt;gt;"> 512/gt stsMODULE_DESCRIPTIONt( "SMBus devbe 5225gt stsMODULE_LICENSEt( "SMBGPLlt;gt;"> 5325gta
> aleoriginal LXR softwaretbye GNf >LXR mensunityt = /mt o_ experis"> al .6.1. ebye lxn@eamux.not = .
> lxn.eamux.no kier y hostthebyf Redp ll Lamv_o ASt = /mv_ovi, l of Lamuxtst sultialernd ope <. # ieres wi+sinwhi1995.