Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1863504imm; Thu, 24 May 2018 01:56:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZozSP/oKIQroRe9Br37VrdbKYYDtjt/V3kAr/e4BMVBF/IgKO2jUT/wFnIJo/7IBrDMnx2p X-Received: by 2002:a65:52cc:: with SMTP id z12-v6mr5071678pgp.126.1527152189705; Thu, 24 May 2018 01:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527152189; cv=none; d=google.com; s=arc-20160816; b=pHPZS+kNG4gvl5vSf59Tzzt3NHTDxG+iG9KPCrnWyVj/nLObDdHtVDIRqZ4M8tiZ/j yOmQ8WyHKIUuX9+WODnwfJAJJTUV9xNG3CZe8pKpdC0Zx+rsWIzk+VIgrwRhfkuSvgmb 0I2yjQM/X2okMKY43jdgWxI2UMhtgIRcBn32SmMj4f1GrEGLioF1ivBZyQsvsqzF0/jX gjPzm+adO9TYBFDf5d51OKH9RLaEH0aU3GznmSr+f3YK55DUvtbfF7VWFhqqAXuU95c7 bwS6uqG1l5FROMztezlkyx/T43d176ndKS2TimEnJGIFa6hEgZmwlaxM/nKdYUMXKRH0 xgNQ== 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=/w3fv+f3iYOgAdrajBNrOQ+w9op1G5TDPt8bxbfzrEo=; b=QwyTDuZY9OO5T4AgWMmG8YAtdMFoebxYDy4vqA8uLN/QK9wBR+O0dh5CX5CSumXt9y o8Tuwld6u4CEFsad9BQIafrA6kk2U4VJkSGcnpF7lNozbOVPmuCJxIKpKJBo7BLHV/Df zfv7/fSWy71t3mmFOBGz1VoBvFHoMUwxeQWfQEEFOUf9PUxbe+yP+thwRiUZVun4NfyY bYiOKK5OjTlWhl+bndlxOnGGWQpYI5iyGTMvMkP9yFduBwBJ32xh0oeWr2zBGWGSW53g 6aygNK+oAT7s3yXBwjI4XOpQ9j3QVjMCNivj5rErsaF71tTR4DMrlTI1t7Kr4cU8XpMf S1rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=YdJLeFNj; 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 u62-v6si15812539pgc.180.2018.05.24.01.56.15; Thu, 24 May 2018 01:56:29 -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=YdJLeFNj; 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 S965633AbeEXIzY (ORCPT + 99 others); Thu, 24 May 2018 04:55:24 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:44763 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965604AbeEXIzN (ORCPT ); Thu, 24 May 2018 04:55:13 -0400 Received: by mail-wr0-f194.google.com with SMTP id y15-v6so1594501wrg.11 for ; Thu, 24 May 2018 01:55:13 -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=/w3fv+f3iYOgAdrajBNrOQ+w9op1G5TDPt8bxbfzrEo=; b=YdJLeFNjrga4G/KMtyOusBEJ2PWvHcqHAd1hlt3L8OkzAYMqH4sIARswFPAltWeJtp 97IjI1CYSYGTjIBLv3TJrIBhEC1j8hMcPiVjalha0ZSIfeHD0H0xMkAbE8LiilsC7Y8h o0HLt+Lrg2fI66oC8oGk1QocrZkyz0PeEpKFBagyIRcSU4Jfs2oxsi264WQyvT5NSZiN 1S8l464RhMQfBMTpTdDxGB2E9O/QRTQ0F4G5jFt20Ff0Joz2QQ7XIwy53dDC440h2bct o3NZx+7CQWY120Dkptsi2OHZAxf/vs4Wlwufnq6y8RU9SkfS50KFAn0VrbHa40SZYllN 0DGg== 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=/w3fv+f3iYOgAdrajBNrOQ+w9op1G5TDPt8bxbfzrEo=; b=CpYet3Jkp9yIbzwZKtuaNMC2JkHDThd5h5+NNWoaUw0ZLt4VQxSi7speau5YUwU0SL BN4Hee2h6B2G+VAg9m+F1/UewSKfVIKV09etzHWzRjlKXlCuhUf+NynbK64dQ2eFmexW 0ZCLm/zmGbTwXsGwK3gYZdc6Qe9kNc1+qLqBPKyLt5cxtDHI5Xb9bUTSlqh8wUtAghHB Pgl2GSFMhSwJ/Fb78mGJ4ld1QcGdZJTE7A+yb0hoZ2FRsu/uxlwfkhPTtDMXGzIuHwQf GQewVnGpj2vty+8ozlBgJ71YKpPTdFwjTbXmEvv5uFgAFNnWYXlIXaz9+RtraFy+YzZo fuTA== X-Gm-Message-State: ALKqPwdXa+pLNURDg9fHBofA1SjTLCYj+XKF6X9SLNhGdAlOChGzJCuZ watsB4zeAEBMdhiipd37pfHEqQ== X-Received: by 2002:adf:ae59:: with SMTP id u25-v6mr5358113wrd.157.1527152112216; Thu, 24 May 2018 01:55:12 -0700 (PDT) Received: from bender.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id z192-v6sm3348462wmc.10.2018.05.24.01.55.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 24 May 2018 01:55:11 -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 v5 4/6] mfd: cros-ec: Introduce CEC commands and events definitions. Date: Thu, 24 May 2018 10:54:59 +0200 Message-Id: <1527152101-17278-5-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527152101-17278-1-git-send-email-narmstrong@baylibre.com> References: <1527152101-17278-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 --- include/linux/mfd/cros_ec_commands.h | 85 ++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index cc0768e..ea9646f 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_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,83 @@ struct ec_params_reboot_ec { /*****************************************************************************/ /* + * HDMI CEC commands + * + * These commands are for sending and receiving message via HDMI CEC + */ +#define 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[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 + * @enable: in case cmd is CEC_CMD_ENABLE, this field can be 0 to disable CEC + * or 1 to enable CEC functionnality + * @address: 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 */ + union { + uint8_t enable; + uint8_t address; + }; +} __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 + * @enable: in case cmd was CEC_CMD_ENABLE, this field will 0 if CEC is + * disabled or 1 if CEC functionnality is enabled + * @address: 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 { + union { + uint8_t enable; + uint8_t address; + }; +} __packed; + +/* CEC parameters command */ +enum 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 { + EC_MKBP_CEC_SEND_OK = BIT(0), + 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