linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] iio: accel: bma180: Prepare for different reset values
       [not found] <20200503172206.13782-1-xc-racer2@live.ca>
@ 2020-05-03 17:22 ` Jonathan Bakker
  2020-05-06 12:37   ` Linus Walleij
  2020-05-03 17:22 ` [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support Jonathan Bakker
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Jonathan Bakker @ 2020-05-03 17:22 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, robh+dt, linus.walleij, linux-iio,
	devicetree, linux-kernel, dmitry.torokhov, kstewart, gregkh,
	tglx, linux-input
  Cc: Jonathan Bakker

Some variants of the bma180 (eg bma023) have different reset
values.  In preparation for adding support for them, factor
out the reset value into the chip specific data.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 drivers/iio/accel/bma180.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index fcd91d5f05fd..75440dd83ec4 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -57,7 +57,7 @@ struct bma180_part_info {
 	u8 power_reg, power_mask, lowpower_val;
 	u8 int_enable_reg, int_enable_mask;
 	u8 int_map_reg, int_enable_dataready_int1_mask;
-	u8 softreset_reg;
+	u8 softreset_reg, softreset_val;
 
 	int (*chip_config)(struct bma180_data *data);
 	void (*chip_disable)(struct bma180_data *data);
@@ -319,7 +319,8 @@ static int bma180_set_pmode(struct bma180_data *data, bool mode)
 static int bma180_soft_reset(struct bma180_data *data)
 {
 	int ret = i2c_smbus_write_byte_data(data->client,
-		data->part_info->softreset_reg, BMA180_RESET_VAL);
+		data->part_info->softreset_reg,
+		data->part_info->softreset_val);
 
 	if (ret)
 		dev_err(&data->client->dev, "failed to reset the chip\n");
@@ -693,6 +694,7 @@ static const struct bma180_part_info bma180_part_info[] = {
 		.int_enable_reg = BMA180_CTRL_REG3,
 		.int_enable_mask = BMA180_NEW_DATA_INT,
 		.softreset_reg = BMA180_RESET,
+		.softreset_val = BMA180_RESET_VAL,
 		.chip_config = bma180_chip_config,
 		.chip_disable = bma180_chip_disable,
 	},
@@ -721,6 +723,7 @@ static const struct bma180_part_info bma180_part_info[] = {
 		.int_map_reg = BMA250_INT_MAP_REG,
 		.int_enable_dataready_int1_mask = BMA250_INT1_DATA_MASK,
 		.softreset_reg = BMA250_RESET_REG,
+		.softreset_val = BMA180_RESET_VAL,
 		.chip_config = bma25x_chip_config,
 		.chip_disable = bma25x_chip_disable,
 	},
@@ -749,6 +752,7 @@ static const struct bma180_part_info bma180_part_info[] = {
 		.int_map_reg = BMA254_INT_MAP_REG,
 		.int_enable_dataready_int1_mask = BMA254_INT1_DATA_MASK,
 		.softreset_reg = BMA254_RESET_REG,
+		.softreset_val = BMA180_RESET_VAL,
 		.chip_config = bma25x_chip_config,
 		.chip_disable = bma25x_chip_disable,
 	},
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support
       [not found] <20200503172206.13782-1-xc-racer2@live.ca>
  2020-05-03 17:22 ` [PATCH 1/5] iio: accel: bma180: Prepare for different reset values Jonathan Bakker
