diff mbox series

[4/4] dt-bindings: input: Add documentation for gp2a sensor

Message ID 20190125175045.22576-5-pawel.mikolaj.chmiel@gmail.com (mailing list archive)
State New, archived
Headers show
Series input: misc: gp2a: Add device tree support | expand

Commit Message

Paweł Chmiel Jan. 25, 2019, 5:50 p.m. UTC
From: Jonathan Bakker <xc-racer2@live.ca>

This commit adds documentation for Sharp GP2AP002A00F.
It's Proximity/Opto Sensor connected over i2c.

Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
 .../bindings/input/sharp,gp2ap002a00f.txt     | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt

Comments

Dmitry Torokhov Jan. 26, 2019, 1:32 a.m. UTC | #1
On Fri, Jan 25, 2019 at 06:50:45PM +0100, Paweł Chmiel wrote:
> From: Jonathan Bakker <xc-racer2@live.ca>
> 
> This commit adds documentation for Sharp GP2AP002A00F.
> It's Proximity/Opto Sensor connected over i2c.
> 
> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> ---
>  .../bindings/input/sharp,gp2ap002a00f.txt     | 29 +++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
> 
> diff --git a/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
> new file mode 100644
> index 000000000000..c524eb7d3d60
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
> @@ -0,0 +1,29 @@
> +* Sharp GP2AP002A00F I2C Proximity/Opto Sensor
> +
> +Required properties:
> +- compatible : Should be "sharp,gp2ap002a00f"
> +- reg : The I2C address of the sensor
> +- vout-gpio : The gpio connected to the vout pin

Do you know what it is for?

> +- interrupt-parent : should be the phandle for the interrupt controller
> +- interrupts : Interrupt mapping for GPIO IRQ, it should by configured with
> +		flags IRQ_TYPE_EDGE_BOTH
> +
> +Optional properties:
> +- wakeup : If the device is capable of waking up the system
> +- io-channels : Phandle to an ADC channel connected to the light sensor
> +- io-channel-names = "light";
> +- poll-interval : Poll interval time in milliseconds, default 500ms
> +- light-adc-max : Maximum light value reported, default 4096
> +- light-adc-fuzz : Fuzz value for reported light value, default 80
> +
> +Example:
> +
> +gp2a@44 {
> +	compatible = "sharp,gp2ap002a00f";
> +	reg = <0x44>;
> +	vout-gpio = <&gph0 2 GPIO_ACTIVE_HIGH>;
> +	interrupt-parent = <&gph0>;
> +	interrupts = <2 IRQ_TYPE_EDGE_BOTH>;
> +	io-channels = <&adc 9>;
> +	io-channel-names = "light";
> +};
> -- 
> 2.17.1
>
Jonathan Bakker Jan. 26, 2019, 3:14 a.m. UTC | #2
Hi Dmitry,

Thanks for your review of the patches.

Considering that the light sensor part should be in IIO, should the entire driver be rewritten as an IIO driver?  There's already the driver for gp2ap020a00f there which is presumably the gp2ap002a00f's successor and does the same functions.

