diff mbox

[PATCHv2] Device tree binding for Avago APDS990X light sensor

Message ID 20180102124450.GA18659@amd (mailing list archive)
State New, archived
Headers show

Commit Message

Pavel Machek Jan. 2, 2018, 12:44 p.m. UTC
From: Filip Matijević <filip.matijevic.pz@gmail.com>

This prepares binding for light sensor used in Nokia N9.

Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>

Comments

Rob Herring Jan. 5, 2018, 4:01 p.m. UTC | #1
On Tue, Jan 02, 2018 at 01:44:51PM +0100, Pavel Machek wrote:
> From: Filip Matijević <filip.matijevic.pz@gmail.com>
> 
> This prepares binding for light sensor used in Nokia N9.

"dt-bindings: ..." is the preferred subject prefix.

> 
> Signed-off-by: Filip Matijević <filip.matijevic.pz@gmail.com>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
> 
> diff --git a/Documentation/devicetree/bindings/misc/avago-apds990x.txt b/Documentation/devicetree/bindings/misc/avago-apds990x.txt
> new file mode 100644
> index 0000000..480c0b1
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/misc/avago-apds990x.txt

Put this with other light sensors whether you use IIO or not:

bindings/iio/light/

> @@ -0,0 +1,41 @@
> +Avago APDS990X driver

Bindings aren't drivers.

> +
> +https://docs.broadcom.com/docs/AV02-2867EN
> +
> +Required properties:
> +- compatible: "avago,apds990x"
> +- reg: address on the I2C bus
> +- interrupts: external interrupt line number
> +- vdd-supply: power supply for VDD
> +- vled-supply: power supply for LEDA
> +- avago,ga: Glass attenuation

We already have "upisemi,glass-coef". Can we align on something common.

> +- avago,cf1: Clear channel factor 1
> +- avago,irf1: IR channel factor 1
> +- avago,cf2: Clear channel factor 2
> +- avago,irf2: IR channel factor 2

Perhaps 2 properties with 2 cells for factor 1 and 2.

> +- avago,df: Device factor

Units/range for all these?

> +- avago,pdrive: IR current, one of APDS_IRLED_CURR_XXXmA values

Don't we have standard current property for LEDs?

> +- avago,ppcount: Proximity pulse count

Is this standard for prox sensors?

> +
> +Example (Nokia N9):
> +
> +	als_ps@39 {

light-sensor@39

> +		compatible = "avago,apds990x";
> +		reg = <0x39>;
> +
> +		interrupt-parent = <&gpio3>;
> +		interrupts = <19 (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW)>; /* gpio_83 */
> +
> +		vdd-supply = <&vaux1>;
> +		vled-supply = <&vbat>;
> +
> +		avago,ga	= <168834>;
> +		avago,cf1	= <4096>;
> +		avago,irf1	= <7824>;
> +		avago,cf2	= <877>;
> +		avago,irf2	= <1575>;
> +		avago,df	= <52>;
> +
> +		avago,pdrive	= <0x2>; /* APDS_IRLED_CURR_25mA */
> +		avago,ppcount	= <5>;
> +	};
> 
> -- 
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Pavel Machek Jan. 8, 2018, 10:20 p.m. UTC | #2
Hi!

> > From: Filip Matijević <filip.matijevic.pz@gmail.com>
> > 
> > This prepares binding for light sensor used in Nokia N9.
> 
> "dt-bindings: ..." is the preferred subject prefix.

Ok.

> > +++ b/Documentation/devicetree/bindings/misc/avago-apds990x.txt
> 
> Put this with other light sensors whether you use IIO or not:
> 
> bindings/iio/light/

Makes sense. Patches to convert to IIO are available.

> > @@ -0,0 +1,41 @@
> > +Avago APDS990X driver
> 
> Bindings aren't drivers.

Ok.

> > +https://docs.broadcom.com/docs/AV02-2867EN
> > +
> > +Required properties:
> > +- compatible: "avago,apds990x"
> > +- reg: address on the I2C bus
> > +- interrupts: external interrupt line number
> > +- vdd-supply: power supply for VDD
> > +- vled-supply: power supply for LEDA
> > +- avago,ga: Glass attenuation
> 
> We already have "upisemi,glass-coef". Can we align on something
> common.

upisemi seems to have different units (1/1000 vs. 1/4096). Do you want
me to do change to avago,glass-coef or ....?

> > +- avago,cf1: Clear channel factor 1
> > +- avago,irf1: IR channel factor 1
> > +- avago,cf2: Clear channel factor 2
> > +- avago,irf2: IR channel factor 2
> 
> Perhaps 2 properties with 2 cells for factor 1 and 2.

This is obviously easier to keep, but I can change.

> > +- avago,df: Device factor
> 
> Units/range for all these?

Fixed point, with 4096 == 1.00.

> > +- avago,pdrive: IR current, one of APDS_IRLED_CURR_XXXmA values
> 
> Don't we have standard current property for LEDs?

We do have "led-max-microamp"; which is not quite what this is. I
guess we can do "led-microamp" if you prefer?

> > +- avago,ppcount: Proximity pulse count
> 
> Is this standard for prox sensors?

I don't know many proximity sensors. Seems like way to raise sensitivity.

Best regards,
								Pavel
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/misc/avago-apds990x.txt b/Documentation/devicetree/bindings/misc/avago-apds990x.txt
new file mode 100644
index 0000000..480c0b1
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/avago-apds990x.txt
@@ -0,0 +1,41 @@ 
+Avago APDS990X driver
+
+https://docs.broadcom.com/docs/AV02-2867EN
+
+Required properties:
+- compatible: "avago,apds990x"
+- reg: address on the I2C bus
+- interrupts: external interrupt line number
+- vdd-supply: power supply for VDD
+- vled-supply: power supply for LEDA
+- avago,ga: Glass attenuation
+- avago,cf1: Clear channel factor 1
+- avago,irf1: IR channel factor 1
+- avago,cf2: Clear channel factor 2
+- avago,irf2: IR channel factor 2
+- avago,df: Device factor
+- avago,pdrive: IR current, one of APDS_IRLED_CURR_XXXmA values
+- avago,ppcount: Proximity pulse count
+
+Example (Nokia N9):
+
+	als_ps@39 {
+		compatible = "avago,apds990x";
+		reg = <0x39>;
+
+		interrupt-parent = <&gpio3>;
+		interrupts = <19 (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW)>; /* gpio_83 */
+
+		vdd-supply = <&vaux1>;
+		vled-supply = <&vbat>;
+
+		avago,ga	= <168834>;
+		avago,cf1	= <4096>;
+		avago,irf1	= <7824>;
+		avago,cf2	= <877>;
+		avago,irf2	= <1575>;
+		avago,df	= <52>;
+
+		avago,pdrive	= <0x2>; /* APDS_IRLED_CURR_25mA */
+		avago,ppcount	= <5>;
+	};