]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pwm: core: Rename of_pwm_request() to of_pwm_get() and export it
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Fri, 21 Dec 2012 09:43:58 +0000 (01:43 -0800)
committerBryan Wu <cooloney@gmail.com>
Sat, 2 Feb 2013 01:47:05 +0000 (17:47 -0800)
Allow client driver to use of_pwm_get() to get the PWM they need. This
is needed for drivers which handle more than one PWM separately, like
leds-pwm driver, which have:

pwmleds {
compatible = "pwm-leds";
kpad {
label = "omap4::keypad";
pwms = <&twl_pwm 0 7812500>;
max-brightness = <127>;
};

charging {
label = "omap4:green:chrg";
pwms = <&twl_pwmled 0 7812500>;
max-brightness = <255>;
};
};

in the dts files.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
drivers/pwm/core.c
include/linux/pwm.h

index 903138b18842d5fb94cdc88316419702f7e0ae8c..3cb741dc2038eaebaca9c2cbf39b93e29b94600c 100644 (file)
@@ -471,7 +471,7 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np)
 }
 
 /**
- * of_pwm_request() - request a PWM via the PWM framework
+ * of_pwm_get() - request a PWM via the PWM framework
  * @np: device node to get the PWM from
  * @con_id: consumer name
  *
@@ -486,8 +486,7 @@ static struct pwm_chip *of_node_to_pwmchip(struct device_node *np)
  * becomes mandatory for devices that look up the PWM device via the con_id
  * parameter.
  */
-static struct pwm_device *of_pwm_request(struct device_node *np,
-                                        const char *con_id)
+struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id)
 {
        struct pwm_device *pwm = NULL;
        struct of_phandle_args args;
@@ -545,6 +544,7 @@ put:
 
        return pwm;
 }
+EXPORT_SYMBOL_GPL(of_pwm_get);
 
 /**
  * pwm_add_table() - register PWM device consumers
@@ -587,7 +587,7 @@ struct pwm_device *pwm_get(struct device *dev, const char *con_id)
 
        /* look up via DT first */
        if (IS_ENABLED(CONFIG_OF) && dev && dev->of_node)
-               return of_pwm_request(dev->of_node, con_id);
+               return of_pwm_get(dev->of_node, con_id);
 
        /*
         * We look up the provider in the static table typically provided by
index cc908a5396f82c8324d8b824967340a1e7f7c55f..76a1959f2b23b0c450267c240c7889dd0ce0d1e7 100644 (file)
@@ -175,6 +175,7 @@ struct pwm_device *of_pwm_xlate_with_flags(struct pwm_chip *pc,
                const struct of_phandle_args *args);
 
 struct pwm_device *pwm_get(struct device *dev, const char *con_id);
+struct pwm_device *of_pwm_get(struct device_node *np, const char *con_id);
 void pwm_put(struct pwm_device *pwm);
 
 struct pwm_device *devm_pwm_get(struct device *dev, const char *con_id);
@@ -213,6 +214,12 @@ static inline struct pwm_device *pwm_get(struct device *dev,
        return ERR_PTR(-ENODEV);
 }
 
+static inline struct pwm_device *of_pwm_get(struct device_node *np,
+                                           const char *con_id)
+{
+       return ERR_PTR(-ENODEV);
+}
+
 static inline void pwm_put(struct pwm_device *pwm)
 {
 }