Changeset 5421

Show
Ignore:
Timestamp:
11/24/08 17:51:00 (4 years ago)
Author:
khali
Message:

Harmonize the order of the parameters of all I2C detection functions.
The purpose of such an admittedly intrusive change is that we then no
longer need to document the calling convention of each function
individually, which spares a huge amount of comments.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r5420 r5421  
    534534       driver => "lm78", 
    535535       i2c_addrs => [0x28..0x2f], 
    536        i2c_detect => sub { lm78_detect(0, @_); }, 
     536       i2c_detect => sub { lm78_detect(@_, 0); }, 
    537537       isa_addrs => [0x290], 
    538538       isa_detect => sub { lm78_isa_detect(@_, 0); }, 
     
    543543       driver => "lm78", 
    544544       i2c_addrs => [0x28..0x2f], 
    545        i2c_detect => sub { lm78_detect(2, @_); }, 
     545       i2c_detect => sub { lm78_detect(@_, 2); }, 
    546546       isa_addrs => [0x290], 
    547547       isa_detect => sub { lm78_isa_detect(@_, 2); }, 
     
    552552       driver => "lm75", 
    553553       i2c_addrs => [0x48..0x4f], 
    554        i2c_detect => sub { lm75_detect(0, @_); }, 
     554       i2c_detect => sub { lm75_detect(@_, 0); }, 
    555555     }, 
    556556     { 
     
    558558       driver => "lm75", 
    559559       i2c_addrs => [0x48..0x4f], 
    560        i2c_detect => sub { lm75_detect(1, @_); }, 
     560       i2c_detect => sub { lm75_detect(@_, 1); }, 
    561561     }, 
    562562     { 
     
    576576       driver => "lm85", 
    577577       i2c_addrs => [0x2c..0x2e], 
    578        i2c_detect => sub { lm85_detect(0, @_); }, 
     578       i2c_detect => sub { lm85_detect(@_, 0); }, 
    579579     }, 
    580580     { 
     
    582582       driver => "lm85", 
    583583       i2c_addrs => [0x2c..0x2e], 
    584        i2c_detect => sub { lm85_detect(1, @_); }, 
     584       i2c_detect => sub { lm85_detect(@_, 1); }, 
    585585     }, 
    586586     { 
     
    588588       driver => "lm85", 
    589589       i2c_addrs => [0x2c..0x2e], 
    590        i2c_detect => sub { lm85_detect(2, @_); }, 
     590       i2c_detect => sub { lm85_detect(@_, 2); }, 
    591591     }, 
    592592     { 
     
    594594       driver => "lm85", 
    595595       i2c_addrs => [0x2c..0x2e], 
    596        i2c_detect => sub { lm85_detect(3, @_); }, 
     596       i2c_detect => sub { lm85_detect(@_, 3); }, 
    597597     }, 
    598598     { 
     
    600600       driver => "lm85", 
    601601       i2c_addrs => [0x2c..0x2e], 
    602        i2c_detect => sub { lm85_detect(4, @_); }, 
     602       i2c_detect => sub { lm85_detect(@_, 4); }, 
    603603     }, 
    604604     { 
     
    606606       driver => "lm85", 
    607607       i2c_addrs => [0x2c..0x2e], 
    608        i2c_detect => sub { lm85_detect(5, @_); }, 
     608       i2c_detect => sub { lm85_detect(@_, 5); }, 
    609609     }, 
    610610     { 
     
    612612       driver => "lm85", 
    613613       i2c_addrs => [0x2c..0x2e], 
    614        i2c_detect => sub { lm85_detect(6, @_); }, 
     614       i2c_detect => sub { lm85_detect(@_, 6); }, 
    615615     }, 
    616616     { 
     
    618618       driver => "adt7462", 
    619619       i2c_addrs => [0x5c, 0x58], 
    620        i2c_detect => sub { adt7467_detect(2, @_); }, 
     620       i2c_detect => sub { adt7467_detect(@_, 2); }, 
    621621     }, 
    622622     { 
     
    624624       driver => "to-be-written", 
    625625       i2c_addrs => [0x4c], 
    626        i2c_detect => sub { adt7467_detect(3, @_); }, 
     626       i2c_detect => sub { adt7467_detect(@_, 3); }, 
    627627     }, 
    628628     { 
     
    630630       driver => "to-be-written", 
    631631       i2c_addrs => [0x2e], 
    632        i2c_detect => sub { adt7467_detect(0, @_); }, 
     632       i2c_detect => sub { adt7467_detect(@_, 0); }, 
    633633     }, 
    634634     { 
     
    636636       driver => "adt7470", 
    637637       i2c_addrs => [0x2c, 0x2e, 0x2f], 
    638        i2c_detect => sub { adt7467_detect(4, @_); }, 
     638       i2c_detect => sub { adt7467_detect(@_, 4); }, 
    639639     }, 
    640640     { 
     
    642642       driver => "adt7473", 
    643643       i2c_addrs => [0x2e], 
    644        i2c_detect => sub { adt7473_detect(0, @_); }, 
     644       i2c_detect => sub { adt7473_detect(@_, 0); }, 
    645645     }, 
    646646     { 
     
    648648       driver => "to-be-written", 
    649649       i2c_addrs => [0x2e], 
    650        i2c_detect => sub { adt7473_detect(1, @_); }, 
     650       i2c_detect => sub { adt7473_detect(@_, 1); }, 
    651651     }, 
    652652     { 
     
    654654       driver => "to-be-written", 
    655655       i2c_addrs => [0x2c..0x2e], 
    656        i2c_detect => sub { adt7467_detect(1, @_); }, 
     656       i2c_detect => sub { adt7467_detect(@_, 1); }, 
    657657     }, 
    658658     { 
     
    666666       driver => "to-be-written", 
    667667       i2c_addrs => [0x58], 
    668        i2c_detect => sub { andigilog_detect(0, @_); }, 
     668       i2c_detect => sub { andigilog_detect(@_, 0); }, 
    669669     }, 
    670670     { 
     
    672672       driver => "to-be-written", 
    673673       i2c_addrs => [0x2c, 0x2d, 0x2e], 
    674        i2c_detect => sub { andigilog_detect(1, @_); }, 
     674       i2c_detect => sub { andigilog_detect(@_, 1); }, 
    675675     }, 
    676676     { 
     
    678678       driver => "to-be-written", 
    679679       i2c_addrs => [0x2c, 0x2d, 0x2e], 
    680        i2c_detect => sub { andigilog_detect(2, @_); }, 
     680       i2c_detect => sub { andigilog_detect(@_, 2); }, 
    681681     }, 
    682682     { 
     
    684684       driver => "lm87", 
    685685       i2c_addrs => [0x2c..0x2e], 
    686        i2c_detect => sub { lm87_detect(0, @_); }, 
     686       i2c_detect => sub { lm87_detect(@_, 0); }, 
    687687     }, 
    688688     { 
     
    690690       driver => "lm87", 
    691691       i2c_addrs => [0x2c..0x2e], 
    692        i2c_detect => sub { lm87_detect(1, @_); }, 
     692       i2c_detect => sub { lm87_detect(@_, 1); }, 
    693693     }, 
    694694     { 
     
    701701       name => "Winbond W83781D", 
    702702       driver => "w83781d", 
    703        i2c_detect => sub { w83781d_detect(0, @_); }, 
     703       i2c_detect => sub { w83781d_detect(@_, 0); }, 
    704704       i2c_addrs => [0x28..0x2f], 
    705705       isa_addrs => [0x290], 
     
    711711       driver => "w83781d", 
    712712       i2c_addrs => [0x28..0x2f], 
    713        i2c_detect => sub { w83781d_detect(1, @_); }, 
     713       i2c_detect => sub { w83781d_detect(@_, 1); }, 
    714714       isa_addrs => [0x290], 
    715715       isa_detect => sub { w83781d_isa_detect(@_, 1); }, 
     
    720720       driver => "w83781d", 
    721721       i2c_addrs => [0x2d], 
    722        i2c_detect => sub { w83781d_detect(2, @_); }, 
     722       i2c_detect => sub { w83781d_detect(@_, 2); }, 
    723723     }, 
    724724     { 
     
    726726       driver => "w83791d", 
    727727       i2c_addrs => [0x2c..0x2f], 
    728        i2c_detect => sub { w83781d_detect(7, @_); }, 
     728       i2c_detect => sub { w83781d_detect(@_, 7); }, 
    729729     }, 
    730730     { 
     
    732732       driver => "w83792d", 
    733733       i2c_addrs => [0x2c..0x2f], 
    734        i2c_detect => sub { w83781d_detect(8, @_); }, 
     734       i2c_detect => sub { w83781d_detect(@_, 8); }, 
    735735     }, 
    736736     { 
     
    750750       driver => "use-isa-instead", 
    751751       i2c_addrs => [0x28..0x2f], 
    752        i2c_detect => sub { w83781d_detect(3, @_); }, 
     752       i2c_detect => sub { w83781d_detect(@_, 3); }, 
    753753     }, 
    754754     { 
     
    756756       driver => "use-isa-instead", 
    757757       i2c_addrs => [0x28..0x2f], 
    758        i2c_detect => sub { w83781d_detect(9, @_); }, 
     758       i2c_detect => sub { w83781d_detect(@_, 9); }, 
    759759     }, 
    760760     { 
     
    762762       driver => "use-isa-instead", 
    763763       i2c_addrs => [0x28..0x2f], 
    764        i2c_detect => sub { w83781d_detect(10, @_); }, 
     764       i2c_detect => sub { w83781d_detect(@_, 10); }, 
    765765     }, 
    766766     { 
     
    768768       driver => "w83781d", 
    769769       i2c_addrs => [0x28..0x2f], 
    770        i2c_detect => sub { w83781d_detect(4, @_); }, 
     770       i2c_detect => sub { w83781d_detect(@_, 4); }, 
    771771     }, 
    772772     { 
     
    774774       driver => "w83781d", 
    775775       i2c_addrs => [0x28..0x2f], 
    776        i2c_detect => sub { w83781d_detect(5, @_); }, 
     776       i2c_detect => sub { w83781d_detect(@_, 5); }, 
    777777     }, 
    778778     { 
     
    780780       driver => "asb100", 
    781781       i2c_addrs => [0x28..0x2f], 
    782        i2c_detect => sub { w83781d_detect(6, @_); }, 
     782       i2c_detect => sub { w83781d_detect(@_, 6); }, 
    783783     }, 
    784784     { 
     
    786786       driver => "to-be-written", 
    787787       i2c_addrs => [0x77], 
    788        i2c_detect => sub { mozart_detect(0, @_); }, 
     788       i2c_detect => sub { mozart_detect(@_, 0); }, 
    789789     }, 
    790790     { 
     
    792792       driver => "to-be-written", 
    793793       i2c_addrs => [0x77], 
    794        i2c_detect => sub { mozart_detect(1, @_); }, 
     794       i2c_detect => sub { mozart_detect(@_, 1); }, 
    795795     }, 
    796796     { 
     
    798798       driver => "to-be-written", 
    799799       i2c_addrs => [0x77], 
    800        i2c_detect => sub { mozart_detect(2, @_); }, 
     800       i2c_detect => sub { mozart_detect(@_, 2); }, 
    801801     }, 
    802802     { 
     
    804804       driver => "to-be-written", 
    805805       i2c_addrs => [0x2d], 
    806        i2c_detect => sub { w83l784r_detect(0, @_); }, 
     806       i2c_detect => sub { w83l784r_detect(@_, 0); }, 
    807807     }, 
    808808     { 
     
    810810       driver => "to-be-written", 
    811811       i2c_addrs => [0x2d], 
    812        i2c_detect => sub { w83l784r_detect(1, @_); }, 
     812       i2c_detect => sub { w83l784r_detect(@_, 1); }, 
    813813     }, 
    814814     { 
     
    816816       driver => "w83l786ng", 
    817817       i2c_addrs => [0x2e, 0x2f], 
    818        i2c_detect => sub { w83l784r_detect(2, @_); }, 
     818       i2c_detect => sub { w83l784r_detect(@_, 2); }, 
    819819     }, 
    820820     { 
     
    828828       driver => "gl518sm", 
    829829       i2c_addrs => [0x2c, 0x2d], 
    830        i2c_detect => sub { gl518sm_detect(0, @_); }, 
     830       i2c_detect => sub { gl518sm_detect(@_, 0); }, 
    831831     }, 
    832832     { 
     
    834834       driver => "gl518sm", 
    835835       i2c_addrs => [0x2c, 0x2d], 
    836        i2c_detect => sub { gl518sm_detect(1, @_); }, 
     836       i2c_detect => sub { gl518sm_detect(@_, 1); }, 
    837837     }, 
    838838     { 
     
    852852       driver => "adm9240", 
    853853       i2c_addrs => [0x2c..0x2f], 
    854        i2c_detect => sub { adm9240_detect(0, @_); }, 
     854       i2c_detect => sub { adm9240_detect(@_, 0); }, 
    855855     }, 
    856856     { 
     
    864864       driver => "adm9240", 
    865865       i2c_addrs => [0x2c..0x2f], 
    866        i2c_detect => sub { adm9240_detect(1, @_); }, 
     866       i2c_detect => sub { adm9240_detect(@_, 1); }, 
    867867     }, 
    868868     { 
     
    870870       driver => "adm9240", 
    871871       i2c_addrs => [0x2c..0x2f], 
    872        i2c_detect => sub { adm9240_detect(2, @_); }, 
     872       i2c_detect => sub { adm9240_detect(@_, 2); }, 
    873873     }, 
    874874     { 
     
    882882       driver => "adm1025", 
    883883       i2c_addrs => [0x2c..0x2e], 
    884        i2c_detect => sub { adm1025_detect(0, @_); }, 
     884       i2c_detect => sub { adm1025_detect(@_, 0); }, 
    885885     }, 
    886886     { 
     
    888888       driver => "adm1025", 
    889889       i2c_addrs => [0x2c..0x2d], 
    890        i2c_detect => sub { adm1025_detect(1, @_); }, 
     890       i2c_detect => sub { adm1025_detect(@_, 1); }, 
    891891     }, 
    892892     { 
     
    894894       driver => "adm1021", 
    895895       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    896        i2c_detect => sub { adm1021_detect(0, @_); }, 
     896       i2c_detect => sub { adm1021_detect(@_, 0); }, 
    897897     }, 
    898898     { 
     
    900900       driver => "adm1021", 
    901901       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    902        i2c_detect => sub { adm1021_detect(1, @_); }, 
     902       i2c_detect => sub { adm1021_detect(@_, 1); }, 
    903903     }, 
    904904     { 
     
    906906       driver => "adm1021", 
    907907       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    908        i2c_detect => sub { adm1021_detect(2, @_); }, 
     908       i2c_detect => sub { adm1021_detect(@_, 2); }, 
    909909     }, 
    910910     { 
     
    912912       driver => "adm1021", 
    913913       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    914        i2c_detect => sub { adm1021_detect(3, @_); }, 
     914       i2c_detect => sub { adm1021_detect(@_, 3); }, 
    915915     }, 
    916916     { 
     
    918918       driver => "max1668", 
    919919       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    920        i2c_detect => sub { max1668_detect(0, @_); }, 
     920       i2c_detect => sub { max1668_detect(@_, 0); }, 
    921921     }, 
    922922     { 
     
    924924       driver => "max1668", 
    925925       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    926        i2c_detect => sub { max1668_detect(1, @_); }, 
     926       i2c_detect => sub { max1668_detect(@_, 1); }, 
    927927     }, 
    928928     { 
     
    930930       driver => "max1668", 
    931931       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    932        i2c_detect => sub { max1668_detect(2, @_); }, 
     932       i2c_detect => sub { max1668_detect(@_, 2); }, 
    933933     }, 
    934934     { 
     
    948948       driver => "adm1021", 
    949949       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    950        i2c_detect => sub { adm1021_detect(4, @_); }, 
     950       i2c_detect => sub { adm1021_detect(@_, 4); }, 
    951951     }, 
    952952     { 
     
    954954       driver => "adm1021", 
    955955       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    956        i2c_detect => sub { adm1021_detect(5, @_); }, 
     956       i2c_detect => sub { adm1021_detect(@_, 5); }, 
    957957     }, 
    958958     { 
     
    960960       driver => "adm1021", 
    961961       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    962        i2c_detect => sub { adm1021_detect(6, @_); }, 
     962       i2c_detect => sub { adm1021_detect(@_, 6); }, 
    963963     }, 
    964964     { 
     
    966966       driver => "adm1021", 
    967967       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    968        i2c_detect => sub { adm1021_detect(7, @_); }, 
     968       i2c_detect => sub { adm1021_detect(@_, 7); }, 
    969969     }, 
    970970     { 
     
    972972       driver => "max1619", 
    973973       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    974        i2c_detect => sub { max1619_detect(1, @_); }, 
     974       i2c_detect => sub { max1619_detect(@_, 1); }, 
    975975     }, 
    976976     { 
     
    978978       driver => "max1619", 
    979979       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    980        i2c_detect => sub { max1619_detect(0, @_); }, 
     980       i2c_detect => sub { max1619_detect(@_, 0); }, 
    981981     }, 
    982982     { 
     
    990990       driver => "lm90", 
    991991       i2c_addrs => [0x4c], 
    992        i2c_detect => sub { lm90_detect(0, @_); }, 
     992       i2c_detect => sub { lm90_detect(@_, 0); }, 
    993993     }, 
    994994     { 
     
    996996       driver => "lm90", 
    997997       i2c_addrs => [0x4c..0x4d], 
    998        i2c_detect => sub { lm90_detect(1, @_); }, 
     998       i2c_detect => sub { lm90_detect(@_, 1); }, 
    999999     }, 
    10001000     { 
     
    10021002       driver => "lm90", 
    10031003       i2c_addrs => [0x4c], 
    1004        i2c_detect => sub { lm90_detect(2, @_); }, 
     1004       i2c_detect => sub { lm90_detect(@_, 2); }, 
    10051005     }, 
    10061006     { 
     
    10081008       driver => "lm90", 
    10091009       i2c_addrs => [0x4c..0x4d], 
    1010        i2c_detect => sub { lm90_detect(3, @_); }, 
     1010       i2c_detect => sub { lm90_detect(@_, 3); }, 
    10111011     }, 
    10121012     { 
     
    10141014       driver => "to-be-written", # probably lm90 
    10151015       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    1016        i2c_detect => sub { lm90_detect(4, @_); }, 
     1016       i2c_detect => sub { lm90_detect(@_, 4); }, 
    10171017     }, 
    10181018     { 
     
    10321032       driver => "lm90", 
    10331033       i2c_addrs => [0x4d], 
    1034        i2c_detect => sub { lm90_detect(6, @_); }, 
     1034       i2c_detect => sub { lm90_detect(@_, 6); }, 
    10351035     }, 
    10361036     { 
     
    10381038       driver => "lm90", 
    10391039       i2c_addrs => [0x4e], 
    1040        i2c_detect => sub { lm90_detect(6, @_); }, 
     1040       i2c_detect => sub { lm90_detect(@_, 6); }, 
    10411041     }, 
    10421042     { 
     
    10441044       driver => "lm90", 
    10451045       i2c_addrs => [0x4c], 
    1046        i2c_detect => sub { lm90_detect(6, @_); }, 
     1046       i2c_detect => sub { lm90_detect(@_, 6); }, 
    10471047     }, 
    10481048     { 
     
    10501050       driver => "lm90", 
    10511051       i2c_addrs => [0x18..0x1a, 0x29..0x2b, 0x4c..0x4e], 
    1052        i2c_detect => sub { lm90_detect(7, @_); }, 
     1052       i2c_detect => sub { lm90_detect(@_, 7); }, 
    10531053     }, 
    10541054     { 
     
    10561056       driver => "lm90", 
    10571057       i2c_addrs => [0x4c], 
    1058        i2c_detect => sub { lm90_detect(8, @_); }, 
     1058       i2c_detect => sub { lm90_detect(@_, 8); }, 
    10591059     }, 
    10601060     { 
     
    10621062       driver => "tmp401", 
    10631063       i2c_addrs => [0x4c], 
    1064        i2c_detect => sub { lm90_detect(9, @_); }, 
     1064       i2c_detect => sub { lm90_detect(@_, 9); }, 
    10651065     }, 
    10661066     { 
     
    10681068       driver => "to-be-written", 
    10691069       i2c_addrs => [0x4c..0x4e], 
    1070        i2c_detect => sub { lm90_detect(10, @_); }, 
     1070       i2c_detect => sub { lm90_detect(@_, 10); }, 
    10711071     }, 
    10721072     { 
     
    10801080       driver => "lm63", 
    10811081       i2c_addrs => [0x4c], 
    1082        i2c_detect => sub { lm63_detect(1, @_); }, 
     1082       i2c_detect => sub { lm63_detect(@_, 1); }, 
    10831083     }, 
    10841084     { 
     
    10861086       driver => "to-be-written", # lm63 
    10871087       i2c_addrs => [0x18, 0x4e], 
    1088        i2c_detect => sub { lm63_detect(3, @_); }, 
     1088       i2c_detect => sub { lm63_detect(@_, 3); }, 
    10891089     }, 
    10901090     { 
     
    10921092       driver => "lm63", # Not yet 
    10931093       i2c_addrs => [0x4c], 
    1094        i2c_detect => sub { lm63_detect(2, @_); }, 
     1094       i2c_detect => sub { lm63_detect(@_, 2); }, 
    10951095     }, 
    10961096     { 
     
    10981098       driver => "lm92", 
    10991099       i2c_addrs => [0x48..0x4b], 
    1100        i2c_detect => sub { lm92_detect(0, @_); }, 
     1100       i2c_detect => sub { lm92_detect(@_, 0); }, 
    11011101     }, 
    11021102     { 
     
    11041104       driver => "lm92", 
    11051105       i2c_addrs => [0x48..0x4b], 
    1106        i2c_detect => sub { lm92_detect(1, @_); }, 
     1106       i2c_detect => sub { lm92_detect(@_, 1); }, 
    11071107     }, 
    11081108     { 
     
    11121112                                  # don't want to probe these addresses, it's 
    11131113                                  # dangerous. 
    1114        i2c_detect => sub { lm92_detect(2, @_); }, 
     1114       i2c_detect => sub { lm92_detect(@_, 2); }, 
    11151115     }, 
    11161116     { 
     
    11181118       driver => "lm90", 
    11191119       i2c_addrs => [0x4c..0x4d], 
    1120        i2c_detect => sub { lm90_detect(5, @_); }, 
     1120       i2c_detect => sub { lm90_detect(@_, 5); }, 
    11211121     }, 
    11221122     { 
     
    11361136       driver => "adm1031", 
    11371137       i2c_addrs => [0x2c..0x2e], 
    1138        i2c_detect => sub { adm1031_detect(0, @_); }, 
     1138       i2c_detect => sub { adm1031_detect(@_, 0); }, 
    11391139     }, 
    11401140     { 
     
    11421142       driver => "adm1031", 
    11431143       i2c_addrs => [0x2c..0x2e], 
    1144        i2c_detect => sub { adm1031_detect(1, @_); }, 
     1144       i2c_detect => sub { adm1031_detect(@_, 1); }, 
    11451145     }, 
    11461146     { 
     
    11481148       driver => "to-be-written", 
    11491149       i2c_addrs => [0x50..0x53], 
    1150        i2c_detect => sub { adm1034_detect(0, @_); }, 
     1150       i2c_detect => sub { adm1034_detect(@_, 0); }, 
    11511151     }, 
    11521152     { 
     
    11541154       driver => "to-be-written", 
    11551155       i2c_addrs => [0x50..0x53], 
    1156        i2c_detect => sub { adm1034_detect(1, @_); }, 
     1156       i2c_detect => sub { adm1034_detect(@_, 1); }, 
    11571157     }, 
    11581158     { 
     
    11601160       driver => "thmc50", 
    11611161       i2c_addrs => [0x2c..0x2e], 
    1162        i2c_detect => sub { adm1022_detect(0, @_); }, 
     1162       i2c_detect => sub { adm1022_detect(@_, 0); }, 
    11631163     }, 
    11641164     { 
     
    11661166       driver => "thmc50", 
    11671167       i2c_addrs => [0x2c..0x2e], 
    1168        i2c_detect => sub { adm1022_detect(1, @_); }, 
     1168       i2c_detect => sub { adm1022_detect(@_, 1); }, 
    11691169     }, 
    11701170     { 
     
    11721172       driver => "thmc50", 
    11731173       i2c_addrs => [0x2e], 
    1174        i2c_detect => sub { adm1022_detect(2, @_); }, 
     1174       i2c_detect => sub { adm1022_detect(@_, 2); }, 
    11751175     }, 
    11761176     { 
     
    11781178       driver => "to-be-written", # thmc50 
    11791179       i2c_addrs => [0x2e], # At least (no datasheet) 
    1180        i2c_detect => sub { adm1022_detect(3, @_); }, 
     1180       i2c_detect => sub { adm1022_detect(@_, 3); }, 
    11811181     }, 
    11821182     { 
     
    12171217       driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscpos" }, 
    12181218       i2c_addrs => [0x73], 
    1219        i2c_detect => sub { fsc_detect(0, @_); }, 
     1219       i2c_detect => sub { fsc_detect(@_, 0); }, 
    12201220     }, 
    12211221     { 
     
    12231223       driver => "to-be-written", 
    12241224       i2c_addrs => [0x73], 
    1225        i2c_detect => sub { fsc_detect(1, @_); }, 
     1225       i2c_detect => sub { fsc_detect(@_, 1); }, 
    12261226     }, 
    12271227     { 
     
    12291229       driver => "fschmd", 
    12301230       i2c_addrs => [0x73], 
    1231        i2c_detect => sub { fsc_detect(2, @_); }, 
     1231       i2c_detect => sub { fsc_detect(@_, 2); }, 
    12321232     }, 
    12331233     { 
     
    12351235       driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscher" }, 
    12361236       i2c_addrs => [0x73], 
    1237        i2c_detect => sub { fsc_detect(3, @_); }, 
     1237       i2c_detect => sub { fsc_detect(@_, 3); }, 
    12381238     }, 
    12391239     { 
     
    12411241       driver => "fschmd", 
    12421242       i2c_addrs => [0x73], 
    1243        i2c_detect => sub { fsc_detect(4, @_); }, 
     1243       i2c_detect => sub { fsc_detect(@_, 4); }, 
    12441244     }, 
    12451245     { 
     
    12471247       driver => "fschmd", 
    12481248       i2c_addrs => [0x73], 
    1249        i2c_detect => sub { fsc_detect(5, @_); }, 
     1249       i2c_detect => sub { fsc_detect(@_, 5); }, 
    12501250     }, 
    12511251     { 
     
    12651265       driver => "dme1737", 
    12661266       i2c_addrs => [0x2c..0x2e], 
    1267        i2c_detect => sub { dme1737_detect(1, @_); }, 
     1267       i2c_detect => sub { dme1737_detect(@_, 1); }, 
    12681268     }, 
    12691269     { 
     
    12711271       driver => "dme1737", 
    12721272       i2c_addrs => [0x2c..0x2e], 
    1273        i2c_detect => sub { dme1737_detect(2, @_); }, 
     1273       i2c_detect => sub { dme1737_detect(@_, 2); }, 
    12741274     }, 
    12751275     { 
     
    12771277       driver => "not-a-sensor", 
    12781278       i2c_addrs => [0x4e], # 0x37 not probed 
    1279        i2c_detect => sub { fintek_detect(1, @_); }, 
     1279       i2c_detect => sub { fintek_detect(@_, 1); }, 
    12801280     }, 
    12811281     { 
     
    12831283       driver => "to-be-written", 
    12841284       i2c_addrs => [0x4e], # 0x37 not probed 
    1285        i2c_detect => sub { fintek_detect(2, @_); }, 
     1285       i2c_detect => sub { fintek_detect(@_, 2); }, 
    12861286     }, 
    12871287     { 
     
    12891289       driver => "f75375s", 
    12901290       i2c_addrs => [0x2d..0x2e], 
    1291        i2c_detect => sub { fintek_detect(3, @_); }, 
     1291       i2c_detect => sub { fintek_detect(@_, 3); }, 
    12921292     }, 
    12931293     { 
     
    12951295       driver => "f75375s", 
    12961296       i2c_addrs => [0x2d..0x2e], 
    1297        i2c_detect => sub { fintek_detect(4, @_); }, 
     1297       i2c_detect => sub { fintek_detect(@_, 4); }, 
    12981298     }, 
    12991299     { 
     
    13011301       driver => "to-be-written", 
    13021302       i2c_addrs => [0x2d..0x2e], 
    1303        i2c_detect => sub { fintek_detect(5, @_); }, 
     1303       i2c_detect => sub { fintek_detect(@_, 5); }, 
    13041304     }, 
    13051305     { 
     
    13071307       driver => "to-be-written", 
    13081308       i2c_addrs => [0x4c], 
    1309        i2c_detect => sub { fintek_detect(6, @_); }, 
     1309       i2c_detect => sub { fintek_detect(@_, 6); }, 
    13101310     }, 
    13111311     { 
     
    13131313       driver => "to-be-written", 
    13141314       i2c_addrs => [0x4d], 
    1315        i2c_detect => sub { fintek_detect(6, @_); }, 
     1315       i2c_detect => sub { fintek_detect(@_, 6); }, 
    13161316     }, 
    13171317     { 
     
    13191319       driver => "to-be-written", 
    13201320       i2c_addrs => [0x2f], 
    1321        i2c_detect => sub { fintek_detect(7, @_); }, 
     1321       i2c_detect => sub { fintek_detect(@_, 7); }, 
    13221322     }, 
    13231323     { 
     
    33723372# function was called is never returned. 
    33733373 
    3374  
    3375 # $_[0]: A reference to the file descriptor to access this chip. 
     3374# All I2C detection functions below take at least 2 parameters: 
     3375# $_[0]: Reference to the file descriptor to access the chip 
    33763376# $_[1]: Address 
    3377 # Returns: undef if not detected, (3) if detected. 
     3377# Some of these functions which can detect more than one type of device, 
     3378# take a third parameter: 
     3379# $_[2]: Chip to detect 
     3380 
    33783381# Registers used: 0x58 
    33793382sub mtp008_detect 
     
    33843387} 
    33853388 
    3386 # $_[0]: Chip to detect (0 = LM78, 2 = LM79) 
    3387 # $_[1]: A reference to the file descriptor to access this chip. 
    3388 # $_[2]: Address 
    3389 # Returns: undef if not detected, (6) if detected. 
     3389# Chip to detect: 0 = LM78, 2 = LM79 
    33903390# Registers used: 
    33913391#   0x40: Configuration 
     
    33943394sub lm78_detect 
    33953395{ 
     3396  my ($file, $addr, $chip) = @_; 
    33963397  my $reg; 
    3397   my ($chip, $file, $addr) = @_; 
    33983398  return unless i2c_smbus_read_byte_data($file, 0x48) == $addr; 
    33993399  return unless (i2c_smbus_read_byte_data($file, 0x40) & 0x80) == 0x00; 
     
    34093409} 
    34103410 
    3411 # $_[0]: Chip to detect (0 = LM75, 1 = DS75) 
    3412 # $_[1]: A reference to the file descriptor to access this chip. 
    3413 # $_[2]: Address (unused) 
    3414 # Returns: undef if not detected, 3 or 6 if detected; 
    3415 #   6 means that the temperatures make sense; 
    3416 #   3 means that the temperatures look strange; 
     3411# Chip to detect: 0 = LM75, 1 = DS75 
    34173412# Registers used: 
    34183413#   0x00: Temperature 
     
    34353430sub lm75_detect 
    34363431{ 
     3432  my ($file, $addr, $chip) = @_; 
    34373433  my $i; 
    3438   my ($chip, $file, $addr) = @_; 
    34393434  my $cur = i2c_smbus_read_byte_data($file, 0x00); 
    34403435  my $conf = i2c_smbus_read_byte_data($file, 0x01); 
     
    34723467} 
    34733468 
    3474 # $_[0]: A reference to the file descriptor to access this chip. 
    3475 # $_[1]: Address 
    3476 # Returns: undef if not detected, 3 or 6 if detected; 
    3477 #   6 means that the temperatures make sense; 
    3478 #   3 means that the temperatures look strange; 
    34793469# Registers used: 
    34803470#   0x00: Temperature 
     
    34973487sub lm77_detect 
    34983488{ 
     3489  my ($file, $addr) = @_; 
    34993490  my $i; 
    3500   my ($file, $addr) = @_; 
    35013491  my $cur = i2c_smbus_read_byte_data($file, 0x00); 
    35023492  my $conf = i2c_smbus_read_byte_data($file, 0x01); 
     
    35563546} 
    35573547 
    3558 # $_[0]: Chip to detect (0 = LM92, 1 = LM76, 2 = MAX6633/MAX6634/MAX6635) 
    3559 # $_[1]: A reference to the file descriptor to access this chip. 
    3560 # $_[2]: Address 
    3561 # Returns: undef if not detected, 2 or 4 if detected; 
     3548# Chip to detect: 0 = LM92, 1 = LM76, 2 = MAX6633/MAX6634/MAX6635 
    35623549# Registers used: 
    35633550#   0x01: Configuration (National Semiconductor only) 
     
    35763563sub lm92_detect 
    35773564{ 
    3578   my ($chip, $file, $addr) = @_; 
     3565  my ($file, $addr, $chip) = @_; 
    35793566 
    35803567  my $conf = i2c_smbus_read_byte_data($file, 0x01); 
     
    36213608} 
    36223609 
    3623 # $_[0]: A reference to the file descriptor to access this chip. 
    3624 # $_[1]: Address 
    3625 # Returns: undef if not detected, 3 if detected 
    36263610# Registers used: 
    36273611#   0xAA: Temperature 
     
    36653649} 
    36663650 
    3667 # $_[0]: A reference to the file descriptor to access this chip. 
    3668 # $_[1]: Address 
    3669 # Returns: undef if not detected, 1 to 3 if detected. 
    36703651# Registers used: 
    36713652#   0x00: Configuration register 
     
    36853666sub lm80_detect 
    36863667{ 
     3668  my ($file, $addr) = @_; 
    36873669  my ($i, $reg); 
    3688   my ($file, $addr) = @_; 
    36893670 
    36903671  return if (i2c_smbus_read_byte_data($file, 0x00) & 0x80) != 0; 
     
    37253706} 
    37263707 
    3727 # $_[0]: A reference to the file descriptor to access this chip. 
    3728 # $_[1]: Address 
    3729 # Returns: undef if not detected, 4 to 8 if detected. 
    37303708# Registers used: 
    37313709#   0x02: Status 1 
     
    37633741} 
    37643742 
    3765 # $_[0]: Chip to detect 
    3766 #   (0 = LM90, 1 = LM89/LM99, 2 = LM86, 3 = ADM1032, 4 = MAX6654/MAX6690, 
    3767 #    5 = ADT7461, 6 = MAX6646/MAX6647/MAX6648/MAX6649/MAX6692, 
    3768 #    7 = MAX6680/MAX6681, 8 = W83L771W/G, 9 = TMP401, 10 = TMP411) 
    3769 # $_[1]: A reference to the file descriptor to access this chip. 
    3770 # $_[2]: Address 
    3771 # Returns: undef if not detected, 6 or 8 if detected. 
     3743# Chip to detect: 0 = LM90, 1 = LM89/LM99, 2 = LM86, 3 = ADM1032, 
     3744#                 4 = MAX6654/MAX6690, 5 = ADT7461, 
     3745#                 6 = MAX6646/MAX6647/MAX6648/MAX6649/MAX6692, 
     3746#                 7 = MAX6680/MAX6681, 8 = W83L771W/G, 9 = TMP401, 10 = TMP411 
    37723747# Registers used: 
    37733748#   0x03: Configuration 
     
    37773752sub lm90_detect 
    37783753{ 
    3779   my ($chip, $file, $addr) = @_; 
     3754  my ($file, $addr, $chip) = @_; 
    37803755  my $mid = i2c_smbus_read_byte_data($file, 0xfe); 
    37813756  my $cid = i2c_smbus_read_byte_data($file, 0xff); 
     
    38643839} 
    38653840 
    3866 # $_[0]: A reference to the file descriptor to access this chip. 
    3867 # $_[1]: Address 
    3868 # Returns: undef if not detected, 5 if detected. 
    38693841# Registers used: 
    38703842#   0x03: Configuration (no low nibble) 
     
    38963868} 
    38973869 
    3898 # $_[0]: A reference to the file descriptor to access this chip. 
    3899 # $_[1]: Address 
    3900 # Returns: undef if not detected, 6 if detected. 
    39013870# Registers used: 
    39023871#   0x03: Configuration 
     
    39173886} 
    39183887 
    3919 # $_[0]: A reference to the file descriptor to access this chip. 
    3920 # $_[1]: Address 
    3921 # Returns: undef if not detected, 6 if detected. 
    39223888# Registers used: 
    39233889#   0x03: Configuration 1 
     
    39413907} 
    39423908 
    3943 # $_[0]: Chip to detect 
    3944 #   (1 = LM63, 2 = F75363SG, 3 = LM64) 
    3945 # $_[1]: A reference to the file descriptor to access this chip. 
    3946 # $_[2]: Address (unused) 
    3947 # Returns: undef if not detected, 6 if detected. 
     3909# Chip to detect: 1 = LM63, 2 = F75363SG, 3 = LM64 
    39483910# Registers used: 
    39493911#   0xfe: Manufacturer ID 
     
    39533915sub lm63_detect 
    39543916{ 
    3955   my ($chip, $file, $addr) = @_; 
     3917  my ($file, $addr, $chip) = @_; 
    39563918 
    39573919  my $mid = i2c_smbus_read_byte_data($file, 0xfe); 
     
    39803942} 
    39813943 
    3982 # $_[0]: A reference to the file descriptor to access this chip. 
    3983 # $_[1]: Address (unused) 
    3984 # Returns: undef if not detected, 6 if detected. 
    39853944# Registers used: 
    39863945#   0x02, 0x03: Fan support 
     
    40123971} 
    40133972 
    4014 # $_[0]: Chip to detect 
    4015 #   (0 = ADM1030, 1=ADM1031) 
    4016 # $_[1]: A reference to the file descriptor to access this chip. 
    4017 # $_[2]: Address 
    4018 # Returns: undef if not detected, 3 to 7 (ADM1031) or 9 (ADM1030) 
    4019 #          if detected. 
     3973# Chip to detect: 0 = ADM1030, 1 = ADM1031 
    40203974# Registers used: 
    40213975#   0x01: Config 2 
     
    40283982sub adm1031_detect 
    40293983{ 
    4030   my ($chip, $file, $addr) = @_; 
     3984  my ($file, $addr, $chip) = @_; 
    40313985  my $mid = i2c_smbus_read_byte_data($file, 0x3e); 
    40323986  my $cid = i2c_smbus_read_byte_data($file, 0x3d); 
     
    40634017} 
    40644018 
    4065 # $_[0]: Chip to detect 
    4066 #   (0 = ADM1033, 1 = ADM1034) 
    4067 # $_[1]: A reference to the file descriptor to access this chip. 
    4068 # $_[2]: Address (unused) 
    4069 # Returns: undef if not detected, 4 or 6 if detected. 
     4019# Chip to detect: 0 = ADM1033, 1 = ADM1034 
    40704020# Registers used: 
    40714021#   0x3d: Chip ID 
     
    40744024sub adm1034_detect 
    40754025{ 
    4076   my ($chip, $file, $addr) = @_; 
     4026  my ($file, $addr, $chip) = @_; 
    40774027  my $mid = i2c_smbus_read_byte_data($file, 0x3e); 
    40784028  my $cid = i2c_smbus_read_byte_data($file, 0x3d); 
     
    40964046} 
    40974047 
    4098 # $_[0]: Chip to detect 
    4099 #   (0 = ADT7467/ADT7468, 1 = ADT7476, 2 = ADT7462, 3 = ADT7466, 
    4100 #    4 = ADT7470) 
    4101 # $_[1]: A reference to the file descriptor to access this chip. 
    4102 # $_[2]: Address 
    4103 # Returns: undef if not detected, 5 or 7 if detected. 
     4048# Chip to detect: 0 = ADT7467/ADT7468, 1 = ADT7476, 2 = ADT7462, 3 = ADT7466, 
     4049#                 4 = ADT7470 
    41044050# Registers used: 
    41054051#   0x3d: Chip ID 
     
    41084054sub adt7467_detect 
    41094055{ 
    4110   my ($chip, $file, $addr) = @_; 
     4056  my ($file, $addr, $chip) = @_; 
    41114057  my $mid = i2c_smbus_read_byte_data($file, 0x3e); 
    41124058  my $cid = i2c_smbus_read_byte_data($file, 0x3d); 
     
    41514097} 
    41524098 
    4153 # $_[0]: Chip to detect 
    4154 #   (0 = ADT7473, 1 = ADT7475) 
    4155 # $_[1]: A reference to the file descriptor to access this chip. 
    4156 # $_[2]: Address (unused) 
    4157 # Returns: undef if not detected, 5 if detected. 
     4099# Chip to detect: 0 = ADT7473, 1 = ADT7475 
    41584100# Registers used: 
    41594101#   0x3d: Chip ID 
     
    41614103sub adt7473_detect 
    41624104{ 
    4163   my ($chip, $file, $addr) = @_; 
     4105  my ($file, $addr, $chip) = @_; 
    41644106  my $mid = i2c_smbus_read_byte_data($file, 0x3e); 
    41654107  my $cid = i2c_smbus_read_byte_data($file, 0x3d); 
     
    41784120} 
    41794121 
    4180 # $_[0]: Chip to detect 
    4181 #   (0 = aSC7512, 1 = aSC7611, 2 = aSC7621) 
    4182 # $_[1]: A reference to the file descriptor to access this chip. 
    4183 # $_[2]: Address (unused) 
    4184 # Returns: undef if not detected, 1 if detected. 
     4122# Chip to detect: 0 = aSC7512, 1 = aSC7611, 2 = aSC7621 
    41854123# Registers used: 
    41864124#   0x3e: Manufacturer ID (0x61) 
    41874125#   0x3f: Version 
    4188  
    41894126sub andigilog_detect 
    41904127{ 
    4191   my ($chip, $file, $addr) = @_; 
     4128  my ($file, $addr, $chip) = @_; 
    41924129  my $mid = i2c_smbus_read_byte_data($file, 0x3e); 
    41934130  my $cid = i2c_smbus_read_byte_data($file, 0x3f); 
     
    42134150} 
    42144151 
    4215 # $_[0]: A reference to the file descriptor to access this chip. 
    4216 # $_[1]: Address (unused) 
    4217 # Returns: undef if not detected, 1 if detected. 
    42184152# Registers used: 
    42194153#   0xfe: Manufacturer ID 
     
    42334167} 
    42344168 
    4235 # $_[0]: Chip to detect 
    4236 #   (0 = LM85, 1 = LM96000, 2 = ADM1027, 3 = ADT7463, 
    4237 #    4 = EMC6D100/101, 5 = EMC6D102, 6 = EMC6D103) 
    4238 # $_[1]: A reference to the file descriptor to access this chip. 
    4239 # #_[2]: Base address. 
    4240 # Returns: undef if not detected, (7) or (8) if detected. 
     4169# Chip to detect: 0 = LM85, 1 = LM96000, 2 = ADM1027, 3 = ADT7463, 
     4170#                 4 = EMC6D100/101, 5 = EMC6D102, 6 = EMC6D103 
    42414171# Registers used: 0x3e == Vendor register. 
    42424172#                 0x3d == Device ID register (Analog Devices only). 
    42434173#                 0x3f == Version/Stepping register. 
    4244 # Constants used: 0x01 == National Semiconductor Vendor Id. 
    4245 #                 0x41 == Analog Devices Vendor Id. 
    4246 #                 0x5c == SMSC Vendor Id. 
    42474174sub lm85_detect 
    42484175{ 
    4249   my ($chip, $file, $addr) = @_; 
     4176  my ($file, $addr, $chip) = @_; 
    42504177  my $vendor = i2c_smbus_read_byte_data($file, 0x3e); 
    42514178  my $verstep = i2c_smbus_read_byte_data($file, 0x3f); 
     
    42864213} 
    42874214 
    4288 # $_[0]: Chip to detect (0 = LM87, 1 = ADM1024) 
    4289 # $_[1]: A reference to the file descriptor to access this chip. 
    4290 # $_[2]: Address 
    4291 # Returns: undef if not detected, (7) if detected. 
     4215# Chip to detect: 0 = LM87, 1 = ADM1024 
    42924216# Registers used: 
    42934217#   0x3e: Company ID 
     
    42964220sub lm87_detect 
    42974221{ 
    4298   my ($chip, $file, $addr) = @_; 
     4222  my ($file, $addr, $chip) = @_; 
    42994223  my $cid = i2c_smbus_read_byte_data($file, 0x3e); 
    43004224  my $rev = i2c_smbus_read_byte_data($file, 0x3f); 
     
    43154239} 
    43164240 
    4317 # $_[0]: Chip to detect (0 = W83781D, 1 = W83782D, 2 = W83783S, 
    4318 #                        3 = W83627HF, 4 = AS99127F (rev.1), 
    4319 #                        5 = AS99127F (rev.2), 6 = ASB100, 7 = W83791D, 
    4320 #                        8 = W83792D, 9 = W83627EHF, 10 = W83627DHG) 
    4321 # $_[1]: A reference to the file descriptor to access this chip. 
    4322 # $_[2]: Address 
    4323 # Returns: undef if not detected, (8, addr1, addr2) if detected, but only 
    4324 #          if the LM75 chip emulation is enabled. 
     4241# Chip to detect: 0 = W83781D, 1 = W83782D, 2 = W83783S, 3 = W83627HF, 
     4242#                 4 = AS99127F (rev.1), 5 = AS99127F (rev.2), 6 = ASB100, 
     4243#                 7 = W83791D, 8 = W83792D, 9 = W83627EHF, 10 = W83627DHG 
    43254244# Registers used: 
    43264245#   0x48: Full I2C Address 
     
    43304249#   0x58: Device ID (only when in bank 0) 
    43314250# Note: Fails if the W8378xD is not in bank 0! 
    4332 # Note: Detection overrules a previous LM78 detection 
    43334251# Note: Asus chips do not have their I2C address at register 0x48? 
    43344252#       AS99127F rev.1 and ASB100 have 0x00, confirmation wanted for 
     
    43364254sub w83781d_detect 
    43374255{ 
     4256  my ($file, $addr, $chip) = @_; 
    43384257  my ($reg1, $reg2, @res); 
    4339   my ($chip, $file, $addr) = @_; 
    43404258 
    43414259  return unless (i2c_smbus_read_byte_data($file, 0x48) == $addr) 
     
    43794297} 
    43804298 
    4381 # $_[0]: A reference to the file descriptor to access this chip. 
    4382 # $_[1]: Address 
    4383 # Returns: undef if not detected 
    4384 #          6 if detected and bank different from 0 
    4385 #          (8, addr1, addr2) if detected, bank is 0 and LM75 chip emulation 
    4386 #          is enabled 
    43874299# Registers used: 
    43884300#   0x0b: Full I2C Address 
     
    43934305sub w83793_detect 
    43944306{ 
     4307  my ($file, $addr) = @_; 
    43954308  my ($bank, $reg, @res); 
    4396   my ($file, $addr) = @_; 
    43974309 
    43984310  $bank = i2c_smbus_read_byte_data($file, 0x00); 
     
    44174329} 
    44184330 
    4419 # $_[0]: A reference to the file descriptor to access this chip. 
    4420 # $_[1]: Address 
    4421 # Returns: undef if not detected, 3 if detected 
    44224331# Registers used: 
    44234332#   0x48: Full I2C Address 
     
    44484357} 
    44494358 
    4450 # $_[0]: Chip to detect (0 = ASM58, 1 = AS2K129R, 2 = ???) 
    4451 # $_[1]: A reference to the file descriptor to access this chip 
    4452 # $_[2]: Address (unused) 
    4453 # Returns: undef if not detected, 5 if detected 
     4359# Chip to detect: 0 = ASM58, 1 = AS2K129R, 2 = ??? 
    44544360# Registers used: 
    44554361#   0x4e: Vendor ID high byte 
     
    44604366sub mozart_detect 
    44614367{ 
     4368  my ($file, $addr, $chip) = @_; 
    44624369  my ($vid, $dev); 
    4463   my ($chip, $file, $addr) = @_; 
    44644370 
    44654371  $vid = (i2c_smbus_read_byte_data($file, 0x4e) << 8) 
     
    44744380} 
    44754381 
    4476 # $_[0]: Chip to detect (0 = Revision 0x00, 1 = Revision 0x80) 
    4477 # $_[1]: A reference to the file descriptor to access this chip. 
    4478 # $_[2]: Address 
    4479 # Returns: undef if not detected, (6) if detected. 
     4382# Chip to detect: 0 = Revision 0x00, 1 = Revision 0x80 
    44804383# Registers used: 
    44814384#   0x00: Device ID 
     
    44854388sub gl518sm_detect 
    44864389{ 
     4390  my ($file, $addr, $chip) = @_; 
    44874391  my $reg; 
    4488   my ($chip, $file, $addr) = @_; 
    44894392  return unless i2c_smbus_read_byte_data($file, 0x00) == 0x80; 
    44904393  return unless (i2c_smbus_read_byte_data($file, 0x03) & 0x80) == 0x00; 
     
    44954398} 
    44964399 
    4497 # $_[0]: A reference to the file descriptor to access this chip. 
    4498 # $_[1]: Address 
    4499 # Returns: undef if not detected, (5) if detected. 
    45004400# Registers used: 
    45014401#   0x00: Device ID 
     
    45134413} 
    45144414 
    4515 # $_[0]: A reference to the file descriptor to access this chip. 
    4516 # $_[1]: Address 
    4517 # Returns: undef if not detected, (5) if detected. 
    45184415# Registers used: 
    45194416#   0x00: Device ID 
     
    45264423} 
    45274424 
    4528 # $_[0]: Chip to detect (0 = ADM9240, 1 = DS1780, 2 = LM81) 
    4529 # $_[1]: A reference to the file descriptor to access this chip. 
    4530 # $_[2]: Address 
    4531 # Returns: undef if not detected, (7) if detected. 
     4425# Chip to detect: 0 = ADM9240, 1 = DS1780, 2 = LM81 
    45324426# Registers used: 
    45334427#   0x3e: Company ID 
    45344428#   0x40: Configuration 
    45354429#   0x48: Full I2C Address 
    4536 # Note: Detection overrules a previous LM78 detection 
    45374430sub adm9240_detect 
    45384431{ 
     4432  my ($file, $addr, $chip) = @_; 
    45394433  my $reg; 
    4540   my ($chip, $file, $addr) = @_; 
    45414434  $reg = i2c_smbus_read_byte_data($file, 0x3e); 
    45424435  return unless ($chip == 0 and $reg == 0x23) or 
     
    45494442} 
    45504443 
    4551 # $_[0]: Chip to detect (0 = ADM1022, 1 = THMC50, 2 = ADM1028, 
    4552 #                        3 = THMC51) 
    4553 # $_[1]: A reference to the file descriptor to access this chip. 
    4554 # $_[2]: Address 
    4555 # Returns: undef if not detected, (8) if detected. 
     4444# Chip to detect: 0 = ADM1022, 1 = THMC50, 2 = ADM1028, 3 = THMC51 
    45564445# Registers used: 
    45574446#   0x3e: Company ID 
    45584447#   0x3f: Revision 
    45594448#   0x40: Configuration 
    4560 # Note: Detection overrules a previous LM78 or ADM9240 detection 
    45614449sub adm1022_detect 
    45624450{ 
     4451  my ($file, $addr, $chip) = @_; 
    45634452  my $reg; 
    4564   my ($chip, $file, $addr) = @_; 
    45654453  $reg = i2c_smbus_read_byte_data($file, 0x3e); 
    45664454  return unless ($chip == 0 and $reg == 0x41) or 
     
    45794467} 
    45804468 
    4581 # $_[0]: Chip to detect (0 = ADM1025, 1 = NE1619) 
    4582 # $_[1]: A reference to the file descriptor to access this chip. 
    4583 # $_[2]: Address 
    4584 # Returns: undef if not detected, (8) if detected. 
     4469# Chip to detect: 0 = ADM1025, 1 = NE1619 
    45854470# Registers used: 
    45864471#   0x3e: Company ID 
     
    45894474#   0x41: Status 1 
    45904475#   0x42: Status 2 
    4591 # Note: Detection overrules a previous LM78 or ADM9240 detection 
    45924476sub adm1025_detect 
    45934477{ 
     4478  my ($file, $addr, $chip) = @_; 
    45944479  my $reg; 
    4595   my ($chip, $file, $addr) = @_; 
    45964480 
    45974481  $reg = i2c_smbus_read_byte_data($file, 0x3e); 
     
    46074491} 
    46084492 
    4609 # $_[0]: A reference to the file descriptor to access this chip. 
    4610 # $_[1]: Address 
    4611 # Returns: undef if not detected, (8) if detected. 
    46124493# Registers used: 
    46134494#   0x16: Company ID 
     
    46154496sub adm1026_detect 
    46164497{ 
     4498  my ($file, $addr) = @_; 
    46174499  my $reg; 
    4618   my ($file, $addr) = @_; 
    46194500  $reg = i2c_smbus_read_byte_data($file, 0x16); 
    46204501  return unless ($reg == 0x41); 
     
    46234504} 
    46244505 
    4625 # $_[0]: Chip to detect 
    4626 #   (0 = ADM1021, 1 = ADM1021A/ADM1023, 2 = MAX1617, 3 = MAX1617A, 4 = THMC10, 
    4627 #    5 = LM84, 6 = GL523, 7 = MC1066) 
    4628 # $_[1]: A reference to the file descriptor to access this chip. 
    4629 # $_[2]: Address 
    4630 # Returns: undef if not detected, 3 if simply detected, 5 if detected and 
    4631 #          manufacturer ID matches, 7 if detected and manufacturer ID and 
    4632 #          revision match 
     4506# Chip to detect: 0 = ADM1021, 1 = ADM1021A/ADM1023, 2 = MAX1617, 3 = MAX1617A, 
     4507#                 4 = THMC10, 5 = LM84, 6 = GL523, 7 = MC1066 
    46334508# Registers used: 
    46344509#   0x04: Company ID (LM84 only) 
     
    46434518sub adm1021_detect 
    46444519{ 
    4645   my ($chip, $file, $addr) = @_; 
     4520  my ($file, $addr, $chip) = @_; 
    46464521  my $man_id = i2c_smbus_read_byte_data($file, 0xfe); 
    46474522  my $rev = i2c_smbus_read_byte_data($file, 0xff); 
     
    47054580} 
    47064581 
    4707 # $_[0]: Chip to detect 
    4708 #   (0 = MAX1668, 1 = MAX1805, 2 = MAX1989) 
    4709 # $_[1]: A reference to the file descriptor to access this chip. 
    4710 #        We may assume an i2c_set_slave_addr was already done. 
    4711 # $_[2]: Address 
    4712 # Returns: undef if not detected, 7 if detected 
     4582# Chip to detect: 0 = MAX1668, 1 = MAX1805, 2 = MAX1989 
    47134583# Registers used: 
    47144584#   0xfe: Company ID 
     
    47164586sub max1668_detect 
    47174587{ 
    4718   my ($chip, $file, $addr) = @_; 
     4588  my ($file, $addr, $chip) = @_; 
    47194589  my $man_id = i2c_smbus_read_byte_data($file, 0xfe); 
    47204590  my $dev_id = i2c_smbus_read_byte_data($file, 0xff); 
     
    47284598} 
    47294599 
    4730 # $_[0]: Chip to detect 
    4731 #   (0 = MAX1619, 1 = MAX1618) 
    4732 # $_[1]: A reference to the file descriptor to access this chip. 
    4733 # $_[2]: Address 
    4734 # Returns: undef if not detected, 7 if detected 
     4600# Chip to detect: 0 = MAX1619, 1 = MAX1618 
    47354601# Registers used: 
    47364602#   0xfe: Company ID 
     
    47414607sub max1619_detect 
    47424608{ 
    4743   my ($chip, $file, $addr) = @_; 
     4609  my ($file, $addr, $chip) = @_; 
    47444610  my $man_id = i2c_smbus_read_byte_data($file, 0xfe); 
    47454611  my $dev_id = i2c_smbus_read_byte_data($file, 0xff); 
     
    47654631} 
    47664632 
    4767 # $_[0]: A reference to the file descriptor to access this chip. 
    4768 # $_[1]: Address (unused) 
    4769 # Returns: undef if not detected, 6 if detected. 
    47704633# Registers used: 
    47714634#   0x28: User ID 
    47724635#   0x29: User ID2 
    4773 #   0x2A: Version ID 
    4774  
    47754636sub ite_overclock_detect 
    47764637{ 
     
    47854646} 
    47864647 
    4787 # $_[0]: A reference to the file descriptor to access this chip. 
    4788 # $_[1]: Address 
    4789 # Returns: undef if not detected, 7 or 8 if detected (tops LM78). 
    47904648# Registers used: 
    47914649#   0x00: Configuration 
     
    47954653sub it8712_i2c_detect 
    47964654{ 
     4655  my ($file, $addr) = @_; 
    47974656  my $reg; 
    4798   my ($file, $addr) = @_; 
    47994657  return unless i2c_smbus_read_byte_data($file, 0x48) == $addr; 
    48004658  return unless (i2c_smbus_read_byte_data($file, 0x00) & 0x90) == 0x10; 
     
    48044662} 
    48054663 
    4806 # $_[0]: A reference to the file descriptor to access this chip 
    4807 # $_[1]: Address 
    4808 # Returns: 8 for a memory eeprom 
    48094664# Registers used: 
    48104665#   0-63: SPD Data and Checksum 
     
    48264681} 
    48274682 
    4828 # $_[0]: A reference to the file descriptor to access this chip. 
    4829 # $_[1]: Address 
    4830 # Returns: undef if not detected, 8 if detected. 
    48314683# Registers used: 
    48324684#   0x00..0x07: DDC signature 
     
    48484700} 
    48494701 
    4850 # $_[0]: Chip to detect (0 = Poseidon I, 1 = Poseidon II, 2 = Scylla, 
    4851 #                        3 = Hermes, 4 = Heimdal, 5 = Heracles) 
    4852 # $_[1]: A reference to the file descriptor to access this chip. 
    4853 # $_[2]: Address 
    4854 # Returns: undef if not detected, (8) if detected. 
     4702# Chip to detect: 0 = Poseidon I, 1 = Poseidon II, 2 = Scylla, 
     4703#                 3 = Hermes, 4 = Heimdal, 5 = Heracles 
    48554704# Registers used: 
    48564705#   0x00-0x02: Identification (3 capital ASCII letters) 
    48574706sub fsc_detect 
    48584707{ 
    4859   my ($chip, $file, $addr) = @_; 
     4708  my ($file, $addr, $chip) = @_; 
    48604709  my $id; 
    48614710 
     
    48744723} 
    48754724 
    4876 # $_[0]: A reference to the file descriptor to access this chip. 
    4877 # $_[1]: Address (unused) 
    4878 # Returns: undef if not detected, 5 if detected. 
    48794725# Registers used: 
    48804726#   0x3E: Manufacturer ID 
     
    48824728sub lm93_detect 
    48834729{ 
    4884   my $file = shift; 
     4730  my ($file, $addr) = @_; 
    48854731  return unless i2c_smbus_read_byte_data($file, 0x3E) == 0x01 
    48864732            and i2c_smbus_read_byte_data($file, 0x3F) == 0x73; 
     
    48884734} 
    48894735 
    4890 # $_[0]: A reference to the file descriptor to access this chip. 
    4891 # $_[1]: Address 
    4892 # Returns: undef if not detected, (7) if detected. 
    48934736# Registers used: 
    48944737#   0x3F: Revision ID 
     
    49174760} 
    49184761 
    4919 # $_[0]: A reference to the file descriptor to access this chip. 
    4920 # $_[1]: Address 
    4921 # Returns: undef if not detected, 5 or 6 if detected. 
    49224762# Registers used: 
    49234763#   0x3E: Manufacturer ID 
     
    49354775} 
    49364776 
    4937 # $_[0]: Chip to detect 
    4938 #        (1 = DME1737, 2 = SCH5027) 
    4939 # $_[1]: A reference to the file descriptor to access this chip. 
    4940 # $_[2]: Address 
    4941 # Returns: undef if not detected, 5 or 6 if detected. 
     4777# Chip to detect: 1 = DME1737, 2 = SCH5027 
    49424778# Registers used: 
    49434779#   0x3E: Manufacturer ID 
     
    49484784sub dme1737_detect 
    49494785{ 
    4950   my ($chip, $file, $addr) = @_; 
     4786  my ($file, $addr, $chip) = @_; 
    49514787  my $vendor = i2c_smbus_read_byte_data($file, 0x3E); 
    49524788  my $verstep = i2c_smbus_read_byte_data($file, 0x3F); 
     
    49664802} 
    49674803 
    4968 # $_[0]: Chip to detect 
    4969 #   (1 = F75111R/RG/N, 2 = F75121R/F75122R/RG, 3 = F75373S/SG, 
    4970 #    4 = F75375S/SP, 5 = F75387SG/RG, 6 = F75383M/S/F75384M/S, 
    4971 #    7 = custom power control IC) 
    4972 # $_[1]: A reference to the file descriptor to access this chip. 
    4973 # $_[2]: Address (unused) 
    4974 # Returns: undef if not detected, 7 if detected. 
     4804# Chip to detect: 1 = F75111R/RG/N, 2 = F75121R/F75122R/RG, 3 = F75373S/SG, 
     4805#                 4 = F75375S/SP, 5 = F75387SG/RG, 6 = F75383M/S/F75384M/S, 
     4806#                 7 = custom power control IC 
    49754807# Registers used: 
    49764808#   0x5A-0x5B: Chip ID 
     
    49784810sub fintek_detect 
    49794811{ 
    4980   my ($chip, $file, $addr) = @_; 
     4812  my ($file, $addr, $chip) = @_; 
    49814813  my $chipid = (i2c_smbus_read_byte_data($file, 0x5A) << 8) 
    49824814             | i2c_smbus_read_byte_data($file, 0x5B); 
     
    50094841# The address (0x0b) is specified by the SMBus standard so it's likely 
    50104842# that this really is a smart battery. 
    5011 # $_[0]: A reference to the file descriptor to access this chip. 
    5012 # $_[1]: Address 
    5013 # Returns: 5 
    50144843sub smartbatt_detect 
    50154844{ 
     
    50284857} 
    50294858 
    5030 # $_[0]: Chip to detect (0 = W83L784R/AR/G, 1 = W83L785R/G, 
    5031 #                        2 = W83L786NR/NG/R/G) 
    5032 # $_[1]: A reference to the file descriptor to access this chip. 
    5033 # $_[2]: Address 
    5034 # Returns: undef if not detected, 6 or 8 if detected 
     4859# Chip to detect: 0 = W83L784R/AR/G, 1 = W83L785R/G, 2 = W83L786NR/NG/R/G 
    50354860# Registers used: 
    50364861#   0x40: Configuration 
     
    50424867sub w83l784r_detect 
    50434868{ 
     4869  my ($file, $addr, $chip) = @_; 
    50444870  my ($reg, @res); 
    5045   my ($chip, $file, $addr) = @_; 
    50464871 
    50474872  return unless (i2c_smbus_read_byte_data($file, 0x40) & 0x80) == 0x00; 
     
    50654890} 
    50664891 
    5067 # $_[0]: A reference to the file descriptor to access this chip. 
    5068 # $_[1]: Address 
    5069 # Returns: undef if not detected, 8 if detected 
    50704892# Registers used: 
    50714893#   0x4C-4E: Mfr and Chip ID 
     
    50794901} 
    50804902 
    5081 # $_[0]: A reference to the file descriptor to access this chip. 
    5082 # $_[1]: Address 
    5083 # Returns: undef if not detected, 3 if detected. 
    5084 # 
    50854903# The max6650 has no device ID register. However, a few registers have 
    50864904# spare bits, which are documented as being always zero on read. We read 
     
    51114929} 
    51124930 
    5113 # $_[0]: A reference to the file descriptor to access this chip. 
    5114 # $_[1]: Address. 
    5115 # 
    5116 # Returns: undef if not detected, 6 if detected. 
    51174931sub max6655_detect 
    51184932{ 
     
    51324946} 
    51334947 
    5134 # $_[0]: A reference to the file descriptor to access this chip. 
    5135 # $_[1]: Address 
    5136 # 
    51374948# This isn't very good detection. 
    51384949# Verify the i2c address, and the stepping ID (which is 0xb0 on 
    51394950# my chip but could be different for others... 
    5140 # 
    51414951sub vt1211_i2c_detect 
    51424952{