linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paweł Chmiel" <pawel.mikolaj.chmiel@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: robh+dt@kernel.org, mark.rutland@arm.com,
	pawel.mikolaj.chmiel@gmail.com, xc-racer2@live.ca,
	devicetree@vger.kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/5] dt-bindings: input: Add binding for bma150 sensor
Date: Sat,  2 Feb 2019 16:18:02 +0100	[thread overview]
Message-ID: <20190202151806.9064-2-pawel.mikolaj.chmiel@gmail.com> (raw)
In-Reply-To: <20190202151806.9064-1-pawel.mikolaj.chmiel@gmail.com>

From: Jonathan Bakker <xc-racer2@live.ca>

Add device tree bindings for Bosch BMA150 Accelerometer Sensor

Changes from v1:
 - Add properties for all of bma150_cfg
 - Correct IRQ type in example

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
 .../bindings/input/bosch,bma150.txt           | 38 +++++++++++++++++++
 include/dt-bindings/input/bma150.h            | 22 +++++++++++
 include/linux/bma150.h                        | 13 +------
 3 files changed, 62 insertions(+), 11 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/input/bosch,bma150.txt
 create mode 100644 include/dt-bindings/input/bma150.h

diff --git a/Documentation/devicetree/bindings/input/bosch,bma150.txt b/Documentation/devicetree/bindings/input/bosch,bma150.txt
new file mode 100644
index 000000000000..f644d132f79c
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/bosch,bma150.txt
@@ -0,0 +1,38 @@
+* Bosch BMA150 Accelerometer Sensor
+
+Also works for the SMB380 and BMA023 accelerometers
+
+Required properties:
+- compatible : Should be "bosch,bma150"
+- reg : The I2C address of the sensor
+
+Optional properties:
+- interrupt-parent : should be the phandle for the interrupt controller
+- interrupts : Interrupt mapping for IRQ.  If not present device will be polled
+- any-motion-int : bool for if the any motion interrupt should be enabled
+- hg-int : bool for if the high-G interrupt should be enabled
+- lg-int : bool for if the low-G interrupt should be enabled
+- any-motion-cfg : array of integers for any motion duration and threshold
+- hg-cfg : array of integers for high-G hysterisis, duration, and threshold
+- lg-cfg : array of integers for low-G hysterisis, duration, and threshold
+- range : configuration of range, one of BMA150_RANGE_* as defined in [1]
+- bandwidth : refresh rate of device, one of BMA150_BW_* as defined in [1]
+
+Example:
+
+bma150@38 {
+	compatible = "bosch,bma150";
+	reg = <0x38>;
+	interrupt-parent = <&gph0>;
+	interrupts = <1 IRQ_TYPE_EDGE_RISING>;
+	any-motion-int;
+	hg-int;
+	lg-int;
+	any-motion-cfg = <0 0>;
+	hg-cfg = <0 150 160>;
+	lg-cfg = <0 150 20>;
+	range = <BMA150_RANGE_2G>;
+	bandwidth = <BMA150_BW_50HZ>;
+};
+
+[1] include/dt-bindings/input/bma150.h
diff --git a/include/dt-bindings/input/bma150.h b/include/dt-bindings/input/bma150.h
new file mode 100644
index 000000000000..fb38ca787f0f
--- /dev/null
+++ b/include/dt-bindings/input/bma150.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * This header provides bindings for the BMA150 accelerometer
+ */
+#ifndef _DT_BINDINGS_INPUT_BMA150_H
+#define _DT_BINDINGS_INPUT_BMA150_H
+
+/* Range */
+#define BMA150_RANGE_2G		0
+#define BMA150_RANGE_4G		1
+#define BMA150_RANGE_8G		2
+
+/* Refresh rate */
+#define BMA150_BW_25HZ		0
+#define BMA150_BW_50HZ		1
+#define BMA150_BW_100HZ		2
+#define BMA150_BW_190HZ		3
+#define BMA150_BW_375HZ		4
+#define BMA150_BW_750HZ		5
+#define BMA150_BW_1500HZ	6
+
+#endif /* _DT_BINDINGS_INPUT_BMA150_H */
diff --git a/include/linux/bma150.h b/include/linux/bma150.h
index 97ade7cdc870..b85266a9c35c 100644
--- a/include/linux/bma150.h
+++ b/include/linux/bma150.h
@@ -20,19 +20,10 @@
 #ifndef _BMA150_H_
 #define _BMA150_H_
 
-#define BMA150_DRIVER		"bma150"
+#include <dt-bindings/input/bma150.h>
 
-#define BMA150_RANGE_2G		0
-#define BMA150_RANGE_4G		1
-#define BMA150_RANGE_8G		2
+#define BMA150_DRIVER		"bma150"
 
-#define BMA150_BW_25HZ		0
-#define BMA150_BW_50HZ		1
-#define BMA150_BW_100HZ		2
-#define BMA150_BW_190HZ		3
-#define BMA150_BW_375HZ		4
-#define BMA150_BW_750HZ		5
-#define BMA150_BW_1500HZ	6
 
 struct bma150_cfg {
 	bool any_motion_int;		/* Set to enable any-motion interrupt */
-- 
2.17.1


  reply	other threads:[~2019-02-02 15:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02 15:18 [PATCH v2 0/5] input: misc: bma150: Add support for device tree Paweł Chmiel
2019-02-02 15:18 ` Paweł Chmiel [this message]
2019-02-18 19:18   ` [PATCH v2 1/5] dt-bindings: input: Add binding for bma150 sensor Rob Herring
2019-02-18 22:17     ` Jonathan Bakker
2019-02-02 15:18 ` [PATCH v2 2/5] input: misc: bma150: Use managed resources helpers Paweł Chmiel
2019-02-06 18:52   ` Dmitry Torokhov
2019-02-02 15:18 ` [PATCH v2 3/5] input: misc: bma150: Add support for device tree Paweł Chmiel
2019-02-02 15:18 ` [PATCH v2 4/5] input: misc: bma150: Drop platform data Paweł Chmiel
2019-02-02 15:18 ` [PATCH v2 5/5] input: misc: bma150: Register input device after setting private data Paweł Chmiel
2019-02-06 18:53   ` Dmitry Torokhov
2019-02-06 19:23     ` Dmitry Torokhov

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=20190202151806.9064-2-pawel.mikolaj.chmiel@gmail.com \
    --to=pawel.mikolaj.chmiel@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=xc-racer2@live.ca \
    /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).