Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
regmap.c File Reference
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/export.h>
#include <linux/mutex.h>
#include <linux/err.h>
#include <linux/rbtree.h>
#include <trace/events/regmap.h>
#include "internal.h"

Go to the source code of this file.

Macros

#define CREATE_TRACE_POINTS
 

Functions

bool regmap_writeable (struct regmap *map, unsigned int reg)
 
bool regmap_readable (struct regmap *map, unsigned int reg)
 
bool regmap_volatile (struct regmap *map, unsigned int reg)
 
bool regmap_precious (struct regmap *map, unsigned int reg)
 
struct regmapregmap_init (struct device *dev, const struct regmap_bus *bus, void *bus_context, const struct regmap_config *config)
 
 EXPORT_SYMBOL_GPL (regmap_init)
 
struct regmapdevm_regmap_init (struct device *dev, const struct regmap_bus *bus, void *bus_context, const struct regmap_config *config)
 
 EXPORT_SYMBOL_GPL (devm_regmap_init)
 
int regmap_reinit_cache (struct regmap *map, const struct regmap_config *config)
 
 EXPORT_SYMBOL_GPL (regmap_reinit_cache)
 
void regmap_exit (struct regmap *map)
 
 EXPORT_SYMBOL_GPL (regmap_exit)
 
: Optional name for the register map, usually NULL.

dev_get_regmap(): Obtain the regmap (if any) for a device

: Device to retrieve the map for

Returns the regmap for the device if one is present, or NULL. If name is specified then it must match the name specified when registering the device, if it is NULL then the first regmap found will be used. Devices with multiple register maps are very rare, generic code should normally not need to specify a name.

struct regmapdev_get_regmap (struct device *dev, const char *name)
 
 EXPORT_SYMBOL_GPL (dev_get_regmap)
 
int _regmap_write (struct regmap *map, unsigned int reg, unsigned int val)
 
int regmap_write (struct regmap *map, unsigned int reg, unsigned int val)
 
 EXPORT_SYMBOL_GPL (regmap_write)
 
int regmap_raw_write (struct regmap *map, unsigned int reg, const void *val, size_t val_len)
 
 EXPORT_SYMBOL_GPL (regmap_raw_write)
 
int regmap_bulk_write (struct regmap *map, unsigned int reg, const void *val, size_t val_count)
 
 EXPORT_SYMBOL_GPL (regmap_bulk_write)
 
int regmap_read (struct regmap *map, unsigned int reg, unsigned int *val)
 
 EXPORT_SYMBOL_GPL (regmap_read)
 
int regmap_raw_read (struct regmap *map, unsigned int reg, void *val, size_t val_len)
 
 EXPORT_SYMBOL_GPL (regmap_raw_read)
 
int regmap_bulk_read (struct regmap *map, unsigned int reg, void *val, size_t val_count)
 
 EXPORT_SYMBOL_GPL (regmap_bulk_read)
 
int regmap_update_bits (struct regmap *map, unsigned int reg, unsigned int mask, unsigned int val)
 
 EXPORT_SYMBOL_GPL (regmap_update_bits)
 
int regmap_update_bits_check (struct regmap *map, unsigned int reg, unsigned int mask, unsigned int val, bool *change)
 
 EXPORT_SYMBOL_GPL (regmap_update_bits_check)
 
int regmap_register_patch (struct regmap *map, const struct reg_default *regs, int num_regs)
 
 EXPORT_SYMBOL_GPL (regmap_register_patch)
 
int regmap_get_val_bytes (struct regmap *map)
 
 EXPORT_SYMBOL_GPL (regmap_get_val_bytes)
 
 postcore_initcall (regmap_initcall)
 

Macro Definition Documentation

#define CREATE_TRACE_POINTS

Definition at line 20 of file regmap.c.

Function Documentation

int _regmap_write ( struct regmap map,
unsigned int  reg,
unsigned int  val 
)

Definition at line 876 of file regmap.c.

struct regmap* dev_get_regmap ( struct device dev,
const char name 
)
read

Definition at line 729 of file regmap.c.

struct regmap* devm_regmap_init ( struct device dev,
const struct regmap_bus *  bus,
void bus_context,
const struct regmap_config *  config 
)
read

devm_regmap_init(): Initialise managed register map

: Device that will be interacted with : Bus-specific callbacks to use with device : Data passed to bus-specific callbacks : Configuration for register map

The return value will be an ERR_PTR() on error or a valid pointer to a struct regmap. This function should generally not be called directly, it should be called by bus-specific init functions. The map will be automatically freed by the device management code.

Definition at line 629 of file regmap.c.

EXPORT_SYMBOL_GPL ( regmap_init  )
EXPORT_SYMBOL_GPL ( devm_regmap_init  )
EXPORT_SYMBOL_GPL ( regmap_reinit_cache  )
EXPORT_SYMBOL_GPL ( regmap_exit  )
EXPORT_SYMBOL_GPL ( dev_get_regmap  )
EXPORT_SYMBOL_GPL ( regmap_write  )
EXPORT_SYMBOL_GPL ( regmap_raw_write  )
EXPORT_SYMBOL_GPL ( regmap_bulk_write  )
EXPORT_SYMBOL_GPL ( regmap_read  )
EXPORT_SYMBOL_GPL ( regmap_raw_read  )
EXPORT_SYMBOL_GPL ( regmap_bulk_read  )
EXPORT_SYMBOL_GPL ( regmap_update_bits  )
EXPORT_SYMBOL_GPL ( regmap_update_bits_check  )
EXPORT_SYMBOL_GPL ( regmap_register_patch  )
EXPORT_SYMBOL_GPL ( regmap_get_val_bytes  )
postcore_initcall ( regmap_initcall  )
int regmap_bulk_read ( struct regmap map,
unsigned int  reg,
void val,
size_t  val_count 
)

