From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: Evgeniy Polyakov <zbr@ioremap.net>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
kernel@pengutronix.de,
Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH v2] w1: ds2482: add support for ds2482-101 sleep pin
Date: Thu, 2 Oct 2014 16:06:36 +0200 [thread overview]
Message-ID: <1412258796-12814-1-git-send-email-s.trumtrar@pengutronix.de> (raw)
The ds2482-101 version of the chip has an active-low sleep pin. Add this as a
gpio to the probe function and describe the DT binding accordingly.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
Changes since v1:
- rebased to next-20141001
Documentation/devicetree/bindings/w1/ds2482.txt | 18 ++++++++++++++++++
drivers/w1/masters/ds2482.c | 9 +++++++++
2 files changed, 27 insertions(+)
create mode 100644 Documentation/devicetree/bindings/w1/ds2482.txt
diff --git a/Documentation/devicetree/bindings/w1/ds2482.txt b/Documentation/devicetree/bindings/w1/ds2482.txt
new file mode 100644
index 000000000000..e065207ab4b8
--- /dev/null
+++ b/Documentation/devicetree/bindings/w1/ds2482.txt
@@ -0,0 +1,18 @@
+ds2482 devicetree bindings
+
+Required properties:
+
+ - compatible: "dallas,ds2482"
+
+Optional properties:
+
+ - sleep-gpios: if specified, the ds2482 has a low-active sleep-pin (ds2482-101).
+
+Example:
+
+ 1wire@18 {
+ compatible = "dallas,ds2482";
+ reg = <0x18>;
+ sleep-gpios = <&gpio4 2 0>;
+ };
+
diff --git a/drivers/w1/masters/ds2482.c b/drivers/w1/masters/ds2482.c
index e76a9b39abb2..d9e7fd479224 100644
--- a/drivers/w1/masters/ds2482.c
+++ b/drivers/w1/masters/ds2482.c
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <asm/delay.h>
#include "../w1.h"
@@ -128,6 +129,7 @@ struct ds2482_data {
u8 channel;
u8 read_prt; /* see DS2482_PTR_CODE_xxx */
u8 reg_config;
+ struct gpio_desc *slpz_gpio;
};
@@ -449,6 +451,7 @@ static int ds2482_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct ds2482_data *data;
+ struct gpio_desc *gpio;
int err = -ENODEV;
int temp1;
int idx;
@@ -466,6 +469,12 @@ static int ds2482_probe(struct i2c_client *client,
data->client = client;
i2c_set_clientdata(client, data);
+ gpio = devm_gpiod_get(&client->dev, "sleep");
+ if (!IS_ERR(gpio)) {
+ data->slpz_gpio = gpio;
+ gpiod_direction_output(data->slpz_gpio, 1);
+ }
+
/* Reset the device (sets the read_ptr to status) */
if (ds2482_send_cmd(data, DS2482_CMD_RESET) < 0) {
dev_warn(&client->dev, "DS2482 reset failed.\n");
--
2.1.0
reply other threads:[~2014-10-02 14:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1412258796-12814-1-git-send-email-s.trumtrar@pengutronix.de \
--to=s.trumtrar@pengutronix.de \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=zbr@ioremap.net \
/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).