summaryrefslogtreecommitdiff
path: root/include/linux/pwm.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2017-01-22 17:14:08 +0100
committerThierry Reding <thierry.reding@gmail.com>2017-01-30 09:36:42 +0100
commitb526a314263ea217b8fa9758dca5dc245fd49997 (patch)
tree33bc36f29bee3acf277fded5b5d30513d16bfd53 /include/linux/pwm.h
parent69efb3439ccf2ce72e01edde05d2c63d624e251e (diff)
pwm: Try to load modules during pwm_get()
Add a module name string to the pwm_lookup struct and if specified try to load the module using request_module() if pwmchip_find_by_name() is unable to find the PWM chip. This is a last resort to work around drivers that can't - and can't be made to - deal with deferred probe. Signed-off-by: Hans de Goede <hdegoede@redhat.com> [thierry.reding@gmail.com: rename new macro, reword commit message] [thierry.reding@gmail.com: add comment explaining use-case] Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'include/linux/pwm.h')
-rw-r--r--include/linux/pwm.h23
1 files changed, 15 insertions, 8 deletions
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index eae215ef1b2c..08fad7c6a471 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -603,18 +603,25 @@ struct pwm_lookup {
const char *con_id;
unsigned int period;
enum pwm_polarity polarity;
+ const char *module; /* optional, may be NULL */
};
-#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id, _period, _polarity) \
- { \
- .provider = _provider, \
- .index = _index, \
- .dev_id = _dev_id, \
- .con_id = _con_id, \
- .period = _period, \
- .polarity = _polarity \
+#define PWM_LOOKUP_WITH_MODULE(_provider, _index, _dev_id, _con_id, \
+ _period, _polarity, _module) \
+ { \
+ .provider = _provider, \
+ .index = _index, \
+ .dev_id = _dev_id, \
+ .con_id = _con_id, \
+ .period = _period, \
+ .polarity = _polarity, \
+ .module = _module, \
}
+#define PWM_LOOKUP(_provider, _index, _dev_id, _con_id, _period, _polarity) \
+ PWM_LOOKUP_WITH_MODULE(_provider, _index, _dev_id, _con_id, _period, \
+ _polarity, NULL)
+
#if IS_ENABLED(CONFIG_PWM)
void pwm_add_table(struct pwm_lookup *table, size_t num);
void pwm_remove_table(struct pwm_lookup *table, size_t num);