Message ID | 9487391b0565434761055b39ba04900bd839580a.1686926857.git.waqarh@axis.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1430915vqr; Fri, 16 Jun 2023 08:36:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4zdQAojGXr9N6QUpMbO/yOYNbNiI9v0oavmSBw+gEAGNIAYnF51dyGEEeBlt/e4lUTFi/s X-Received: by 2002:a05:6808:2993:b0:39c:717c:f4e3 with SMTP id ex19-20020a056808299300b0039c717cf4e3mr2374641oib.27.1686929793522; Fri, 16 Jun 2023 08:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686929793; cv=none; d=google.com; s=arc-20160816; b=b/ncUNjWkO5ms/752AFKWGqCJUErmmEc7wJxQtsVizQxyko7MlCnvA4pzvSVoFjQ8B v7E9UZ87Cf6OoQY2glgNHRRzcDW3DmSsS0L8CHLZTEwIauAHM5jCCHlIg+YdRs6j6CBu 1wJ5jPCCiyaMW6qlZ6Qxy1ASGQvZcqxWEPQAdH1moVZJqh3JCw1x7lir/gyingPp2l1W aWeojDmXVmGwkhQ2qcUiUuqV8ZrAj1GII6rriqfltAixxtB+exAQCSjKfg+I6UnoWm4A h6+Ff2r5Qrkyj3ieWSHhWJ6NKtva1oas42VlxcsADGE/7Bt+3mC7hVtwSLIHRB2/OYG0 v9rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:in-reply-to:subject :cc:to:from:user-agent:references:dkim-signature; bh=BuJWD6MDEmgPeXDb5794LN9Pv82aJsMiwAk15GVPLck=; b=Mr87NCCmoG0W/LCzFtcq2sgKlB5eYl1ATrSnJKloiC+J/VVdl7MiOxPzB7SFo1Qe/y QRmGwza0wi09TYi3144LaJ+CmSIvQl1a+OjLO1+J6q/KcGgjO2RsbIemm2cqqjs8alnu vB9So3ffqjBSkzYj6G2jvMF8xSWmKEVK5qwl5pkpEiUSsoURoVyXoqsj+WcRz7n1YFNi 14cK0s2acxwwJmuTejbRGbCd8k3YClUxwreeH1sBeAw43cPP1Zq+ptncaM+aBwQd8zLn uBz8jgE2R0+XKBT4acmpznOO4xgRdzAHVXoNM74VLSyhV/L69s3fJq7qdgygOkik4Ckk 69rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=fEeHnF6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a17090a001100b0025b8c6cfc45si1368092pja.80.2023.06.16.08.36.20; Fri, 16 Jun 2023 08:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=fEeHnF6r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345715AbjFPPNc (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Fri, 16 Jun 2023 11:13:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345881AbjFPPNa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 16 Jun 2023 11:13:30 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0BD33581; Fri, 16 Jun 2023 08:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1686928409; x=1718464409; h=references:from:to:cc:subject:in-reply-to:date: message-id:mime-version; bh=BuJWD6MDEmgPeXDb5794LN9Pv82aJsMiwAk15GVPLck=; b=fEeHnF6roftz+0JFxpjLDFMyAFMGISh+UdGR+xlsPVsOgT/Zuq9ZKSGu 4aKP+FGQCXcN03q1ohT7hx0LbitjAxhvBpqgGd3UpjFc/T/hhRYcjjFpa +GCcK25eyrVAvBk7H4O1VKZC0vNRifARtCPqj4lFgHXeIgBBESZrJtv4h 7Rq/A96xkW71HUFR9c66Cr445384BH+q8LcZ8uqkfVWw+2OIItL11qEHI TT7/mCWXmVJg3tLvgAwPHULVLFjkLLsyAKJUZkKa2heJZtEb3z9zOgQ46 0P1BYLMDFb5H3apdSVoA4ZBIHE2xbNumrkkRWUkyc0c3EDRbbUqpJHtGb g==; References: <cover.1686926857.git.waqarh@axis.com> User-agent: a.out From: Waqar Hameed <waqar.hameed@axis.com> To: Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org> CC: <linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <kernel@axis.com> Subject: [PATCH 1/2] dt-bindings: iio: proximity: Add bindings for Murata IRS-D200 In-Reply-To: <cover.1686926857.git.waqarh@axis.com> Date: Fri, 16 Jun 2023 17:10:42 +0200 Message-ID: <9487391b0565434761055b39ba04900bd839580a.1686926857.git.waqarh@axis.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.5.60] X-ClientProxiedBy: se-mail01w.axis.com (10.20.40.7) To se-mail01w.axis.com (10.20.40.7) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768874095050169546?= X-GMAIL-MSGID: =?utf-8?q?1768874095050169546?= |
Series |
Add driver for Murata IRS-D200
|
|
Commit Message
Waqar Hameed
June 16, 2023, 3:10 p.m. UTC
Murata IRS-D200 is a PIR sensor for human detection. It uses the I2C bus
for communication with interrupt support. Add devicetree bindings
requiring the compatible string, I2C slave address (reg) and interrupts.
Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
---
.../iio/proximity/murata,irsd200.yaml | 54 +++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml
Comments
On 16/06/2023 17:10, Waqar Hameed wrote: > Murata IRS-D200 is a PIR sensor for human detection. It uses the I2C bus > for communication with interrupt support. Add devicetree bindings > requiring the compatible string, I2C slave address (reg) and interrupts. Thank you for your patch. There is something to discuss/improve. I have actually only remark about DTS example, but since I expect resend two more nits as well. A nit, subject: drop second/last, redundant "bindings for". The "dt-bindings" prefix is already stating that these are bindings. > > Signed-off-by: Waqar Hameed <waqar.hameed@axis.com> > --- > .../iio/proximity/murata,irsd200.yaml | 54 +++++++++++++++++++ > 1 file changed, 54 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml > > diff --git a/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml b/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml > new file mode 100644 > index 000000000000..d317fbe7bd50 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml > @@ -0,0 +1,54 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/proximity/murata,irsd200.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Murata IRS-D200 PIR sensor > + > +maintainers: > + - Waqar Hameed <waqar.hameed@axis.com> > + > +description: | Nit, do not need '|' unless you need to preserve formatting. > + PIR sensor for human detection. > + > +properties: > + compatible: > + const: murata,irsd200 > + > + reg: > + items: > + - enum: > + - 0x48 > + - 0x49 > + description: | > + When the AD pin is connected to GND, the slave address is 0x48. > + When the AD pin is connected to VDD, the slave address is 0x49. > + > + interrupts: > + maxItems: 1 > + description: > + Type should be IRQ_TYPE_EDGE_RISING. > + > +required: > + - compatible > + - reg > + - interrupts > + > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + pir@48 { Node names should be generic. See also explanation and list of examples in DT specification: https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation so I guess: proximity@? Best regards, Krzysztof
On Fri, 16 Jun 2023 17:10:42 +0200 Waqar Hameed <waqar.hameed@axis.com> wrote: > Murata IRS-D200 is a PIR sensor for human detection. It uses the I2C bus > for communication with interrupt support. Add devicetree bindings > requiring the compatible string, I2C slave address (reg) and interrupts. > > Signed-off-by: Waqar Hameed <waqar.hameed@axis.com> This device will have some power supplies, so I'd expect those to be both listed and marked as required (maybe some are optional?) Other than that and the points in the other review one thing inline about interrupts. Jonathan > --- > .../iio/proximity/murata,irsd200.yaml | 54 +++++++++++++++++++ > 1 file changed, 54 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml > > diff --git a/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml b/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml > new file mode 100644 > index 000000000000..d317fbe7bd50 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml > @@ -0,0 +1,54 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/proximity/murata,irsd200.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Murata IRS-D200 PIR sensor > + > +maintainers: > + - Waqar Hameed <waqar.hameed@axis.com> > + > +description: | > + PIR sensor for human detection. > + > +properties: > + compatible: > + const: murata,irsd200 > + > + reg: > + items: > + - enum: > + - 0x48 > + - 0x49 > + description: | > + When the AD pin is connected to GND, the slave address is 0x48. > + When the AD pin is connected to VDD, the slave address is 0x49. > + > + interrupts: > + maxItems: 1 > + description: > + Type should be IRQ_TYPE_EDGE_RISING. > + > +required: > + - compatible > + - reg > + - interrupts If it is possible to remove interrupts from requires - and hence have at least a partly functional driver doing basic reading of the sensor then that is usually a good idea. Far too many board designers seem to decide that they don't need to wire up interrupt lines. If it's really hard then don't worry too much. Jonathan > + > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + > + i2c { > + #address-cells = <1>; > + #size-cells = <0>; > + > + pir@48 { > + compatible = "murata,irsd200"; > + reg = <0x48>; > + interrupts = <24 IRQ_TYPE_EDGE_RISING>; > + }; > + }; > +...
On Sat, Jun 17, 2023 at 10:55 +0200 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > On 16/06/2023 17:10, Waqar Hameed wrote: >> Murata IRS-D200 is a PIR sensor for human detection. It uses the I2C bus >> for communication with interrupt support. Add devicetree bindings >> requiring the compatible string, I2C slave address (reg) and interrupts. > > Thank you for your patch. There is something to discuss/improve. I have > actually only remark about DTS example, but since I expect resend two > more nits as well. > > > A nit, subject: drop second/last, redundant "bindings for". The > "dt-bindings" prefix is already stating that these are bindings. Alright, will change to "dt-bindings: iio: proximity: Add Murata IRS-D200". [...] >> +maintainers: >> + - Waqar Hameed <waqar.hameed@axis.com> >> + >> +description: | > > Nit, do not need '|' unless you need to preserve formatting. Yes, will remove (a remnant from previous version that had multiple lines... Sorry!). [...] >> +examples: >> + - | >> + #include <dt-bindings/interrupt-controller/irq.h> >> + >> + i2c { >> + #address-cells = <1>; >> + #size-cells = <0>; >> + >> + pir@48 { > > Node names should be generic. See also explanation and list of examples > in DT specification: > https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation > > so I guess: proximity@? On that list there is "temperature-sensor". Would it make sense then to call it "proximity-sensor"?
On Sat, Jun 17, 2023 at 13:55 +0100 Jonathan Cameron <jic23@kernel.org> wrote: > On Fri, 16 Jun 2023 17:10:42 +0200 > Waqar Hameed <waqar.hameed@axis.com> wrote: > >> Murata IRS-D200 is a PIR sensor for human detection. It uses the I2C bus >> for communication with interrupt support. Add devicetree bindings >> requiring the compatible string, I2C slave address (reg) and interrupts. >> >> Signed-off-by: Waqar Hameed <waqar.hameed@axis.com> > > This device will have some power supplies, so I'd expect those to be both > listed and marked as required (maybe some are optional?) Right, will add that here (and call `devm_regulator_get_enable()` in driver's probe). [...] >> +required: >> + - compatible >> + - reg >> + - interrupts > > If it is possible to remove interrupts from requires - and hence have > at least a partly functional driver doing basic reading of the sensor > then that is usually a good idea. Far too many board designers seem > to decide that they don't need to wire up interrupt lines. > > If it's really hard then don't worry too much. I see. It would be possible, but would also require some work. Let's leave it for now then?
On 19/06/2023 12:40, Waqar Hameed wrote: >> Node names should be generic. See also explanation and list of examples >> in DT specification: >> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation >> >> so I guess: proximity@? > > On that list there is "temperature-sensor". Would it make sense then to > call it "proximity-sensor"? Choose whatever is the most popular in existing Linux sources. Best regards, Krzysztof
On Mon, 19 Jun 2023 12:41:06 +0200 Waqar Hameed <waqar.hameed@axis.com> wrote: > On Sat, Jun 17, 2023 at 13:55 +0100 Jonathan Cameron <jic23@kernel.org> wrote: > > > On Fri, 16 Jun 2023 17:10:42 +0200 > > Waqar Hameed <waqar.hameed@axis.com> wrote: > > > >> Murata IRS-D200 is a PIR sensor for human detection. It uses the I2C bus > >> for communication with interrupt support. Add devicetree bindings > >> requiring the compatible string, I2C slave address (reg) and interrupts. > >> > >> Signed-off-by: Waqar Hameed <waqar.hameed@axis.com> > > > > This device will have some power supplies, so I'd expect those to be both > > listed and marked as required (maybe some are optional?) > > Right, will add that here (and call `devm_regulator_get_enable()` in > driver's probe). > > [...] > > >> +required: > >> + - compatible > >> + - reg > >> + - interrupts > > > > If it is possible to remove interrupts from requires - and hence have > > at least a partly functional driver doing basic reading of the sensor > > then that is usually a good idea. Far too many board designers seem > > to decide that they don't need to wire up interrupt liness > > If it's really hard then don't worry too much. > > I see. It would be possible, but would also require some work. Let's > leave it for now then? Sure - as long as you review the patches when they come in :) Jonathan
diff --git a/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml b/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml new file mode 100644 index 000000000000..d317fbe7bd50 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/proximity/murata,irsd200.yaml @@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/proximity/murata,irsd200.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Murata IRS-D200 PIR sensor + +maintainers: + - Waqar Hameed <waqar.hameed@axis.com> + +description: | + PIR sensor for human detection. + +properties: + compatible: + const: murata,irsd200 + + reg: + items: + - enum: + - 0x48 + - 0x49 + description: | + When the AD pin is connected to GND, the slave address is 0x48. + When the AD pin is connected to VDD, the slave address is 0x49. + + interrupts: + maxItems: 1 + description: + Type should be IRQ_TYPE_EDGE_RISING. + +required: + - compatible + - reg + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pir@48 { + compatible = "murata,irsd200"; + reg = <0x48>; + interrupts = <24 IRQ_TYPE_EDGE_RISING>; + }; + }; +...