// SPDX-License-Identifier: GPL-2.0
/*
* USB Type-C Connector Class
*
* Copyright (C) 2017, Intel Corporation
* Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
*/
#include <linux/device.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/slab.h>
#include "bus.h"
struct typec_plug {
struct device dev;
enum typec_plug_index index;
struct ida mode_ids;
};
struct typec_cable {
struct device dev;
enum typec_plug_type type;
struct usb_pd_identity *identity;
unsigned int active:1;
};
struct typec_partner {
struct device dev;
unsigned int usb_pd:1;
struct usb_pd_identity *identity;
enum typec_accessory accessory;
struct ida mode_ids;
};
struct typec_port {
unsigned int id;
struct device dev;
struct ida mode_ids;
int prefer_role;
enum typec_data_role data_role;
enum typec_role pwr_role;
enum typec_role vconn_role;
enum typec_pwr_opmode pwr_opmode;
enum typec_port_type port_type;
struct mutex port_type_lock;
enum typec_orientation orientation;
struct typec_switch *sw;
struct typec_mux *mux;
const struct typec_capability *cap;
const struct typec_operations *ops;
};
#define to_typec_port(_dev_) container_of(_dev_, struct typec_port, dev)
#define to_typec_plug(_dev_) container_of(_dev_, struct typec_plug, dev)
#define to_typec_cable(_dev_) container_of(_dev_, struct typec_cable, dev)
#define to_typec_partner(_dev_) container_of(_dev_, struct typec_partner, dev)
static const struct device_type typec_partn
|