From c53a39db6f24f315efb7312ad1a90dfa8858fdef Mon Sep 17 00:00:00 2001 From: Thomas Kaiser Date: Sat, 13 Feb 2016 17:40:38 +0100 Subject: [PATCH] Few more fixes for Orange Pi PC/One --- config/linux-sun8i-default.config | 1 + configuration.sh | 5 +- .../opi_pc_one_disable_gmac.patch | 89 ++ .../opi_plus_gmac.patch.disabled | 94 -- .../orangepi_h3_gc2305_camera.patch | 986 ++++++++++++++++++ 5 files changed, 1080 insertions(+), 95 deletions(-) create mode 100644 patch/kernel/sun8i-default/opi_pc_one_disable_gmac.patch delete mode 100644 patch/kernel/sun8i-default/opi_plus_gmac.patch.disabled create mode 100644 patch/kernel/sun8i-default/orangepi_h3_gc2305_camera.patch diff --git a/config/linux-sun8i-default.config b/config/linux-sun8i-default.config index 0858110c9..8a35d3def 100644 --- a/config/linux-sun8i-default.config +++ b/config/linux-sun8i-default.config @@ -2452,6 +2452,7 @@ CONFIG_FB_TFT_WATTEROTT=m CONFIG_FB_FLEX=m CONFIG_FB_TFT_FBTFT_DEVICE=m CONFIG_DRM=m +CONFIG_DRM_MALI=m # CONFIG_DRM_UDL is not set CONFIG_ION=y CONFIG_ION_SUNXI=y diff --git a/configuration.sh b/configuration.sh index 21bcdd6b2..38fd164a3 100644 --- a/configuration.sh +++ b/configuration.sh @@ -219,6 +219,7 @@ MODULES_NEXT="" CPUMIN="480000" CPUMAX="1296000" + GOVERNOR="interactive" ;; orangepipc)#enabled @@ -230,6 +231,7 @@ MODULES_NEXT="" CPUMIN="480000" CPUMAX="1296000" + GOVERNOR="interactive" ;; orangepione)#enabled @@ -241,6 +243,7 @@ MODULES_NEXT="" CPUMIN="648000" CPUMAX="1200000" + GOVERNOR="interactive" ;; cubox-i)#enabled @@ -340,7 +343,7 @@ # KERNEL_DEFAULT="https://github.com/ssvb/linux-sunxi" # KERNEL_DEFAULT_BRANCH="20151207-embedded-lima-memtester-h3" KERNEL_DEFAULT="https://github.com/O-Computers/linux-sunxi" - KERNEL_DEFAULT_BRANCH="h3" + KERNEL_DEFAULT_BRANCH="h3-wip" KERNEL_DEFAULT_SOURCE="linux-sun8i" fi KERNEL_NEXT='git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git' diff --git a/patch/kernel/sun8i-default/opi_pc_one_disable_gmac.patch b/patch/kernel/sun8i-default/opi_pc_one_disable_gmac.patch new file mode 100644 index 000000000..811c45105 --- /dev/null +++ b/patch/kernel/sun8i-default/opi_pc_one_disable_gmac.patch @@ -0,0 +1,89 @@ +diff --git a/drivers/net/ethernet/sunxi/eth/Kconfig b/drivers/net/ethernet/sunxi/eth/Kconfig +index af930df..13787db 100755 +--- a/drivers/net/ethernet/sunxi/eth/Kconfig ++++ b/drivers/net/ethernet/sunxi/eth/Kconfig +@@ -35,13 +35,5 @@ config GETH_PHY_POWER + If external PHY power is exist, and it want to be controled, + select it. If not, it mean the power of PHY already on. + +-config GMAC_PHY_POWER +- bool "External PHY power control" +- depends on SUNXI_GETH +- default y +- ---help--- +- If external PHY power is exist, and it want to be controled, +- select it. If not, it mean the power of PHY already on. +- + endif + +diff --git a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c +index 03931f2..8c9b912 100755 +--- a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c ++++ b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c +@@ -154,9 +154,6 @@ struct geth_priv { + + spinlock_t lock; + spinlock_t tx_lock; +-#ifdef CONFIG_GMAC_PHY_POWER +- u32 gpio_power_hd; +-#endif + }; + + #ifdef CONFIG_GETH_PHY_POWER +@@ -199,10 +196,6 @@ static int geth_power_on(struct geth_priv *priv) + { + int value; + +-#ifdef CONFIG_GMAC_PHY_POWER +- gpio_set_value(priv->gpio_power_hd, 1); +-#endif +- + #ifdef CONFIG_GETH_PHY_POWER + struct regulator **regu; + int ret = 0, i = 0; +@@ -267,10 +260,6 @@ static void geth_power_off(struct geth_priv *priv) + { + int value; + +-#ifdef CONFIG_GMAC_PHY_POWER +- gpio_set_value(priv->gpio_power_hd, 0); +-#endif +- + #ifdef CONFIG_GETH_PHY_POWER + struct regulator **regu = priv->power; + int i = 0; +@@ -1621,12 +1610,6 @@ static int geth_sys_request(struct platform_device *pdev) + int ret = 0; + struct resource *res; + +-#ifdef CONFIG_GMAC_PHY_POWER +- script_item_value_type_e type; +- script_item_u item; +- int req_status; +-#endif +- + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "geth_extclk"); + if (unlikely(!res)){ + ret = -ENODEV; +@@ -1701,21 +1684,6 @@ static int geth_sys_request(struct platform_device *pdev) + } + #endif + +-#ifdef CONFIG_GMAC_PHY_POWER && CONFIG_GETH_SCRIPT_SYS +- type = script_get_item("gmac_phy_power", "gmac_phy_power_en", &item); +- if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) { +- pr_err("script_get_item return type err\n"); +- return -EFAULT; +- } +- /*request gpio*/ +- req_status = gpio_request(item.gpio.gpio, NULL); +- if (0 != req_status) { +- pr_err("request gpio failed!\n"); +- } +- gpio_direction_output(item.gpio.gpio, 1); +- priv->gpio_power_hd = item.gpio.gpio; +- #endif +- + return 0; + + pin_err: diff --git a/patch/kernel/sun8i-default/opi_plus_gmac.patch.disabled b/patch/kernel/sun8i-default/opi_plus_gmac.patch.disabled deleted file mode 100644 index e55d8bf10..000000000 --- a/patch/kernel/sun8i-default/opi_plus_gmac.patch.disabled +++ /dev/null @@ -1,94 +0,0 @@ -diff --git a/drivers/net/ethernet/sunxi/eth/Kconfig b/drivers/net/ethernet/sunxi/eth/Kconfig -index 13787db..af930df 100755 ---- a/drivers/net/ethernet/sunxi/eth/Kconfig -+++ b/drivers/net/ethernet/sunxi/eth/Kconfig -@@ -35,5 +35,13 @@ config GETH_PHY_POWER - If external PHY power is exist, and it want to be controled, - select it. If not, it mean the power of PHY already on. - -+config GMAC_PHY_POWER -+ bool "External PHY power control" -+ depends on SUNXI_GETH -+ default y -+ ---help--- -+ If external PHY power is exist, and it want to be controled, -+ select it. If not, it mean the power of PHY already on. -+ - endif - -diff --git a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c -index 7c48f7b..96be5a3 100755 ---- a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c -+++ b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c -@@ -154,6 +154,9 @@ struct geth_priv { - - spinlock_t lock; - spinlock_t tx_lock; -+#ifdef CONFIG_GMAC_PHY_POWER -+ u32 gpio_power_hd; -+#endif - }; - - #ifdef CONFIG_GETH_PHY_POWER -@@ -195,6 +198,11 @@ static void desc_print(struct dma_desc *desc, int size) - static int geth_power_on(struct geth_priv *priv) - { - int value; -+ -+#ifdef CONFIG_GMAC_PHY_POWER -+ gpio_set_value(priv->gpio_power_hd, 1); -+#endif -+ - #ifdef CONFIG_GETH_PHY_POWER - struct regulator **regu; - int ret = 0, i = 0; -@@ -258,6 +266,11 @@ err: - static void geth_power_off(struct geth_priv *priv) - { - int value; -+ -+#ifdef CONFIG_GMAC_PHY_POWER -+ gpio_set_value(priv->gpio_power_hd, 0); -+#endif -+ - #ifdef CONFIG_GETH_PHY_POWER - struct regulator **regu = priv->power; - int i = 0; -@@ -1607,7 +1620,13 @@ static int geth_sys_request(struct platform_device *pdev) - struct geth_priv *priv = netdev_priv(ndev); - int ret = 0; - struct resource *res; -- -+ -+#ifdef CONFIG_GMAC_PHY_POWER -+ script_item_value_type_e type; -+ script_item_u item; -+ int req_status; -+#endif -+ - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "geth_extclk"); - if (unlikely(!res)){ - ret = -ENODEV; -@@ -1681,6 +1700,22 @@ static int geth_sys_request(struct platform_device *pdev) - } - } - #endif -+ -+#ifdef CONFIG_GMAC_PHY_POWER && CONFIG_GETH_SCRIPT_SYS -+ type = script_get_item("gmac_phy_power", "gmac_phy_power_en", &item); -+ if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) { -+ pr_err("script_get_item return type err\n"); -+ return -EFAULT; -+ } -+ /*request gpio*/ -+ req_status = gpio_request(item.gpio.gpio, NULL); -+ if (0 != req_status) { -+ pr_err("request gpio failed!\n"); -+ } -+ gpio_direction_output(item.gpio.gpio, 1); -+ priv->gpio_power_hd = item.gpio.gpio; -+ #endif -+ - return 0; - - pin_err: diff --git a/patch/kernel/sun8i-default/orangepi_h3_gc2305_camera.patch b/patch/kernel/sun8i-default/orangepi_h3_gc2305_camera.patch new file mode 100644 index 000000000..5fb4c6a6a --- /dev/null +++ b/patch/kernel/sun8i-default/orangepi_h3_gc2305_camera.patch @@ -0,0 +1,986 @@ +diff --git a/drivers/media/video/sunxi-vfe/device/gc2035.c b/drivers/media/video/sunxi-vfe/device/gc2035.c +index 1d3eb0e..36f94b2 100755 +--- a/drivers/media/video/sunxi-vfe/device/gc2035.c ++++ b/drivers/media/video/sunxi-vfe/device/gc2035.c +@@ -97,7 +97,676 @@ static inline struct sensor_info *to_state(struct v4l2_subdev *sd) + * The default register settings + * + */ ++/* ----------------------------------- */ ++/* comment _640x480_1280x720_ONLY */ ++/* if you want 800x600 and 1600x1200 */ ++/* ----------------------------------- */ ++#define _640x480_1280x720_ONLY + ++#ifdef _640x480_1280x720_ONLY ++static struct regval_list sensor_default_regs[] = { ++ {0xfe,0x80}, ++ {0xfe,0x80}, ++ {0xfe,0x80}, ++ {0xfc,0x06}, ++ {0xf9,0xfe}, //[0] pll enable ++ {0xfa,0x00}, ++ {0xf6,0x00}, ++ {0xf7,0x17}, //pll enable ++ {0xf8,0x00}, ++ {0xfe,0x00}, ++ {0x82,0x00}, ++ {0xb3,0x60}, ++ {0xb4,0x40}, ++ {0xb5,0x60}, ++ {0x03,0x05}, ++ {0x04,0x2e}, ++ ++ //measure window ++ {0xfe,0x00}, ++ {0xec,0x04}, ++ {0xed,0x04}, ++ {0xee,0x60}, ++ {0xef,0x90}, ++ ++ ++ ++ {0x0a,0x00}, //row start ++ {0x0c,0x02}, //col start ++ ++ {0x0d,0x04}, ++ {0x0e,0xc0}, ++ {0x0f,0x06}, //Window setting ++ {0x10,0x58},// ++ ++ {0x17,0x14}, //[0]mirror [1]flip ++ {0x18,0x0a}, //sdark 4 row in even frame?? ++ {0x19,0x0a}, //AD pipe number ++ ++ {0x1a,0x01}, //CISCTL mode4 ++ {0x1b,0x48}, ++ {0x1e,0x88}, //analog mode1 [7] tx-high en ++ {0x1f,0x0f}, //analog mode2 ++ ++ {0x20,0x05}, //[0]adclk mode [1]rowclk_MODE [2]rsthigh_en ++ {0x21,0x0f}, //[3]txlow_en ++ {0x22,0xf0}, //[3:0]vref ++ {0x23,0xc3}, //f3//ADC_r ++ {0x24,0x16}, //pad drive ++ ++ //==============================aec ++ //AEC ++ {0xfe,0x01}, ++ {0x09,0x00}, ++ ++ {0x11,0x10}, ++ {0x47,0x30}, ++ {0x0b,0x90}, ++ {0x13,0x80}, //0x75 ++ {0x1f,0xc0},//addd ++ {0x20,0x50},//add 0x60 ++ {0xfe,0x00}, ++ {0xf7,0x17}, //pll enable ++ {0xf8,0x00}, ++ {0x05,0x01}, ++ {0x06,0x18}, ++ {0x07,0x00}, ++ {0x08,0x48}, ++ {0xfe,0x01}, ++ {0x27,0x00}, ++ {0x28,0x6a}, ++ {0x29,0x03}, ++ {0x2a,0x50},//8fps ++ {0x2b,0x04}, ++ {0x2c,0xf8}, ++ {0x2d,0x06}, ++ {0x2e,0xa0},//6fps ++ {0x3e,0x40},//0x40 ++ {0xfe,0x00}, ++ {0xb6,0x03}, //AEC enable ++ {0xfe,0x00}, ++ ++ ///////BLK ++ ++ {0x3f,0x00}, //prc close??? ++ {0x40,0xa7}, // a7 77 ++ {0x42,0x7f}, ++ {0x43,0x30},//0x30 ++ ++ {0x5c,0x08}, ++ //{0x6c 3a //manual_offset ,real B channel ++ //{0x6d 3a//manual_offset ,real B channel ++ //{0x6e 36//manual_offset ,real R channel ++ //{0x6f 36//manual_offset ,real R channel ++ {0x5e,0x20}, ++ {0x5f,0x20}, ++ {0x60,0x20}, ++ {0x61,0x20}, ++ {0x62,0x20}, ++ {0x63,0x20}, ++ {0x64,0x20}, ++ {0x65,0x20}, ++ {0x66,0x20}, ++ {0x67,0x20}, ++ {0x68,0x20}, ++ {0x69,0x20}, ++ ++ /////crop// ++ {0x90,0x01}, //crop enable ++ {0x95,0x04}, //1600x1200 ++ {0x96,0xb0}, ++ {0x97,0x06}, ++ {0x98,0x40}, ++ ++ {0xfe,0x03}, ++ {0x42,0x80}, ++ {0x43,0x06}, //output buf width //buf widthÕâÒ»¿éµÄÅäÖû¹ÐèÒªžãÇå³þ ++ {0x41,0x00}, // delay ++ {0x40,0x00}, //fifo half full trig ++ {0x17,0x01}, //wid mipi²¿·ÖµÄ·ÖƵÊÇΪʲÎv£¿ ++ {0xfe,0x00}, ++ ++ {0x80,0xff},//block enable 0xff ++ {0x81,0x26},//38 //skin_Y 8c_debug ++ ++ {0x03,0x05}, ++ {0x04,0x2e}, ++ {0x84,0x00}, //output put foramat ++ {0x86,0x03}, //sync plority ++ {0x87,0x80}, //middle gamma on ++ {0x8b,0xbc},//debug modeÐèÒªžãÇå³þһϠ++ {0xa7,0x80},//B_channel_gain ++ {0xa8,0x80},//B_channel_gain ++ {0xb0,0x80}, //globle gain ++ {0xc0,0x40}, ++ ++#if 1 ++ //lsc, ++ {0xfe,0x01}, ++ {0xc2,0x10},//0x1f ++ {0xc3,0x02},//0x07 ++ {0xc4,0x03},//0x03 ++ {0xc8,0x10},//10 ++ {0xc9,0x0a},//0x0a ++ {0xca,0x08},//0x08 ++ {0xbc,0x16},// 3c ++ {0xbd,0x10},//0x1c ++ {0xbe,0x10},//0x1a ++ {0xb6,0x22},// 0x30 ++ {0xb7,0x18},//0x1c ++ {0xb8,0x15},//0x15 ++ {0xc5,0x00}, ++ {0xc6,0x00}, ++ {0xc7,0x00}, ++ {0xcb,0x00}, ++ {0xcc,0x00}, ++ {0xcd,0x00}, ++ {0xbf,0x0a},//0x0c ++ {0xc0,0x01},//0x04 ++ {0xc1,0x00}, ++ {0xb9,0x00}, ++ {0xba,0x00}, ++ {0xbb,0x00}, ++ {0xaa,0x00}, ++ {0xab,0x02},//00 ++ {0xac,0x00}, ++ {0xad,0x00}, ++ {0xae,0x00}, ++ {0xaf,0x00}, ++ {0xb0,0x00}, ++ {0xb1,0x00}, ++ {0xb2,0x00}, ++ {0xb3,0x00}, ++ {0xb4,0x02},//00 ++ {0xb5,0x00}, ++ {0xd0,0x01}, ++ {0xd2,0x02},//00 ++ {0xd3,0x00}, ++ {0xd8,0x18}, ++ {0xda,0x00}, ++ {0xdb,0x04}, ++ {0xdc,0x00}, ++ {0xde,0x07},//0x07 ++ {0xdf,0x00}, ++ {0xd4,0x00}, ++ {0xd6,0x00},//00 ++ {0xd7,0x00}, ++ {0xa4,0x20},//00 ++ {0xa5,0x02},//00 ++ {0xa6,0x04}, ++ {0xa7,0x00}, ++ {0xa8,0x20},//00 ++ {0xa9,0x02},//00 ++ {0xa1,0x80}, ++ {0xa2,0x80}, ++ ++ {0xfe,0x02}, ++ {0xa4,0x00}, ++ {0xfe,0x00}, ++ ++ {0xfe,0x02}, ++ {0xc0,0x01}, ++ {0xc1,0x40}, //Green_cc ++ {0xc2,0xfc}, ++ {0xc3,0x05}, ++ {0xc4,0xec}, ++ {0xc5,0x42}, ++ {0xc6,0xf8}, ++ {0xc7,0x40}, ++ {0xc8,0xf8}, ++ {0xc9,0x06}, ++ {0xca,0xfd}, ++ {0xcb,0x3e}, ++ {0xcc,0xf3}, ++ {0xcd,0x36}, ++ {0xce,0xf6}, ++ {0xcf,0x04}, ++ {0xe3,0x0c}, ++ {0xe4,0x44}, ++ {0xe5,0xe5}, ++ {0xfe,0x00}, ++ {0xfe,0x00}, ++ //awb ++ {0xfe,0x01}, ++ {0x4f,0x00}, ++ {0x4d,0x10}, ////////////////10 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x20}, ///////////////20 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x30}, //////////////////30 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x02}, // d65 ++ {0x4e,0x04}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x40}, //////////////////////40 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, //cwf ++ {0x4e,0x08}, // cwf ++ {0x4e,0x04}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x50}, //////////////////50 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x10}, // tl84 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x60}, /////////////////60 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x70}, ///////////////////70 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x20}, // a ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x80}, /////////////////////80 ++ {0x4e,0x00}, //H ++ {0x4e,0x40}, // h ++ {0x4e,0x00}, //A ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0x90}, //////////////////////90 ++ {0x4e,0x00}, // h ++ {0x4e,0x40}, ++ {0x4e,0x40}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0xa0}, /////////////////a0 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0xb0}, //////////////////////////////////b0 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0xc0}, //////////////////////////////////c0 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0xd0}, ////////////////////////////d0 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0xe0}, /////////////////////////////////e0 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4d,0xf0}, /////////////////////////////////f0 ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4e,0x00}, ++ {0x4f,0x01}, ++#endif ++ {0xfe,0x01}, ++ {0x50,0x88}, ++ {0x52,0x40}, ++ {0x54,0x60}, ++ {0x56,0x06}, ++ {0x57,0x20}, //pre adjust ++ {0x58,0x01}, ++ {0x5c,0xf0}, ++ {0x5d,0x40}, ++ {0x5b,0x02}, //AWB_gain_delta ++ {0x61,0xaa},//R/G stand ++ {0x62,0xaa},//R/G stand ++ {0x71,0x00}, ++ {0x74,0x10}, //AWB_C_max ++ {0x77,0x08}, //AWB_p2_x ++ {0x78,0xfd}, //AWB_p2_y ++ {0x86,0x30}, ++ {0x87,0x00}, ++ {0x88,0x06},//04 ++ {0x8a,0x8a},//awb move mode ++ {0x89,0x75}, ++ {0x84,0x08}, //auto_window ++ {0x8b,0x00}, //awb compare luma ++ {0x8d,0x70}, //awb gain limit R ++ {0x8e,0x70},//G ++ {0x8f,0xf4},//B ++ {0x5e,0xa4}, ++ {0x5f,0x60}, ++ {0x92,0x58}, ++ {0xfe,0x00}, ++ {0x82,0x02},//awb_en ++ ++ //{0xfe ,0xec}, luma_value ++ ++ {0xfe,0x01}, ++ {0x1e,0xf1}, ++ {0x9c,0x00}, //add abs slope 0x02 ++ {0x21,0xbf}, ++ {0xfe,0x02}, ++ {0xa5,0x60}, //lsc_th //40 ++ {0xa2,0xc0}, //lsc_dec_slope 0xa0 ++ {0xa3,0x30}, //when total gain is bigger than the value, enter dark light mode 0x20 added ++ {0xa4,0x00},//add ++ {0xa6,0x50}, //dd_th ++ {0xa7,0x80}, //ot_th 30 ++ {0xab,0x31}, //[0]b_dn_effect_dark_inc_or_dec ++ {0x88,0x15}, //[5:0]b_base ++ {0xa9,0x6c}, //[7:4] ASDE_DN_b_slope_high 0x6c 0x6f ++ ++ {0xb0,0x66}, //6edge effect slope 0x66 0x88 0x99 ++ ++ {0xb3,0x70}, //saturation dec slope //0x70 0x40 ++ {0xb4,0x32},//0x32 0x42 ++ {0x8c,0xf6}, //[2]b_in_dark_inc ++ {0x89,0x03}, //dn_c_weight 0x03 ++ ++ {0xde,0xb8}, //b6[7]asde_autogray [3:0]auto_gray_value 0xb9 0xb8 0xb9 ++ {0x38,0x06}, //0aasde_autogray_slope 0x08 0x05 0x06 0x0a ++ {0x39,0x50}, //50asde_autogray_threshold 0x50 0x30 ++ ++ {0xfe,0x00}, ++ {0x81,0x24}, //0x26 ++ {0x87,0x90}, //[5:4]first_dn_en first_dd_en enable 0x80 0xb0 ++ ++ {0xfe,0x02}, ++ {0x83,0x00},//[6]green_bks_auto [5]gobal_green_bks ++ {0x84,0x45},//RB offset ++ {0xd1,0x38}, //saturation_cb 0x3a ++ {0xd2,0x38}, //saturation_Cr 0x38 ++ {0xd3,0x30}, ++ {0xdc,0x30}, ++ {0xdd,0xb8}, //edge_sa_g,b ++ {0xfe,0x00}, ++ {0xad,0x80},//80 ++ {0xae,0x7d},//80 ++ {0xaf,0x80}, ++ ++ //gmma-curve4-low strech ++ {0xfe,0x02}, ++ {0x15,0x05}, ++ {0x16,0x0b}, ++ {0x17,0x10}, ++ {0x18,0x16}, ++ {0x19,0x24}, ++ {0x1a,0x32}, ++ {0x1b,0x42}, ++ {0x1c,0x4e}, ++ {0x1d,0x64}, ++ {0x1e,0x76}, ++ {0x1f,0x86}, ++ {0x20,0x94}, ++ {0x21,0x9f}, ++ {0x22,0xb4}, ++ {0x23,0xc3}, ++ {0x24,0xce}, ++ {0x25,0xd7}, ++ {0x26,0xe3}, ++ {0x27,0xec}, ++ {0x28,0xf7}, ++ {0x29,0xff}, ++ ++ ++ ++ //y-gamma ++ {0x2b,0x00}, ++ {0x2c,0x04}, ++ {0x2d,0x09}, ++ {0x2e,0x18}, ++ {0x2f,0x27}, ++ {0x30,0x37}, ++ {0x31,0x49}, ++ {0x32,0x5c}, ++ {0x33,0x7e}, ++ {0x34,0xa0}, ++ {0x35,0xc0}, ++ {0x36,0xe0}, ++ {0x37,0xff}, ++ {0xfe,0x00}, ++ ++ {0xfe,0x00}, ++ ++ {0x82,0xfe}, ++ //sleep 400 ++ {0xf2,0x70}, ++ {0xf3,0xff}, ++ {0xf4,0x00}, ++ {0xf5,0x30}, ++ {0xfe,0x01}, ++ {0x0b,0x90}, ++ {0x87,0x00},//0x10 ++ {0xfe,0x00}, ++ ++ /////,0xup},date ++ //ÈÈ?0x }, ++ {0xfe,0x02}, ++ {0xa6,0x80}, //dd_th ++ {0xa7,0x60}, //ot_th //0x80 ++ {0xa9,0x66}, //6f[7:4] ASDE_DN_b_slope_high 0x68 ++ {0xb0,0x88}, //edge effect slope 0x99 ++ {0x38,0x08}, //asde_autogray_slope 0x08 0x0f 0x0a 0b ++ {0x39,0x50}, //asde_autogray_threshold 0x60 ++ {0xfe,0x00}, ++ {0x87,0x90}, //[5:4]first_dn_en first_dd_en 0x90 ++ ++ {0xfe,0x00}, ++ {0x90,0x01}, ++ {0x95,0x01}, ++ {0x96,0xe0}, ++ {0x97,0x02}, ++ {0x98,0x80}, ++ {0xc8,0x14}, ++ {0xf7,0x0D}, ++ {0xf8,0x83}, ++ {0xfa,0x00},//pll=4 ++ {0x05,0x00}, ++ {0x06,0xc4}, ++ {0x07,0x00}, ++ {0x08,0xae}, ++ {0xad,0x80}, ++ {0xae,0x7a}, ++ {0xaf,0x7a}, ++ {0xfe,0x01}, ++ {0x27,0x00}, ++ {0x28,0xe5}, ++ {0x29,0x05}, ++ {0x2a,0x5e},//18fps ++ {0x2b,0x07}, ++ {0x2c,0x28},//12.5fps ++ {0x2d,0x0a}, ++ {0x2e,0xbc},//8fps ++ {0x3e,0x40},// exposure level ++ {0xfe,0x03}, ++ {0x42,0x04}, ++ {0x43,0x05}, //output buf width ++ {0x41,0x02}, // delay ++ {0x40,0x40}, //fifo half full trig ++ {0x17,0x00}, //widv is 0 ++ {0xfe,0x00}, ++ {0xc8,0x55}, ++}; ++#else + static struct regval_list sensor_default_regs[] = { + {0xfe , 0x80}, + {0xfe , 0x80}, +@@ -774,6 +1443,7 @@ static struct regval_list sensor_default_regs[] = { + + #endif + }; ++#endif + + /* 1600X1200 UXGA capture */ + static struct regval_list sensor_uxga_regs[] ={ +@@ -827,73 +1497,101 @@ static struct regval_list sensor_svga_regs[] = + {0x98,0x20}, + }; + ++/* 640X480 VGA */ ++static struct regval_list sensor_vga_regs[] = ++{ ++ {0xfe , 0x00}, ++ ++ {0x0a , 0x00}, //row start ++ {0x0c , 0x00}, //col start ++ ++ {0x0d , 0x04}, ++ {0x0e , 0xc0}, ++ {0x0f , 0x06}, //Window setting ++ {0x10 , 0x58},// ++ ++ {0x90 , 0x01}, ++ {0x94 , 0x00}, ++ {0x95 , 0x01}, ++ {0x96 , 0xe0}, ++ {0x97 , 0x02}, ++ {0x98 , 0x80}, ++ {0xc8 , 0x15}, ++ ++ ++ ++ {0xfa , 0x00}, ++ ++ ++ {0xfe , 0x03}, ++ {0x42 , 0x00}, ++ {0x43 , 0x05}, //output buf width 280*2=500 ++ {0x41 , 0x02}, // delay ++ {0x40 , 0x40}, //fifo half full trig ++ {0x17 , 0x00}, //widv is 0 ++ ++ {0xfe , 0x00}, ++ {0xc8 , 0x55}, ++ {0xb6 , 0x03},//aec on ++}; ++ ++ + ////1280*720---init---/// +-//static struct regval_list Gc2015_sensor_hd720_regs[] = { +-// +-// +-//{0xfe , 0x00}, +-//{0x05, 0x01}, +-//{0x06, 0x9e}, +-//{0x07, 0x01}, +-//{0x08, 0x6d}, +-//{0x0a , 0xf0}, //row start +-//{0x0c , 0xa0}, //col start +-//{0x0d , 0x02}, +-//{0x0e , 0xd8}, +-//{0x0f , 0x05}, //Window setting +-//{0x10 , 0x18}, +-// +-//{0xfe, 0x01}, +-//{0x27, 0x00}, +-//{0x28, 0xd9}, +-//{0x29, 0x04}, +-//{0x2a, 0x3d},//18fps +-//{0x2b, 0x06}, +-//{0x2c, 0xc8},//12.5fps +-//{0x2d, 0x0a}, +-//{0x2e, 0x2c},//8fps +-//{0x3e, 0x40},//0x40 0x00 +-// +-////measure window +-//{0xfe, 0x00}, +-//{0xec, 0x04}, +-//{0xed, 0x04}, +-//{0xee, 0x50}, +-//{0xef, 0x58}, +-// +-// +-// +-// +-//{0x90 , 0x01}, //crop enable +-//{0x95 , 0x02}, +-//{0x96 , 0xd0}, +-//{0x97 , 0x05}, +-//{0x98 , 0x00}, +-// +-// +-//{0xfe , 0x03}, +-//{0x42 , 0x80}, +-//{0x43 , 0x06}, //output buf width +-//{0x41 , 0x00}, // delay +-//{0x40 , 0x00}, //fifo half full trig +-//{0x17 , 0x01}, //widv +-//{0xfe , 0x00}, +-// +-// +-//{0x99, 0x11}, +-//{0xc8, 0x00}, +-// +-//{0xfa, 0x11}, +-// +-// +-// +-// +-// +-//{0xff, 0xff}, +-// +-// +-// +-//}; ++static struct regval_list Gc2015_sensor_hd720_regs[] = ++{ ++{0xfe , 0x00}, ++{0x05, 0x01}, ++{0x06, 0x9e}, ++{0x07, 0x01}, ++{0x08, 0x6d}, ++{0x0a , 0xf0}, //row start ++{0x0c , 0xa0}, //col start ++{0x0d , 0x02}, ++{0x0e , 0xd8}, ++{0x0f , 0x05}, //Window setting ++{0x10 , 0x18}, ++ ++{0xfe, 0x01}, ++{0x27, 0x00}, ++{0x28, 0xd9}, ++{0x29, 0x04}, ++{0x2a, 0x3d},//18fps ++{0x2b, 0x06}, ++{0x2c, 0xc8},//12.5fps ++{0x2d, 0x0a}, ++{0x2e, 0x2c},//8fps ++{0x3e, 0x40},//0x40 0x00 ++ ++//measure window ++{0xfe, 0x00}, ++{0xec, 0x04}, ++{0xed, 0x04}, ++{0xee, 0x50}, ++{0xef, 0x58}, ++ ++{0x90 , 0x01}, //crop enable ++{0x95 , 0x02}, ++{0x96 , 0xd0}, ++{0x97 , 0x05}, ++{0x98 , 0x00}, ++ ++ ++{0xfe , 0x03}, ++{0x42 , 0x80}, ++{0x43 , 0x06}, //output buf width ++{0x41 , 0x00}, // delay ++{0x40 , 0x00}, //fifo half full trig ++{0x17 , 0x01}, //widv ++{0xfe , 0x00}, ++ ++{0x99, 0x11}, ++{0xc8, 0x00}, ++ ++{0xfa, 0x11}, ++ ++{0xff, 0xff}, ++ ++}; + + + +@@ -2427,16 +3125,16 @@ sensor_win_sizes[] = { + .regs_size = ARRAY_SIZE(sensor_uxga_regs), + .set_size = NULL, + }, +-// /* 720p */ +-// { +-// .width = HD720_WIDTH, +-// .height = HD720_HEIGHT, +-// .hoffset = 0, +-// .voffset = 0, +-// .regs = Gc2015_sensor_hd720_regs, +-// .regs_size = ARRAY_SIZE(Gc2015_sensor_hd720_regs), +-// .set_size = NULL, +-// }, ++ /* 720p */ ++ { ++ .width = HD720_WIDTH, ++ .height = HD720_HEIGHT, ++ .hoffset = 0, ++ .voffset = 0, ++ .regs = Gc2015_sensor_hd720_regs, ++ .regs_size = ARRAY_SIZE(Gc2015_sensor_hd720_regs), ++ .set_size = NULL, ++ }, + /* SVGA */ + { + .width = SVGA_WIDTH, +@@ -2448,7 +3146,6 @@ sensor_win_sizes[] = { + .set_size = NULL, + }, + /* VGA */ +- /* + { + .width = VGA_WIDTH, + .height = VGA_HEIGHT, +@@ -2458,7 +3155,6 @@ sensor_win_sizes[] = { + .regs_size = ARRAY_SIZE(sensor_vga_regs), + .set_size = NULL, + }, +- */ + }; + + #define N_WIN_SIZES (ARRAY_SIZE(sensor_win_sizes)) +@@ -2571,14 +3267,12 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, + if (ret) + return ret; + ++#ifndef _640x480_1280x720_ONLY + if((wsize->width==1600)&&(wsize->height==1200)) //capture mode >640*480 + { + // printk(" read 2035 exptime 11111111\n" ); +- + sensor_write(sd, 0xfe, 0x00); +- + sensor_write(sd, 0xb6, 0x02); +- + /*read shutter */ + sensor_read(sd, 0x03, &val); + temp |= (val<< 8); +@@ -2591,6 +3285,7 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, + shutter=temp; + // printk(" shutter = [%x]\n", shutter); + } ++#endif + + sensor_write_array(sd, sensor_fmt->regs , sensor_fmt->regs_size); + +@@ -2612,28 +3307,47 @@ static int sensor_s_fmt(struct v4l2_subdev *sd, + ////////// + + #if 1 ++ ++#ifdef _640x480_1280x720_ONLY ++ if((wsize->width==1600)&&(wsize->height==1200)) { ++ ++ sensor_write(sd, 0xfe, 0x00); ++ sensor_write(sd, 0xb6, 0x02); // AEC OFF ++ sensor_read(sd, 0x03, &val); ++ temp |= (val<< 8); ++ sensor_read(sd, 0x04, &val); ++ temp |= (val & 0xff); ++ shutter=temp; ++ shutter= shutter /2; // 2 ++ if (shutter < 1) ++ shutter = 1; ++ val = ((shutter>>8)&0xff); ++ sensor_write(sd, 0x03, val); ++ val = (shutter&0xff); ++ sensor_write(sd, 0x04, val); ++ msleep(550); ++ } ++#else + if((wsize->width==1600)&&(wsize->height==1200)) + { +- +- + //printk(" write 2035 exptime 22222222\n" ); +- +- + sensor_write(sd, 0xfe, 0x00); +- + shutter= shutter /2; // 2 +- + if(shutter < 1) shutter = 1; + val = ((shutter>>8)&0xff); + // printk(" write0x03 = [%x]\n", regs.value[0]); + sensor_write(sd, 0x03, val); +- + val = (shutter&0xff); +- + sensor_write(sd, 0x04, val); +- + msleep(550); + } ++#endif ++ if((wsize->width==640)&&(wsize->height==480)) { ++ mdelay(50);//200 ++ sensor_write(sd, 0xb6, 0x03); // AEC ON ++ mdelay(300); ++ } ++ + + #endif + ///////////////////////////// +@@ -3041,3 +3755,4 @@ static __exit void exit_sensor(void) + + module_init(init_sensor); + module_exit(exit_sensor); ++