From e558b68e04793888d54721f7653b32da96916d2f Mon Sep 17 00:00:00 2001
From: FUKAUMI Naoki <naobsd@gmail.com>
Date: Mon, 20 Oct 2014 17:03:58 +0900
Subject: [PATCH] Netxeon R89

---
 kernel/arch/arm/boot/dts/rk3288-box.dts            | 22 ++++++++++++++--------
 ...box_defconfig => rockchip_box_ap6330_defconfig} |  4 ++--
 kernel/arch/arm/configs/rockchip_box_defconfig     |  2 +-
 kernel/drivers/input/remotectl/rk_pwm_remotectl.c  | 20 ++++++++++++++++++++
 kernel/drivers/net/ethernet/rockchip/eth_mac.c     |  2 --
 .../net/ethernet/rockchip/gmac/stmmac_main.c       |  2 ++
 kernel/drivers/regulator/act8846.c                 |  4 ++++
 kernel/sound/soc/codecs/rk1000_codec.c             |  2 +-
 8 files changed, 44 insertions(+), 14 deletions(-)
 copy kernel/arch/arm/configs/{rockchip_box_defconfig => rockchip_box_ap6330_defconfig} (99%)
 mode change 100755 => 100644
 mode change 100755 => 100644 kernel/arch/arm/configs/rockchip_box_defconfig

diff --git a/kernel/arch/arm/boot/dts/rk3288-box.dts b/kernel/arch/arm/boot/dts/rk3288-box.dts
index 02d26b4..d145e67 100755
--- a/kernel/arch/arm/boot/dts/rk3288-box.dts
+++ b/kernel/arch/arm/boot/dts/rk3288-box.dts
@@ -8,6 +8,12 @@
 		status = "okay";
 	};
 
