Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1320665rdb; Mon, 2 Oct 2023 06:17:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtmMMEvPBJabDou02PGdO6YGzfpESq2crqvfgjmhHgSNoa7RerJal6xU+2EuUMk5Jn4jBW X-Received: by 2002:a17:90b:3ec7:b0:268:2658:3b01 with SMTP id rm7-20020a17090b3ec700b0026826583b01mr8923730pjb.39.1696252668319; Mon, 02 Oct 2023 06:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696252668; cv=none; d=google.com; s=arc-20160816; b=LBkknD/sCZO2hU6CTl0OW+A/XZXDNwR9DXPFOItVBZMz/ZvmCOC9y/keyp5y6Q/j/K ITxXtYz61KXlBvPr8vsPPEHLYV/DDB6bWqrSJxRZBpegmGNdkXhjPoIcGg8Qn7DjiF6J VJQgevxUzLSILLhNjA32vFdO0Px2YosIDU/qG9HggAtU0rXjeF8Sp8WDl/GuYU419yEP qXNTOUj3f+91HhkvEtrzSUxbf+jwMt92nDIo4qiVVlJw1MKZHifafggWeAJd3HxDuPuy 2LMBwPMvwbO6urJ8qREKTyhaAbqd+OgGhrjuF4UtGKIk1KYwmn0nEHUG0sg1GBnkSX1c SeSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=u+VAUc4E+Y21AdLpQo4ZI38h7A9OH7Ux8a8Ek8zfCE8=; fh=bD0irRExCR9U/CdLuI02LRr7jOWxzGkti19Icxfbv34=; b=ZwbnJazxHnrjQtco8z7ZHMjEOWRWBZMGVzjnnyXBJ7AO4VJSniI2mn4jAiS5GaRKYP CMFQnbZ/+n45zCd8S2Gqq2JTJlt2PV3Ih5UORruciIton/0TdG39gOUrYxnqHiSsky/z 36ru2WjaQbqPVflgorZI5rdteDPIvxwdMPYMuFWJTzbTiE8OrgvvKZ1vkghTdo1WrXjb 0NcNIJzAUB/QvClJdjWZ7kX//lDf4PL+Yp/8ctc+DEYAwtwIizeOleHG6lLO9Ao/ENf4 lcQZR8if6enq90V7VXCoGBiL/aoJeDqFh+zPqf0GywtrfagNBp/a/DyQf8IKjbemkKMz T3Qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=qplXjsWH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id h1-20020a17090acf0100b0026d60f1627asi7622852pju.173.2023.10.02.06.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 06:17:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=qplXjsWH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4A697805F084; Mon, 2 Oct 2023 00:43:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235773AbjJBHnI (ORCPT + 99 others); Mon, 2 Oct 2023 03:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjJBHnH (ORCPT ); Mon, 2 Oct 2023 03:43:07 -0400 Received: from mail-ua1-x936.google.com (mail-ua1-x936.google.com [IPv6:2607:f8b0:4864:20::936]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45AEAB3 for ; Mon, 2 Oct 2023 00:43:04 -0700 (PDT) Received: by mail-ua1-x936.google.com with SMTP id a1e0cc1a2514c-7ab9488f2f0so6262784241.3 for ; Mon, 02 Oct 2023 00:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1696232583; x=1696837383; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=u+VAUc4E+Y21AdLpQo4ZI38h7A9OH7Ux8a8Ek8zfCE8=; b=qplXjsWHxVZXvDUoPJc+ruqcd/LRX1kKkgII1SKDn4FvThkhEGf2Lf+QfX+2O8ktTz 1MCoMyNWO3JAqO5k8gXrR2Z8fxyNdIypQmpF8NIAq77zRyi9mCnp2XJlzQbXXfKbYdyK fmNqkOT630jLVqHNOphKHctCSwPvlSMuaqV4ygHW7tGsLgYJZF+Johncih+QN79x0Dcz ztW90zVVfTG3md3HZ7jCWnhjwpjs/3lCqEV2PG+hwIm6IA6xnINdPFMssFMLDQH/lJzr /gdfzQrV57+EgAP0Tl/KlCUWQ6aXStJsA4IdA4bYCPbj9hrMkniMByf4dGRQaC/JQkVN oPIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696232583; x=1696837383; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u+VAUc4E+Y21AdLpQo4ZI38h7A9OH7Ux8a8Ek8zfCE8=; b=tLuDaBvazDMV76Mwe1vZeMMWT9IWUA8DUMiWNXPSAH5V0dMYruQenlsMDyiV4wcCeC qjoibobfwnxPOns0pNqUsdL3vzxqKOECTNkp95Z0yhBe3BAtAAwI+kR0kgf8X5SSdm1y MP/UYLWkSqdZqAQiXgz05HAQCagiHMruNsGmgqC/jwjUdUe5AlghpAL/rKdhlOZ0hbb2 3rB02tgS2aoHEYRlsMIjjh4vLKKOk37LPDqtsLTye4YEi8nxTV2Ixy1dMFBIlqZ3ZgAS taPtvpH3EkdUu3pDEjQaw7a3PaFKQYAsSTj+VBLKdRlEUImwBvStoOF5/TBMDzAXsDOb zHug== X-Gm-Message-State: AOJu0YzCuYmSWNmEKLwf2rBaoLKadG+9u5EaO3h6++qdK+DUDZEF9HcY pTbnau82wE8edHltKClDJmx0O8otU76Vp+jf1JVjTw== X-Received: by 2002:a67:cfc6:0:b0:452:7795:7c93 with SMTP id h6-20020a67cfc6000000b0045277957c93mr9731589vsm.29.1696232583363; Mon, 02 Oct 2023 00:43:03 -0700 (PDT) MIME-Version: 1.0 References: <20231001-pxa-gpio-v4-0-0f3b975e6ed5@skole.hr> <20231001-pxa-gpio-v4-5-0f3b975e6ed5@skole.hr> In-Reply-To: <20231001-pxa-gpio-v4-5-0f3b975e6ed5@skole.hr> From: Bartosz Golaszewski Date: Mon, 2 Oct 2023 09:42:52 +0200 Message-ID: Subject: Re: [PATCH RFC v4 5/6] ARM: pxa: Convert gumstix Bluetooth to GPIO descriptors To: =?UTF-8?Q?Duje_Mihanovi=C4=87?= Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Alan Stern , Greg Kroah-Hartman , Linus Walleij , Andy Shevchenko , Dmitry Torokhov , Mark Brown , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, linux-input@vger.kernel.org, linux-spi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 00:43:13 -0700 (PDT) On Sun, Oct 1, 2023 at 4:13=E2=80=AFPM Duje Mihanovi=C4=87 wrote: > > Gumstix still uses the legacy GPIO interface for resetting the Bluetooth > device. > > Convert it to use the GPIO descriptor interface. > > Reviewed-by: Linus Walleij > Signed-off-by: Duje Mihanovi=C4=87 > --- > arch/arm/mach-pxa/gumstix.c | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) > > diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c > index c9f0f62187bd..14e1b9274d7a 100644 > --- a/arch/arm/mach-pxa/gumstix.c > +++ b/arch/arm/mach-pxa/gumstix.c > @@ -20,8 +20,8 @@ > #include > #include > #include > +#include > #include > -#include > #include > #include > > @@ -129,6 +129,9 @@ static void gumstix_udc_init(void) > #endif > > #ifdef CONFIG_BT > +GPIO_LOOKUP_SINGLE(gumstix_bt_gpio_table, "pxa2xx-uart.1", "pxa-gpio", > + GPIO_GUMSTIX_BTRESET, "BTRST", GPIO_ACTIVE_LOW); > + > /* Normally, the bootloader would have enabled this 32kHz clock but many > ** boards still have u-boot 1.1.4 so we check if it has been turned on a= nd > ** if not, we turn it on with a warning message. */ > @@ -153,24 +156,23 @@ static void gumstix_setup_bt_clock(void) > > static void __init gumstix_bluetooth_init(void) > { > - int err; > + struct gpio_desc *desc; > + > + gpiod_add_lookup_table(&gumstix_bt_gpio_table); > > gumstix_setup_bt_clock(); > > - err =3D gpio_request(GPIO_GUMSTIX_BTRESET, "BTRST"); > - if (err) { > + desc =3D gpiod_get(&pxa_device_btuart.dev, "BTRST", GPIOD_OUT_HIG= H); > + if (IS_ERR(desc)) { > pr_err("gumstix: failed request gpio for bluetooth reset\= n"); > return; > } > > - err =3D gpio_direction_output(GPIO_GUMSTIX_BTRESET, 1); > - if (err) { > - pr_err("gumstix: can't reset bluetooth\n"); > - return; > - } > - gpio_set_value(GPIO_GUMSTIX_BTRESET, 0); > + gpiod_set_value(desc, 0); > udelay(100); > - gpio_set_value(GPIO_GUMSTIX_BTRESET, 1); > + gpiod_set_value(desc, 1); > + > + gpiod_put(desc); This changes the way this code works. You release the descriptor here, it returns to the driver and can be re-requested by someone else. Its value is also not guaranteed to remain as "active". Is this what you want? Bart > } > #else > static void gumstix_bluetooth_init(void) > > -- > 2.42.0 > >