Message ID | 20240227212244.262710-3-chris.packham@alliedtelesis.co.nz |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-84027-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2973180dyb; Tue, 27 Feb 2024 13:23:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUxumfB/Qtc0Y9oIksawrO6N+2CA82XayFZUTva/QyzpnXMawhGefw/7guQznybEFKXzGMrdfjrdayCrmwEmAm6g2zqRA== X-Google-Smtp-Source: AGHT+IG6SeToTKce25QevmpuqYTfOMz+swgNolSIn4gLFkkQLEKRt8GIt2UZiQhC9jXrYEoUWOe1 X-Received: by 2002:a0c:de08:0:b0:68f:f74f:4fbe with SMTP id t8-20020a0cde08000000b0068ff74f4fbemr3131546qvk.52.1709069031264; Tue, 27 Feb 2024 13:23:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709069031; cv=pass; d=google.com; s=arc-20160816; b=fRy7iVOJHsxvUz8bEw0mXxo2Mq9sEsoLMznFS+wtTX/6O8fvRx3ZdB1YbCrCz1WwBM qKZLlSgnpoab9rEmJCflZW1CzW1Zz2+bXAAwfep/XxkSHhE+nmFjlzrOn/m2yAxOh6ad T2z0S4UmKIk/HavsMtr2uxQ30bheUsdzUSmElOm73GSUfZj3bj+8iQAvw0Lo0hy3+5re Mt/IKcurnv/AIPKtFff6CJ/wqmINQQ2ANHVFUBcFltR5sK6UhZMdJx4zoNjZhe8LBP/G a1mx0gm4wSWh9tluzJJYZGMNyiSMSGzeHZCTL2VYKei1M8toa1cQBManDYsQPOVcWV1Z 19vg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=LOw+APALrT5aUqA/0fMq33F3F8DtOvqcqkhH81G9wOw=; fh=0E1zKu25rC1dvhxh54JUfQllyJcUtqgw4XThBRPfUNc=; b=AhRLqOABqRYKMJ2PZgbJFrEFjYUhosXBaJRDLGR0dcdAZgbZQ+22E+tOzTz8fquzTq qVwHq3TgOYH9BbNoUZ4PEyQ+fHc3Oo0VAn/Uso7SJZIH50G8Mr3+2mj6tD/QdkXGVhqD 0h90Lfgw+AYYh4CC6JreT1KnwBjgLe0TIr/8JQ3VOQVI+Jp/Uawg0yDNObn8sOtm/qWI EbUumoI0lrGRYr+cVx09Ob03LJKzdtY4UZEoEFWSzsWWIbjOUcZM82EqrJKOahno9afU FVzJFmg5CSPvMGp+3uG/Fe7cfsGXxeAbdYzbkJRXmgnyvI0gTn9taPZRZcSj8C6gboeL Lbhw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=lYcSDEAv; arc=pass (i=1 spf=pass spfdomain=alliedtelesis.co.nz dkim=pass dkdomain=alliedtelesis.co.nz dmarc=pass fromdomain=alliedtelesis.co.nz); spf=pass (google.com: domain of linux-kernel+bounces-84027-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84027-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id u5-20020ad45aa5000000b0069007a575f5si5780054qvg.226.2024.02.27.13.23.51 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 13:23:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84027-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b=lYcSDEAv; arc=pass (i=1 spf=pass spfdomain=alliedtelesis.co.nz dkim=pass dkdomain=alliedtelesis.co.nz dmarc=pass fromdomain=alliedtelesis.co.nz); spf=pass (google.com: domain of linux-kernel+bounces-84027-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84027-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=alliedtelesis.co.nz Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 125A61C2273B for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 21:23:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 161EB155314; Tue, 27 Feb 2024 21:22:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b="lYcSDEAv" Received: from gate2.alliedtelesis.co.nz (gate2.alliedtelesis.co.nz [202.36.163.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0534914EFDB for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 21:22:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.36.163.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709068972; cv=none; b=O0B5mGbiMZnx97JQWhpH7lYQk/Or6ogSk9/gHAKgKTu5DGL3nK0BbsyroZGUwZAC1zqpKd5J5qo571Fd8qvMvxnSF7Daod0wJF1VXQd/41ZwLYtWGUDvoz5Lv7uI9kP3K40auY2jsbAh0uJ5BOWnPvfzMbJ7iUzbzDhpK+9kgCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709068972; c=relaxed/simple; bh=eK9yw7rjJCnXz/CRcOc0uADvvqCIKYQRpfuCDUPnZlY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hxyw42peQelpySeonm2+ywojbDphf6LMdG4YGQmqOC7k2RxNfy5ReveG0H1Q9kM7U2cJ/kf/agTyLtkuN1oLaeQrNMIfx1OSVhv8bFNYKRZmqhX92+PwcePpEyQqyTYaM+AKBZo8DefUiXRYAUP7NpJFC1qUI6cSLn2Zbd0bHWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=alliedtelesis.co.nz; spf=pass smtp.mailfrom=alliedtelesis.co.nz; dkim=pass (2048-bit key) header.d=alliedtelesis.co.nz header.i=@alliedtelesis.co.nz header.b=lYcSDEAv; arc=none smtp.client-ip=202.36.163.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=alliedtelesis.co.nz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=alliedtelesis.co.nz Received: from svr-chch-seg1.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id D11672C05BB; Wed, 28 Feb 2024 10:22:46 +1300 (NZDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1709068966; bh=LOw+APALrT5aUqA/0fMq33F3F8DtOvqcqkhH81G9wOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lYcSDEAviff6X00qS3mF3yGsjFgw2eo+sDdRxFGO79Ddn70FcnWazriYVZJ6l16p3 53IPb0v65KS9ObQBR5QhbKKl4wkPRy7cMH/DlFxR39krhG06lxuNKl7FoOXIcz4i2m 70wSgJlYIG+D/I9RBmdjdMvn9WLL8wVy16vrN12qEXt5W+EGG7EAc8Vu12Z3OWE9PG 7ELjT/Cnm//csJstogNXktFod2rBtpMOu5ddjbiy1tmzzL0IxnvvY/pMbTntEvsMWn UH0APOj8wR+iDzYie4+VeMLi2MkiMClOBjhrSynXWEdrN2D4w/3+SOIg7XDCI0ae83 vrXvMybCVSxCQ== Received: from pat.atlnz.lc (Not Verified[10.32.16.33]) by svr-chch-seg1.atlnz.lc with Trustwave SEG (v8,2,6,11305) id <B65de52a60002>; Wed, 28 Feb 2024 10:22:46 +1300 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by pat.atlnz.lc (Postfix) with ESMTP id 66AB013EE85; Wed, 28 Feb 2024 10:22:46 +1300 (NZDT) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 628CE280B00; Wed, 28 Feb 2024 10:22:46 +1300 (NZDT) From: Chris Packham <chris.packham@alliedtelesis.co.nz> To: andy@kernel.org, geert@linux-m68k.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, andrew@lunn.ch, gregory.clement@bootlin.com, sebastian.hesselbarth@gmail.com, ojeda@kernel.org, tzimmermann@suse.de, javierm@redhat.com, robin@protonic.nl, lee@kernel.org, pavel@ucw.cz Cc: devicetree@vger.kernel.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Chris Packham <chris.packham@alliedtelesis.co.nz> Subject: [PATCH v2 2/4] dt-bindings: auxdisplay: Add bindings for generic 7 segment LED Date: Wed, 28 Feb 2024 10:22:42 +1300 Message-ID: <20240227212244.262710-3-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240227212244.262710-1-chris.packham@alliedtelesis.co.nz> References: <20240227212244.262710-1-chris.packham@alliedtelesis.co.nz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SEG-SpamProfiler-Analysis: v=2.4 cv=BKkQr0QG c=1 sm=1 tr=0 ts=65de52a6 a=KLBiSEs5mFS1a/PbTCJxuA==:117 a=k7vzHIieQBIA:10 a=gEfo2CItAAAA:8 a=wDxYY4ZP0rUsokw9mtgA:9 a=3ZKOabzyN94A:10 a=sptkURWiP4Gy88Gu7hUp:22 X-SEG-SpamProfiler-Score: 0 x-atlnz-ls: pat X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792088768569522695 X-GMAIL-MSGID: 1792088768569522695 |
Series |
auxdisplay: 7 segment LED display
|
|
Commit Message
Chris Packham
Feb. 27, 2024, 9:22 p.m. UTC
Add bindings for a generic 7 segment LED display using GPIOs.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
Changes in v2:
- Use compatible = "generic-gpio-7seg" to keep checkpatch.pl happy
.../auxdisplay/generic-gpio-7seg.yaml | 40 +++++++++++++++++++
1 file changed, 40 insertions(+)
create mode 100644 Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml
Comments
On Wed, 28 Feb 2024 10:22:42 +1300, Chris Packham wrote: > Add bindings for a generic 7 segment LED display using GPIOs. > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > > Notes: > Changes in v2: > - Use compatible = "generic-gpio-7seg" to keep checkpatch.pl happy > > .../auxdisplay/generic-gpio-7seg.yaml | 40 +++++++++++++++++++ > 1 file changed, 40 insertions(+) > create mode 100644 Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13): yamllint warnings/errors: dtschema/dtc warnings/errors: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename $id: http://devicetree.org/schemas/auxdisplay/generic,gpio-7seg.yaml file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240227212244.262710-3-chris.packham@alliedtelesis.co.nz The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
On Tue, Feb 27, 2024 at 11:22 PM Chris Packham <chris.packham@alliedtelesis.co.nz> wrote: .. > + segment-gpios: > + description: > + An array of GPIOs one per segment. This is a vague description. Please explain the order (e.g., LSB = 'a', MSB = 'g'), use of DP (optional?), etc. > + minItems: 7 maxItems? .. > + led-7seg { Probably it should be more human readable. DT people might suggest something better. > + compatible = "generic-gpio-7seg"; > + segment-gpios = <&gpio 0 GPIO_ACTIVE_LOW > + &gpio 1 GPIO_ACTIVE_LOW > + &gpio 2 GPIO_ACTIVE_LOW > + &gpio 3 GPIO_ACTIVE_LOW > + &gpio 4 GPIO_ACTIVE_LOW > + &gpio 5 GPIO_ACTIVE_LOW > + &gpio 6 GPIO_ACTIVE_LOW>; Dunno how to handle DP. Either we always expect it to be here (as placeholder) or with additional property. > + };
On 28/02/24 13:03, Andy Shevchenko wrote: > On Tue, Feb 27, 2024 at 11:22 PM Chris Packham > <chris.packham@alliedtelesis.co.nz> wrote: > > ... > >> + segment-gpios: >> + description: >> + An array of GPIOs one per segment. > This is a vague description. Please explain the order (e.g., LSB = > 'a', MSB = 'g'), use of DP (optional?), etc. > >> + minItems: 7 > maxItems? > > ... I plan on saying maxItems: 7 (more discussion below) > >> + led-7seg { > Probably it should be more human readable. DT people might suggest > something better. > >> + compatible = "generic-gpio-7seg"; >> + segment-gpios = <&gpio 0 GPIO_ACTIVE_LOW >> + &gpio 1 GPIO_ACTIVE_LOW >> + &gpio 2 GPIO_ACTIVE_LOW >> + &gpio 3 GPIO_ACTIVE_LOW >> + &gpio 4 GPIO_ACTIVE_LOW >> + &gpio 5 GPIO_ACTIVE_LOW >> + &gpio 6 GPIO_ACTIVE_LOW>; > Dunno how to handle DP. Either we always expect it to be here (as > placeholder) or with additional property. My current plan was to ignore it. As you see it my later patch I'm (ab)using DP as a discrete gpio-led with a different function. We could either a separate dp-gpios property or set maxItems to 8. Right now the driver won't do anything with either option.To actually do something in the linedisp driver we'd need to have a new character map that includes the extra LED. >> + };
On Wed, Feb 28, 2024 at 10:22:42AM +1300, Chris Packham wrote: > Add bindings for a generic 7 segment LED display using GPIOs. > > Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> > --- > > Notes: > Changes in v2: > - Use compatible = "generic-gpio-7seg" to keep checkpatch.pl happy > > .../auxdisplay/generic-gpio-7seg.yaml | 40 +++++++++++++++++++ > 1 file changed, 40 insertions(+) > create mode 100644 Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml > > diff --git a/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml b/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml > new file mode 100644 > index 000000000000..46d53ebdf413 > --- /dev/null > +++ b/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml > @@ -0,0 +1,40 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/auxdisplay/generic,gpio-7seg.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: GPIO based LED segment display > + > +maintainers: > + - Chris Packham <chris.packham@alliedtelesis.co.nz> > + > +properties: > + compatible: > + const: generic-gpio-7seg 'generic' doesn't add anything of value. 7seg is kind of vague. So, gpio-7-segment? > + > + segment-gpios: > + description: > + An array of GPIOs one per segment. > + minItems: 7 How does one know which GPIO is which segment? Rob
On Wed, Feb 28, 2024 at 4:04 PM Rob Herring <robh@kernel.org> wrote: > On Wed, Feb 28, 2024 at 10:22:42AM +1300, Chris Packham wrote: .. > > + segment-gpios: > > + description: > > + An array of GPIOs one per segment. > > + minItems: 7 > > How does one know which GPIO is which segment? I believe we need just to agree on this. Since anybody can shuffle GPIOs in the DT, there is no need to support arbitrary orders. And naturally 'a' is bit 0, 'g' is bit 6, 'dp' bit 7 if present.
On Wed, Feb 28, 2024 at 01:53:08AM +0000, Chris Packham wrote: > On 28/02/24 13:03, Andy Shevchenko wrote: > > On Tue, Feb 27, 2024 at 11:22 PM Chris Packham > > <chris.packham@alliedtelesis.co.nz> wrote: .. > >> + segment-gpios: > >> + description: > >> + An array of GPIOs one per segment. > > This is a vague description. Please explain the order (e.g., LSB = > > 'a', MSB = 'g'), use of DP (optional?), etc. > > > >> + minItems: 7 > > maxItems? > I plan on saying maxItems: 7 (more discussion below) .. > >> + led-7seg { > > Probably it should be more human readable. DT people might suggest > > something better. > > > >> + compatible = "generic-gpio-7seg"; > >> + segment-gpios = <&gpio 0 GPIO_ACTIVE_LOW > >> + &gpio 1 GPIO_ACTIVE_LOW > >> + &gpio 2 GPIO_ACTIVE_LOW > >> + &gpio 3 GPIO_ACTIVE_LOW > >> + &gpio 4 GPIO_ACTIVE_LOW > >> + &gpio 5 GPIO_ACTIVE_LOW > >> + &gpio 6 GPIO_ACTIVE_LOW>; > > Dunno how to handle DP. Either we always expect it to be here (as > > placeholder) or with additional property. > > My current plan was to ignore it. As you see it my later patch I'm > (ab)using DP as a discrete gpio-led with a different function. FWIW, I have _no_ indicator _without_ DP. So, my statistics is towards enabling DP as a part of 7-segment displays. > We could either a separate dp-gpios property or set maxItems to 8. Right > now the driver won't do anything with either option.To actually do > something in the linedisp driver we'd need to have a new character map > that includes the extra LED. Yeah, we can leave it open for now. > >> + };
On 29/02/24 03:04, Rob Herring wrote: > On Wed, Feb 28, 2024 at 10:22:42AM +1300, Chris Packham wrote: >> Add bindings for a generic 7 segment LED display using GPIOs. >> >> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> >> --- >> >> Notes: >> Changes in v2: >> - Use compatible = "generic-gpio-7seg" to keep http://scanmail.trustwave.com/?c=20988&d=7b3f5fUJGtY-Kala5ZOOxaOVYt2BwN-ZLskYi3hWDQ&u=http%3a%2f%2fcheckpatch%2epl happy >> >> .../auxdisplay/generic-gpio-7seg.yaml | 40 +++++++++++++++++++ >> 1 file changed, 40 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml >> >> diff --git a/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml b/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml >> new file mode 100644 >> index 000000000000..46d53ebdf413 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml >> @@ -0,0 +1,40 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://scanmail.trustwave.com/?c=20988&d=7b3f5fUJGtY-Kala5ZOOxaOVYt2BwN-ZLsYdhCQAWQ&u=http%3a%2f%2fdevicetree%2eorg%2fschemas%2fauxdisplay%2fgeneric%2cgpio-7seg%2eyaml%23 >> +$schema: http://scanmail.trustwave.com/?c=20988&d=7b3f5fUJGtY-Kala5ZOOxaOVYt2BwN-ZLsYY0X9WDg&u=http%3a%2f%2fdevicetree%2eorg%2fmeta-schemas%2fcore%2eyaml%23 >> + >> +title: GPIO based LED segment display >> + >> +maintainers: >> + - Chris Packham <chris.packham@alliedtelesis.co.nz> >> + >> +properties: >> + compatible: >> + const: generic-gpio-7seg > 'generic' doesn't add anything of value. 7seg is kind of vague. So, > gpio-7-segment? Ack. >> + >> + segment-gpios: >> + description: >> + An array of GPIOs one per segment. >> + minItems: 7 > How does one know which GPIO is which segment? I've expanded the description in v3. + An array of GPIOs one per segment. The first GPIO corresponds to the A + segment the last GPIO corresponds to the G segment. Do you think that's sufficient or do I need to add more? In the driver itself I've put a little ascii art diagram of the segments.
Hi Andy, On Wed, Feb 28, 2024 at 3:58 PM Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > On Wed, Feb 28, 2024 at 4:04 PM Rob Herring <robh@kernel.org> wrote: > > On Wed, Feb 28, 2024 at 10:22:42AM +1300, Chris Packham wrote: > > ... > > > > + segment-gpios: > > > + description: > > > + An array of GPIOs one per segment. > > > + minItems: 7 > > > > How does one know which GPIO is which segment? > > I believe we need just to agree on this. Since anybody can shuffle > GPIOs in the DT, there is no need to support arbitrary orders. And > naturally 'a' is bit 0, 'g' is bit 6, 'dp' bit 7 if present. Note that there are no bits involved at this level, only GPIO specifiers. Gr{oetje,eeting}s, Geert
Hi Chris, On Wed, Feb 28, 2024 at 9:02 PM Chris Packham <Chris.Packham@alliedtelesis.co.nz> wrote: > On 29/02/24 03:04, Rob Herring wrote: > > On Wed, Feb 28, 2024 at 10:22:42AM +1300, Chris Packham wrote: > >> + segment-gpios: > >> + description: > >> + An array of GPIOs one per segment. > >> + minItems: 7 > > How does one know which GPIO is which segment? > > I've expanded the description in v3. > > + An array of GPIOs one per segment. The first GPIO corresponds to the A > + segment the last GPIO corresponds to the G segment. > > Do you think that's sufficient or do I need to add more? In the driver > itself I've put a little ascii art diagram of the segments. Given users are reading the bindings rather than the driver source, I would move the diagram to the bindings. Thanks! Gr{oetje,eeting}s, Geert
On Thu, Feb 29, 2024 at 10:23:15AM +0100, Geert Uytterhoeven wrote: > On Wed, Feb 28, 2024 at 3:58 PM Andy Shevchenko > <andy.shevchenko@gmail.com> wrote: > > On Wed, Feb 28, 2024 at 4:04 PM Rob Herring <robh@kernel.org> wrote: > > > On Wed, Feb 28, 2024 at 10:22:42AM +1300, Chris Packham wrote: .. > > > > + segment-gpios: > > > > + description: > > > > + An array of GPIOs one per segment. > > > > + minItems: 7 > > > > > > How does one know which GPIO is which segment? > > > > I believe we need just to agree on this. Since anybody can shuffle > > GPIOs in the DT, there is no need to support arbitrary orders. And > > naturally 'a' is bit 0, 'g' is bit 6, 'dp' bit 7 if present. > > Note that there are no bits involved at this level, only GPIO specifiers. Right, I meant the sequence in the array of GPIOs in the DT. I implied that it maps 1:1 to the real bits in HW (in some cases).
On Thu, Feb 29, 2024 at 10:24:33AM +0100, Geert Uytterhoeven wrote: > On Wed, Feb 28, 2024 at 9:02 PM Chris Packham > <Chris.Packham@alliedtelesis.co.nz> wrote: > > On 29/02/24 03:04, Rob Herring wrote: > > > On Wed, Feb 28, 2024 at 10:22:42AM +1300, Chris Packham wrote: .. > > > How does one know which GPIO is which segment? > > > > I've expanded the description in v3. > > > > + An array of GPIOs one per segment. The first GPIO corresponds to the A > > + segment the last GPIO corresponds to the G segment. > > > > Do you think that's sufficient or do I need to add more? In the driver > > itself I've put a little ascii art diagram of the segments. > > Given users are reading the bindings rather than the driver source, > I would move the diagram to the bindings. +1 here. We have a diagram already in UAPI headers, but that won't be (quickly) visible for the real users, duplicating in the code doesn't add any value, but adding it to DT description will be beneficial.
diff --git a/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml b/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml new file mode 100644 index 000000000000..46d53ebdf413 --- /dev/null +++ b/Documentation/devicetree/bindings/auxdisplay/generic-gpio-7seg.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/auxdisplay/generic,gpio-7seg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GPIO based LED segment display + +maintainers: + - Chris Packham <chris.packham@alliedtelesis.co.nz> + +properties: + compatible: + const: generic-gpio-7seg + + segment-gpios: + description: + An array of GPIOs one per segment. + minItems: 7 + +required: + - segment-gpios + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/gpio/gpio.h> + + led-7seg { + compatible = "generic-gpio-7seg"; + segment-gpios = <&gpio 0 GPIO_ACTIVE_LOW + &gpio 1 GPIO_ACTIVE_LOW + &gpio 2 GPIO_ACTIVE_LOW + &gpio 3 GPIO_ACTIVE_LOW + &gpio 4 GPIO_ACTIVE_LOW + &gpio 5 GPIO_ACTIVE_LOW + &gpio 6 GPIO_ACTIVE_LOW>; + };