Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions
gpio-cfg.h File Reference
#include <linux/types.h>

Go to the source code of this file.

Data Structures

struct  samsung_gpio_cfg


#define __PLAT_GPIO_CFG_H   __FILE__
#define S3C_GPIO_SPECIAL_MARK   (0xfffffff0)
#define S3C_GPIO_SFN(x)   (S3C_GPIO_SPECIAL(x))
#define samsung_gpio_is_cfg_special(_cfg)   (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)
#define S3C_GPIO_PULL_NONE   ((__force samsung_gpio_pull_t)0x00)
#define S3C_GPIO_PULL_DOWN   ((__force samsung_gpio_pull_t)0x01)
#define S3C_GPIO_PULL_UP   ((__force samsung_gpio_pull_t)0x02)
#define S5P_GPIO_DRVSTR_LV1   ((__force s5p_gpio_drvstr_t)0x0)
#define S5P_GPIO_DRVSTR_LV2   ((__force s5p_gpio_drvstr_t)0x2)
#define S5P_GPIO_DRVSTR_LV3   ((__force s5p_gpio_drvstr_t)0x1)
#define S5P_GPIO_DRVSTR_LV4   ((__force s5p_gpio_drvstr_t)0x3)
#define s5p_register_gpioint_bank(chain_irq, start, nr_groups)   do { } while (0)


typedef unsigned int __bitwise__ samsung_gpio_pull_t
typedef unsigned int __bitwise__ s5p_gpio_drvstr_t


int s3c_gpio_cfgpin (unsigned int pin, unsigned int to)
unsigned s3c_gpio_getcfg (unsigned int pin)
int s3c_gpio_cfgpin_range (unsigned int start, unsigned int nr, unsigned int cfg)
int s3c_gpio_setpull (unsigned int pin, samsung_gpio_pull_t pull)
samsung_gpio_pull_t s3c_gpio_getpull (unsigned int pin)
int s3c_gpio_cfgall_range (unsigned int start, unsigned int nr, unsigned int cfg, samsung_gpio_pull_t pull)
s5p_gpio_drvstr_t s5p_gpio_get_drvstr (unsigned int pin)
int s5p_gpio_set_drvstr (unsigned int pin, s5p_gpio_drvstr_t drvstr)
int s5p_register_gpio_interrupt (int pin)

Macro Definition Documentation

#define __PLAT_GPIO_CFG_H   __FILE__

Definition at line 25 of file gpio-cfg.h.


Definition at line 70 of file gpio-cfg.h.


Definition at line 71 of file gpio-cfg.h.

#define S3C_GPIO_PULL_DOWN   ((__force samsung_gpio_pull_t)0x01)

Definition at line 134 of file gpio-cfg.h.

#define S3C_GPIO_PULL_NONE   ((__force samsung_gpio_pull_t)0x00)

Definition at line 133 of file gpio-cfg.h.

#define S3C_GPIO_PULL_UP   ((__force samsung_gpio_pull_t)0x02)

Definition at line 135 of file gpio-cfg.h.

#define S3C_GPIO_SFN (   x)    (S3C_GPIO_SPECIAL(x))

Definition at line 72 of file gpio-cfg.h.

#define S3C_GPIO_SPECIAL (   x)    (S3C_GPIO_SPECIAL_MARK | (x))

Definition at line 67 of file gpio-cfg.h.

#define S3C_GPIO_SPECIAL_MARK   (0xfffffff0)

Definition at line 66 of file gpio-cfg.h.

#define S5P_GPIO_DRVSTR_LV1   ((__force s5p_gpio_drvstr_t)0x0)

Definition at line 188 of file gpio-cfg.h.

#define S5P_GPIO_DRVSTR_LV2   ((__force s5p_gpio_drvstr_t)0x2)

Definition at line 189 of file gpio-cfg.h.

#define S5P_GPIO_DRVSTR_LV3   ((__force s5p_gpio_drvstr_t)0x1)

Definition at line 190 of file gpio-cfg.h.

#define S5P_GPIO_DRVSTR_LV4   ((__force s5p_gpio_drvstr_t)0x3)

Definition at line 191 of file gpio-cfg.h.

#define s5p_register_gpioint_bank (   chain_irq,
)    do { } while (0)

s5p_register_gpioint_bank() - add gpio bank for further gpio interrupt registration (see s5p_register_gpio_interrupt function) : chained irq number for the gpio int handler for this bank : start gpio group number of this bank : number of gpio groups handled by this bank

This functions registers initial information about gpio banks that can be later used by the s5p_register_gpio_interrupt() function to enable support for gpio interrupt for particular gpio group.

