linux/drivers/usb/misc/apple-mfi-fastcharge.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Fast-charge control for Apple "MFi" devices
 *
 * Copyright (C) 2019 Bastien Nocera <[email protected]>
 */

/* Standard include files */
#include <linux/module.h>
#include <linux/power_supply.h>
#include <linux/slab.h>
#include <linux/usb.h>

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

#define TRICKLE_CURRENT_MA
#define FAST_CURRENT_MA

#define APPLE_VENDOR_ID

/* The product ID is defined as starting with 0x12nn, as per the
 * "Choosing an Apple Device USB Configuration" section in
 * release R9 (2012) of the "MFi Accessory Hardware Specification"
 *
 * To distinguish an Apple device, a USB host can check the device
 * descriptor of attached USB devices for the following fields:
 * ■ Vendor ID: 0x05AC
 * ■ Product ID: 0x12nn
 *
 * Those checks will be done in .match() and .probe().
 */

static const struct usb_device_id mfi_fc_id_table[] =;

MODULE_DEVICE_TABLE(usb, mfi_fc_id_table);

/* Driver-local specific stuff */
struct mfi_device {};

static int apple_mfi_fc_set_charge_type(struct mfi_device *mfi,
					const union power_supply_propval *val)
{}

static int apple_mfi_fc_get_property(struct power_supply *psy,
		enum power_supply_property psp,
		union power_supply_propval *val)
{}

static int apple_mfi_fc_set_property(struct power_supply *psy,
		enum power_supply_property psp,
		const union power_supply_propval *val)
{}

static int apple_mfi_fc_property_is_writeable(struct power_supply *psy,
					      enum power_supply_property psp)
{}

static enum power_supply_property apple_mfi_fc_properties[] =;

static const struct power_supply_desc apple_mfi_fc_desc =;

static bool mfi_fc_match(struct usb_device *udev)
{}

static int mfi_fc_probe(struct usb_device *udev)
{}

static void mfi_fc_disconnect(struct usb_device *udev)
{}

static struct usb_device_driver mfi_fc_driver =;

static int __init mfi_fc_driver_init(void)
{}

static void __exit mfi_fc_driver_exit(void)
{}

module_init();
module_exit(mfi_fc_driver_exit);