Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
gpio-samsung.c File Reference
#include <linux/kernel.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/ioport.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/of_address.h>
#include <asm/irq.h>
#include <mach/hardware.h>
#include <mach/map.h>
#include <mach/regs-clock.h>
#include <mach/regs-gpio.h>
#include <plat/cpu.h>
#include <plat/gpio-core.h>
#include <plat/gpio-cfg.h>
#include <plat/gpio-cfg-helpers.h>
#include <plat/gpio-fns.h>
#include <plat/pm.h>

Go to the source code of this file.

Macros

#define gpio_dbg(x...)   do { } while (0)
 

Functions

int samsung_gpio_setpull_updown (struct samsung_gpio_chip *chip, unsigned int off, samsung_gpio_pull_t pull)
 
samsung_gpio_pull_t samsung_gpio_getpull_updown (struct samsung_gpio_chip *chip, unsigned int off)
 
int s3c2443_gpio_setpull (struct samsung_gpio_chip *chip, unsigned int off, samsung_gpio_pull_t pull)
 
samsung_gpio_pull_t s3c2443_gpio_getpull (struct samsung_gpio_chip *chip, unsigned int off)
 
samsung_gpio_pull_t s3c24xx_gpio_getpull_1up (struct samsung_gpio_chip *chip, unsigned int off)
 
int s3c24xx_gpio_setpull_1up (struct samsung_gpio_chip *chip, unsigned int off, samsung_gpio_pull_t pull)
 
samsung_gpio_pull_t s3c24xx_gpio_getpull_1down (struct samsung_gpio_chip *chip, unsigned int off)
 
int s3c24xx_gpio_setpull_1down (struct samsung_gpio_chip *chip, unsigned int off, samsung_gpio_pull_t pull)
 
int samsung_gpiolib_to_irq (struct gpio_chip *chip, unsigned int offset)
 
 core_initcall (samsung_gpiolib_init)
 
int s3c_gpio_cfgpin (unsigned int pin, unsigned int config)
 
 EXPORT_SYMBOL (s3c_gpio_cfgpin)
 
int s3c_gpio_cfgpin_range (unsigned int start, unsigned int nr, unsigned int cfg)
 
 EXPORT_SYMBOL_GPL (s3c_gpio_cfgpin_range)
 
int s3c_gpio_cfgall_range (unsigned int start, unsigned int nr, unsigned int cfg, samsung_gpio_pull_t pull)
 
 EXPORT_SYMBOL_GPL (s3c_gpio_cfgall_range)
 
unsigned s3c_gpio_getcfg (unsigned int pin)
 
 EXPORT_SYMBOL (s3c_gpio_getcfg)
 
int s3c_gpio_setpull (unsigned int pin, samsung_gpio_pull_t pull)
 
 EXPORT_SYMBOL (s3c_gpio_setpull)
 
samsung_gpio_pull_t s3c_gpio_getpull (unsigned int pin)
 
 EXPORT_SYMBOL (s3c_gpio_getpull)
 

Variables

struct samsung_gpio_cfg s3c24xx_gpiocfg_default
 
struct samsung_gpio_chip s3c24xx_gpios []
 

Macro Definition Documentation

#define gpio_dbg (   x...)    do { } while (0)

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

Function Documentation

core_initcall ( samsung_gpiolib_init  )
EXPORT_SYMBOL ( s3c_gpio_cfgpin  )
EXPORT_SYMBOL ( s3c_gpio_getcfg  )
EXPORT_SYMBOL ( s3c_gpio_setpull  )
EXPORT_SYMBOL ( s3c_gpio_getpull  )
EXPORT_SYMBOL_GPL ( s3c_gpio_cfgpin_range  )
EXPORT_SYMBOL_GPL ( s3c_gpio_cfgall_range  )
samsung_gpio_pull_t s3c2443_gpio_getpull ( struct samsung_gpio_chip chip,
unsigned int  off 
)

s3c2443_gpio_getpull() - Get configuration for s3c2443 pull resistors : The gpio chip that the GPIO pin belongs to. : The offset to the pin to get the configuration of.

This helper function reads the state of the pull-{up,down} resistor for the given GPIO in the same case as samsung_gpio_setpull_upown.

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

