linux/drivers/usb/typec/mux/intel_pmc_mux.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Driver for Intel PMC USB mux control
 *
 * Copyright (C) 2020 Intel Corporation
 * Author: Heikki Krogerus <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/usb/pd.h>
#include <linux/usb/role.h>
#include <linux/usb/typec_mux.h>
#include <linux/usb/typec_dp.h>
#include <linux/usb/typec_tbt.h>
#include <linux/debugfs.h>
#include <linux/usb.h>

#include <asm/intel_scu_ipc.h>

#define PMC_USBC_CMD

/* Response status bits */
#define PMC_USB_RESP_STATUS_FAILURE
#define PMC_USB_RESP_STATUS_FATAL

/* "Usage" OOB Message field values */
enum {};

#define PMC_USB_MSG_USB2_PORT_SHIFT
#define PMC_USB_MSG_USB3_PORT_SHIFT
#define PMC_USB_MSG_UFP_SHIFT
#define PMC_USB_MSG_ORI_HSL_SHIFT
#define PMC_USB_MSG_ORI_AUX_SHIFT

/* Alt Mode Request */
struct altmode_req {} __packed;

#define PMC_USB_MODE_TYPE_SHIFT

enum {};

/* Common Mode Data bits */
#define PMC_USB_ALTMODE_RETIMER_CABLE

#define PMC_USB_ALTMODE_ORI_SHIFT
#define PMC_USB_ALTMODE_UFP_SHIFT

/* DP specific Mode Data bits */
#define PMC_USB_ALTMODE_DP_MODE_SHIFT

/* TBT specific Mode Data bits */
#define PMC_USB_ALTMODE_TBT_TYPE
#define PMC_USB_ALTMODE_CABLE_TYPE
#define PMC_USB_ALTMODE_ACTIVE_LINK
#define PMC_USB_ALTMODE_ACTIVE_CABLE
#define PMC_USB_ALTMODE_FORCE_LSR
#define PMC_USB_ALTMODE_CABLE_SPD(_s_)
#define PMC_USB_ALTMODE_CABLE_USB31
#define PMC_USB_ALTMODE_CABLE_10GPS
#define PMC_USB_ALTMODE_CABLE_20GPS
#define PMC_USB_ALTMODE_TBT_GEN(_g_)

/* Display HPD Request bits */
#define PMC_USB_DP_HPD_LVL
#define PMC_USB_DP_HPD_IRQ

/*
 * Input Output Manager (IOM) PORT STATUS
 */
#define IOM_PORT_STATUS_ACTIVITY_TYPE_MASK
#define IOM_PORT_STATUS_ACTIVITY_TYPE_SHIFT
#define IOM_PORT_STATUS_ACTIVITY_TYPE_USB
/* activity type: Safe Mode */
#define IOM_PORT_STATUS_ACTIVITY_TYPE_SAFE_MODE
/* activity type: Display Port */
#define IOM_PORT_STATUS_ACTIVITY_TYPE_DP
/* activity type: Display Port Multi Function Device */
#define IOM_PORT_STATUS_ACTIVITY_TYPE_DP_MFD
/* activity type: Thunderbolt */
#define IOM_PORT_STATUS_ACTIVITY_TYPE_TBT
#define IOM_PORT_STATUS_ACTIVITY_TYPE_ALT_MODE_USB
#define IOM_PORT_STATUS_ACTIVITY_TYPE_ALT_MODE_TBT_USB
/* Upstream Facing Port Information */
#define IOM_PORT_STATUS_UFP
/* Display Port Hot Plug Detect status */
#define IOM_PORT_STATUS_DHPD_HPD_STATUS_MASK
#define IOM_PORT_STATUS_DHPD_HPD_STATUS_SHIFT
#define IOM_PORT_STATUS_DHPD_HPD_STATUS_ASSERT
#define IOM_PORT_STATUS_DHPD_HPD_SOURCE_TBT
#define IOM_PORT_STATUS_CONNECTED

#define IOM_PORT_ACTIVITY_IS(_status_, _type_)

#define IOM_PORT_HPD_ASSERTED(_status_)

/* IOM port status register */
#define IOM_PORT_STATUS_REGS(_offset_, _size_)
#define IOM_PORT_STATUS_REGS_SZ_MASK
#define IOM_PORT_STATUS_REGS_SZ_4
#define IOM_PORT_STATUS_REGS_SZ_8
#define IOM_PORT_STATUS_REGS_OFFSET(_d_)
#define IOM_PORT_STATUS_REGS_SIZE(_d_)

struct pmc_usb;

struct pmc_usb_port {};

struct pmc_usb {};

static struct dentry *pmc_mux_debugfs_root;

static void update_port_status(struct pmc_usb_port *port)
{}

static int sbu_orientation(struct pmc_usb_port *port)
{}

static int hsl_orientation(struct pmc_usb_port *port)
{}

static bool is_pmc_mux_tbt(struct acpi_device *adev)
{}

static int pmc_usb_send_command(struct intel_scu_ipc_dev *ipc, u8 *msg, u32 len)
{}

static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
{}

static int
pmc_usb_mux_dp_hpd(struct pmc_usb_port *port, struct typec_displayport_data *dp)
{}

static int
pmc_usb_mux_dp(struct pmc_usb_port *port, struct typec_mux_state *state)
{}

static int
pmc_usb_mux_tbt(struct pmc_usb_port *port, struct typec_mux_state *state)
{}

static int
pmc_usb_mux_usb4(struct pmc_usb_port *port, struct typec_mux_state *state)
{}

static int pmc_usb_mux_safe_state(struct pmc_usb_port *port,
				  struct typec_mux_state *state)
{}

static int pmc_usb_disconnect(struct pmc_usb_port *port)
{}

static int pmc_usb_connect(struct pmc_usb_port *port, enum usb_role role)
{}

static int
pmc_usb_mux_set(struct typec_mux_dev *mux, struct typec_mux_state *state)
{}

static int pmc_usb_set_orientation(struct typec_switch_dev *sw,
				   enum typec_orientation orientation)
{}

static int pmc_usb_set_role(struct usb_role_switch *sw, enum usb_role role)
{}

static int pmc_usb_register_port(struct pmc_usb *pmc, int index,
				 struct fwnode_handle *fwnode)
{}

/* IOM ACPI IDs and IOM_PORT_STATUS_OFFSET */
static const struct acpi_device_id iom_acpi_ids[] =;

static int pmc_usb_probe_iom(struct pmc_usb *pmc)
{}

static int port_iom_status_show(struct seq_file *s, void *unused)
{}
DEFINE_SHOW_ATTRIBUTE();

static void pmc_mux_port_debugfs_init(struct pmc_usb_port *port)
{}

static int pmc_usb_probe(struct platform_device *pdev)
{}

static void pmc_usb_remove(struct platform_device *pdev)
{}

static const struct acpi_device_id pmc_usb_acpi_ids[] =;
MODULE_DEVICE_TABLE(acpi, pmc_usb_acpi_ids);

static struct platform_driver pmc_usb_driver =;

static int __init pmc_usb_init(void)
{}
module_init();

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

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