@ 2020-05-03 17:22 ` Jonathan Bakker
  2020-05-06 12:46   ` Linus Walleij
  2020-05-03 17:22 ` [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180 Jonathan Bakker
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 16+ messages in thread
From: Jonathan Bakker @ 2020-05-03 17:22 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, robh+dt, linus.walleij, linux-iio,
	devicetree, linux-kernel, dmitry.torokhov, kstewart, gregkh,
	tglx, linux-input
  Cc: Jonathan Bakker

The bma180 IIO driver has been extended for support for bma023.
However, this could cause conflicts with this driver.  Since some
setups may depend upon the evdev setup, disable support in this
driver for the bma023 only when the IIO driver is being built.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 drivers/input/misc/bma150.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c
index a9d984da95f3..5d3f8b05b316 100644
--- a/drivers/input/misc/bma150.c
+++ b/drivers/input/misc/bma150.c
@@ -541,7 +541,10 @@ static UNIVERSAL_DEV_PM_OPS(bma150_pm, bma150_suspend, bma150_resume, NULL);
 static const struct i2c_device_id bma150_id[] = {
 	{ "bma150", 0 },
 	{ "smb380", 0 },
+	/* Prefer the IIO-based driver for bma023 if enabled */
+#if !IS_ENABLED(CONFIG_BMA180)
 	{ "bma023", 0 },
+#endif
 	{ }
 };
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180
       [not found] <20200503172206.13782-1-xc-racer2@live.ca>
  2020-05-03 17:22 ` [PATCH 1/5] iio: accel: bma180: Prepare for different reset values Jonathan Bakker
  2020-05-03 17:22 ` [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support Jonathan Bakker
@ 2020-05-03 17:22 ` Jonathan Bakker
  2020-05-06 12:49   ` Linus Walleij
  2020-05-12 22:15   ` Rob Herring
  2020-05-03 17:22 ` [PATCH 4/5] dt-bindings: iio: accel: Add required regulators " Jonathan Bakker
  2020-05-03 17:22 ` [PATCH 5/5] iio: accel: bma180: Add support for bma023 Jonathan Bakker
  4 siblings, 2 replies; 16+ messages in thread
From: Jonathan Bakker @ 2020-05-03 17:22 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, robh+dt, linus.walleij, linux-iio,
	devicetree, linux-kernel, dmitry.torokhov, kstewart, gregkh,
	tglx, linux-input
  Cc: Jonathan Bakker

The bma023 is in the same family as the bma180 and support is
being added to the bma180 IIO driver for it.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 Documentation/devicetree/bindings/iio/accel/bma180.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/iio/accel/bma180.txt b/Documentation/devicetree/bindings/iio/accel/bma180.txt
index f53237270b32..48bec35f452a 100644
--- a/Documentation/devicetree/bindings/iio/accel/bma180.txt
+++ b/Documentation/devicetree/bindings/iio/accel/bma180.txt
@@ -1,4 +1,4 @@
-* Bosch BMA180 / BMA25x triaxial acceleration sensor
+* Bosch BMA023 / BMA180 / BMA25x triaxial acceleration sensor
 
 http://omapworld.com/BMA180_111_1002839.pdf
 http://ae-bst.resource.bosch.com/media/products/dokumente/bma250/bst-bma250-ds002-05.pdf
@@ -6,6 +6,7 @@ http://ae-bst.resource.bosch.com/media/products/dokumente/bma250/bst-bma250-ds00
 Required properties:
 
   - compatible : should be one of:
+    "bosch,bma023"
     "bosch,bma180"
     "bosch,bma250"
     "bosch,bma254"
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 4/5] dt-bindings: iio: accel: Add required regulators to bma180
       [not found] <20200503172206.13782-1-xc-racer2@live.ca>
                   ` (2 preceding siblings ...)
  2020-05-03 17:22 ` [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180 Jonathan Bakker
@ 2020-05-03 17:22 ` Jonathan Bakker
  2020-05-06 12:49   ` Linus Walleij
  2020-05-12 22:15   ` Rob Herring
  2020-05-03 17:22 ` [PATCH 5/5] iio: accel: bma180: Add support for bma023 Jonathan Bakker
  4 siblings, 2 replies; 16+ messages in thread
From: Jonathan Bakker @ 2020-05-03 17:22 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, robh+dt, linus.walleij, linux-iio,
	devicetree, linux-kernel, dmitry.torokhov, kstewart, gregkh,
	tglx, linux-input
  Cc: Jonathan Bakker

The bma180 and related chips should have two registers attached to
them.  The IIO driver currently uses them, document them here as
well.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 Documentation/devicetree/bindings/iio/accel/bma180.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/accel/bma180.txt b/Documentation/devicetree/bindings/iio/accel/bma180.txt
index 48bec35f452a..af34f4fe410d 100644
--- a/Documentation/devicetree/bindings/iio/accel/bma180.txt
+++ b/Documentation/devicetree/bindings/iio/accel/bma180.txt
@@ -11,6 +11,8 @@ Required properties:
     "bosch,bma250"
     "bosch,bma254"
   - reg : the I2C address of the sensor
+  - vdd-supply : regulator phandle connected to the VDD pin
+  - vddio-supply : regulator phandle connected to the VDDIO pin
 
 Optional properties:
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 5/5] iio: accel: bma180: Add support for bma023
       [not found] <20200503172206.13782-1-xc-racer2@live.ca>
                   ` (3 preceding siblings ...)
  2020-05-03 17:22 ` [PATCH 4/5] dt-bindings: iio: accel: Add required regulators " Jonathan Bakker
