[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200728162816.GK1705504@lunn.ch>
Date: Tue, 28 Jul 2020 18:28:16 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Marek Behún <marek.behun@....cz>
Cc: netdev@...r.kernel.org, linux-leds@...r.kernel.org,
Pavel Machek <pavel@....cz>, jacek.anaszewski@...il.com,
Dan Murphy <dmurphy@...com>,
Ondřej Jirman <megous@...ous.com>,
Russell King <linux@...linux.org.uk>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Gregory Clement <gregory.clement@...tlin.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC leds + net-next v4 1/2] net: phy: add API for LEDs
controlled by PHY HW
> > @@ -736,6 +777,16 @@ struct phy_driver {
> > int (*set_loopback)(struct phy_device *dev, bool enable);
> > int (*get_sqi)(struct phy_device *dev);
> > int (*get_sqi_max)(struct phy_device *dev);
> > +
> > + /* PHY LED support */
> > + int (*led_init)(struct phy_device *dev, struct
> > phy_device_led *led);
> > + int (*led_brightness_set)(struct phy_device *dev, struct
> > phy_device_led *led,
> > + enum led_brightness brightness);
> > + const char *(*led_iter_hw_mode)(struct phy_device *dev,
> > struct phy_device_led *led,
> > + void ** iter);
> > + int (*led_set_hw_mode)(struct phy_device *dev, struct
> > phy_device_led *led,
> > + const char *mode);
> > + const char *(*led_get_hw_mode)(struct phy_device *dev,
> > struct phy_device_led *led); };
> > #define to_phy_driver(d)
> > container_of(to_mdio_common_driver(d), \ struct
> > phy_driver, mdiodrv)
>
> The problem here is that the same code will have to be added to DSA
> switch ops structure, which is not OK.
Not necessarily. DSA drivers do have access to the phydev structure.
I think putting these members into a structure is a good idea. That
structure can be part of phy_driver and initialised just like other
members. But on probing the phy, it can be copied over to the
phy_device structure. And we can provide an API which DSA drivers can
use to register there own structure of ops to be placed into
phy_device, which would call into the DSA driver.
Andrew
Powered by blists - more mailing lists