From patchwork Tue Apr 9 15:29:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 787410 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7967413B5B8 for ; Tue, 9 Apr 2024 15:29:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712676564; cv=none; b=O99hCsu0utRCpPPvEqPz8QctMVyERHjRjVhN6jj9lZvDkvdlumRjx0+Nn++xj6Gv/7kHQnU8PKehJNsnjVbmn4jZ6l2IKimTdbTTclGMdNB8LAINWA5jr8zNMYK6ah0xJka/gvSm6PEXvQ6BZNLDM34ZWxbkW+qPMgyXwRPya+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712676564; c=relaxed/simple; bh=Qii41m4WQHeAZjiOSBCpdD4P8rWOw8ayDA/3aiWLd8s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FHLjhke0mskr7aTFSxhJaGIZ20Stj9+XaAj7XgHW1OX8RU5ipgO3Cv1SxOS1SeC8Gkz2AaLQKi7OQtM0Bz94BnFm7NyIDiS6usaUhic/ZeVC5XiN2TTsAopVn7WWr3FaCGFc8xYafjrhy29pvdAiH4prSjSeDC95DZtBF5Rk0JY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=QOUEkWKC; arc=none smtp.client-ip=209.85.167.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QOUEkWKC" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-516d6898bebso4670859e87.3 for ; Tue, 09 Apr 2024 08:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712676560; x=1713281360; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+rK4J26zOCM/IkzvRWeb9dI3/SvLzqKWXafwI1/aF88=; b=QOUEkWKCmCxIBAP5sY/uH9inDRSXrPTOt/86djQ89oKg5GEwGwK0aFQIAXkYIjhbEd GKAOSzY2BY2wE/bYWqdnRtw8bAEEaK+Kf4yuufgkB37+1rFM1ztK6AoGrx66/2EpVvqT 2AdgHeie864URa9l3NaDXNUbDwf8OE27jI+YAswRg551hUo/xqaLO7Vg3cgZo7Pu2sNl OrG+AV7dQoirxDx8P7Wec24fJQvS2Nl+50lLFXYREw1QF9H3Hh6Dp8zZ/1syiqkRz1L1 BuxZ66qxI+zUJ2lUNUM7ug3GCD25uYWGy8OaPP83+oBIysc8mGZiGRTfjivi4oFgdNVm +1Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712676560; x=1713281360; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+rK4J26zOCM/IkzvRWeb9dI3/SvLzqKWXafwI1/aF88=; b=nBLpjMJUkK3YG30poZF0b/Pi48Jf06A/uACTJ0HOCRTctGuN9aI0PWpO7JSnwLW8lT UTj99Q2a33bj7zuhYwLshou5nfBL+Zp/53zs6XxVpPmZ90+xGJDOMxUl5j8wv2CWdNEC WXC6VCz0jIrEbH3rq/vUA1mZfiX7sR6OVH/G9cE/6nwwz7lsygcJlpnb2PCr/rM2MIKE lUg3GySBo4WT1bZTqePnpf59akZAwRFenjfgFKYKCDlWrg4ok6oufYjG1Bv+bPcaMNxN eFOPHZ3KGMo3dYS7wEw8ysMbT22ro72BnsbCCu/B+FOG+JaBYN4W5JreINRYEtytFpCf rzJA== X-Forwarded-Encrypted: i=1; AJvYcCUv6iKngxgO3PsxnKajRzjKqUTh9YpLHBLsc2+Pf20NlgOCnjsv75T0fCBXVaFQ90FAhm11ej1VkbQhUSQAisg6Uo9Ggq2mkXn+ X-Gm-Message-State: AOJu0YzuVSQHnjKEDoAK4qFdFyujUwfXpCFLUYH7cWbg8oi6fCF2cCAR NMd8gJi9P6oxVZqaEVPUTDZCzgsFErYX2XR1T4cN4z3w6KwzNwKAv/SvIypXPno= X-Google-Smtp-Source: AGHT+IGMKent0y5+d712rV157ro50tteaT7iALlT9p6G6N21wZ5FvY8p31VZWC1tP1MhiFwnv7+z+g== X-Received: by 2002:a05:6512:4dd:b0:516:d029:b51e with SMTP id w29-20020a05651204dd00b00516d029b51emr8019855lfq.60.1712676560602; Tue, 09 Apr 2024 08:29:20 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id a16-20020ac25e70000000b005159412ab81sm1579990lfr.216.2024.04.09.08.29.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 08:29:19 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 09 Apr 2024 18:29:16 +0300 Subject: [PATCH v2 1/3] usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk on qcm6490 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240409-qcom-ucsi-fixes-bis-v2-1-6d3a09faec90@linaro.org> References: <20240409-qcom-ucsi-fixes-bis-v2-0-6d3a09faec90@linaro.org> In-Reply-To: <20240409-qcom-ucsi-fixes-bis-v2-0-6d3a09faec90@linaro.org> To: Heikki Krogerus , Greg Kroah-Hartman Cc: Neil Armstrong , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1312; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Qii41m4WQHeAZjiOSBCpdD4P8rWOw8ayDA/3aiWLd8s=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmFV7NfOogr91/8Kf+FoWNU3eahnqt2+8+GmUBf 1bZb1X99uiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZhVezQAKCRCLPIo+Aiko 1foKCACKFkuLgNblvsbMUbIOPyJPkyBv80SJal1FZyJm7wAjvXqbqKaNM40PqGlByQHjZ3zcFuq KCpCQw03UbOYRvhnRSNNFptDsnxLdtFXTrp9hhcfNioicXaw22I3GL0UxcYNNCQDQjvjnM+UAm7 rU4d4GlcxbtlWV2oi/WrUlSFYuDC8pm8VAz5qPC/ZPSAAinWlkjLPm769thDt/W1zfYzO1m2tDp 8kVfTxwg7hYrvcEUsbq4huiQnxtPTBvFI3rB4NmNoPYqTd5wr2xqkQPdHfFz4ZKSZdw2txDvm3s HKdx2E0KR7QCgFoORL4mtqKvGAue+efT4KC/y4aNXNHNTy8A X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Enable the UCSI_DELAY_DEVICE_PDOS quirk on Qualcomm QCM6490. This platform also doesn't correctly handle reading PD capabilities until PD partner is connected. Fixes: 5da727f75823 ("usb: typec: ucsi_glink: enable the UCSI_DELAY_DEVICE_PDOS quirk") Reviewed-by: Heikki Krogerus Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/ucsi/ucsi_glink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c index ef00a6563c88..9bd80a2218e4 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -316,7 +316,7 @@ static unsigned long quirk_sc8280xp = UCSI_NO_PARTNER_PDOS | UCSI_DELAY_DEVICE_P static unsigned long quirk_sm8450 = UCSI_DELAY_DEVICE_PDOS; static const struct of_device_id pmic_glink_ucsi_of_quirks[] = { - { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8180x, }, + { .compatible = "qcom,qcm6490-pmic-glink", .data = &quirk_sc8280xp, }, { .compatible = "qcom,sc8180x-pmic-glink", .data = &quirk_sc8180x, }, { .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8280xp, }, { .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, }, From patchwork Tue Apr 9 15:29:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 787409 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 314AA13BC28 for ; Tue, 9 Apr 2024 15:29:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712676566; cv=none; b=ZZxDMMRzFo00fGlor9xol7M5NSVrirja4Yn7r34SgSIop9RKizauw2bX8nNniHnOiKeaewsFGyR8ErmTJrx/iSfToKtiI//XSt9UdQzpCb8ulAvEksjDfa1MhPjD7y70OwAlnCc7KVs1EzARB0bElR0aeFiLb3vsiPwrbl/BMEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712676566; c=relaxed/simple; bh=oepvaY2/VOteNy8Xi3leUDDFpbyZF3Ik3OJOE9wvk9o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EIgq02Kp1OIPneIzw8zBHsxGSaEVKiWpx736K2g8TsoY2xP5XdyP/kL9IqCeyEDQ+TKKYbTEh7aRzLSW4+EJrzmCYgMQW3cbe40P/hFDS+O44BYHdNJE1BUG/vqXBthJ2qJx0MPIxSX3q3qe0LcreROefdDOVR2/U8LzMpqUNk4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SuRiQqa9; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SuRiQqa9" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-516d0162fa1so6867580e87.3 for ; Tue, 09 Apr 2024 08:29:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1712676562; x=1713281362; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=oFHcZaaVDW076N+4Kkfs0Y536W5JnS9HZUoI18BuVEQ=; b=SuRiQqa95RRH/pWHHHoUC42pIZH90G6SDAT4Y2FiQDSMnHhGZjHkFkrqVNwna+zUOJ /EW6LdZpiKtPaCaPhtz7g02BAtieoFeBRenHX6TGiXA/s/HBkzdQFultp/eG+E9HgreN OgkTPtm+0s19gQE49pAAZiRh/YzkMNBB+XyZa6+pZcxV54gc7xeCpu2js/MKHx+LwnG5 Nh1j77FCNRUjFVd66PU87ww998QI4R4H2Zp5vo8gdotv0sCw24x5hQIKNcmF2jPGBwYq snZP4sWRzVQkII6fpfBKDc0uesYQXy02BNH1NDyIuv6v+ZwH/BwXEtG5MLSRft5e9Krl vlAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712676562; x=1713281362; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oFHcZaaVDW076N+4Kkfs0Y536W5JnS9HZUoI18BuVEQ=; b=arW5za3DN6x/hAxK/ZDRvPGNR6cC7FN5GW2eqgISAoSL2mCZlxMfxEGC19GGCeWe4D 7ZW6vxDpQOYGL+udrLnfELwrF7J6w3NHBdBFoEMrWMdVh4USPI/TkmP0gXuLZpuuYHYR fZW654vSxZNU1n1AU7mRc6+Fl/gPfgpvD/psH6jD7oMA26seRma54JHaqme5YiNdRABS lXpyiQ9CE3H1NA1/tNLoIwumf6x1sm/BtpuRPoQpm2+eMRtlfrPLkviHq61P2wX/hyj/ ytYb4g0FOKcbWdz+rIU638NuqpFeK4bm9aQKLh5tZIBr99j1EJKdqo80Jr/zYW1zaG7R yWXg== X-Forwarded-Encrypted: i=1; AJvYcCWBbCgcouCtlsKMUjuiFnKX4i1FntWRDyAm3XrDxwUfuYQaNSbK047kv5Pk4lKVQuOd6ct3gHdgFy/FNTKKKJ6bZPxeqhgfj+Ny X-Gm-Message-State: AOJu0Yx6aMQRV0zVtECWv+tnJqayep/uPZRVKHprNRG9yU8tAdiEfQLX 9p7JdaGZRUCpMpac6gJxbFfYTm2qXOPyog3ojRz/amU5ZyiUIO5UkO1w2gk9b7ffFoEyBdv5zlj y X-Google-Smtp-Source: AGHT+IG3J5+oTY8k82U26bGqhj0qhc6r1PMbTssB72gqdqfofcyL2lFLRihn120L0oVWy1CZVyRT/Q== X-Received: by 2002:a19:8c09:0:b0:513:da24:19ff with SMTP id o9-20020a198c09000000b00513da2419ffmr8284672lfd.38.1712676562383; Tue, 09 Apr 2024 08:29:22 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id a16-20020ac25e70000000b005159412ab81sm1579990lfr.216.2024.04.09.08.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 08:29:21 -0700 (PDT) From: Dmitry Baryshkov Date: Tue, 09 Apr 2024 18:29:18 +0300 Subject: [PATCH v2 3/3] usb: typec: ucsi_glink: drop special handling for CCI_BUSY Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240409-qcom-ucsi-fixes-bis-v2-3-6d3a09faec90@linaro.org> References: <20240409-qcom-ucsi-fixes-bis-v2-0-6d3a09faec90@linaro.org> In-Reply-To: <20240409-qcom-ucsi-fixes-bis-v2-0-6d3a09faec90@linaro.org> To: Heikki Krogerus , Greg Kroah-Hartman Cc: Neil Armstrong , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1866; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=oepvaY2/VOteNy8Xi3leUDDFpbyZF3Ik3OJOE9wvk9o=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ5po3Fld0cp+TSFbtrecTsLtOenWejWJ81UPxTGpy2/+n RX1MqGT0ZiFgZGLQVZMkcWnoGVqzKbksA87ptbDDGJlApnCwMUpABNRm8T+m8XBodAtJUb5A5O3 cGcAx7oD2oa33ir/fvL+8SEHPQO5po9T22MtmGz1Gy4/nqrflP1Cn91qznwvp8tTd1g9nqNTU1X iYV50ROjrzlkism26Wbu9P34RPlYxe3nzz1+9CzZPSdS9ejxAi39N4u6PKu51nvcT/Ng4rqjHb3 dynLy+/fqWMyyyx3hYrr9/tdrKfFtJzhOzkwlm2/s82/+L9/26z21YdWm39P+9E624V/9dxujos Typ46NPcs2B+Q18gVvrVhVvYU+XTV/zWiUpPkQo01xK1rxNLvaSTez/D5IxzrXmPK1l4vPY2JQU t3+03fA2edZsP1G7yBVLD6RkhtbrSN99u+ZEnOzTbVMB X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Newer Qualcomm platforms (sm8450+) successfully handle busy state and send the Command Completion after sending the Busy state. Older devices have firmware bug and can not continue after sending the CCI_BUSY state, but the command that leads to CCI_BUSY is already forbidden by the NO_PARTNER_PDOS quirk. Follow other UCSI glue drivers and drop special handling for CCI_BUSY event. Let the UCSI core properly handle this state. Reviewed-by: Heikki Krogerus Signed-off-by: Dmitry Baryshkov --- drivers/usb/typec/ucsi/ucsi_glink.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c index 9ffea20020e7..fe9b951f5228 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -176,7 +176,8 @@ static int pmic_glink_ucsi_sync_write(struct ucsi *__ucsi, unsigned int offset, left = wait_for_completion_timeout(&ucsi->sync_ack, 5 * HZ); if (!left) { dev_err(ucsi->dev, "timeout waiting for UCSI sync write response\n"); - ret = -ETIMEDOUT; + /* return 0 here and let core UCSI code handle the CCI_BUSY */ + ret = 0; } else if (ucsi->sync_val) { dev_err(ucsi->dev, "sync write returned: %d\n", ucsi->sync_val); } @@ -243,11 +244,8 @@ static void pmic_glink_ucsi_notify(struct work_struct *work) ucsi_connector_change(ucsi->ucsi, con_num); } - if (ucsi->sync_pending && cci & UCSI_CCI_BUSY) { - ucsi->sync_val = -EBUSY; - complete(&ucsi->sync_ack); - } else if (ucsi->sync_pending && - (cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE))) { + if (ucsi->sync_pending && + (cci & (UCSI_CCI_ACK_COMPLETE | UCSI_CCI_COMMAND_COMPLETE))) { complete(&ucsi->sync_ack); } }