From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C71EC47073 for ; Thu, 4 Jan 2024 21:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eLjJhLpuVs/3k0Y79M4xPnTkGoL49hYiJfrDjbG38Wg=; b=DcNluGUy79wZ18 yK0Q7YxVOzFsueowjo8ioqbs4GwIcaIcK2mFbWGNyApFQ4rdgEqKCtOAXpOmbD7hBXTLzl/Aqnf4O BqECqFRTHR1F83HpTQS4pVPf6SJvuiXq3bzQKIesvxVoFTujHKlp3zv8fwXQgkocAvUCV9P9M2ncc dbtvmnqt72APmXSIYNbVCLMcjhpzcxfagvNzqerAa+PFrBMqB838s2nngjhLsxsTAQkJfDDcjU3AP k6nWUwhCOqCg1W8JkwtvI+/EfckmO7pkYg1QBqYVPTKbYJKFV/OObG5ss4YfhP/oGf/fuGg0s13/a EytZ1dpjrSeRtM4bTj8w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLVcw-00FITg-1U; Thu, 04 Jan 2024 21:51:46 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rLVct-00FITA-0q for linux-arm-kernel@lists.infradead.org; Thu, 04 Jan 2024 21:51:44 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40d4a7f0c4dso9596455e9.1 for ; Thu, 04 Jan 2024 13:51:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704405101; x=1705009901; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=Bas+YdPjRljGtlJX4ssRIxTCAw0axobXiWVL+eDf96Y=; b=BcJDA3+anTu0397gM9E1ktc0o69UwMNYdkjjIZrirLFjbQ/GzUrGfv8Ot317kXUnJA T7aM/+/VkBtA8tHw+PNsGXlZZC8zJjVasRNF0zzTMGAizgDYOS4B6p3QqipDR8inKlOi N3K4ASADlYno8Esr+W2VmHPltvwazmEk4FFDb8zznX1YKlbr/iGZs0YBOTHjRywHfAL5 s8l6PpUB39C41hJtzFFMCvxI8OcoDHjit25VRpFqbLZU8f+tTLAvBjoLgKGTiox5CV9/ DLZ53vHl88j8rxBoAgwys2wd7EldBK9vWKk5F/PTab55JE8jmzMNRKP1SO702Zt04w5i 0bqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704405101; x=1705009901; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Bas+YdPjRljGtlJX4ssRIxTCAw0axobXiWVL+eDf96Y=; b=vC3AnMkHwCXGW0aRlMRnc5MxVOkXEMGen+tHvcKue1FjlfBcwyTIBXkUJbXx4zC6m5 KWK6WIU/di/sy4k6tforeo2rho05EirsFxR6QBUoK060uW+dkPH7CfHDBaZjEyHlThD0 9tcMTNY4ywtL5dcYo4Q/Wb01PfiRIA2MW3cUdkq5azPJjO4m+X53F80DJR+3VMBYpLqU IB++BCeryAlTl2SXNApxtlOUIOK5NDbcnRlxThR+cQ0Y+ZkZC6v2NjkiCVWUVOy270jr 3vvUuya9a60yY076wQ4vUFI7ABoa3RojnPzuwD8x2dYdeAJjF7YQPyRYqq0QHNHLp9k6 ZB5w== X-Gm-Message-State: AOJu0Yy6j/jQfuoFOv0zNruArYCT8xzvkK+8eh/wj4NPXKu8cFCNeB1S oOzAhKif1Uz+N1ySoSSFxNc= X-Google-Smtp-Source: AGHT+IHZyjHBUN0jDo/92RJRPvzGHGPyqBLjQ4NZE1nxbAPYeJtwdJ1AmotGhClp5OzXnm8VlOE/Fg== X-Received: by 2002:a05:600c:3acd:b0:40d:5b0d:b105 with SMTP id d13-20020a05600c3acd00b0040d5b0db105mr754745wms.117.1704405101029; Thu, 04 Jan 2024 13:51:41 -0800 (PST) Received: from Ansuel-xps. (host-80-116-159-187.pool80116.interbusiness.it. [80.116.159.187]) by smtp.gmail.com with ESMTPSA id u18-20020a05600c139200b0040d5ae2905asm426374wmf.30.2024.01.04.13.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 13:51:40 -0800 (PST) Message-ID: <6597286c.050a0220.4684a.182e@mx.google.com> X-Google-Original-Message-ID: Date: Thu, 4 Jan 2024 22:42:23 +0100 From: Christian Marangi To: Andrew Lunn Cc: Pavel Machek , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , William Zhang , Anand Gore , Kursad Oney , Florian Fainelli , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , Broadcom internal kernel review list , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King , Jacek Anaszewski , =?iso-8859-1?Q?Fern=E1ndez?= Rojas , Sven Schwermer , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Subject: Re: [net-next PATCH v8 3/5] net: phy: add support for PHY LEDs polarity modes References: <20240104110114.2020-1-ansuelsmth@gmail.com> <20240104110114.2020-4-ansuelsmth@gmail.com> <47f18def-d34f-4224-9de2-6e0ae7122a52@lunn.ch> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <47f18def-d34f-4224-9de2-6e0ae7122a52@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240104_135143_323634_AB4F6DC6 X-CRM114-Status: GOOD ( 21.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jan 04, 2024 at 02:20:45PM +0100, Andrew Lunn wrote: > > + if (phydev->drv->led_polarity_set) { > > + if (of_property_read_bool(led, "active-low")) > > + set_bit(PHY_LED_ACTIVE_LOW, &modes); > > + if (of_property_read_bool(led, "inactive-high-impedance")) > > + set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes); > > + > > + err = phydev->drv->led_polarity_set(phydev, index, modes); > > + if (err) > > + return err; > > + } > > I think we should return an error if asked to set the mode, but its > not implemented by the driver. Something like: > > if (of_property_read_bool(led, "active-low")) > set_bit(PHY_LED_ACTIVE_LOW, &modes); > if (of_property_read_bool(led, "inactive-high-impedance")) > set_bit(PHY_LED_INACTIVE_HIGH_IMPEDANCE, &modes); > > > if (mode) > if (phydev->drv->led_polarity_set) { > return -EINVAL; > } else { > err = phydev->drv->led_polarity_set(phydev, index, modes); > if (err) > return err; > } > } > > > + /** > > + * @led_polarity_set: Set the LED polarity if active low > > The 'if active low' is not ouw of date, since it is used for more than > that. > > > + * @dev: PHY device which has the LED > > + * @index: Which LED of the PHY device or -1 > > + * @modes: bitmap of LED polarity modes > > + * > > + * Configure LED with all the required polarity modes in @modes > > + * to make it correctly turn ON or OFF. > > index == -1 should be explained. > If you are referring to the special way of setting the LED globally, that is not a thing anymore. Rob pointed out that having the double reference in DT is problematic and PHY driver should handle that internally. > > + * > > + * Returns 0, or an error code. > > + */ > > + int (*led_polarity_set)(struct phy_device *dev, int index, > > + unsigned long modes); > > > Andrew > > --- > pw-bot: cr -- Ansuel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel