1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. 4 */ 5 6 #ifndef _DP_HPD_H_ 7 #define _DP_HPD_H_ 8 9 //#include <linux/usb/usbpd.h> 10 11 #include <linux/types.h> 12 #include <linux/device.h> 13 14 enum plug_orientation { 15 ORIENTATION_NONE, 16 ORIENTATION_CC1, 17 ORIENTATION_CC2, 18 }; 19 20 /** 21 * struct dp_usbpd - DisplayPort status 22 * 23 * @orientation: plug orientation configuration 24 * @low_pow_st: low power state 25 * @adaptor_dp_en: adaptor functionality enabled 26 * @multi_func: multi-function preferred 27 * @usb_config_req: request to switch to usb 28 * @exit_dp_mode: request exit from displayport mode 29 * @hpd_irq: Change in the status since last message 30 * @alt_mode_cfg_done: bool to specify alt mode status 31 * @debug_en: bool to specify debug mode 32 * @connect: simulate disconnect or connect for debug mode 33 */ 34 struct dp_usbpd { 35 enum plug_orientation orientation; 36 bool low_pow_st; 37 bool adaptor_dp_en; 38 bool multi_func; 39 bool usb_config_req; 40 bool exit_dp_mode; 41 bool hpd_irq; 42 bool alt_mode_cfg_done; 43 bool debug_en; 44 45 int (*connect)(struct dp_usbpd *dp_usbpd, bool hpd); 46 }; 47 48 /** 49 * struct dp_usbpd_cb - callback functions provided by the client 50 * 51 * @configure: called by usbpd module when PD communication has 52 * been completed and the usb peripheral has been configured on 53 * dp mode. 54 * @disconnect: notify the cable disconnect issued by usb. 55 * @attention: notify any attention message issued by usb. 56 */ 57 struct dp_usbpd_cb { 58 int (*configure)(struct device *dev); 59 int (*disconnect)(struct device *dev); 60 int (*attention)(struct device *dev); 61 }; 62 63 /** 64 * dp_hpd_get() - setup hpd module 65 * 66 * @dev: device instance of the caller 67 * @cb: struct containing callback function pointers. 68 * 69 * This function allows the client to initialize the usbpd 70 * module. The module will communicate with HPD module. 71 */ 72 struct dp_usbpd *dp_hpd_get(struct device *dev, struct dp_usbpd_cb *cb); 73 74 int dp_hpd_register(struct dp_usbpd *dp_usbpd); 75 void dp_hpd_unregister(struct dp_usbpd *dp_usbpd); 76 int dp_hpd_connect(struct dp_usbpd *dp_usbpd, bool hpd); 77 78 #endif /* _DP_HPD_H_ */ 79