int s3c2443_gpio_setpull ( struct samsung_gpio_chip chip,
unsigned int  off,
samsung_gpio_pull_t  pull 
)

s3c2443_gpio_setpull() - Pull configuration for s3c2443. : The gpio chip that is being configured. : The offset for the GPIO being configured.

Parameters
pull: The pull mode being requested.

This is a helper function for the case where we have GPIOs with two bits configuring the presence of a pull resistor, in the following order: 00 = Pull-up resistor connected 10 = Pull-down resistor connected x1 = No pull up resistor

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

samsung_gpio_pull_t s3c24xx_gpio_getpull_1down ( struct samsung_gpio_chip chip,
unsigned int  off 
)

s3c24xx_gpio_getpull_1down() - Get configuration for choice of down or none : The gpio chip that the GPIO pin belongs to : The offset to the pin to get the configuration of.

This helper function reads the state of the pull-down resistor for the given GPIO in the same case as s3c24xx_gpio_setpull_1down.

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

samsung_gpio_pull_t s3c24xx_gpio_getpull_1up ( struct samsung_gpio_chip chip,
unsigned int  off 
)

s3c24xx_gpio_getpull_1up() - Get configuration for choice of up or none : The gpio chip that the GPIO pin belongs to : The offset to the pin to get the configuration of.

This helper function reads the state of the pull-up resistor for the given GPIO in the same case as s3c24xx_gpio_setpull_1up.

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

int s3c24xx_gpio_setpull_1down ( struct samsung_gpio_chip chip,
unsigned int  off,
samsung_gpio_pull_t  pull 
)

s3c24xx_gpio_setpull_1down() - Pull configuration for choice of down or none : The gpio chip that is being configured : The offset for the GPIO being configured

Parameters
pull: The pull mode being requested

This is a helper function for the case where we have GPIOs with one bit configuring the presence of a pull-down resistor.

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

int s3c24xx_gpio_setpull_1up ( struct samsung_gpio_chip chip,
unsigned int  off,
samsung_gpio_pull_t  pull 
)

s3c24xx_gpio_setpull_1up() - Pull configuration for choice of up or none. : The gpio chip that is being configured. : The offset for the GPIO being configured.

Parameters
pull: The pull mode being requested.

This is a helper function for the case where we have GPIOs with one bit configuring the presence of a pull-up resistor.

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

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
s3c_gpio_cfgpin
s3c_gpio_setpull
s3c_gpio_cfgpin_range

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
s3c_gpio_cfgpin.

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
s3c_gpio_cfgpin

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.

is one of S3C_GPIO_PULL_NONE, S3C_GPIO_PULL_DOWN or S3C_GPIO_PULL_UP.

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

samsung_gpio_pull_t samsung_gpio_getpull_updown ( struct samsung_gpio_chip chip,
unsigned int  off 
)

samsung_gpio_getpull_updown() - Get configuration for choice of up, down or none

: The gpio chip that the GPIO pin belongs to : The offset to the pin to get the configuration of.

This helper function reads the state of the pull-{up,down} resistor for the given GPIO in the same case as samsung_gpio_setpull_upown.

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

int samsung_gpio_setpull_updown ( struct samsung_gpio_chip chip,
unsigned int  off,
samsung_gpio_pull_t  pull 
)

samsung_gpio_setpull_upown() - Pull configuration for choice of up, down or none

: The gpio chip that is being configured. : The offset for the GPIO being configured.

Parameters
pull: The pull mode being requested.

This is a helper function for the case where we have GPIOs with two bits configuring the presence of a pull resistor, in the following order: 00 = No pull resistor connected 01 = Pull-up resistor connected 10 = Pull-down resistor connected

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

int samsung_gpiolib_to_irq ( struct gpio_chip *  chip,
unsigned int  offset 
)

samsung_gpiolib_to_irq - convert gpio pin to irq number : The gpio chip that the pin belongs to. : The offset of the pin in the chip.

This helper returns the irq number calculated from the chip->irq_base and the provided offset.

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

Variable Documentation

struct samsung_gpio_cfg s3c24xx_gpiocfg_default
Initial value:
= {
.set_config = samsung_gpio_setcfg_2bit,
.get_config = samsung_gpio_getcfg_2bit,
}

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

struct samsung_gpio_chip s3c24xx_gpios[]

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