Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
core.c File Reference
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/err.h>
#include <linux/list.h>
#include <linux/sysfs.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/pinctrl/consumer.h>
#include <linux/pinctrl/pinctrl.h>
#include <linux/pinctrl/machine.h>
#include "core.h"
#include "devicetree.h"
#include "pinmux.h"
#include "pinconf.h"

Go to the source code of this file.

Data Structures

struct  pinctrl_maps
 

Macros

#define pr_fmt(fmt)   "pinctrl core: " fmt
 
#define for_each_maps(_maps_node_, _i_, _map_)
 

Functions

 DEFINE_MUTEX (pinctrl_mutex)
 
 LIST_HEAD (pinctrldev_list)
 
void pinctrl_provide_dummies (void)
 
const charpinctrl_dev_get_name (struct pinctrl_dev *pctldev)
 
 EXPORT_SYMBOL_GPL (pinctrl_dev_get_name)
 
voidpinctrl_dev_get_drvdata (struct pinctrl_dev *pctldev)
 
 EXPORT_SYMBOL_GPL (pinctrl_dev_get_drvdata)
 
struct pinctrl_devget_pinctrl_dev_from_devname (const char *devname)
 
: the name of the pin to look up

pin_get_name_from_id() - look up a pin name from a pin id : the pin control device to lookup the pin on

int pin_get_from_name (struct pinctrl_dev *pctldev, const char *name)
 
const charpin_get_name (struct pinctrl_dev *pctldev, const unsigned pin)
 
bool pin_is_valid (struct pinctrl_dev *pctldev, int pin)
 
 EXPORT_SYMBOL_GPL (pin_is_valid)
 
void pinctrl_add_gpio_range (struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *range)
 
 EXPORT_SYMBOL_GPL (pinctrl_add_gpio_range)
 
void pinctrl_add_gpio_ranges (struct pinctrl_dev *pctldev, struct pinctrl_gpio_range *ranges, unsigned nranges)
 
 EXPORT_SYMBOL_GPL (pinctrl_add_gpio_ranges)
 
int pinctrl_get_group_selector (struct pinctrl_dev *pctldev, const char *pin_group)
 
int pinctrl_request_gpio (unsigned gpio)
 
 EXPORT_SYMBOL_GPL (pinctrl_request_gpio)
 
void pinctrl_free_gpio (unsigned gpio)
 
 EXPORT_SYMBOL_GPL (pinctrl_free_gpio)
 
int pinctrl_gpio_direction_input (unsigned gpio)
 
 EXPORT_SYMBOL_GPL (pinctrl_gpio_direction_input)
 
int pinctrl_gpio_direction_output (unsigned gpio)
 
 EXPORT_SYMBOL_GPL (pinctrl_gpio_direction_output)
 
struct pinctrlpinctrl_get (struct device *dev)
 
 EXPORT_SYMBOL_GPL (pinctrl_get)
 
void pinctrl_put (struct pinctrl *p)
 
 EXPORT_SYMBOL_GPL (pinctrl_put)
 
: the state name to retrieve

pinctrl_lookup_state() - retrieves a state handle from a pinctrl handle : the pinctrl handle to retrieve the state from

struct pinctrl_statepinctrl_lookup_state (struct pinctrl *p, const char *name)
 
 EXPORT_SYMBOL_GPL (pinctrl_lookup_state)
 
int pinctrl_select_state (struct pinctrl *p, struct pinctrl_state *state)
 
 EXPORT_SYMBOL_GPL (pinctrl_select_state)
 
struct pinctrldevm_pinctrl_get (struct device *dev)
 
 EXPORT_SYMBOL_GPL (devm_pinctrl_get)
 
void devm_pinctrl_put (struct pinctrl *p)
 
 EXPORT_SYMBOL_GPL (devm_pinctrl_put)
 
int pinctrl_register_map (struct pinctrl_map const *maps, unsigned num_maps, bool dup, bool locked)
 
int pinctrl_register_mappings (struct pinctrl_map const *maps, unsigned num_maps)
 
void pinctrl_unregister_map (struct pinctrl_map const *map)
 
struct pinctrl_devpinctrl_register (struct pinctrl_desc *pctldesc, struct device *dev, void *driver_data)
 
 EXPORT_SYMBOL_GPL (pinctrl_register)
 
