From: Junhan Bae Date: Tue, 5 Nov 2019 11:47:43 +0000 (+0900) Subject: [9610] usbpd Rp Defenderault to Contract. X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7158ce203f40641a92153b09ecb8c3c9ac41477b;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [9610] usbpd Rp Defenderault to Contract. Change-Id: I653309e3f33eefa61b202fc0c073941fd8ead9ec Signed-off-by: Junhan Bae --- diff --git a/drivers/ccic/s2mu106-usbpd.c b/drivers/ccic/s2mu106-usbpd.c index bd9312189308..97a966e4582b 100644 --- a/drivers/ccic/s2mu106-usbpd.c +++ b/drivers/ccic/s2mu106-usbpd.c @@ -1072,6 +1072,18 @@ static int s2mu106_set_cc_control(void *_data, int val) return ret; } +static int s2mu106_set_rp_control(void *_data, int val) +{ + struct usbpd_data *data = (struct usbpd_data *) _data; + struct s2mu106_usbpd_data *pdic_data = data->phy_driver_data; + + mutex_lock(&pdic_data->cc_mutex); + s2mu106_usbpd_set_rp_scr_sel(pdic_data, val); + mutex_unlock(&pdic_data->cc_mutex); + + return 0; +} + static int s2mu106_vbus_on_check(void *_data) { struct usbpd_data *data = (struct usbpd_data *) _data; @@ -2405,7 +2417,6 @@ static int s2mu106_check_port_detect(struct s2mu106_usbpd_data *pdic_data) dev_err(&i2c->dev, "%s, abnormal attach\n", __func__); return -1; } - s2mu106_usbpd_set_rp_scr_sel(pdic_data, PLUG_CTRL_RP180); ret = s2mu106_usbpd_check_accessory(pdic_data); if (ret < 0) { dev_info(&i2c->dev, "%s attach accessory\n", __func__); @@ -3136,6 +3147,7 @@ static usbpd_phy_ops_type s2mu106_ops = { .pr_swap = s2mu106_pr_swap, .vbus_on_check = s2mu106_vbus_on_check, .set_pwr_opmode = s2mu106_set_pwr_opmode, + .set_rp_control = s2mu106_set_rp_control, }; #if defined CONFIG_PM diff --git a/drivers/ccic/usbpd.c b/drivers/ccic/usbpd.c index c441086e9a77..532bdec4b002 100644 --- a/drivers/ccic/usbpd.c +++ b/drivers/ccic/usbpd.c @@ -332,6 +332,7 @@ void usbpd_set_ops(struct device *dev, usbpd_phy_ops_type *ops) pd_data->phy_ops.get_side_check = ops->get_side_check; pd_data->phy_ops.pr_swap = ops->pr_swap; pd_data->phy_ops.vbus_on_check = ops->vbus_on_check; + pd_data->phy_ops.set_rp_control = ops->set_rp_control; pd_data->phy_ops.set_pwr_opmode = ops->set_pwr_opmode; } diff --git a/drivers/ccic/usbpd_policy.c b/drivers/ccic/usbpd_policy.c index d08449200175..b91461a521a5 100644 --- a/drivers/ccic/usbpd_policy.c +++ b/drivers/ccic/usbpd_policy.c @@ -303,6 +303,8 @@ policy_state usbpd_policy_src_transition_supply(struct policy_data *policy) return ret; usbpd_send_ctrl_msg(pd_data, &policy->tx_msg_header, USBPD_PS_RDY, USBPD_DFP, USBPD_SOURCE); + pd_data->phy_ops.set_rp_control(pd_data, PLUG_CTRL_RP180); + ret = PE_SRC_Ready; break; } diff --git a/include/linux/ccic/usbpd.h b/include/linux/ccic/usbpd.h index 3e293d08c096..e8651457fe14 100644 --- a/include/linux/ccic/usbpd.h +++ b/include/linux/ccic/usbpd.h @@ -351,6 +351,7 @@ typedef struct usbpd_phy_ops { int (*set_cc_control)(void *, int); void (*pr_swap)(void *, int); int (*vbus_on_check)(void *); + int (*set_rp_control)(void *, int); int (*get_side_check)(void *_data); void (*set_pwr_opmode)(void *_data, int mode); } usbpd_phy_ops_type;