Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3664717imm; Mon, 18 Jun 2018 01:51:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKqpx/EJ9nAe5Og+qcuCSxvU0ENfZHuZxtY1pU+yB1KuKX0qlj3TNSBbDymaIxbzbPDNocK X-Received: by 2002:a62:c45a:: with SMTP id y87-v6mr12658826pff.190.1529311887099; Mon, 18 Jun 2018 01:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529311887; cv=none; d=google.com; s=arc-20160816; b=jDYmwj+jiO2RPh6uz/4eY1T0CmMDzLCsc5BzYSMRUyRShmV4TADPdDcFK++NSxNlfN uFBv1Wmwz8hEo1LADg7X6z1qhLTyshXMTOBmOwCB9fOKi0WthNA/0Nn1VN3K2+I4iMsl V6ADnhd8nq4xfwg49Y0caAFMQamyRgG6/fXjgXNKMK5atIjzc9aIAbVWtya/FmmOQMab nikdFMqdCJoyCB+lkP6SXLAUGeFPDJsxasv+/sUnLDNCs6OFuPU1N6J47cnQx912GstF STxVc1p+QIgKaiN+U0V/7fmdet2RL6QiGkkNh4RjMXC3oD3YGL7+2OwXnzX0LoUX/h7i Jjvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=wCv8iAm1FHuuOJrG8CucWMia0Z2aifu0jVywYDRkh7c=; b=NPEX7PqgP6O15HIMpQvA2vqbt16ghkHcf77P4nmDvPqC+WGapVdhdGiwEk9f7vtiYt UM5GrdwUohucOSSBEhOKw6YM0e9+3dbxljf9PV/VBSddlparWPQAPJcTDOvqX9gmKhh/ wzw2Yr+2N/ixKsXVGXKNVK2iyVu86aqb1MDfA+DLQWCx4EpwnDwmiP4gUx11rSlKSF+P XsgB66EsqkqyXI4WMyCs36BZ5e8lXpva2B8jz5Gql/ch/5eMNGtlxEcYIH/RY3gtIJ8p Drt16LrSkGXnOXqB9HDb4MsyKkM3p3vyNOLIex5KNRnlyQYpk0Notgzs3gHCuKFjLIIC WD2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ePAqByO8; 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 k12-v6si11820198pgp.561.2018.06.18.01.51.03; Mon, 18 Jun 2018 01:51:27 -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=ePAqByO8; 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 S968070AbeFRIu2 (ORCPT + 99 others); Mon, 18 Jun 2018 04:50:28 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33008 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968004AbeFRIf7 (ORCPT ); Mon, 18 Jun 2018 04:35:59 -0400 Received: by mail-wr0-f195.google.com with SMTP id k16-v6so15851698wro.0 for ; Mon, 18 Jun 2018 01:35:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:openpgp:autocrypt:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wCv8iAm1FHuuOJrG8CucWMia0Z2aifu0jVywYDRkh7c=; b=ePAqByO8AUmPoz86j8ZQT/kQFd69ERz/F3rJKesC32VClqSmYAfQen7UOH4gRv74K2 Dc7ne4St/DPQFJSfF85fuTpqq+SfhQj5Di2+GeWnWJs8p6FD1pJ9B9H1I/Q5vwitmCT3 PNxEf5z83uhRKHAUyRAtHViPQ/5ggUOnyqfybmV7LBuU9dDgLa9hQWfxOhRVD30sDWyn p+dGMTlk+siFOo/yvPsjiDU5pPWc/UNjiQv8PCb/UD2AkfCluoSy93uA2un8OblUUy5Q mBTDmC2KbpBxN2x6v6ovczz10+yjc9JZMGSfEhA9VVtophZ0GaHeSmT8jZTNIXiU0WRU 2ayA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=wCv8iAm1FHuuOJrG8CucWMia0Z2aifu0jVywYDRkh7c=; b=PxKI4WKNo4TpgGi3H6x495+Tkd/6Azx1HEXeAbEkmeJgvIbpSHxk74HJca818Ctdu8 zuoUzpSXnd43rE8WgAoDmTT7Lp+CVvY61w+6EI7IqMYlCLD57OFsVnoV4ScmU1JWbdWo uJkSb8y5j6/+27jEMMt79YrPS/zEEIyugXR73E6uFpS6COOW5wgTzhzpkZQzSdwJJpbT 7nY/OqvNbHpC+oO5fRjkm2PhtLmEhpyBPJy0rob1RyX/8WQkE1ed1CUbbTmNFqADrehu U6fWazjLg30Vd+NaHsjWoic86xiH1Rn4gkMdHLg6NmF5z/33aj1Vcxc0hKvu0/4bk8gj haHg== X-Gm-Message-State: APt69E33joM6x/ZDYDu3yY7zehfXdTjsA5vQzOjCR9j8U/wkLMCl2a96 RT2i/JvJ+DFFIdx/S/gD+8namg== X-Received: by 2002:adf:9d02:: with SMTP id k2-v6mr9234285wre.213.1529310958170; Mon, 18 Jun 2018 01:35:58 -0700 (PDT) Received: from [10.1.2.12] ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id q17-v6sm15429701wrr.7.2018.06.18.01.35.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jun 2018 01:35:57 -0700 (PDT) Subject: Re: [PATCH v7 3/6] mfd: cros-ec: Increase maximum mkbp event size To: Lee Jones Cc: airlied@linux.ie, hans.verkuil@cisco.com, olof@lixom.net, seanpaul@google.com, 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, Stefan Adolfsson References: <1527841154-24832-1-git-send-email-narmstrong@baylibre.com> <1527841154-24832-4-git-send-email-narmstrong@baylibre.com> <20180618074443.GK31141@dell> From: Neil Armstrong Openpgp: preference=signencrypt Autocrypt: addr=narmstrong@baylibre.com; prefer-encrypt=mutual; keydata= xsBNBE1ZBs8BCAD78xVLsXPwV/2qQx2FaO/7mhWL0Qodw8UcQJnkrWmgTFRobtTWxuRx8WWP GTjuhvbleoQ5Cxjr+v+1ARGCH46MxFP5DwauzPekwJUD5QKZlaw/bURTLmS2id5wWi3lqVH4 BVF2WzvGyyeV1o4RTCYDnZ9VLLylJ9bneEaIs/7cjCEbipGGFlfIML3sfqnIvMAxIMZrvcl9 qPV2k+KQ7q+aXavU5W+yLNn7QtXUB530Zlk/d2ETgzQ5FLYYnUDAaRl+8JUTjc0CNOTpCeik 80TZcE6f8M76Xa6yU8VcNko94Ck7iB4vj70q76P/J7kt98hklrr85/3NU3oti3nrIHmHABEB AAHNKE5laWwgQXJtc3Ryb25nIDxuYXJtc3Ryb25nQGJheWxpYnJlLmNvbT7CwHsEEwEKACUC GyMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheABQJXDO2CAhkBAAoJEBaat7Gkz/iubGIH/iyk RqvgB62oKOFlgOTYCMkYp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p6h8g Organization: Baylibre Message-ID: <017e4688-4036-e606-7220-2e472afa0aac@baylibre.com> Date: Mon, 18 Jun 2018 10:35:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180618074443.GK31141@dell> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Lee, On 18/06/2018 09:44, Lee Jones wrote: > On Fri, 01 Jun 2018, Neil Armstrong wrote: > >> Having a 16 byte mkbp event size makes it possible to send CEC >> messages from the EC to the AP directly inside the mkbp event >> instead of first doing a notification and then a read. >> >> Signed-off-by: Stefan Adolfsson >> Signed-off-by: Neil Armstrong >> Tested-by: Enric Balletbo i Serra >> --- >> drivers/platform/chrome/cros_ec_proto.c | 40 +++++++++++++++++++++++++-------- >> include/linux/mfd/cros_ec.h | 2 +- >> include/linux/mfd/cros_ec_commands.h | 19 ++++++++++++++++ >> 3 files changed, 51 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c >> index e7bbdf9..c4f6c44 100644 >> --- a/drivers/platform/chrome/cros_ec_proto.c >> +++ b/drivers/platform/chrome/cros_ec_proto.c >> @@ -504,10 +504,31 @@ int cros_ec_cmd_xfer_status(struct cros_ec_device *ec_dev, >> } >> EXPORT_SYMBOL(cros_ec_cmd_xfer_status); >> >> +static int get_next_event_xfer(struct cros_ec_device *ec_dev, >> + struct cros_ec_command *msg, >> + int version, uint32_t size) >> +{ >> + int ret; >> + >> + msg->version = version; >> + msg->command = EC_CMD_GET_NEXT_EVENT; >> + msg->insize = size; >> + msg->outsize = 0; >> + >> + ret = cros_ec_cmd_xfer(ec_dev, msg); >> + if (ret > 0) { >> + ec_dev->event_size = ret - 1; >> + memcpy(&ec_dev->event_data, msg->data, ec_dev->event_size); >> + } >> + >> + return ret; >> +} >> + >> static int get_next_event(struct cros_ec_device *ec_dev) >> { >> u8 buffer[sizeof(struct cros_ec_command) + sizeof(ec_dev->event_data)]; >> struct cros_ec_command *msg = (struct cros_ec_command *)&buffer; >> + static int cmd_version = 1; >> int ret; >> >> if (ec_dev->suspended) { >> @@ -515,18 +536,19 @@ static int get_next_event(struct cros_ec_device *ec_dev) >> return -EHOSTDOWN; >> } >> >> - msg->version = 0; >> - msg->command = EC_CMD_GET_NEXT_EVENT; >> - msg->insize = sizeof(ec_dev->event_data); >> - msg->outsize = 0; >> + if (cmd_version == 1) { >> + ret = get_next_event_xfer(ec_dev, msg, cmd_version, >> + sizeof(struct ec_response_get_next_event_v1)); >> + if (ret < 0 || msg->result != EC_RES_INVALID_VERSION) >> + return ret; >> >> - ret = cros_ec_cmd_xfer(ec_dev, msg); >> - if (ret > 0) { >> - ec_dev->event_size = ret - 1; >> - memcpy(&ec_dev->event_data, msg->data, >> - sizeof(ec_dev->event_data)); >> + /* Fallback to version 0 for future send attempts */ >> + cmd_version = 0; >> } >> >> + ret = get_next_event_xfer(ec_dev, msg, cmd_version, >> + sizeof(struct ec_response_get_next_event)); >> + >> return ret; >> } >> >> diff --git a/include/linux/mfd/cros_ec.h b/include/linux/mfd/cros_ec.h >> index f36125e..32caef3 100644 >> --- a/include/linux/mfd/cros_ec.h >> +++ b/include/linux/mfd/cros_ec.h >> @@ -147,7 +147,7 @@ struct cros_ec_device { >> bool mkbp_event_supported; >> struct blocking_notifier_head event_notifier; >> >> - struct ec_response_get_next_event event_data; >> + struct ec_response_get_next_event_v1 event_data; >> int event_size; >> u32 host_event_wake_mask; >> }; >> diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h >> index f2edd99..cc0768e 100644 >> --- a/include/linux/mfd/cros_ec_commands.h >> +++ b/include/linux/mfd/cros_ec_commands.h >> @@ -2093,12 +2093,31 @@ union ec_response_get_next_data { >> uint32_t sysrq; >> } __packed; >> >> +union ec_response_get_next_data_v1 { >> + uint8_t key_matrix[16]; >> + >> + /* Unaligned */ > > That's funny! > >> + uint32_t host_event; >> + >> + uint32_t buttons; >> + uint32_t switches; >> + uint32_t sysrq; >> + uint32_t cec_events; >> + uint8_t cec_message[16]; > > Since there are some whitespace alignment issues in here. > >> +} __packed; > > How come these guys have kerneldoc headers? Can you explicit what should be changed here ? Thanks, Neil > >> struct ec_response_get_next_event { >> uint8_t event_type; >> /* Followed by event data if any */ >> union ec_response_get_next_data data; >> } __packed; >> >> +struct ec_response_get_next_event_v1 { >> + uint8_t event_type; >> + /* Followed by event data if any */ >> + union ec_response_get_next_data_v1 data; >> +} __packed; >> + >> /* Bit indices for buttons and switches.*/ >> /* Buttons */ >> #define EC_MKBP_POWER_BUTTON 0 >