Lines Matching +full:product +full:- +full:files

1 // SPDX-License-Identifier: GPL-2.0+
3 * Fast-charge control for Apple "MFi" devices
8 /* Standard include files */
15 MODULE_DESCRIPTION("Fast-charge control for Apple \"MFi\" devices");
23 /* The product ID is defined as starting with 0x12nn, as per the
30 * ■ Product ID: 0x12nn
43 /* Driver-local specific stuff */
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()
63 switch (val->intval) { in apple_mfi_fc_set_charge_type()
71 return -EINVAL; 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()
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()
104 val->intval = POWER_SUPPLY_SCOPE_DEVICE; in apple_mfi_fc_get_property()
107 return -ENODATA; in apple_mfi_fc_get_property()
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()
133 ret = -EINVAL; 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()
172 idProduct = le16_to_cpu(udev->descriptor.idProduct); in mfi_fc_match()
184 return -ENODEV; in mfi_fc_probe()
188 return -ENOMEM; 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()
197 dev_err(&udev->dev, "Can't register battery\n"); in mfi_fc_probe()
198 err = PTR_ERR(mfi->battery); 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()
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()
216 dev_set_drvdata(&udev->dev, NULL); in mfi_fc_disconnect()
217 usb_put_dev(mfi->udev); in mfi_fc_disconnect()
222 .name = "apple-mfi-fastcharge",