linux/drivers/acpi/sbshc.c
<<
opti v/spa v/form va opti href="../linux+v3.8=1./drivers/acpi/sbshc.c">opti vimg src="../.static/gfx/right.png" alt=">>">opv/spa opvspa class="lxr_search">optiopti vinput typptihidden" namptinavtarget" 2opti vinput typptitext" namptisearch" idtisearch">opti vbutt22.typptisubmit">Searchopti Prefs v/a>opv/spa ti v/div ti vform ac.1" ="ajax+*" method="post" onsubmit="return false;">opvinput typptihidden" namptiajax_lookup" idtiajax_lookup" 2oti v/form oti vdiv class="headingbott2m">
vdiv idtifile_contents"
   1v/a>vspa
 class="comment">/*v/spa
	    2v/a>vspa
 class="comment"> * SMBus driver for ACPI Embedded Controller (v0.1)v/spa
	    3v/a>vspa
 class="comment"> *v/spa
	    4v/a>vspa
 class="comment"> * Copyright (c) 2007 Alexey Starikovskiyv/spa
	    5v/a>vspa
 class="comment"> *v/spa
	    6v/a>vspa
 class="comment"> * This program is free software; you ca
 redistribute it and/or modifyv/spa
	    7v/a>vspa
 class="comment"> * it under the terms of the GNU General Public License as published byv/spa
	    8v/a>vspa
 class="comment"> * the Free Software Founda6.22.2ers.22.2.v/spa
	    9v/a>vspa
 class="comment"> */v/spa
	   6.27a	   11v/a>#include <acpi/acpi_bus.hv/a>>   12v/a>#include <acpi/acpi_drivers.hv/a>>   13v/a>#include <linux/wait.hv/a>>   14v/a>#include <linux/slab.hv/a>>   15v/a>#include <linux/delay.hv/a>>   16v/a>#include <linux/module.hv/a>>   17v/a>#include <linux/interrupt.hv/a>>   18v/a>#include "sbshc.hv/a>"   1927a	   2.27a	#define va href="+code=PREFIX" class="sref">PREFIX27a	 vspa
 class="string">"ACPI: "  2127a	   2227a	#define va href="+code=ACPI_SMB_HC_CLASS" class="sref">ACPI_SMB_HC_CLASS27a	 ti    vspa
 class="string">"smbus_host_ctl"  2327a	#define va href="+code=ACPI_SMB_HC_DEVICE_NAME" class="sref">ACPI_SMB_HC_DEVICE_NAME27a	 vspa
 class="string">"ACPI SMBus HC"  2427a	   25v/a>struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 {   2627a	 ti     struct va href="+code=acpi_ec" class="sref">acpi_ec27a	 *va href="+code=ec" class="sref">ec27a	;   2727a	 ti     struct va href="+code=mutex" class="sref">mutex27a	 va href="+code=lock" class="sref">lock27a	;   2827a	 ti     va href="+code=wait_queue_head_t" class="sref">wait_queue_head_t27a	 va href="+code=wait" class="sref">wait27a	;   2927a	 ti     va href="+code=u8" class="sref">u827a	 va href="+code=offset" class="sref">offset27a	;   3027a	 ti     va href="+code=u8" class="sref">u827a	 va href="+code=query_bit" class="sref">query_bit27a	;   3127a	 ti     va href="+code=smbus_alarm_callback" class="sref">smbus_alarm_callback27a	 va href="+code=callback" class="sref">callback27a	;   3227a	 ti     void *va href="+code=context" class="sref">context27a	;   3327a	};   3427a	   35v/a>static int va href="+code=acpi_smbus_hc_add" class="sref">acpi_smbus_hc_addv/a>(struct va href="+code=acpi_device" class="sref">acpi_device27a	 *va href="+code=device" class="sref">device27a	);   36v/a>static int va href="+code=acpi_smbus_hc_remove" class="sref">acpi_smbus_hc_removev/a>(struct va href="+code=acpi_device" class="sref">acpi_device27a	 *va href="+code=device" class="sref">device27a	, int va href="+code=typp" class="sref">typp27a	);   3727a	   38v/a>static const struct va href="+code=acpi_device_id" class="sref">acpi_device_id27a	 va href="+code=sbs_device_ids" class="sref">sbs_device_ids27a	[] = {   3927a	 ti     {vspa
 class="string">"ACPI0001"  4027a	 ti     {vspa
 class="string">"ACPI0005"  4127a	 ti     {vspa
 class="string">""  4227a	};   4327a	   44v/a>va href="+code=MODULE_DEVICE_TABLE" class="sref">MODULE_DEVICE_TABLEv/a>(va href="+code=acpi" class="sref">acpi27a	, va href="+code=sbs_device_ids" class="sref">sbs_device_ids27a	);   4527a	   46v/a>static struct va href="+code=acpi_driver" class="sref">acpi_driver27a	 va href="+code=acpi_smb_hc_driver" class="sref">acpi_smb_hc_driver27a	 = {   4727a	 ti     .va href="+code=namp" class="sref">namp27a	 = vspa
 class="string">"smbus_hc"  4827a	 ti     .va href="+code=class" class="sref">class27a	 = va href="+code=ACPI_SMB_HC_CLASS" class="sref">ACPI_SMB_HC_CLASS27a	,   4927a	 ti     .va href="+code=ids" class="sref">ids27a	 = va href="+code=sbs_device_ids" class="sref">sbs_device_ids27a	,   5027a	 ti     .va href="+code=ops" class="sref">ops27a	 = {   5127a	 ti      ti     .va href="+code=add" class="sref">addv/a> = va href="+code=acpi_smbus_hc_add" class="sref">acpi_smbus_hc_addv/a>,   5227a	 ti      ti     .va href="+code=remove" class="sref">removev/a> = va href="+code=acpi_smbus_hc_remove" class="sref">acpi_smbus_hc_removev/a>,   5327a	 ti      ti     },   5427a	};   5527a	   56v/a>un.22.va href="+code=acpi_smb_status" class="sref">acpi_smb_status27a	 {   5727a	 ti     va href="+code=u8" class="sref">u827a	 va href="+code=raw" class="sref">raw27a	;   5827a	 ti     struct {   5927a	 ti      ti     va href="+code=u8" class="sref">u827a	 va href="+code=status" class="sref">status27a	:5;   6027a	 ti      ti     va href="+code=u8" class="sref">u827a	 va href="+code=reserved" class="sref">reserved27a	:1;   6127a	 ti      ti     va href="+code=u8" class="sref">u827a	 va href="+code=alarm" class="sref">alarm27a	:1;   6227a	 ti      ti     va href="+code=u8" class="sref">u827a	 va href="+code=done" class="sref">done27a	:1;   6327a	 ti     } va href="+code=fields" class="sref">fields27a	;   6427a	};   6527a	   66v/a>enum.va href="+code=acpi_smb_status_codes" class="sref">acpi_smb_status_codes27a	 {   6727a	 ti     va href="+code=SMBUS_OK" class="sref">SMBUS_OKv/a> = 0,   6827a	 ti     va href="+code=SMBUS_UNKNOWN_FAILURE" class="sref">SMBUS_UNKNOWN_FAILUREv/a> = 0x07,   6927a	 ti     va href="+code=SMBUS_DEVICE_ADDRESS_NACK" class="sref">SMBUS_DEVICE_ADDRESS_NACKv/a> = 0x10,   7027a	 ti     va href="+code=SMBUS_DEVICE_ERROR" class="sref">SMBUS_DEVICE_ERRORv/a> = 0x11,   7127a	 ti     va href="+code=SMBUS_DEVICE_COMMAND_ACCESS_DENIED" class="sref">SMBUS_DEVICE_COMMAND_ACCESS_DENIEDv/a> = 0x12,   7227a	 ti     va href="+code=SMBUS_UNKNOWN_ERROR" class="sref">SMBUS_UNKNOWN_ERRORv/a> = 0x13,   7327a	 ti     va href="+code=SMBUS_DEVICE_ACCESS_DENIED" class="sref">SMBUS_DEVICE_ACCESS_DENIEDv/a> = 0x17,   7427a	 ti     va href="+code=SMBUS_TIMEOUT" class="sref">SMBUS_TIMEOUTv/a> = 0x18,   7527a	 ti     va href="+code=SMBUS_HOST_UNSUPPORTED_PROTOCOL" class="sref">SMBUS_HOST_UNSUPPORTED_PROTOCOLv/a> = 0x19,   7627a	 ti     va href="+code=SMBUS_BUSY" class="sref">SMBUS_BUSYv/a> = 0x1a,   7727a	 ti     va href="+code=SMBUS_PEC_ERROR" class="sref">SMBUS_PEC_ERRORv/a> = 0x1f,   7827a	};   7927a	   80v/a>enum.va href="+code=acpi_smb_offset" class="sref">acpi_smb_offset27a	 {   8127a	 ti     va href="+code=ACPI_SMB_PROTOCOL" class="sref">ACPI_SMB_PROTOCOLv/a> = 0,  vspa
 class="comment">/* protocol, PEC */v/spa
	   8227a	 ti     va href="+code=ACPI_SMB_STATUS" class="sref">ACPI_SMB_STATUSv/a> = 1,    vspa
 class="comment">/* status */v/spa
	   8327a	 ti     va href="+code=ACPI_SMB_ADDRESS" class="sref">ACPI_SMB_ADDRESSv/a> = 2,   vspa
 class="comment">/* address */v/spa
	   8427a	 ti     va href="+code=ACPI_SMB_COMMAND" class="sref">ACPI_SMB_COMMANDv/a> = 3,   vspa
 class="comment">/* command */v/spa
	   8527a	 ti     va href="+code=ACPI_SMB_DATA" class="sref">ACPI_SMB_DATAv/a> = 4,i     vspa
 class="comment">/* 32 data registers */v/spa
	   8627a	 ti     va href="+code=ACPI_SMB_BLOCK_COUNT" class="sref">ACPI_SMB_BLOCK_COUNTv/a> = 0x24,    vspa
 class="comment">/* number of data bytes */v/spa
	   8727a	 ti     va href="+code=ACPI_SMB_ALARM_ADDRESS" class="sref">ACPI_SMB_ALARM_ADDRESSv/a> = 0x25,  vspa
 class="comment">/* alarm address */v/spa
	   8827a	 ti     va href="+code=ACPI_SMB_ALARM_DATA" class="sref">ACPI_SMB_ALARM_DATAv/a> = 0x26,     vspa
 class="comment">/* 2 bytes alarm data */v/spa
	   8927a	};   9.27a	   91v/a>static va href="+code=inline" class="sref">inlinev/a> int va href="+code=smb_hc_read" class="sref">smb_hc_readv/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	, va href="+code=u8" class="sref">u827a	 va href="+code=address" class="sref">address27a	, va href="+code=u8" class="sref">u827a	 *va href="+code=data" class="sref">data27a	)   9227a	{   9327a	 ti     return va href="+code=ec_read" class="sref">ec_readv/a>(va href="+code=hc" class="sref">hc27a	->va href="+code=offset" class="sref">offset27a	 + va href="+code=address" class="sref">address27a	, va href="+code=data" class="sref">data27a	);   9427a	}   9527a	   96v/a>static va href="+code=inline" class="sref">inlinev/a> int va href="+code=smb_hc_write" class="sref">smb_hc_writev/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	, va href="+code=u8" class="sref">u827a	 va href="+code=address" class="sref">address27a	, va href="+code=u8" class="sref">u827a	 va href="+code=data" class="sref">data27a	)   9727a	{   9827a	 ti     return va href="+code=ec_write" class="sref">ec_writev/a>(va href="+code=hc" class="sref">hc27a	->va href="+code=offset" class="sref">offset27a	 + va href="+code=address" class="sref">address27a	, va href="+code=data" class="sref">data27a	);   9927a	}  10027a	  101v/a>static va href="+code=inline" class="sref">inlinev/a> int va href="+code=smb_check_done" class="sref">smb_check_donev/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	)  10227a	{  10327a	 ti     un.22.va href="+code=acpi_smb_status" class="sref">acpi_smb_status27a	 va href="+code=status" class="sref">status27a	 = {.va href="+code=raw" class="sref">raw27a	 = 0};  10427a	 ti     va href="+code=smb_hc_read" class="sref">smb_hc_readv/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_STATUS" class="sref">ACPI_SMB_STATUSv/a>, &va href="+code=status" class="sref">status27a	.va href="+code=raw" class="sref">raw27a	);  10527a	 ti     return va href="+code=status" class="sref">status27a	.va href="+code=fields" class="sref">fields27a	.va href="+code=done" class="sref">done27a	 && (va href="+code=status" class="sref">status27a	.va href="+code=fields" class="sref">fields27a	.va href="+code=status" class="sref">status27a	 == va href="+code=SMBUS_OK" class="sref">SMBUS_OKv/a>);  10627a	}  10727a	  108v/a>static int va href="+code=wait_transac.1"
_complete" class="sref">wait_transac.1"
_completev/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	, int va href="+code=timeout" class="sref">timeout27a	)  10927a	{  11027a	 ti     if (va href="+code=wait_event_timeout" class="sref">wait_event_timeoutv/a>(va href="+code=hc" class="sref">hc27a	->va href="+code=wait" class="sref">wait27a	, va href="+code=smb_check_done" class="sref">smb_check_donev/a>(va href="+code=hc" class="sref">hc27a	),  11127a	 ti      ti                    va href="+code=msecs_to_jiffies" class="sref">msecs_to_jiffiesv/a>(va href="+code=timeout" class="sref">timeout27a	)))  11227a	 ti      ti     return 0;  11327a	 ti     vspa
 class="comment">/*v/spa
	  114v/a>vspa
 class="comment">         * After the timeout happens, OS will try to check the status of SMbus.v/spa
	  115v/a>vspa
 class="comment">         * If the status is what OS expected, it will be regarded as the bogus27spa
	  116v/a>vspa
 class="comment">         * timeout.v/spa
	  117v/a>vspa
 class="comment">         */v/spa
	  11827a	 ti     if (va href="+code=smb_check_done" class="sref">smb_check_donev/a>(va href="+code=hc" class="sref">hc27a	))  11927a	 ti      ti     return 0;  12027a	 ti     else  12127a	 ti      ti     return -va href="+code=ETIME" class="sref">ETIME27a	;  12227a	}  12327a	  12427a	static int va href="+code=acpi_smbus_transac.1"
