diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2012-03-26 02:42:48 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@avionic-design.de> | 2012-06-15 06:56:53 -0400 |
commit | 8138d2ddbcca2a100482dac390133f83c5a60f94 (patch) | |
tree | 814645a7608376af451f9721dd3da585a87bbdd6 /include/linux/pwm.h | |
parent | 62099abf67a20cfb98d4c031fb1925e10a78ee1b (diff) |
pwm: Add table-based lookup for static mappings
In order to get rid of the global namespace for PWM devices, this commit
provides an alternative method, similar to that of the regulator or
clock frameworks, for registering a static mapping for PWM devices. This
works by providing a table with a provider/consumer map in the board
setup code.
With the new pwm_get() and pwm_put() functions available, usage of
pwm_request() and pwm_free() becomes deprecated.
Reviewed-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r-- | include/linux/pwm.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h index 047cd5351a3b..2947a4fea6ad 100644 --- a/include/linux/pwm.h +++ b/include/linux/pwm.h | |||
@@ -115,6 +115,28 @@ int pwmchip_remove(struct pwm_chip *chip); | |||
115 | struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, | 115 | struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip, |
116 | unsigned int index, | 116 | unsigned int index, |
117 | const char *label); | 117 | const char *label); |
118 | |||
119 | struct pwm_device *pwm_get(struct device *dev, const char *consumer); | ||
120 | void pwm_put(struct pwm_device *pwm); | ||
121 | |||
122 | struct pwm_lookup { | ||
123 | struct list_head list; | ||
124 | const char *provider; | ||
125 | unsigned int index; | ||
126 | const char *dev_id; | ||
127 | const char *con_id; | ||
128 | }; | ||
129 | |||
130 | #define PWM_LOOKUP(_provider, _index, _dev_id, _con_id) \ | ||
131 | { \ | ||
132 | .provider = _provider, \ | ||
133 | .index = _index, \ | ||
134 | .dev_id = _dev_id, \ | ||
135 | .con_id = _con_id, \ | ||
136 | } | ||
137 | |||
138 | void pwm_add_table(struct pwm_lookup *table, size_t num); | ||
139 | |||
118 | #endif | 140 | #endif |
119 | 141 | ||
120 | #endif /* __LINUX_PWM_H */ | 142 | #endif /* __LINUX_PWM_H */ |