void pinctrl_unregister (struct pinctrl_dev *pctldev)
 
 EXPORT_SYMBOL_GPL (pinctrl_unregister)
 
 core_initcall (pinctrl_init)
 

Macro Definition Documentation

#define for_each_maps (   _maps_node_,
  _i_,
  _map_ 
)
Value:
for (_i_ = 0, _map_ = &_maps_node_->maps[_i_]; \
_i_ < _maps_node_->num_maps; \
_i_++, _map_ = &_maps_node_->maps[_i_])

Definition at line 60 of file core.c.

#define pr_fmt (   fmt)    "pinctrl core: " fmt

Definition at line 14 of file core.c.

Function Documentation

core_initcall ( pinctrl_init  )
DEFINE_MUTEX ( pinctrl_mutex  )
struct pinctrl* devm_pinctrl_get ( struct device dev)
read

struct devm_pinctrl_get() - Resource managed pinctrl_get() : the device to obtain the handle for

If there is a need to explicitly destroy the returned struct pinctrl, devm_pinctrl_put() should be used, rather than plain pinctrl_put().

Definition at line 854 of file core.c.

void devm_pinctrl_put ( struct pinctrl p)

devm_pinctrl_put() - Resource managed pinctrl_put() : the pinctrl handle to release

Deallocate a struct pinctrl obtained via devm_pinctrl_get(). Normally this function will not need to be called and the resource management code will ensure that the resource is freed.

Definition at line 889 of file core.c.

EXPORT_SYMBOL_GPL ( pinctrl_dev_get_name  )
EXPORT_SYMBOL_GPL ( pinctrl_dev_get_drvdata  )
EXPORT_SYMBOL_GPL ( pin_is_valid  )
EXPORT_SYMBOL_GPL ( pinctrl_add_gpio_range  )
EXPORT_SYMBOL_GPL ( pinctrl_add_gpio_ranges  )
EXPORT_SYMBOL_GPL ( pinctrl_request_gpio  )
EXPORT_SYMBOL_GPL ( pinctrl_free_gpio  )
EXPORT_SYMBOL_GPL ( pinctrl_gpio_direction_input  )
EXPORT_SYMBOL_GPL ( pinctrl_gpio_direction_output  )
EXPORT_SYMBOL_GPL ( pinctrl_get  )
EXPORT_SYMBOL_GPL ( pinctrl_put  )
EXPORT_SYMBOL_GPL ( pinctrl_lookup_state  )
EXPORT_SYMBOL_GPL ( pinctrl_select_state  )
EXPORT_SYMBOL_GPL ( devm_pinctrl_get  )
EXPORT_SYMBOL_GPL ( devm_pinctrl_put  )
EXPORT_SYMBOL_GPL ( pinctrl_register  )
EXPORT_SYMBOL_GPL ( pinctrl_unregister  )
struct pinctrl_dev* get_pinctrl_dev_from_devname ( const char devname)
read

get_pinctrl_dev_from_devname() - look up pin controller device : the name of a device instance, as returned by dev_name()

Looks up a pin control device matching a certain device name or pure device pointer, the pure device pointer will take precedence.

Definition at line 99 of file core.c.

LIST_HEAD ( pinctrldev_list  )
int pin_get_from_name ( struct pinctrl_dev pctldev,
const char name 
)

Definition at line 123 of file core.c.

const char* pin_get_name ( struct pinctrl_dev pctldev,
const unsigned  pin 
)

Definition at line 148 of file core.c.

bool pin_is_valid ( struct pinctrl_dev pctldev,
int  pin 
)

pin_is_valid() - check if pin exists on controller : the pin control device to check the pin on : pin to check, use the local pin controller index number

This tells us whether a certain pin exist on a certain pin controller or not. Pin lists may be sparse, so some pins may not exist.

Definition at line 170 of file core.c.

void pinctrl_add_gpio_range ( struct pinctrl_dev pctldev,
struct pinctrl_gpio_range *  range 
)

pinctrl_add_gpio_range() - register a GPIO range for a controller : pin controller device to add the range to : the GPIO range to add

This adds a range of GPIOs to be handled by a certain pin controller. Call this to register handled ranges after registering your pin controller.

Definition at line 328 of file core.c.

void pinctrl_add_gpio_ranges ( struct pinctrl_dev pctldev,
struct pinctrl_gpio_range *  ranges,
unsigned  nranges 
)

Definition at line 337 of file core.c.

void* pinctrl_dev_get_drvdata ( struct pinctrl_dev pctldev)

