summaryrefslogtreecommitdiff
path: root/drivers/staging/typec/tcpm.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 20:53:28 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-13 20:53:28 -0800
commit449fcf3ab0baf3dde9952385e6789f2ca10c3980 (patch)
tree180f10c2cdd63836e47725cddc8850ca7144091a /drivers/staging/typec/tcpm.h
parent3c073991eb417b6f785ddc6afbbdc369eb84aa6a (diff)
parentc14dd9d5f8beda9d8c621683b4e7d6cb5cd3cda7 (diff)
Merge tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO updates from Greg KH: "Here is the "big" staging and IIO driver update for 4.15-rc1. Lots and lots of little changes, almost all minor code cleanups as the Outreachy application process happened during this development cycle. Also happened was a lot of IIO driver activity, and the typec USB code moving out of staging to drivers/usb (same commits are in the USB tree on a persistent branch to not cause merge issues.) Overall, it's a wash, I think we added a few hundred more lines than removed, but really only a few thousand were modified at all. All of these have been in linux-next for a while. There might be a merge issue with Al's vfs tree in the pi433 driver (take his changes, they are always better), and the media tree with some of the odd atomisp cleanups (take the media tree's version)" * tag 'staging-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (507 commits) staging: lustre: add SPDX identifiers to all lustre files staging: greybus: Remove redundant license text staging: greybus: add SPDX identifiers to all greybus driver files staging: ccree: simplify ioread/iowrite staging: ccree: simplify registers access staging: ccree: simplify error handling logic staging: ccree: remove dead code staging: ccree: handle limiting of DMA masks staging: ccree: copy IV to DMAable memory staging: fbtft: remove redundant initialization of buf staging: sm750fb: Fix parameter mistake in poke32 staging: wilc1000: Fix bssid buffer offset in Txq staging: fbtft: fb_ssd1331: fix mirrored display staging: android: Fix checkpatch.pl error staging: greybus: loopback: convert loopback to use generic async operations staging: greybus: operation: add private data with get/set accessors staging: greybus: loopback: Fix iteration count on async path staging: greybus: loopback: Hold per-connection mutex across operations staging: greybus/loopback: use ktime_get() for time intervals staging: fsl-dpaa2/eth: Extra headroom in RX buffers ...
Diffstat (limited to 'drivers/staging/typec/tcpm.h')
-rw-r--r--drivers/staging/typec/tcpm.h161
1 files changed, 0 insertions, 161 deletions
diff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h
deleted file mode 100644
index 7e9a6b7b5cd6..000000000000
--- a/drivers/staging/typec/tcpm.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright 2015-2017 Google, Inc
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef __LINUX_USB_TCPM_H
-#define __LINUX_USB_TCPM_H
-
-#include <linux/bitops.h>
-#include <linux/usb/typec.h>
-#include "pd.h"
-
-enum typec_cc_status {
- TYPEC_CC_OPEN,
- TYPEC_CC_RA,
- TYPEC_CC_RD,
- TYPEC_CC_RP_DEF,
- TYPEC_CC_RP_1_5,
- TYPEC_CC_RP_3_0,
-};
-
-enum typec_cc_polarity {
- TYPEC_POLARITY_CC1,
- TYPEC_POLARITY_CC2,
-};
-
-/* Time to wait for TCPC to complete transmit */
-#define PD_T_TCPC_TX_TIMEOUT 100 /* in ms */
-#define PD_ROLE_SWAP_TIMEOUT (MSEC_PER_SEC * 10)
-
-enum tcpm_transmit_status {
- TCPC_TX_SUCCESS = 0,
- TCPC_TX_DISCARDED = 1,
- TCPC_TX_FAILED = 2,
-};
-
-enum tcpm_transmit_type {
- TCPC_TX_SOP = 0,
- TCPC_TX_SOP_PRIME = 1,
- TCPC_TX_SOP_PRIME_PRIME = 2,
- TCPC_TX_SOP_DEBUG_PRIME = 3,
- TCPC_TX_SOP_DEBUG_PRIME_PRIME = 4,
- TCPC_TX_HARD_RESET = 5,
- TCPC_TX_CABLE_RESET = 6,
- TCPC_TX_BIST_MODE_2 = 7
-};
-
-struct tcpc_config {
- const u32 *src_pdo;
- unsigned int nr_src_pdo;
-
- const u32 *snk_pdo;
- unsigned int nr_snk_pdo;
-
- const u32 *snk_vdo;
- unsigned int nr_snk_vdo;
-
- unsigned int max_snk_mv;
- unsigned int max_snk_ma;
- unsigned int max_snk_mw;
- unsigned int operating_snk_mw;
-
- enum typec_port_type type;
- enum typec_role default_role;
- bool try_role_hw; /* try.{src,snk} implemented in hardware */
-
- const struct typec_altmode_desc *alt_modes;
-};
-
-enum tcpc_usb_switch {
- TCPC_USB_SWITCH_CONNECT,
- TCPC_USB_SWITCH_DISCONNECT,
- TCPC_USB_SWITCH_RESTORE, /* TODO FIXME */
-};
-
-/* Mux state attributes */
-#define TCPC_MUX_USB_ENABLED BIT(0) /* USB enabled */
-#define TCPC_MUX_DP_ENABLED BIT(1) /* DP enabled */
-#define TCPC_MUX_POLARITY_INVERTED BIT(2) /* Polarity inverted */
-
-/* Mux modes, decoded to attributes */
-enum tcpc_mux_mode {
- TYPEC_MUX_NONE = 0, /* Open switch */
- TYPEC_MUX_USB = TCPC_MUX_USB_ENABLED, /* USB only */
- TYPEC_MUX_DP = TCPC_MUX_DP_ENABLED, /* DP only */
- TYPEC_MUX_DOCK = TCPC_MUX_USB_ENABLED | /* Both USB and DP */
- TCPC_MUX_DP_ENABLED,
-};
-
-struct tcpc_mux_dev {
- int (*set)(struct tcpc_mux_dev *dev, enum tcpc_mux_mode mux_mode,
- enum tcpc_usb_switch usb_config,
- enum typec_cc_polarity polarity);
- bool dfp_only;
- void *priv_data;
-};
-
-struct tcpc_dev {
- const struct tcpc_config *config;
-
- int (*init)(struct tcpc_dev *dev);
- int (*get_vbus)(struct tcpc_dev *dev);
- /*
- * This optional callback gets called by the tcpm core when configured
- * as a snk and cc=Rp-def. This allows the tcpm to provide a fallback
- * current-limit detection method for the cc=Rp-def case. E.g. some
- * tcpcs may include BC1.2 charger detection and use that in this case.
- */
- int (*get_current_limit)(struct tcpc_dev *dev);
- int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
- int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
- enum typec_cc_status *cc2);
- int (*set_polarity)(struct tcpc_dev *dev,
- enum typec_cc_polarity polarity);
- int (*set_vconn)(struct tcpc_dev *dev, bool on);
- int (*set_vbus)(struct tcpc_dev *dev, bool on, bool charge);
- int (*set_current_limit)(struct tcpc_dev *dev, u32 max_ma, u32 mv);
- int (*set_pd_rx)(struct tcpc_dev *dev, bool on);
- int (*set_roles)(struct tcpc_dev *dev, bool attached,
- enum typec_role role, enum typec_data_role data);
- int (*start_drp_toggling)(struct tcpc_dev *dev,
- enum typec_cc_status cc);
- int (*try_role)(struct tcpc_dev *dev, int role);
- int (*pd_transmit)(struct tcpc_dev *dev, enum tcpm_transmit_type type,
- const struct pd_message *msg);
- struct tcpc_mux_dev *mux;
-};
-
-struct tcpm_port;
-
-struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc);
-void tcpm_unregister_port(struct tcpm_port *port);
-
-void tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo,
- unsigned int nr_pdo);
-void tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo,
- unsigned int nr_pdo,
- unsigned int max_snk_mv,
- unsigned int max_snk_ma,
- unsigned int max_snk_mw,
- unsigned int operating_snk_mw);
-
-void tcpm_vbus_change(struct tcpm_port *port);
-void tcpm_cc_change(struct tcpm_port *port);
-void tcpm_pd_receive(struct tcpm_port *port,
- const struct pd_message *msg);
-void tcpm_pd_transmit_complete(struct tcpm_port *port,
- enum tcpm_transmit_status status);
-void tcpm_pd_hard_reset(struct tcpm_port *port);
-void tcpm_tcpc_reset(struct tcpm_port *port);
-
-#endif /* __LINUX_USB_TCPM_H */