linux/drivers/usb/typec/tcpm/wcove.c

// SPDX-License-Identifier: GPL-2.0
/*
 * typec_wcove.c - WhiskeyCove PMIC USB Type-C PHY driver
 *
 * Copyright (C) 2017 Intel Corporation
 * Author: Heikki Krogerus <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/module.h>
#include <linux/usb/tcpm.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/mfd/intel_soc_pmic.h>

/* Register offsets */
#define WCOVE_CHGRIRQ0

#define USBC_CONTROL1
#define USBC_CONTROL2
#define USBC_CONTROL3
#define USBC_CC1_CTRL
#define USBC_CC2_CTRL
#define USBC_STATUS1
#define USBC_STATUS2
#define USBC_STATUS3
#define USBC_CC1
#define USBC_CC2
#define USBC_CC1_STATUS
#define USBC_CC2_STATUS
#define USBC_IRQ1
#define USBC_IRQ2
#define USBC_IRQMASK1
#define USBC_IRQMASK2
#define USBC_PDCFG2
#define USBC_PDCFG3
#define USBC_PDSTATUS
#define USBC_RXSTATUS
#define USBC_RXINFO
#define USBC_TXCMD
#define USBC_TXINFO
#define USBC_RX_DATA
#define USBC_TX_DATA

/* Register bits */

#define USBC_CONTROL1_MODE_MASK
#define USBC_CONTROL1_MODE_SNK
#define USBC_CONTROL1_MODE_SNKACC
#define USBC_CONTROL1_MODE_SRC
#define USBC_CONTROL1_MODE_SRCACC
#define USBC_CONTROL1_MODE_DRP
#define USBC_CONTROL1_MODE_DRPACC
#define USBC_CONTROL1_MODE_TEST
#define USBC_CONTROL1_CURSRC_MASK
#define USBC_CONTROL1_CURSRC_UA_0
#define USBC_CONTROL1_CURSRC_UA_80
#define USBC_CONTROL1_CURSRC_UA_180
#define USBC_CONTROL1_CURSRC_UA_330
#define USBC_CONTROL1_DRPTOGGLE_RANDOM

#define USBC_CONTROL2_UNATT_SNK
#define USBC_CONTROL2_UNATT_SRC
#define USBC_CONTROL2_DIS_ST

#define USBC_CONTROL3_DET_DIS
#define USBC_CONTROL3_PD_DIS
#define USBC_CONTROL3_RESETPHY

#define USBC_CC_CTRL_PU_EN
#define USBC_CC_CTRL_VCONN_EN
#define USBC_CC_CTRL_TX_EN
#define USBC_CC_CTRL_PD_EN
#define USBC_CC_CTRL_CDET_EN
#define USBC_CC_CTRL_RDET_EN
#define USBC_CC_CTRL_ADC_EN
#define USBC_CC_CTRL_VBUSOK

#define USBC_STATUS1_DET_ONGOING
#define USBC_STATUS1_RSLT(r)
#define USBC_RSLT_NOTHING
#define USBC_RSLT_SRC_DEFAULT
#define USBC_RSLT_SRC_1_5A
#define USBC_RSLT_SRC_3_0A
#define USBC_RSLT_SNK
#define USBC_RSLT_DEBUG_ACC
#define USBC_RSLT_AUDIO_ACC
#define USBC_RSLT_UNDEF
#define USBC_STATUS1_ORIENT(r)
#define USBC_ORIENT_NORMAL
#define USBC_ORIENT_REVERSE

#define USBC_STATUS2_VBUS_REQ

#define UCSC_CC_STATUS_SNK_RP
#define UCSC_CC_STATUS_PWRDEFSNK
#define UCSC_CC_STATUS_PWR_1P5A_SNK
#define UCSC_CC_STATUS_PWR_3A_SNK
#define UCSC_CC_STATUS_SRC_RP
#define UCSC_CC_STATUS_RX(r)
#define USBC_CC_STATUS_RD
#define USBC_CC_STATUS_RA

