enable-gpios = <&gpio3 GPIO_C1 GPIO_ACTIVE_HIGH>;
};
+ gpio_poweroff {
+ compatible = "gpio-poweroff";
+ gpios = <&gpio1 GPIO_A2 GPIO_ACTIVE_LOW>;
+ };
usb_control {
compatible = "rockchip,rk3126-usb-control";
compatible = "rk30-adc-battery";
io-channels = <&adc 0>;
dc_det_gpio = <&gpio2 GPIO_B1 GPIO_ACTIVE_LOW>;
- pwr_hold = <&gpio1 GPIO_A2 GPIO_ACTIVE_LOW>;
//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
&dwc_control_usb {
usb_uart {
- status = "disabled";
+ status = "ok";
};
};
#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);
unsigned long gSecondsCnt = 0;
char gDischargeFlag[4] = {"on "};
-int pwr_hold;
-
#if 1
#define BATT_MAX_VOL_VALUE 4250/*Full charge volatge*/
#define BATT_ZERO_VOL_VALUE 3500/*power down voltage*/
{
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
static ssize_t bat_param_read(struct device *dev,struct device_attribute *attr, char *buf)
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) {
memset(data->adc_samples, 0, sizeof(int)*(NUM_VOLTAGE_SAMPLE + 2));
//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
/*data->client = client;*/
data->adc_val = rk_adc_battery_iio_read(data->pdata);
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/unistd.h>
+#ifdef CONFIG_ARCH_ROCKCHIP
+#include <asm/system_misc.h>
+#endif
#ifndef SET_UNALIGN_CTL
# define SET_UNALIGN_CTL(a,b) (-EINVAL)
printk(KERN_EMERG "Power down.\n");
kmsg_dump(KMSG_DUMP_POWEROFF);
machine_power_off();
+#ifdef CONFIG_ARCH_ROCKCHIP
+ arm_pm_restart('h', "charge");
+#endif
}
EXPORT_SYMBOL_GPL(kernel_power_off);