Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1179622lqt; Fri, 7 Jun 2024 10:06:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXYJr92vNi518dwcGBh64VGAlWdFVtkGQOffm92sCmtGfg495w65JQM0k3TRIf+oE7roqO+96yTK17MzLB/4eAmtRyI6GWGtdLyjq/i4A== X-Google-Smtp-Source: AGHT+IEQ+QPBQPDR6V6JFq6QRyGNqDHc2vIPTKqEariBKtujgImQD7CvqA9SKBGlM+8wJJoJivoy X-Received: by 2002:a05:6602:6b85:b0:7e1:8191:f59a with SMTP id ca18e2360f4ac-7eb571f2d5dmr357253839f.5.1717779981667; Fri, 07 Jun 2024 10:06:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717779981; cv=pass; d=google.com; s=arc-20160816; b=OGECMW7sdJUA87I5ApxCFHKQPfwoBPihke481vdqc6XapWcI5sRspJ+EpbF3x+XPqx /qERCkHap8Gv5rKrCYtojuNkaNK0Le3W7lZa5ZSTS/g1+NO5FvGt2cinQLibpDcAPveU WlKTXlk4mLEB+GfU5/YlSdzOESjkXCf80DHIEbiEPfYXuSn+An4amSEv8J9uEXb7s1X+ OsORaPgZL/p+aq3z6Ujx+q0hajkXJYI/CqzATkkeCmbnumUHddEyzikB8UZvBUtXaj1M s8DM7jjsgMZbxqMG2lRbkSekckBtHdivS10blZVb4Fxap6VBsYZTddGQyH8cld7ymbPN MKdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jbUvxHBzQ3FTw0LHwYR3I6ZzDjqDjsM/1Nz1IUatQIk=; fh=wDYfIDBm+3tTgJQ6g3pPYLU+P0UY777JX+m6bZ3cdlU=; b=DCINSpxtXm7wb7mjGwU2a66LPWgGBsZEz4TYJHQveOhjMSuwh+Z43lqJSpZLwHgeE1 VtIakHPsaPrbyLBXYE4qERg58KCUDkOJkgX1CFVwaWgAU33hgQJsVK91RlwVc4sRtm7z D18lf5mkHPS0NfdHsyH8CNfFl+rIWge6cG4D/VYdZScAZlpRS26LeNmoA1/fqWYRp1MZ UlNkFWnOKtSEIMQ3X0bvKYIeI2GYIPWwTARDpXzSLxezdUj0Ti67iPrr9hU/lkMcisgu tZBxCogn9gUKLrBYgL8aTssMnHeBQeeZmAUFR8z//KMUA6quNLWCH0rR3sJ+E360dU7a zP+A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cJL4nH9A; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-206524-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206524-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e32de38150si598736a12.486.2024.06.07.10.06.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 10:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206524-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=cJL4nH9A; arc=pass (i=1 spf=pass spfdomain=chromium.org dkim=pass dkdomain=chromium.org dmarc=pass fromdomain=chromium.org); spf=pass (google.com: domain of linux-kernel+bounces-206524-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206524-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 016C1B24D75 for ; Fri, 7 Jun 2024 17:04:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A96519A29C; Fri, 7 Jun 2024 17:03:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="cJL4nH9A" Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 D223819ADAD for ; Fri, 7 Jun 2024 17:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717779822; cv=none; b=Efv/buydiCbQlAcBnu+XUMoxygyV2DHHL7mbcKC7orU1a61TfsI4Z4KRsbLcI3wnJwH0sfqriodw9gptIUWXaV/YvQglzByySitM+ZcSO2Zt97VojNB1ztJFiWB8+fBBsh3DsSd0u+38dAo0mY27jx45O+nT+wg9yz+tfankZIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717779822; c=relaxed/simple; bh=qQ216A7Cu3X95KjC96oChuTYwL6nPl5HT7+Ubx2VE4Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jm0zRgJYQi4DPQeehPx9WKYXRDG3GeWf/0s+ajA8HD4EQ2m6KjTaOFkvRfxZgw59I1z460ZEqi7UNxDa+4DgXIv+zzfuhUM0BlJv0nXfqB+PH7vaCPjTTAjOSjfsWMsFzLyGmWirB6cUD+IVSM65b+h5vmdYmdu8UjQTUvNGzm8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=cJL4nH9A; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-70109d34a16so2193266b3a.2 for ; Fri, 07 Jun 2024 10:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1717779820; x=1718384620; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jbUvxHBzQ3FTw0LHwYR3I6ZzDjqDjsM/1Nz1IUatQIk=; b=cJL4nH9ATXJHbAGi2noEZp+RLFlSQqz0I19DWcS4DyhXo1dgkB+WuHrYi+bX6Yf1yJ F8rMQbHShMwHh7AQgjs9fdCWb7+mJCDt6OiAtSCaM7Dd8XkUMB+CTJ04ObBl3AU5Cep2 M/8wVYVrlVgWjx89KeoxvjHp4hW4r9YjxPoAY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717779820; x=1718384620; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jbUvxHBzQ3FTw0LHwYR3I6ZzDjqDjsM/1Nz1IUatQIk=; b=kQLAIPvu7+ZlZ2hjZIb4x6oZHguXttYIqKUJzjo1xHoQwZNZQ34i9Nc+RXC44nt676 UUxzOGG0nbPvs8pPXs11ra6ZpWEpeOW6tmO2ObjWeIrTsr+nx8Cg9gIbOKgRtoc4nUCj 0vdCLiGr01IC7Eua7ZXMx3YCXIar4wSyG+UHVYUIO1avHvkC8bg9afAtrNb4tdEtusei plVPhn0moWWNuxpPvmnrPLhBTobHhuj8C8VRhuv+hqFXOpES7E9UmTsW9LIzL95yAPtj OPSTy9YFCW8qFuZDODrE9aQaoxdl2wt8KCgU1RgsmZjsnRjRL0fBVYYiCDnJBfukRueY hpbg== X-Forwarded-Encrypted: i=1; AJvYcCV7XQrzkXUf87zgNdOG+DhmPUdD9IRR74DQe9rqz5fkAbWKxEAPlQ8NrURb4Pdk5NqhDpiri5YvVnMEC3sy9u+CU5WFLnsCtvzMrv36 X-Gm-Message-State: AOJu0YwahXnN8cr24paL+8Xgj+DadVSd2PuD2qRlmkM6YD5Sq6m0MYmR ELBOlglWktTGoHYmmtSJfeIQAlkKNIR8a5kFoEM5ODUM90JYafURLcQximu2dg== X-Received: by 2002:a05:6a20:d043:b0:1b4:4568:4c40 with SMTP id adf61e73a8af0-1b445684d58mr1419765637.12.1717779819908; Fri, 07 Jun 2024 10:03:39 -0700 (PDT) Received: from pc98uv11.mtv.corp.google.com ([2620:15c:9d:2:98ef:4953:160:1c67]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-6e439d12cf5sm970705a12.67.2024.06.07.10.03.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 10:03:39 -0700 (PDT) From: Daisuke Nojiri To: Cc: Benson Leung , Tzung-Bi Shih , Guenter Roeck , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Reka Norman , Hans Verkuil , Pavan Holla , Gwendal Grignou , Lukasz Majczak , Daisuke Nojiri , Ching-Kang Yen , Stephen Boyd , Prashant Malani , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 2/3] platform/chrome: cros_ec_proto: Upgrade get_next_event to v3 Date: Fri, 7 Jun 2024 10:02:57 -0700 Message-ID: X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Upgrade EC_CMD_GET_NEXT_EVENT to version 3. The max supported version will be v3. So, we speak v3 even if the EC says it supports v4+. Signed-off-by: Daisuke Nojiri --- drivers/platform/chrome/cros_ec_proto.c | 27 ++++++++++++++------- include/linux/platform_data/cros_ec_proto.h | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c index 945b1b15a04c..df257ab12968 100644 --- a/drivers/platform/chrome/cros_ec_proto.c +++ b/drivers/platform/chrome/cros_ec_proto.c @@ -686,7 +686,7 @@ EXPORT_SYMBOL(cros_ec_cmd_xfer_status); static int get_next_event_xfer(struct cros_ec_device *ec_dev, struct cros_ec_command *msg, - struct ec_response_get_next_event_v1 *event, + struct ec_response_get_next_event_v3 *event, int version, uint32_t size) { int ret; @@ -709,11 +709,12 @@ static int get_next_event(struct cros_ec_device *ec_dev) { struct { struct cros_ec_command msg; - struct ec_response_get_next_event_v1 event; + struct ec_response_get_next_event_v3 event; } __packed buf; struct cros_ec_command *msg = &buf.msg; - struct ec_response_get_next_event_v1 *event = &buf.event; - const int cmd_version = ec_dev->mkbp_event_supported - 1; + struct ec_response_get_next_event_v3 *event = &buf.event; + int cmd_version = ec_dev->mkbp_event_supported - 1; + uint32_t size; memset(msg, 0, sizeof(*msg)); if (ec_dev->suspended) { @@ -721,12 +722,20 @@ static int get_next_event(struct cros_ec_device *ec_dev) return -EHOSTDOWN; } - if (cmd_version == 0) - return get_next_event_xfer(ec_dev, msg, event, 0, - sizeof(struct ec_response_get_next_event)); + if (cmd_version == 0) { + size = sizeof(struct ec_response_get_next_event); + } else if (cmd_version < 3) { + size = sizeof(struct ec_response_get_next_event_v1); + } else { + /* + * The max version we support is v3. So, we speak v3 even if the + * EC says it supports v4+. + */ + cmd_version = 3; + size = sizeof(struct ec_response_get_next_event_v3); + } - return get_next_event_xfer(ec_dev, msg, event, cmd_version, - sizeof(struct ec_response_get_next_event_v1)); + return get_next_event_xfer(ec_dev, msg, event, cmd_version, size); } static int get_keyboard_state_event(struct cros_ec_device *ec_dev) diff --git a/include/linux/platform_data/cros_ec_proto.h b/include/linux/platform_data/cros_ec_proto.h index 8865e350c12a..dbfd38b3becd 100644 --- a/include/linux/platform_data/cros_ec_proto.h +++ b/include/linux/platform_data/cros_ec_proto.h @@ -185,7 +185,7 @@ struct cros_ec_device { bool host_sleep_v1; struct blocking_notifier_head event_notifier; - struct ec_response_get_next_event_v1 event_data; + struct ec_response_get_next_event_v3 event_data; int event_size; u32 host_event_wake_mask; u32 last_resume_result; -- 2.45.2.505.gda0bf45e8d-goog