@@ -1054,24 +1054,6 @@ static int cros_typec_get_cmd_version(struct cros_typec_data *typec)
1054
1054
return 0 ;
1055
1055
}
1056
1056
1057
- /* Check the EC feature flags to see if TYPEC_* features are supported. */
1058
- static int cros_typec_feature_supported (struct cros_typec_data * typec , enum ec_feature_code feature )
1059
- {
1060
- struct ec_response_get_features resp = {};
1061
- int ret ;
1062
-
1063
- ret = cros_typec_ec_command (typec , 0 , EC_CMD_GET_FEATURES , NULL , 0 ,
1064
- & resp , sizeof (resp ));
1065
- if (ret < 0 ) {
1066
- dev_warn (typec -> dev ,
1067
- "Failed to get features, assuming typec feature=%d unsupported.\n" ,
1068
- feature );
1069
- return 0 ;
1070
- }
1071
-
1072
- return resp .flags [feature / 32 ] & EC_FEATURE_MASK_1 (feature );
1073
- }
1074
-
1075
1057
static void cros_typec_port_work (struct work_struct * work )
1076
1058
{
1077
1059
struct cros_typec_data * typec = container_of (work , struct cros_typec_data , port_work );
@@ -1113,6 +1095,7 @@ MODULE_DEVICE_TABLE(of, cros_typec_of_match);
1113
1095
1114
1096
static int cros_typec_probe (struct platform_device * pdev )
1115
1097
{
1098
+ struct cros_ec_dev * ec_dev = NULL ;
1116
1099
struct device * dev = & pdev -> dev ;
1117
1100
struct cros_typec_data * typec ;
1118
1101
struct ec_response_usb_pd_ports resp ;
@@ -1132,10 +1115,10 @@ static int cros_typec_probe(struct platform_device *pdev)
1132
1115
return ret ;
1133
1116
}
1134
1117
1135
- typec -> typec_cmd_supported = !! cros_typec_feature_supported ( typec ,
1136
- EC_FEATURE_TYPEC_CMD );
1137
- typec -> needs_mux_ack = !!cros_typec_feature_supported ( typec ,
1138
- EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK );
1118
+ ec_dev = dev_get_drvdata ( & typec -> ec -> ec -> dev );
1119
+ typec -> typec_cmd_supported = !! cros_ec_check_features ( ec_dev , EC_FEATURE_TYPEC_CMD );
1120
+ typec -> needs_mux_ack = !!cros_ec_check_features ( ec_dev ,
1121
+ EC_FEATURE_TYPEC_MUX_REQUIRE_AP_ACK );
1139
1122
1140
1123
ret = cros_typec_ec_command (typec , 0 , EC_CMD_USB_PD_PORTS , NULL , 0 ,
1141
1124
& resp , sizeof (resp ));
0 commit comments