Definition at line 86 of file core.c.

const char* pinctrl_dev_get_name ( struct pinctrl_dev pctldev)

Definition at line 79 of file core.c.

void pinctrl_free_gpio ( unsigned  gpio)

pinctrl_free_gpio() - free control on a single pin, currently used as GPIO : the GPIO pin number from the GPIO subsystem number space

This function should ONLY be used from gpiolib-based GPIO drivers, as part of their gpio_free() semantics, platforms and individual drivers shall NOT request GPIO pins to be muxed out.

Definition at line 421 of file core.c.

struct pinctrl* pinctrl_get ( struct device dev)
read

pinctrl_get() - retrieves the pinctrl handle for a device : the device to obtain the handle for

Definition at line 669 of file core.c.

int pinctrl_get_group_selector ( struct pinctrl_dev pctldev,
const char pin_group 
)

pinctrl_get_group_selector() - returns the group selector for a group : the pin controller handling the group : the pin group to look up

Definition at line 353 of file core.c.

int pinctrl_gpio_direction_input ( unsigned  gpio)

pinctrl_gpio_direction_input() - request a GPIO pin to go into input mode : the GPIO pin number from the GPIO subsystem number space

This function should ONLY be used from gpiolib-based GPIO drivers, as part of their gpio_direction_input() semantics, platforms and individual drivers shall NOT touch pin control GPIO calls.

Definition at line 470 of file core.c.

int pinctrl_gpio_direction_output ( unsigned  gpio)

pinctrl_gpio_direction_output() - request a GPIO pin to go into output mode : the GPIO pin number from the GPIO subsystem number space

This function should ONLY be used from gpiolib-based GPIO drivers, as part of their gpio_direction_output() semantics, platforms and individual drivers shall NOT touch pin control GPIO calls.

Definition at line 488 of file core.c.

struct pinctrl_state* pinctrl_lookup_state ( struct pinctrl p,
const char name 
)
read

Definition at line 751 of file core.c.

void pinctrl_provide_dummies ( void  )

pinctrl_provide_dummies() - indicate if pinctrl provides dummy state support

Usually this function is called by platforms without pinctrl driver support but run with some shared drivers using pinctrl APIs. After calling this function, the pinctrl core will return successfully with creating a dummy state for the driver to keep going smoothly.

Definition at line 74 of file core.c.

void pinctrl_put ( struct pinctrl p)

pinctrl_put() - release a previously claimed pinctrl handle : the pinctrl handle to release

Definition at line 719 of file core.c.

struct pinctrl_dev* pinctrl_register ( struct pinctrl_desc *  pctldesc,
struct device dev,
void driver_data 
)
read

pinctrl_register() - register a pin controller device : descriptor for this pin controller : parent device for this pin controller : private pin controller data for this pin controller

Definition at line 1386 of file core.c.

int pinctrl_register_map ( struct pinctrl_map const maps,
unsigned  num_maps,
bool  dup,
bool  locked 
)

Definition at line 897 of file core.c.

int pinctrl_register_mappings ( struct pinctrl_map const maps,
unsigned  num_maps 
)

pinctrl_register_mappings() - register a set of pin controller mappings : the pincontrol mappings table to register. This should probably be marked with __initdata so it can be discarded after boot. This function will perform a shallow copy for the mapping entries. : the number of maps in the mapping table

Definition at line 982 of file core.c.

int pinctrl_request_gpio ( unsigned  gpio)

pinctrl_request_gpio() - request a single pin to be used in as GPIO : the GPIO pin number from the GPIO subsystem number space

This function should ONLY be used from gpiolib-based GPIO drivers, as part of their gpio_request() semantics, platforms and individual drivers shall NOT request GPIO pins to be muxed in.

Definition at line 388 of file core.c.

int pinctrl_select_state ( struct pinctrl p,
struct pinctrl_state state 
)

pinctrl_select() - select/activate/program a pinctrl state to HW : the pinctrl handle for the device that requests configuratio : the state handle to select/activate/program

Definition at line 830 of file core.c.

void pinctrl_unregister ( struct pinctrl_dev pctldev)

pinctrl_unregister() - unregister pinmux : pin controller to unregister

Called by pinmux drivers to unregister a pinmux.

Definition at line 1475 of file core.c.

void pinctrl_unregister_map ( struct pinctrl_map const map)

Definition at line 988 of file core.c.