From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.127.231.35 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796358092; b=TAVw+QG3Tge5DAIEcV4MmgYl+K1JMwODnZbfi3kIB2rd7IQJSTVb015KTbBya8Rd/9lV GXQAXKHcaXP0xM20pgYZWzAZnu8fp/LyK1t57nDla2NYUZLO5r9sEd0aukvZ6nUAhAWjB HpSKbBzzb/jM+WG0hkxcoQMkS5uQMsQf43+ThSE/pZj2AtpSXGqQX0IzxjhFR4umjXaB9 fOfDOsBPrb0GcmjMUB0ZW7Uwg6bPEHV4vddWJFjrQSfR0+epWb8s/mlsJgsvStZjYDL7W OLU2+Pz2JUBIdUvJ3esDZK89bupBg1C/X6Y05EtLZj1I0iEvfgwZ/dP5D289vNhy35A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796358092; h=DMARC-Filter:DKIM-Signature:Subject:X-Original-From:To:From: Mime-Version:Content-Transfer-Encoding:References:Date:Message-Id: In-Reply-To:X-Lms-Return-Path:Received:Cc:X-Mailer:Content-Type; bh=STzVIPbFZJpPpahGPCLWO2yTqMojy1cqq8hOATvLyyY=; b=dhUtD23RrMI7FTnj7wJrVBXQ/SveP8UiSxQHT02kGv9pwpmAMAwJzbtPN/3lTxqmJx7/ GHB+btRFxjt7wuYnXbxxiijpND4/ILBP1Zk0lGeuPxsNOTuaFiRKZ0UZz6HQOcE5b1Iqu XEIlEA6GqsQ6oaykn3Jtzd2jsK1rNN19k+IIsUx/y5wQrvesxdawFMFrkQyi809h6nezk arafacP/ALUvFcW73uVVjQBRarfqAVDeLvH0U72DYCjM9tu05d4BD0vPBek/qQbzA4PE2 z+UbMPOKsAITMr/p74vwodszZNN7ew2hIo1xQOxmDMtEaiXVMza0shfT5/UmNL0ABmA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=deepcomputing.io; spf=pass smtp.mailfrom=deepcomputing.io; dkim=pass header.d=deepcomputing-io.20200927.dkim.feishu.cn header.i=@deepcomputing-io.20200927.dkim.feishu.cn header.a=rsa-sha256 header.s=s1 header.b=UB2sy97k; arc=none smtp.remote-ip=209.127.231.35 Received: from va-2-35.ptr.blmpb.com (va-2-35.ptr.blmpb.com [209.127.231.35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7545606A330 for ; Fri, 4 Dec 2026 04:21:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7545606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=deepcomputing.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=deepcomputing.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=deepcomputing-io.20200927.dkim.feishu.cn header.i=@deepcomputing-io.20200927.dkim.feishu.cn header.a=rsa-sha256 header.s=s1 header.b=UB2sy97k DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=deepcomputing-io.20200927.dkim.feishu.cn; t=1796358087; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=STzVIPbFZJpPpahGPCLWO2yTqMojy1cqq8hOATvLyyY=; b=UB2sy97kE34dDBKeDj0swItMT3VeCXOpdFTLlUyAyALxdVB62xyqg0MTgM5zihj3YAMkFl qCZZ0bf2XsDo72LhTetSf01oV72E/zNylrW5Nb+AZSoqiaGtVjnbK5NYskQ4d48m7eS98f clN0WdWYwjlQD/bBfv/LR/expQ9NJhr7zxo86OWXGARFxwTcC+hlmpaMM+WsmiQXzqx3N7 KPZegKhQlWZwjhatCABmeg9VTvPMxlLm59fv+uaKXfBbNkVq2/qe2erGqRf8rJbiKFTSdi TFXv7gz4zOBgl/SgClMrG/uAxr0hBJE8lEyr9GKDqGNWt9PCvzaZoBJDCfB0bw== Subject: [PATCH v2 03/13] platform/chrome: Allow transport-specific LPC response timeouts X-Original-From: Wang Yang To: From: "Wang Yang" X-Mailing-List: chrome-platform@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Transfer-Encoding: 7bit References: <20261204042112.2985112-1-yang.wang@deepcomputing.io> Date: Fri, 4 Dec 2026 12:21:01 +0800 Message-Id: <20261204042112.2985112-4-yang.wang@deepcomputing.io> In-Reply-To: <20261204042112.2985112-1-yang.wang@deepcomputing.io> X-Lms-Return-Path: Received: from ubuntu.. ([183.23.101.24]) by smtp.feishu.cn with ESMTPS; Fri, 04 Dec 2026 12:21:24 +0800 Cc: "Benson Leung" , "Tzung-Bi Shih" , "Guenter Roeck" , X-Mailer: git-send-email 2.43.0 Content-Type: text/plain; charset=UTF-8 Preserve the LPC default of one second and -EIO. Let a transport supply a deadline and timeout error without copying the polling loop. Prepared with OpenAI Codex assistance. Signed-off-by: Wang Yang --- drivers/platform/chrome/cros_ec_lpc_proto.c | 9 +++++---- drivers/platform/chrome/cros_ec_lpc_proto.h | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_lpc_proto.c b/drivers/platform/chrome/cros_ec_lpc_proto.c index 1dfc32a6ecd7..f0bd70e70a9c 100644 --- a/drivers/platform/chrome/cros_ec_lpc_proto.c +++ b/drivers/platform/chrome/cros_ec_lpc_proto.c @@ -13,7 +13,8 @@ static int ec_response_timed_out(struct cros_ec_device *ec, const struct cros_ec_lpc_io *io) { - unsigned long one_second = jiffies + HZ; + unsigned long timeout = jiffies + (io->response_timeout_ms ? + msecs_to_jiffies(io->response_timeout_ms) : HZ); u8 data; int ret; @@ -25,7 +26,7 @@ static int ec_response_timed_out(struct cros_ec_device *ec, if (!(data & EC_LPC_STATUS_BUSY_MASK)) return 0; usleep_range(100, 200); - } while (time_before(jiffies, one_second)); + } while (time_before(jiffies, timeout)); return 1; } @@ -59,7 +60,7 @@ int cros_ec_lpc_pkt_xfer(struct cros_ec_device *ec, goto done; if (ret) { dev_warn(ec->dev, "EC response timed out\n"); - ret = -EIO; + ret = io->timeout_error ?: -EIO; goto done; } @@ -158,7 +159,7 @@ int cros_ec_lpc_cmd_xfer(struct cros_ec_device *ec, goto done; if (ret) { dev_warn(ec->dev, "EC response timed out\n"); - ret = -EIO; + ret = io->timeout_error ?: -EIO; goto done; } diff --git a/drivers/platform/chrome/cros_ec_lpc_proto.h b/drivers/platform/chrome/cros_ec_lpc_proto.h index 7f884ffe823a..9276fb09807d 100644 --- a/drivers/platform/chrome/cros_ec_lpc_proto.h +++ b/drivers/platform/chrome/cros_ec_lpc_proto.h @@ -11,12 +11,16 @@ struct cros_ec_command; * struct cros_ec_lpc_io - byte access to an LPC-style EC interface * @read: Read bytes, returning their checksum or a negative error. * @write: Write bytes, returning their checksum or a negative error. + * @response_timeout_ms: Response timeout in milliseconds, or zero for one second. + * @timeout_error: Negative timeout error, or zero for the LPC default (-EIO). */ struct cros_ec_lpc_io { int (*read)(struct cros_ec_device *ec, unsigned int offset, unsigned int length, u8 *dest); int (*write)(struct cros_ec_device *ec, unsigned int offset, unsigned int length, const u8 *src); + unsigned int response_timeout_ms; + int timeout_error; }; int cros_ec_lpc_pkt_xfer(struct cros_ec_device *ec, -- 2.43.0