" class="sref">acpi_smbus_transac.1"
v/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	, va href="+code=u8" class="sref">u827a	 va href="+code=protocol" class="sref">protocol27a	,  12527a	 ti      ti                       va href="+code=u8" class="sref">u827a	 va href="+code=address" class="sref">address27a	, va href="+code=u8" class="sref">u827a	 va href="+code=command" class="sref">command27a	, va href="+code=u8" class="sref">u827a	 *va href="+code=data" class="sref">data27a	, va href="+code=u8" class="sref">u827a	 va href="+code=length" class="sref">length27a	)  12627a	{  12727a	 ti     int va href="+code=ret" class="sref">ret27a	 = -va href="+code=EFAULT" class="sref">EFAULT27a	, va href="+code=i" class="sref">i27a	;  12827a	 ti     va href="+code=u8" class="sref">u827a	 va href="+code=temp" class="sref">temp27a	, va href="+code=sz" class="sref">sz27a	 = 0;  12927a	  13027a	 ti     if (!va href="+code=hc" class="sref">hc27a	) {  13127a	 ti      ti     va href="+code=printk" class="sref">printkv/a>(va href="+code=KERN_ERR" class="sref">KERN_ERR27a	 va href="+code=PREFIX" class="sref">PREFIX27a	 vspa
 class="string">"host controller is not configured\n" 13227a	 ti      ti     return va href="+code=ret" class="sref">ret27a	;  13327a	 ti     }  13427a	  13527a	 ti     va href="+code=mutex_lock" class="sref">mutex_lockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  13627a	 ti     if (va href="+code=smb_hc_read" class="sref">smb_hc_readv/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_PROTOCOL" class="sref">ACPI_SMB_PROTOCOLv/a>, &va href="+code=temp" class="sref">temp27a	))  13727a	 ti      ti     goto va href="+code=end" class="sref">end27a	;  13827a	 ti     if (va href="+code=temp" class="sref">temp27a	) {  13927a	 ti      ti     va href="+code=ret" class="sref">ret27a	 = -va href="+code=EBUSY" class="sref">EBUSYv/a>;  14027a	 ti      ti     goto va href="+code=end" class="sref">end27a	;  14127a	 ti     }  14227a	 ti     va href="+code=smb_hc_write" class="sref">smb_hc_writev/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_COMMAND" class="sref">ACPI_SMB_COMMANDv/a>, va href="+code=command" class="sref">command27a	);  14327a	 ti     if (!(va href="+code=protocol" class="sref">protocol27a	 & 0x01)) {  14427a	 ti      ti     va href="+code=smb_hc_write" class="sref">smb_hc_writev/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_BLOCK_COUNT" class="sref">ACPI_SMB_BLOCK_COUNTv/a>, va href="+code=length" class="sref">length27a	);  14527a	 ti      ti     for (va href="+code=i" class="sref">i27a	 = 0; va href="+code=i" class="sref">i27a	 < va href="+code=length" class="sref">length27a	; ++va href="+code=i" class="sref">i27a	)  14627a	 ti      ti      ti     va href="+code=smb_hc_write" class="sref">smb_hc_writev/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_DATA" class="sref">ACPI_SMB_DATAv/a> + va href="+code=i" class="sref">i27a	, va href="+code=data" class="sref">data27a	[va href="+code=i" class="sref">i27a	]);  14727a	 ti     }  14827a	 ti     va href="+code=smb_hc_write" class="sref">smb_hc_writev/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_ADDRESS" class="sref">ACPI_SMB_ADDRESSv/a>, va href="+code=address" class="sref">address27a	 << 1);  14927a	 ti     va href="+code=smb_hc_write" class="sref">smb_hc_writev/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_PROTOCOL" class="sref">ACPI_SMB_PROTOCOLv/a>, va href="+code=protocol" class="sref">protocol27a	);  15027a	 ti     vspa
 class="comment">/*v/spa
	  151v/a>vspa
 class="comment">  ti     * Wait for completion. Save the status code, data size,v/spa
	  152v/a>vspa
 class="comment">  ti     * and data into the return package (if required by the protocol).v/spa
	  153v/a>vspa
 class="comment">  ti     */v/spa
	  15427a	 ti     va href="+code=ret" class="sref">ret27a	 = va href="+code=wait_transac.1"
