All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Kubiak <michal.kubiak@intel.com>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	Rob Herring <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Gregory Clement <gregory.clement@bootlin.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Andy Gross <agross@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>,
	John Crispin <john@phrozen.org>, <netdev@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-leds@vger.kernel.org>
Subject: Re: [net-next PATCH v5 02/15] net: dsa: qca8k: add LEDs basic support
Date: Mon, 20 Mar 2023 18:48:51 +0100	[thread overview]
Message-ID: <ZBicg28JwVLugzqz@localhost.localdomain> (raw)
In-Reply-To: <64188af6.050a0220.c5fe1.1d96@mx.google.com>

On Mon, Mar 20, 2023 at 05:33:56PM +0100, Christian Marangi wrote:
> 
> Btw ok for the description of the LED mapping? It's a bit complex so
> tried to do my best to describe them.
> 

Yes, now it is much easier to understand the logic behind LED mapping.
Thanks for adding that! I think it will save some time for anyone who
will be working with that code in the future.

The only thing I still do not understand is the initial 14 bit shift:

>	if (led->port_num == 0 || led->port_num == 4) {
>		mask = QCA8K_LED_PATTERN_EN_MASK;
>		val <<= QCA8K_LED_PATTERN_EN_SHIFT;

For example, according to the code above, for port 4:
	- the value is shifted by 14 bits - to bits (15,14)
	- mask is also set to bits (15,14)
	- then, both mask and value are shifted again by 16 bits:

>		return regmap_update_bits(priv->regmap, reg_info.reg,
>					  mask << reg_info.shift,
>					  val << reg_info.shift);

because reg_info.shift == QCA8K_LED_PHY4_CONTROL_RULE_SHIFT == 16 for
port_num == 4.

It means, in fact, for controlling port 4 we use bits (31,30) which
seems to be inconsistent with your comment below.

>	 * To control port 4:
>	 * - the 2 bit (17, 16) of:
>	 *   - QCA8K_LED_CTRL0_REG for led1
>	 *   - QCA8K_LED_CTRL1_REG for led2
>	 *   - QCA8K_LED_CTRL2_REG for led3
>	 *

Are values for ports 0 and 4 correct in your description in
"qca8k_led_brightness_set()"?

Thanks,
Michal

WARNING: multiple messages have this Message-ID (diff)
From: Michal Kubiak <michal.kubiak@intel.com>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	Rob Herring <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Gregory Clement <gregory.clement@bootlin.com>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Andy Gross <agross@kernel.org>,
	"Bjorn Andersson" <andersson@kernel.org>,
	Konrad Dybcio <konrad.dybcio@linaro.org>,
	Pavel Machek <pavel@ucw.cz>, Lee Jones <lee@kernel.org>,
	John Crispin <john@phrozen.org>, <netdev@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-arm-msm@vger.kernel.org>, <linux-leds@vger.kernel.org>
Subject: Re: [net-next PATCH v5 02/15] net: dsa: qca8k: add LEDs basic support
Date: Mon, 20 Mar 2023 18:48:51 +0100	[thread overview]
Message-ID: <ZBicg28JwVLugzqz@localhost.localdomain> (raw)
In-Reply-To: <64188af6.050a0220.c5fe1.1d96@mx.google.com>

On Mon, Mar 20, 2023 at 05:33:56PM +0100, Christian Marangi wrote:
> 
> Btw ok for the description of the LED mapping? It's a bit complex so
> tried to do my best to describe them.
> 

Yes, now it is much easier to understand the logic behind LED mapping.
Thanks for adding that! I think it will save some time for anyone who
will be working with that code in the future.

The only thing I still do not understand is the initial 14 bit shift:

>	if (led->port_num == 0 || led->port_num == 4) {
>		mask = QCA8K_LED_PATTERN_EN_MASK;
>		val <<= QCA8K_LED_PATTERN_EN_SHIFT;

For example, according to the code above, for port 4:
	- the value is shifted by 14 bits - to bits (15,14)
	- mask is also set to bits (15,14)
	- then, both mask and value are shifted again by 16 bits:

>		return regmap_update_bits(priv->regmap, reg_info.reg,
>					  mask << reg_info.shift,
>					  val << reg_info.shift);

because reg_info.shift == QCA8K_LED_PHY4_CONTROL_RULE_SHIFT == 16 for
port_num == 4.

It means, in fact, for controlling port 4 we use bits (31,30) which
seems to be inconsistent with your comment below.

>	 * To control port 4:
>	 * - the 2 bit (17, 16) of:
>	 *   - QCA8K_LED_CTRL0_REG for led1
>	 *   - QCA8K_LED_CTRL1_REG for led2
>	 *   - QCA8K_LED_CTRL2_REG for led3
>	 *

Are values for ports 0 and 4 correct in your description in
"qca8k_led_brightness_set()"?

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-03-20 17:56 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 19:17 [net-next PATCH v5 00/15] net: Add basic LED support for switch/phy Christian Marangi
2023-03-19 19:17 ` Christian Marangi
2023-03-19 19:18 ` [net-next PATCH v5 01/15] net: dsa: qca8k: move qca8k_port_to_phy() to header Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-20 16:32   ` Michal Kubiak
2023-03-20 16:32     ` Michal Kubiak
2023-03-19 19:18 ` [net-next PATCH v5 02/15] net: dsa: qca8k: add LEDs basic support Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-20 16:30   ` Michal Kubiak
2023-03-20 16:30     ` Michal Kubiak
2023-03-20 16:33     ` Christian Marangi
2023-03-20 16:33       ` Christian Marangi
2023-03-20 17:48       ` Michal Kubiak [this message]
2023-03-20 17:48         ` Michal Kubiak
2023-03-20 18:05         ` Christian Marangi
2023-03-20 18:05           ` Christian Marangi
2023-03-19 19:18 ` [net-next PATCH v5 03/15] net: dsa: qca8k: add LEDs blink_set() support Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-23 11:55   ` Pavel Machek
2023-03-23 11:55     ` Pavel Machek
2023-03-19 19:18 ` [net-next PATCH v5 04/15] leds: Provide stubs for when CLASS_LED is disabled Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-19 22:49   ` Andrew Lunn
2023-03-19 22:49     ` Andrew Lunn
2023-03-20 17:52     ` Christian Marangi
2023-03-20 17:52       ` Christian Marangi
2023-03-20 19:31       ` Andrew Lunn
2023-03-20 19:31         ` Andrew Lunn
2023-03-21  7:55         ` Christian Marangi
2023-03-21  7:55           ` Christian Marangi
2023-03-21 15:58           ` Andrew Lunn
2023-03-21 15:58             ` Andrew Lunn
2023-03-21 16:02           ` Andrew Lunn
2023-03-21 16:02             ` Andrew Lunn
2023-03-21 16:13             ` Christian Marangi
2023-03-21 16:13               ` Christian Marangi
2023-03-19 19:18 ` [net-next PATCH v5 05/15] net: phy: Add a binding for PHY LEDs Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-20 16:34   ` Michal Kubiak
2023-03-20 16:34     ` Michal Kubiak
2023-03-21 17:31   ` kernel test robot
2023-03-19 19:18 ` [net-next PATCH v5 06/15] net: phy: phy_device: Call into the PHY driver to set LED brightness Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-20 16:36   ` Michal Kubiak
2023-03-20 16:36     ` Michal Kubiak
2023-03-19 19:18 ` [net-next PATCH v5 07/15] net: phy: marvell: Add software control of the LEDs Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-23 11:55   ` Pavel Machek
2023-03-23 11:55     ` Pavel Machek
2023-03-19 19:18 ` [net-next PATCH v5 08/15] net: phy: phy_device: Call into the PHY driver to set LED blinking Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-23 11:56   ` Pavel Machek
2023-03-23 11:56     ` Pavel Machek
2023-03-19 19:18 ` [net-next PATCH v5 09/15] net: phy: marvell: Implement led_blink_set() Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-23 11:57   ` Pavel Machek
2023-03-23 11:57     ` Pavel Machek
2023-03-19 19:18 ` [net-next PATCH v5 10/15] dt-bindings: net: ethernet-controller: Document support for LEDs node Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-21 21:19   ` Rob Herring
2023-03-21 21:19     ` Rob Herring
2023-03-21 22:54     ` Christian Marangi
2023-03-21 22:54       ` Christian Marangi
2023-03-21 23:23       ` Andrew Lunn
2023-03-21 23:23         ` Andrew Lunn
2023-03-21 23:39         ` Christian Marangi
2023-03-21 23:39           ` Christian Marangi
2023-03-24 21:59           ` Rob Herring
2023-03-24 21:59             ` Rob Herring
2023-03-24 22:06       ` Rob Herring
2023-03-24 22:06         ` Rob Herring
2023-03-19 19:18 ` [net-next PATCH v5 11/15] dt-bindings: net: dsa: qca8k: add LEDs definition example Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-21 21:27   ` Rob Herring
2023-03-21 21:27     ` Rob Herring
2023-03-19 19:18 ` [net-next PATCH v5 12/15] arm: qcom: dt: Drop unevaluated properties in switch nodes for rb3011 Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-24  8:54   ` Krzysztof Kozlowski
2023-03-24  8:54     ` Krzysztof Kozlowski
2023-03-19 19:18 ` [net-next PATCH v5 13/15] arm: qcom: dt: Add Switch LED for each port " Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-23 12:00   ` Pavel Machek
2023-03-23 12:00     ` Pavel Machek
2023-03-19 19:18 ` [net-next PATCH v5 14/15] dt-bindings: net: phy: Document support for LEDs node Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-21 21:29   ` Rob Herring
2023-03-21 21:29     ` Rob Herring
2023-03-19 19:18 ` [net-next PATCH v5 15/15] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port Christian Marangi
2023-03-19 19:18   ` Christian Marangi
2023-03-23 12:04   ` Pavel Machek
2023-03-23 12:04     ` Pavel Machek
2023-03-23 17:02     ` Andrew Lunn
2023-03-23 17:02       ` Andrew Lunn
2023-03-23 19:11       ` Pavel Machek
2023-03-23 19:11         ` Pavel Machek
2023-03-23 19:53         ` Andrew Lunn
2023-03-23 19:53           ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBicg28JwVLugzqz@localhost.localdomain \
    --to=michal.kubiak@intel.com \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregory.clement@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=john@phrozen.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.