Lines Matching refs:pwm
19 struct pwm_device *pwm; member
33 return export->pwm; in child_to_pwm_device()
40 const struct pwm_device *pwm = child_to_pwm_device(child); in period_show() local
43 pwm_get_state(pwm, &state); in period_show()
53 struct pwm_device *pwm = export->pwm; in period_store() local
63 pwm_get_state(pwm, &state); in period_store()
65 ret = pwm_apply_state(pwm, &state); in period_store()
75 const struct pwm_device *pwm = child_to_pwm_device(child); in duty_cycle_show() local
78 pwm_get_state(pwm, &state); in duty_cycle_show()
88 struct pwm_device *pwm = export->pwm; in duty_cycle_store() local
98 pwm_get_state(pwm, &state); in duty_cycle_store()
100 ret = pwm_apply_state(pwm, &state); in duty_cycle_store()
110 const struct pwm_device *pwm = child_to_pwm_device(child); in enable_show() local
113 pwm_get_state(pwm, &state); in enable_show()
123 struct pwm_device *pwm = export->pwm; in enable_store() local
133 pwm_get_state(pwm, &state); in enable_store()
147 ret = pwm_apply_state(pwm, &state); in enable_store()
158 const struct pwm_device *pwm = child_to_pwm_device(child); in polarity_show() local
162 pwm_get_state(pwm, &state); in polarity_show()
182 struct pwm_device *pwm = export->pwm; in polarity_store() local
195 pwm_get_state(pwm, &state); in polarity_store()
197 ret = pwm_apply_state(pwm, &state); in polarity_store()
207 struct pwm_device *pwm = child_to_pwm_device(child); in capture_show() local
211 ret = pwm_capture(pwm, &result, jiffies_to_msecs(HZ)); in capture_show()
232 ATTRIBUTE_GROUPS(pwm);
241 static int pwm_export_child(struct device *parent, struct pwm_device *pwm) in pwm_export_child() argument
247 if (test_and_set_bit(PWMF_EXPORTED, &pwm->flags)) in pwm_export_child()
252 clear_bit(PWMF_EXPORTED, &pwm->flags); in pwm_export_child()
256 export->pwm = pwm; in pwm_export_child()
263 dev_set_name(&export->child, "pwm%u", pwm->hwpwm); in pwm_export_child()
267 clear_bit(PWMF_EXPORTED, &pwm->flags); in pwm_export_child()
272 pwm_prop[0] = kasprintf(GFP_KERNEL, "EXPORT=pwm%u", pwm->hwpwm); in pwm_export_child()
285 static int pwm_unexport_child(struct device *parent, struct pwm_device *pwm) in pwm_unexport_child() argument
290 if (!test_and_clear_bit(PWMF_EXPORTED, &pwm->flags)) in pwm_unexport_child()
293 child = device_find_child(parent, pwm, pwm_unexport_match); in pwm_unexport_child()
297 pwm_prop[0] = kasprintf(GFP_KERNEL, "UNEXPORT=pwm%u", pwm->hwpwm); in pwm_unexport_child()
305 pwm_put(pwm); in pwm_unexport_child()
315 struct pwm_device *pwm; in export_store() local
326 pwm = pwm_request_from_chip(chip, hwpwm, "sysfs"); in export_store()
327 if (IS_ERR(pwm)) in export_store()
328 return PTR_ERR(pwm); in export_store()
330 ret = pwm_export_child(parent, pwm); in export_store()
332 pwm_put(pwm); in export_store()
378 struct pwm_device *pwm, in pwm_class_get_state() argument
384 if (!test_bit(PWMF_EXPORTED, &pwm->flags)) in pwm_class_get_state()
387 child = device_find_child(parent, pwm, pwm_unexport_match); in pwm_class_get_state()
395 pwm_get_state(pwm, state); in pwm_class_get_state()
401 struct pwm_device *pwm, in pwm_class_apply_state() argument
404 int ret = pwm_apply_state(pwm, state); in pwm_class_apply_state()
419 struct pwm_device *pwm = &chip->pwms[i]; in pwm_class_resume_npwm() local
423 export = pwm_class_get_state(parent, pwm, &state); in pwm_class_resume_npwm()
428 ret = pwm_class_apply_state(export, pwm, &state); in pwm_class_resume_npwm()
443 struct pwm_device *pwm = &chip->pwms[i]; in pwm_class_suspend() local
447 export = pwm_class_get_state(parent, pwm, &state); in pwm_class_suspend()
453 ret = pwm_class_apply_state(export, pwm, &state); in pwm_class_suspend()
515 struct pwm_device *pwm = &chip->pwms[i]; in pwmchip_sysfs_unexport() local
517 if (test_bit(PWMF_EXPORTED, &pwm->flags)) in pwmchip_sysfs_unexport()
518 pwm_unexport_child(parent, pwm); in pwmchip_sysfs_unexport()