Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
nvec.h File Reference
#include <linux/atomic.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>

Go to the source code of this file.

Data Structures

struct  nvec_msg
 
struct  nvec_subdev
 
struct  nvec_platform_data
 
struct  nvec_chip
 

Macros

#define NVEC_POOL_SIZE   64
 
#define NVEC_MSG_SIZE   34
 

Enumerations

enum  nvec_event_size { NVEC_2BYTES, NVEC_3BYTES, NVEC_VAR_SIZE }
 
enum  nvec_msg_type {
  NVEC_SYS = 1, NVEC_BAT, NVEC_KBD = 5, NVEC_PS2,
  NVEC_CNTL, NVEC_KB_EVT = 0x80, NVEC_PS2_EVT
}
 

Functions

: The name of the sub device

struct nvec_subdev - A subdevice of nvec, such as nvec_kbd

: Platform data : Identifier of the sub device

int nvec_write_async (struct nvec_chip *nvec, const unsigned char *data, short size)
 
struct nvec_msgnvec_write_sync (struct nvec_chip *nvec, const unsigned char *data, short size)
 
int nvec_register_notifier (struct nvec_chip *nvec, struct notifier_block *nb, unsigned int events)
 
int nvec_unregister_notifier (struct device *dev, struct notifier_block *nb, unsigned int events)
 
void nvec_msg_free (struct nvec_chip *nvec, struct nvec_msg *msg)
 

Macro Definition Documentation

#define NVEC_MSG_SIZE   34

Definition at line 39 of file nvec.h.

#define NVEC_POOL_SIZE   64

Definition at line 30 of file nvec.h.

Enumeration Type Documentation

enum nvec_event_size - The size of an event message : The message has one command byte and one data byte : The message has one command byte and two data bytes : The message has one command byte, one count byte, and has up to as many bytes as the number in the count byte. The maximum is 32

Events can be fixed or variable sized. This is useless on other message types, which are always variable sized.

Enumerator:
NVEC_2BYTES 
NVEC_3BYTES 
NVEC_VAR_SIZE 

Definition at line 52 of file nvec.h.

enum nvec_msg_type - The type of a message : A system request/response : A battery request/response : A keyboard request/response : A mouse request/response : A EC control request/response : An event from the keyboard : An event from the mouse

Events can be fixed or variable sized. This is useless on other message types, which are always variable sized.

Enumerator:
NVEC_SYS 
NVEC_BAT 
NVEC_KBD 
NVEC_PS2 
NVEC_CNTL 
NVEC_KB_EVT 
NVEC_PS2_EVT 

Definition at line 71 of file nvec.h.

Function Documentation

void nvec_msg_free ( struct nvec_chip nvec,
struct nvec_msg msg 
)
inline

nvec_msg_free: : A &struct nvec_chip : A message (must be allocated by nvec_msg_alloc() and belong to )

Free the given message

Definition at line 183 of file nvec.c.

int nvec_register_notifier ( struct nvec_chip nvec,
struct notifier_block nb,
unsigned int  events 
)

nvec_register_notifier - Register a notifier with nvec : A &struct nvec_chip : The notifier block to register

Registers a notifier with . The notifier will be added to an atomic notifier chain that is called for all received messages except those that correspond to a request initiated by nvec_write_sync().

Definition at line 114 of file nvec.c.

int nvec_unregister_notifier ( struct device dev,
struct notifier_block nb,
unsigned int  events 
)
int nvec_write_async ( struct nvec_chip nvec,
const unsigned char data,
short  size 
)

nvec_write_async - Asynchronously write a message to NVEC : An nvec_chip instance : The message data, starting with the request type : The size of

Queue a single message to be transferred to the embedded controller and return immediately.

Returns: 0 on success, a negative error code on failure. If a failure occured, the nvec driver may print an error.

Definition at line 248 of file nvec.c.

struct nvec_msg* nvec_write_sync ( struct nvec_chip nvec,
const unsigned char data,
short  size 
)
read

nvec_write_sync - Write a message to nvec and read the response : An &struct nvec_chip : The data to write : The size of

This is similar to nvec_write_async(), but waits for the request to be answered before returning. This function uses a mutex and can thus not be called from e.g. interrupt handlers.

Returns: A pointer to the response message on success, NULL on failure. Free with nvec_msg_free() once no longer used.

Definition at line 288 of file nvec.c.