static ssize_t pwm_period_ns_show(struct device *dev, struct device_attribute *attr, char *buf) { struct pwm_device *p = dev_get_drvdata(dev); return sprintf(buf, "%lu\n", pwm_get_period_ns(p)); }
pwm_result_t pwm_get_config(pwm_handle handle, pwm_chan_config *config) { pwm_internal *pwm; struct pwm_channel *p; pwm = (pwm_internal *)handle; if (!pwm || (PWM_MAGIC !=pwm->magic) || !pwm->data || !config) { return PWM_INVALID_PARAM; } p = (struct pwm_channel *)pwm->data; config->duty_ns = pwm_get_duty_ns(p); config->period_ns = pwm_get_period_ns(p); config->duty_percent = pwm_get_duty_percent(p); config->polarity = pwm_get_polarity(p); return PWM_OK; }