[PATCH] mt76: mt7915: add LED support

Felix Fietkau nbd at nbd.name
Fri Aug 13 03:52:02 PDT 2021


On 2021-06-21 16:14, MeiChia Chiu wrote:
> From: MeiChia Chiu <meichia.chiu at mediatek.com>
> 
> Initialize brightness_set and blink_set callbacks to enable LED support.
> 
> Signed-off-by: MeiChia Chiu <meichia.chiu at mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee at mediatek.com>
> Signed-off-by: Money Wang <money.wang at mediatek.com>
> ---
>  .../net/wireless/mediatek/mt76/mt7915/init.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  .../net/wireless/mediatek/mt76/mt7915/mmio.c |  6 +++--
>  .../net/wireless/mediatek/mt76/mt7915/regs.h | 19 ++++++++++++++
>  3 files changed, 92 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> index e027273..defb0ec 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c
> @@ -151,6 +151,64 @@ static int mt7915_thermal_init(struct mt7915_phy *phy)
>  	return 0;
>  }
>  
> +static void mt7915_led_set_config(struct led_classdev *led_cdev,
> +				  u8 delay_on, u8 delay_off)
> +{
> +	struct mt7915_dev *dev;
> +	struct mt76_dev *mt76;
> +	u32 val;
> +
> +	mt76 = container_of(led_cdev, struct mt76_dev, led_cdev);
> +	dev = container_of(mt76, struct mt7915_dev, mt76);
> +
> +	/* select TX blink mode, 2: only data frames */
> +	mt76_rmw_field(dev, MT_TMAC_TCR0(0), MT_TMAC_TCR0_TX_BLINK, 2);
Does that mean the hw triggers the LED with the configured on/off delay
on TX? I think blinking should be controlled entirely by software.

- Felix



More information about the Linux-mediatek mailing list