Home Home > GIT Browse > openSUSE-15.1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Saenz Julienne <nsaenzjulienne@suse.de>2019-01-11 12:45:55 +0100
committerNicolas Saenz Julienne <nsaenzjulienne@suse.de>2019-01-11 12:53:22 +0100
commitf37544afa28e6c34b136515072b79e3364685790 (patch)
tree2f9074dbebb2e4b0c8a60e9cfb8239fc2c2470bb
parenta5fcedb88acd3a4b5c5a5ef412e8b8f0173bf880 (diff)
usb: typec: tcpm: Extend the matching rules on PPS APDO
selection (FATE#326325).
-rw-r--r--patches.drivers/usb-typec-tcpm-extend-the-matching-rules-on-pps-apdo-selection.patch117
-rw-r--r--series.conf1
2 files changed, 118 insertions, 0 deletions
diff --git a/patches.drivers/usb-typec-tcpm-extend-the-matching-rules-on-pps-apdo-selection.patch b/patches.drivers/usb-typec-tcpm-extend-the-matching-rules-on-pps-apdo-selection.patch
new file mode 100644
index 0000000000..04ed5f40bb
--- /dev/null
+++ b/patches.drivers/usb-typec-tcpm-extend-the-matching-rules-on-pps-apdo-selection.patch
@@ -0,0 +1,117 @@
+From: Kyle Tso <kyletso@google.com>
+Date: Mon, 17 Dec 2018 21:22:13 +0800
+Subject: usb: typec: tcpm: Extend the matching rules on PPS APDO selection
+Git-commit: c710d0bb76ff0795d8b6c1cda1e01e6e1e661a4a
+Patch-mainline: v5.0-rc1
+References: FATE#326325
+
+Current matching rules ensure that the voltage range of selected Source
+Capability is entirely within the range defined in one of the Sink
+Capabilities. This is reasonable but not practical because Sink may not
+support wide range of voltage when sinking power while Source could
+advertise its capabilities in relatively wider range. For example, a
+Source PDO advertising 3.3V-11V@3A (9V Prog of Fixed Nominal Voltage)
+will not be selected if the Sink requires 5V-12V@3A PPS power. However,
+the Sink could work well if the requested voltage range in RDOs is
+5V-11V@3A.
+
+Currently accepted:
+ |--------- source -----|
+ |----------- sink ---------------|
+
+Currently not accepted:
+ |--------- source -----|
+ |----------- sink ---------------|
+
+ |--------- source -----|
+ |----------- sink ---------------|
+
+ |--------- source -----------------|
+ |------ sink -------|
+
+To improve the usability, change the matching rules to what listed
+below:
+a. The Source PDO is selectable if any portion of the voltage range
+ overlaps one of the Sink PDO's voltage range.
+b. The maximum operational voltage will be the lower one between the
+ selected Source PDO and the matching Sink PDO.
+c. The maximum power will be the maximum operational voltage times the
+ maximum current defined in the selected Source PDO
+d. Select the Source PDO with the highest maximum power
+
+Signed-off-by: Kyle Tso <kyletso@google.com>
+Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
+Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
+---
+ drivers/usb/typec/tcpm/tcpm.c | 35 ++++++++++++++++++++---------------
+ 1 file changed, 20 insertions(+), 15 deletions(-)
+
+diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
+index 3620efee2688..4bc29b586698 100644
+--- a/drivers/usb/typec/tcpm/tcpm.c
++++ b/drivers/usb/typec/tcpm/tcpm.c
+@@ -2213,7 +2213,8 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
+ unsigned int i, j, max_mw = 0, max_mv = 0;
+ unsigned int min_src_mv, max_src_mv, src_ma, src_mw;
+ unsigned int min_snk_mv, max_snk_mv;
+- u32 pdo;
++ unsigned int max_op_mv;
++ u32 pdo, src, snk;
+ unsigned int src_pdo = 0, snk_pdo = 0;
+
+ /*
+@@ -2263,16 +2264,18 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
+ continue;
+ }
+
+- if (max_src_mv <= max_snk_mv &&
+- min_src_mv >= min_snk_mv) {
++ if (min_src_mv <= max_snk_mv &&
++ max_src_mv >= min_snk_mv) {
++ max_op_mv = min(max_src_mv, max_snk_mv);
++ src_mw = (max_op_mv * src_ma) / 1000;
+ /* Prefer higher voltages if available */
+ if ((src_mw == max_mw &&
+- min_src_mv > max_mv) ||
++ max_op_mv > max_mv) ||
+ src_mw > max_mw) {
+ src_pdo = i;
+ snk_pdo = j;
+ max_mw = src_mw;
+- max_mv = max_src_mv;
++ max_mv = max_op_mv;
+ }
+ }
+ }
+@@ -2285,16 +2288,18 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
+ }
+
+ if (src_pdo) {
+- pdo = port->source_caps[src_pdo];
+-
+- port->pps_data.min_volt = pdo_pps_apdo_min_voltage(pdo);
+- port->pps_data.max_volt = pdo_pps_apdo_max_voltage(pdo);
+- port->pps_data.max_curr =
+- min_pps_apdo_current(pdo, port->snk_pdo[snk_pdo]);
+- port->pps_data.out_volt =
+- min(pdo_pps_apdo_max_voltage(pdo), port->pps_data.out_volt);
+- port->pps_data.op_curr =
+- min(port->pps_data.max_curr, port->pps_data.op_curr);
++ src = port->source_caps[src_pdo];
++ snk = port->snk_pdo[snk_pdo];
++
++ port->pps_data.min_volt = max(pdo_pps_apdo_min_voltage(src),
++ pdo_pps_apdo_min_voltage(snk));
++ port->pps_data.max_volt = min(pdo_pps_apdo_max_voltage(src),
++ pdo_pps_apdo_max_voltage(snk));
++ port->pps_data.max_curr = min_pps_apdo_current(src, snk);
++ port->pps_data.out_volt = min(port->pps_data.max_volt,
++ port->pps_data.out_volt);
++ port->pps_data.op_curr = min(port->pps_data.max_curr,
++ port->pps_data.op_curr);
+ }
+
+ return src_pdo;
+
diff --git a/series.conf b/series.conf
index 3b8d000813..ee1159864a 100644
--- a/series.conf
+++ b/series.conf
@@ -42019,6 +42019,7 @@
patches.drivers/gpio-raspberrypi-exp-decrease-refcount-on-firmware-dt-node.patch
patches.drivers/power-supply-olpc_battery-correct-the-temperature-un.patch
patches.drivers/usb-dwc2-host-use-hrtimer-for-nak-retries.patch
+ patches.drivers/usb-typec-tcpm-extend-the-matching-rules-on-pps-apdo-selection.patch
patches.suse/tty-ldsem-Wake-up-readers-after-timed-out-down_write.patch
patches.suse/tty-Hold-tty_ldisc_lock-during-tty_reopen.patch
patches.suse/tty-Don-t-block-on-IO-when-ldisc-change-is-pending.patch