Skip to content

Commit 36b35ad

Browse files
committed
Merge tag 'qcom-drivers-fixes-for-7.0' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/qcom/linux into arm/fixes
Qualcomm driver fixes for v7.0 Fix the length of the PD restart reason string in pd-mapper to avoid QMI decoding errors, resulting in the notification being dropped. Fix the newly introduce handling of TBT/USB4 notifications in pmic_glink altmode driver, as it broke the handling of non-TBT/USB4 DisplayPort unplug events. * tag 'qcom-drivers-fixes-for-7.0' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/qcom/linux: soc: qcom: pmic_glink_altmode: Fix TBT->SAFE->!TBT transition soc: qcom: pmic_glink_altmode: Fix SVID=DP && unconnected edge case soc: qcom: pd-mapper: Fix element length in servreg_loc_pfr_req_ei Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
2 parents 7962fd9 + a343fb1 commit 36b35ad

4 files changed

Lines changed: 31 additions & 13 deletions

File tree

drivers/soc/qcom/pdr_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ struct servreg_set_ack_resp {
8484

8585
struct servreg_loc_pfr_req {
8686
char service[SERVREG_NAME_LENGTH + 1];
87-
char reason[257];
87+
char reason[SERVREG_PFR_LENGTH + 1];
8888
};
8989

9090
struct servreg_loc_pfr_resp {

drivers/soc/qcom/pmic_glink_altmode.c

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ struct usbc_notify {
6262
u8 orientation;
6363
u8 mux_ctrl;
6464
#define MUX_CTRL_STATE_NO_CONN 0
65+
#define MUX_CTRL_STATE_USB3_ONLY 1
66+
#define MUX_CTRL_STATE_DP4LN 2
67+
#define MUX_CTRL_STATE_USB3_DP 3
6568
#define MUX_CTRL_STATE_TUNNELING 4
6669

6770
u8 res;
@@ -350,15 +353,20 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
350353

351354
typec_switch_set(alt_port->typec_switch, alt_port->orientation);
352355

353-
if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
354-
pmic_glink_altmode_safe(altmode, alt_port);
355-
} else if (alt_port->svid == USB_TYPEC_TBT_SID) {
356-
pmic_glink_altmode_enable_tbt(altmode, alt_port);
357-
} else if (alt_port->svid == USB_TYPEC_DP_SID) {
358-
pmic_glink_altmode_enable_dp(altmode, alt_port,
359-
alt_port->mode,
360-
alt_port->hpd_state,
361-
alt_port->hpd_irq);
356+
/*
357+
* MUX_CTRL_STATE_DP4LN/USB3_DP may only be set if SVID=DP, but we need
358+
* to special-case the SVID=DP && mux_ctrl=NO_CONN case to deliver a
359+
* HPD notification
360+
*/
361+
if (alt_port->svid == USB_TYPEC_DP_SID) {
362+
if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
363+
pmic_glink_altmode_safe(altmode, alt_port);
364+
} else {
365+
pmic_glink_altmode_enable_dp(altmode, alt_port,
366+
alt_port->mode,
367+
alt_port->hpd_state,
368+
alt_port->hpd_irq);
369+
}
362370

363371
if (alt_port->hpd_state)
364372
conn_status = connector_status_connected;
@@ -367,9 +375,18 @@ static void pmic_glink_altmode_worker(struct work_struct *work)
367375

368376
drm_aux_hpd_bridge_notify(&alt_port->bridge->dev, conn_status);
369377
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_TUNNELING) {
370-
pmic_glink_altmode_enable_usb4(altmode, alt_port);
371-
} else {
378+
if (alt_port->svid == USB_TYPEC_TBT_SID)
379+
pmic_glink_altmode_enable_tbt(altmode, alt_port);
380+
else
381+
pmic_glink_altmode_enable_usb4(altmode, alt_port);
382+
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_USB3_ONLY) {
372383
pmic_glink_altmode_enable_usb(altmode, alt_port);
384+
} else if (alt_port->mux_ctrl == MUX_CTRL_STATE_NO_CONN) {
385+
pmic_glink_altmode_safe(altmode, alt_port);
386+
} else {
387+
dev_err(altmode->dev, "Got unknown mux_ctrl: %u on port %u, forcing safe mode\n",
388+
alt_port->mux_ctrl, alt_port->index);
389+
pmic_glink_altmode_safe(altmode, alt_port);
373390
}
374391

375392
pmic_glink_altmode_request(altmode, ALTMODE_PAN_ACK, alt_port->index);

drivers/soc/qcom/qcom_pdr_msg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ const struct qmi_elem_info servreg_loc_pfr_req_ei[] = {
325325
},
326326
{
327327
.data_type = QMI_STRING,
328-
.elem_len = SERVREG_NAME_LENGTH + 1,
328+
.elem_len = SERVREG_PFR_LENGTH + 1,
329329
.elem_size = sizeof(char),
330330
.array_type = VAR_LEN_ARRAY,
331331
.tlv_type = 0x02,

include/linux/soc/qcom/pdr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <linux/soc/qcom/qmi.h>
66

77
#define SERVREG_NAME_LENGTH 64
8+
#define SERVREG_PFR_LENGTH 256
89

910
struct pdr_service;
1011
struct pdr_handle;

0 commit comments

Comments
 (0)