Lines Matching refs:chip

60 	struct max17040_chip *chip = power_supply_get_drvdata(psy);  in max17040_get_property()  local
64 val->intval = chip->status; in max17040_get_property()
67 val->intval = chip->online; in max17040_get_property()
70 val->intval = chip->vcell; in max17040_get_property()
73 val->intval = chip->soc; in max17040_get_property()
113 struct max17040_chip *chip = i2c_get_clientdata(client); in max17040_get_vcell() local
120 chip->vcell = (msb << 4) + (lsb >> 4); in max17040_get_vcell()
125 struct max17040_chip *chip = i2c_get_clientdata(client); in max17040_get_soc() local
132 chip->soc = msb; in max17040_get_soc()
148 struct max17040_chip *chip = i2c_get_clientdata(client); in max17040_get_online() local
150 if (chip->pdata && chip->pdata->battery_online) in max17040_get_online()
151 chip->online = chip->pdata->battery_online(); in max17040_get_online()
153 chip->online = 1; in max17040_get_online()
158 struct max17040_chip *chip = i2c_get_clientdata(client); in max17040_get_status() local
160 if (!chip->pdata || !chip->pdata->charger_online in max17040_get_status()
161 || !chip->pdata->charger_enable) { in max17040_get_status()
162 chip->status = POWER_SUPPLY_STATUS_UNKNOWN; in max17040_get_status()
166 if (chip->pdata->charger_online()) { in max17040_get_status()
167 if (chip->pdata->charger_enable()) in max17040_get_status()
168 chip->status = POWER_SUPPLY_STATUS_CHARGING; in max17040_get_status()
170 chip->status = POWER_SUPPLY_STATUS_NOT_CHARGING; in max17040_get_status()
172 chip->status = POWER_SUPPLY_STATUS_DISCHARGING; in max17040_get_status()
175 if (chip->soc > MAX17040_BATTERY_FULL) in max17040_get_status()
176 chip->status = POWER_SUPPLY_STATUS_FULL; in max17040_get_status()
181 struct max17040_chip *chip; in max17040_work() local
183 chip = container_of(work, struct max17040_chip, work.work); in max17040_work()
185 max17040_get_vcell(chip->client); in max17040_work()
186 max17040_get_soc(chip->client); in max17040_work()
187 max17040_get_online(chip->client); in max17040_work()
188 max17040_get_status(chip->client); in max17040_work()
190 queue_delayed_work(system_power_efficient_wq, &chip->work, in max17040_work()
214 struct max17040_chip *chip; in max17040_probe() local
219 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); in max17040_probe()
220 if (!chip) in max17040_probe()
223 chip->client = client; in max17040_probe()
224 chip->pdata = client->dev.platform_data; in max17040_probe()
226 i2c_set_clientdata(client, chip); in max17040_probe()
227 psy_cfg.drv_data = chip; in max17040_probe()
229 chip->battery = power_supply_register(&client->dev, in max17040_probe()
231 if (IS_ERR(chip->battery)) { in max17040_probe()
233 return PTR_ERR(chip->battery); in max17040_probe()
239 INIT_DEFERRABLE_WORK(&chip->work, max17040_work); in max17040_probe()
240 queue_delayed_work(system_power_efficient_wq, &chip->work, in max17040_probe()
248 struct max17040_chip *chip = i2c_get_clientdata(client); in max17040_remove() local
250 power_supply_unregister(chip->battery); in max17040_remove()
251 cancel_delayed_work(&chip->work); in max17040_remove()
260 struct max17040_chip *chip = i2c_get_clientdata(client); in max17040_suspend() local
262 cancel_delayed_work(&chip->work); in max17040_suspend()
269 struct max17040_chip *chip = i2c_get_clientdata(client); in max17040_resume() local
271 queue_delayed_work(system_power_efficient_wq, &chip->work, in max17040_resume()