From patchwork Mon Dec 2 03:06:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Zhu X-Patchwork-Id: 13889905 Received: from mx0b-00230701.pphosted.com (mx0b-00230701.pphosted.com [148.163.158.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A1AE18E29; Mon, 2 Dec 2024 03:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=148.163.158.9 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733108838; cv=fail; b=RCYBFCl6Iq8+wq6+o7S5GvTZWYGaMNMzM+RwfobGPDCrcQRSsr7823n4ReYGQassNMVbwFRujTvyElh3PMdOaYjvmjQ5HDp+yBgyPeoJAkqRqNtay0dXBP6rKlXZA33IToRg81OIg1oSKiqogdGpdVSU8BAyAIfGrKh+UDKuCrs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733108838; c=relaxed/simple; bh=bg0RqbNEitW2clomyIk2L+g3IwJ0j1tVPHQv03N3E7c=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Vz1bppM6OnC77JqptA8fBMZPm5zm3lIer+z1kq4SDI+FrkRFpTCvdxw0nHhooNdN9CqXz7KjsHLydqGNboUUZS+6AmhzVSK922vZwTMao/BCoZTQkk30Jt5+wW6SbvwSMBkmJEdAu2Srep9JmeVNO0VpFJ9jKa3jN717vc4pnqQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com; spf=pass smtp.mailfrom=synopsys.com; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=dyang6kY; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=gLuLOlsi; dkim=fail (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b=jtpOOAYy reason="signature verification failed"; arc=fail smtp.client-ip=148.163.158.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=synopsys.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="dyang6kY"; dkim=pass (2048-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="gLuLOlsi"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=synopsys.com header.i=@synopsys.com header.b="jtpOOAYy" Received: from pps.filterd (m0098572.ppops.net [127.0.0.1]) by mx0b-00230701.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4B1KNsiK006475; Sun, 1 Dec 2024 19:06:58 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfptdkimsnps; bh=h5HV9K49imEMPd33uEX uu+MPv30bOxCntpJF2eMlYl8=; b=dyang6kY6tZbKWwRG7+KbumNKzFn5J1qvOg 7oJdFnMdfLDjAHoP/uJjQRgEd20cBJj0ZQgUbsenZZl5QJ/aB+9FqYV86uikX7g/ CFBRsutsVcaFSQ5nZhRwKiWOR2KsraXmxZMi1igYheafXslmXAvI6zNj/nU55YQ9 9o8MaSYZ5sdp9vzAArWG/pvqTHm86vqk/o8fGH5MEtQN1dfA5E/mWBQpMfVBidM6 hn4C5yt+W1kyGFeANnNovK5bGIqqF7RXkOZGnVpqvw+KzMK2LdSVVAcZLzTIYt/y bPam7hkmuWmlElzCBnay7GtL+Gv3dsHkblF5+Jd1yAY94zqDFkw== Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by mx0b-00230701.pphosted.com (PPS) with ESMTPS id 43827k4y61-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 01 Dec 2024 19:06:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1733108816; bh=bg0RqbNEitW2clomyIk2L+g3IwJ0j1tVPHQv03N3E7c=; h=From:To:CC:Subject:Date:From; b=gLuLOlsig06knoq7Y3/5AJDzF0E+JMygp5Ka0yuUi8zIINzm7Z0tuGDfOupryPlV0 WrLfJyuSDcqLrmScxLpfd37PFxzUn4yioqwK23msgFOh1O7OkWYsiu1b2pUUWZBM2U uW5cf1lThNzbq3mT6rNOokfKIDOYbP6PwZaUaS3Ss70XGiDI3KeD+avgl/fpaMXQTF f/Taa1IoiMson9LOqXWyuRCjUD1C2Xs7qTv5u9/o7DbMYRNBc/p6fUqEu3RkwpooF+ BEIslcVBhN3lsT42obLbZ3xjKcwpAzFmf6yjAw7UXABALMIbut76Sz5584+0gr7aUl lfNerChJZfaMQ== Received: from mailhost.synopsys.com (badc-mailhost3.synopsys.com [10.192.0.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) client-signature RSA-PSS (2048 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id A9FDC40147; Mon, 2 Dec 2024 03:06:55 +0000 (UTC) Received: from o365relay-in.synopsys.com (us03-o365relay1.synopsys.com [10.4.161.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "o365relay-in.synopsys.com", Issuer "Entrust Certification Authority - L1K" (not verified)) by mailhost.synopsys.com (Postfix) with ESMTPS id 3986FA0085; Mon, 2 Dec 2024 03:06:53 +0000 (UTC) Authentication-Results: o365relay-in.synopsys.com; dmarc=pass (p=reject dis=none) header.from=synopsys.com Authentication-Results: o365relay-in.synopsys.com; spf=pass smtp.mailfrom=synopsys.com Authentication-Results: o365relay-in.synopsys.com; dkim=pass (1024-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=selector1 header.b=jtpOOAYy; dkim-atps=neutral Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by o365relay-in.synopsys.com (Postfix) with ESMTPS id BFF2340235; Mon, 2 Dec 2024 03:06:51 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MFdYFLti77201bosMAobJ7JHsDoK0FOyk/KZTQhzl7myBTmRdTs7qPVVSBgZgl+lcoakzosrhV76LoGwOPIxxeQcN5TILAJ+3fWbNVBrFVdeXUd5OIymUlxINNeryJzAwc63j5Q2nR4TLFAM6BL0ZswvtdnY4YlG52lBBvJzUoLni/Tz3JutMYZ1T6IkWhD6kRbuy17HlkHsU0C2gqPfshv9QvFhA5KBEw8dg7MbeZlk61TmLZ9sGBXiBfruRIM7SzQtByaAwJY0gy+6dtZSHK1AS30xTF9WgQLSFC8WLobCuJuWGloW8yMVtZEFLi9qL4W1hm50wPIUiLVj2EbFTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h5HV9K49imEMPd33uEXuu+MPv30bOxCntpJF2eMlYl8=; b=o9wr6ujypX/A96x+pSllyS0GjuzKmkK9t+dx8KiITMvUIZcW2UEl/APtpHFA6XJyQlLiSMfu2M19miIm9VIiJkC9h0e+hzP2U6ZutJ6gQvrLz3YMlfoNnLwgXcx1JV7Th/DV9wnoysOXqA7BJYQ2fysr+xTwXtlNNI5xmXFQ76OtNPd7BO6M4is+mxUNRUM6+ysPyVu3DOkshqkcqBC08siwyz23Ug/H+iWCe+YmqsG4q0vyH/GpOzMfHk8OOeqQnNhYJfSPsYa6GdC4xf+TnjLk3vWxXvNTlhs/JEj4GBfkBtaFGxJu13loEmh5EICJxTagVhlwZDZH/+CoLm1Iww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synopsys.com; dmarc=pass action=none header.from=synopsys.com; dkim=pass header.d=synopsys.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=synopsys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h5HV9K49imEMPd33uEXuu+MPv30bOxCntpJF2eMlYl8=; b=jtpOOAYymsZSaOFoF3gIAmYai/djknDcNp5Mv5FQdSEVYZf/ZkQPeFenFgAaQSWJg/FDWfq6eZdwYkG+Cyog8CHABHzpXEvSAcKvi2SzA9Lvd+w/pQa6H/0gZRGFNdT84Vn0Ni7BfOZN0pT1qgHfwapYkbru13FvZ2TbHB8CArw= Received: from LV2PR12MB5799.namprd12.prod.outlook.com (2603:10b6:408:179::11) by PH0PR12MB5647.namprd12.prod.outlook.com (2603:10b6:510:144::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.20; Mon, 2 Dec 2024 03:06:45 +0000 Received: from LV2PR12MB5799.namprd12.prod.outlook.com ([fe80::9fea:67a4:7d73:bff7]) by LV2PR12MB5799.namprd12.prod.outlook.com ([fe80::9fea:67a4:7d73:bff7%4]) with mapi id 15.20.8207.017; Mon, 2 Dec 2024 03:06:45 +0000 X-SNPS-Relay: synopsys.com From: Miao Zhu To: "heikki.krogerus@linux.intel.com" , "gregkh@linuxfoundation.org" , "andre.draszik@linaro.org" , "rdbabiera@google.com" , "m.felsch@pengutronix.de" , "u.kleine-koenig@baylibre.com" , "dan.carpenter@linaro.org" , Miao Zhu , "emanuele.ghidoli@toradex.com" CC: "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jianheng Zhang Subject: [PATCH] usb: typec: tcpm: tcpci: Make the driver be compatible with the TCPCI spec [Rev 2.0 Ver 1.0, October 2017] Thread-Topic: [PATCH] usb: typec: tcpm: tcpci: Make the driver be compatible with the TCPCI spec [Rev 2.0 Ver 1.0, October 2017] Thread-Index: AdtEZo2aQYcfRgOGQAOd6IaiTP6nKg== Date: Mon, 2 Dec 2024 03:06:45 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-dg-ref: PG1ldGE+PGF0IG5tPSJib2R5LnR4dCIgcD0iYzpcdXNlcnNcbWlhb1xhcHBkYXRhXHJvYW1pbmdcMDlkODQ5YjYtMzJkMy00YTQwLTg1ZWUtNmI4NGJhMjllMzViXG1zZ3NcbXNnLTZmYTVhODMwLWIwNWEtMTFlZi05YmQ5LTI4MmU4OTE2MTdjOVxhbWUtdGVzdFw2ZmE1YTgzMS1iMDVhLTExZWYtOWJkOS0yODJlODkxNjE3Yzlib2R5LnR4dCIgc3o9IjE3NTQ2IiB0PSIxMzM3NzU4MjQwMzM2NTg4NjQiIGg9Ik5HSnljdkpEa1VKd3doZVFlVEdPQ05uNkpiWT0iIGlkPSIiIGJsPSIwIiBibz0iMSIvPjwvbWV0YT4= x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV2PR12MB5799:EE_|PH0PR12MB5647:EE_ x-ms-office365-filtering-correlation-id: 75849644-e2c7-4ef3-e47d-08dd127e5aa6 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: jnB6H/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SXCt/OESCDejKxh1jMUf7JsZFeF+jTbARUAOVQou2HHTkY9xy3qS3i1xFnvYamwV7XZGVcBiT9lE8+ZdRMqt1U+B/c9/KHi3yDEOQ0yj715HfwiAH5o/Q/oxf1wpzQzgnnKKeBLHs76RT4IKf8ClGqwTfq9bBsbzap3K2ubxsO2TYxx5ZfxZLMNnGsQ9zu4ytzraynhzFGyZs1h2xABA3yNSAlDMe99BEz92vh1MaSTyQjOVZOJLmy0GXSNwPpzMN8XB0Bzdb/Lu/ZldecR4RbBbqN4+Ro7y7bxnG5CD1ZkubNvcYiHupATs0LyJ7ZoElhuvLRYbZslXieSNPIOGquBE15iG9A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV2PR12MB5799.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(1800799024)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: Tg0vNzRsItLJ8PGAvJLdJXvOJe6WRIWbfPzkfke6Cagf6ppCWIvESpXaGQsRW6t0abXbzzXqpwn7nV2W7Ry03wN/ICQJaKyP5vq3Wnv65xDjz9vLUbmt8YoXt9rx2GinHs6Z+GduWmYv0YI9ojhT4lmkbvKKxhzGub/dzJDnk7kDJo6nrv6M8uxfOAmtXObURAobXmvYV3Eeqs6UIxMvDYmfHaBBWgrylM1F6WCUMQAklHxuQoYbHSB93Dz0vq7HqaHwA/gpe/1NJzzM8hw7yw0Y9L7iXxUL5N/kD9KihE32isrF9hbWRnvk0Lr8LrIuvWmsLV1Fto0Jt80yBtx+lJ06vgBHKKRyvoWeEjYJznL+R4wM6V4l7ZDz2uxiBiQfhK4HWITCt7QjCuVMi7Fvn+lyEvVxuK+5dB788I2MH//Ii9yefzW+HjQYts2BVqCC74Mv0r+G0Wi37aHWS2mEFtCje+o/8/c1IvzmlIj3TeAzyudnQmRW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Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: edskGXv8cdVuJQGV4Z/ffEvrT248Tsr75QDc/GRPf0Rmgg2XNI/fcuUHSFVzzO7PbQ/LFLsTUUxOmXx0l4omD/FaTxSP8S/Ya+pG9pkXKRkneaBHa7yCZG8Ji2njvQVqwNXpLzwEQ8RERoSLL86NTAlafai36rfhxm+v+qtXiCedGlvBKXilUIxS01WwqM+XjPVPAa5sRX+iAQfDzhCkHC2gRxmm5v4VHGWWqNvDA3QpA1SqG/hy4o5YWv6cDPnSFJxM7tiob5kqmge/np2BvCz91IggQ75ZxHkjTei5EZ0FG5xQ+ngssQbr0IPPWxgxW+iDDTN1LynmeGhDr2mvzxRI3KCnfF9kmG/T03H3QgKWvoqElUDu/3kRcwRmafDVzabg7yo8xL76VQHeScbTtwipB/m10tjFNfrm5OaX2MQ3U/hHvMn5RYdh1jGIE6G/a6WG8vPJHtrdw2wSlcMmjMV+eM5lwbp95vqtVyAgd7gA/l2338ZJQ3jfz1FvbGUC2IciSWL82PMPKQ7DQ6d9aHzXlGfimOiqJOfIVtznjmtOGfk76KA1hjCZvu40+RsjldRtGF0cWXpiFfgCF7XgkrycoD3lPSkNe1P6bQaexi+n6k0UT71pxjfLWBuPKVAVttmNIDRrCP4DgOAxq94W/g== X-OriginatorOrg: synopsys.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV2PR12MB5799.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75849644-e2c7-4ef3-e47d-08dd127e5aa6 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Dec 2024 03:06:45.2100 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: c33c9f88-1eb7-4099-9700-16013fd9e8aa X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: F08+gx784u4LBSaVCOL7bmSRWs3GVh2rQfOz9m5rLMJLessMg7c9K/0aK+dsLFJMOfl0r8/lvclk3Yb1HMjOwA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5647 X-Proofpoint-GUID: Z1xi1xyTVBnKuBWoCMMPbE6iC_aC0Pwq X-Proofpoint-ORIG-GUID: Z1xi1xyTVBnKuBWoCMMPbE6iC_aC0Pwq X-Authority-Analysis: v=2.4 cv=U/toDfru c=1 sm=1 tr=0 ts=674d2451 cx=c_pps a=t4gDRyhI9k+KZ5gXRQysFQ==:117 a=t4gDRyhI9k+KZ5gXRQysFQ==:17 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=N6atwU2pGFX-QpmD:21 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=RZcAm9yDv7YA:10 a=nEwiWwFL_bsA:10 a=qPHU084jO2kA:10 a=jIQo8A4GAAAA:8 a=eGn6WNas5V0CIjkcNdIA:9 a=CjuIK1q_8ugA:10 a=Lf5xNeLK5dgiOs8hzIjU:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_active_cloned_notspam policy=outbound_active_cloned score=0 suspectscore=0 adultscore=0 spamscore=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 bulkscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412020026 The tcpci driver doesn't fully follow the TCPCI spec even if it mentions this spec in its comments. - Add two flags into tcpci_data: RX_BUF_BYTE_x_hidden conn_present_capable - Following flags in tcpci_data are read from device tree in tcpci_probe. TX_BUF_BYTE_x_hidden RX_BUF_BYTE_x_hidden auto_discharge_disconnect vbus_vsafe0v The change makes the driver be compatible with the TCPCI spec and therefore won't impact existing HW. Signed-off-by: Miao Zhu --- drivers/usb/typec/tcpm/tcpci.c | 115 +++++++++++++++++++++++++++------ include/linux/usb/tcpci.h | 11 ++++ 2 files changed, 106 insertions(+), 20 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index ed32583829be..e4a885fa38b5 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -453,19 +453,26 @@ static int tcpci_set_roles(struct tcpc_dev *tcpc, bool attached, enum typec_role role, enum typec_data_role data) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); - unsigned int reg; + unsigned int reg = 0; int ret; - reg = FIELD_PREP(TCPC_MSG_HDR_INFO_REV, PD_REV20); - if (role == TYPEC_SOURCE) - reg |= TCPC_MSG_HDR_INFO_PWR_ROLE; - if (data == TYPEC_HOST) - reg |= TCPC_MSG_HDR_INFO_DATA_ROLE; + if (attached) { + reg = FIELD_PREP(TCPC_MSG_HDR_INFO_REV, PD_REV20); + if (role == TYPEC_SOURCE) + reg |= TCPC_MSG_HDR_INFO_PWR_ROLE; + if (data == TYPEC_HOST) + reg |= TCPC_MSG_HDR_INFO_DATA_ROLE; + } ret = regmap_write(tcpci->regmap, TCPC_MSG_HDR_INFO, reg); if (ret < 0) return ret; - return 0; + if (tcpci->data->conn_present_capable) + return regmap_update_bits(tcpci->regmap, TCPC_CONFIG_STD_OUTPUT, + TCPC_CONFIG_STD_OUTPUT_CON_PRES, + attached ? TCPC_CONFIG_STD_OUTPUT_CON_PRES : 0); + else + return 0; } static int tcpci_set_pd_rx(struct tcpc_dev *tcpc, bool enable) @@ -741,33 +748,86 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) struct pd_message msg; unsigned int cnt, payload_cnt; u16 header; + unsigned int frame_type; + enum tcpm_transmit_type rx_type; regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); /* * 'cnt' corresponds to READABLE_BYTE_COUNT in section 4.4.14 * of the TCPCI spec [Rev 2.0 Ver 1.0 October 2017] and is * defined in table 4-36 as one greater than the number of - * bytes received. And that number includes the header. So: + * bytes received. And that number includes the header. + * In Section 4.4.14 of the TCPCI spec [Rev 2.0 Ver 1.0 October, 2017], + * the RECEIVE_BUFFER comprises of three sets of registers: + * READABLE_BYTE_COUNT, RX_BUF_FRAME_TYPE and RX_BUF_BYTE_x. + * These registers can only be accessed by reading at a common + * register address 0x30h. */ - if (cnt > 3) - payload_cnt = cnt - (1 + sizeof(msg.header)); - else - payload_cnt = 0; + if (tcpci->data->TX_BUF_BYTE_x_hidden) { + u8 buf[TCPC_RECEIVE_BUFFER_MAX_LEN] = {0,}; + u8 pos = 0; + + /* Read the count and frame type in RECEIVE_BUFFER */ + regmap_raw_read(tcpci->regmap, TCPC_RX_BYTE_CNT, buf, 2); + /* READABLE_BYTE_COUNT */ + cnt = buf[0]; + /* RX_BUF_FRAME_TYPE */ + frame_type = buf[1]; + + /* Read the content of the USB PD message in RECEIVE_BUFFER */ + regmap_raw_read(tcpci->regmap, TCPC_RX_BYTE_CNT, buf, cnt + 1); + + pos += 2; + memcpy(&msg.header, &buf[pos], sizeof(msg.header)); + + if (cnt > 3) { + pos += sizeof(msg.header); + payload_cnt = cnt - (1 + sizeof(msg.header)); + if (WARN_ON(payload_cnt > sizeof(msg.payload))) + payload_cnt = sizeof(msg.payload); + memcpy(&msg.payload, &buf[pos], payload_cnt); + } + } else { + regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); + /* + * 'cnt' corresponds to READABLE_BYTE_COUNT in section 4.4.14 + * of the TCPCI spec [Rev 2.0 Ver 1.0 October 2017] and is + * defined in table 4-36 as one greater than the number of + * bytes received. And that number includes the header. So: + */ + if (cnt > 3) + payload_cnt = cnt - (1 + sizeof(msg.header)); + else + payload_cnt = 0; - tcpci_read16(tcpci, TCPC_RX_HDR, &header); - msg.header = cpu_to_le16(header); + regmap_read(tcpci->regmap, TCPC_RX_BUF_FRAME_TYPE, &frame_type); - if (WARN_ON(payload_cnt > sizeof(msg.payload))) - payload_cnt = sizeof(msg.payload); + tcpci_read16(tcpci, TCPC_RX_HDR, &header); + msg.header = cpu_to_le16(header); - if (payload_cnt > 0) - regmap_raw_read(tcpci->regmap, TCPC_RX_DATA, - &msg.payload, payload_cnt); + if (WARN_ON(payload_cnt > sizeof(msg.payload))) + payload_cnt = sizeof(msg.payload); + + if (payload_cnt > 0) + regmap_raw_read(tcpci->regmap, TCPC_RX_DATA, + &msg.payload, payload_cnt); + } /* Read complete, clear RX status alert bit */ tcpci_write16(tcpci, TCPC_ALERT, TCPC_ALERT_RX_STATUS); - tcpm_pd_receive(tcpci->port, &msg, TCPC_TX_SOP); + switch (frame_type) { + case TCPC_RX_BUF_FRAME_TYPE_SOP1: + rx_type = TCPC_TX_SOP_PRIME; + break; + case TCPC_RX_BUF_FRAME_TYPE_SOP: + rx_type = TCPC_TX_SOP; + break; + default: + rx_type = TCPC_TX_SOP; + break; + } + tcpm_pd_receive(tcpci->port, &msg, rx_type); } if (tcpci->data->vbus_vsafe0v && (status & TCPC_ALERT_EXTENDED_STATUS)) { @@ -916,6 +976,21 @@ static int tcpci_probe(struct i2c_client *client) if (err < 0) return err; + chip->data.TX_BUF_BYTE_x_hidden = + device_property_read_bool(&client->dev, "TX_BUF_BYTE_x_hidden"); + chip->data.RX_BUF_BYTE_x_hidden = + device_property_read_bool(&client->dev, "RX_BUF_BYTE_x_hidden"); + chip->data.auto_discharge_disconnect = + device_property_read_bool(&client->dev, "auto_discharge_disconnect"); + chip->data.vbus_vsafe0v = device_property_read_bool(&client->dev, "vbus_vsafe0v"); + + err = tcpci_check_std_output_cap(chip->data.regmap, + TCPC_STD_OUTPUT_CAP_CONN_PRESENT); + if (err < 0) + return err; + + chip->data.conn_present_capable = err; + err = tcpci_check_std_output_cap(chip->data.regmap, TCPC_STD_OUTPUT_CAP_ORIENTATION); if (err < 0) diff --git a/include/linux/usb/tcpci.h b/include/linux/usb/tcpci.h index f7f5cfbdef12..0760187ea4b5 100644 --- a/include/linux/usb/tcpci.h +++ b/include/linux/usb/tcpci.h @@ -50,6 +50,7 @@ #define TCPC_CONFIG_STD_OUTPUT_ORIENTATION_MASK BIT(0) #define TCPC_CONFIG_STD_OUTPUT_ORIENTATION_NORMAL 0 #define TCPC_CONFIG_STD_OUTPUT_ORIENTATION_FLIPPED 1 +#define TCPC_CONFIG_STD_OUTPUT_CON_PRES BIT(1) #define TCPC_TCPC_CTRL 0x19 #define TCPC_TCPC_CTRL_ORIENTATION BIT(0) @@ -126,6 +127,7 @@ #define TCPC_STD_INPUT_CAP 0x28 #define TCPC_STD_OUTPUT_CAP 0x29 #define TCPC_STD_OUTPUT_CAP_ORIENTATION BIT(0) +#define TCPC_STD_OUTPUT_CAP_CONN_PRESENT BIT(1) #define TCPC_MSG_HDR_INFO 0x2e #define TCPC_MSG_HDR_INFO_DATA_ROLE BIT(3) @@ -167,6 +169,7 @@ /* I2C_WRITE_BYTE_COUNT + 1 when TX_BUF_BYTE_x is only accessible I2C_WRITE_BYTE_COUNT */ #define TCPC_TRANSMIT_BUFFER_MAX_LEN 31 +#define TCPC_RECEIVE_BUFFER_MAX_LEN 32 #define tcpc_presenting_rd(reg, cc) \ (!(TCPC_ROLE_CTRL_DRP & (reg)) && \ @@ -177,6 +180,9 @@ struct tcpci; /* * @TX_BUF_BYTE_x_hidden: * optional; Set when TX_BUF_BYTE_x can only be accessed through I2C_WRITE_BYTE_COUNT. + * @RX_BUF_BYTE_x_hidden: + * Optional; Set when READABLE_BYTE_COUNT, RX_BUF_FRAME_TYPE and RX_BUF_BYTE_x + * can only be accessed through READABLE_BYTE_COUNT. * @frs_sourcing_vbus: * Optional; Callback to perform chip specific operations when FRS * is sourcing vbus. @@ -204,6 +210,9 @@ struct tcpci; * swap following Discover Identity on SOP' occurs. * Return true when the TCPM is allowed to request a Vconn swap * after Discovery Identity on SOP. + * @conn_present_capable: + * Optional; Enable setting the connection present + * CONFIG_STANDARD_OUTPUT (0x18) bit1. * @set_orientation: * Optional; Enable setting the connector orientation * CONFIG_STANDARD_OUTPUT (0x18) bit0. @@ -211,9 +220,11 @@ struct tcpci; struct tcpci_data { struct regmap *regmap; unsigned char TX_BUF_BYTE_x_hidden:1; + unsigned char RX_BUF_BYTE_x_hidden:1; unsigned char auto_discharge_disconnect:1; unsigned char vbus_vsafe0v:1; unsigned char cable_comm_capable:1; + unsigned char conn_present_capable:1; unsigned char set_orientation:1; int (*init)(struct tcpci *tcpci, struct tcpci_data *data);