@ 2020-05-03 17:22 ` Jonathan Bakker
  2020-05-06 12:51   ` Linus Walleij
  4 siblings, 1 reply; 16+ messages in thread
From: Jonathan Bakker @ 2020-05-03 17:22 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, robh+dt, linus.walleij, linux-iio,
	devicetree, linux-kernel, dmitry.torokhov, kstewart, gregkh,
	tglx, linux-input
  Cc: Jonathan Bakker

The bma023 chip is similar enough to the bma180 and bma25x that the
same driver can support all of them.  The biggest differences are
the lack of a temperature channel and no low power but still working
mode.

The bma150 is a close relative of the bma023, but it does have a
temperature channel so support is not added for it.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
 drivers/iio/accel/Kconfig  |   6 +-
 drivers/iio/accel/bma180.c | 123 +++++++++++++++++++++++++++++++++++--
 2 files changed, 122 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
index 5d91a6dda894..4699113f19d9 100644
--- a/drivers/iio/accel/Kconfig
+++ b/drivers/iio/accel/Kconfig
@@ -89,13 +89,13 @@ config ADXL372_I2C
 	  module will be called adxl372_i2c.
 
 config BMA180
-	tristate "Bosch BMA180/BMA25x 3-Axis Accelerometer Driver"
+	tristate "Bosch BMA023/BMA180/BMA25x 3-Axis Accelerometer Driver"
 	depends on I2C
 	select IIO_BUFFER
 	select IIO_TRIGGERED_BUFFER
 	help
-	  Say Y here if you want to build a driver for the Bosch BMA180 or
-	  BMA25x triaxial acceleration sensor.
+	  Say Y here if you want to build a driver for the Bosch BMA023, BMA180
+	  or BMA25x triaxial acceleration sensor.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called bma180.
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 75440dd83ec4..19d4f174a890 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -7,6 +7,7 @@
  * Support for BMA250 (c) Peter Meerwald <pmeerw@pmeerw.net>
  *
  * SPI is not supported by driver
+ * BMA023: 7-bit I2C slave address 0x38
  * BMA180: 7-bit I2C slave address 0x40 or 0x41
  * BMA250: 7-bit I2C slave address 0x18 or 0x19
  * BMA254: 7-bit I2C slave address 0x18 or 0x19
