Lines Matching refs:pwm

28 	struct pwm_device *pwm;  member
40 return export->pwm; in child_to_pwm_device()
47 const struct pwm_device *pwm = child_to_pwm_device(child); in pwm_period_show() local
49 return sprintf(buf, "%u\n", pwm->period); in pwm_period_show()
56 struct pwm_device *pwm = child_to_pwm_device(child); in pwm_period_store() local
64 ret = pwm_config(pwm, pwm->duty_cycle, val); in pwm_period_store()
73 const struct pwm_device *pwm = child_to_pwm_device(child); in pwm_duty_cycle_show() local
75 return sprintf(buf, "%u\n", pwm->duty_cycle); in pwm_duty_cycle_show()
82 struct pwm_device *pwm = child_to_pwm_device(child); in pwm_duty_cycle_store() local
90 ret = pwm_config(pwm, val, pwm->period); in pwm_duty_cycle_store()
99 const struct pwm_device *pwm = child_to_pwm_device(child); in pwm_enable_show() local
100 int enabled = test_bit(PWMF_ENABLED, &pwm->flags); in pwm_enable_show()
109 struct pwm_device *pwm = child_to_pwm_device(child); in pwm_enable_store() local
118 pwm_disable(pwm); in pwm_enable_store()
121 ret = pwm_enable(pwm); in pwm_enable_store()
135 const struct pwm_device *pwm = child_to_pwm_device(child); in pwm_polarity_show() local
137 return sprintf(buf, "%s\n", pwm->polarity ? "inversed" : "normal"); in pwm_polarity_show()
144 struct pwm_device *pwm = child_to_pwm_device(child); in pwm_polarity_store() local
155 ret = pwm_set_polarity(pwm, polarity); in pwm_polarity_store()
172 ATTRIBUTE_GROUPS(pwm);
181 static int pwm_export_child(struct device *parent, struct pwm_device *pwm) in pwm_export_child() argument
186 if (test_and_set_bit(PWMF_EXPORTED, &pwm->flags)) in pwm_export_child()
191 clear_bit(PWMF_EXPORTED, &pwm->flags); in pwm_export_child()
195 export->pwm = pwm; in pwm_export_child()
201 dev_set_name(&export->child, "pwm%u", pwm->hwpwm); in pwm_export_child()
205 clear_bit(PWMF_EXPORTED, &pwm->flags); in pwm_export_child()
218 static int pwm_unexport_child(struct device *parent, struct pwm_device *pwm) in pwm_unexport_child() argument
222 if (!test_and_clear_bit(PWMF_EXPORTED, &pwm->flags)) in pwm_unexport_child()
225 child = device_find_child(parent, pwm, pwm_unexport_match); in pwm_unexport_child()
232 pwm_put(pwm); in pwm_unexport_child()
242 struct pwm_device *pwm; in pwm_export_store() local
253 pwm = pwm_request_from_chip(chip, hwpwm, "sysfs"); in pwm_export_store()
254 if (IS_ERR(pwm)) in pwm_export_store()
255 return PTR_ERR(pwm); in pwm_export_store()
257 ret = pwm_export_child(parent, pwm); in pwm_export_store()
259 pwm_put(pwm); in pwm_export_store()