linux/drivers/usb/roles/class.c

// SPDX-License-Identifier: GPL-2.0
/*
 * USB Role Switch Support
 *
 * Copyright (C) 2018 Intel Corporation
 * Author: Heikki Krogerus <[email protected]>
 *         Hans de Goede <[email protected]>
 */

#include <linux/component.h>
#include <linux/usb/role.h>
#include <linux/property.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>

static const struct class role_class =;

struct usb_role_switch {};

#define to_role_switch(d)

static int connector_bind(struct device *dev, struct device *connector, void *data)
{}

static void connector_unbind(struct device *dev, struct device *connector, void *data)
{}

static const struct component_ops connector_ops =;

/**
 * usb_role_switch_set_role - Set USB role for a switch
 * @sw: USB role switch
 * @role: USB role to be switched to
 *
 * Set USB role @role for @sw.
 */
int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role)
{}
EXPORT_SYMBOL_GPL();

/**
 * usb_role_switch_get_role - Get the USB role for a switch
 * @sw: USB role switch
 *
 * Depending on the role-switch-driver this function returns either a cached
 * value of the last set role, or reads back the actual value from the hardware.
 */
enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw)
{}
EXPORT_SYMBOL_GPL();

static void *usb_role_switch_match(const struct fwnode_handle *fwnode, const char *id,
				   void *data)
{}

static struct usb_role_switch *
usb_role_switch_is_parent(struct fwnode_handle *fwnode)
{}

/**
 * usb_role_switch_get - Find USB role switch linked with the caller
 * @dev: The caller device
 *
 * Finds and returns role switch linked with @dev. The reference count for the
 * found switch is incremented.
 */
struct usb_role_switch *usb_role_switch_get(struct device *dev)
{}
EXPORT_SYMBOL_GPL();

/**
 * fwnode_usb_role_switch_get - Find USB role switch linked with the caller
 * @fwnode: The caller device node
 *
 * This is similar to the usb_role_switch_get() function above, but it searches
 * the switch using fwnode instead of device entry.
 */
struct usb_role_switch *fwnode_usb_role_switch_get(struct fwnode_handle *fwnode)
{}
EXPORT_SYMBOL_GPL();

/**
 * usb_role_switch_put - Release handle to a switch
 * @sw: USB Role Switch
 *
 * Decrement reference count for @sw.
 */
void usb_role_switch_put(struct usb_role_switch *sw)
{}
EXPORT_SYMBOL_GPL();

/**
 * usb_role_switch_find_by_fwnode - Find USB role switch with its fwnode
 * @fwnode: fwnode of the USB Role Switch
 *
 * Finds and returns role switch with @fwnode. The reference count for the
 * found switch is incremented.
 */
struct usb_role_switch *
usb_role_switch_find_by_fwnode(const struct fwnode_handle *fwnode)
{}
EXPORT_SYMBOL_GPL();

static umode_t
usb_role_switch_is_visible(struct kobject *kobj, struct attribute *attr, int n)
{}

static const char * const usb_roles[] =;

const char *usb_role_string(enum usb_role role)
{}
EXPORT_SYMBOL_GPL();

static ssize_t
role_show(struct device *dev, struct device_attribute *attr, char *buf)
{}

static ssize_t role_store(struct device *dev, struct device_attribute *attr,
			  const char *buf, size_t size)
{}
static DEVICE_ATTR_RW(role);

static struct attribute *usb_role_switch_attrs[] =;

static const struct attribute_group usb_role_switch_group =;

static const struct attribute_group *usb_role_switch_groups[] =;

static int usb_role_switch_uevent(const struct device *dev, struct kobj_uevent_env *env)
{}

static void usb_role_switch_release(struct device *dev)
{}

static const struct device_type usb_role_dev_type =;

/**
 * usb_role_switch_register - Register USB Role Switch
 * @parent: Parent device for the switch
 * @desc: Description of the switch
 *
 * USB Role Switch is a device capable or choosing the role for USB connector.
 * On platforms where the USB controller is dual-role capable, the controller
 * driver will need to register the switch. On platforms where the USB host and
 * USB device controllers behind the connector are separate, there will be a
 * mux, and the driver for that mux will need to register the switch.
 *
 * Returns handle to a new role switch or ERR_PTR. The content of @desc is
 * copied.
 */
struct usb_role_switch *
usb_role_switch_register(struct device *parent,
			 const struct usb_role_switch_desc *desc)
{}
EXPORT_SYMBOL_GPL();

/**
 * usb_role_switch_unregister - Unregsiter USB Role Switch
 * @sw: USB Role Switch
 *
 * Unregister switch that was registered with usb_role_switch_register().
 */
void usb_role_switch_unregister(struct usb_role_switch *sw)
{}
EXPORT_SYMBOL_GPL();

/**
 * usb_role_switch_set_drvdata - Assign private data pointer to a switch
 * @sw: USB Role Switch
 * @data: Private data pointer
 */
void usb_role_switch_set_drvdata(struct usb_role_switch *sw, void *data)
{}
EXPORT_SYMBOL_GPL();

/**
 * usb_role_switch_get_drvdata - Get the private data pointer of a switch
 * @sw: USB Role Switch
 */
void *usb_role_switch_get_drvdata(struct usb_role_switch *sw)
{}
EXPORT_SYMBOL_GPL();

static int __init usb_roles_init(void)
{}
subsys_initcall(usb_roles_init);

static void __exit usb_roles_exit(void)
{}
module_exit(usb_roles_exit);

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