mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
mfd: fusb302: Add notify when received attention HPD signal
Fix DP drivers can't get the HPD signal changed when DP mode is on. Change-Id: I0e8eefadb677e956cca4f62a4befa9ee47e7e013 Signed-off-by: zain wang <wzz@rock-chips.com>
This commit is contained in:
@@ -220,7 +220,8 @@ void fusb_irq_enable(struct fusb30x_chip *chip)
|
||||
|
||||
static void platform_fusb_notify(struct fusb30x_chip *chip)
|
||||
{
|
||||
bool plugged = 0, flip = 0, dfp = 0, ufp = 0, dp = 0, usb_ss = 0;
|
||||
bool plugged = 0, flip = 0, dfp = 0, ufp = 0, dp = 0, usb_ss = 0,
|
||||
hpd = 0;
|
||||
union extcon_property_value property;
|
||||
|
||||
if (chip->notify.is_cc_connected)
|
||||
@@ -244,6 +245,7 @@ static void platform_fusb_notify(struct fusb30x_chip *chip)
|
||||
dfp = 1;
|
||||
usb_ss = (chip->notify.pin_assignment_def &
|
||||
(PIN_MAP_B | PIN_MAP_D | PIN_MAP_F)) ? 1 : 0;
|
||||
hpd = GET_DP_STATUS_HPD(chip->notify.dp_status);
|
||||
} else if (chip->notify.data_role) {
|
||||
dfp = 1;
|
||||
usb_ss = 1;
|
||||
@@ -269,7 +271,7 @@ static void platform_fusb_notify(struct fusb30x_chip *chip)
|
||||
EXTCON_PROP_USB_SS, property);
|
||||
extcon_set_state(chip->extcon, EXTCON_USB, ufp);
|
||||
extcon_set_state(chip->extcon, EXTCON_USB_HOST, dfp);
|
||||
extcon_set_state(chip->extcon, EXTCON_DISP_DP, dp);
|
||||
extcon_set_state(chip->extcon, EXTCON_DISP_DP, dp && hpd);
|
||||
extcon_sync(chip->extcon, EXTCON_USB);
|
||||
extcon_sync(chip->extcon, EXTCON_USB_HOST);
|
||||
extcon_sync(chip->extcon, EXTCON_DISP_DP);
|
||||
@@ -1020,10 +1022,12 @@ static void process_vdm_msg(struct fusb30x_chip *chip)
|
||||
case VDM_TYPE_INIT:
|
||||
switch (GET_VDMHEAD_CMD(vdm_header)) {
|
||||
case VDM_ATTENTION:
|
||||
chip->notify.dp_status = GET_DP_STATUS(chip->rec_load[1]);
|
||||
dev_info(chip->dev, "attention, dp_status %x\n",
|
||||
chip->rec_load[1]);
|
||||
chip->notify.attention = 1;
|
||||
chip->vdm_state = 6;
|
||||
platform_fusb_notify(chip);
|
||||
break;
|
||||
default:
|
||||
dev_warn(chip->dev, "rec unknown init vdm msg\n");
|
||||
@@ -1085,6 +1089,7 @@ static void process_vdm_msg(struct fusb30x_chip *chip)
|
||||
chip->val_tmp = 1;
|
||||
break;
|
||||
case VDM_DP_STATUS_UPDATE:
|
||||
chip->notify.dp_status = GET_DP_STATUS(chip->rec_load[1]);
|
||||
dev_dbg(chip->dev, "dp_status 0x%x\n",
|
||||
chip->rec_load[1]);
|
||||
chip->val_tmp = 1;
|
||||
|
||||
@@ -311,6 +311,12 @@ enum tcpm_rp_value {
|
||||
#define GET_VDMHEAD_CMD(head) (head & VDMHEAD_CMD_MASK)
|
||||
#define GET_VDMHEAD_STRUCT_TYPE(head) ((head & VDMHEAD_STRUCT_TYPE_MASK) >> 15)
|
||||
|
||||
#define DP_STATUS_MASK 0x000000ff
|
||||
#define DP_STATUS_HPD_STATE BIT(7)
|
||||
|
||||
#define GET_DP_STATUS(status) (status & DP_STATUS_MASK)
|
||||
#define GET_DP_STATUS_HPD(status) ((status & DP_STATUS_HPD_STATE) >> 7)
|
||||
|
||||
#define VDM_IDHEAD_USBVID_MASK (0xffff << 0)
|
||||
#define VDM_IDHEAD_MODALSUPPORT_MASK BIT(26)
|
||||
#define VDM_IDHEAD_PRODUCTTYPE (7 << 27)
|
||||
@@ -342,6 +348,7 @@ struct notify_info {
|
||||
int pin_assignment_support;
|
||||
int pin_assignment_def;
|
||||
bool attention;
|
||||
u32 dp_status;
|
||||
};
|
||||
|
||||
enum tx_state {
|
||||
@@ -424,7 +431,6 @@ struct fusb30x_chip {
|
||||
int vdm_state;
|
||||
int vdm_substate;
|
||||
int vdm_send_state;
|
||||
u32 dp_status;
|
||||
u16 vdm_svid[12];
|
||||
int vdm_svid_num;
|
||||
u32 vdm_id;
|
||||
|
||||
Reference in New Issue
Block a user