of_node_put(chip->dev->of_node);
}
+static void init_pwm_of_config(struct pwm_chip *chip, struct pwm_device *pwm)
+{
+ struct device_node *np = chip->dev->of_node;
+ u32 pval;
+ int ret;
+
+ if (!np)
+ return;
+
+ ret = of_property_read_u32(np, "pwm-ramp-time", &pval);
+ if (!ret)
+ pwm->ramp_time = pval;
+
+ ret = of_property_read_u32(np, "pwm-double-pulse-period", &pval);
+ if (!ret)
+ pwm->double_period = pval;
+}
+
/**
* pwm_set_chip_data() - set private chip data for a PWM
* @pwm: PWM device
pwm->polarity = polarity;
mutex_init(&pwm->lock);
+ init_pwm_of_config(chip, pwm);
+
radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
}
{
}
-int pwm_set_ramp_time(struct pwm_device *pwm, int ramp_time)
+static inline int pwm_set_ramp_time(struct pwm_device *pwm, int ramp_time)
{
return -EINVAL;
}
-int pwm_set_double_pulse_period(struct pwm_device *pwm, int period)
+static inline int pwm_set_double_pulse_period(struct pwm_device *pwm,
+ int period)
{
return -EINVAL;
}
* @lock: used to serialize accesses to the PWM device where necessary
* @period: period of the PWM signal (in nanoseconds)
* @duty_cycle: duty cycle of the PWM signal (in nanoseconds)
+ * @double_period: Doble pulse period.
+ * @ramp_time: Ramp up/down time.
* @polarity: polarity of the PWM signal
*/
struct pwm_device {
* @capture: capture and report PWM signal
* @enable: enable PWM output toggling
* @disable: disable PWM output toggling
+ * @set_ramp_time: Set PWM ramp up/down time.
+ * @set_double_pulse_period: Set double pulse period time.
* @dbg_show: optional routine to show contents in debugfs
* @owner: helps prevent removal of modules exporting active PWMs
*/