static int axp_battery_first_init(struct axp_charger *charger) { int ret; uint8_t val; axp_set_charge(charger); ret = axp_battery_adc_set(charger); if(ret) return ret; ret = axp_read(charger->master, AXP81X_ADC_CONTROL4, &val); spin_lock(&charger->charger_lock); switch ((val >> 4) & 0x03) { case 0: charger->sample_time = 100; break; case 1: charger->sample_time = 200; break; case 2: charger->sample_time = 400; break; case 3: charger->sample_time = 800; break; default: break; } spin_unlock(&charger->charger_lock); return ret; }
static int axp_battery_first_init(struct axp_charger *charger) { int ret; axp_set_charge(charger); ret = axp_battery_adc_set(charger); return ret; }
static int axp_battery_first_init(struct axp_charger *charger) { int ret; uint8_t val; axp_set_charge(charger); ret = axp_battery_adc_set(charger); if(ret) return ret; ret = axp_read(charger->master, AXP19_ADC_CONTROL3, &val); switch ((val >> 6) & 0x03){ case 0: charger->sample_time = 25;break; case 1: charger->sample_time = 50;break; case 2: charger->sample_time = 100;break; case 3: charger->sample_time = 200;break; default:break; } return ret; }