mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: move leds struct in mt76_phy
Move leds struct in mt76_phy in order to have leds associated to phy (e.g. in dbdc mode) instead of per device. Tested-by: Frank Wunderlich <[email protected]> Co-developed-by: Ryder Lee <[email protected]> Signed-off-by: Ryder Lee <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
551201379e
commit
14fbb6d6e8
+15
-16
@@ -87,10 +87,9 @@ static const struct ieee80211_iface_combination mt76x02u_if_comb[] = {
|
||||
};
|
||||
|
||||
static void
|
||||
mt76x02_led_set_config(struct mt76_dev *mdev, u8 delay_on,
|
||||
u8 delay_off)
|
||||
mt76x02_led_set_config(struct mt76_phy *mphy, u8 delay_on, u8 delay_off)
|
||||
{
|
||||
struct mt76x02_dev *dev = container_of(mdev, struct mt76x02_dev,
|
||||
struct mt76x02_dev *dev = container_of(mphy->dev, struct mt76x02_dev,
|
||||
mt76);
|
||||
u32 val;
|
||||
|
||||
@@ -98,13 +97,13 @@ mt76x02_led_set_config(struct mt76_dev *mdev, u8 delay_on,
|
||||
FIELD_PREP(MT_LED_STATUS_OFF, delay_off) |
|
||||
FIELD_PREP(MT_LED_STATUS_ON, delay_on);
|
||||
|
||||
mt76_wr(dev, MT_LED_S0(mdev->leds.pin), val);
|
||||
mt76_wr(dev, MT_LED_S1(mdev->leds.pin), val);
|
||||
mt76_wr(dev, MT_LED_S0(mphy->leds.pin), val);
|
||||
mt76_wr(dev, MT_LED_S1(mphy->leds.pin), val);
|
||||
|
||||
val = MT_LED_CTRL_REPLAY(mdev->leds.pin) |
|
||||
MT_LED_CTRL_KICK(mdev->leds.pin);
|
||||
if (mdev->leds.al)
|
||||
val |= MT_LED_CTRL_POLARITY(mdev->leds.pin);
|
||||
val = MT_LED_CTRL_REPLAY(mphy->leds.pin) |
|
||||
MT_LED_CTRL_KICK(mphy->leds.pin);
|
||||
if (mphy->leds.al)
|
||||
val |= MT_LED_CTRL_POLARITY(mphy->leds.pin);
|
||||
mt76_wr(dev, MT_LED_CTRL, val);
|
||||
}
|
||||
|
||||
@@ -113,14 +112,14 @@ mt76x02_led_set_blink(struct led_classdev *led_cdev,
|
||||
unsigned long *delay_on,
|
||||
unsigned long *delay_off)
|
||||
{
|
||||
struct mt76_dev *mdev = container_of(led_cdev, struct mt76_dev,
|
||||
struct mt76_phy *mphy = container_of(led_cdev, struct mt76_phy,
|
||||
leds.cdev);
|
||||
u8 delta_on, delta_off;
|
||||
|
||||
delta_off = max_t(u8, *delay_off / 10, 1);
|
||||
delta_on = max_t(u8, *delay_on / 10, 1);
|
||||
|
||||
mt76x02_led_set_config(mdev, delta_on, delta_off);
|
||||
mt76x02_led_set_config(mphy, delta_on, delta_off);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -129,13 +128,13 @@ static void
|
||||
mt76x02_led_set_brightness(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct mt76_dev *mdev = container_of(led_cdev, struct mt76_dev,
|
||||
struct mt76_phy *mphy = container_of(led_cdev, struct mt76_phy,
|
||||
leds.cdev);
|
||||
|
||||
if (!brightness)
|
||||
mt76x02_led_set_config(mdev, 0, 0xff);
|
||||
mt76x02_led_set_config(mphy, 0, 0xff);
|
||||
else
|
||||
mt76x02_led_set_config(mdev, 0xff, 0);
|
||||
mt76x02_led_set_config(mphy, 0xff, 0);
|
||||
}
|
||||
|
||||
int mt76x02_init_device(struct mt76x02_dev *dev)
|
||||
@@ -167,9 +166,9 @@ int mt76x02_init_device(struct mt76x02_dev *dev)
|
||||
|
||||
/* init led callbacks */
|
||||
if (IS_ENABLED(CONFIG_MT76_LEDS)) {
|
||||
dev->mt76.leds.cdev.brightness_set =
|
||||
dev->mphy.leds.cdev.brightness_set =
|
||||
mt76x02_led_set_brightness;
|
||||
dev->mt76.leds.cdev.blink_set = mt76x02_led_set_blink;
|
||||
dev->mphy.leds.cdev.blink_set = mt76x02_led_set_blink;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user