Skip to contentSkip to conversation

Add EOC handling for bmp085 + DT and platform data updates

PATCH Superseded Marek Belisko 8 participants 21 messages Nov 14, 2013 – Dec 3, 2013 7 messages not in the archive

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add EOC handling for bmp085 + DT and platform data updates

This series add support for using EOC gpio line of bmp085 to detect when conversion is finished. First patch add that functionality. Second patch add DT bindings for gpio and irq parameters. Third patch add missing platform data which are already in DT bindings to have possibility to used them on non-DT archs.

Marek Belisko (3):
misc: bmp085: Clean up and enable use of interrupt for completion.
misc: bmp085: Add DT bindings for EOC gpio line and direct irq.
misc: bmp085: Add missing platform data.

 Documentation/devicetree/bindings/misc/bmp085.txt |   8 ++
 drivers/misc/bmp085.c                             | 138 +++++++++++++++++++---
 include/linux/i2c/bmp085.h                        |  24 ++++
 3 files changed, 155 insertions(+), 15 deletions(-)
 create mode 100644 include/linux/i2c/bmp085.h
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/3 misc: bmp085: Clean up and enable use of interrupt for completion.

- pass GPIO or IRQ to driver and have it initialize the GPIO and the IRQ
- finish waiting early if interrupt fires
- clean up GPIO and IRQ on exit.

---
 drivers/misc/bmp085.c      | 68 +++++++++++++++++++++++++++++++++++++++++-----
 include/linux/i2c/bmp085.h | 17 ++++++++++++
 2 files changed, 78 insertions(+), 7 deletions(-)
 create mode 100644 include/linux/i2c/bmp085.h
drivers/misc/bmp085.c +61 -7
index 2704d88..1510a7b 100644
@@ -49,9 +49,12 @@
 #include <linux/device.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/delay.h>
 #include <linux/of.h>
 #include "bmp085.h"
+#include <linux/interrupt.h>
+#include <linux/completion.h>
+#include <linux/gpio.h>
+#include <linux/i2c/bmp085.h>
 
 #define BMP085_CHIP_ID			0x55
 #define BMP085_CALIBRATION_DATA_START	0xAA
@@ -84,8 +87,20 @@ struct bmp085_data {
 	unsigned long last_temp_measurement;
 	u8	chip_id;
 	s32	b6; /* calculated temperature correction coefficient */
+	int	irq;
+	int	gpio;
+	struct	completion done;
 };
 
+static irqreturn_t bmp085_eoc_isr(int irq, void *devid)
+{
+	struct bmp085_data *data = devid;
+
+	complete(&data->done);
+
+	return IRQ_HANDLED;
+}
+
 static s32 bmp085_read_calibration_data(struct bmp085_data *data)
 {
 	u16 tmp[BMP085_CALIBRATION_DATA_LENGTH];
@@ -116,6 +131,9 @@ static s32 bmp085_update_raw_temperature(struct bmp085_data *data)
 	s32 status;
 
 	mutex_lock(&data->lock);
+
+	init_completion(&data->done);
+
 	status = regmap_write(data->regmap, BMP085_CTRL_REG,
 			      BMP085_TEMP_MEASUREMENT);
 	if (status < 0) {
@@ -123,7 +141,8 @@ static s32 bmp085_update_raw_temperature(struct bmp085_data *data)
 			"Error while requesting temperature measurement.\n");
 		goto exit;
 	}
-	msleep(BMP085_TEMP_CONVERSION_TIME);
+	wait_for_completion_timeout(&data->done, 1 + msecs_to_jiffies(
+					    BMP085_TEMP_CONVERSION_TIME));
 
 	status = regmap_bulk_read(data->regmap, BMP085_CONVERSION_REGISTER_MSB,
 				 &tmp, sizeof(tmp));
@@ -147,6 +166,9 @@ static s32 bmp085_update_raw_pressure(struct bmp085_data *data)
 	s32 status;
 
 	mutex_lock(&data->lock);
+
+	init_completion(&data->done);
+
 	status = regmap_write(data->regmap, BMP085_CTRL_REG,
 			BMP085_PRESSURE_MEASUREMENT +
 			(data->oversampling_setting << 6));
@@ -157,8 +179,8 @@ static s32 bmp085_update_raw_pressure(struct bmp085_data *data)
 	}
 
 	/* wait for the end of conversion */
-	msleep(2+(3 << data->oversampling_setting));
-
+	wait_for_completion_timeout(&data->done, 1 + msecs_to_jiffies(
+					2+(3 << data->oversampling_setting)));
 	/* copy data into a u32 (4 bytes), but skip the first byte. */
 	status = regmap_bulk_read(data->regmap, BMP085_CONVERSION_REGISTER_MSB,
 				 ((u8 *)&tmp)+1, 3);