+	indicator_led {
+		compatible = "indicator_led";
+		indicator,pin = <&gpio7 GPIO_A4 GPIO_ACTIVE_HIGH>;
+		status = "okay";
+	};
+
     wireless-wlan {
         compatible = "wlan-platdata";
 	       	
@@ -159,9 +165,9 @@
 &pinctrl {
 	//used for init some gpio
 	
-	init-gpios = <&gpio8 GPIO_A1 GPIO_ACTIVE_HIGH
+	/*init-gpios = <&gpio8 GPIO_A1 GPIO_ACTIVE_HIGH
 		&gpio7 GPIO_B1 GPIO_ACTIVE_HIGH		
-		&gpio4 GPIO_B0 GPIO_ACTIVE_HIGH>;
+		&gpio4 GPIO_B0 GPIO_ACTIVE_HIGH>;*/
 	gpio0_gpio {
 			gpio0_c2: gpio0-c2 {
 				rockchip,pins = <GPIO0_C2>;
@@ -237,7 +243,7 @@
 		supports-highspeed;
 		supports-sd;
 		broken-cd;
-		card-detect-delay = <200>;
+		card-detect-delay = <400>;
 
 		ignore-pm-notify;
         	keep-power-in-suspend;
@@ -461,7 +467,7 @@
 	rk1000_codec: rk1000_codec@60 {
 		compatible = "rockchip,rk1000_codec";
 		reg = <0x60>;
-		spk_ctl_io = <&gpio7 GPIO_A5 GPIO_ACTIVE_LOW>;
+		spk_ctl_io = <&gpio7 GPIO_A5 GPIO_ACTIVE_HIGH>;
 		boot_depop = <1>;
 		pa_enable_time = <5000>;
 	};
@@ -504,13 +510,13 @@
 };
 
 &adc {
-	status = "disabled";
+	status = "okay";
 
 	key {
 		compatible = "rockchip,key";
-		/*
-		io-channels = <&adc 1>;
 		
+		io-channels = <&adc 1>;
+		/*
 		vol-up-key {
 			linux,code = <115>;
 			label = "volume up";
@@ -630,7 +636,7 @@
 };
 /include/ "act8846.dtsi"
 &act8846 {
-	gpios =<&gpio7 GPIO_A1 GPIO_ACTIVE_LOW>,<&gpio0 GPIO_B2 GPIO_ACTIVE_HIGH>;
+	gpios =<&gpio7 GPIO_A1 GPIO_ACTIVE_LOW>,<&gpio0 GPIO_A6 GPIO_ACTIVE_HIGH>;
 	act8846,system-power-controller;
 
 	regulators {
diff --git a/kernel/arch/arm/configs/rockchip_box_defconfig b/kernel/arch/arm/configs/rockchip_box_ap6330_defconfig
old mode 100755
new mode 100644
similarity index 99%
copy from kernel/arch/arm/configs/rockchip_box_defconfig
copy to kernel/arch/arm/configs/rockchip_box_ap6330_defconfig
index bab3f6e..ff71445
--- a/kernel/arch/arm/configs/rockchip_box_defconfig
+++ b/kernel/arch/arm/configs/rockchip_box_ap6330_defconfig
@@ -270,8 +270,9 @@ CONFIG_USB_HSO=y
 CONFIG_USB_NET_INT51X1=y
 CONFIG_USB_IPHETH=y
 CONFIG_USB_SIERRA_NET=y
+# CONFIG_RTL_WIRELESS_SOLUTION is not set
 CONFIG_RKWIFI=y
-CONFIG_AP6335=y
+CONFIG_AP6330=y
 # CONFIG_INPUT_MOUSEDEV is not set
 CONFIG_INPUT_EVDEV=y
 CONFIG_INPUT_KEYRESET=y
@@ -381,7 +382,6 @@ CONFIG_SND_VERBOSE_PRINTK=y
 CONFIG_SND_USB_AUDIO=y
 CONFIG_SND_SOC=y
 CONFIG_SND_RK_SOC=y
-CONFIG_SND_RK_SOC_HDMI_I2S=y
 CONFIG_SND_RK_SOC_RK1000=y
 CONFIG_HID_BATTERY_STRENGTH=y
 CONFIG_HIDRAW=y
diff --git a/kernel/arch/arm/configs/rockchip_box_defconfig b/kernel/arch/arm/configs/rockchip_box_defconfig
old mode 100755
new mode 100644
index bab3f6e..b0205c7
--- a/kernel/arch/arm/configs/rockchip_box_defconfig
+++ b/kernel/arch/arm/configs/rockchip_box_defconfig
@@ -270,6 +270,7 @@ CONFIG_USB_HSO=y
 CONFIG_USB_NET_INT51X1=y
 CONFIG_USB_IPHETH=y
 CONFIG_USB_SIERRA_NET=y
+# CONFIG_RTL_WIRELESS_SOLUTION is not set
 CONFIG_RKWIFI=y
 CONFIG_AP6335=y
 # CONFIG_INPUT_MOUSEDEV is not set
@@ -381,7 +382,6 @@ CONFIG_SND_VERBOSE_PRINTK=y
 CONFIG_SND_USB_AUDIO=y
 CONFIG_SND_SOC=y
 CONFIG_SND_RK_SOC=y
-CONFIG_SND_RK_SOC_HDMI_I2S=y
 CONFIG_SND_RK_SOC_RK1000=y
 CONFIG_HID_BATTERY_STRENGTH=y
 CONFIG_HIDRAW=y
diff --git a/kernel/drivers/input/remotectl/rk_pwm_remotectl.c b/kernel/drivers/input/remotectl/rk_pwm_remotectl.c
index 4cf4e18..c44d82d 100755
--- a/kernel/drivers/input/remotectl/rk_pwm_remotectl.c
+++ b/kernel/drivers/input/remotectl/rk_pwm_remotectl.c
@@ -161,9 +161,29 @@ static struct rkxx_remote_key_table remote_key_table_sunchip_ff00[] = {
     {0xbe, KEY_SEARCH},     // search
 };
 
+static struct rkxx_remote_key_table remote_key_table_netxeon_ff00[] = {
+    {0xeb, KEY_POWER},	//
+    {0xb7, KEY_HOME},	//
+    {0xec, KEY_MENU},	//
+    {0xfe, KEY_BACK},	//
+    {0xf8, KEY_REPLY},	//
+    {0xfc, KEY_UP},	//
+    {0xfd, KEY_DOWN},	//
+    {0xf1, KEY_LEFT},	//
+    {0xe5, KEY_RIGHT},	//
+    {0xa7, KEY_VOLUMEDOWN},	//
+    {0xf4, KEY_VOLUMEUP},	//
+    {0xa3, 0x184},	//
+};
+
 
 static struct rkxx_remotectl_button remotectl_button[] = 
 {
+    {
+       .usercode = 0xff00,
+       .nbuttons = 12,
+       .key_table = &remote_key_table_netxeon_ff00[0],
+    },
     {  
        .usercode = 0xff00,
        .nbuttons =  29, 
diff --git a/kernel/drivers/net/ethernet/rockchip/eth_mac.c b/kernel/drivers/net/ethernet/rockchip/eth_mac.c
index 102f712..eefa420 100755
--- a/kernel/drivers/net/ethernet/rockchip/eth_mac.c
+++ b/kernel/drivers/net/ethernet/rockchip/eth_mac.c
@@ -70,7 +70,6 @@ int eth_mac_idb(u8 *eth_mac)
 	return 0;
 }
 
-#if 0
 /**
 *大写转小写
 *
@@ -191,4 +190,3 @@ int eth_mac_wifi(u8 *eth_mac){
 	
 }
 
-#endif
diff --git a/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c b/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c
index 658a610..c9ae187 100755
--- a/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c
+++ b/kernel/drivers/net/ethernet/rockchip/gmac/stmmac_main.c
@@ -1576,6 +1576,8 @@ static void stmmac_check_ether_addr(struct stmmac_priv *priv)
 		if (!is_valid_ether_addr(priv->dev->dev_addr))
 			eth_mac_idb(priv->dev->dev_addr);
 		if (!is_valid_ether_addr(priv->dev->dev_addr))
+			eth_mac_wifi(priv->dev->dev_addr);
+		if (!is_valid_ether_addr(priv->dev->dev_addr))
 			eth_hw_addr_random(priv->dev);
 	}
 	pr_warn("%s: device MAC address %pM\n", priv->dev->name,
diff --git a/kernel/drivers/regulator/act8846.c b/kernel/drivers/regulator/act8846.c
index 8c57878..a572ad7 100755
--- a/kernel/drivers/regulator/act8846.c
+++ b/kernel/drivers/regulator/act8846.c
@@ -800,6 +800,10 @@ void act8846_device_shutdown(void)
 	
 	printk("%s\n",__func__);
 #if 1
+	act8846_reg_read(act8846,0xc3);
+	act8846_set_bits(act8846, 0xc3,(0x1<<3),(0x1<<3));
+	act8846_set_bits(act8846, 0xc3,(0x1<<4),(0x1<<4));
+
 	if (act8846->pmic_hold_gpio) {
 			gpio_direction_output(act8846->pmic_hold_gpio,0);
 			mdelay(100);
diff --git a/kernel/sound/soc/codecs/rk1000_codec.c b/kernel/sound/soc/codecs/rk1000_codec.c
index 0561062..3bd2a96 100755
--- a/kernel/sound/soc/codecs/rk1000_codec.c
+++ b/kernel/sound/soc/codecs/rk1000_codec.c
@@ -62,7 +62,7 @@
 #define Volume_Codec_PA 0x0
 
 //rk1000 input volume,rk610 can not adjust the recording volume 
-#define Volume_Input 0x07
+#define Volume_Input 0x06
 
 
 
-- 
2.1.1

