Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
hsi.c File Reference
#include <linux/hsi/hsi.h>
#include <linux/compiler.h>
#include <linux/list.h>
#include <linux/kobject.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/notifier.h>
#include "hsi_core.h"

Go to the source code of this file.

Functions

void hsi_unregister_controller (struct hsi_controller *hsi)
 
 EXPORT_SYMBOL_GPL (hsi_unregister_controller)
 
int hsi_register_controller (struct hsi_controller *hsi)
 
 EXPORT_SYMBOL_GPL (hsi_register_controller)
 
int hsi_register_client_driver (struct hsi_client_driver *drv)
 
 EXPORT_SYMBOL_GPL (hsi_register_client_driver)
 
void hsi_put_controller (struct hsi_controller *hsi)
 
 EXPORT_SYMBOL_GPL (hsi_put_controller)
 
struct hsi_controllerhsi_alloc_controller (unsigned int n_ports, gfp_t flags)
 
 EXPORT_SYMBOL_GPL (hsi_alloc_controller)
 
void hsi_free_msg (struct hsi_msg *msg)
 
 EXPORT_SYMBOL_GPL (hsi_free_msg)
 
struct hsi_msghsi_alloc_msg (unsigned int nents, gfp_t flags)
 
 EXPORT_SYMBOL_GPL (hsi_alloc_msg)
 
int hsi_async (struct hsi_client *cl, struct hsi_msg *msg)
 
 EXPORT_SYMBOL_GPL (hsi_async)
 
int hsi_claim_port (struct hsi_client *cl, unsigned int share)
 
 EXPORT_SYMBOL_GPL (hsi_claim_port)
 
void hsi_release_port (struct hsi_client *cl)
 
 EXPORT_SYMBOL_GPL (hsi_release_port)
 
int hsi_register_port_event (struct hsi_client *cl, void(*handler)(struct hsi_client *, unsigned long))
 
 EXPORT_SYMBOL_GPL (hsi_register_port_event)
 
int hsi_unregister_port_event (struct hsi_client *cl)
 
 EXPORT_SYMBOL_GPL (hsi_unregister_port_event)
 
int hsi_event (struct hsi_port *port, unsigned long event)
 
 EXPORT_SYMBOL_GPL (hsi_event)
 
 postcore_initcall (hsi_init)
 
 module_exit (hsi_exit)
 
 MODULE_AUTHOR ("Carlos Chinea <[email protected]>")
 
 MODULE_DESCRIPTION ("High-speed Synchronous Serial Interface (HSI) framework")
 
 MODULE_LICENSE ("GPL v2")
 

Function Documentation

EXPORT_SYMBOL_GPL ( hsi_unregister_controller  )
EXPORT_SYMBOL_GPL ( hsi_register_controller  )
EXPORT_SYMBOL_GPL ( hsi_register_client_driver  )
EXPORT_SYMBOL_GPL ( hsi_put_controller  )
EXPORT_SYMBOL_GPL ( hsi_alloc_controller  )
EXPORT_SYMBOL_GPL ( hsi_free_msg  )
EXPORT_SYMBOL_GPL ( hsi_alloc_msg  )
EXPORT_SYMBOL_GPL ( hsi_async  )
EXPORT_SYMBOL_GPL ( hsi_claim_port  )
EXPORT_SYMBOL_GPL ( hsi_release_port  )
EXPORT_SYMBOL_GPL ( hsi_register_port_event  )
EXPORT_SYMBOL_GPL ( hsi_unregister_port_event  )
EXPORT_SYMBOL_GPL ( hsi_event  )
struct hsi_controller* hsi_alloc_controller ( unsigned int  n_ports,
gfp_t  flags 
)
read

hsi_alloc_controller - Allocate an HSI controller and its ports : Number of ports on the HSI controller : Kernel allocation flags

Return NULL on failure or a pointer to an hsi_controller on success.

Definition at line 228 of file hsi.c.

struct hsi_msg* hsi_alloc_msg ( unsigned int  nents,
gfp_t  flags 
)
read

hsi_alloc_msg - Allocate an HSI message : Number of memory entries : Kernel allocation flags

