Lines Matching refs:pwm
15 #include <linux/pwm.h>
19 struct pwm_device *pwm;
33 return export->pwm;
38 const struct pwm_device *pwm = child_to_pwm_device(child);
41 pwm_get_state(pwm, &state);
49 struct pwm_device *pwm = export->pwm;
60 pwm_get_state(pwm, &state);
62 ret = pwm_apply_state(pwm, &state);
70 const struct pwm_device *pwm = child_to_pwm_device(child);
73 pwm_get_state(pwm, &state);
81 struct pwm_device *pwm = export->pwm;
92 pwm_get_state(pwm, &state);
94 ret = pwm_apply_state(pwm, &state);
103 const struct pwm_device *pwm = child_to_pwm_device(child);
106 pwm_get_state(pwm, &state);
114 struct pwm_device *pwm = export->pwm;
125 pwm_get_state(pwm, &state);
127 ret = pwm_apply_state(pwm, &state);
136 const struct pwm_device *pwm = child_to_pwm_device(child);
139 pwm_get_state(pwm, &state);
147 struct pwm_device *pwm = export->pwm;
158 pwm_get_state(pwm, &state);
172 ret = pwm_apply_state(pwm, &state);
181 const struct pwm_device *pwm = child_to_pwm_device(child);
185 pwm_get_state(pwm, &state);
203 struct pwm_device *pwm = export->pwm;
217 pwm_get_state(pwm, &state);
219 ret = pwm_apply_state(pwm, &state);
227 struct pwm_device *pwm = child_to_pwm_device(child);
231 ret = pwm_capture(pwm, &result, jiffies_to_msecs(HZ));
254 ATTRIBUTE_GROUPS(pwm);
263 static int pwm_export_child(struct device *parent, struct pwm_device *pwm)
269 if (test_and_set_bit(PWMF_EXPORTED, &pwm->flags)) {
275 clear_bit(PWMF_EXPORTED, &pwm->flags);
279 export->pwm = pwm;
286 dev_set_name(&export->child, "pwm%u", pwm->hwpwm);
290 clear_bit(PWMF_EXPORTED, &pwm->flags);
295 pwm_prop[0] = kasprintf(GFP_KERNEL, "EXPORT=pwm%u", pwm->hwpwm);
308 static int pwm_unexport_child(struct device *parent, struct pwm_device *pwm)
313 if (!test_and_clear_bit(PWMF_EXPORTED, &pwm->flags)) {
317 child = device_find_child(parent, pwm, pwm_unexport_match);
322 pwm_prop[0] = kasprintf(GFP_KERNEL, "UNEXPORT=pwm%u", pwm->hwpwm);
330 pwm_put(pwm);
338 struct pwm_device *pwm;
351 pwm = pwm_request_from_chip(chip, hwpwm, "sysfs");
352 if (IS_ERR(pwm)) {
353 return PTR_ERR(pwm);
356 ret = pwm_export_child(parent, pwm);
358 pwm_put(pwm);
403 static struct pwm_export *pwm_class_get_state(struct device *parent, struct pwm_device *pwm, struct pwm_state *state)
408 if (!test_bit(PWMF_EXPORTED, &pwm->flags)) {
412 child = device_find_child(parent, pwm, pwm_unexport_match);
421 pwm_get_state(pwm, state);
426 static int pwm_class_apply_state(struct pwm_export *export, struct pwm_device *pwm, struct pwm_state *state)
428 int ret = pwm_apply_state(pwm, state);
443 struct pwm_device *pwm = &chip->pwms[i];
447 export = pwm_class_get_state(parent, pwm, &state);
453 ret = pwm_class_apply_state(export, pwm, &state);
469 struct pwm_device *pwm = &chip->pwms[i];
473 export = pwm_class_get_state(parent, pwm, &state);
480 ret = pwm_class_apply_state(export, pwm, &state);
504 .name = "pwm",
540 struct pwm_device *pwm = &chip->pwms[i];
542 if (test_bit(PWMF_EXPORTED, &pwm->flags)) {
543 pwm_unexport_child(parent, pwm);