Skip to contentSkip to conversation

platform/chrome: cros_ec_typec: Tolerate unrecognized mux flags

PATCH Applied Prashant Malani 3 participants 5 messages Nov 6, 2020 – Dec 10, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 platform/chrome: cros_ec_typec: Tolerate unrecognized mux flags

On occasion, the Chrome Embedded Controller (EC) can send a mux configuration which doesn't map to a particular data mode. For instance, dedicated Type C chargers, when connected, may cause only USB_PD_MUX_POLARITY_INVERTED to be set. This is a valid flag combination and should not lead to a driver abort.

Modify the mux configuration handling to not return an error when an unrecognized mux flag combination is encountered. Concordantly, make the ensuing print a debug level print so as to not pollute the kernel logs.

---
 drivers/platform/chrome/cros_ec_typec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +3 -4
index ce031a10eb1b..5b8db02ab84a 100644
@@ -537,10 +537,9 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,
 		port->state.mode = TYPEC_STATE_USB;
 		ret = typec_mux_set(port->mux, &port->state);
 	} else {
-		dev_info(typec->dev,
-			 "Unsupported mode requested, mux flags: %x\n",
-			 mux_flags);
-		ret = -ENOTSUPP;
+		dev_dbg(typec->dev,
+			"Unrecognized mode requested, mux flags: %x\n",
+			mux_flags);
 	}
 
 	return ret;
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog
#1 lore raw

Including Heikki, who I forgot to add in the original patch email.

Quoted 37 lines · Prashant Malani

On occasion, the Chrome Embedded Controller (EC) can send a mux configuration which doesn't map to a particular data mode. For instance, dedicated Type C chargers, when connected, may cause only USB_PD_MUX_POLARITY_INVERTED to be set. This is a valid flag combination and should not lead to a driver abort.

Modify the mux configuration handling to not return an error when an unrecognized mux flag combination is encountered. Concordantly, make the ensuing print a debug level print so as to not pollute the kernel logs.

---
 drivers/platform/chrome/cros_ec_typec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +3 -4
index ce031a10eb1b..5b8db02ab84a 100644
@@ -537,10 +537,9 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,
 		port->state.mode = TYPEC_STATE_USB;
 		ret = typec_mux_set(port->mux, &port->state);
 	} else {
-		dev_info(typec->dev,
-			 "Unsupported mode requested, mux flags: %x\n",
-			 mux_flags);
-		ret = -ENOTSUPP;
+		dev_dbg(typec->dev,
+			"Unrecognized mode requested, mux flags: %x\n",
+			mux_flags);
 	}
 
 	return ret;
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog
Acked-by on v1 1/1
#2 lore raw
In reply to Prashant Malani
Quoted 6 lines · Prashant Malani

On occasion, the Chrome Embedded Controller (EC) can send a mux configuration which doesn't map to a particular data mode. For instance, dedicated Type C chargers, when connected, may cause only USB_PD_MUX_POLARITY_INVERTED to be set. This is a valid flag combination and should not lead to a driver abort.

Quoted 6 lines

Modify the mux configuration handling to not return an error when an unrecognized mux flag combination is encountered. Concordantly, make the ensuing print a debug level print so as to not pollute the kernel logs.

FWIW:

Quoted 24 lines
---
 drivers/platform/chrome/cros_ec_typec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +3 -4
index ce031a10eb1b..5b8db02ab84a 100644
@@ -537,10 +537,9 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,
 		port->state.mode = TYPEC_STATE_USB;
 		ret = typec_mux_set(port->mux, &port->state);
 	} else {
-		dev_info(typec->dev,
-			 "Unsupported mode requested, mux flags: %x\n",
-			 mux_flags);
-		ret = -ENOTSUPP;
+		dev_dbg(typec->dev,
+			"Unrecognized mode requested, mux flags: %x\n",
+			mux_flags);
 	}
 
 	return ret;
Signature · 1 line
2.29.1.341.ge80a0c044ae-goog

thanks,

Signature · 1 line
heikki
#3 lore raw

Friendly ping. If there are not other reservations, can we pick this patch? It doesn't depend on any other patch series.

Thanks,

Quoted 48 lines · Heikki Krogerus
Quoted 6 lines · Prashant Malani

On occasion, the Chrome Embedded Controller (EC) can send a mux configuration which doesn't map to a particular data mode. For instance, dedicated Type C chargers, when connected, may cause only USB_PD_MUX_POLARITY_INVERTED to be set. This is a valid flag combination and should not lead to a driver abort.

Quoted 6 lines

Modify the mux configuration handling to not return an error when an unrecognized mux flag combination is encountered. Concordantly, make the ensuing print a debug level print so as to not pollute the kernel logs.

FWIW:

Quoted 23 lines
---
 drivers/platform/chrome/cros_ec_typec.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/platform/chrome/cros_ec_typec.c +3 -5
index ce031a10eb1b..5b8db02ab84a 100644
@@ -537,10 +537,9 @@ static int cros_typec_configure_mux(struct cros_typec_data *typec, int port_num,
              port->state.mode = TYPEC_STATE_USB;
              ret = typec_mux_set(port->mux, &port->state);
      } else {
-             dev_info(typec->dev,
-                      "Unsupported mode requested, mux flags: %x\n",
-                      mux_flags);
-             ret = -ENOTSUPP;
+             dev_dbg(typec->dev,
+                     "Unrecognized mode requested, mux flags: %x\n",
+                     mux_flags);
      }
 
      return ret;
--
Quoted 1 line

2.29.1.341.ge80a0c044ae-goog

thanks,

--
heikki

maintainer Applied
#4 lore raw
In reply to Prashant Malani
Quoted 9 lines · Prashant Malani

On occasion, the Chrome Embedded Controller (EC) can send a mux configuration which doesn't map to a particular data mode. For instance, dedicated Type C chargers, when connected, may cause only USB_PD_MUX_POLARITY_INVERTED to be set. This is a valid flag combination and should not lead to a driver abort.

Modify the mux configuration handling to not return an error when an unrecognized mux flag combination is encountered. Concordantly, make the ensuing print a debug level print so as to not pollute the kernel logs.

Applied, thanks!

[1/1] platform/chrome: cros_ec_typec: Tolerate unrecognized mux flags

      commit: 6ae9b5ffcaeba64c290dfb8bd7b0194b1fdf0c92

Best regards,

Signature · 7 lines
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
[email protected]
Chromium OS Project
[email protected]