From: Marco Felsch <m.felsch@pengutronix.de>
To: richard.leitner@skidata.com, robh+dt@kernel.org, fancer.lancer@gmail.com
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
kernel@pengutronix.de
Subject: [PATCH 2/4] usb: usb251xb: add vdd supply support
Date: Tue, 17 Sep 2019 16:44:47 +0200 [thread overview]
Message-ID: <20190917144449.32739-3-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20190917144449.32739-1-m.felsch@pengutronix.de>
Currently we don't handle the supply. We need to add the supply support
to be able to switch the supply off e.g. during a suspend-to-ram
operation. So we can guarantee a correct (re-)initialization.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
---
drivers/usb/misc/usb251xb.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index 6ca9111d150a..05819167604d 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/nls.h>
#include <linux/of_device.h>
+#include <linux/regulator/consumer.h>
#include <linux/slab.h>
/* Internal Register Set Addresses & Default Values acc. to DS00001692C */
@@ -116,6 +117,7 @@
struct usb251xb {
struct device *dev;
struct i2c_client *i2c;
+ struct regulator *vdd;
u8 skip_config;
struct gpio_desc *gpio_reset;
u16 vendor_id;
@@ -420,6 +422,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
return err;
}
+ hub->vdd = devm_regulator_get(dev, "vdd");
+ if (IS_ERR(hub->vdd))
+ return PTR_ERR(hub->vdd);
+
if (of_property_read_u16_array(np, "vendor-id", &hub->vendor_id, 1))
hub->vendor_id = USB251XB_DEF_VENDOR_ID;
@@ -665,6 +671,10 @@ static int usb251xb_probe(struct usb251xb *hub)
if (err)
return err;
+ err = regulator_enable(hub->vdd);
+ if (err)
+ return err;
+
err = usb251xb_connect(hub);
if (err) {
dev_err(dev, "Failed to connect hub (%d)\n", err);
--
2.20.1
next prev parent reply other threads:[~2019-09-17 14:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-17 14:44 [PATCH 0/4] Add simple-pm ops Marco Felsch
2019-09-17 14:44 ` [PATCH 1/4] dt-bindings: usb: usb251xb: add documentation for voltage supply Marco Felsch
2019-09-18 8:13 ` Richard Leitner
2019-09-30 23:07 ` Rob Herring
2019-09-17 14:44 ` Marco Felsch [this message]
2019-09-18 8:14 ` [PATCH 2/4] usb: usb251xb: add vdd supply support Richard Leitner
2019-09-17 14:44 ` [PATCH 3/4] usb: usb251xb: simplify reset helper Marco Felsch
2019-09-18 8:14 ` Richard Leitner
2019-09-17 14:44 ` [PATCH 4/4] usb: usb251xb: add pm_ops Marco Felsch
2019-09-18 8:15 ` Richard Leitner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190917144449.32739-3-m.felsch@pengutronix.de \
--to=m.felsch@pengutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-usb@vger.kernel.org \
--cc=richard.leitner@skidata.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).