_complete" class="sref">wait_transac.1"
_completev/a>(va href="+code=hc" class="sref">hc27a	, 1000);  15527a	 ti     if (va href="+code=ret" class="sref">ret27a	 || !(va href="+code=protocol" class="sref">protocol27a	 & 0x01))  15627a	 ti      ti     goto va href="+code=end" class="sref">end27a	;  15727a	 ti     switch (va href="+code=protocol" class="sref">protocol27a	) {  15827a	 ti     case va href="+code=SMBUS_RECEIVE_BYTE" class="sref">SMBUS_RECEIVE_BYTE27a	:  15927a	 ti     case va href="+code=SMBUS_READ_BYTE" class="sref">SMBUS_READ_BYTE27a	:  16027a	 ti      ti     va href="+code=sz" class="sref">sz27a	 = 1;  16127a	 ti      ti     break;  16227a	 ti     case va href="+code=SMBUS_READ_WORD" class="sref">SMBUS_READ_WORD27a	:  16327a	 ti      ti     va href="+code=sz" class="sref">sz27a	 = 2;  16427a	 ti      ti     break;  16527a	 ti     case va href="+code=SMBUS_READ_BLOCK" class="sref">SMBUS_READ_BLOCK27a	:  16627a	 ti      ti     if (va href="+code=smb_hc_read" class="sref">smb_hc_readv/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_BLOCK_COUNT" class="sref">ACPI_SMB_BLOCK_COUNTv/a>, &va href="+code=sz" class="sref">sz27a	)) {  16727a	 ti      ti      ti     va href="+code=ret" class="sref">ret27a	 = -va href="+code=EFAULT" class="sref">EFAULT27a	;  16827a	 ti                     goto va href="+code=end" class="sref">end27a	;  16927a	 ti      ti     }  17027a	 ti      ti     va href="+code=sz" class="sref">sz27a	 &= 0x1f;  17127a	 ti      ti     break;  17227a	 ti     }  17327a	 ti     for (va href="+code=i" class="sref">i27a	 = 0; va href="+code=i" class="sref">i27a	 < va href="+code=sz" class="sref">sz27a	; ++va href="+code=i" class="sref">i27a	)  17427a	 ti      ti     va href="+code=smb_hc_read" class="sref">smb_hc_readv/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_DATA" class="sref">ACPI_SMB_DATAv/a> + va href="+code=i" class="sref">i27a	, &va href="+code=data" class="sref">data27a	[va href="+code=i" class="sref">i27a	]);  17527a	 ti   va href="+code=end" class="sref">end27a	:  17627a	 ti     va href="+code=mutex_unlock" class="sref">mutex_unlockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  17727a	 ti     return va href="+code=ret" class="sref">ret27a	;  17827a	}  17927a	  180v/a>int va href="+code=acpi_smbus_read" class="sref">acpi_smbus_readv/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	, va href="+code=u8" class="sref">u827a	 va href="+code=protocol" class="sref">protocol27a	, va href="+code=u8" class="sref">u827a	 va href="+code=address" class="sref">address27a	,  18127a	 ti      ti         va href="+code=u8" class="sref">u827a	 va href="+code=command" class="sref">command27a	, va href="+code=u8" class="sref">u827a	 *va href="+code=data" class="sref">data27a	)  18227a	{  18327a	 ti     return va href="+code=acpi_smbus_transac.1"
" class="sref">acpi_smbus_transac.1"
v/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=protocol" class="sref">protocol27a	, va href="+code=address" class="sref">address27a	, va href="+code=command" class="sref">command27a	, va href="+code=data" class="sref">data27a	, 0);  18427a	}  18527a	  18627a	va href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLv/a>(va href="+code=acpi_smbus_read" class="sref">acpi_smbus_readv/a>);  18727a	  18827a	int va href="+code=acpi_smbus_write" class="sref">acpi_smbus_writev/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	, va href="+code=u8" class="sref">u827a	 va href="+code=protocol" class="sref">protocol27a	, va href="+code=u8" class="sref">u827a	 va href="+code=address" class="sref">address27a	,  18927a	 ti      ti          va href="+code=u8" class="sref">u827a	 va href="+code=command" class="sref">command27a	, va href="+code=u8" class="sref">u827a	 *va href="+code=data" class="sref">data27a	, va href="+code=u8" class="sref">u827a	 va href="+code=length" class="sref">length27a	)  19.27a	{  19127a	 ti     return va href="+code=acpi_smbus_transac.1"
" class="sref">acpi_smbus_transac.1"
v/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=protocol" class="sref">protocol27a	, va href="+code=address" class="sref">address27a	, va href="+code=command" class="sref">command27a	, va href="+code=data" class="sref">data27a	, va href="+code=length" class="sref">length27a	);  19227a	}  19327a	  194v/a>va href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLv/a>(va href="+code=acpi_smbus_write" class="sref">acpi_smbus_writev/a>);  19527a	  196v/a>int va href="+code=acpi_smbus_register_callback" class="sref">acpi_smbus_register_callbackv/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	,  19727a	 ti      ti      ti       ti     va href="+code=smbus_alarm_callback" class="sref">smbus_alarm_callback27a	 va href="+code=callback" class="sref">callback27a	, void *va href="+code=context" class="sref">context27a	)  19827a	{  19927a	 ti     va href="+code=mutex_lock" class="sref">mutex_lockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  20027a	 ti     va href="+code=hc" class="sref">hc27a	->va href="+code=callback" class="sref">callback27a	 = va href="+code=callback" class="sref">callback27a	;  20127a	 ti     va href="+code=hc" class="sref">hc27a	->va href="+code=context" class="sref">context27a	 = va href="+code=context" class="sref">context27a	;  20227a	 ti     va href="+code=mutex_unlock" class="sref">mutex_unlockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  20327a	 ti     return 0;  20427a	}  20527a	  20627a	va href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLv/a>(va href="+code=acpi_smbus_register_callback" class="sref">acpi_smbus_register_callbackv/a>);  20727a	  20827a	int va href="+code=acpi_smbus_unregister_callback" class="sref">acpi_smbus_unregister_callbackv/a>(struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	)  20927a	{  21027a	 ti     va href="+code=mutex_lock" class="sref">mutex_lockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  21127a	 ti     va href="+code=hc" class="sref">hc27a	->va href="+code=callback" class="sref">callback27a	 = va href="+code=NULL" class="sref">NULL27a	;  21227a	 ti     va href="+code=hc" class="sref">hc27a	->va href="+code=context" class="sref">context27a	 = va href="+code=NULL" class="sref">NULL27a	;  21327a	 ti     va href="+code=mutex_unlock" class="sref">mutex_unlockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  21427a	 ti     return 0;  215v/a>}  216v/a>  217v/a>va href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPLv/a>(va href="+code=acpi_smbus_unregister_callback" class="sref">acpi_smbus_unregister_callbackv/a>);  21827a	  21927a	static va href="+code=inline" class="sref">inlinev/a> void va href="+code=acpi_smbus_callback" class="sref">acpi_smbus_callbackv/a>(void *va href="+code=context" class="sref">context27a	)  22.27a	{  22127a	 ti     struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	 = va href="+code=context" class="sref">context27a	;  22227a	 ti     if (va href="+code=hc" class="sref">hc27a	->va href="+code=callback" class="sref">callback27a	)  22327a	 ti      ti     va href="+code=hc" class="sref">hc27a	->va href="+code=callback" class="sref">callback27a	(va href="+code=hc" class="sref">hc27a	->va href="+code=context" class="sref">context27a	);  22427a	}  22527a	  226v/a>static int va href="+code=smbus_alarm" class="sref">smbus_alarmv/a>(void *va href="+code=context" class="sref">context27a	)  22727a	{  22827a	 ti     struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	 = va href="+code=context" class="sref">context27a	;  22927a	 ti     un.22.va href="+code=acpi_smb_status" class="sref">acpi_smb_status27a	 va href="+code=status" class="sref">status27a	;  23027a	 ti     va href="+code=u8" class="sref">u827a	 va href="+code=address" class="sref">address27a	;  23127a	 ti     if (va href="+code=smb_hc_read" class="sref">smb_hc_readv/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_STATUS" class="sref">ACPI_SMB_STATUSv/a>, &va href="+code=status" class="sref">status27a	.va href="+code=raw" class="sref">raw27a	))  23227a	 ti      ti     return 0;  23327a	 ti     vspa
 class="comment">/* Check if it is only a completion notify */v/spa
	  23427a	 ti     if (va href="+code=status" class="sref">status27a	.va href="+code=fields" class="sref">fields27a	.va href="+code=done" class="sref">done27a	)  23527a	 ti      ti     va href="+code=wake_up" class="sref">wake_upv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=wait" class="sref">wait27a	);  23627a	 ti     if (!va href="+code=status" class="sref">status27a	.va href="+code=fields" class="sref">fields27a	.va href="+code=alarm" class="sref">alarm27a	)  23727a	 ti      ti     return 0;  23827a	 ti     va href="+code=mutex_lock" class="sref">mutex_lockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  23927a	 ti     va href="+code=smb_hc_read" class="sref">smb_hc_readv/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_ALARM_ADDRESS" class="sref">ACPI_SMB_ALARM_ADDRESSv/a>, &va href="+code=address" class="sref">address27a	);  24027a	 ti     va href="+code=status" class="sref">status27a	.va href="+code=fields" class="sref">fields27a	.va href="+code=alarm" class="sref">alarm27a	 = 0;  24127a	 ti     va href="+code=smb_hc_write" class="sref">smb_hc_writev/a>(va href="+code=hc" class="sref">hc27a	, va href="+code=ACPI_SMB_STATUS" class="sref">ACPI_SMB_STATUSv/a>, va href="+code=status" class="sref">status27a	.va href="+code=raw" class="sref">raw27a	);  24227a	 ti     vspa
 class="comment">/* We are only interested in events coming from known devices */v/spa
	  24327a	 ti     switch (va href="+code=address" class="sref">address27a	 >> 1) {  24427a	 ti      ti     case va href="+code=ACPI_SBS_CHARGER" class="sref">ACPI_SBS_CHARGER27a	:  24527a	 ti      ti     case va href="+code=ACPI_SBS_MANAGER" class="sref">ACPI_SBS_MANAGER27a	:  24627a	 ti      ti     case va href="+code=ACPI_SBS_BATTERY" class="sref">ACPI_SBS_BATTERY27a	:  24727a	 ti      ti      ti     va href="+code=acpi_os_execute" class="sref">acpi_os_executev/a>(va href="+code=OSL_NOTIFY_HANDLER" class="sref">OSL_NOTIFY_HANDLERv/a>,  24827a	 ti                      ti      ti     va href="+code=acpi_smbus_callback" class="sref">acpi_smbus_callbackv/a>, va href="+code=hc" class="sref">hc27a	);  24927a	 ti      ti     default:;  25027a	 ti     }  25127a	 ti     va href="+code=mutex_unlock" class="sref">mutex_unlockv/a>(&va href="+code=hc" class="sref">hc27a	->va href="+code=lock" class="sref">lock27a	);  25227a	 ti     return 0;  253v/a>}  25427a	  25527a	typedef int (*va href="+code=acpi_ec_query_func" class="sref">acpi_ec_query_func27a	) (void *va href="+code=data" class="sref">data27a	);  256v/a>  25727a	extern int va href="+code=acpi_ec_add_query_handler" class="sref">acpi_ec_add_query_handlerv/a>(struct va href="+code=acpi_ec" class="sref">acpi_ec27a	 *va href="+code=ec" class="sref">ec27a	, va href="+code=u8" class="sref">u827a	 va href="+code=query_bit" class="sref">query_bitv/a>,  25827a	 ti                      ti   va href="+code=acpi_handle" class="sref">acpi_handle27a	 va href="+code=handle" class="sref">handle27a	, va href="+code=acpi_ec_query_func" class="sref">acpi_ec_query_func27a	 va href="+code=func" class="sref">func27a	,  25927a	 ti      ti                   void *va href="+code=data" class="sref">data27a	);  26027a	  261v/a>static int va href="+code=acpi_smbus_hc_add" class="sref">acpi_smbus_hc_addv/a>(struct va href="+code=acpi_device" class="sref">acpi_device27a	 *va href="+code=device" class="sref">device27a	)  26ransac.1"
