Loading drivers/net/phy/dp83867.c +22 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ /* LED_DRV bits */ #define DP83867_LED_DRV_EN(x) BIT((x) * 4) #define DP83867_LED_DRV_VAL(x) BIT((x) * 4 + 1) #define DP83867_LED_POLARITY(x) BIT((x) * 4 + 2) #define DP83867_LED_FN(idx, val) (((val) & 0xf) << ((idx) * 4)) #define DP83867_LED_FN_MASK(idx) (0xf << ((idx) * 4)) Loading Loading @@ -1152,6 +1153,26 @@ static int dp83867_led_hw_control_get(struct phy_device *phydev, u8 index, return 0; } static int dp83867_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes) { /* Default active high */ u16 polarity = DP83867_LED_POLARITY(index); u32 mode; for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { switch (mode) { case PHY_LED_ACTIVE_LOW: polarity = 0; break; default: return -EINVAL; } } return phy_modify(phydev, DP83867_LEDCR2, DP83867_LED_POLARITY(index), polarity); } static struct phy_driver dp83867_driver[] = { { .phy_id = DP83867_PHY_ID, Loading Loading @@ -1184,6 +1205,7 @@ static struct phy_driver dp83867_driver[] = { .led_hw_is_supported = dp83867_led_hw_is_supported, .led_hw_control_set = dp83867_led_hw_control_set, .led_hw_control_get = dp83867_led_hw_control_get, .led_polarity_set = dp83867_led_polarity_set, }, }; module_phy_driver(dp83867_driver); Loading Loading
drivers/net/phy/dp83867.c +22 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,7 @@ /* LED_DRV bits */ #define DP83867_LED_DRV_EN(x) BIT((x) * 4) #define DP83867_LED_DRV_VAL(x) BIT((x) * 4 + 1) #define DP83867_LED_POLARITY(x) BIT((x) * 4 + 2) #define DP83867_LED_FN(idx, val) (((val) & 0xf) << ((idx) * 4)) #define DP83867_LED_FN_MASK(idx) (0xf << ((idx) * 4)) Loading Loading @@ -1152,6 +1153,26 @@ static int dp83867_led_hw_control_get(struct phy_device *phydev, u8 index, return 0; } static int dp83867_led_polarity_set(struct phy_device *phydev, int index, unsigned long modes) { /* Default active high */ u16 polarity = DP83867_LED_POLARITY(index); u32 mode; for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) { switch (mode) { case PHY_LED_ACTIVE_LOW: polarity = 0; break; default: return -EINVAL; } } return phy_modify(phydev, DP83867_LEDCR2, DP83867_LED_POLARITY(index), polarity); } static struct phy_driver dp83867_driver[] = { { .phy_id = DP83867_PHY_ID, Loading Loading @@ -1184,6 +1205,7 @@ static struct phy_driver dp83867_driver[] = { .led_hw_is_supported = dp83867_led_hw_is_supported, .led_hw_control_set = dp83867_led_hw_control_set, .led_hw_control_get = dp83867_led_hw_control_get, .led_polarity_set = dp83867_led_polarity_set, }, }; module_phy_driver(dp83867_driver); Loading