Definition at line 243 of file gpio-cfg.h.

#define samsung_gpio_is_cfg_special (   _cfg)    (((_cfg) & S3C_GPIO_SPECIAL_MARK) == S3C_GPIO_SPECIAL_MARK)

Definition at line 74 of file gpio-cfg.h.

Typedef Documentation

typedef unsigned int __bitwise__ s5p_gpio_drvstr_t

Definition at line 30 of file gpio-cfg.h.

Definition at line 29 of file gpio-cfg.h.

Function Documentation

int s3c_gpio_cfgall_range ( unsigned int  start,
unsigned int  nr,
unsigned int  cfg,
samsung_gpio_pull_t  pull 

s3c_gpio_cfgall_range() - configure range of gpio functtion and pull. : The gpio number to start at. : The number of gpio to configure from . : The configuration to use : The pull setting to use.

Run s3c_gpio_cfgpin() and s3c_gpio_setpull() over the gpio range starting and running for .

See Also

Definition at line 3145 of file gpio-samsung.c.

int s3c_gpio_cfgpin ( unsigned int  pin,
unsigned int  to 

s3c_gpio_cfgpin() - Change the GPIO function of a pin. pin The pin number to configure. to The configuration for the pin's function.

Configure which function is actually connected to the external pin, such as an gpio input, output or some form of special function connected to an internal peripheral block.

The parameter can be one of the generic S3C_GPIO_INPUT, S3C_GPIO_OUTPUT or S3C_GPIO_SFN() to indicate one of the possible values that the helper will then generate the correct bit mask and shift for the configuration.

If a bank of GPIOs all needs to be set to special-function 2, then the following code will work:

for (gpio = start; gpio < end; gpio++) s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));

The parameter can also be a specific value already shifted to the correct position in the control register, although these are discouraged in newer kernels and are only being kept for compatibility.

Definition at line 3110 of file gpio-samsung.c.

int s3c_gpio_cfgpin_range ( unsigned int  start,
unsigned int  nr,
unsigned int  cfg 

s3c_gpio_cfgpin_range() - Change the GPIO function for configuring pin range : The pin number to start at : The number of pins to configure from . : The configuration for the pin's function

Call s3c_gpio_cfgpin() for the pins starting at .

See Also

Definition at line 3130 of file gpio-samsung.c.

unsigned s3c_gpio_getcfg ( unsigned int  pin)

s3c_gpio_getcfg - Read the current function for a GPIO pin : The pin to read the configuration value for.

Read the configuration state of the given , returning a value that could be passed back to s3c_gpio_cfgpin().

See Also

Definition at line 3161 of file gpio-samsung.c.

samsung_gpio_pull_t s3c_gpio_getpull ( unsigned int  pin)

s3c_gpio_getpull() - get the pull resistor state of a gpio pin : The pin number to get the settings for

Read the pull resistor value for the specified pin.

Definition at line 3199 of file gpio-samsung.c.

int s3c_gpio_setpull ( unsigned int  pin,
samsung_gpio_pull_t  pull 

s3c_gpio_setpull() - set the state of a gpio pin pull resistor : The pin number to configure the pull resistor. : The configuration for the pull resistor.

This function sets the state of the pull-{up,down} resistor for the specified pin. It will return 0 if successful, or a negative error code if the pin cannot support the requested pull setting.


Definition at line 3180 of file gpio-samsung.c.

s5p_gpio_drvstr_t s5p_gpio_get_drvstr ( unsigned int  pin)

s5c_gpio_get_drvstr() - get the driver streght value of a gpio pin : The pin number to get the settings for

Read the driver streght value for the specified pin.

int s5p_gpio_set_drvstr ( unsigned int  pin,
s5p_gpio_drvstr_t  drvstr 

s3c_gpio_set_drvstr() - set the driver streght value of a gpio pin : The pin number to configure the driver streght value : The new value of the driver strength

This function sets the driver strength value for the specified pin. It will return 0 if successful, or a negative error code if the pin cannot support the requested setting.

int s5p_register_gpio_interrupt ( int  pin)

s5p_register_gpio_interrupt() - register interrupt support for a gpio group : The pin number from the group to be registered

This function registers gpio interrupt support for the group that the specified pin belongs to.

The total number of gpio pins is quite large ob s5p series. Registering irq support for all of them would be a resource waste. Because of that the interrupt support for standard gpio pins is registered dynamically.

It will return the irq number of the interrupt that has been registered or -ENOMEM if no more gpio interrupts can be registered. It is allowed to call this function more than once for the same gpio group (the group will be registered only once).

Definition at line 174 of file s5p-irq-gpioint.c.