lkml.org 
[lkml]   [2020]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC leds + net-next v4 1/2] net: phy: add API for LEDs controlled by PHY HW
On Tue, 28 Jul 2020 17:05:29 +0200
Marek Behún <marek.behun@nic.cz> wrote:

> @@ -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.

I wanted to put this into struct mdio_driver_common, so that all mdio
drivers would be able to have HW LEDs connected. But then I remembered
that not all DSA drivers are connected via MDIO, some are via SPI.

So maybe this could instead become part of LED API, instead of phydev
API. Structure
struct hw_controlled_led
and
struct hw_controlled_led_ops
could be offered by the LED API, which would also register the needed
trigger.

struct phydev, struct dsa_switch and other could then just contain
pointer to struct hw_controlled_led_ops...

Marek

\
 
 \ /
  Last update: 2020-07-28 17:12    [W:0.275 / U:0.896 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site