]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
pwm: core: Add details for ramp time and double pulse period
authorLaxman Dewangan <ldewangan@nvidia.com>
Wed, 12 Apr 2017 17:33:12 +0000 (23:03 +0530)
committerBharat Nihalani <bnihalani@nvidia.com>
Mon, 13 Nov 2017 08:56:40 +0000 (00:56 -0800)
Add details in header file for PWM ramp time and double pulse
period. Also make the dummy function implementation as static
inline.

Change-Id: I8f28a52105b2cc902380c5577b44b88dca1e55e6
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/1461620
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Reddy Talla <vreddytalla@nvidia.com>
(cherry picked from commit 38c9304feaa316167c6bfb4f3d5f3f258cc34717)

drivers/pwm/core.c
include/linux/pwm.h

index 381dd896741748d745bb05733e8a7da87d5c1517..901975fd120921b36dabf88e1d8d9c42a4803501 100644 (file)
@@ -196,6 +196,24 @@ static void of_pwmchip_remove(struct pwm_chip *chip)
                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
@@ -271,6 +289,8 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
                pwm->polarity = polarity;
                mutex_init(&pwm->lock);
 
+               init_pwm_of_config(chip, pwm);
+
                radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
        }
 
index dee5337d88aeb1b3618344f6e64405a60410c746..e6d930f4336428ae64098a3c693bcb3fa4746c5c 100644 (file)
@@ -68,12 +68,13 @@ static inline void pwm_disable(struct pwm_device *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;
 }
@@ -112,6 +113,8 @@ enum {
  * @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 {
@@ -186,6 +189,8 @@ static inline enum pwm_polarity pwm_get_polarity(const struct pwm_device *pwm)
  * @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
  */