mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
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>
This commit is contained in:
parent
62099abf67
commit
8138d2ddbc
3 changed files with 199 additions and 19 deletions
|
@ -115,6 +115,28 @@ int pwmchip_remove(struct pwm_chip *chip);
|
|||
struct pwm_device *pwm_request_from_chip(struct pwm_chip *chip,
|
||||
unsigned int index,
|
||||
const char *label);
|
||||
|
||||
struct pwm_device *pwm_get(struct device *dev, const char *consumer);
|
||||
void pwm_put(struct pwm_device *pwm);
|
||||
|
||||
struct pwm_lookup {
|
||||
struct list_head list;
|
||||
const char *provider;
|
||||
unsigned int index;
|
||||
const char *dev_id;
|
||||
const char *con_id;
|
||||
};
|
||||
|
||||
#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id) \
|
||||
{ \
|
||||
.provider = _provider, \
|
||||
.index = _index, \
|
||||
.dev_id = _dev_id, \
|
||||
.con_id = _con_id, \
|
||||
}
|
||||
|
||||
void pwm_add_table(struct pwm_lookup *table, size_t num);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __LINUX_PWM_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue