Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
linux
pinctrl
pinctrl.h
Go to the documentation of this file.
1
/*
2
* Interface the pinctrl subsystem
3
*
4
* Copyright (C) 2011 ST-Ericsson SA
5
* Written on behalf of Linaro for ST-Ericsson
6
* This interface is used in the core to keep track of pins.
7
*
8
* Author: Linus Walleij <linus.walleij@linaro.org>
9
*
10
* License terms: GNU General Public License (GPL) version 2
11
*/
12
#ifndef __LINUX_PINCTRL_PINCTRL_H
13
#define __LINUX_PINCTRL_PINCTRL_H
14
15
#ifdef CONFIG_PINCTRL
16
17
#include <
linux/radix-tree.h
>
18
#include <linux/list.h>
19
#include <
linux/seq_file.h
>
20
#include <
linux/pinctrl/pinctrl-state.h
>
21
22
struct
device
;
23
struct
pinctrl_dev
;
24
struct
pinctrl_map
;
25
struct
pinmux_ops;
26
struct
pinconf_ops;
27
struct
gpio_chip;
28
struct
device_node
;
29
36
struct
pinctrl_pin_desc {
37
unsigned
number
;
38
const
char
*
name
;
39
};
40
41
/* Convenience macro to define a single named or anonymous pin descriptor */
42
#define PINCTRL_PIN(a, b) { .number = a, .name = b }
43
#define PINCTRL_PIN_ANON(a) { .number = a }
44
56
struct
pinctrl_gpio_range {
57
struct
list_head
node
;
58
const
char
*
name
;
59
unsigned
int
id
;
60
unsigned
int
base
;
61
unsigned
int
pin_base;
62
unsigned
int
npins;
63
struct
gpio_chip *
gc
;
64
};
65
85
struct
pinctrl_ops {
86
int
(*get_groups_count) (
struct
pinctrl_dev
*pctldev);
87
const
char
*(*get_group_name) (
struct
pinctrl_dev
*pctldev,
88
unsigned
selector
);
89
int
(*get_group_pins) (
struct
pinctrl_dev
*pctldev,
90
unsigned
selector
,
91
const
unsigned
**
pins
,
92
unsigned
*num_pins);
93
void
(*pin_dbg_show) (
struct
pinctrl_dev
*pctldev,
struct
seq_file
*
s
,
94
unsigned
offset
);
95
int
(*dt_node_to_map) (
struct
pinctrl_dev
*pctldev,
96
struct
device_node
*np_config,
97
struct
pinctrl_map
**
map
,
unsigned
*num_maps);
98
void
(*dt_free_map) (
struct
pinctrl_dev
*pctldev,
99
struct
pinctrl_map
*
map
,
unsigned
num_maps);
100
};
101
117
struct
pinctrl_desc {
118
const
char
*
name
;
119
struct
pinctrl_pin_desc
const
*
pins
;
120
unsigned
int
npins;
121
struct
pinctrl_ops *pctlops;
122
struct
pinmux_ops *pmxops;
123
struct
pinconf_ops *confops;
124
struct
module
*
owner
;
125
};
126
127
/* External interface to pin controller */
128
extern
struct
pinctrl_dev
*
pinctrl_register
(
struct
pinctrl_desc *pctldesc,
129
struct
device
*
dev
,
void
*
driver_data
);
130
extern
void
pinctrl_unregister
(
struct
pinctrl_dev
*pctldev);
131
extern
bool
pin_is_valid
(
struct
pinctrl_dev
*pctldev,
int
pin
);
132
extern
void
pinctrl_add_gpio_range
(
struct
pinctrl_dev
*pctldev,
133
struct
pinctrl_gpio_range *
range
);
134
extern
void
pinctrl_add_gpio_ranges
(
struct
pinctrl_dev
*pctldev,
135
struct
pinctrl_gpio_range *ranges,
136
unsigned
nranges);
137
extern
const
char
*
pinctrl_dev_get_name
(
struct
pinctrl_dev
*pctldev);
138
extern
void
*
pinctrl_dev_get_drvdata
(
struct
pinctrl_dev
*pctldev);
139
#else
140
141
struct
pinctrl_dev
;
142
143
/* Sufficiently stupid default functions when pinctrl is not in use */
144
static
inline
bool
pin_is_valid
(
struct
pinctrl_dev
*pctldev,
int
pin
)
145
{
146
return
pin >= 0;
147
}
148
149
#endif
/* !CONFIG_PINCTRL */
150
151
#endif
/* __LINUX_PINCTRL_PINCTRL_H */
Generated on Thu Jan 10 2013 14:52:18 for Linux Kernel by
1.8.2