linux/drivers/usb/typec/ucsi/ucsi.c

// SPDX-License-Identifier: GPL-2.0
/*
 * USB Type-C Connector System Software Interface driver
 *
 * Copyright (C) 2017, Intel Corporation
 * Author: Heikki Krogerus <[email protected]>
 */

#include <linux/completion.h>
#include <linux/property.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/usb/typec_dp.h>

#include "ucsi.h"
#include "trace.h"

/*
 * UCSI_TIMEOUT_MS - PPM communication timeout
 *
 * Ideally we could use MIN_TIME_TO_RESPOND_WITH_BUSY (which is defined in UCSI
 * specification) here as reference, but unfortunately we can't. It is very
 * difficult to estimate the time it takes for the system to process the command
 * before it is actually passed to the PPM.
 */
#define UCSI_TIMEOUT_MS

/*
 * UCSI_SWAP_TIMEOUT_MS - Timeout for role swap requests
 *
 * 5 seconds is close to the time it takes for CapsCounter to reach 0, so even
 * if the PPM does not generate Connector Change events before that with
 * partners that do not support USB Power Delivery, this should still work.
 */
#define UCSI_SWAP_TIMEOUT_MS

void ucsi_notify_common(struct ucsi *ucsi, u32 cci)
{}
EXPORT_SYMBOL_GPL();

int ucsi_sync_control_common(struct ucsi *ucsi, u64 command)
{}
EXPORT_SYMBOL_GPL();

static int ucsi_acknowledge(struct ucsi *ucsi, bool conn_ack)
{}

static int ucsi_run_command(struct ucsi *ucsi, u64 command, u32 *cci,
			    void *data, size_t size, bool conn_ack)
{}

static int ucsi_read_error(struct ucsi *ucsi, u8 connector_num)
{}

static int ucsi_send_command_common(struct ucsi *ucsi, u64 cmd,
				    void *data, size_t size, bool conn_ack)
{}

int ucsi_send_command(struct ucsi *ucsi, u64 command,
		      void *data, size_t size)
{}
EXPORT_SYMBOL_GPL();

/* -------------------------------------------------------------------------- */

struct ucsi_work {};

static void ucsi_poll_worker(struct work_struct *work)
{}

static int ucsi_partner_task(struct ucsi_connector *con,
			     int (*cb)(struct ucsi_connector *),
			     int retries, unsigned long delay)
{}

/* -------------------------------------------------------------------------- */

void ucsi_altmode_update_active(struct ucsi_connector *con)
{}

static int ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)
{}

static int ucsi_next_altmode(struct typec_altmode **alt)
{}

static int ucsi_get_num_altmode(struct typec_altmode **alt)
{}

static int ucsi_register_altmode(struct ucsi_connector *con,
				 struct typec_altmode_desc *desc,
				 u8 recipient)
{}

static int
ucsi_register_altmodes_nvidia(struct ucsi_connector *con, u8 recipient)
{}

static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient)
{}

static void ucsi_unregister_altmodes(struct ucsi_connector *con, u8 recipient)
{}

static int ucsi_read_pdos(struct ucsi_connector *con,
			  enum typec_role role, int is_partner,
			  u32 *pdos, int offset, int num_pdos)
{}

static int ucsi_get_pdos(struct ucsi_connector *con, enum typec_role role,
			 int is_partner, u32 *pdos)
{}

static int ucsi_get_src_pdos(struct ucsi_connector *con)
{}

static struct usb_power_delivery_capabilities *ucsi_get_pd_caps(struct ucsi_connector *con,
								enum typec_role role,
								bool is_partner)
{}

static int ucsi_read_identity(struct ucsi_connector *con, u8 recipient,
			      u8 offset, u8 bytes, void *resp)
{}

static int ucsi_get_identity(struct ucsi_connector *con, u8 recipient,
			      struct usb_pd_identity *id)
{}

static int ucsi_get_partner_identity(struct ucsi_connector *con)
{}

static int ucsi_get_cable_identity(struct ucsi_connector *con)
{}

static int ucsi_check_altmodes(struct ucsi_connector *con)
{}

static void ucsi_register_device_pdos(struct ucsi_connector *con)
{}