" class="sref">acpi_smbus_tr263" idtiL263" class="line" namptiL16drive2227a	 ti      tt va href="+code=smbtus" class="sref">status27a	;  16227a	 ti      tunsign inlo frlo fr href="+code=smva class="sref">prva a	;  16227a	 ti     caruct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	 = 1626/a>  16227a	 ti      t (!va href="+code=stvice" class="sref">device27a	)  16227a	 ti               turn -va href="+code=ETIINVA class="sref">EXPINVA a	 = 16267a	  17277a	 ti     va href="+code=status" class="sref">status27a	.v va href="+code=copi_ec_va uate_tereg" class="sref">acpi_ec_va uate_tereg" a>(va href="+code=OSvice" class="sref">device27a	) gt;va href="+code=londle" class="sref">handle27a	, va a
 class="string">"ho_ECuot;NULL27a	; &va href="+code=adva class="sref">prva a	;   17277a	 ti     if (va href="+code=smPI_SBFAILUREclass="sref">ACPI_SBFAILUREa>(va href="+code=OSatus" class="sref">status27a	.v {  17277a	 ti      ti     re href="+code=OSintk" class="sref">printkv/a>(va href="+code=KERN_ERR" class="sref">KERN_ERR27a	 va href="+code=PREFIX" class="sref">PREFIX27a	 vspa
 class="string">"hoerror obtaing fr_EC." 17227a	 ti     fo        turn -va href="+code=ETIIOclass="sref">EXPIOa	 = 17227a	 ti      t 17277a	  17227a	 ti     va href="+code=murincpyclass="sref">statncpya>(va href="+code=KEpi_device27_mpticlass="sref">acpi_device27_mptia>(va href="+code=OSvice" class="sref">device27a	) )va href="+code=ACPI_SMB_STHC_DEVICE_NA" class="sref">ETPI_SMB_STHC_DEVICE_NA" a	;   17227a	 ti     re href="+code=murincpyclass="sref">statncpya>(va href="+code=KEpi_device27_ass="class="sref">acpi_device27_ass="a>(va href="+code=OSvice" class="sref">device27a	) )va href="+code=ACPI_SMB_STHC_CLA" class="sref">ACPI_SMB_ALHC_CLA" a	;   17277a	  17277a	 ti     va href="+code=sm" class="sref">hc27a	 = va href="+code=cokzallo class="sref">hckzallo a>(strizeoftruct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *)va href="+code=ACGFP_RN_EE class="sref">NUGFP_RN_EE a	;   18287a	 ti     if (!va href="+code=hc" class="sref">hc27a	) {a href="drivers/acpi/sbshc.c#L260" idtiL172" class="line" namptiL182"> 18227a	 ti      ti       turn -va href="+code=ETINOMEMclass="sref">EXPNOMEMa	 = 18287a	 ti     va href="+code=mutex_uning+code=query_bit"tex_uning+code=ETINOMEMclass="sref">EXPNOMEMa	 = 18287a	 ti     va hru1amptiL182"> 18287a	 ti     va hru1ampt6_ = 1; (va href="+code=smPI_SBFAILUREclasi	 = -va href="+code=EFAULT" class="sref">tiL153" class="li#L256" idtiL256"ass=jLT" clas7ti     goto va href="+code=end" class=ss="sref">end2e37a	 ti      t 18227a	 28     va href="+code=mutex_lo56"ass=jLT" clas7ti     goto va href="+codes="sref">ec27a	, va hreef="+code=copi_ec_va uaacpi/s_ass="sref">data27a	va uaacpi/s_ass=href="+code=OSvice" class="sref">device27a	) gt;va href="+code=londle" parWe asref">printkv/aarWe nd2e37a	 ti      t 18227a	v28     va href="+code=murincpy56"ass=jLT" clas7ti     goto va href="+codeoffss="sref">ret27a	;offss= hreef=="+code=OSvice" ss="sref">prva a	;   18227a	 28     re href="+code=murincpy56"ass=jLT" clas7ti     goto va href="+codet" class="sref">query_bitv/a>, prva a	;   18227a	i28     va href="+code=mutex_loclass="sref">device27a	) gt;va href="+code=londle" acpi/s_ass="sref">data27a	acpi/s_ass=hrefef="+code=copi_ec_s="sref">hc27a	 = 18227a	 28 href="drivers/acpi/sbshc.c#L182" idtiL190" cla2s="line" namptiL190"> 19227a	{29     va href="+code=status" add_query_handler" class="sref">acpi_ec_add_query_handlerv/a>(struct v"+code=mutex_lo56"ass=jLT" clas7ti     goto va href="+codes="sref">ec27a	, va href="+code=hc" class="sref">hc27a	); query_bitv/a>, NULL27a	; &va "+code=murincpycrm" class="sref">smbus_alarmv/a>(void *vf="+code=hc" class="sref">hc27a	);  19227a	 29     va href="+code=mutex_unclass="sref">printkv/a>(va href="+code=KERN_ERR" claINF="sref">EXPIOa	 " claINF=href="+code=PREFIX" class="sref">PREFIX27a	 vspa
 class="string">"hoerror SBS HC: EC hrex%p, offss= hrex%0x, tv/a>,  19227a	}29      ti     re href="+code=OSintk" 56"ass=jLT" clas7ti     goto va href="+codes="sref">ec27a	, va href="+code=hc" class="sref">hc27a	); ret27a	;offss= href="+code=hc" class="sref">hc27a	); query_bitv/a>,  18s="line" namptiL193"> 19227a	 2a href="drivers/acpi/sbshc.c#L194" idt2L194" cla2s="line" namptiL194"> 192v/a>v29     return 0;  19227a	 29a href="drivers/acpi/sbshc.c#L216" idtiL196" cla2s="line" namptiL196"> 192v/a>i29 href="drivers/acpi/sbshc.c#L257" idtiL197" cla2s="line" namptiL197"> 19227a	 29ern int va hhref="+code=acpi_smbus_caea>(vmoveandler" class="sref">acpi_ec_add_quer(vmoveandler" class=uct va href="+code=acpi_ec" class="sref">acpi_ec27a	 *va href="+code=ec" class="sref">ec27a	, va href="+code=u8" class="sref">u827a	 va href="+code=query_bit" class="sref">query_bitv/a>,  19227a	{29 href="drivers/acpi/sbshc.c#L219" idtiL199" cla2s="line" namptiL199"> 19227a	 29tic va href=ref="+code=acpi_smbus_hc_add" cla(vmove"sref">acpi_smbus_hc_addv/a>((vmoveuct va href="+code=acpi_device" class="sref">acpi_device27a	 *va href="+code=device" class="sref">device27a	) device27int  href="drivers/acpi/sbshc.c#L260" idt3L200" cla3s="line" namptiL200"> 20327a	 30a href="drivers/acpi/sbshc.c#L221" idt3L201" cla3s="line" namptiL201"> 20327a	 30     struct va href="+code=acpi_smb_hc" class="sref">acpi_smb_hc27a	 *va href="+code=hc" class="sref">hc27a	 = va hrf="drivers/acpi/sbshc.c#L249" idt3L202" cla3s="line" namptiL202"> 20327a	 3i     ="drivers/acpi/sbshc.c#L249" idt3L302" cla3s="line" namptiL193"> 19327a	 3i     return 0href="+code=stvice" class="sref">device27a	)  20327a	}30      ti     case va va href="+code=ETIINVA class="sref">EXPINVA a	 = 20327a	 3a href="drivers/acpi/sbshc.c#L206" idt3L206" cla3s="line" namptiL206"> 20327a	v30     va href="+code=murincpy56"ass=jLT" clas7ti    ef="+code=copi_ec_va uaacpi/s_ass="sref">data27a	va uaacpi/s_ass=href="+code=OSvice" class="sref">device27a	) gt;va ef="drivers/acpi/sbshc.c#L249" idt3L207" cla3s="line" namptiL207"> 20327a	 30     re href="+code=murincpyus_caea>(vmoveandler" class="sref">acpi_ec_add_quer(vmoveandler" class=uct v"+code=OSintk" 56"ass=jLT" clas7ti     goto va href="+codes="sref">ec27a	, va href="+code=hc" class="sref">hc27a	); query_bitv/a>,  20327a	i30     va href="+code=mutex_lokfre="sref">device27kfre=uct v"+code=OSintk" 56"ass=jLT" clas7ti    ef="drivers/acpi/sbshc.c#L249" idt3L908" cla3s="line" namptiL199"> 19327a	{30     va href="+code=sm" clasclass="sref">device27a	) gt;va href="+code=londle" acpi/s_ass="sref">data27a	acpi/s_ass=hrefef="+code=copi_ec_ass="sref">NULL27a	;  21327a	 3i     va href=;  21327a	 3i     f="drivers/acpi/sbshc.c#L216" idt3L212" cla3s="line" namptiL212"> 21327a	 31     ="drivers/acpi/sbshc.c#L249" idt3L213" cla3s="line" namptiL213"> 21327a	 3i     "+code=mutex_uniodule_va uaacpi/suery_bit"tex_uniodule_va uaacpi/shref="+code=KEpi_device27ritev/aacpi/suery_bit"tex_unice27ritev/aacpi/s    ef="drivers/acpi/sbshc.c#L249" idt3L214" cla3s="line" namptiL214"> 21327a	 31 href="drivers/acpi/sbshc.c#L255" idt3L215" cla3s="line" namptiL215"> 213v/a>}3ETPI_SMBMODULE_LICENS=href="ss="string">"hoerror GPLspa
	);  213v/a> 31href="+code=EXPORT_SMODULE_AUTHO="sref">KERN_ERRMODULE_AUTHO=href="ss="string">"hoerror Alexey Starikovskiyspa
	);  213v/a>v3 href="+code=EXPORT_SMODULE_DESCRIPTION"sref">KERN_ERRMODULE_DESCRIPTIONhref="ss="string">"hoerror ACPI SMBus HC acpi/sspa
	);  21327a	 3a href


The original LXR softw introtocol"drivers/http://sourceforge.net/projects/lxa">LXR >/* unity href=this experi We al i/sbfy *rot"drivers/mailto:lxa@mptux.no">lxa@mptux.no hre. lxa.mptux.no kilasy hoeventrot"drivers/http://www.redpill-mptpro.no">Redpill Lptpro Aa href=provider of Lptux >/nsultC.&q intoperaify s serv/spa since ti 5.