From: Andrew Lunn <andrew@lunn.ch>
To: Vishal Thanki <vishalthanki@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
Matus Ujhelyi <ujhelyi.m@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH] net: phy: at803x: Add support to control PHY LEDs
Date: Mon, 21 Mar 2016 19:13:04 +0100 [thread overview]
Message-ID: <20160321181304.GH28582@lunn.ch> (raw)
In-Reply-To: <20160321173648.GA30581@c50.bag.software>
On Mon, Mar 21, 2016 at 06:36:50PM +0100, Vishal Thanki wrote:
> Hi,
>
> On Thu, Mar 17, 2016 at 07:07:12PM +0100, Vishal Thanki wrote:
> > >
> > > They might not be on/off controllable individually, but you can often
> > > set them to show Packet RX, Packet TX, Link, speed, etc, in a
> > > reasonably flexible way. So you could have LED triggers mapping to
> > > these functionalities. The user can then pick the trigger for the LED.
> > >
> > > Actually, the data sheet says:
> > >
> > > 2.3.4 LED Interface
> > >
> > > The LED interface can either be controlled by the PHY or controlled
> > > manually, independent of the state of the PHY. Two status LEDs are
> > > available. These can be used to indicate operation speed, and link
> > > status. The LEDs can be programmed to different status functions from
> > > their default value. They can also be controlled directly from the MII
> > > register interface.
> > >
> > > So maybe you can control the on/off state.
> > >
>
> I need some more understanding on using the LED subsystem for this task.
> Pardon my lack of knowledge, and probably silly questions too.
>
> Here is what I understood when we decide to use the LED subsystem for
> exposing PHY LEDs.
>
> 1) Have a generic driver under drivers/leds/, for example leds-eth-phy.c
> 2) Implement a set of phylib APIs which will be used by generic phy led
> driver to set the brightness.
> 3) The phylib APIs will depend on actual PHY driver, at803x.c for
> example, (by means of callbacks implemented in PHY driver) to control LEDs.
> 4) PHY driver can advertise its support for LEDs using the capability
> flags.
>
> Please let me know if my understanding is correct.
LEDs are more than brightness. They can also have triggers.
It would require some rework of the LED core, but you could imagine
being able to associate triggers to specific LEDs. You could have
triggers like "eth-phy-link" and "eth-phy-activity" which the phylib and
phy driver exports. The PHY would export LEDs and say that they can be
used with these triggers. So when for example the "eth-phy-link"
trigger is activated on an LED, the PHY driver programs the hardware
to show the link status on the LED.
The key here is that the hardware is in control of the LED, when the
trigger is used. You don't want software involved when you are
transmitting a million packets per second.
Andrew
next prev parent reply other threads:[~2016-03-21 18:13 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 13:59 [PATCH] Add support to control PHY LEDs Vishal Thanki
2016-03-17 13:59 ` [PATCH] net: phy: at803x: " Vishal Thanki
2016-03-17 14:50 ` Andrew Lunn
2016-03-17 16:59 ` Florian Fainelli
2016-03-17 17:32 ` Vishal Thanki
2016-03-17 17:51 ` Andrew Lunn
2016-03-17 18:07 ` Vishal Thanki
2016-03-21 17:36 ` Vishal Thanki
2016-03-21 18:13 ` Andrew Lunn [this message]
2016-03-17 14:54 ` [PATCH] " 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=20160321181304.GH28582@lunn.ch \
--to=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=ujhelyi.m@gmail.com \
--cc=vishalthanki@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).