linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: jic23@kernel.org
Cc: linux-iio@vger.kernel.org, sean@geanix.com, martin@geanix.com,
	rjones@gateworks.com, lorenzo.bianconi@redhat.com,
	devicetree@vger.kernel.org
Subject: [PATCH 10/13] iio: imu: st_lsm6dsx: add wakeup_source in st_sensors_platform_data
Date: Sun,  6 Oct 2019 15:22:04 +0200	[thread overview]
Message-ID: <a237c2406825ff16c5606344420fd566b08525f9.1570367532.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1570367532.git.lorenzo@kernel.org>

Add the possibility to enable/disable wakeup source through
st_sensors_platform_data and not only through device tree

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c   | 6 ++++--
 include/linux/platform_data/st_sensors_pdata.h | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index b0623b837abd..a2a0ac81e3d3 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2089,7 +2089,9 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
 int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 		     struct regmap *regmap)
 {
+	struct st_sensors_platform_data *pdata = dev->platform_data;
 	const struct st_lsm6dsx_shub_settings *hub_settings;
+	struct device_node *np = dev->of_node;
 	struct st_lsm6dsx_hw *hw;
 	const char *name = NULL;
 	int i, err;
@@ -2152,8 +2154,8 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
 			return err;
 	}
 
-	if (dev->of_node &&
-	    of_property_read_bool(dev->of_node, "wakeup-source"))
+	if ((np && of_property_read_bool(np, "wakeup-source")) ||
+	    (pdata && pdata->wakeup_source))
 		device_init_wakeup(dev, true);
 
 	return 0;
diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h
index 30929c22227d..e40b28ca892e 100644
--- a/include/linux/platform_data/st_sensors_pdata.h
+++ b/include/linux/platform_data/st_sensors_pdata.h
@@ -18,12 +18,14 @@
  * @open_drain: set the interrupt line to be open drain if possible.
  * @spi_3wire: enable spi-3wire mode.
  * @pullups: enable/disable i2c controller pullup resistors.
+ * @wakeup_source: enable/disable device as wakeup generator.
  */
 struct st_sensors_platform_data {
 	u8 drdy_int_pin;
 	bool open_drain;
 	bool spi_3wire;
 	bool pullups;
+	bool wakeup_source;
 };
 
 #endif /* ST_SENSORS_PDATA_H */
-- 
2.21.0


  parent reply	other threads:[~2019-10-06 13:22 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-06 13:21 [PATCH 00/13] various st_lsm6dsx fixes and missing bits Lorenzo Bianconi
2019-10-06 13:21 ` [PATCH 01/13] iio: imu: st_lsm6dsx: use st_lsm6dsx_read_locked in st_lsm6dsx_report_motion_event Lorenzo Bianconi
2019-10-07  7:54   ` Sean Nyekjaer
2019-10-12 12:08   ` Jonathan Cameron
2019-10-06 13:21 ` [PATCH 02/13] iio: imu: st_lsm6dsx: add sanity check for read_fifo pointer Lorenzo Bianconi
2019-10-06 13:21 ` [PATCH 03/13] iio: imu: st_lsm6dsx: move irq related definitions in irq_config Lorenzo Bianconi
2019-10-07  7:54   ` Sean Nyekjaer
2019-10-12 12:13     ` Jonathan Cameron
2019-10-06 13:21 ` [PATCH 04/13] iio: imu: st_lsm6dsx: do not access active-low/open-drain regs if not supported Lorenzo Bianconi
2019-10-12 12:14   ` Jonathan Cameron
2019-10-06 13:21 ` [PATCH 05/13] iio: imu: st_lsm6dsx: move bdu/boot and reset register info in hw_settings Lorenzo Bianconi
2019-10-12 12:19   ` Jonathan Cameron
2019-10-06 13:22 ` [PATCH 06/13] iio: imu: st_lsm6dsx: always check enable_reg in st_lsm6dsx_event_setup Lorenzo Bianconi
2019-10-07  7:55   ` Sean Nyekjaer
2019-10-12 12:21     ` Jonathan Cameron
2019-10-06 13:22 ` [PATCH 07/13] iio: imu: st_lsm6dsx: rely on st_lsm6dsx_update_bits_locked configuring events Lorenzo Bianconi
2019-10-12 12:22   ` Jonathan Cameron
2019-10-06 13:22 ` [PATCH 08/13] iio: imu: st_lsm6dsx: grab conf mutex in st_lsm6dsx_write_event_config Lorenzo Bianconi
2019-10-12 12:23   ` Jonathan Cameron
2019-10-06 13:22 ` [PATCH 09/13] iio: imu: st_lsm6dsx: fix checkpatch warning Lorenzo Bianconi
2019-10-12 12:24   ` Jonathan Cameron
2019-10-06 13:22 ` Lorenzo Bianconi [this message]
2019-10-12 12:25   ` [PATCH 10/13] iio: imu: st_lsm6dsx: add wakeup_source in st_sensors_platform_data Jonathan Cameron
2019-10-06 13:22 ` [PATCH 11/13] iio: imu: st_lsm6dsx: add missing kernel documenation Lorenzo Bianconi
2019-10-07  7:56   ` Sean Nyekjaer
2019-10-12 12:26     ` Jonathan Cameron
2019-10-06 13:22 ` [PATCH 12/13] dt-bindings: iio: imu: st_lsm6dsx: document missing wakeup-source property Lorenzo Bianconi
2019-10-07  7:56   ` Sean Nyekjaer
2019-10-15 20:34   ` Rob Herring
2019-10-06 13:22 ` [PATCH 13/13] iio: imu: st_lsm6dsx: enable wake-up event for LSM6DSO Lorenzo Bianconi
2019-10-12 12:28   ` Jonathan Cameron
2019-10-12 12:20 ` [PATCH 00/13] various st_lsm6dsx fixes and missing bits Jonathan Cameron
2019-10-12 12:26   ` Lorenzo Bianconi
2019-10-12 13:26     ` Jonathan Cameron

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=a237c2406825ff16c5606344420fd566b08525f9.1570367532.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=martin@geanix.com \
    --cc=rjones@gateworks.com \
    --cc=sean@geanix.com \
    /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).