lkml.org 
[lkml]   [2012]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 2/3] regulator: add set_pulldown in regulator operations
    Some PMUs provide programmable active shutdown switches
    that help discharge the load if the supply is off.
    For providing this feature, set_pulldown() is added in the ops.

    The set_pulldown() is not exported function.
    This function is called internally when the regulator is disabled.
    Then pull-down bits can be programmed in each regulator driver.

    * patch base version : linux-3.2.4

    Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
    ---
    drivers/regulator/core.c | 18 ++++++++++++++++++
    include/linux/regulator/driver.h | 2 ++
    2 files changed, 20 insertions(+), 0 deletions(-)

    diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
    index 938398f..3053f4f 100644
    --- a/drivers/regulator/core.c
    +++ b/drivers/regulator/core.c
    @@ -1457,6 +1457,15 @@ static int _regulator_disable(struct regulator_dev *rdev)
    return ret;
    }

    + if (rdev->desc->ops->set_pulldown) {
    + ret = rdev->desc->ops->set_pulldown(rdev);
    + if (ret < 0) {
    + rdev_err(rdev,
    + "failed to set pulldown\n");
    + return ret;
    + }
    + }
    +
    trace_regulator_disable_complete(rdev_get_name(rdev));

    _notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
    @@ -1518,6 +1527,15 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
    rdev_err(rdev, "failed to force disable\n");
    return ret;
    }
    +
    + if (rdev->desc->ops->set_pulldown) {
    + ret = rdev->desc->ops->set_pulldown(rdev);
    + if (ret < 0) {
    + rdev_err(rdev, "failed to set pulldown\n");
    + return ret;
    + }
    + }
    +
    /* notify other consumers that power has been forced off */
    _notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
    REGULATOR_EVENT_DISABLE, NULL);
    diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
    index df6e9ec..081f91d 100644
    --- a/include/linux/regulator/driver.h
    +++ b/include/linux/regulator/driver.h
    @@ -38,6 +38,7 @@ enum regulator_status {
    *
    * @enable: Configure the regulator as enabled.
    * @disable: Configure the regulator as disabled.
    + * @set_pulldown : Configure pulldown setting when the regulator is disabled.
    * @is_enabled: Return 1 if the regulator is enabled, 0 if not.
    * May also return negative errno.
    *
    @@ -102,6 +103,7 @@ struct regulator_ops {
    /* enable/disable regulator */
    int (*enable) (struct regulator_dev *);
    int (*disable) (struct regulator_dev *);
    + int (*set_pulldown) (struct regulator_dev *);
    int (*is_enabled) (struct regulator_dev *);

    /* get/set regulator operating mode (defined in consumer.h) */
    --
    1.7.4.1

    Best Regards,
    Milo (Woogyom) Kim
    Texas Instruments Incorporated






    \
     
     \ /
      Last update: 2012-02-17 07:45    [W:5.827 / U:0.084 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site