regmap_bulk_read(): Read multiple registers from the device

: Register map to write to : First register to be read from : Pointer to store read value, in native register size for device : Number of registers to read

A value of zero will be returned on success, a negative errno will be returned in error cases.

Definition at line 1213 of file regmap.c.

int regmap_bulk_write ( struct regmap map,
unsigned int  reg,
const void val,
size_t  val_count 
)

Definition at line 1002 of file regmap.c.

void regmap_exit ( struct regmap map)

regmap_exit(): Free a previously allocated register map

Definition at line 690 of file regmap.c.

int regmap_get_val_bytes ( struct regmap map)

Definition at line 1400 of file regmap.c.

struct regmap* regmap_init ( struct device dev,
const struct regmap_bus *  bus,
void bus_context,
const struct regmap_config *  config 
)
read

regmap_init(): Initialise register map

: Device that will be interacted with : Bus-specific callbacks to use with device : Data passed to bus-specific callbacks : Configuration for register map

The return value will be an ERR_PTR() on error or a valid pointer to a struct regmap. This function should generally not be called directly, it should be called by bus-specific init functions.

Definition at line 319 of file regmap.c.

bool regmap_precious ( struct regmap map,
unsigned int  reg 
)

Definition at line 73 of file regmap.c.

int regmap_raw_read ( struct regmap map,
unsigned int  reg,
void val,
size_t  val_len 
)

regmap_raw_read(): Read raw data from the device

: Register map to write to : First register to be read from : Pointer to store read value : Size of data to read

A value of zero will be returned on success, a negative errno will be returned in error cases.

Definition at line 1161 of file regmap.c.

int regmap_raw_write ( struct regmap map,
unsigned int  reg,
const void val,
size_t  val_len 
)

regmap_raw_write(): Write raw values to one or more registers

: Register map to write to : Initial register to write to : Block of data to be written, laid out for direct transmission to the device : Length of data pointed to by val.

This function is intended to be used for things like firmware download where a large block of data needs to be transferred to the device. No formatting will be done on the data provided.

A value of zero will be returned on success, a negative errno will be returned in error cases.

Definition at line 968 of file regmap.c.

int regmap_read ( struct regmap map,
unsigned int  reg,
unsigned int val 
)

regmap_read(): Read a value from a single register

: Register map to write to : Register to be read from : Pointer to store read value

A value of zero will be returned on success, a negative errno will be returned in error cases.

Definition at line 1133 of file regmap.c.

bool regmap_readable ( struct regmap map,
unsigned int  reg 
)

Definition at line 48 of file regmap.c.

int regmap_register_patch ( struct regmap map,
const struct reg_default regs,
int  num_regs 
)

regmap_register_patch: Register and apply register updates to be applied on device initialistion

: Register map to apply updates to. : Values to update. : Number of entries in regs.

Register a set of register updates to be applied to the device whenever the device registers are synchronised with the cache and apply them immediately. Typically this is used to apply corrections to be applied to the device defaults on startup, such as the updates some vendors provide to undocumented registers.

Definition at line 1350 of file regmap.c.

int regmap_reinit_cache ( struct regmap map,
const struct regmap_config *  config 
)

regmap_reinit_cache(): Reinitialise the current register cache

: Register map to operate on. : New configuration. Only the cache data will be used.

Discard any existing register cache for the map and initialize a new cache. This can be used to restore the cache to defaults or to update the cache configuration to reflect runtime discovery of the hardware.

No explicit locking is done here, the user needs to ensure that this function will not race with other calls to regmap.

Definition at line 666 of file regmap.c.

int regmap_update_bits ( struct regmap map,
unsigned int  reg,
unsigned int  mask,
unsigned int  val 
)

regmap_update_bits: Perform a read/modify/write cycle on the register map

: Register map to update : Register to update : Bitmask to change : New value for bitmask

Returns zero for success, a negative number on error.

Definition at line 1297 of file regmap.c.

int regmap_update_bits_check ( struct regmap map,
unsigned int  reg,
unsigned int  mask,
unsigned int  val,
bool change 
)

regmap_update_bits_check: Perform a read/modify/write cycle on the register map and report if updated

: Register map to update : Register to update : Bitmask to change : New value for bitmask : Boolean indicating if a write was done

Returns zero for success, a negative number on error.

Definition at line 1323 of file regmap.c.

bool regmap_volatile ( struct regmap map,
unsigned int  reg 
)

Definition at line 62 of file regmap.c.

int regmap_write ( struct regmap map,
unsigned int  reg,
unsigned int  val 
)

regmap_write(): Write a value to a single register

: Register map to write to : Register to write to : Value to be written

A value of zero will be returned on success, a negative errno will be returned in error cases.

Definition at line 935 of file regmap.c.

bool regmap_writeable ( struct regmap map,
unsigned int  reg 
)

Definition at line 37 of file regmap.c.