Re: [PATCH v2] HID: i2c-hid: Add vddl regulator control

From: Stephen Boyd
Date: Thu Jun 21 2018 - 21:33:34 EST


Quoting Dmitry Torokhov (2018-06-21 16:58:31)
> On Thu, Jun 21, 2018 at 4:41 PM Stephen Boyd <swboyd@xxxxxxxxxxxx> wrote:
> >
> > Some wacom w9013 devices have a vddl supply for "low valtage"
> > requirements. Add support in this driver to turn on this low voltage
> > supply. We can also drop a handful of error messages because the
> > regulator core is already printing an error when bulk regulators fail to
> > enable or disable.
> >
> > Cc: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>
> > Cc: Hans de Goede <hdegoede@xxxxxxxxxx>
> > Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > Cc: Dmitry Torokhov <dtor@xxxxxxxxxxxx>
> > Cc: Doug Anderson <dianders@xxxxxxxxxxxx>
> > Acked-by: Rob Herring <robh@xxxxxxxxxx>
> > Cc: <devicetree@xxxxxxxxxxxxxxx>
> > Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
> > ---
> >
> > Changes from v1:
> > * Use the bulk regulator APIs instead of open coding it (Dmitry)
> >
> > .../bindings/input/hid-over-i2c.txt | 3 +-
> > drivers/hid/i2c-hid/i2c-hid.c | 62 +++++++++----------
> > include/linux/platform_data/i2c-hid.h | 7 +--
> > 3 files changed, 36 insertions(+), 36 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/input/hid-over-i2c.txt b/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > index 4d3da9d91de4..89e6ab89ba38 100644
> > --- a/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > +++ b/Documentation/devicetree/bindings/input/hid-over-i2c.txt
> > @@ -26,7 +26,8 @@ device-specific compatible properties, which should be used in addition to the
> >
> > - compatible:
> > * "wacom,w9013" (Wacom W9013 digitizer). Supports:
> > - - vdd-supply
> > + - vdd-supply (3.3V)
> > + - vddl-supply (1.8V)
> > - post-power-on-delay-ms
> >
> > - vdd-supply: phandle of the regulator that provides the supply voltage.
> > diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
> > index c1652bb7bd15..1d83531454c5 100644
> > --- a/drivers/hid/i2c-hid/i2c-hid.c
> > +++ b/drivers/hid/i2c-hid/i2c-hid.c
> > @@ -1002,18 +1002,21 @@ static int i2c_hid_probe(struct i2c_client *client,
> > return client->irq;
> > }
> >
> > - ihid = kzalloc(sizeof(struct i2c_hid), GFP_KERNEL);
> > + ihid = devm_kzalloc(&client->dev, sizeof(*ihid), GFP_KERNEL);
>
> The patch looks good, but I think this chunk needs to be split out.
>

Ok. It needs to be done otherwise the regulator put with devm blows up
when the containing structure is freed underneath it.