86v:电池检测,摄像头的整理修改
authorxhh <xhh@rock-chips.com>
Sat, 13 Sep 2014 03:22:51 +0000 (11:22 +0800)
committerxhh <xhh@rock-chips.com>
Sat, 13 Sep 2014 03:22:51 +0000 (11:22 +0800)
arch/arm/boot/dts/rk3126-86v.dts
arch/arm/boot/dts/rk3126-cif-sensor.dtsi
arch/arm/configs/rk3126_86v_defconfig
drivers/power/rk30_factory_adc_battery.c [changed mode: 0644->0755]
include/linux/power/rk30_factory_adc_battery.h [deleted file]

index 70794e07c672c7757ae4f01312f5d57d74167356..2d570af3100553a16a4205bc959016c3f4ef0e0d 100755 (executable)
@@ -25,7 +25,7 @@
         wireless-wlan {
         compatible = "wlan-platdata";
 
-        wifi_chip_type = "rtl8188eu";
+        wifi_chip_type = "rtkwifi";
         sdio_vref = <1800>; //1800mv or 3300mv
 
         //power_ctrl_by_pmu;
@@ -70,7 +70,7 @@
                                200000 1100000
                                300000 1100000
                                400000 1100000
-                               533000 1100000
+                               533000 1250000
                                >;
 
                        freq-table = <
                                /* KHz    uV */
                                //200000 1250000
                                300000 1100000
-                          400000  1100000
-                          480000  1200000
+                          400000  1150000
+                          480000  1250000
                        
                        //300000 1250000
                                >;
                //bat_low_gpio = <&gpio0 GPIO_A7 GPIO_ACTIVE_LOW>;
                //chg_ok_gpio = <&gpio0 GPIO_B1 GPIO_ACTIVE_HIGH>;
                bat_table = <0 0 0 0 100 100
-                 3500 3729 3860 3910 3959 4000 4044 4086 4150 4208 4250
-                 3750 3900 4020 4080 4125 4185 4215 4240 4275 4295 4300
+                 3500 3619 3678 3734 3742 3783 3813 3884 3968 4110 4220
+                 3750 3710 3770 3830 3850 3880 3910 3980 4060 4240 4300
                 >;
                is_dc_charge = <1>;
                is_usb_charge = <0>;
index c056d7e9eb98e1c40928985f15f48349fd2b9210..f9d26410f4215450d3d1cd05981a207b529207c4 100755 (executable)
                        is_front = <1>;
                        rockchip,power = <&gpio2 GPIO_B2 GPIO_ACTIVE_HIGH>; 
                        rockchip,powerdown = <&gpio1 GPIO_B2 GPIO_ACTIVE_HIGH>;
+                       pwdn_active = <gc0308_PWRDN_ACTIVE>;
+                       pwr_active = <PWR_ACTIVE_HIGH>;
                        mir = <0>;
                        flash_attach = <0>;
                        resolution = <gc0308_FULL_RESOLUTION>;
-                       pwdn_info = <gc0308_PWRDN_ACTIVE>;
                        powerup_sequence = <gc0308_PWRSEQ>;
                        orientation = <0>;              
                        i2c_add = <gc0308_I2C_ADDR>;
                        is_front = <0>;
                        rockchip,power = <&gpio2 GPIO_B2 GPIO_ACTIVE_HIGH>; 
                        rockchip,powerdown = <&gpio1 GPIO_B1 GPIO_ACTIVE_HIGH>;
+                       pwdn_active = <gc2035_PWRDN_ACTIVE>;
+                       pwr_active = <PWR_ACTIVE_HIGH>;
                        mir = <0>;
                        flash_attach = <0>;
                        resolution = <gc2035_FULL_RESOLUTION>;
-                       pwdn_info = <gc2035_PWRDN_ACTIVE>;
                        powerup_sequence = <gc2035_PWRSEQ>;
                        orientation = <0>;              
                        i2c_add = <gc2035_I2C_ADDR>;
index 74f3989490a308499870f09d7361c607a67384f2..c42a54bee3908efe078bf8f22d498078c9d6f3f3 100755 (executable)
@@ -210,6 +210,7 @@ CONFIG_RFKILL=y
 CONFIG_RFKILL_RK=y
 CONFIG_DEVTMPFS=y
 CONFIG_DMA_CMA=y
+CONFIG_CMA_SIZE_MBYTES=4
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_UID_STAT=y
 CONFIG_SRAM=y
@@ -332,6 +333,10 @@ CONFIG_SPI_ROCKCHIP_DMA=y
 CONFIG_SPI_ROCKCHIP_TEST=y
 CONFIG_DEBUG_GPIO=y
 CONFIG_GPIO_SYSFS=y
+CONFIG_CHARGER_RT5025=y
+CONFIG_BATTERY_RT5025=y
+CONFIG_CHARGER_RT5036=y
+CONFIG_RT_POWER=y
 CONFIG_BATTERY_RICOH619=y
 CONFIG_BATTERY_BQ24296=y
 CONFIG_BATTERY_BQ27320=y
@@ -339,6 +344,13 @@ CONFIG_BATTERY_RK30_ADC_FAC=y
 CONFIG_CW2015_BATTERY=y
 CONFIG_SENSORS_ROCKCHIP_TSADC=y
 CONFIG_THERMAL=y
+CONFIG_MFD_RT5025=y
+CONFIG_MISC_RT5025=y
+CONFIG_IRQ_RT5025=y
+CONFIG_DEBUG_RT5025=y
+CONFIG_MFD_RT5036=y
+CONFIG_MISC_RT5036=y
+CONFIG_IRQ_RT5036=y
 CONFIG_MFD_RK808=y
 CONFIG_MFD_RK818=y
 CONFIG_MFD_RICOH619=y
@@ -346,6 +358,8 @@ CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_ACT8846=y
 CONFIG_ACT8846_SUPPORT_RESET=y
+CONFIG_REGULATOR_RT5025=y
+CONFIG_REGULATOR_RT5036=y
 CONFIG_ROCKCHIP_PWM_REGULATOR=y
 CONFIG_REGULATOR_SYR82X=y
 CONFIG_REGULATOR_RICOH619=y
@@ -358,6 +372,7 @@ CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_GC0308=y
 # CONFIG_GC0329 is not set
 CONFIG_GC2035=y
+# CONFIG_OV2659 is not set
 CONFIG_MALI_MIDGARD=m
 CONFIG_MALI_MIDGARD_DVFS=y
 CONFIG_MALI_MIDGARD_RT_PM=y
@@ -517,6 +532,7 @@ CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_SWITCH=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HYM8563=y
+CONFIG_RTC_RT5036=y
 CONFIG_RTC_DRV_RC5T619=y
 CONFIG_STAGING=y
 CONFIG_ZSMALLOC=y
old mode 100644 (file)
new mode 100755 (executable)
index 157e21e..b07d98f
@@ -44,6 +44,7 @@
 #include <linux/iio/driver.h>
 #include <linux/iio/consumer.h>
 
+#include <asm/system_misc.h>
 #ifdef CONFIG_EARLYSUSPEND
 /* kernel/power/earlysuspend.c */
 extern suspend_state_t get_suspend_state(void);
@@ -60,8 +61,8 @@ do {\
 
 #define        TIMER_MS_COUNTS          1000   
 #define        SLOPE_SECOND_COUNTS                    15       
-#define        DISCHARGE_MIN_SECOND                   60
-#define        CHARGE_MIN_SECOND                      45       
+#define        DISCHARGE_MIN_SECOND                   30
+#define        CHARGE_MIN_SECOND                      30       
 #define        CHARGE_MID_SECOND                      90       
 #define        CHARGE_MAX_SECOND                      250
 #define   CHARGE_FULL_DELAY_TIMES          10     
@@ -104,6 +105,7 @@ int    gDoubleVoltageCnt = 6800;
 unsigned long gSecondsCnt = 0;
 char gDischargeFlag[4] = {"on "};
 
+int pwr_hold;
 
 #if 1
 #define BATT_MAX_VOL_VALUE     4250/*Full  charge volatge*/
@@ -245,6 +247,35 @@ static  bool batt_gpio_is_valid(int number)
        return number > 0 && number < 256;
 }
 
+static void v86_pm_power_off(void)
+{
+
+   bool isCharging = false; 
+       if (batt_gpio_is_valid(gBatteryData->pdata->dc_det_pin)){
+               if (gpio_get_value (gBatteryData->pdata->dc_det_pin) == gBatteryData->pdata->dc_det_level){
+                               isCharging = 1;
+                       }else{
+                               isCharging = 0;
+                       }
+       }
+   //gpio_direction_output(pwr_hold, GPIO_LOW);
+   printk("xhh ========= v86_pm_power_off \n"); 
+   gpio_request(pwr_hold, NULL);
+   //mdelay(500);
+      if(isCharging)
+   {
+       printk("xhh ========= isCharging \n");
+      arm_pm_restart('h', "charge");     
+   }
+   else
+   {
+       printk("xhh ========= power off \n");
+       gpio_direction_output(pwr_hold, RK30_GPIO_LOW);
+         gpio_set_value(pwr_hold,RK30_GPIO_LOW);       
+   } 
+   while(1);
+
+}
 
 #ifdef  BATTERY_APK
 //#define BAT_ADC_TABLE_LEN               11
@@ -2179,6 +2210,10 @@ rk30_adc_battery_platform_data *data)
        if (batt_gpio_is_valid(data->charge_ok_pin))
                data->charge_ok_level = (flags & OF_GPIO_ACTIVE_LOW)
                ? RK30_GPIO_LOW : RK30_GPIO_HIGH;