#define USBC_IRQ1_ADCDONE1
#define USBC_IRQ1_OVERTEMP
#define USBC_IRQ1_SHORT

#define USBC_IRQ2_CC_CHANGE
#define USBC_IRQ2_RX_PD
#define USBC_IRQ2_RX_HR
#define USBC_IRQ2_RX_CR
#define USBC_IRQ2_TX_SUCCESS
#define USBC_IRQ2_TX_FAIL

#define USBC_IRQMASK1_ALL

#define USBC_IRQMASK2_ALL

#define USBC_PDCFG2_SOP
#define USBC_PDCFG2_SOP_P
#define USBC_PDCFG2_SOP_PP
#define USBC_PDCFG2_SOP_P_DEBUG
#define USBC_PDCFG2_SOP_PP_DEBUG

#define USBC_PDCFG3_DATAROLE_SHIFT
#define USBC_PDCFG3_SOP_SHIFT

#define USBC_RXSTATUS_RXCLEAR
#define USBC_RXSTATUS_RXDATA

#define USBC_RXINFO_RXBYTES(i)

#define USBC_TXCMD_BUF_RDY
#define USBC_TXCMD_START
#define USBC_TXCMD_NOP
#define USBC_TXCMD_MSG
#define USBC_TXCMD_CR
#define USBC_TXCMD_HR
#define USBC_TXCMD_BIST

#define USBC_TXINFO_RETRIES(d)

struct wcove_typec {};

#define tcpc_to_wcove(_tcpc_)

enum wcove_typec_func {};

enum wcove_typec_orientation {};

enum wcove_typec_role {};

#define WCOVE_DSM_UUID

static int wcove_typec_func(struct wcove_typec *wcove,
			    enum wcove_typec_func func, int param)
{}

static int wcove_init(struct tcpc_dev *tcpc)
{}

static int wcove_get_vbus(struct tcpc_dev *tcpc)
{}

static int wcove_set_vbus(struct tcpc_dev *tcpc, bool on, bool sink)
{}

static int wcove_set_vconn(struct tcpc_dev *tcpc, bool on)
{}

static enum typec_cc_status wcove_to_typec_cc(unsigned int cc)
{}

static int wcove_get_cc(struct tcpc_dev *tcpc, enum typec_cc_status *cc1,
			enum typec_cc_status *cc2)
{}

static int wcove_set_cc(struct tcpc_dev *tcpc, enum typec_cc_status cc)
{}

static int wcove_set_polarity(struct tcpc_dev *tcpc, enum typec_cc_polarity pol)
{}

static int wcove_set_current_limit(struct tcpc_dev *tcpc, u32 max_ma, u32 mv)
{}

static int wcove_set_roles(struct tcpc_dev *tcpc, bool attached,
			   enum typec_role role, enum typec_data_role data)
{}

static int wcove_set_pd_rx(struct tcpc_dev *tcpc, bool on)
{}

static int wcove_pd_transmit(struct tcpc_dev *tcpc,
			     enum tcpm_transmit_type type,
			     const struct pd_message *msg,
			     unsigned int negotiated_rev)
{}

static int wcove_start_toggling(struct tcpc_dev *tcpc,
				enum typec_port_type port_type,
				enum typec_cc_status cc)
{}

static int wcove_read_rx_buffer(struct wcove_typec *wcove, void *msg)
{}

static irqreturn_t wcove_typec_irq(int irq, void *data)
{}

/*
 * The following power levels should be safe to use with Joule board.
 */
static const u32 src_pdo[] =;

static const u32 snk_pdo[] =;

static const struct property_entry wcove_props[] =;

static int wcove_typec_probe(struct platform_device *pdev)
{}

static void wcove_typec_remove(struct platform_device *pdev)
{}

static struct platform_driver wcove_typec_driver =;

module_platform_driver();

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