Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp324924imm; Fri, 1 Jun 2018 01:20:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJPL+mjXSJ4pLx7ZsUoK3ftijatl/0ED6cvg38k9EMUads5RB2GjZqT+QrpAm7zbKGiZwxY X-Received: by 2002:a17:902:aa98:: with SMTP id d24-v6mr10174001plr.185.1527841258177; Fri, 01 Jun 2018 01:20:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527841258; cv=none; d=google.com; s=arc-20160816; b=LhklhxGDMMLd/GbryRWzCIBPfLyQs80vRdJgtAT3l5C+5RtaXAws0IgQV/91GsKVt8 JiSlw7dwj0ARzW3w8+RTpU1Tj4SA9LUo9SNG4zdwakFf9kAi5dJQNFDIy/8YEk8RP0kG Fdl2QbhqFAWQKhXorB2S33U/gdVMMCXMdlQLd/9Ultro7YgYwFw9E8fVBPxsnMsf2kk/ cibBnGiQYvq3mvHhqGhD7GqxbvZetzIOTjOIp/aJXGoAdcT6Yhl2og8ORMFbrNDY/47H RfVaFVV5IWdHJYlb/M2kY8JIC2FSiyNW1p/T81puaghhhCct+NOcMwUPwulqydSxS5fa O1uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=70ItSO1GTZNf+9IYcNbtgzKl9waou6eUE57aIj6Cmt0=; b=W4op0ldxywBAcVrcI0CH2sjcQWAhGOGtFyu+hfQX9ieWxvyIZn9NbN6LVWyPnh3Cus 1eX3B0IFqFsgF1dmUMcWM/kTyfhct/x1SoAadM0Ljwu7moTbA/tMC/cp2BPnZtQs2jbx BgP4egTZE78djIatNpiS2M6u6SbELooiWb/eXmKWE4sQxz18i7e8N78WGUSFNsdBP/UX oCfFQ6TyOG2T0sJwEqyjsfMf+HhOCv/i7Hh2mRdGl5r2Kxdh0W2EVZMmXDNKlXQPJwBb i+dVDu9Wdm+5fRyKbWH2vNg5g/Ybr5rceWE6MRtK91dYW1ZPji+2QSDoE0iw13v6tDWs 9V1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=O4gmU9YH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6-v6si2839098pgv.328.2018.06.01.01.20.42; Fri, 01 Jun 2018 01:20:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=O4gmU9YH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751482AbeFAITj (ORCPT + 99 others); Fri, 1 Jun 2018 04:19:39 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:46341 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751431AbeFAIT2 (ORCPT ); Fri, 1 Jun 2018 04:19:28 -0400 Received: by mail-wr0-f193.google.com with SMTP id v13-v6so23754405wrp.13 for ; Fri, 01 Jun 2018 01:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=70ItSO1GTZNf+9IYcNbtgzKl9waou6eUE57aIj6Cmt0=; b=O4gmU9YHwdtyTeEGtNGjfe3StWAEcfTs22XKEbPR79cXUZ1t5IV2FNRCB1pfZR6T2J rzUWezqauJ2ZhfeYfRhvS6Qx8lxVVJGQUaGDbl1/LyldTngIW24TVIWcb+KzAoTp4NJu kuH0EVAsCAZtHXFiAW/IJkRAcD7sJDYS1hnv0E9a9GeJGpkAe6I1WpA3EnCauuvqYnfx u3wpgMtfvHNqlFxdoZZY5csA3mqptLfG5pC6lIxaPXSpHdQ3vkf7n9CKSGnX+/CiYOtU SBj0gujEJd34x61Leaqn+jSjXBMf6Vv57mULGo/8DgI59WnaMHtavnKi3sBO6JpdppY4 UJQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=70ItSO1GTZNf+9IYcNbtgzKl9waou6eUE57aIj6Cmt0=; b=dxKWJY7Rrz7wEkkXU+FZ1YUWIX8qxIbh0+r0SYUh7sxKX6OJIRNXaxFSpCgL9yOW1R +7pxyNLz6+hGo7jUHtzI8s/gcXoVr8xwtvL+ueV/dDVAH9ZKdQivCSyaS2Bv4SJOMTc2 IcViSsXxdgSFi1n9nNPIW2qfjBbNwUVpHLT8D4Sxu9ERFAmRJ0AtfmnIGGJuH0LpL7Ob 3UoLjBlcXpZJg39LM6fv7LSIWBF6d7DzFo6y3OULVXz7SeBhgrYyYfxdQRQnWFom0IeE R6+k7ccFc1xCD4P5m3h6MhRE+PTq98wz9cReOPEFlaE1IFgDD6llAsovBVhp1kKNlTt7 sapA== X-Gm-Message-State: ALKqPwckavRniH9d1V5p2WFY/RJ58knJWvNrIsWfzzfNitwqMG4wgkhI xVTtoCj7Lo5JcR5t6wdnteiK4A== X-Received: by 2002:adf:b097:: with SMTP id i23-v6mr7582245wra.52.1527841167526; Fri, 01 Jun 2018 01:19:27 -0700 (PDT) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id h7-v6sm555949wmc.44.2018.06.01.01.19.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 01 Jun 2018 01:19:26 -0700 (PDT) From: Neil Armstrong To: airlied@linux.ie, hans.verkuil@cisco.com, lee.jones@linaro.org, olof@lixom.net, seanpaul@google.com Cc: Neil Armstrong , sadolfsson@google.com, felixe@google.com, bleung@google.com, darekm@google.com, marcheu@chromium.org, fparent@baylibre.com, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, eballetbo@gmail.com Subject: [PATCH v7 4/6] mfd: cros-ec: Introduce CEC commands and events definitions. Date: Fri, 1 Jun 2018 10:19:12 +0200 Message-Id: <1527841154-24832-5-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527841154-24832-1-git-send-email-narmstrong@baylibre.com> References: <1527841154-24832-1-git-send-email-narmstrong@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The EC can expose a CEC bus, this patch adds the CEC related definitions needed by the cros-ec-cec driver. Signed-off-by: Neil Armstrong Tested-by: Enric Balletbo i Serra Reviewed-by: Hans Verkuil --- include/linux/mfd/cros_ec_commands.h | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index cc0768e..fe33a81 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -804,6 +804,8 @@ enum ec_feature_code { EC_FEATURE_MOTION_SENSE_FIFO = 24, /* EC has RTC feature that can be controlled by host commands */ EC_FEATURE_RTC = 27, + /* EC supports CEC commands */ + EC_FEATURE_CEC = 35, }; #define EC_FEATURE_MASK_0(event_code) (1UL << (event_code % 32)) @@ -2078,6 +2080,12 @@ enum ec_mkbp_event { /* EC sent a sysrq command */ EC_MKBP_EVENT_SYSRQ = 6, + /* Notify the AP that something happened on CEC */ + EC_MKBP_EVENT_CEC_EVENT = 8, + + /* Send an incoming CEC message to the AP */ + EC_MKBP_EVENT_CEC_MESSAGE = 9, + /* Number of MKBP events */ EC_MKBP_EVENT_COUNT, }; @@ -2850,6 +2858,79 @@ struct ec_params_reboot_ec { /*****************************************************************************/ /* + * HDMI CEC commands + * + * These commands are for sending and receiving message via HDMI CEC + */ +#define EC_MAX_CEC_MSG_LEN 16 + +/* CEC message from the AP to be written on the CEC bus */ +#define EC_CMD_CEC_WRITE_MSG 0x00B8 + +/** + * struct ec_params_cec_write - Message to write to the CEC bus + * @msg: message content to write to the CEC bus + */ +struct ec_params_cec_write { + uint8_t msg[EC_MAX_CEC_MSG_LEN]; +} __packed; + +/* Set various CEC parameters */ +#define EC_CMD_CEC_SET 0x00BA + +/** + * struct ec_params_cec_set - CEC parameters set + * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS + * @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 val; +} __packed; + +/* Read various CEC parameters */ +#define EC_CMD_CEC_GET 0x00BB + +/** + * struct ec_params_cec_get - CEC parameters get + * @cmd: parameter type, can be CEC_CMD_ENABLE or CEC_CMD_LOGICAL_ADDRESS + */ +struct ec_params_cec_get { + uint8_t cmd; /* enum cec_command */ +} __packed; + +/** + * struct ec_response_cec_get - CEC parameters get response + * @val: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is + * disabled or 1 if CEC functionality is enabled, + * in case cmd was CEC_CMD_LOGICAL_ADDRESS, this will encode the + * configured logical address between 0 and 15 or 0xff if unregistered + */ +struct ec_response_cec_get { + uint8_t val; +} __packed; + +/* CEC parameters command */ +enum ec_cec_command { + /* CEC reading, writing and events enable */ + CEC_CMD_ENABLE, + /* CEC logical address */ + CEC_CMD_LOGICAL_ADDRESS, +}; + +/* Events from CEC to AP */ +enum mkbp_cec_event { + /* Outgoing message was acknowledged by a follower */ + EC_MKBP_CEC_SEND_OK = BIT(0), + /* Outgoing message was not acknowledged */ + EC_MKBP_CEC_SEND_FAILED = BIT(1), +}; + +/*****************************************************************************/ +/* * Special commands * * These do not follow the normal rules for commands. See each command for -- 2.7.4