Message ID | 20221117090130.51702-1-antoniu.miclaus@analog.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp292093wrr; Thu, 17 Nov 2022 01:07:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf7mpTMcECebn/yqe0DN9a1POjFq1t+c3kbLjAjfQ4EFXhvG2NN/GyGNRaclMTkNBGq6Uo6G X-Received: by 2002:a05:6402:43c7:b0:468:cd3a:4493 with SMTP id p7-20020a05640243c700b00468cd3a4493mr885731edc.309.1668676030373; Thu, 17 Nov 2022 01:07:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668676030; cv=none; d=google.com; s=arc-20160816; b=tWeijec7AOGuuzyQGQhMoA5q26zLULmx/4o3TLoYH3r/ab9NWwCor2fvaSr34GO6dv UY4HeAI9pDVhJHYN7/OPNoXWU7wVVJMG4w+xJwMunfQM4514bhkhvWTS3+d3Vk7zckz3 84RcyTG2zdycUH8ltIkSeDEZttJU9b4dBjLgYJhXLMAITHi7pnaRi8JtjdyxzAALrgyg IAn6W3/pVdERc7oAQSqjDNyxPztOzeyMpK5ad08LLS13ngfbz/y7iNGJZX+MTqjejQUu unzQ5tRisgrQ+7fRHqHwCD0lSbfVhkjPiFljH/SNDVCJ9DriUU0t9D+0xlsdj+Ax1Jix qjbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=89XzHh2+s9fZyaVZ2k2zyIPSczNreXwdEWHrkXYXtPQ=; b=ZZw+oR8kDHPVaiP1k1AUiTYpzDMOqbqm5Gb5NKVg2ptbrnAVTAMIAynn3m8heW5Gn/ 7gXnxuxKdcSbJWNoh2x+rELDpsDCljs4jttQbrEOJ2G9is/yYEwjbckNcIav+Y/VrgEB ZZ3BC7cd3VvhKibwvutrnZCfOEPbZhdIR4mE1c0WHXrW654mp8PG4YtCUMvA/T4I0HHe hTAGc0U4I86sULAtKtpZBVXs1OJTYeV4d18IJlqMOmnsj3qT5yRJsB1Ne33Ko+kkfj14 rA4Qtc9rbfaYaHcjJuXIFfOU3m3/83Y8J3XJs/GkDaNeDMMRmP8q5Sc2LhRriQUcph1H x2zQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m10-20020a056402430a00b0045c98bb5359si468278edc.590.2022.11.17.01.06.47; Thu, 17 Nov 2022 01:07:10 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=analog.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239268AbiKQJCC (ORCPT <rfc822;just.gull.subs@gmail.com> + 99 others); Thu, 17 Nov 2022 04:02:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239439AbiKQJB5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 17 Nov 2022 04:01:57 -0500 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6187559149; Thu, 17 Nov 2022 01:01:56 -0800 (PST) Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AH7n6nY003733; Thu, 17 Nov 2022 04:01:51 -0500 Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 3kwgw4rg03-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Nov 2022 04:01:50 -0500 Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 2AH91nBH004105 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 17 Nov 2022 04:01:49 -0500 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Thu, 17 Nov 2022 04:01:48 -0500 Received: from ASHBMBX9.ad.analog.com (10.64.17.10) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.14; Thu, 17 Nov 2022 04:01:48 -0500 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server id 15.2.986.14 via Frontend Transport; Thu, 17 Nov 2022 04:01:48 -0500 Received: from amiclaus-VirtualBox.ad.analog.com (AMICLAUS-L02.ad.analog.com [10.48.65.121]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 2AH91dQM020374; Thu, 17 Nov 2022 04:01:41 -0500 From: Antoniu Miclaus <antoniu.miclaus@analog.com> To: <jic23@kernel.org>, <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: Antoniu Miclaus <antoniu.miclaus@analog.com> Subject: [PATCH] drivers: iio: dac: ad5592r: add gpio_chip names Date: Thu, 17 Nov 2022 11:01:30 +0200 Message-ID: <20221117090130.51702-1-antoniu.miclaus@analog.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: jZc6A2xlq7rdUNNqwykqQIO3WcUtfw65 X-Proofpoint-ORIG-GUID: jZc6A2xlq7rdUNNqwykqQIO3WcUtfw65 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-17_04,2022-11-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 malwarescore=0 impostorscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 priorityscore=1501 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211170068 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS 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?1749733636922766502?= X-GMAIL-MSGID: =?utf-8?q?1749733636922766502?= |
Series |
drivers: iio: dac: ad5592r: add gpio_chip names
|
|
Commit Message
Antoniu Miclaus
Nov. 17, 2022, 9:01 a.m. UTC
Add array of explicit gpio names for the `gpiochip` structure of
ad5592r, mainly for debug purposes.
Since the gpios are configurable via the dts, generic names are
used.
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
drivers/iio/dac/ad5592r-base.c | 5 +++++
1 file changed, 5 insertions(+)
Comments
On Thu, 17 Nov 2022 11:01:30 +0200 Antoniu Miclaus <antoniu.miclaus@analog.com> wrote: > Add array of explicit gpio names for the `gpiochip` structure of > ad5592r, mainly for debug purposes. Can you give an example of when this is more useful than the offset? (which I'm assuming is also available when debugging?) Jonathan > > Since the gpios are configurable via the dts, generic names are > used. > > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> > --- > drivers/iio/dac/ad5592r-base.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c > index 7a9b5fc1e579..076bc9ecfb49 100644 > --- a/drivers/iio/dac/ad5592r-base.c > +++ b/drivers/iio/dac/ad5592r-base.c > @@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip *chip, unsigned offset) > return 0; > } > > +static const char * const ad5592r_gpio_names[] = { > + "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6", "GPIO7", > +}; > + > static int ad5592r_gpio_init(struct ad5592r_state *st) > { > if (!st->gpio_map) > @@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state *st) > st->gpiochip.set = ad5592r_gpio_set; > st->gpiochip.request = ad5592r_gpio_request; > st->gpiochip.owner = THIS_MODULE; > + st->gpiochip.names = ad5592r_gpio_names; > > mutex_init(&st->gpio_lock); >
On Wed, 23 Nov 2022 20:48:32 +0000 Jonathan Cameron <jic23@kernel.org> wrote: > On Thu, 17 Nov 2022 11:01:30 +0200 > Antoniu Miclaus <antoniu.miclaus@analog.com> wrote: > > > Add array of explicit gpio names for the `gpiochip` structure of > > ad5592r, mainly for debug purposes. > Can you give an example of when this is more useful than the offset? > (which I'm assuming is also available when debugging?) > > Jonathan This one is still outstanding in patchwork. Antoniu, if you want this to be applied please address the question above. Thanks, Jonathan > > > > > Since the gpios are configurable via the dts, generic names are > > used. > > > > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> > > --- > > drivers/iio/dac/ad5592r-base.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c > > index 7a9b5fc1e579..076bc9ecfb49 100644 > > --- a/drivers/iio/dac/ad5592r-base.c > > +++ b/drivers/iio/dac/ad5592r-base.c > > @@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip *chip, unsigned offset) > > return 0; > > } > > > > +static const char * const ad5592r_gpio_names[] = { > > + "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6", "GPIO7", > > +}; > > + > > static int ad5592r_gpio_init(struct ad5592r_state *st) > > { > > if (!st->gpio_map) > > @@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state *st) > > st->gpiochip.set = ad5592r_gpio_set; > > st->gpiochip.request = ad5592r_gpio_request; > > st->gpiochip.owner = THIS_MODULE; > > + st->gpiochip.names = ad5592r_gpio_names; > > > > mutex_init(&st->gpio_lock); > > >
-- Antoniu Miclăuş > -----Original Message----- > From: Jonathan Cameron <jic23@kernel.org> > Sent: Wednesday, November 23, 2022 10:49 PM > To: Miclaus, Antoniu <Antoniu.Miclaus@analog.com> > Cc: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] drivers: iio: dac: ad5592r: add gpio_chip names > > [External] > > On Thu, 17 Nov 2022 11:01:30 +0200 > Antoniu Miclaus <antoniu.miclaus@analog.com> wrote: > > > Add array of explicit gpio names for the `gpiochip` structure of > > ad5592r, mainly for debug purposes. > Can you give an example of when this is more useful than the offset? > (which I'm assuming is also available when debugging?) > > Jonathan > Hello Jonathan, I guess this patch is not mandatory. It is a gpio_chip structure member that was left unpopulated. Also, I think it is nice to see explicitly the gpios under cat /sys/kernel/debug/gpio alongside the others. This is the current output when trying to debug on a rpi (without the patch applied): analog@analog:~ $ sudo cat /sys/kernel/debug/gpio gpiochip0: GPIOs 0-57, parent: platform/fe200000.gpio, pinctrl-bcm2711: gpio-0 (ID_SDA ) gpio-1 (ID_SCL ) gpio-2 (SDA1 ) gpio-3 (SCL1 ) gpio-4 (GPIO_GCLK ) gpio-5 (GPIO5 ) gpio-6 (GPIO6 ) .... gpiochip2: GPIOs 496-503, parent: spi/spi0.0, spi0.0, can sleep: gpiochip1: GPIOs 504-511, parent: platform/soc:firmware:gpio, raspberrypi-exp-gpio, can sleep: gpio-504 (BT_ON ) gpio-505 (WL_ON ) gpio-506 (PWR_LED_OFF |led1 ) out lo ACTIVE LOW gpio-507 (GLOBAL_RESET ) gpio-508 (VDD_SD_IO_SEL |vdd-sd-io ) out hi gpio-509 (CAM_GPIO |power_ctrl ) out lo gpio-510 (SD_PWR_ON |sd_vcc_reg ) out hi gpio-511 (SD_OC_N ) The gpiochip2, corresponding to ad5592r has no explicit gpios, due to the fact that the gpio names were assigned. Regards, > > > > Since the gpios are configurable via the dts, generic names are > > used. > > > > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> > > --- > > drivers/iio/dac/ad5592r-base.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c > > index 7a9b5fc1e579..076bc9ecfb49 100644 > > --- a/drivers/iio/dac/ad5592r-base.c > > +++ b/drivers/iio/dac/ad5592r-base.c > > @@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip > *chip, unsigned offset) > > return 0; > > } > > > > +static const char * const ad5592r_gpio_names[] = { > > + "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6", > "GPIO7", > > +}; > > + > > static int ad5592r_gpio_init(struct ad5592r_state *st) > > { > > if (!st->gpio_map) > > @@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state > *st) > > st->gpiochip.set = ad5592r_gpio_set; > > st->gpiochip.request = ad5592r_gpio_request; > > st->gpiochip.owner = THIS_MODULE; > > + st->gpiochip.names = ad5592r_gpio_names; > > > > mutex_init(&st->gpio_lock); > >
On Wed, 1 Feb 2023 13:11:30 +0000 "Miclaus, Antoniu" <Antoniu.Miclaus@analog.com> wrote: > -- > Antoniu Miclăuş > > > -----Original Message----- > > From: Jonathan Cameron <jic23@kernel.org> > > Sent: Wednesday, November 23, 2022 10:49 PM > > To: Miclaus, Antoniu <Antoniu.Miclaus@analog.com> > > Cc: linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: Re: [PATCH] drivers: iio: dac: ad5592r: add gpio_chip names > > > > [External] > > > > On Thu, 17 Nov 2022 11:01:30 +0200 > > Antoniu Miclaus <antoniu.miclaus@analog.com> wrote: > > > > > Add array of explicit gpio names for the `gpiochip` structure of > > > ad5592r, mainly for debug purposes. > > Can you give an example of when this is more useful than the offset? > > (which I'm assuming is also available when debugging?) > > > > Jonathan > > > Hello Jonathan, > > I guess this patch is not mandatory. It is a gpio_chip structure member that was left unpopulated. > Also, I think it is nice to see explicitly the gpios under cat /sys/kernel/debug/gpio alongside the others. > This is the current output when trying to debug on a rpi (without the patch applied): > > analog@analog:~ $ sudo cat /sys/kernel/debug/gpio > gpiochip0: GPIOs 0-57, parent: platform/fe200000.gpio, pinctrl-bcm2711: > gpio-0 (ID_SDA ) > gpio-1 (ID_SCL ) > gpio-2 (SDA1 ) > gpio-3 (SCL1 ) > gpio-4 (GPIO_GCLK ) > gpio-5 (GPIO5 ) > gpio-6 (GPIO6 ) > .... > gpiochip2: GPIOs 496-503, parent: spi/spi0.0, spi0.0, can sleep: > > gpiochip1: GPIOs 504-511, parent: platform/soc:firmware:gpio, raspberrypi-exp-gpio, can sleep: > gpio-504 (BT_ON ) > gpio-505 (WL_ON ) > gpio-506 (PWR_LED_OFF |led1 ) out lo ACTIVE LOW > gpio-507 (GLOBAL_RESET ) > gpio-508 (VDD_SD_IO_SEL |vdd-sd-io ) out hi > gpio-509 (CAM_GPIO |power_ctrl ) out lo > gpio-510 (SD_PWR_ON |sd_vcc_reg ) out hi > gpio-511 (SD_OC_N ) > > The gpiochip2, corresponding to ad5592r has no explicit gpios, due to the fact that the > gpio names were assigned. Thanks for the info. Applied to the togreg branch of iio.git and pushed out as testing for 0-day to poke at it an see if we missed anything. We are a bit tight timing wise, so this might end up in next cycle. Jonathan > > Regards, > > > > > > Since the gpios are configurable via the dts, generic names are > > > used. > > > > > > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> > > > --- > > > drivers/iio/dac/ad5592r-base.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c > > > index 7a9b5fc1e579..076bc9ecfb49 100644 > > > --- a/drivers/iio/dac/ad5592r-base.c > > > +++ b/drivers/iio/dac/ad5592r-base.c > > > @@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip > > *chip, unsigned offset) > > > return 0; > > > } > > > > > > +static const char * const ad5592r_gpio_names[] = { > > > + "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6", > > "GPIO7", > > > +}; > > > + > > > static int ad5592r_gpio_init(struct ad5592r_state *st) > > > { > > > if (!st->gpio_map) > > > @@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state > > *st) > > > st->gpiochip.set = ad5592r_gpio_set; > > > st->gpiochip.request = ad5592r_gpio_request; > > > st->gpiochip.owner = THIS_MODULE; > > > + st->gpiochip.names = ad5592r_gpio_names; > > > > > > mutex_init(&st->gpio_lock); > > > >
diff --git a/drivers/iio/dac/ad5592r-base.c b/drivers/iio/dac/ad5592r-base.c index 7a9b5fc1e579..076bc9ecfb49 100644 --- a/drivers/iio/dac/ad5592r-base.c +++ b/drivers/iio/dac/ad5592r-base.c @@ -124,6 +124,10 @@ static int ad5592r_gpio_request(struct gpio_chip *chip, unsigned offset) return 0; } +static const char * const ad5592r_gpio_names[] = { + "GPIO0", "GPIO1", "GPIO2", "GPIO3", "GPIO4", "GPIO5", "GPIO6", "GPIO7", +}; + static int ad5592r_gpio_init(struct ad5592r_state *st) { if (!st->gpio_map) @@ -140,6 +144,7 @@ static int ad5592r_gpio_init(struct ad5592r_state *st) st->gpiochip.set = ad5592r_gpio_set; st->gpiochip.request = ad5592r_gpio_request; st->gpiochip.owner = THIS_MODULE; + st->gpiochip.names = ad5592r_gpio_names; mutex_init(&st->gpio_lock);