@@ -33,6 +34,7 @@
 #define BMA180_IRQ_NAME "bma180_event"
 
 enum chip_ids {
+	BMA023,
 	BMA180,
 	BMA250,
 	BMA254,
@@ -64,6 +66,18 @@ struct bma180_part_info {
 };
 
 /* Register set */
+#define BMA023_CTRL_REG0	0x0a
+#define BMA023_CTRL_REG1	0x0b
+#define BMA023_CTRL_REG2	0x14
+#define BMA023_CTRL_REG3	0x15
+
+#define BMA023_RANGE_MASK	GENMASK(4, 3) /* Range of accel values */
+#define BMA023_BW_MASK		GENMASK(2, 0) /* Accel bandwidth */
+#define BMA023_SLEEP		BIT(0)
+#define BMA023_INT_RESET_MASK	BIT(6)
+#define BMA023_NEW_DATA_INT	BIT(5) /* Intr every new accel data is ready */
+#define BMA023_RESET_VAL	BIT(1)
+
 #define BMA180_CHIP_ID		0x00 /* Need to distinguish BMA180 from other */
 #define BMA180_ACC_X_LSB	0x02 /* First of 6 registers of accel data */
 #define BMA180_TEMP		0x08
@@ -94,6 +108,7 @@ struct bma180_part_info {
 /* We have to write this value in reset register to do soft reset */
 #define BMA180_RESET_VAL	0xb6
 
+#define BMA023_ID_REG_VAL	0x02
 #define BMA180_ID_REG_VAL	0x03
 #define BMA250_ID_REG_VAL	0x03
 #define BMA254_ID_REG_VAL	0xfa /* 250 decimal */
@@ -156,6 +171,9 @@ enum bma180_chan {
 	TEMP
 };
 
+static int bma023_bw_table[] = { 25, 50, 100, 190, 375, 750, 1500 }; /* Hz */
+static int bma023_scale_table[] = { 2452, 4903, 9709, };
+
 static int bma180_bw_table[] = { 10, 20, 40, 75, 150, 300 }; /* Hz */
 static int bma180_scale_table[] = { 1275, 1863, 2452, 3727, 4903, 9709, 19417 };
 
@@ -350,17 +368,37 @@ static int bma180_chip_init(struct bma180_data *data)
 	 */
 	msleep(20);
 
-	ret = bma180_set_new_data_intr_state(data, false);
+	return bma180_set_new_data_intr_state(data, false);
+}
+
+static int bma023_chip_config(struct bma180_data *data)
+{
+	int ret = bma180_chip_init(data);
+
 	if (ret)
-		return ret;
+		goto err;
+
+	ret = bma180_set_bw(data, 50); /* 50 Hz */
+	if (ret)
+		goto err;
+	ret = bma180_set_scale(data, 2452); /* 2 G */
+	if (ret)
+		goto err;
 
-	return bma180_set_pmode(data, false);
+	return 0;
+
+err:
+	dev_err(&data->client->dev, "failed to config the chip\n");
+	return ret;
 }
 
 static int bma180_chip_config(struct bma180_data *data)
 {
 	int ret = bma180_chip_init(data);
 
+	if (ret)
+		goto err;
+	ret = bma180_set_pmode(data, false);
 	if (ret)
 		goto err;
 	ret = bma180_set_bits(data, BMA180_CTRL_REG0, BMA180_DIS_WAKE_UP, 1);
@@ -390,6 +428,9 @@ static int bma25x_chip_config(struct bma180_data *data)
 {
 	int ret = bma180_chip_init(data);
 
+	if (ret)
+		goto err;
+	ret = bma180_set_pmode(data, false);
 	if (ret)
 		goto err;
 	ret = bma180_set_bw(data, 16); /* 16 Hz */
@@ -414,6 +455,17 @@ static int bma25x_chip_config(struct bma180_data *data)
 	return ret;
 }
 
+static void bma023_chip_disable(struct bma180_data *data)
+{
+	if (bma180_set_sleep_state(data, true))
+		goto err;
+
+	return;
+
+err:
+	dev_err(&data->client->dev, "failed to disable the chip\n");
+}
+
 static void bma180_chip_disable(struct bma180_data *data)
 {
 	if (bma180_set_new_data_intr_state(data, false))
@@ -610,6 +662,11 @@ static const struct iio_enum bma180_power_mode_enum = {
 	.set = bma180_set_power_mode,
 };
 
+static const struct iio_chan_spec_ext_info bma023_ext_info[] = {
+	IIO_MOUNT_MATRIX(IIO_SHARED_BY_DIR, bma180_accel_get_mount_matrix),
+	{ }
+};
+
 static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
 	IIO_ENUM("power_mode", true, &bma180_power_mode_enum),
 	IIO_ENUM_AVAILABLE("power_mode", &bma180_power_mode_enum),
@@ -617,6 +674,23 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
 	{ }
 };
 
+#define BMA023_ACC_CHANNEL(_axis, _bits) {				\
+	.type = IIO_ACCEL,						\
+	.modified = 1,							\
+	.channel2 = IIO_MOD_##_axis,					\
+	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),			\
+	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) |		\
+		BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY),	\
+	.scan_index = AXIS_##_axis,					\
+	.scan_type = {							\
+		.sign = 's',						\
+		.realbits = _bits,					\
+		.storagebits = 16,					\
+		.shift = 16 - _bits,					\
+	},								\
+	.ext_info = bma023_ext_info,					\
+}
+
 #define BMA180_ACC_CHANNEL(_axis, _bits) {				\
 	.type = IIO_ACCEL,						\
 	.modified = 1,							\
