From patchwork Mon Aug 14 04:29:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Reka Norman X-Patchwork-Id: 135123 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp2528677vqi; Sun, 13 Aug 2023 22:13:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHGZLxtxYlURM6T4jXeanLIv/6ITlk06cczNWm/kV/sL+0+xsfb1aVYyP9WArNwrQ/WUwKE X-Received: by 2002:a17:902:d352:b0:1b0:f8:9b2d with SMTP id l18-20020a170902d35200b001b000f89b2dmr9229587plk.29.1691990000266; Sun, 13 Aug 2023 22:13:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691990000; cv=none; d=google.com; s=arc-20160816; b=NIeu1cLCa+VTrRWjzBvjFJn1MNDvEhwmrjUrl5Ttut9dBH7wFk/Ff11Am7FjNMVlww TCglVoBUsz2yymwbwTiszGYRK7Bs9dByELG0miTJLaY5pnW28n7PYp4K1fBm1wX9v0ON D/QHJv5CPKZJlwearmDAVSNdkarudBB4YmHqrtghvyTMbLFYfQnX0qcquswl+bh+TM95 dmmuSZJecv/dLgel7CrPA4MVt/oLTKtBBCsQQ2tu3oksKs8oih+HhsAatYA918ebaIpu fPBRgQIArrJPwK3jj+VLZYWCyTEY0rNAcJtQy2Z8nHv7H4yh1hlE+C0uY6+wvNpV1tMH 70gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=itIjiisrKDd0dEJkr9u7QlSUsM4Bsnb9Jzz0yBh6Gm4=; fh=Z54ABTjWKY0UM+xzbKZvDcqrpuAhT1VnH73TfCDbJK4=; b=tlmQZkPfdG2iC5VgVEs0jgPZ0yqAKejIbEJ8xuh9l0zWVYFTXBHn0pp1y6NcknCOE8 TQYSI+jCz7n3ekB2hFC/OY9riZDN5guTCKKUmbpcGA6UZ1/KnjxaC1qlccJEJ5DZQ95m JUQxMBNP7DlCdgD6mDAHoFq1EeVB5UyvQyE4wGsYMhT+icyYLwWLaCs5rOkmVwLC50s0 tGEe4M8H30Ccd7WRfoMgI0wrIW/R8D8bMcQAfbh51hcp/N6zWS78fpi50gC1+PgPkEHe RQmUSpVvhZa/Ywc7l4HxKCqI9YcK27lkrqGRa+M6cEMGU+bLHqZSITXIDVgTnN0+PBlo N6Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Xck3Z5On; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a170902db0300b001b9f091a08dsi7838908plx.635.2023.08.13.22.13.06; Sun, 13 Aug 2023 22:13:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Xck3Z5On; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233104AbjHNEgM (ORCPT + 99 others); Mon, 14 Aug 2023 00:36:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233151AbjHNEfz (ORCPT ); Mon, 14 Aug 2023 00:35:55 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4222EE7E for ; Sun, 13 Aug 2023 21:35:52 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1bda9207132so29859035ad.0 for ; Sun, 13 Aug 2023 21:35:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691987752; x=1692592552; 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=itIjiisrKDd0dEJkr9u7QlSUsM4Bsnb9Jzz0yBh6Gm4=; b=Xck3Z5OnJrMbtyD9wFRDW/GmpGf9wAmSvtvm5NQ2xVthLhnRYzQuocKe4GukWXcu0b MMoucWrJSb2GhXbqcMLVLtlIBkbvLwycQ16Li2XkSn8YTMF/ecRkjn9rMN/fl4Rj6YqQ xi4GlIxY+9jFma3qoicyW/h7wEzrASoM/IFxc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691987752; x=1692592552; 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=itIjiisrKDd0dEJkr9u7QlSUsM4Bsnb9Jzz0yBh6Gm4=; b=K1CsG94T616TlputHHsCtBM9JgguTLXk4X+Afmj6Y0H4FlFTtWyTJGxcbwzcIO+6MO /F1ugJ/rq6LDYdSbRvhQmZyScTLNvt7TUqMpzGZsIhgNhFt0N0eteGvo27E3DyXZQqJ/ LauTQuT1cU7V5UYN3vSa3YD/FsnonbzdL5j3j6hSsWln9v9dFWTNsEWPdlvxD8M1B5qa AgD9xc8cclG99g9lX6Mp2KGx5bTSgxI+ozcwP62mWdWfSikCZ3/NW1v+8CiDQppGUCue rF39gbPG1xwpFl9Jg3yGup6CssKhCH7V5DtTvG/ITb2WZTqRUl8TbWGbHo5yucYCd3Io H0OA== X-Gm-Message-State: AOJu0YzxX5zAV31idTtO+dMo0rRj9UGEZvvN2pplvPDmAyWyye2YRqQX sqBXZXF9aAVYoO2D2b75fhBJzw== X-Received: by 2002:a17:902:da85:b0:1bc:5b36:a2e8 with SMTP id j5-20020a170902da8500b001bc5b36a2e8mr11568693plx.34.1691987751762; Sun, 13 Aug 2023 21:35:51 -0700 (PDT) Received: from rekanorman3.syd.corp.google.com ([2401:fa00:9:14:4ae6:d1a4:27c2:80ff]) by smtp.gmail.com with ESMTPSA id ju17-20020a170903429100b001bdb0483e65sm6761865plb.265.2023.08.13.21.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Aug 2023 21:35:51 -0700 (PDT) From: Reka Norman To: Hans Verkuil Cc: Neil Armstrong , Daisuke Nojiri , Stefan Adolfsson , Reka Norman , Benson Leung , Guenter Roeck , Mauro Carvalho Chehab , chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 3/9] media: cros-ec-cec: Support multiple ports in set/get host commands Date: Mon, 14 Aug 2023 14:29:12 +1000 Message-ID: <20230814043140.1108917-4-rekanorman@chromium.org> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog In-Reply-To: <20230814043140.1108917-1-rekanorman@chromium.org> References: <20230814043140.1108917-1-rekanorman@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1774180106713857983 X-GMAIL-MSGID: 1774180106713857983 Reuse the top four bits of the cmd field to specify the port number. The reason for doing this as opposed to adding a separate uint8_t field is it avoids the need to add new versions of these commands. The change is backwards compatible since these bits were previously always zero, so the default behaviour is to always operate on port 0. Signed-off-by: Reka Norman --- drivers/media/cec/platform/cros-ec/cros-ec-cec.c | 2 ++ include/linux/platform_data/cros_ec_commands.h | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c index d76a25ae0cf1..e969031e1e0e 100644 --- a/drivers/media/cec/platform/cros-ec/cros-ec-cec.c +++ b/drivers/media/cec/platform/cros-ec/cros-ec-cec.c @@ -118,6 +118,7 @@ static int cros_ec_cec_set_log_addr(struct cec_adapter *adap, u8 logical_addr) struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; struct ec_params_cec_set params = { .cmd = CEC_CMD_LOGICAL_ADDRESS, + .port = port->port_num, .val = logical_addr, }; int ret; @@ -162,6 +163,7 @@ static int cros_ec_cec_adap_enable(struct cec_adapter *adap, bool enable) struct cros_ec_device *cros_ec = cros_ec_cec->cros_ec; struct ec_params_cec_set params = { .cmd = CEC_CMD_ENABLE, + .port = port->port_num, .val = enable, }; int ret; diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h index cb2ddd10a613..e8bb05db360f 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -4457,13 +4457,15 @@ struct ec_params_cec_write { /** * struct ec_params_cec_set - CEC parameters set * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS + * @port: CEC port to set the parameter on * @val: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC * or 1 to enable CEC functionality, in case cmd is * CEC_CMD_LOGICAL_ADDRESS, this field encodes the requested logical * address between 0 and 15 or 0xff to unregister */ struct ec_params_cec_set { - uint8_t cmd; /* enum cec_command */ + uint8_t cmd : 4; /* enum cec_command */ + uint8_t port : 4; uint8_t val; } __ec_align1; @@ -4473,9 +4475,11 @@ struct ec_params_cec_set { /** * struct ec_params_cec_get - CEC parameters get * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS + * @port: CEC port to get the parameter on */ struct ec_params_cec_get { - uint8_t cmd; /* enum cec_command */ + uint8_t cmd : 4; /* enum cec_command */ + uint8_t port : 4; } __ec_align1; /**