diff --git a/projects/WeTek_Play/patches/linux/30-wifi_eth_leds_control.patch b/projects/WeTek_Play/patches/linux/30-wifi_eth_leds_control.patch index add2998451..48fc0d8e31 100644 --- a/projects/WeTek_Play/patches/linux/30-wifi_eth_leds_control.patch +++ b/projects/WeTek_Play/patches/linux/30-wifi_eth_leds_control.patch @@ -1,108 +1,82 @@ -diff -Naur a/drivers/amlogic/ethernet/am_net8218.c b/drivers/amlogic/ethernet/am_net8218.c ---- a/drivers/amlogic/ethernet/am_net8218.c 2015-02-14 20:42:23.000000000 +0100 -+++ b/drivers/amlogic/ethernet/am_net8218.c 2015-03-03 16:30:11.000000000 +0100 -@@ -54,6 +54,7 @@ - +From 8f08833d315afc65378d7f2e2b5704b46d68a099 Mon Sep 17 00:00:00 2001 +From: Memphiz +Date: Sun, 8 Mar 2015 22:21:05 +0100 +Subject: [PATCH 4/6] [WeTek_Play] - use new led trigger for signaling link + status of eth and wifi links + +--- + drivers/amlogic/ethernet/am_net8218.c | 14 ++++++++++++++ + drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c | 12 ++++++++++++ + 2 files changed, 26 insertions(+) + +diff --git a/drivers/amlogic/ethernet/am_net8218.c b/drivers/amlogic/ethernet/am_net8218.c +index aec2980..f5ced5a 100755 +--- a/drivers/amlogic/ethernet/am_net8218.c ++++ b/drivers/amlogic/ethernet/am_net8218.c +@@ -55,6 +55,12 @@ #define DRV_NAME DRIVER_NAME #define DRV_VERSION "v2.0.0" -+#define OWNER_NAME "meson-eth" ++#ifdef CONFIG_LEDS_TRIGGER_NETWORK ++#include ++extern void ledtrig_eth_linkup(struct led_classdev *led_cdev); ++extern void ledtrig_eth_linkdown(struct led_classdev *led_cdev); ++#endif ++ #undef CONFIG_HAS_EARLYSUSPEND #ifdef CONFIG_HAS_EARLYSUSPEND -@@ -975,6 +976,12 @@ + #include +@@ -975,6 +981,14 @@ static void aml_adjust_link(struct net_device *dev) return; spin_lock_irqsave(&priv->lock, flags); -+ -+ if (phydev->link) -+ amlogic_gpio_direction_output(GPIOC_14, 1, OWNER_NAME); -+ else -+ amlogic_gpio_direction_output(GPIOC_14, 0, OWNER_NAME); + ++#ifdef CONFIG_LEDS_TRIGGER_NETWORK ++ if (phydev->link) ++ ledtrig_eth_linkup(NULL); ++ else ++ ledtrig_eth_linkdown(NULL); ++#endif ++ if(phydev->phy_id == INTERNALPHY_ID){ val = (8<<27)|(7 << 24)|(1<<16)|(1<<15)|(1 << 13)|(1 << 12)|(4 << 4)|(0 << 1); PERIPHS_SET_BITS(P_PREG_ETHERNET_ADDR0, val); -@@ -1316,6 +1323,8 @@ - free_ringdesc(dev); - free_irq(dev->irq, dev); +diff --git a/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c b/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c +index 5596f1d..e9f91d7 100755 +--- a/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c ++++ b/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c +@@ -92,6 +92,12 @@ + #define IW_WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED)) + #endif /* BCMWAPI_WPI */ -+ amlogic_gpio_direction_output(GPIOC_14, 0, OWNER_NAME); -+ - if (g_debug > 0) { - printk(KERN_DEBUG "%s: closed\n", dev->name); - } -@@ -2870,7 +2879,7 @@ - - return ret; - } --#define OWNER_NAME "meson-eth" ++#ifdef CONFIG_LEDS_TRIGGER_NETWORK ++#include ++extern void ledtrig_wifi_linkup(struct led_classdev *led_cdev); ++extern void ledtrig_wifi_linkdown(struct led_classdev *led_cdev); ++#endif + - void hardware_reset_phy(void){ - if(reset_pin_enable){ - amlogic_gpio_direction_output(reset_pin_num, 0, OWNER_NAME); -@@ -2958,6 +2967,7 @@ - } - - #endif -+ amlogic_gpio_request(GPIOC_14, OWNER_NAME); - printk(DRV_NAME "init(dbg[%p]=%d)\n", (&g_debug), g_debug); - switch_mod_gate_by_name("ethernet",1); - my_ndev = alloc_etherdev(sizeof(struct am_net_private)); -diff -Naur a/drivers/amlogic/wifi/broadcm_40181/dhd_linux.c b/drivers/amlogic/wifi/broadcm_40181/dhd_linux.c ---- a/drivers/amlogic/wifi/broadcm_40181/dhd_linux.c 2015-02-14 20:42:23.000000000 +0100 -+++ b/drivers/amlogic/wifi/broadcm_40181/dhd_linux.c 2015-03-03 16:33:58.000000000 +0100 -@@ -34,7 +34,7 @@ - #include - #include - #include -- -+#include - #include - #include - #include -@@ -4878,7 +4878,7 @@ - { - - printk("%s: Enter\n", __FUNCTION__); -- -+ amlogic_gpio_free(GPIOC_8, "WIFILED"); - dhd_bus_unregister(); - - #if defined(CONFIG_WIFI_CONTROL_FUNC) -@@ -4907,6 +4907,7 @@ - int chip_up = 0; - #endif - -+ amlogic_gpio_request(GPIOC_8, "WIFILED"); - printk("%s: Enter\n", __FUNCTION__); - if (wifi_setup_dt()) { - printk("wifi_dt : fail to setup dt\n"); -diff -Naur a/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c b/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c ---- a/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c 2015-02-14 20:42:23.000000000 +0100 -+++ b/drivers/amlogic/wifi/broadcm_40181/wl_cfg80211.c 2015-03-03 16:35:01.000000000 +0100 -@@ -47,6 +47,7 @@ - #include - #include - #include -+#include - - #ifdef PROP_TXSTATUS - #include -@@ -11181,6 +11182,8 @@ + static struct device *cfg80211_parent_dev = NULL; + struct wl_priv *wlcfg_drv_priv = NULL; + u32 wl_dbg_level = WL_DBG_ERR; +@@ -11181,6 +11187,9 @@ static u32 wl_get_ielen(struct wl_priv *wl) static void wl_link_up(struct wl_priv *wl) { wl->link_up = true; -+ amlogic_gpio_direction_output(GPIOC_8, 1, "WIFILED"); -+ ++#ifdef CONFIG_LEDS_TRIGGER_NETWORK ++ ledtrig_wifi_linkup(NULL); ++#endif } static void wl_link_down(struct wl_priv *wl) -@@ -11191,6 +11194,8 @@ +@@ -11191,6 +11200,9 @@ static void wl_link_down(struct wl_priv *wl) wl->link_up = false; conn_info->req_ie_len = 0; conn_info->resp_ie_len = 0; -+ amlogic_gpio_direction_output(GPIOC_8, 0, "WIFILED"); -+ ++#ifdef CONFIG_LEDS_TRIGGER_NETWORK ++ ledtrig_wifi_linkdown(NULL); ++#endif } static unsigned long wl_lock_eq(struct wl_priv *wl) +-- +1.9.3 (Apple Git-50)