Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
0004  */
0005 
0006 #ifndef _DP_HPD_H_
0007 #define _DP_HPD_H_
0008 
0009 //#include <linux/usb/usbpd.h>
0010 
0011 #include <linux/types.h>
0012 #include <linux/device.h>
0013 
0014 enum plug_orientation {
0015     ORIENTATION_NONE,
0016     ORIENTATION_CC1,
0017     ORIENTATION_CC2,
0018 };
0019 
0020 /**
0021  * struct dp_usbpd - DisplayPort status
0022  *
0023  * @orientation: plug orientation configuration
0024  * @low_pow_st: low power state
0025  * @adaptor_dp_en: adaptor functionality enabled
0026  * @multi_func: multi-function preferred
0027  * @usb_config_req: request to switch to usb
0028  * @exit_dp_mode: request exit from displayport mode
0029  * @hpd_irq: Change in the status since last message
0030  * @alt_mode_cfg_done: bool to specify alt mode status
0031  * @debug_en: bool to specify debug mode
0032  * @connect: simulate disconnect or connect for debug mode
0033  */
0034 struct dp_usbpd {
0035     enum plug_orientation orientation;
0036     bool low_pow_st;
0037     bool adaptor_dp_en;
0038     bool multi_func;
0039     bool usb_config_req;
0040     bool exit_dp_mode;
0041     bool hpd_irq;
0042     bool alt_mode_cfg_done;
0043     bool debug_en;
0044 
0045     int (*connect)(struct dp_usbpd *dp_usbpd, bool hpd);
0046 };
0047 
0048 /**
0049  * struct dp_usbpd_cb - callback functions provided by the client
0050  *
0051  * @configure: called by usbpd module when PD communication has
0052  * been completed and the usb peripheral has been configured on
0053  * dp mode.
0054  * @disconnect: notify the cable disconnect issued by usb.
0055  * @attention: notify any attention message issued by usb.
0056  */
0057 struct dp_usbpd_cb {
0058     int (*configure)(struct device *dev);
0059     int (*disconnect)(struct device *dev);
0060     int (*attention)(struct device *dev);
0061 };
0062 
0063 /**
0064  * dp_hpd_get() - setup hpd module
0065  *
0066  * @dev: device instance of the caller
0067  * @cb: struct containing callback function pointers.
0068  *
0069  * This function allows the client to initialize the usbpd
0070  * module. The module will communicate with HPD module.
0071  */
0072 struct dp_usbpd *dp_hpd_get(struct device *dev, struct dp_usbpd_cb *cb);
0073 
0074 int dp_hpd_register(struct dp_usbpd *dp_usbpd);
0075 void dp_hpd_unregister(struct dp_usbpd *dp_usbpd);
0076 int dp_hpd_connect(struct dp_usbpd *dp_usbpd, bool hpd);
0077 
0078 #endif /* _DP_HPD_H_ */