Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Enumerations | Functions
nvec.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/atomic.h>
#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/list.h>
#include <linux/mfd/core.h>
#include <linux/mutex.h>
#include <linux/notifier.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <mach/clk.h>
#include <mach/iomap.h>
#include "nvec.h"

Go to the source code of this file.

Macros

#define I2C_CNFG   0x00
 
#define I2C_CNFG_PACKET_MODE_EN   (1<<10)
 
#define I2C_CNFG_NEW_MASTER_SFM   (1<<11)
 
#define I2C_CNFG_DEBOUNCE_CNT_SHIFT   12
 
#define I2C_SL_CNFG   0x20
 
#define I2C_SL_NEWSL   (1<<2)
 
#define I2C_SL_NACK   (1<<1)
 
#define I2C_SL_RESP   (1<<0)
 
#define I2C_SL_IRQ   (1<<3)
 
#define END_TRANS   (1<<4)
 
#define RCVD   (1<<2)
 
#define RNW   (1<<1)
 
#define I2C_SL_RCVD   0x24
 
#define I2C_SL_STATUS   0x28
 
#define I2C_SL_ADDR1   0x2c
 
#define I2C_SL_ADDR2   0x30
 
#define I2C_SL_DELAY_COUNT   0x3c
 

Enumerations

enum  nvec_msg_category { NVEC_MSG_RX, NVEC_MSG_TX }
 

Functions

int nvec_register_notifier (struct nvec_chip *nvec, struct notifier_block *nb, unsigned int events)
 
 EXPORT_SYMBOL_GPL (nvec_register_notifier)
 
void nvec_msg_free (struct nvec_chip *nvec, struct nvec_msg *msg)
 
 EXPORT_SYMBOL_GPL (nvec_msg_free)
 
int nvec_write_async (struct nvec_chip *nvec, const unsigned char *data, short size)
 
 EXPORT_SYMBOL (nvec_write_async)
 
struct nvec_msgnvec_write_sync (struct nvec_chip *nvec, const unsigned char *data, short size)
 
 EXPORT_SYMBOL (nvec_write_sync)
 
 MODULE_DEVICE_TABLE (of, nvidia_nvec_of_match)
 
 module_platform_driver (nvec_device_driver)
 
 MODULE_ALIAS ("platform:nvec")
 
 MODULE_DESCRIPTION ("NVIDIA compliant embedded controller interface")
 
 MODULE_AUTHOR ("Marc Dietrich <[email protected]>")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define END_TRANS   (1<<4)

Definition at line 56 of file nvec.c.

#define I2C_CNFG   0x00

Definition at line 46 of file nvec.c.

#define I2C_CNFG_DEBOUNCE_CNT_SHIFT   12

Definition at line 49 of file nvec.c.

#define I2C_CNFG_NEW_MASTER_SFM   (1<<11)

Definition at line 48 of file nvec.c.

#define I2C_CNFG_PACKET_MODE_EN   (1<<10)

Definition at line 47 of file nvec.c.

#define I2C_SL_ADDR1   0x2c

Definition at line 62 of file nvec.c.

#define I2C_SL_ADDR2   0x30

Definition at line 63 of file nvec.c.

#define I2C_SL_CNFG   0x20

Definition at line 51 of file nvec.c.

#define I2C_SL_DELAY_COUNT   0x3c

Definition at line 64 of file nvec.c.

#define I2C_SL_IRQ   (1<<3)

Definition at line 55 of file nvec.c.

#define I2C_SL_NACK   (1<<1)

Definition at line 53 of file nvec.c.

#define I2C_SL_NEWSL   (1<<2)

Definition at line 52 of file nvec.c.

#define I2C_SL_RCVD   0x24

Definition at line 60 of file nvec.c.

#define I2C_SL_RESP   (1<<0)

Definition at line 54 of file nvec.c.

#define I2C_SL_STATUS   0x28

Definition at line 61 of file nvec.c.

#define RCVD   (1<<2)

Definition at line 57 of file nvec.c.

#define RNW   (1<<1)

Definition at line 58 of file nvec.c.

Enumeration Type Documentation

enum nvec_msg_category - Message categories for nvec_msg_alloc() : The message is an incoming message (from EC) : The message is an outgoing message (to EC)

Enumerator:
NVEC_MSG_RX 
NVEC_MSG_TX 

Definition at line 71 of file nvec.c.

Function Documentation

EXPORT_SYMBOL ( nvec_write_async  )
EXPORT_SYMBOL ( nvec_write_sync  )
EXPORT_SYMBOL_GPL ( nvec_register_notifier  )
EXPORT_SYMBOL_GPL ( nvec_msg_free  )
MODULE_ALIAS ( "platform:nvec"  )
MODULE_AUTHOR ( "Marc Dietrich <[email protected]>"  )
MODULE_DESCRIPTION ( "NVIDIA compliant embedded controller interface )
MODULE_DEVICE_TABLE ( of  ,
nvidia_nvec_of_match   
)
MODULE_LICENSE ( "GPL"  )
module_platform_driver ( nvec_device_driver  )
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_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.