@@ -646,6 +720,13 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
 	},								\
 }
 
+static const struct iio_chan_spec bma023_channels[] = {
+	BMA023_ACC_CHANNEL(X, 10),
+	BMA023_ACC_CHANNEL(Y, 10),
+	BMA023_ACC_CHANNEL(Z, 10),
+	IIO_CHAN_SOFT_TIMESTAMP(4),
+};
+
 static const struct iio_chan_spec bma180_channels[] = {
 	BMA180_ACC_CHANNEL(X, 14),
 	BMA180_ACC_CHANNEL(Y, 14),
@@ -671,6 +752,35 @@ static const struct iio_chan_spec bma254_channels[] = {
 };
 
 static const struct bma180_part_info bma180_part_info[] = {
+	[BMA023] = {
+		.chip_id = BMA023_ID_REG_VAL,
+		.channels = bma023_channels,
+		.num_channels = ARRAY_SIZE(bma023_channels),
+		.scale_table = bma023_scale_table,
+		.num_scales = ARRAY_SIZE(bma023_scale_table),
+		.bw_table = bma023_bw_table,
+		.num_bw = ARRAY_SIZE(bma023_bw_table),
+		/* No temperature channel */
+		.center_temp = 0,
+		.int_reset_reg = BMA023_CTRL_REG0,
+		.int_reset_mask = BMA023_INT_RESET_MASK,
+		.sleep_reg = BMA023_CTRL_REG0,
+		.sleep_mask = BMA023_SLEEP,
+		.bw_reg = BMA023_CTRL_REG2,
+		.bw_mask = BMA023_BW_MASK,
+		.scale_reg = BMA023_CTRL_REG2,
+		.scale_mask = BMA023_RANGE_MASK,
+		/* No power mode on bma023 */
+		.power_reg = 0,
+		.power_mask = 0,
+		.lowpower_val = 0,
+		.int_enable_reg = BMA023_CTRL_REG3,
+		.int_enable_mask = BMA023_NEW_DATA_INT,
+		.softreset_reg = BMA023_CTRL_REG0,
+		.softreset_val = BMA023_RESET_VAL,
+		.chip_config = bma023_chip_config,
+		.chip_disable = bma023_chip_disable,
+	},
 	[BMA180] = {
 		.chip_id = BMA180_ID_REG_VAL,
 		.channels = bma180_channels,
@@ -994,6 +1104,7 @@ static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume);
 #endif
 
 static const struct i2c_device_id bma180_ids[] = {
+	{ "bma023", BMA023 },
 	{ "bma180", BMA180 },
 	{ "bma250", BMA250 },
 	{ "bma254", BMA254 },
@@ -1003,6 +1114,10 @@ static const struct i2c_device_id bma180_ids[] = {
 MODULE_DEVICE_TABLE(i2c, bma180_ids);
 
 static const struct of_device_id bma180_of_match[] = {
+	{
+		.compatible = "bosch,bma023",
+		.data = (void *)BMA023
+	},
 	{
 		.compatible = "bosch,bma180",
 		.data = (void *)BMA180
@@ -1034,5 +1149,5 @@ module_i2c_driver(bma180_driver);
 
 MODULE_AUTHOR("Kravchenko Oleksandr <x0199363@ti.com>");
 MODULE_AUTHOR("Texas Instruments, Inc.");
-MODULE_DESCRIPTION("Bosch BMA180/BMA25x triaxial acceleration sensor");
+MODULE_DESCRIPTION("Bosch BMA023/BMA180/BMA25x triaxial acceleration sensor");
 MODULE_LICENSE("GPL");
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] iio: accel: bma180: Prepare for different reset values
  2020-05-03 17:22 ` [PATCH 1/5] iio: accel: bma180: Prepare for different reset values Jonathan Bakker
@ 2020-05-06 12:37   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2020-05-06 12:37 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Dmitry Torokhov, Kate Stewart, Greg KH,
	Thomas Gleixner, Linux Input

On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:

> Some variants of the bma180 (eg bma023) have different reset
> values.  In preparation for adding support for them, factor
> out the reset value into the chip specific data.
>
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support
  2020-05-03 17:22 ` [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support Jonathan Bakker
@ 2020-05-06 12:46   ` Linus Walleij
  2020-05-07  3:46     ` Jonathan Bakker
  0 siblings, 1 reply; 16+ messages in thread
From: Linus Walleij @ 2020-05-06 12:46 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Dmitry Torokhov, Kate Stewart, Greg KH,
	Thomas Gleixner, Linux Input

On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:

> The bma180 IIO driver has been extended for support for bma023.
> However, this could cause conflicts with this driver.  Since some
> setups may depend upon the evdev setup, disable support in this
> driver for the bma023 only when the IIO driver is being built.
>
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>

I would just fix this with KConfig instead, like add mutually
exclusive depends on these two drivers.

Set this input driver as:
depends on BMA180=n

And the IIO driver as:
depends on INPUT_BMA150=n

It's a rough measure but this input driver should anyway
go away.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180
  2020-05-03 17:22 ` [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180 Jonathan Bakker
@ 2020-05-06 12:49   ` Linus Walleij
  2020-05-12 22:15   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2020-05-06 12:49 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Dmitry Torokhov, Kate Stewart, Greg KH,
	Thomas Gleixner, Linux Input

On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:

> The bma023 is in the same family as the bma180 and support is
> being added to the bma180 IIO driver for it.
>
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
(...)
>    - compatible : should be one of:
> +    "bosch,bma023"

Please add bma150 and smb380 compatibles at the
same time, it's simple enough and nobody will get hurt.

With that:
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] dt-bindings: iio: accel: Add required regulators to bma180
  2020-05-03 17:22 ` [PATCH 4/5] dt-bindings: iio: accel: Add required regulators " Jonathan Bakker
@ 2020-05-06 12:49   ` Linus Walleij
  2020-05-12 22:15   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2020-05-06 12:49 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Dmitry Torokhov, Kate Stewart, Greg KH,
	Thomas Gleixner, Linux Input

On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:

> The bma180 and related chips should have two registers attached to
> them.  The IIO driver currently uses them, document them here as
> well.
>
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/5] iio: accel: bma180: Add support for bma023
  2020-05-03 17:22 ` [PATCH 5/5] iio: accel: bma180: Add support for bma023 Jonathan Bakker
@ 2020-05-06 12:51   ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2020-05-06 12:51 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Dmitry Torokhov, Kate Stewart, Greg KH,
	Thomas Gleixner, Linux Input

On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:

> The bma023 chip is similar enough to the bma180 and bma25x that the
> same driver can support all of them.  The biggest differences are
> the lack of a temperature channel and no low power but still working
> mode.
>
> The bma150 is a close relative of the bma023, but it does have a
> temperature channel so support is not added for it.
>
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>

Looks good to me!
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support
  2020-05-06 12:46   ` Linus Walleij
@ 2020-05-07  3:46     ` Jonathan Bakker
  2020-05-07  4:23       ` Dmitry Torokhov
  0 siblings, 1 reply; 16+ messages in thread
From: Jonathan Bakker @ 2020-05-07  3:46 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Dmitry Torokhov, Kate Stewart, Greg KH,
	Thomas Gleixner, Linux Input

Hi Linus,

On 2020-05-06 5:46 a.m., Linus Walleij wrote:
> On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:
> 
>> The bma180 IIO driver has been extended for support for bma023.
>> However, this could cause conflicts with this driver.  Since some
>> setups may depend upon the evdev setup, disable support in this
>> driver for the bma023 only when the IIO driver is being built.
>>
>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> 
> I would just fix this with KConfig instead, like add mutually
> exclusive depends on these two drivers.
> 
> Set this input driver as:
> depends on BMA180=n
> 
> And the IIO driver as:
> depends on INPUT_BMA150=n
> 
> It's a rough measure but this input driver should anyway
> go away.
> 

Ok, sounds good to me.  If I include a patch removing the input driver, can I just drop this patch entirely?

The only in-tree user of the input driver (based on i2c ids) is Intel Mid.  Not sure what the kernel policy on dropping drivers is.

> Yours,
> Linus Walleij
> 

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support
  2020-05-07  3:46     ` Jonathan Bakker
@ 2020-05-07  4:23       ` Dmitry Torokhov
  2020-05-08 15:57         ` Jonathan Bakker
  0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Torokhov @ 2020-05-07  4:23 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: Linus Walleij, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Kate Stewart, Greg KH, Thomas Gleixner,
	Linux Input

On Wed, May 06, 2020 at 08:46:12PM -0700, Jonathan Bakker wrote:
> Hi Linus,
> 
> On 2020-05-06 5:46 a.m., Linus Walleij wrote:
> > On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:
> > 
> >> The bma180 IIO driver has been extended for support for bma023.
> >> However, this could cause conflicts with this driver.  Since some
> >> setups may depend upon the evdev setup, disable support in this
> >> driver for the bma023 only when the IIO driver is being built.
> >>
> >> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> > 
> > I would just fix this with KConfig instead, like add mutually
> > exclusive depends on these two drivers.
> > 
> > Set this input driver as:
> > depends on BMA180=n
> > 
> > And the IIO driver as:
> > depends on INPUT_BMA150=n
> > 
> > It's a rough measure but this input driver should anyway
> > go away.

Isn't the driver handle more than bma023? I see bma150 and smb380 ID's.
If we go Kconfig route we will be disabling it for them as well when IIO
driver is enabled.

> > 
> 
> Ok, sounds good to me.  If I include a patch removing the input
> driver, can I just drop this patch entirely?

> 
> The only in-tree user of the input driver (based on i2c ids) is Intel
> Mid.  Not sure what the kernel policy on dropping drivers is.

Do we still support this platform? I'd start there.

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support
  2020-05-07  4:23       ` Dmitry Torokhov
@ 2020-05-08 15:57         ` Jonathan Bakker
  2020-05-08 19:41           ` Linus Walleij
  0 siblings, 1 reply; 16+ messages in thread
From: Jonathan Bakker @ 2020-05-08 15:57 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Kate Stewart, Greg KH, Thomas Gleixner,
	Linux Input

H Dmitry,

On 2020-05-06 9:23 p.m., Dmitry Torokhov wrote:
> On Wed, May 06, 2020 at 08:46:12PM -0700, Jonathan Bakker wrote:
>> Hi Linus,
>>
>> On 2020-05-06 5:46 a.m., Linus Walleij wrote:
>>> On Sun, May 3, 2020 at 7:22 PM Jonathan Bakker <xc-racer2@live.ca> wrote:
>>>
>>>> The bma180 IIO driver has been extended for support for bma023.
>>>> However, this could cause conflicts with this driver.  Since some
>>>> setups may depend upon the evdev setup, disable support in this
>>>> driver for the bma023 only when the IIO driver is being built.
>>>>
>>>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>>>
>>> I would just fix this with KConfig instead, like add mutually
>>> exclusive depends on these two drivers.
>>>
>>> Set this input driver as:
>>> depends on BMA180=n
>>>
>>> And the IIO driver as:
>>> depends on INPUT_BMA150=n
>>>
>>> It's a rough measure but this input driver should anyway
>>> go away.
> 
> Isn't the driver handle more than bma023? I see bma150 and smb380 ID's.
> If we go Kconfig route we will be disabling it for them as well when IIO
> driver is enabled.
> 

Yes, that's correct.

>>>
>>
>> Ok, sounds good to me.  If I include a patch removing the input
>> driver, can I just drop this patch entirely?
> 
>>
>> The only in-tree user of the input driver (based on i2c ids) is Intel
>> Mid.  Not sure what the kernel policy on dropping drivers is.
> 
> Do we still support this platform? I'd start there.

It looks to me like the preferred method would be to also add IIO support for
smb380/bma150, add the exclusive Kconfig entries, and leave the input
driver in place.  Does this work for everyone?

> 
> Thanks.
> 

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support
  2020-05-08 15:57         ` Jonathan Bakker
@ 2020-05-08 19:41           ` Linus Walleij
  0 siblings, 0 replies; 16+ messages in thread
From: Linus Walleij @ 2020-05-08 19:41 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: Dmitry Torokhov, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald, Rob Herring, linux-iio,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	linux-kernel, Kate Stewart, Greg KH, Thomas Gleixner,
	Linux Input

On Fri, May 8, 2020 at 5:57 PM Jonathan Bakker <xc-racer2@live.ca> wrote:

> It looks to me like the preferred method would be to also add IIO support for
> smb380/bma150, add the exclusive Kconfig entries, and leave the input
> driver in place.  Does this work for everyone?

That's my preferred solution for sure, so go for it if I have a say.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180
  2020-05-03 17:22 ` [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180 Jonathan Bakker
  2020-05-06 12:49   ` Linus Walleij
@ 2020-05-12 22:15   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2020-05-12 22:15 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: devicetree, linux-kernel, tglx, jic23, linux-iio, gregkh, pmeerw,
	linus.walleij, linux-input, lars, kstewart, knaack.h,
	dmitry.torokhov, robh+dt

On Sun,  3 May 2020 10:22:04 -0700, Jonathan Bakker wrote:
> The bma023 is in the same family as the bma180 and support is
> being added to the bma180 IIO driver for it.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> ---
>  Documentation/devicetree/bindings/iio/accel/bma180.txt | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 4/5] dt-bindings: iio: accel: Add required regulators to bma180
  2020-05-03 17:22 ` [PATCH 4/5] dt-bindings: iio: accel: Add required regulators " Jonathan Bakker
  2020-05-06 12:49   ` Linus Walleij
@ 2020-05-12 22:15   ` Rob Herring
  1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring @ 2020-05-12 22:15 UTC (permalink / raw)
  To: Jonathan Bakker
  Cc: knaack.h, tglx, linus.walleij, linux-kernel, lars, jic23,
	robh+dt, kstewart, pmeerw, gregkh, linux-input, dmitry.torokhov,
	devicetree, linux-iio

On Sun,  3 May 2020 10:22:05 -0700, Jonathan Bakker wrote:
> The bma180 and related chips should have two registers attached to
> them.  The IIO driver currently uses them, document them here as
> well.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> ---
>  Documentation/devicetree/bindings/iio/accel/bma180.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-05-12 22:15 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200503172206.13782-1-xc-racer2@live.ca>
2020-05-03 17:22 ` [PATCH 1/5] iio: accel: bma180: Prepare for different reset values Jonathan Bakker
2020-05-06 12:37   ` Linus Walleij
2020-05-03 17:22 ` [PATCH 2/5] input: misc: bma150: Conditionally disable bma023 support Jonathan Bakker
2020-05-06 12:46   ` Linus Walleij
2020-05-07  3:46     ` Jonathan Bakker
2020-05-07  4:23       ` Dmitry Torokhov
2020-05-08 15:57         ` Jonathan Bakker
2020-05-08 19:41           ` Linus Walleij
2020-05-03 17:22 ` [PATCH 3/5] dt-bindings: iio: accel: Add bma023 compatible to bma180 Jonathan Bakker
2020-05-06 12:49   ` Linus Walleij
2020-05-12 22:15   ` Rob Herring
2020-05-03 17:22 ` [PATCH 4/5] dt-bindings: iio: accel: Add required regulators " Jonathan Bakker
2020-05-06 12:49   ` Linus Walleij
2020-05-12 22:15   ` Rob Herring
2020-05-03 17:22 ` [PATCH 5/5] iio: accel: bma180: Add support for bma023 Jonathan Bakker
2020-05-06 12:51   ` Linus Walleij

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).