On 2019-01-25 5:32 p.m., Dmitry Torokhov wrote:
> On Fri, Jan 25, 2019 at 06:50:45PM +0100, Paweł Chmiel wrote:
>> From: Jonathan Bakker <xc-racer2@live.ca>
>>
>> This commit adds documentation for Sharp GP2AP002A00F.
>> It's Proximity/Opto Sensor connected over i2c.
>>
>> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
>> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
>> ---
>>  .../bindings/input/sharp,gp2ap002a00f.txt     | 29 +++++++++++++++++++
>>  1 file changed, 29 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
>>
>> diff --git a/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
>> new file mode 100644
>> index 000000000000..c524eb7d3d60
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
>> @@ -0,0 +1,29 @@
>> +* Sharp GP2AP002A00F I2C Proximity/Opto Sensor
>> +
>> +Required properties:
>> +- compatible : Should be "sharp,gp2ap002a00f"
>> +- reg : The I2C address of the sensor
>> +- vout-gpio : The gpio connected to the vout pin
> 
> Do you know what it is for?
> 
It's the control of the main power supply to the chip.
>> +- interrupt-parent : should be the phandle for the interrupt controller
>> +- interrupts : Interrupt mapping for GPIO IRQ, it should by configured with
>> +		flags IRQ_TYPE_EDGE_BOTH
>> +
>> +Optional properties:
>> +- wakeup : If the device is capable of waking up the system
>> +- io-channels : Phandle to an ADC channel connected to the light sensor
>> +- io-channel-names = "light";
>> +- poll-interval : Poll interval time in milliseconds, default 500ms
>> +- light-adc-max : Maximum light value reported, default 4096
>> +- light-adc-fuzz : Fuzz value for reported light value, default 80
>> +
>> +Example:
>> +
>> +gp2a@44 {
>> +	compatible = "sharp,gp2ap002a00f";
>> +	reg = <0x44>;
>> +	vout-gpio = <&gph0 2 GPIO_ACTIVE_HIGH>;
>> +	interrupt-parent = <&gph0>;
>> +	interrupts = <2 IRQ_TYPE_EDGE_BOTH>;
>> +	io-channels = <&adc 9>;
>> +	io-channel-names = "light";
>> +};
>> -- 
>> 2.17.1
>>
> 
Thanks,
Jonathan
Dmitry Torokhov Jan. 28, 2019, 7:30 p.m. UTC | #3
On Sat, Jan 26, 2019 at 03:14:14AM +0000, Jonathan Bakker wrote:
> Hi Dmitry,
> 
> Thanks for your review of the patches.
> 
> Considering that the light sensor part should be in IIO, should the entire driver be rewritten as an IIO driver?  There's already the driver for gp2ap020a00f there which is presumably the gp2ap002a00f's successor and does the same functions.

I'd be fine with that.

> 
> On 2019-01-25 5:32 p.m., Dmitry Torokhov wrote:
> > On Fri, Jan 25, 2019 at 06:50:45PM +0100, Paweł Chmiel wrote:
> >> From: Jonathan Bakker <xc-racer2@live.ca>
> >>
> >> This commit adds documentation for Sharp GP2AP002A00F.
> >> It's Proximity/Opto Sensor connected over i2c.
> >>
> >> Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
> >> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> >> ---
> >>  .../bindings/input/sharp,gp2ap002a00f.txt     | 29 +++++++++++++++++++
> >>  1 file changed, 29 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
> >> new file mode 100644
> >> index 000000000000..c524eb7d3d60
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
> >> @@ -0,0 +1,29 @@
> >> +* Sharp GP2AP002A00F I2C Proximity/Opto Sensor
> >> +
> >> +Required properties:
> >> +- compatible : Should be "sharp,gp2ap002a00f"
> >> +- reg : The I2C address of the sensor
> >> +- vout-gpio : The gpio connected to the vout pin
> > 
> > Do you know what it is for?
> > 
> It's the control of the main power supply to the chip.

In this case it should be a power supply (regulator), not gpio.

Thanks.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
new file mode 100644
index 000000000000..c524eb7d3d60
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/sharp,gp2ap002a00f.txt
@@ -0,0 +1,29 @@ 
+* Sharp GP2AP002A00F I2C Proximity/Opto Sensor
+
+Required properties:
+- compatible : Should be "sharp,gp2ap002a00f"
+- reg : The I2C address of the sensor
+- vout-gpio : The gpio connected to the vout pin
+- interrupt-parent : should be the phandle for the interrupt controller
+- interrupts : Interrupt mapping for GPIO IRQ, it should by configured with
+		flags IRQ_TYPE_EDGE_BOTH
+
+Optional properties:
+- wakeup : If the device is capable of waking up the system
+- io-channels : Phandle to an ADC channel connected to the light sensor
+- io-channel-names = "light";
+- poll-interval : Poll interval time in milliseconds, default 500ms
+- light-adc-max : Maximum light value reported, default 4096
+- light-adc-fuzz : Fuzz value for reported light value, default 80
+
+Example:
+
+gp2a@44 {
+	compatible = "sharp,gp2ap002a00f";
+	reg = <0x44>;
+	vout-gpio = <&gph0 2 GPIO_ACTIVE_HIGH>;
+	interrupt-parent = <&gph0>;
+	interrupts = <2 IRQ_TYPE_EDGE_BOTH>;
+	io-channels = <&adc 9>;
+	io-channel-names = "light";
+};