From patchwork Sun May 15 06:03:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12849979 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF099C433EF for ; Sun, 15 May 2022 06:03:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235734AbiEOGDx (ORCPT ); Sun, 15 May 2022 02:03:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbiEOGDv (ORCPT ); Sun, 15 May 2022 02:03:51 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ED044BE3C; Sat, 14 May 2022 23:03:49 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.91,227,1647270000"; d="scan'208";a="121009741" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 15 May 2022 15:03:49 +0900 Received: from localhost.localdomain (unknown [10.226.92.18]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 07CA440065CE; Sun, 15 May 2022 15:03:44 +0900 (JST) From: Biju Das To: Jonathan Cameron , Rob Herring , Krzysztof Kozlowski Cc: Biju Das , Lad Prabhakar , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das , Krzysztof Kozlowski Subject: [PATCH v5 1/2] dt-bindings: iio: adc: Document Renesas RZ/G2UL ADC Date: Sun, 15 May 2022 07:03:35 +0100 Message-Id: <20220515060337.16513-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220515060337.16513-1-biju.das.jz@bp.renesas.com> References: <20220515060337.16513-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Document Renesas RZ/G2UL ADC bindings. RZ/G2UL ADC is almost identical to RZ/G2L, but it has 2 analog input channels compared to 8 channels on the RZ/G2L. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven Reviewed-by: Krzysztof Kozlowski Acked-by: Rob Herring --- v4->v5: * Removed redundant "type:object" * Added Rb tag from Krzysztof Kozlowski v3->v4: * Removed unnecessary SoC specific reg description as it is equivalent to the logic used in reg. * Removed Items from reg. v2->v3: * Added generic description for reg. * Improved schema validation by restricting both channel and reg to [0-1]. v1->v2: * Started using generic compatible for RZ/G2UL and added SoC specific validation for channels. --- .../bindings/iio/adc/renesas,rzg2l-adc.yaml | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml index d66c24cae1e1..61c6157cf5a9 100644 --- a/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml +++ b/Documentation/devicetree/bindings/iio/adc/renesas,rzg2l-adc.yaml @@ -19,6 +19,7 @@ properties: compatible: items: - enum: + - renesas,r9a07g043-adc # RZ/G2UL - renesas,r9a07g044-adc # RZ/G2L - renesas,r9a07g054-adc # RZ/V2L - const: renesas,rzg2l-adc @@ -76,16 +77,35 @@ patternProperties: properties: reg: description: | - The channel number. It can have up to 8 channels numbered from 0 to 7. - items: - - minimum: 0 - maximum: 7 + The channel number. required: - reg additionalProperties: false +allOf: + - if: + properties: + compatible: + contains: + const: renesas,r9a07g043-adc + then: + patternProperties: + "^channel@[2-7]$": false + "^channel@[0-1]$": + properties: + reg: + minimum: 0 + maximum: 1 + else: + patternProperties: + "^channel@[0-7]$": + properties: + reg: + minimum: 0 + maximum: 7 + additionalProperties: false examples: From patchwork Sun May 15 06:03:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12849980 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F08ECC433EF for ; Sun, 15 May 2022 06:03:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235728AbiEOGDy (ORCPT ); Sun, 15 May 2022 02:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbiEOGDy (ORCPT ); Sun, 15 May 2022 02:03:54 -0400 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73E20BE3C; Sat, 14 May 2022 23:03:53 -0700 (PDT) X-IronPort-AV: E=Sophos;i="5.91,227,1647270000"; d="scan'208";a="119707858" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 15 May 2022 15:03:52 +0900 Received: from localhost.localdomain (unknown [10.226.92.18]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id DA9A140065CE; Sun, 15 May 2022 15:03:49 +0900 (JST) From: Biju Das To: Jonathan Cameron Cc: Biju Das , Lad Prabhakar , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Chris Paterson , Biju Das Subject: [PATCH v5 2/2] iio: adc: rzg2l_adc: Remove unnecessary channel check from rzg2l_adc_read_label() Date: Sun, 15 May 2022 07:03:36 +0100 Message-Id: <20220515060337.16513-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220515060337.16513-1-biju.das.jz@bp.renesas.com> References: <20220515060337.16513-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Remove unnecessary channel check from rzg2l_adc_read_label(), as the channel error handling is already done in probe(). Therefore no need to validate at runtime. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v4->v5: * No Change. v3->v4: * No Change. v2->v3: * Added Rb tag from Geert. v2: * New patch --- drivers/iio/adc/rzg2l_adc.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/iio/adc/rzg2l_adc.c b/drivers/iio/adc/rzg2l_adc.c index 7585144b9715..bee5f9861acb 100644 --- a/drivers/iio/adc/rzg2l_adc.c +++ b/drivers/iio/adc/rzg2l_adc.c @@ -260,9 +260,6 @@ static int rzg2l_adc_read_label(struct iio_dev *iio_dev, const struct iio_chan_spec *chan, char *label) { - if (chan->channel >= RZG2L_ADC_MAX_CHANNELS) - return -EINVAL; - return sysfs_emit(label, "%s\n", rzg2l_adc_channel_name[chan->channel]); }