Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
hsi.h File Reference
#include <linux/device.h>
#include <linux/mutex.h>
#include <linux/scatterlist.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/notifier.h>

Go to the source code of this file.

Data Structures

struct  hsi_config
 
struct  hsi_board_info
 
struct  hsi_client
 
struct  hsi_client_driver
 
struct  hsi_msg
 
struct  hsi_port
 
struct  hsi_controller
 

Macros

#define HSI_MSG_READ   0
 
#define HSI_MSG_WRITE   1
 
#define HSI_MAX_CHANNELS   16
 

Enumerations

enum  { HSI_MODE_STREAM = 1, HSI_MODE_FRAME }
 
enum  { HSI_FLOW_SYNC, HSI_FLOW_PIPE }
 
enum  { HSI_ARB_RR, HSI_ARB_PRIO }
 
enum  {
  HSI_STATUS_COMPLETED, HSI_STATUS_PENDING, HSI_STATUS_PROCEEDING, HSI_STATUS_QUEUED,
  HSI_STATUS_ERROR
}
 
enum  { HSI_EVENT_START_RX, HSI_EVENT_STOP_RX }
 

: Name for the HSI device

struct hsi_board_info - HSI client board info

: HSI controller id where the client sits : Port number in the controller where the client sits : HSI TX configuration : HSI RX configuration : Platform related data : Architecture-dependent device data

#define to_hsi_client(dev)   container_of(dev, struct hsi_client, device)
 
#define to_hsi_client_driver(drv)
 
#define to_hsi_port(dev)   container_of(dev, struct hsi_port, device)
 
#define hsi_get_port(cl)   to_hsi_port((cl)->device.parent)
 
#define to_hsi_controller(dev)   container_of(dev, struct hsi_controller, device)
 
int hsi_register_port_event (struct hsi_client *cl, void(*handler)(struct hsi_client *, unsigned long))
 
int hsi_unregister_port_event (struct hsi_client *cl)
 
int hsi_register_client_driver (struct hsi_client_driver *drv)
 
struct hsi_msghsi_alloc_msg (unsigned int n_frag, gfp_t flags)
 
void hsi_free_msg (struct hsi_msg *msg)
 
int hsi_event (struct hsi_port *port, unsigned long event)
 
int hsi_claim_port (struct hsi_client *cl, unsigned int share)
 
void hsi_release_port (struct hsi_client *cl)
 
struct hsi_controllerhsi_alloc_controller (unsigned int n_ports, gfp_t flags)
 
void hsi_put_controller (struct hsi_controller *hsi)
 
int hsi_register_controller (struct hsi_controller *hsi)
 
void hsi_unregister_controller (struct hsi_controller *hsi)
 
int hsi_async (struct hsi_client *cl, struct hsi_msg *msg)
 

Macro Definition Documentation

#define hsi_get_port (   cl)    to_hsi_port((cl)->device.parent)

Definition at line 242 of file hsi.h.

#define HSI_MAX_CHANNELS   16

Definition at line 53 of file hsi.h.

#define HSI_MSG_READ   0

Definition at line 34 of file hsi.h.

#define HSI_MSG_WRITE   1

Definition at line 35 of file hsi.h.

#define to_hsi_client (   dev)    container_of(dev, struct hsi_client, device)

Definition at line 138 of file hsi.h.

#define to_hsi_client_driver (   drv)
Value:

Definition at line 162 of file hsi.h.

#define to_hsi_controller (   dev)    container_of(dev, struct hsi_controller, device)

Definition at line 279 of file hsi.h.

#define to_hsi_port (   dev)    container_of(dev, struct hsi_port, device)

Definition at line 241 of file hsi.h.

Enumeration Type Documentation

anonymous enum
Enumerator:
HSI_MODE_STREAM 
HSI_MODE_FRAME 

Definition at line 38 of file hsi.h.

anonymous enum
Enumerator:
HSI_FLOW_SYNC 
HSI_FLOW_PIPE 

Definition at line 43 of file hsi.h.

anonymous enum
Enumerator:
HSI_ARB_RR 
HSI_ARB_PRIO 

Definition at line 48 of file hsi.h.

anonymous enum
Enumerator:
HSI_STATUS_COMPLETED 
HSI_STATUS_PENDING 
HSI_STATUS_PROCEEDING 
HSI_STATUS_QUEUED 
HSI_STATUS_ERROR 

Definition at line 56 of file hsi.h.

anonymous enum
Enumerator:
HSI_EVENT_START_RX 
HSI_EVENT_STOP_RX 

Definition at line 65 of file hsi.h.

Function Documentation

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.