[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230315004453.sxzqccyozvsfp374@skbuf>
Date: Wed, 15 Mar 2023 02:44:53 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
Gregory Clement <gregory.clement@...tlin.com>,
Sebastian Hesselbarth <sebastian.hesselbarth@...il.com>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
John Crispin <john@...ozen.org>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, Lee Jones <lee@...nel.org>,
linux-leds@...r.kernel.org
Subject: Re: [net-next PATCH v3 06/14] net: phy: marvell: Add software
control of the LEDs
On Tue, Mar 14, 2023 at 11:15:08AM +0100, Christian Marangi wrote:
> From: Andrew Lunn <andrew@...n.ch>
>
> Add a brightness function, so the LEDs can be controlled from
> software using the standard Linux LED infrastructure.
>
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> Signed-off-by: Christian Marangi <ansuelsmth@...il.com>
> ---
> +static int m88e1318_led_brightness_set(struct phy_device *phydev,
> + u32 index, enum led_brightness value)
> +{
> + u16 reg;
> +
> + reg = phy_read_paged(phydev, MII_MARVELL_LED_PAGE,
> + MII_88E1318S_PHY_LED_FUNC);
> + if (reg < 0)
> + return reg;
"reg" is declared as unsigned, so it's surely positive.
> +
> + switch (index) {
> + case 0:
> + case 1:
> + case 2:
> + reg &= ~(0xf << (4 * index));
> + if (value == LED_OFF)
> + reg |= MII_88E1318S_PHY_LED_FUNC_OFF << (4 * index);
> + else
> + reg |= MII_88E1318S_PHY_LED_FUNC_ON << (4 * index);
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + return phy_write_paged(phydev, MII_MARVELL_LED_PAGE,
> + MII_88E1318S_PHY_LED_FUNC, reg);
> +}
Powered by blists - more mailing lists