lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=VsBkaMWSNFGimx3jFk==xsK+_NL-i1M0Dr_X9sc4EL9Q@mail.gmail.com>
Date:   Fri, 24 Jul 2020 13:25:01 -0700
From:   Doug Anderson <dianders@...omium.org>
To:     Stephen Boyd <swboyd@...omium.org>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        Gwendal Grignou <gwendal@...omium.org>,
        Daniel Campello <campello@...omium.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>
Subject: Re: [PATCH 3/3] iio: sx9310: Enable regulator for svdd supply

Hi,

On Thu, Jul 23, 2020 at 4:03 PM Stephen Boyd <swboyd@...omium.org> wrote:
>
> Enable the digital IO power supply (svdd) during probe so that the i2c
> communication works properly on boards that aggressively power gate this
> supply.
>
> Cc: Gwendal Grignou <gwendal@...omium.org>
> Cc: Daniel Campello <campello@...omium.org>
> Cc: Hartmut Knaack <knaack.h@....de>
> Cc: Lars-Peter Clausen <lars@...afoo.de>
> Cc: Peter Meerwald-Stadler <pmeerw@...erw.net>
> Cc: Douglas Anderson <dianders@...omium.org>
> Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> ---
>  drivers/iio/proximity/sx9310.c | 49 ++++++++++++++++++++++++++++------
>  1 file changed, 41 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c
> index 84c3c9ae80dc..d21c17a4d541 100644
> --- a/drivers/iio/proximity/sx9310.c
> +++ b/drivers/iio/proximity/sx9310.c
> @@ -19,6 +19,7 @@
>  #include <linux/of.h>
>  #include <linux/pm.h>
>  #include <linux/regmap.h>
> +#include <linux/regulator/consumer.h>
>  #include <linux/slab.h>
>
>  #include <linux/iio/buffer.h>
> @@ -131,6 +132,7 @@ struct sx9310_data {
>         struct i2c_client *client;
>         struct iio_trigger *trig;
>         struct regmap *regmap;
> +       struct regulator *supply;

Done need to store if you use devm.  See below.


>         /*
>          * Last reading of the proximity status for each channel.
>          * We only send an event to user space when this changes.
> @@ -914,21 +916,31 @@ static int sx9310_probe(struct i2c_client *client,
>         mutex_init(&data->mutex);
>         init_completion(&data->completion);
>
> +       data->supply = devm_regulator_get(&client->dev, "svdd");
> +       if (IS_ERR(data->supply))
> +               return PTR_ERR(data->supply);
> +
>         data->regmap = devm_regmap_init_i2c(client, &sx9310_regmap_config);
>         if (IS_ERR(data->regmap))
>                 return PTR_ERR(data->regmap);
>
> +       ret = regulator_enable(data->supply);
> +       if (ret)
> +               return ret;
> +       /* Must wait for Tpor time after initial power up */
> +       usleep_range(1000, 1100);

ret = devm_add_action_or_reset(&client->dev, sx9310_regulator_disable, supply);
if (ret)
  return ret;

static void sx9310_regulator_disable(void *regulator) {
  regulator_disable(regulator);
}

Then drop all changes below this line.


Seems like you could add support for the other regulator listed in the
bindings, too?


-Doug

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