rk3288:bq24296:add dc_det_pin func,support power on when no usb

This commit is contained in:
张晴
2014-03-22 21:23:52 +08:00
parent 61c1380919
commit 3e7a8bc24e
3 changed files with 25 additions and 1 deletions

View File

@@ -221,7 +221,7 @@
bq24296: bq24296@6b {
compatible = "ti,bq24296";
reg = <0x6b>;
gpios = <&gpio0 GPIO_A7 GPIO_ACTIVE_HIGH>;
gpios = <&gpio0 GPIO_A7 GPIO_ACTIVE_HIGH>,<&gpio0 GPIO_B0 GPIO_ACTIVE_HIGH>;
bq24296,chg_current = <1000 500 3000>;
status = "okay";
};

View File

@@ -383,6 +383,24 @@ static void usb_detect_work_func(struct work_struct *work)
DBG("%s: retval = %08x bq24296_chag_down = %d\n", __func__,retval,bq24296_chag_down);
#ifdef CONFIG_OF
if (gpio_is_valid(bq24296_pdata->dc_det_pin)){
ret = gpio_request(bq24296_pdata->dc_det_pin, "bq24296_dc_det");
if (ret < 0) {
DBG("Failed to request gpio %d with ret:""%d\n",bq24296_pdata->dc_det_pin, ret);
}
gpio_direction_input(bq24296_pdata->dc_det_pin);
ret = gpio_get_value(bq24296_pdata->dc_det_pin);
if (ret ==0){
bq24296_update_input_current_limit(bq24296_di->adp_input_current);
bq24296_set_charge_current(bq24296_di->chg_current);
bq24296_charge_mode_config(0);
}
gpio_free(bq24296_pdata->dc_det_pin);
DBG("%s: bq24296_di->dc_det_pin=%x\n", __func__, ret);
}
#endif
mutex_lock(&pi->var_lock);
DBG("%s: dwc_otg_check_dpdm %d\n", __func__, dwc_otg_check_dpdm(0));
switch(dwc_otg_check_dpdm(0))
@@ -457,6 +475,11 @@ static struct bq24296_board *bq24296_parse_dt(struct bq24296_device_info *di)
if (!gpio_is_valid(pdata->chg_irq_pin)) {
printk("invalid gpio: %d\n", pdata->chg_irq_pin);
}
pdata->dc_det_pin = of_get_named_gpio(bq24296_np,"gpios",1);
if (!gpio_is_valid(pdata->dc_det_pin)) {
printk("invalid gpio: %d\n", pdata->dc_det_pin);
}
return pdata;
}

View File

@@ -153,6 +153,7 @@ struct bq24296_platform_data {
struct bq24296_board {
unsigned int otg_usb_pin;
unsigned int chg_irq_pin;
unsigned int dc_det_pin;
unsigned int psel_pin;
struct device_node *of_node;
unsigned int chg_current[3];