nents can be 0. This mainly makes sense for read transfer. In that case, HSI drivers will call the complete callback when there is data to be read without consuming it.

Return NULL on failure or a pointer to an hsi_msg on success.

Definition at line 302 of file hsi.c.

int hsi_async ( struct hsi_client cl,
struct hsi_msg msg 
)

hsi_async - Submit an HSI transfer to the controller : HSI client sending the transfer : The HSI transfer passed to controller

The HSI message must have the channel, ttype, complete and destructor fields set beforehand. If nents > 0 then the client has to initialize also the scatterlists to point to the buffers to write to or read from.

HSI controllers relay on pre-allocated buffers from their clients and they do not allocate buffers on their own.

Once the HSI message transfer finishes, the HSI controller calls the complete callback with the status and actual_len fields of the HSI message updated. The complete callback can be called before returning from hsi_async.

Returns -errno on failure or 0 on success

Definition at line 343 of file hsi.c.

int hsi_claim_port ( struct hsi_client cl,
unsigned int  share 
)

hsi_claim_port - Claim the HSI client's port : HSI client that wants to claim its port : Flag to indicate if the client wants to share the port or not.

Returns -errno on failure, 0 on success.

Definition at line 364 of file hsi.c.

int hsi_event ( struct hsi_port port,
unsigned long  event 
)

hsi_event -Notifies clients about port events : Port where the event occurred : The event type

Clients should not be concerned about wake line behavior. However, due to a race condition in HSI HW protocol, clients need to be notified about wake line changes, so they can implement a workaround for it.

Events: HSI_EVENT_START_RX - Incoming wake line high HSI_EVENT_STOP_RX - Incoming wake line down

Returns -errno on error, or 0 on success.

Definition at line 487 of file hsi.c.

void hsi_free_msg ( struct hsi_msg msg)

hsi_free_msg - Free an HSI message : Pointer to the HSI message

Client is responsible to free the buffers pointed by the scatterlists.

Definition at line 282 of file hsi.c.

void hsi_put_controller ( struct hsi_controller hsi)

hsi_put_controller - Free an HSI controller

: Pointer to the HSI controller to freed

HSI controller drivers should only use this function if they need to free their allocated hsi_controller structures before a successful call to hsi_register_controller. Other use is not allowed.

Definition at line 207 of file hsi.c.

int hsi_register_client_driver ( struct hsi_client_driver drv)

hsi_register_client_driver - Register an HSI client to the HSI bus : HSI client driver to register

Returns -errno on failure, 0 on success.

Definition at line 180 of file hsi.c.

int hsi_register_controller ( struct hsi_controller hsi)

hsi_register_controller - Register an HSI controller and its ports : The HSI controller to register

Returns -errno on failure, 0 on success.

Definition at line 147 of file hsi.c.

int hsi_register_port_event ( struct hsi_client cl,
void(*)(struct hsi_client *, unsigned long handler 
)

hsi_register_port_event - Register a client to receive port events : HSI client that wants to receive port events : Event handler callback

Clients should register a callback to be able to receive events from the ports. Registration should happen after claiming the port. The handler can be called in interrupt context.

Returns -errno on error, or 0 on success.

Definition at line 432 of file hsi.c.

void hsi_release_port ( struct hsi_client cl)

hsi_release_port - Release the HSI client's port : HSI client which previously claimed its port

Definition at line 392 of file hsi.c.

void hsi_unregister_controller ( struct hsi_controller hsi)

hsi_unregister_controller - Unregister an HSI controller : The HSI controller to register

Definition at line 134 of file hsi.c.

int hsi_unregister_port_event ( struct hsi_client cl)

hsi_unregister_port_event - Stop receiving port events for a client : HSI client that wants to stop receiving port events

Clients should call this function before releasing their associated port.

Returns -errno on error, or 0 on success.

Definition at line 457 of file hsi.c.

MODULE_AUTHOR ( "Carlos Chinea <[email protected]>"  )
MODULE_DESCRIPTION ( "High-speed Synchronous Serial Interface (HSI) framework"  )
module_exit ( hsi_exit  )
MODULE_LICENSE ( "GPL v2 )
postcore_initcall ( hsi_init  )