Lines Matching refs:mfi
50 static int apple_mfi_fc_set_charge_type(struct mfi_device *mfi, in apple_mfi_fc_set_charge_type() argument
57 if (mfi->charge_type == val->intval) { in apple_mfi_fc_set_charge_type()
58 dev_dbg(&mfi->udev->dev, "charge type %d already set\n", in apple_mfi_fc_set_charge_type()
59 mfi->charge_type); in apple_mfi_fc_set_charge_type()
75 retval = usb_control_msg(mfi->udev, usb_sndctrlpipe(mfi->udev, 0), in apple_mfi_fc_set_charge_type()
82 dev_dbg(&mfi->udev->dev, "retval = %d\n", retval); in apple_mfi_fc_set_charge_type()
86 mfi->charge_type = val->intval; in apple_mfi_fc_set_charge_type()
95 struct mfi_device *mfi = power_supply_get_drvdata(psy); in apple_mfi_fc_get_property() local
97 dev_dbg(&mfi->udev->dev, "prop: %d\n", psp); in apple_mfi_fc_get_property()
101 val->intval = mfi->charge_type; in apple_mfi_fc_get_property()
117 struct mfi_device *mfi = power_supply_get_drvdata(psy); in apple_mfi_fc_set_property() local
120 dev_dbg(&mfi->udev->dev, "prop: %d\n", psp); in apple_mfi_fc_set_property()
122 ret = pm_runtime_get_sync(&mfi->udev->dev); in apple_mfi_fc_set_property()
124 pm_runtime_put_noidle(&mfi->udev->dev); in apple_mfi_fc_set_property()
130 ret = apple_mfi_fc_set_charge_type(mfi, val); in apple_mfi_fc_set_property()
136 pm_runtime_mark_last_busy(&mfi->udev->dev); in apple_mfi_fc_set_property()
137 pm_runtime_put_autosuspend(&mfi->udev->dev); in apple_mfi_fc_set_property()
180 struct mfi_device *mfi = NULL; in mfi_fc_probe() local
186 mfi = kzalloc(sizeof(struct mfi_device), GFP_KERNEL); in mfi_fc_probe()
187 if (!mfi) in mfi_fc_probe()
190 battery_cfg.drv_data = mfi; in mfi_fc_probe()
192 mfi->charge_type = POWER_SUPPLY_CHARGE_TYPE_TRICKLE; in mfi_fc_probe()
193 mfi->battery = power_supply_register(&udev->dev, in mfi_fc_probe()
196 if (IS_ERR(mfi->battery)) { in mfi_fc_probe()
198 err = PTR_ERR(mfi->battery); in mfi_fc_probe()
199 kfree(mfi); in mfi_fc_probe()
203 mfi->udev = usb_get_dev(udev); in mfi_fc_probe()
204 dev_set_drvdata(&udev->dev, mfi); in mfi_fc_probe()
211 struct mfi_device *mfi; in mfi_fc_disconnect() local
213 mfi = dev_get_drvdata(&udev->dev); in mfi_fc_disconnect()
214 if (mfi->battery) in mfi_fc_disconnect()
215 power_supply_unregister(mfi->battery); in mfi_fc_disconnect()
217 usb_put_dev(mfi->udev); in mfi_fc_disconnect()
218 kfree(mfi); in mfi_fc_disconnect()