arch/arm/mach-s3c/gpio-samsung.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-s3c/gpio-samsung.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-s3c/gpio-samsung.c- Extension
.c- Size
- 21629 bytes
- Lines
- 891
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/gpio/driver.hlinux/irq.hlinux/io.hlinux/init.hlinux/spinlock.hlinux/module.hlinux/interrupt.hlinux/device.hlinux/ioport.hlinux/of.hlinux/slab.hlinux/of_address.hasm/irq.hirqs.hmap.hregs-gpio.hgpio-samsung.hcpu.hgpio-core.hgpio-cfg.hgpio-cfg-helpers.hpm.h
Detected Declarations
function samsung_gpio_setpull_updownfunction samsung_gpio_getpull_updownfunction samsung_gpio_setcfg_2bitfunction samsung_gpio_setcfg_2bitfunction samsung_gpio_setcfg_4bitfunction samsung_gpio_setcfg_4bitfunction samsung_gpiolib_set_cfgfunction samsung_gpiolib_2bit_inputfunction samsung_gpiolib_2bit_outputfunction registerfunction samsung_gpiolib_4bit_outputfunction registerfunction samsung_gpiolib_4bit2_outputfunction samsung_gpiolib_setfunction samsung_gpiolib_getfunction s3c_gpiolib_trackfunction samsung_gpiolib_addfunction samsung_gpiolib_add_2bit_chipsfunction samsung_gpiolib_add_4bit_chipsfunction samsung_gpiolib_add_4bit2_chipsfunction samsung_gpiolib_to_irqfunction s3c64xx_gpiolib_mbank_to_irqfunction s3c64xx_gpiolib_lbank_to_irqfunction samsung_gpiolib_initfunction s3c_gpio_cfgpinfunction s3c_gpio_cfgpin_rangefunction s3c_gpio_cfgall_rangefunction s3c_gpio_setpullmodule init samsung_gpiolib_initexport s3c_gpio_cfgpinexport s3c_gpio_cfgpin_rangeexport s3c_gpio_cfgall_rangeexport s3c_gpio_setpull
Annotated Snippet
core_initcall(samsung_gpiolib_init);
int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
{
struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
unsigned long flags;
int offset;
int ret;
if (!chip)
return -EINVAL;
offset = pin - chip->chip.base;
samsung_gpio_lock(chip, flags);
ret = samsung_gpio_do_setcfg(chip, offset, config);
samsung_gpio_unlock(chip, flags);
return ret;
}
EXPORT_SYMBOL(s3c_gpio_cfgpin);
int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
unsigned int cfg)
{
int ret;
for (; nr > 0; nr--, start++) {
ret = s3c_gpio_cfgpin(start, cfg);
if (ret != 0)
return ret;
}
return 0;
}
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)
{
int ret;
for (; nr > 0; nr--, start++) {
s3c_gpio_setpull(start, pull);
ret = s3c_gpio_cfgpin(start, cfg);
if (ret != 0)
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(s3c_gpio_cfgall_range);
int s3c_gpio_setpull(unsigned int pin, samsung_gpio_pull_t pull)
{
struct samsung_gpio_chip *chip = samsung_gpiolib_getchip(pin);
unsigned long flags;
int offset, ret;
if (!chip)
return -EINVAL;
offset = pin - chip->chip.base;
samsung_gpio_lock(chip, flags);
ret = samsung_gpio_do_setpull(chip, offset, pull);
samsung_gpio_unlock(chip, flags);
return ret;
}
EXPORT_SYMBOL(s3c_gpio_setpull);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/gpio/driver.h`, `linux/irq.h`, `linux/io.h`, `linux/init.h`, `linux/spinlock.h`, `linux/module.h`, `linux/interrupt.h`.
- Detected declarations: `function samsung_gpio_setpull_updown`, `function samsung_gpio_getpull_updown`, `function samsung_gpio_setcfg_2bit`, `function samsung_gpio_setcfg_2bit`, `function samsung_gpio_setcfg_4bit`, `function samsung_gpio_setcfg_4bit`, `function samsung_gpiolib_set_cfg`, `function samsung_gpiolib_2bit_input`, `function samsung_gpiolib_2bit_output`, `function register`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.