@@ -423,6 +445,7 @@ EXPORT_SYMBOL_GPL(bmp085_regmap_config);
 int bmp085_probe(struct device *dev, struct regmap *regmap)
 {
 	struct bmp085_data *data;
+	struct bmp085_platform_data *pdata = dev->platform_data;
 	int err = 0;
 
 	data = kzalloc(sizeof(struct bmp085_data), GFP_KERNEL);
@@ -435,26 +458,54 @@ int bmp085_probe(struct device *dev, struct regmap *regmap)
 	data->dev = dev;
 	data->regmap = regmap;
 
+	if (pdata && gpio_is_valid(pdata->gpio)) {
+		err = devm_gpio_request(dev, pdata->gpio, "bmp085_eoc_irq");
+		if (err)
+			goto exit_free;
+		err = gpio_direction_input(pdata->gpio);
+		if (err)
+			goto exit_free;
+		data->irq = gpio_to_irq(pdata->gpio);
+		data->gpio = pdata->gpio;
+	} else {
+		if (pdata)
+			data->irq = pdata->irq;
+		else
+			data->irq = 0;
+		data->gpio = -EINVAL;
+	}
+	if (data->irq > 0) {
+		err = request_any_context_irq(data->irq, bmp085_eoc_isr,
+					      IRQF_TRIGGER_RISING, "bmp085",
+					      data);
+		if (err < 0)
+			goto exit_free;
+	} else
+		data->irq = 0;
+
 	/* Initialize the BMP085 chip */
 	err = bmp085_init_client(data);
 	if (err < 0)
-		goto exit_free;
+		goto exit_free_irq;
 
 	err = bmp085_detect(dev);
 	if (err < 0) {
 		dev_err(dev, "%s: chip_id failed!\n", BMP085_NAME);
-		goto exit_free;
+		goto exit_free_irq;
 	}
 
 	/* Register sysfs hooks */
 	err = sysfs_create_group(&dev->kobj, &bmp085_attr_group);
 	if (err)
-		goto exit_free;
+		goto exit_free_irq;
 
 	dev_info(dev, "Successfully initialized %s!\n", BMP085_NAME);
 
 	return 0;
 
+exit_free_irq:
+	if (data->irq)
+		free_irq(data->irq, data);
 exit_free:
 	kfree(data);
 exit:
@@ -466,6 +517,9 @@ int bmp085_remove(struct device *dev)
 {
 	struct bmp085_data *data = dev_get_drvdata(dev);
 
+	if (data->irq)
+		free_irq(data->irq, data);
+
 	sysfs_remove_group(&data->dev->kobj, &bmp085_attr_group);
 	kfree(data);
 
include/linux/i2c/bmp085.h new file +17 -0
new file mode 100644
index 0000000..b66cb98
@@ -0,0 +1,17 @@
+#ifndef __LINUX_I2C_BMP085_H
+#define __LINUX_I2C_BMP085_H
+
+/* linux/i2c/bmp085.h */
+
+/*
+ * bmp085 platform data
+ * @gpio: if is set it is the End Of Conversion line which is high when
+ * conversion is finished
+ * @irq: if gpio < 0 and irq > 0, then it is an interrupt with no gpio
+ */
+struct bmp085_platform_data {
+	int	gpio;
+	int	irq;
+};
+
+#endif
Signature · 6 lines
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH 2/3 misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

In reply to Marek Belisko
---
 Documentation/devicetree/bindings/misc/bmp085.txt |  8 ++++
 drivers/misc/bmp085.c                             | 53 ++++++++++++++++++++---
 2 files changed, 55 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/misc/bmp085.txt +8 -0
index 91dfda2..c6033d5 100644
@@ -8,6 +8,9 @@ Optional properties:
 - temp-measurement-period: temperature measurement period (milliseconds)
 - default-oversampling: default oversampling value to be used at startup,
   value range is 0-3 with rising sensitivity.
+- gpio: if device is using EOC irq line gpio can be specified to setup interrupt
+  handling
+- irq: interrupt with no gpio
 
 Example:
 
@@ -17,4 +20,9 @@ pressure@77 {
 	chip-id = <10>;
 	temp-measurement-period = <100>;
 	default-oversampling = <2>;
+	gpio = <&gpio0 17 0>;
+
+	OR
+
+	irq = <75>;
 };
drivers/misc/bmp085.c +47 -6

104 lines not on this page · raw message

Signature · 6 lines
1.8.1.2

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#3 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

drivers/misc/bmp085.c static int bmp085_init_client(struct bmp085_data *data) · line 447

Quoted 7 lines · Marek Belisko
drivers/misc/bmp085.c +7 -0
+       if (node && !pdata) {
+               pdata = devm_kzalloc(dev, sizeof(struct bmp085_platform_data),
+                                       GFP_KERNEL);
+               if (!pdata)
+                       return -ENOMEM;
+       }
+

I generally recommend against allocating platform data from inside the driver, as this requires more code and more memory than just adding fields to the driver-specific data structure and copying over the fields from either DT or the supplied platform data, depending on which one is used.

Arnd

#4 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

In reply to Marek Belisko
Quoted 21 lines · Marek Belisko
---
 Documentation/devicetree/bindings/misc/bmp085.txt |  8 ++++
 drivers/misc/bmp085.c                             | 53 ++++++++++++++++++++---
 2 files changed, 55 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/misc/bmp085.txt +3 -0
index 91dfda2..c6033d5 100644
@@ -8,6 +8,9 @@ Optional properties:
 - temp-measurement-period: temperature measurement period (milliseconds)
 - default-oversampling: default oversampling value to be used at startup,
   value range is 0-3 with rising sensitivity.
+- gpio: if device is using EOC irq line gpio can be specified to setup interrupt
+  handling
+- irq: interrupt with no gpio
 
 Example:
 

Documentation/devicetree/bindings/misc/bmp085.txt pressure@77 { · line 27

Quoted 8 lines
Documentation/devicetree/bindings/misc/bmp085.txt +5 -0
@@ -17,4 +20,9 @@ pressure@77 {
 	chip-id = <10>;
 	temp-measurement-period = <100>;
 	default-oversampling = <2>;
+	gpio = <&gpio0 17 0>;
+
+	OR
+
+	irq = <75>;

There's some contention over the description of gpio-based IRQs in DT.

Quoted 1 line

From the point of view of the device there is a logical IRQ output; the

fact that this happens to be wired up to a GPIO pin that can happen to generate interrupts isn't anything to do with the device itself. There are plenty of device we have now whose interrupt lines could be wired to GPIOs. I see no reason to extend their bindings to support explicit GPIOs for IRQs, and I see no reason the driver should have to handle this.

It would be far nicer for the device binding to just have the interrupts property, and for the gpio controller to act as an interrupt-controller, with the appropriate pin management.

Thanks,
Mark.

maintainer
#5 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

Quoted 9 lines · Mark Rutland

There's some contention over the description of gpio-based IRQs in DT. From the point of view of the device there is a logical IRQ output; the fact that this happens to be wired up to a GPIO pin that can happen to generate interrupts isn't anything to do with the device itself. There are plenty of device we have now whose interrupt lines could be wired to GPIOs. I see no reason to extend their bindings to support explicit GPIOs for IRQs, and I see no reason the driver should have to handle this.

Quoted 3 lines

It would be far nicer for the device binding to just have the interrupts property, and for the gpio controller to act as an interrupt-controller, with the appropriate pin management.

Yes, agreed. I missed this point in my review: the GPIO is used only as an interrupt pin here, so there is no reason to know the GPIO number.

Arnd

#6 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

In reply to Mark Rutland

Hi Mark,

Quoted 40 lines · Mark Rutland
Quoted 21 lines · Marek Belisko
---
 Documentation/devicetree/bindings/misc/bmp085.txt |  8 ++++
 drivers/misc/bmp085.c                             | 53 ++++++++++++++++++++---
 2 files changed, 55 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/misc/bmp085.txt +3 -0
index 91dfda2..c6033d5 100644
@@ -8,6 +8,9 @@ Optional properties:
 - temp-measurement-period: temperature measurement period (milliseconds)
 - default-oversampling: default oversampling value to be used at startup,
   value range is 0-3 with rising sensitivity.
+- gpio: if device is using EOC irq line gpio can be specified to setup interrupt
+  handling
+- irq: interrupt with no gpio
 
 Example:
 

Documentation/devicetree/bindings/misc/bmp085.txt pressure@77 { · line 27

Quoted 8 lines
Documentation/devicetree/bindings/misc/bmp085.txt +5 -0
@@ -17,4 +20,9 @@ pressure@77 {
      chip-id = <10>;
      temp-measurement-period = <100>;
      default-oversampling = <2>;
+     gpio = <&gpio0 17 0>;
+
+     OR
+
+     irq = <75>;

There's some contention over the description of gpio-based IRQs in DT. From the point of view of the device there is a logical IRQ output; the fact that this happens to be wired up to a GPIO pin that can happen to generate interrupts isn't anything to do with the device itself. There are plenty of device we have now whose interrupt lines could be wired to GPIOs. I see no reason to extend their bindings to support explicit GPIOs for IRQs, and I see no reason the driver should have to handle this.

Quoted 3 lines

It would be far nicer for the device binding to just have the interrupts property, and for the gpio controller to act as an interrupt-controller, with the appropriate pin management.

OK. Can you please give me some example in current bindings tree? Something like in:
Documentation/devicetree/bindings/fb/mxsfb.txt ? So if I understand correctly we define only property
interrupts = <xxx> which will be exact interrupt number for cpu gpio connected to bmp085 irq line.

Quoted 3 lines

Thanks,
Mark.

Thanks,

marek

Signature · 10 lines
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com
maintainer
#7 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

Quoted 10 lines · Belisko Marek
Quoted 3 lines

It would be far nicer for the device binding to just have the interrupts property, and for the gpio controller to act as an interrupt-controller, with the appropriate pin management.

OK. Can you please give me some example in current bindings tree? Something like in:
Documentation/devicetree/bindings/fb/mxsfb.txt ? So if I understand correctly we define only property
interrupts = <xxx> which will be exact interrupt number for cpu gpio connected to bmp085 irq line.

Quoted 1 line

See Documentation/devicetree/bindings/gpio/8xxx_gpio.txt for an example of a device whose interrupt line is connected to a gpio controller. The key here is to set the "interrupt-parent" to the gpio node and have the irq specifier define an interrupt local to that node.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

[ trimmed Cc: list for DT ]
[ is the bindings/gpio/8xxx_gpio.txt document incomplete? ]

Quoted 6 lines · Arnd Bergmann

See Documentation/devicetree/bindings/gpio/8xxx_gpio.txt for an example of a device whose interrupt line is connected to a gpio controller. The key here is to set the "interrupt-parent" to the gpio node and have the irq specifier define an interrupt local to that node.

I was wondering whether the gpio-controller nodes lack both the 'interrupt-controller' boolean flag as well as the '#interrupt-cells = <2>' property. The former may be optional, I'm not certain there. But the latter should be a hard requirement without which the 'funkyfpga' references cannot get parsed I'm afraid.

Am I missing something? Did I get the names right? Shall I send a patch? Is the code working without those specs since it assumes knowledge that was not specified in the device tree? And would this be against the idea that the binding should be "complete" and independent of who is interpreting the data? Or is the binding document just incomplete?

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20131118171747.GM17929-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org

#11 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

Quoted 11 lines · Gerhard Sittig

[ trimmed Cc: list for DT ]
[ is the bindings/gpio/8xxx_gpio.txt document incomplete? ]

Quoted 6 lines · Arnd Bergmann

See Documentation/devicetree/bindings/gpio/8xxx_gpio.txt for an example of a device whose interrupt line is connected to a gpio controller. The key here is to set the "interrupt-parent" to the gpio node and have the irq specifier define an interrupt local to that node.

Quoted 6 lines

I was wondering whether the gpio-controller nodes lack both the 'interrupt-controller' boolean flag as well as the '#interrupt-cells = <2>' property. The former may be optional, I'm not certain there. But the latter should be a hard requirement without which the 'funkyfpga' references cannot get parsed I'm afraid.

You are absolutely right, I picked an example that was actually wrong.

Quoted 6 lines

Am I missing something? Did I get the names right? Shall I send a patch? Is the code working without those specs since it assumes knowledge that was not specified in the device tree? And would this be against the idea that the binding should be "complete" and independent of who is interpreting the data? Or is the binding document just incomplete?

I think the problem is that this particular controller is never used in "interrupts" properties, so nobody noticed the mistake. It probably still works for gpio references and drivers using gpio_to_irq on those numbers. It would be nice if you can send a patch to add those as optional properties to the binding and the example. We can't really make them mandatory properties now because that would make all existing dts files with this controller invalid.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

PATCH 1/1 dt: binding: reword PowerPC 8xxx GPIO documentation

re-format and re-word the device tree binding documentation for MPC8xxx and compatibles, reference the common document for interrupt controllers and remove outdated duplicate SoC specific information

Cc Mark Rutland <[email protected]>
Cc Rob Herring@ <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Arnd Bergmann <[email protected]>

---

This change should improve the "flow" of the 8xxx GPIO binding document, starting with an overview, then discussing specific properties, and then collecting examples at the end. Re-formatting should improve readability of enumerations.

I was not certain whether the kinds of changes to the document warrant a split into several patches, separating whitespace/reformatting and the content update. For the moment I went with a single patch to not overcomplicate matters.

Putting the interrupt-parent before the interrupts specifiers is a thing of personal taste -- I'm a fan of hierarchy, finding the specific detail first and then the addendum "oh, by the way, it's that other parent" keeps confusing me as much as top-posting in email does. :)

Feel free to tell me when I got terminology wrong. This is the only real issue that may remain after this change IMO.

 .../devicetree/bindings/gpio/8xxx_gpio.txt         |   59 ++++++++++++--------
 1 file changed, 35 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +35 -24
index b0019eb5330e..7788e8df3a15 100644
@@ -5,16 +5,41 @@ This is for the non-QE/CPM/GUTs GPIO controllers as found on
 
 Every GPIO controller node must have #gpio-cells property defined,
 this information will be used to translate gpio-specifiers.
+See bindings/gpio/gpio.txt for details of how to specify GPIO
+information for devices.
+
+The GPIO module usually is connected to the SoC's internal interrupt
+controller, see bindings/interrupt-controller/interrupts.txt (the
+interrupt client nodes section) for details how to specify this GPIO
+module's interrupt.
+
+The GPIO module may serve as another interrupt controller (cascaded to
+the SoC's internal interrupt controller).  See the interrupt controller
+nodes section in bindings/interrupt-controller/interrupts.txt for
+details.
 
 Required properties:
-- compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for
-  83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx.
-- #gpio-cells : Should be two. The first cell is the pin number and the
-  second cell is used to specify optional parameters (currently unused).
- - interrupts : Interrupt mapping for GPIO IRQ.
- - interrupt-parent : Phandle for the interrupt controller that
-   services interrupts for this device.
-- gpio-controller : Marks the port as GPIO controller.
+- compatible:		"fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio"
+			for 83xx, "fsl,mpc8572-gpio" for 85xx and
+			"fsl,mpc8610-gpio" for 86xx.
+- #gpio-cells:		Should be two. The first cell is the pin number
+			and the second cell is used to specify optional
+			parameters (currently unused).
+- interrupt-parent:	Phandle for the interrupt controller that
+			services interrupts for this device.
+- interrupts:		Interrupt mapping for GPIO IRQ.
+- gpio-controller:	Marks the port as GPIO controller.
+
+Optional properties:
+- interrupt-controller:	Empty boolean property which marks the GPIO
+			module as an IRQ controller.
+- #interrupt-cells:	Number of integer cells required to specify an
+			interrupt within this interrupt controller.  The
+			first cell defines the pin number, the second
+			cell defines additional flags (trigger type,
+			trigger polarity).  Note that the specific set
+			of trigger conditions supported by the GPIO
+			module depends on the actual SoC.
 
 Example of gpio-controller nodes for a MPC8347 SoC:
 
@@ -36,25 +61,11 @@ Example of gpio-controller nodes for a MPC8347 SoC:
 		gpio-controller;
 	};
 
-See booting-without-of.txt for details of how to specify GPIO
-information for devices.
-
-To use GPIO pins as interrupt sources for peripherals, specify the
-GPIO controller as the interrupt parent and define GPIO number +
-trigger mode using the interrupts property, which is defined like
-this:
-
-interrupts = <number trigger>, where:
- - number: GPIO pin (0..31)
- - trigger: trigger mode:
-	2 = trigger on falling edge
-	3 = trigger on both edges
-
-Example of device using this is:
+Example of a peripheral using the GPIO module as an IRQ controller:
 
 	funkyfpga@0 {
 		compatible = "funky-fpga";
 		...
-		interrupts = <4 3>;
 		interrupt-parent = <&gpio1>;
+		interrupts = <4 3>;
 	};
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1384983293-11002-1-git-send-email-gsi-ynQEQJNshbs@public.gmane.org

#15 lore raw

Re: [PATCH v1 1/1] dt: binding: reword PowerPC 8xxx GPIO documentation

Quoted 54 lines · Gerhard Sittig

re-format and re-word the device tree binding documentation for MPC8xxx and compatibles, reference the common document for interrupt controllers and remove outdated duplicate SoC specific information

Cc Mark Rutland <[email protected]>
Cc Rob Herring@ <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Arnd Bergmann <[email protected]>

---

This change should improve the "flow" of the 8xxx GPIO binding document, starting with an overview, then discussing specific properties, and then collecting examples at the end. Re-formatting should improve readability of enumerations.

I was not certain whether the kinds of changes to the document warrant a split into several patches, separating whitespace/reformatting and the content update. For the moment I went with a single patch to not overcomplicate matters.

Putting the interrupt-parent before the interrupts specifiers is a thing of personal taste -- I'm a fan of hierarchy, finding the specific detail first and then the addendum "oh, by the way, it's that other parent" keeps confusing me as much as top-posting in email does. :)

Feel free to tell me when I got terminology wrong. This is the only real issue that may remain after this change IMO.

 .../devicetree/bindings/gpio/8xxx_gpio.txt         |   59 ++++++++++++--------
 1 file changed, 35 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +12 -0
index b0019eb5330e..7788e8df3a15 100644
@@ -5,16 +5,41 @@ This is for the non-QE/CPM/GUTs GPIO controllers as found on
 
 Every GPIO controller node must have #gpio-cells property defined,
 this information will be used to translate gpio-specifiers.
+See bindings/gpio/gpio.txt for details of how to specify GPIO
+information for devices.
+
+The GPIO module usually is connected to the SoC's internal interrupt
+controller, see bindings/interrupt-controller/interrupts.txt (the
+interrupt client nodes section) for details how to specify this GPIO
+module's interrupt.
+
+The GPIO module may serve as another interrupt controller (cascaded to
+the SoC's internal interrupt controller).  See the interrupt controller
+nodes section in bindings/interrupt-controller/interrupts.txt for
+details.
 

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 22

Quoted 10 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +1 -8
 Required properties:
-- compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for
-  83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx.
-- #gpio-cells : Should be two. The first cell is the pin number and the
-  second cell is used to specify optional parameters (currently unused).
- - interrupts : Interrupt mapping for GPIO IRQ.
- - interrupt-parent : Phandle for the interrupt controller that
-   services interrupts for this device.
-- gpio-controller : Marks the port as GPIO controller.
+- compatible:          "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio"

Can you use <chip> here. Only because I'm developing some documentation checking scripts and handle that already.

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 23

Quoted 1 line
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +1 -0
+                       for 83xx, "fsl,mpc8572-gpio" for 85xx and

s/and/or/

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 36

Quoted 13 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +13 -0
+                       "fsl,mpc8610-gpio" for 86xx.
+- #gpio-cells:         Should be two. The first cell is the pin number
+                       and the second cell is used to specify optional
+                       parameters (currently unused).
+- interrupt-parent:    Phandle for the interrupt controller that
+                       services interrupts for this device.
+- interrupts:          Interrupt mapping for GPIO IRQ.
+- gpio-controller:     Marks the port as GPIO controller.
+
+Optional properties:
+- interrupt-controller:        Empty boolean property which marks the GPIO
+                       module as an IRQ controller.
+- #interrupt-cells:    Number of integer cells required to specify an

Should start with "Should be two."

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 42

Quoted 6 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +6 -0
+                       interrupt within this interrupt controller.  The
+                       first cell defines the pin number, the second
+                       cell defines additional flags (trigger type,
+                       trigger polarity).  Note that the specific set
+                       of trigger conditions supported by the GPIO
+                       module depends on the actual SoC.

You mean what values are supported vary, not the meaning of the values right?

Quoted 33 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +2 -17
 Example of gpio-controller nodes for a MPC8347 SoC:
 
@@ -36,25 +61,11 @@ Example of gpio-controller nodes for a MPC8347 SoC:
                gpio-controller;
        };
 
-See booting-without-of.txt for details of how to specify GPIO
-information for devices.
-
-To use GPIO pins as interrupt sources for peripherals, specify the
-GPIO controller as the interrupt parent and define GPIO number +
-trigger mode using the interrupts property, which is defined like
-this:
-
-interrupts = <number trigger>, where:
- - number: GPIO pin (0..31)
- - trigger: trigger mode:
-       2 = trigger on falling edge
-       3 = trigger on both edges
-
-Example of device using this is:
+Example of a peripheral using the GPIO module as an IRQ controller:
 
        funkyfpga@0 {
                compatible = "funky-fpga";
...
-               interrupts = <4 3>;
                interrupt-parent = <&gpio1>;
+               interrupts = <4 3>;
        };
--

1.7.10.4

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAL_JsqJvxA240QEreWPp2L+eNFQmhp0XV=qmO4QXqTga+RFuCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#17 lore raw

Re: [PATCH v1 1/1] dt: binding: reword PowerPC 8xxx GPIO documentation

Quoted 16 lines · Rob Herring
Quoted 14 lines · Gerhard Sittig

re-format and re-word the device tree binding documentation for MPC8xxx and compatibles, reference the common document for interrupt controllers and remove outdated duplicate SoC specific information

[ ... ]

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +0 -0
index b0019eb5330e..7788e8df3a15 100644
@@ -5,16 +5,41 @@ This is for the non-QE/CPM/GUTs GPIO controllers as found on
 
[ ... ]
Quoted 13 lines

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 22

Quoted 10 lines

Required properties:
-- compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +1 -7
-  83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx.
-- #gpio-cells : Should be two. The first cell is the pin number and the
-  second cell is used to specify optional parameters (currently unused).
- - interrupts : Interrupt mapping for GPIO IRQ.
- - interrupt-parent : Phandle for the interrupt controller that
-   services interrupts for this device.
-- gpio-controller : Marks the port as GPIO controller.
+- compatible:          "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio"

Can you use <chip> here. Only because I'm developing some documentation checking scripts and handle that already.

will do

Quoted 4 lines
Quoted 2 lines

+ for 83xx, "fsl,mpc8572-gpio" for 85xx and

s/and/or/

will do

Quoted 16 lines
Quoted 4 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +3 -0
+                       "fsl,mpc8610-gpio" for 86xx.
+- #gpio-cells:         Should be two. The first cell is the pin number
+                       and the second cell is used to specify optional

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 36

Quoted 10 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +10 -0
+                       parameters (currently unused).
+- interrupt-parent:    Phandle for the interrupt controller that
+                       services interrupts for this device.
+- interrupts:          Interrupt mapping for GPIO IRQ.
+- gpio-controller:     Marks the port as GPIO controller.
+
+Optional properties:
+- interrupt-controller:        Empty boolean property which marks the GPIO
+                       module as an IRQ controller.
+- #interrupt-cells:    Number of integer cells required to specify an

Should start with "Should be two."

will do

Quoted 9 lines

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 42

Quoted 7 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +6 -0
+                       interrupt within this interrupt controller.  The
+                       first cell defines the pin number, the second
+                       cell defines additional flags (trigger type,
+                       trigger polarity).  Note that the specific set
+                       of trigger conditions supported by the GPIO
+                       module depends on the actual SoC.

You mean what values are supported vary, not the meaning of the values right?

yes, encoding of trigger conditions is specified in the common document and the values remain the same, but the set of possible values which apply to a SoC are individual

thank you for the feedback

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Acked-by
#18 lore raw

Re: [PATCH v1 1/1] dt: binding: reword PowerPC 8xxx GPIO documentation

In reply to a message not in the archive
Quoted 10 lines · Gerhard Sittig

re-format and re-word the device tree binding documentation for MPC8xxx and compatibles, reference the common document for interrupt controllers and remove outdated duplicate SoC specific information

Cc Mark Rutland <[email protected]>
Cc Rob Herring@ <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Arnd Bergmann <[email protected]>

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 42

Quoted 10 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +10 -0
+Optional properties:
+- interrupt-controller:	Empty boolean property which marks the GPIO
+			module as an IRQ controller.
+- #interrupt-cells:	Number of integer cells required to specify an
+			interrupt within this interrupt controller.  The
+			first cell defines the pin number, the second
+			cell defines additional flags (trigger type,
+			trigger polarity).  Note that the specific set
+			of trigger conditions supported by the GPIO
+			module depends on the actual SoC.

Nitpicking: I think you need to add that #interrupt-cells must be <2> if present. I'd also suggest adding these two to the example section of the binding while you're at it.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#20 lore raw

Re: [PATCH v1 1/1] dt: binding: reword PowerPC 8xxx GPIO documentation

Quoted 6 lines · Arnd Bergmann
Quoted 4 lines · Gerhard Sittig

re-format and re-word the device tree binding documentation for MPC8xxx and compatibles, reference the common document for interrupt controllers and remove outdated duplicate SoC specific information

Quoted 8 lines
Quoted 6 lines
Cc Mark Rutland <[email protected]>
Cc Rob Herring@ <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Arnd Bergmann <[email protected]>

thank you for the feedback and for the ACK

Quoted 6 lines
Quoted 6 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +6 -0
+Optional properties:
+- interrupt-controller:	Empty boolean property which marks the GPIO
+			module as an IRQ controller.
+- #interrupt-cells:	Number of integer cells required to specify an
+			interrupt within this interrupt controller.  The
+			first cell defines the pin number, the second
Quoted 8 lines

Documentation/devicetree/bindings/gpio/8xxx_gpio.txt This is for the non-QE/CPM/GUTs GPIO controllers as found on · line 42

Quoted 4 lines
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +4 -0
+			cell defines additional flags (trigger type,
+			trigger polarity).  Note that the specific set
+			of trigger conditions supported by the GPIO
+			module depends on the actual SoC.

Nitpicking: I think you need to add that #interrupt-cells must be <2> if present. I'd also suggest adding these two to the example section of the binding while you're at it.

will do

and I assume that your ACK still applies after I have addressed the feedback from you and from Rob

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#21 lore raw

PATCH v2 1/1 dt: binding: reword PowerPC 8xxx GPIO documentation

In reply to a message not in the archive

re-format and re-word the device tree binding documentation for MPC8xxx and compatibles, reference the common document for interrupt controllers and remove outdated duplicate SoC specific information

Cc Mark Rutland <[email protected]>
Cc Rob Herring@ <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Arnd Bergmann <[email protected]>

---

changes in v2:
- s/CHIP/chip/ in 'compatible', s/and/or/ for the list of strings to use in 'compatible'
- "should be two" and "s/specific/available/ set of trigger conditions" in '#interrupt-cells'
- IRQ controller properties added to the 'gpio1' example node as it is referenced as one from 'funkyfpga'

---
 .../devicetree/bindings/gpio/8xxx_gpio.txt         |   66 ++++++++++++--------
 1 file changed, 40 insertions(+), 26 deletions(-)
Documentation/devicetree/bindings/gpio/8xxx_gpio.txt +40 -26
index b0019eb5330e..798cfc9d3839 100644
@@ -5,16 +5,42 @@ This is for the non-QE/CPM/GUTs GPIO controllers as found on
 
 Every GPIO controller node must have #gpio-cells property defined,
 this information will be used to translate gpio-specifiers.
+See bindings/gpio/gpio.txt for details of how to specify GPIO
+information for devices.
+
+The GPIO module usually is connected to the SoC's internal interrupt
+controller, see bindings/interrupt-controller/interrupts.txt (the
+interrupt client nodes section) for details how to specify this GPIO
+module's interrupt.
+
+The GPIO module may serve as another interrupt controller (cascaded to
+the SoC's internal interrupt controller).  See the interrupt controller
+nodes section in bindings/interrupt-controller/interrupts.txt for
+details.
 
 Required properties:
-- compatible : "fsl,<CHIP>-gpio" followed by "fsl,mpc8349-gpio" for
-  83xx, "fsl,mpc8572-gpio" for 85xx and "fsl,mpc8610-gpio" for 86xx.
-- #gpio-cells : Should be two. The first cell is the pin number and the
-  second cell is used to specify optional parameters (currently unused).
- - interrupts : Interrupt mapping for GPIO IRQ.
- - interrupt-parent : Phandle for the interrupt controller that
-   services interrupts for this device.
-- gpio-controller : Marks the port as GPIO controller.
+- compatible:		"fsl,<chip>-gpio" followed by "fsl,mpc8349-gpio"
+			for 83xx, "fsl,mpc8572-gpio" for 85xx, or
+			"fsl,mpc8610-gpio" for 86xx.
+- #gpio-cells:		Should be two. The first cell is the pin number
+			and the second cell is used to specify optional
+			parameters (currently unused).
+- interrupt-parent:	Phandle for the interrupt controller that
+			services interrupts for this device.
+- interrupts:		Interrupt mapping for GPIO IRQ.
+- gpio-controller:	Marks the port as GPIO controller.
+
+Optional properties:
+- interrupt-controller:	Empty boolean property which marks the GPIO
+			module as an IRQ controller.
+- #interrupt-cells:	Should be two.  Defines the number of integer
+			cells required to specify an interrupt within
+			this interrupt controller.  The first cell
+			defines the pin number, the second cell
+			defines additional flags (trigger type,
+			trigger polarity).  Note that the available
+			set of trigger conditions supported by the
+			GPIO module depends on the actual SoC.
 
 Example of gpio-controller nodes for a MPC8347 SoC:
 
@@ -22,39 +48,27 @@ Example of gpio-controller nodes for a MPC8347 SoC:
 		#gpio-cells = <2>;
 		compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio";
 		reg = <0xc00 0x100>;
-		interrupts = <74 0x8>;
 		interrupt-parent = <&ipic>;
+		interrupts = <74 0x8>;
 		gpio-controller;
+		interrupt-controller;
+		#interrupt-cells = <2>;
 	};
 
 	gpio2: gpio-controller@d00 {
 		#gpio-cells = <2>;
 		compatible = "fsl,mpc8347-gpio", "fsl,mpc8349-gpio";
 		reg = <0xd00 0x100>;
-		interrupts = <75 0x8>;
 		interrupt-parent = <&ipic>;
+		interrupts = <75 0x8>;
 		gpio-controller;
 	};
 
-See booting-without-of.txt for details of how to specify GPIO
-information for devices.
-
-To use GPIO pins as interrupt sources for peripherals, specify the
-GPIO controller as the interrupt parent and define GPIO number +
-trigger mode using the interrupts property, which is defined like
-this:
-
-interrupts = <number trigger>, where:
- - number: GPIO pin (0..31)
- - trigger: trigger mode:
-	2 = trigger on falling edge
-	3 = trigger on both edges
-
-Example of device using this is:
+Example of a peripheral using the GPIO module as an IRQ controller:
 
 	funkyfpga@0 {
 		compatible = "funky-fpga";
 		...
-		interrupts = <4 3>;
 		interrupt-parent = <&gpio1>;
+		interrupts = <4 3>;
 	};
Signature · 6 lines
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1385023304-15396-1-git-send-email-gsi-ynQEQJNshbs@public.gmane.org

#23 lore raw

Re: [PATCH v2 1/1] dt: binding: reword PowerPC 8xxx GPIO documentation

Quoted 20 lines · Gerhard Sittig

re-format and re-word the device tree binding documentation for MPC8xxx and compatibles, reference the common document for interrupt controllers and remove outdated duplicate SoC specific information

Cc Mark Rutland <[email protected]>
Cc Rob Herring@ <rob.herring-bsGFqQB8/[email protected]>
Cc Pawel Moll <[email protected]>
Cc Arnd Bergmann <[email protected]>

---

changes in v2:
- s/CHIP/chip/ in 'compatible', s/and/or/ for the list of strings to use in 'compatible'
- "should be two" and "s/specific/available/ set of trigger conditions" in '#interrupt-cells'
- IRQ controller properties added to the 'gpio1' example node as it is referenced as one from 'funkyfpga'

Quoted 3 lines
---
 .../devicetree/bindings/gpio/8xxx_gpio.txt         |   66 ++++++++++++--------
 1 file changed, 40 insertions(+), 26 deletions(-)

Applied for 3.13.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#24 lore raw

Re: [PATCH 2/3] misc: bmp085: Add DT bindings for EOC gpio line and direct irq.

In reply to a message not in the archive
Quoted 6 lines · Arnd Bergmann

[ ... incomplete 8xxx gpio binding document ... ]

You are absolutely right, I picked an example that was actually wrong.

Quoted 6 lines

[ ... ]

I think the problem is that this particular controller is never used in "interrupts" properties, so nobody noticed the mistake. It probably still works for gpio references and drivers using gpio_to_irq on those numbers.

Actually that very GPIO module _is_ being used as an IRQ controller as well. The MPC5121 is one of those (not explicitly listed) compatibles. The mpc5121.dtsi correctly declares the GPIO module as both a GPIO as well as an IRQ controller, and the ac14xx.dts board does use GPIO lines as IRQs.

Which suggests that the issue is just incomplete documentation. And that an incomplete binding document does not prevent correct use of the binding. :) And more importantly that the use of DT is so intuitive that people get things right without looking at the docs. :-]

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#25 lore raw

PATCH 3/3 misc: bmp085: Add missing platform data.

In reply to Marek Belisko

DT bindings contains more parameters to set so add them to platform data also to have possibility to use on arch where DT isn't available yet.

---
 drivers/misc/bmp085.c      | 21 +++++++++++++++++----
 include/linux/i2c/bmp085.h |  7 +++++++
 2 files changed, 24 insertions(+), 4 deletions(-)
drivers/misc/bmp085.c +17 -4
index 9792ce2..530b4a1 100644
@@ -408,13 +408,15 @@ static void bmp085_get_of_properties(struct bmp085_data *data,
 		return;
 
 	if (!of_property_read_u32(np, "chip-id", &prop))
-		data->chip_id = prop & 0xff;
+		pdata->chip_id = prop & 0xff;
 
 	if (!of_property_read_u32(np, "temp-measurement-period", &prop))
-		data->temp_measurement_period = (prop/100)*HZ;
+		pdata->temp_measurement_period = (prop/100)*HZ;
 
 	if (!of_property_read_u32(np, "default-oversampling", &prop))
-		data->oversampling_setting = prop & 0xff;
+		pdata->default_oversampling = prop & 0xff;
+	else
+		pdata->default_oversampling = -1;
 
 	pdata->gpio = of_get_named_gpio(np, "gpio", 0);
 	of_property_read_u32(np, "irq", &pdata->irq);
@@ -443,9 +445,20 @@ static int bmp085_init_client(struct device *dev, struct bmp085_data *data)
 					GFP_KERNEL);
 		if (!pdata)
 			return -ENOMEM;
+
+		bmp085_get_of_properties(data, pdata);
 	}
 
-	bmp085_get_of_properties(data, pdata);
+	if (pdata->chip_id)
+		data->chip_id = pdata->chip_id;
+
+	if (pdata->temp_measurement_period > 0)
+		data->temp_measurement_period =
+			(pdata->temp_measurement_period/100)*HZ;
+
+	if (pdata->default_oversampling >= 0 &&
+		pdata->default_oversampling <= 3)
+		data->oversampling_setting = pdata->default_oversampling;
 
 	if (gpio_is_valid(pdata->gpio)) {
 		err = devm_gpio_request(dev, pdata->gpio, "bmp085_eoc_irq");
include/linux/i2c/bmp085.h +7 -0
index b66cb98..addb972 100644
@@ -5,11 +5,18 @@
 
 /*
  * bmp085 platform data
+ * @chip_id: configurable chip id for non-default chip revisions
+ * @temp_measurement_period: in milliseconds
+ * @default_oversampling: used at startup, range is 0-3 with rising sensitivity
+ * set it to -1 when don't want to change default value (3)
  * @gpio: if is set it is the End Of Conversion line which is high when
  * conversion is finished
  * @irq: if gpio < 0 and irq > 0, then it is an interrupt with no gpio
  */
 struct bmp085_platform_data {
+	int	chip_id;
+	int	temp_measurement_period;
+	int	default_oversampling;
 	int	gpio;
 	int	irq;
 };
Signature · 1 line
1.8.1.2
maintainer
#26 lore raw

Re: [PATCH 3/3] misc: bmp085: Add missing platform data.

Quoted 4 lines · Marek Belisko

DT bindings contains more parameters to set so add them to platform data also to have possibility to use on arch where DT isn't available yet.

Can you give an example of a platform that uses this chip and cannot yet use DT in the mainline kernel?
If it's only for out-of-tree platforms, I'd prefer to leave this patch out of tree as well and put the burden on whoever maintains a non-DT platform in a private kernel.

include/linux/i2c/bmp085.h

Quoted 4 lines
include/linux/i2c/bmp085.h +0 -0
index b66cb98..addb972 100644

Shouldn't this be in include/linux/platform_data?

Arnd

#27 lore raw

Re: [PATCH 3/3] misc: bmp085: Add missing platform data.

Am 15.11.2013 um 14:58 schrieb Arnd Bergmann:

Quoted 8 lines · Marek Belisko
Quoted 4 lines

DT bindings contains more parameters to set so add them to platform data also to have possibility to use on arch where DT isn't available yet.

Can you give an example of a platform that uses this chip and cannot yet use DT in the mainline kernel?

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/omap3-gta04.dts

exists but is far from being complete, because the transition to DT is really complex.

We still need some (private) board file for 3.13 and hope to have everything ready for 3.14. But that depends on speed of acceptance of other drivers because all DT things are still constantly moving.

So we will have to mix DT+board file for a while.

Quoted 5 lines

If it's only for out-of-tree platforms, I'd prefer to leave this patch out of tree as well and put the burden on whoever maintains a non-DT platform in a private kernel.

Quoted 8 lines

include/linux/i2c/bmp085.h

Quoted 4 lines
include/linux/i2c/bmp085.h +0 -0
index b66cb98..addb972 100644

Shouldn't this be in include/linux/platform_data?

Arnd

-- hns