Ejemplo n.º 1
0
static void bq27541_battery_work(struct work_struct *work)
{
	unsigned int value;
	struct bq27541_dev_info *di = container_of(work,
						     struct bq27541_dev_info,
						     monitor_work.work);
	const int interval = HZ * 10;
	pr_info("at %s\n",__func__);
	//bq27541_battery_update_status(di);
    if(!bBq27541Supend)
    {
	   /*if ((di->battery_status == POWER_SUPPLY_STATUS_CHARGING)
	   	&& (bq27x00_battery_ai(di)<0)) //something wrong with mc23892
	   {
    	   	pmic_read_reg(REG_CHARGE, &value, 0xffffff);
    	   	value |= 0x100000;
    	   	pmic_write_reg(REG_CHARGE, value, 0xffffff);
	   }*/
	   if(plat_data->ch_status()){
            set_charge_current();
        }
    	bq27541_battery_update_status(di);
    }
	queue_delayed_work(di->monitor_wqueue, &di->monitor_work, interval);
}
Ejemplo n.º 2
0
static int usbdc_thread(void *unused)
{

	while(1)
	{
		set_current_state(TASK_INTERRUPTIBLE);
		schedule();
		
		msleep(200);

        	bFastCharge = 0;
		if (plat_data != NULL)
		{
			if (bq27x00_battery_ai(di) > 0) {
				di->battery_status = POWER_SUPPLY_STATUS_DISCHARGING;
			} else {
				di->battery_status = POWER_SUPPLY_STATUS_CHARGING;
                		set_charge_current();
			}
		}

		if ( di != NULL)
		{
			power_supply_changed(&di->bat);
		}
	}
    return 0;
}
Ejemplo n.º 3
0
 bool CapacitiveSensor::connect(ConnectionPtr the_device)
 {
     m_impl->m_sensor_device = the_device;
     m_impl->m_sensor_accumulator.clear();
     
     if(the_device /*&& the_uart_device->is_open()*/)
     {
         the_device->drain();
         set_thresholds(m_impl->m_thresh_touch, m_impl->m_thresh_release);
         set_charge_current(m_impl->m_charge_current);
         m_impl->m_sensor_device->set_receive_cb(std::bind(&CapacitiveSensor::receive_data,
                                                           this,
                                                           std::placeholders::_1,
                                                           std::placeholders::_2));
         return true;
     }
     return false;
 }