+               pwr_hold = of_get_named_gpio_flags(node, "pwr_hold", 0,
+                                                   &flags);
+       if (pwr_hold == -EPROBE_DEFER)
+               printk("%s  pwr_hold error\n",__func__);
 
        ret = of_property_read_u32(node, "is_dc_charge", &value);
        if (ret < 0) {
@@ -2291,6 +2326,9 @@ static int rk30_adc_battery_probe(struct platform_device *pdev)
 
         //register adc for battery sample
 
+       if (!pm_power_off) {
+               pm_power_off = v86_pm_power_off;
+       }       
        data->wq = create_singlethread_workqueue("adc_battd");
            
         //variable init
diff --git a/include/linux/power/rk30_factory_adc_battery.h b/include/linux/power/rk30_factory_adc_battery.h
deleted file mode 100755 (executable)
index c794a10..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * RockChip ADC Battery Driver 
- * Copyright (C) 2012, RockChip
- *
- * Authors: xuhuicong <xhc@rock-chips.com>
- *
- * Based on rk30_adc_battery.c
-
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#ifndef RK30_FACTORY_ADC_BATTERY_H
-#define RK30_FACTORY_ADC_BATTERY_H
-
-
-/* adc battery */
-struct rk30_adc_battery_platform_data {
-       int (*io_init)(void);
-       int (*io_deinit)(void);
-       int (*is_dc_charging)(void);
-       int (*charging_ok)(void);
-
-       int (*is_usb_charging)(void);
-       int spport_usb_charging ;
-       int (*control_usb_charging)(int);
-
-       int usb_det_pin;
-       int dc_det_pin;
-       int batt_low_pin;
-       int charge_ok_pin;
-       int charge_set_pin;
-       int back_light_pin;
-
-       int ctrl_charge_led_pin;
-       int ctrl_charge_enable;
-       void (*ctrl_charge_led)(int);
-       
-       int dc_det_level;
-       int batt_low_level;
-       int charge_ok_level;
-       int charge_set_level;
-       int usb_det_level;
-       
-       int adc_channel;
-
-       int dc_det_pin_pull;    //pull up/down enable/disbale
-       int batt_low_pin_pull;
-       int charge_ok_pin_pull;
-       int charge_set_pin_pull;
-
-       int low_voltage_protection; // low voltage protection
-
-       int charging_sleep; // don't have lock,if chargeing_sleep = 0;else have lock
-       
-       int is_reboot_charging;
-       int save_capacity;  //save capacity to /data/bat_last_capacity.dat,  suggested use
-
-       int reference_voltage; // the rK2928 is 3300;RK3066 and rk29 are 2500;rk3066B is 1800;
-       int pull_up_res;      //divider resistance ,  pull-up resistor
-       int pull_down_res; //divider resistance , pull-down resistor
-
-       int time_down_discharge; //the time of capactiy drop 1% --discharge
-       int time_up_charge; //the time of capacity up 1% ---charging 
-
-       int  use_board_table;
-       int  table_size;
-       int  *discharge_table;
-       int  *charge_table;
-       int  *property_tabel;
-       int *board_batt_table;
-       int *dts_batt_table;
-
-int is_dc_charge;
-int is_usb_charge;
- struct iio_channel *chan;
-
-};
-
-#endif