linux/drivers/hwmon/sch5627.c
<<
aluealuealo/spa.14alospa. class="lxr_search">aluealuealuealue typ Search14 aluealo/spa.14uealoinput typ aue4 odiv id/ /1o/a>ospa. class="comment">/***************************************************************************o/spa.14/ /2o/a>ospa. class="comment"> */ /Copyright (C) 2010-2012 Hans de Goede <hdegoede@redhat.com> *o/spa.14/ /3o/a>ospa. class="comment"> */ ///////////////////////////////////////////////////////////////////////*o/spa.14/ /4o/a>ospa. class="comment"> */ /This program is free software; you ca. redistribute it and/or modify//*o/spa.14/ /5o/a>ospa. class="comment"> */ /it under the terms of the GNU General Public License as published by//*o/spa.14/ /6o/a>ospa. class="comment"> */ /the Free Software Founda v3.; either verson> 2 of the License, or ////*o/spa.14/ /7o/a>ospa. class="comment"> */ /(at your v3.) any later verson>.///////////////////////////////////*o/spa.14/ /8o/a>ospa. class="comment"> */ ///////////////////////////////////////////////////////////////////////*o/spa.14/ /9o/a>ospa. class="comment"> */ /This program is distributed in the hope that/it will be useful,///////*o/spa.14/ a>ospa. class="comment"> */ /but WITHOUT ANY WARRANTY; without even the implied warranty of ///////*o/spa.14/ 11o/a>ospa. class="comment"> */ /MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.//See the ///////*o/spa.14/ 12o/a>ospa. class="comment"> */ /GNU General Public License for more details.//////////////////////////*o/spa.14/ 13o/a>ospa. class="comment"> */ ///////////////////////////////////////////////////////////////////////*o/spa.14/ 14o/a>ospa. class="comment"> */ /You should have received a copy of the GNU General Public License ////*o/spa.14/ 15o/a>ospa. class="comment"> */ /along with this program; if not, write to the ///////////////////////*o/spa.14/ 16o/a>ospa. class="comment"> */ /Free Software Founda v3., Inc., /////////////////////////////////////*o/spa.14/ 17o/a>ospa. class="comment"> */ /59 Temple Place - Suite 330, Bost3., MA 02111-1307, USA./////////////*o/spa.14/ 18o/a>ospa. class="comment"> ***************************************************************************/o/spa.14/ 19o/a>4/ 2 a>#define/oa href="+code=pr_fmt" class="sref">pr_fmt a>(oa href="+code=fmt" class="sref">fmt a>)/oa href="+code=KBUILD_MODNAME" class="sref">KBUILD_MODNAME a> ospa. class="string">": "o/spa.1/oa href="+code=fmt" class="sref">fmt a>4/ 21 a>4/ 22o/a>#include <linux/module.ho/a>>4/ 23o/a>#include <linux/init.ho/a>>4/ 24o/a>#include <linux/slab.ho/a>>4/ 25o/a>#include <linux/jiffies.ho/a>>4/ 26o/a>#include <linux/platform_device.ho/a>>4/ 27o/a>#include <linux/hwmon.ho/a>>4/ 28o/a>#include <linux/hwmon-sysfs.ho/a>>4/ 29o/a>#include <linux/err.ho/a>>4/ 30o/a>#include <linux/mutex.ho/a>>4/ 31o/a>#include "oa href="drivers/hwmon/sch56xx-common.h" class="fref">sch56xx-common.ho/a>"4/ 32 a>4/ 33 a>#define/oa href="+code=DRVNAME" class="sref">DRVNAME a> ospa. class="string">"sch5627"o/spa.14/ 34 a>#define/oa href="+code=DEVNAME" class="sref">DEVNAME a> oa href="+code=DRVNAME" class="sref">DRVNAME a> ospa. class="comment">/* We only support one model */o/spa.14/ 35 a>4/ 36 a>#define/oa href="+code=SCH5627_HWMON_ID" class="sref">SCH5627_HWMON_ID a> 0xa54/ 37 a>#define/oa href="+code=SCH5627_COMPANY_ID" class="sref">SCH5627_COMPANY_ID a> 0x5c4/ 38 a>#define/oa href="+code=SCH5627_PRIMARY_ID" class="sref">SCH5627_PRIMARY_ID a> 0xa04/ 39o/a>4/ 4 a>#define/oa href="+code=SCH5627_REG_BUILD_CODE" class="sref">SCH5627_REG_BUILD_CODE a> 0x394/ 41 a>#define/oa href="+code=SCH5627_REG_BUILD_ID" class="sref">SCH5627_REG_BUILD_ID a> 0x3a4/ 42 a>#define/oa href="+code=SCH5627_REG_HWMON_ID" class="sref">SCH5627_REG_HWMON_ID a> 0x3c4/ 43 a>#define/oa href="+code=SCH5627_REG_HWMON_REV" class="sref">SCH5627_REG_HWMON_REV a> 0x3d4/ 44 a>#define/oa href="+code=SCH5627_REG_COMPANY_ID" class="sref">SCH5627_REG_COMPANY_ID a> 0x3e4/ 45 a>#define/oa href="+code=SCH5627_REG_PRIMARY_ID" class="sref">SCH5627_REG_PRIMARY_ID a> 0x3f4/ 46 a>#define/oa href="+code=SCH5627_REG_CTRL" class="sref">SCH5627_REG_CTRL a> 0x404/ 47o/a>4/ 48 a>#define/oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a> 84/ 49 a>#define/oa href="+code=SCH5627_NO_FANS" class="sref">SCH5627_NO_FANS a> 44/ 5 a>#define/oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a> / 54/ 51 a>4/ 52 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_TEMP_MSB" class="sref">SCH5627_REG_TEMP_MSBo/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>] = {4/ 53 a> 0x2B, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x180, 0x181 };4/ 54 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_TEMP_LSN" class="sref">SCH5627_REG_TEMP_LSNo/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>] = {4/ 55 a> 0xE2, 0xE1, 0xE1, 0xE5, 0xE5, 0xE6, 0x182, 0x182 };4/ 56 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_TEMP_HIGH_NIBBLE" class="sref">SCH5627_REG_TEMP_HIGH_NIBBLEo/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>] = {4/ 57 a> 0, 0, 1, 1, 0, 0, 0, 1 };4/ 58 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_TEMP_HIGH" class="sref">SCH5627_REG_TEMP_HIGHo/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>] = {4/ 59 a> 0x61, 0x57, 0x59, 0x5B, 0x5D, 0x5F, 0x184, 0x186 };4/ 60 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_TEMP_ABS" class="sref">SCH5627_REG_TEMP_ABSo/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>] = {4/ 61 a> 0x9B, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x1A8, 0x1A9 };4/ 62 a>4/ 63 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_FAN" class="sref">SCH5627_REG_FANo/a>[oa href="+code=SCH5627_NO_FANS" class="sref">SCH5627_NO_FANS a>] = {4/ 64 a> 0x2C, 0x2E, 0x30, 0x32 };4/ 65 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_FAN_MIN" class="sref">SCH5627_REG_FAN_MINo/a>[oa href="+code=SCH5627_NO_FANS" class="sref">SCH5627_NO_FANS a>] = {4/ 66 a> 0x62, 0x64, 0x66, 0x68 };4/ 67o/a>4/ 68 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_IN_MSB" class="sref">SCH5627_REG_IN_MSBo/a>[oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a>] = {4/ 69 a> 0x22, 0x23, 0x24, 0x25, 0x189 };4/ 70 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_IN_LSN" class="sref">SCH5627_REG_IN_LSNo/a>[oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a>] = {4/ 71 a> 0xE4, 0xE4, 0xE3, 0xE3, 0x18A };4/ 72 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_IN_HIGH_NIBBLE" class="sref">SCH5627_REG_IN_HIGH_NIBBLEo/a>[oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a>] = {4/ 73 a> 1, 0, 1, 0, 1 };4/ 74 a>static const/oa href="+code=u16" class="sref">u16o/a>/oa href="+code=SCH5627_REG_IN_FACTOR" class="sref">SCH5627_REG_IN_FACTORo/a>[oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a>] = {4/ 75 a> 10745, 3660, 9765, 10745, 3660 };4/ 76 a>static const/char * const/oa href="+code=SCH5627_IN_LABELS" class="sref">SCH5627_IN_LABELSo/a>[oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a>] = {4/ 77 a> ospa. class="string">"VCC"o/spa.1, ospa. class="string">"VTT"o/spa.1, ospa. class="string">"VBAT"o/spa.1, ospa. class="string">"VTR"o/spa.1, ospa. class="string">"V_IN"o/spa.1/};4/ 78o/a>4/ 79 a>struct/oa href="+code=sch5627_data" class="sref">sch5627_data a> {4/ 80 a> unsigned short/oa href="+code=addr" class="sref">addr a>;4/ 81 a> struct/oa href="+code=device" class="sref">device a> *oa href="+code=hwmon_dev" class="sref">hwmon_dev a>;4/ 82 a> struct/oa href="+code=sch56xx_watchdog_data" class="sref">sch56xx_watchdog_data a> *oa href="+code=watchdog" class="sref">watchdog a>;4/ 83 a> oa href="+code=u8" class="sref">u8o/a>/oa href="+code=control" class="sref">control a>;4/ 84 a> oa href="+code=u8" class="sref">u8o/a>/oa href="+code=temp_max" class="sref">temp_maxo/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>];4/ 85 a> oa href="+code=u8" class="sref">u8o/a>/oa href="+code=temp_crit" class="sref">temp_crito/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>];4/ 86 a> oa href="+code=u16" class="sref">u16o/a>/oa href="+code=fan_min" class="sref">fan_mino/a>[oa href="+code=SCH5627_NO_FANS" class="sref">SCH5627_NO_FANS a>];4/ 87o/a>4/ 88 a> struct/oa href="+code=mutex" class="sref">mutexo/a>/oa href="+code=update_lock" class="sref">update_lock a>;4/ 89 a> unsigned long oa href="+code=last_battery" class="sref">last_battery a>; ospa. class="comment">/* In jiffies */o/spa.14/ 90 a> char oa href="+code=valid" class="sref">valid a>; ospa. class="comment">/* !=0 if following fields are valid */o/spa.14/ 91 a> unsigned long oa href="+code=last_updated" class="sref">last_updated a>; ospa. class="comment">/* In jiffies */o/spa.14/ 92 a> oa href="+code=u16" class="sref">u16o/a>/oa href="+code=temp" class="sref">tempo/a>[oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>];4/ 93 a> oa href="+code=u16" class="sref">u16o/a>/oa href="+code=fan" class="sref">fano/a>[oa href="+code=SCH5627_NO_FANS" class="sref">SCH5627_NO_FANS a>];4/ 94 a> oa href="+code=u16" class="sref">u16o/a>/oa href="+code=in" class="sref">ino/a>[oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a>];4/ 95 a>};4/ 96o/a>4/ 97 a>static struct/oa href="+code=sch5627_data" class="sref">sch5627_data a> *oa href="+code=sch5627_update_device" class="sref">sch5627_update_device a>(struct/oa href="+code=device" class="sref">device a> *oa href="+code=dev" class="sref">dev a>)4/ 98 a>{4/ 99 a> struct/oa href="+code=sch5627_data" class="sref">sch5627_data a> *oa href="+code=data" class="sref">data a> =/oa href="+code=dev_get_drvdata" class="sref">dev_get_drvdata a>(oa href="+code=dev" class="sref">dev a>);4/100 a> struct/oa href="+code=sch5627_data" class="sref">sch5627_data a> *oa href="+code=ret" class="sref">ret a> =/oa href="+code=data" class="sref">data a>;4/101 a> int/oa href="+code=i" class="sref">i a>, oa href="+code=val" class="sref">val a>;4/102 a>4/103 a> oa href="+code=mutex_lock" class="sref">mutex_lock a>(&oa href="+code=data" class="sref">data a>->oa href="+code=update_lock" class="sref">update_lock a>);4/104 a>4/105 a> ospa. class="comment">/* Trigger a Vbat voltage measurement every 5 minutes */o/spa.14/106 a> if (oa href="+code=time_after" class="sref">time_after a>(oa href="+code=jiffies" class="sref">jiffies a>, oa href="+code=data" class="sref">data a>->oa href="+code=last_battery" class="sref">last_battery a> + 300 * oa href="+code=HZ" class="sref">HZ a>)) {4/107 a> oa href="+code=sch56xx_write_virtual_reg" class="sref">sch56xx_write_virtual_reg a>(oa href="+code=data" class="sref">data a>->oa href="+code=addr" class="sref">addr a>, oa href="+code=SCH5627_REG_CTRL" class="sref">SCH5627_REG_CTRL a>,4/108 a> oa href="+code=data" class="sref">data a>->oa href="+code=control" class="sref">control a> | 0x10);4/109 a> oa href="+code=data" class="sref">data a>->oa href="+code=last_battery" class="sref">last_battery a> =/oa href="+code=jiffies" class="sref">jiffies a>;4/110 a> }4/111 a>4/112 a> ospa. class="comment">/* Cache the s for 1 second */o/spa.14/113 a> if (oa href="+code=time_after" class="sref">time_after a>(oa href="+code=jiffies" class="sref">jiffies a>, oa href="+code=data" class="sref">data a>->oa href="+code=last_updated" class="sref">last_updated a> + oa href="+code=HZ" class="sref">HZ a>) || !oa href="+code=data" class="sref">data a>->oa href="+code=valid" class="sref">valid a>) {4/114 a> for (oa href="+code=i" class="sref">i a> =/0;/oa href="+code=i" class="sref">i a> </oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>;/oa href="+code=i" class="sref">i a>++) {4/115 a> oa href="+code=val" class="sref">val a> =/oa href="+code=sch56xx_read_virtual_reg12" class="sref">sch56xx_read_virtual_reg12 a>(oa href="+code=data" class="sref">data a>->oa href="+code=addr" class="sref">addr a>,4/116 a> oa href="+code=SCH5627_REG_TEMP_MSB" class="sref">SCH5627_REG_TEMP_MSBo/a>[oa href="+code=i" class="sref">i a>],4/117 a> oa href="+code=SCH5627_REG_TEMP_LSN" class="sref">SCH5627_REG_TEMP_LSNo/a>[oa href="+code=i" class="sref">i a>],4/118 a> oa href="+code=SCH5627_REG_TEMP_HIGH_NIBBLE" class="sref">SCH5627_REG_TEMP_HIGH_NIBBLEo/a>[oa href="+code=i" class="sref">i a>]);4/119 a> if (oa href="+code=unlikely" class="sref">unlikely a>(oa href="+code=val" class="sref">val a> </0)) {4/120 a> oa href="+code=ret" class="sref">ret a> =/oa href="+code=ERR_PTR" class="sref">ERR_PTR a>(oa href="+code=val" class="sref">val a>);4/121 a> goto/oa href="+code=abort" class="sref">abort a>;4/122 a> }4/123 a> oa href="+code=data" class="sref">data a>->oa href="+code=temp" class="sref">tempo/a>[oa href="+code=i" class="sref">i a>] =/oa href="+code=val" class="sref">val a>;4/124 a> }4/125 a>4/126 a> for (oa href="+code=i" class="sref">i a> =/0;/oa href="+code=i" class="sref">i a> </oa href="+code=SCH5627_NO_FANS" class="sref">SCH5627_NO_FANS a>;/oa href="+code=i" class="sref">i a>++) {4/127 a> oa href="+code=val" class="sref">val a> =/oa href="+code=sch56xx_read_virtual_reg16" class="sref">sch56xx_read_virtual_reg16 a>(oa href="+code=data" class="sref">data a>->oa href="+code=addr" class="sref">addr a>,4/128 a> oa href="+code=SCH5627_REG_FAN" class="sref">SCH5627_REG_FANo/a>[oa href="+code=i" class="sref">i a>]);4/129 a> if (oa href="+code=unlikely" class="sref">unlikely a>(oa href="+code=val" class="sref">val a> </0)) {4/130 a> oa href="+code=ret" class="sref">ret a> =/oa href="+code=ERR_PTR" class="sref">ERR_PTR a>(oa href="+code=val" class="sref">val a>);4/131 a> goto/oa href="+code=abort" class="sref">abort a>;4/132 a> }4/133 a> oa href="+code=data" class="sref">data a>->oa href="+code=fan" class="sref">fano/a>[oa href="+code=i" class="sref">i a>] =/oa href="+code=val" class="sref">val a>;4/134 a> }4/135 a>4/136 a> for (oa href="+code=i" class="sref">i a> =/0;/oa href="+code=i" class="sref">i a> </oa href="+code=SCH5627_NO_IN" class="sref">SCH5627_NO_IN a>;/oa href="+code=i" class="sref">i a>++) {4/137 a> oa href="+code=val" class="sref">val a> =/oa href="+code=sch56xx_read_virtual_reg12" class="sref">sch56xx_read_virtual_reg12 a>(oa href="+code=data" class="sref">data a>->oa href="+code=addr" class="sref">addr a>,4/138 a> oa href="+code=SCH5627_REG_IN_MSB" class="sref">SCH5627_REG_IN_MSBo/a>[oa href="+code=i" class="sref">i a>],4/139 a> oa href="+code=SCH5627_REG_IN_LSN" class="sref">SCH5627_REG_IN_LSNo/a>[oa href="+code=i" class="sref">i a>],4/140 a> oa href="+code=SCH5627_REG_IN_HIGH_NIBBLE" class="sref">SCH5627_REG_IN_HIGH_NIBBLEo/a>[oa href="+code=i" class="sref">i a>]);4/141 a> if (oa href="+code=unlikely" class="sref">unlikely a>(oa href="+code=val" class="sref">val a> </0)) {4/142 a> oa href="+code=ret" class="sref">ret a> =/oa href="+code=ERR_PTR" class="sref">ERR_PTR a>(oa href="+code=val" class="sref">val a>);4/143 a> goto/oa href="+code=abort" class="sref">abort a>;4/144 a> }4/145 a> oa href="+code=data" class="sref">data a>->oa href="+code=in" class="sref">ino/a>[oa href="+code=i" class="sref">i a>] =/oa href="+code=val" class="sref">val a>;4/146 a> }4/147o/a>4/148 a> oa href="+code=data" class="sref">data a>->oa href="+code=last_updated" class="sref">last_updated a> =/oa href="+code=jiffies" class="sref">jiffies a>;4/149 a> oa href="+code=data" class="sref">data a>->oa href="+code=valid" class="sref">valid a> =/1;4/150 a> }4/151 a>oa href="+code=abort" class="sref">abort a>:4/152 a> oa href="+code=mutex_unlock" class="sref">mutex_unlock a>(&oa href="+code=data" class="sref">data a>->oa href="+code=update_lock" class="sref">update_lock a>);4/153 a> return oa href="+code=ret" class="sref">ret a>;4/154 a>}4/155 a>4/156 a>static int/oa href="+code=sch5627_read_limits" class="sref">sch5627_read_limits a>(struct/oa href="+code=sch5627_data" class="sref">sch5627_data a> *oa href="+code=data" class="sref">data a>)4/157 a>{4/158 a> int/oa href="+code=i" class="sref">i a>, oa href="+code=val" class="sref">val a>;4/159o/a>4/160 a> for (oa href="+code=i" class="sref">i a> =/0;/oa href="+code=i" class="sref">i a> </oa href="+code=SCH5627_NO_TEMPS" class="sref">SCH5627_NO_TEMPS a>;/oa href="+code=i" class="sref">i a>++) {4/161 a> ospa. class="comment">/*o/spa.14/162o/a>ospa. class="comment"> * Note what/SMSC calls ABS, is what/lm_sensors calls maxo/spa.14/163o/a>ospa. class="comment"> * (aka high), and HIGH is what/lm_sensors calls crit.o/spa.14/164o/a>ospa. class="comment"> */o/spa.14/165 a> oa href="+code=val" class="sref">val a> =/oa href="+code=sch56xx_read_virtual_reg" class="sref">sch56xx_read_virtual_reg a>(oa href="+code=data" class="sref">data a>->oa href="+code=addr" class="sref">addr a>,4/166 a> oa href="+code=SCH5627_REG_TEMP_ABS" class="sref">SCH5627_REG_TEMP_ABSo/a>[oa href="+code=i" class="sref">i a>]);4/167 a> if (oa href="+code=val" class="sref">val a> </0)4/168 a> return oa href="+code=val" class="sref">val a>;4/169 a> oa href="+code=data" class="sref">data a>->oa href="+code=temp_max" class="sref">temp_maxo/a>[oa href="+code=i" class="sref">i a>] =/oa href="+code=val" class="sref">val a>;4/170 a>4/171 a> oa href="+code=val" class="sref">val a> =/oa href="+code=sch56xx_read_virtual_reg" class="sref">sch56xx_read_virtual_reg a>(oa href="+code=data" class="sref">data a>->oa href="+code=addr" class="sref">addr a>,4/172 a> oa href="+code=SCH5627_REG_TEMP_HIGH" class="sref">SCH5627_REG_TEMP_HIGHo/a>[oa href="+code=i" class="sref">i a>]);4/173 a> if (oa href="+code=val" class="sref">val a> </0)4/174 a> return oa href="+code=val" class="sref">val a>;4/175 a> oa href="+code=data" class="sref">data a>->oa href="+code=temp_crit" class="sref">temp_crito/a>[oa href="+code=i" class="sref">i a>] =/oa href="+code=val" class="sref">val a>;4/176 a> }4/177 a> for (oa href="+code=i" class="sref">i a> =/0;/oa href="+code=i" class="sref">i a> </oa href="+code=SCH5627_NO_FANS" class="sref">SCH5627_NO_FANS a>;/oa href="+code=i" class="sref">i a>++) {4/178 a> oa href="+code=val" class="sref">val a> =/oa href="+code=sch56xx_read_virtual_reg16" class="sref">sch56xx_read_virtual_reg16 a>(oa href="+code=data" class="sref">data a>->oa href="+code=addr" class="sref">addr a>,4/179 a> oa href="+code=SCH5627_REG_FAN_MIN" class="sref">SCH5627_REG_FAN_MINo/a>[oa href="+code=i" class="sref">i a>]);4/180 a> if (oa href="+code=val" class="sref">val a> </0)4/181 a> return oa href="+code=val" class="sref">val a>;4/182 a> oa href="+code=data" class="sref">data a>->oa href="+code=fan_min" class="sref">fan_mino/a>[oa href="+code=i" class="sref">i a>] =/oa href="+code=val" class="sref">val a>;4/183 a> }4/184 a>4/185 a> return 0;4/186 a>}4/187o/a>4/188 a>static int/oa href="+code=reg_to_temp" class="sref">reg_to_temp a>(oa href="+code=u16" class="sref">u16o/a>/oa href="+code=reg" class="sref">reg a>)4/189 a>{4/190 a> return (oa href="+code=reg" class="sref">reg a> * 625) / 10 - 64000;4/191 a>}4/192 a>4/193 a>static int/oa href="+code=reg_to_temp_limit" class="sref">reg_to_temp_limit a>(oa href="+code=u8" class="sref">u8o/a>/oa href="+code=reg" class="sref">reg a>)4/194 a>{4/195 a> return (oa href="+code=reg" class="sref">reg a> - 64) * 1000;4/196 a>}4/197o/a>4/198 a>static int/oa href="+code=reg_to_rpm" class="sref">reg_to_rpm a>(oa href="+code=u16" class="sref">u16o/a>/oa href="+code=reg" class="sref">reg a>)4/199 a>{4/200 a> if (oa href="+code=reg" class="sref">reg a> ==/0)4/201 a> return -oa href="+code=EIO" class="sref">EIO a>;4/202 a> if (oa href="+code=reg" class="sref">reg a> ==/0xffff)4/203 a> return 0;4/204 a>4/205 a> return 5400540 / oa href="+code=reg" class="sref">reg a>;4/206 a>}4/207o/a>4/208 a>static oa href="+code=ssize_t" class="sref">ssize_to/a>/oa href="+code=show_nam " class="sref">show_nam a>(struct/oa href="+code=device" class="sref">device a> *oa href="+code=dev" class="sref">dev a>, struct/oa href="+code=device_attribute" class="sref">device_attribute a> *oa href="+code=devattr" class="sref">devattr a>,4/209 a> char *oa href="+code=buf" class="sref">buf a>)4/210 a>{4/211 a> return oa href="+code=snprintf" class="sref">snprintf a>(oa href="+code=buf" class="sref">buf a>, oa href="+code=Ph5uf" class="sref">buf a>, oa href="+code=Ph5uf" class="sref">buf a>, oa href="+code=Ph5uf" class="sref">bsef">buf x=data" class="sref">dati="sref">bsef">buf x=data" class="sref">dati="sref2">bsef">buf x=datdevice a> *oa href="+code=hwmon_devL=ck