Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4609383rdb; Fri, 15 Sep 2023 07:21:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiAP3uV5kI7tLkAIqj6HTPgpMZaEx/lJ8VDC/v/3XZ7lULJpq/ZTZM+GJdDp0xn9iYu6sI X-Received: by 2002:a05:6a21:47c6:b0:140:a25:1c1d with SMTP id as6-20020a056a2147c600b001400a251c1dmr1751961pzc.51.1694787672216; Fri, 15 Sep 2023 07:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694787672; cv=none; d=google.com; s=arc-20160816; b=jtcG7ZNV502VQRxBQUBfzj45TRlYa5pIeZOSnScCdhH2V1lpw/JZv7OR5LtYHYjRJL fPxWM+Z2aC94lJO0NfX+QTJn6IS0528gX2DET6743CiYbpWbJYmW+2YTk9QULKIOPhxF oaSQdcrtBYdKFun2sH8+/V5HEHT4NvcyP+oWbOrGYPxlH9Vog7zFVyN4JswNi3wlvWcN qdA/J7jHlRjisYjhnT38ECv+41BldNgSUyRjrccp409FGaXSMm84OkDg50ecT5Us4By+ sCvgPItip/CR4gBNkcUot5cRDgAInfcSwEVMogOQNyQ0WSpfTxsb52TYejhrtFGbQjf/ Vx8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bcC+3d6nREseLnXm3tJm4zKoTUyggXQ4BhmuTN3mAIg=; fh=2npxsdirJnDAqhuyPPDX+JWYwKUA4f6QPrNKDfKzDQQ=; b=SVbLtzLAdjEAIaP++7NB2dWkIBoyjAAFYETh4aI09mOofNRCjKJW0x5gH9vqthJ4/I j4QrBzajWK6Rag4iSfshW3JBrGBbcadAYGyPG3EY6M674mRZ8/W6pvPs0b7Y88pVRlPW dGHdecpPfYaniOLDWkIaMPje56Zeb2kl3P0tfHegulcCixWHutMF9zjeQ8FF18ujJXIO GlzkJaumgrmw+JR8gsPw84bCFeE8W6TgySqIN+6DLhE9JGD0PgRpc9QlLHfPbwgFxb5X 3z0/ddhixJuNolxGHU2YQuczpKwahF0y+nz1yWClahv42q2UI8vrr+aAtugZPCMG5KCv HBHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FM8atK66; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id bk13-20020a056a02028d00b005654b3ead4bsi3239295pgb.402.2023.09.15.07.21.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 07:21:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FM8atK66; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id AC3638197053; Fri, 15 Sep 2023 07:16:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235633AbjIOOQA (ORCPT + 99 others); Fri, 15 Sep 2023 10:16:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235554AbjIOOP4 (ORCPT ); Fri, 15 Sep 2023 10:15:56 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E401FC9; Fri, 15 Sep 2023 07:15:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B571FC433C8; Fri, 15 Sep 2023 14:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694787351; bh=my7q6sWI3MWvt71tahat6xPgVNItmOGSgwXOtqEbLN4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FM8atK66YrwtjpT6e4y1aWjUIbsW7QcwMS7pm+LJ+lh/kVjGaMsgGFzE+mYQM6hJe JAREwNP86xIWJkQfKx5mUg9Rm1J8ux7vW/MjB9VSR27IinDmgr3o6zy0bLiWcqkgvh t6yZyfQzbJmxz0fVhkp6clm32eHfFI0AvQaYpQXI/3HKeE7mNlbF1xoCkSUY7QfulV jmumv1kU1tZXX3uP2x3NenkiZoZJ8Eb8J50S/81r2DerHhMciDSsC+siN0uL7+6vNy Qp0mxkqp1o/SAB9goZ6YaK21v5qC/UXs+JhjPMfcAxpgOGS9SKFkdVLp9ex/hu9LQB w+2G2jsvL54Vg== Received: (nullmailer pid 3664536 invoked by uid 1000); Fri, 15 Sep 2023 14:15:49 -0000 Date: Fri, 15 Sep 2023 09:15:49 -0500 From: Rob Herring To: Linus Walleij Cc: Jan =?iso-8859-1?Q?Kundr=E1t?= , Pavel Machek , Lee Jones , Krzysztof Kozlowski , Conor Dooley , Jacek Anaszewski , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] leds: triggers: gpio: Rewrite to use trigger-sources Message-ID: <20230915141549.GA3658872-robh@kernel.org> References: <20230912-gpio-led-trigger-dt-v1-0-1b50e3756dda@linaro.org> <20230912-gpio-led-trigger-dt-v1-2-1b50e3756dda@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230912-gpio-led-trigger-dt-v1-2-1b50e3756dda@linaro.org> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email 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 (agentk.vger.email [0.0.0.0]); Fri, 15 Sep 2023 07:16:12 -0700 (PDT) On Tue, Sep 12, 2023 at 03:44:31PM +0200, Linus Walleij wrote: > By providing a GPIO line as "trigger-sources" in the FWNODE > (such as from the device tree) and combining with the > GPIO trigger, we can support a GPIO LED trigger in a natural > way from the hardware description instead of using the > custom sysfs and deprecated global GPIO numberspace. > > Example: > > gpio: gpio@0 { > compatible "my-gpio"; > gpio-controller; > #gpio-cells = <2>; > interrupt-controller; > #interrupt-cells = <2>; > #trigger-source-cells = <2>; > }; > > leds { > compatible = "gpio-leds"; > led-my-gpio { > label = "device:blue:myled"; > gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; > default-state = "off"; > linux,default-trigger = "gpio"; > trigger-sources = <&gpio 1 GPIO_ACTIVE_HIGH>; > }; > }; > > Make this the norm, unmark the driver as broken. > > Delete the sysfs handling of GPIOs. > > Since GPIO descriptors inherently can describe inversion, > the inversion handling can just be deleted. > > Signed-off-by: Linus Walleij > --- [...] > @@ -167,16 +78,47 @@ ATTRIBUTE_GROUPS(gpio_trig); > static int gpio_trig_activate(struct led_classdev *led) > { > struct gpio_trig_data *gpio_data; > + struct device *dev = led->dev; > + int ret; > > gpio_data = kzalloc(sizeof(*gpio_data), GFP_KERNEL); > if (!gpio_data) > return -ENOMEM; > > - gpio_data->led = led; > - gpio_data->gpio = -ENOENT; > + /* > + * The generic property "trigger-sources" is followed, > + * and we hope that this is a GPIO. > + */ > + gpio_data->gpiod = fwnode_gpiod_get_index(dev->fwnode, > + "trigger-sources", > + 0, GPIOD_IN, > + "led-trigger"); Isn't this going to look for "trigger-sources-gpio" and ""trigger-sources-gpios"? Rob