mt76: mt7915: add LED support [update to v3]

Initialize brightness_set and blink_set callbacks to enable LED support.
The base 0x7c000000 is MCU space so driver can't touch it, and should
map the LED base to 0x18000000 host's view.

Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Money Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
MeiChia Chiu
2021-09-24 18:03:18 +02:00
committed by Felix Fietkau
parent 8ee6446075
commit e17d730bf2
3 changed files with 15 additions and 18 deletions
+1 -1
View File
@@ -221,7 +221,7 @@ static int mt7915_led_set_blink(struct led_classdev *led_cdev,
unsigned long *delay_on,
unsigned long *delay_off)
{
u16 delta_on, delta_off;
u16 delta_on = 0, delta_off = 0;
#define HW_TICK 10
#define TO_HW_TICK(_t) (((_t) > HW_TICK) ? ((_t) / HW_TICK) : HW_TICK)
-3
View File
@@ -95,9 +95,6 @@ static u32 __mt7915_reg_addr(struct mt7915_dev *dev, u32 addr)
(addr >= 0x70000000 && addr < 0x78000000))
return mt7915_reg_map_l1(dev, addr);
if (addr >= 0x7c000000 && addr < 0x7c400000)
return mt7915_reg_map_l1(dev, addr - 0x64000000);
return mt7915_reg_map_l2(dev, addr);
}
+14 -14
View File
@@ -431,6 +431,20 @@
#define MT_SWDEF_ICAP_MODE 1
#define MT_SWDEF_SPECTRUM_MODE 2
#define MT_LED_TOP_BASE 0x18013000
#define MT_LED_PHYS(_n) (MT_LED_TOP_BASE + (_n))
#define MT_LED_CTRL(_n) MT_LED_PHYS(0x00 + ((_n) * 4))
#define MT_LED_CTRL_KICK BIT(7)
#define MT_LED_CTRL_BLINK_MODE BIT(2)
#define MT_LED_CTRL_POLARITY BIT(1)
#define MT_LED_TX_BLINK(_n) MT_LED_PHYS(0x10 + ((_n) * 4))
#define MT_LED_TX_BLINK_ON_MASK GENMASK(7, 0)
#define MT_LED_TX_BLINK_OFF_MASK GENMASK(15, 8)
#define MT_LED_EN(_n) MT_LED_PHYS(0x40 + ((_n) * 4))
#define MT_TOP_BASE 0x18060000
#define MT_TOP(ofs) (MT_TOP_BASE + (ofs))
@@ -458,20 +472,6 @@
#define MT_PCIE_MAC(ofs) (MT_PCIE_MAC_BASE + (ofs))
#define MT_PCIE_MAC_INT_ENABLE MT_PCIE_MAC(0x188)
#define MT_LED_TOP_BASE 0x7c013000
#define MT_LED_PHYS(_n) (MT_LED_TOP_BASE + (_n))
#define MT_LED_CTRL(_n) MT_LED_PHYS(0x00 + ((_n) * 4))
#define MT_LED_CTRL_KICK BIT(7)
#define MT_LED_CTRL_BLINK_MODE BIT(2)
#define MT_LED_CTRL_POLARITY BIT(1)
#define MT_LED_TX_BLINK(_n) MT_LED_PHYS(0x10 + ((_n) * 4))
#define MT_LED_TX_BLINK_ON_MASK GENMASK(7, 0)
#define MT_LED_TX_BLINK_OFF_MASK GENMASK(15, 8)
#define MT_LED_EN(_n) MT_LED_PHYS(0x40 + ((_n) * 4))
#define MT_WF_IRPI_BASE 0x83006000
#define MT_WF_IRPI(ofs) (MT_WF_IRPI_BASE + ((ofs) << 16))