static int ucsi_register_partner_pdos(struct ucsi_connector *con)
{}

static void ucsi_unregister_partner_pdos(struct ucsi_connector *con)
{}

static int ucsi_register_plug(struct ucsi_connector *con)
{}

static void ucsi_unregister_plug(struct ucsi_connector *con)
{}

static int ucsi_register_cable(struct ucsi_connector *con)
{}

static void ucsi_unregister_cable(struct ucsi_connector *con)
{}

static void ucsi_pwr_opmode_change(struct ucsi_connector *con)
{}

static int ucsi_register_partner(struct ucsi_connector *con)
{}

static void ucsi_unregister_partner(struct ucsi_connector *con)
{}

static void ucsi_partner_change(struct ucsi_connector *con)
{}

static int ucsi_check_connector_capability(struct ucsi_connector *con)
{}

static int ucsi_check_connection(struct ucsi_connector *con)
{}

static int ucsi_check_cable(struct ucsi_connector *con)
{}

static void ucsi_handle_connector_change(struct work_struct *work)
{}

/**
 * ucsi_connector_change - Process Connector Change Event
 * @ucsi: UCSI Interface
 * @num: Connector number
 */
void ucsi_connector_change(struct ucsi *ucsi, u8 num)
{}
EXPORT_SYMBOL_GPL();

/* -------------------------------------------------------------------------- */

static int ucsi_reset_connector(struct ucsi_connector *con, bool hard)
{}

static int ucsi_reset_ppm(struct ucsi *ucsi)
{}

static int ucsi_role_cmd(struct ucsi_connector *con, u64 command)
{}

static int ucsi_dr_swap(struct typec_port *port, enum typec_data_role role)
{}

static int ucsi_pr_swap(struct typec_port *port, enum typec_role role)
{}

static const struct typec_operations ucsi_ops =;

/* Caller must call fwnode_handle_put() after use */
static struct fwnode_handle *ucsi_find_fwnode(struct ucsi_connector *con)
{}

static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
{}

static u64 ucsi_get_supported_notifications(struct ucsi *ucsi)
{}

/**
 * ucsi_init - Initialize UCSI interface
 * @ucsi: UCSI to be initialized
 *
 * Registers all ports @ucsi has and enables all notification events.
 */
static int ucsi_init(struct ucsi *ucsi)
{}

static void ucsi_resume_work(struct work_struct *work)
{}

int ucsi_resume(struct ucsi *ucsi)
{}
EXPORT_SYMBOL_GPL();

static void ucsi_init_work(struct work_struct *work)
{}

/**
 * ucsi_get_drvdata - Return private driver data pointer
 * @ucsi: UCSI interface
 */
void *ucsi_get_drvdata(struct ucsi *ucsi)
{}
EXPORT_SYMBOL_GPL();

/**
 * ucsi_set_drvdata - Assign private driver data pointer
 * @ucsi: UCSI interface
 * @data: Private data pointer
 */
void ucsi_set_drvdata(struct ucsi *ucsi, void *data)
{}
EXPORT_SYMBOL_GPL();

/**
 * ucsi_create - Allocate UCSI instance
 * @dev: Device interface to the PPM (Platform Policy Manager)
 * @ops: I/O routines
 */
struct ucsi *ucsi_create(struct device *dev, const struct ucsi_operations *ops)
{}
EXPORT_SYMBOL_GPL();

/**
 * ucsi_destroy - Free UCSI instance
 * @ucsi: UCSI instance to be freed
 */
void ucsi_destroy(struct ucsi *ucsi)
{}
EXPORT_SYMBOL_GPL();

/**
 * ucsi_register - Register UCSI interface
 * @ucsi: UCSI instance
 */
int ucsi_register(struct ucsi *ucsi)
{}
EXPORT_SYMBOL_GPL();

/**
 * ucsi_unregister - Unregister UCSI interface
 * @ucsi: UCSI interface to be unregistered
 *
 * Unregister UCSI interface that was created with ucsi_register().
 */
void ucsi_unregister(struct ucsi *ucsi)
{}
EXPORT_SYMBOL_GPL();

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

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

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