Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1091003imm; Tue, 3 Jul 2018 05:28:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJEZXhmloz7NbbIPB5kWu8CnLPOROnXZKwLuBuxmoYqtRQeJ2SIp80h9Voi5OhAS2XguqW+ X-Received: by 2002:a63:7f16:: with SMTP id a22-v6mr25413392pgd.255.1530620910877; Tue, 03 Jul 2018 05:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530620910; cv=none; d=google.com; s=arc-20160816; b=WqEiHe8s7+koJOJ6v5/ie8pu/XrWpZ9jvoUf8HViwJBXsveth/+l0UU9qHkbIVtXeA 8X3E6BzvWLU+N/1gUdgE7uyNn/gi24XXXJj9SXuvxWcYkZanMhlua/Z9/IBGSVepc6QT 847Y7dSvZ120WfpMJpIQujIsVj1kQidNPixglMZINjSG8oR131ogleXCajgNMOv5PijB vOSubRJaS9NFFaVtGmsslHRWCiOkkNWcdduszDT0HHFK6fh5ruHbwX6ID+hy2J81C9sS 7SVvU0lrWe0ZY14jZpBwIvJosWDzWGcHiuRQkkBoii00Wo+2XLC0/8ub1vTcAHMqHc8g DZIg== 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=ldC5P7njACjAGpU1TBHpK/e8MVvVmPN7LyLSGiGYAcY=; b=NltgLRlNxcPvJ6tORIOuNaKh+czEVOsrG/zEhiBpcKdYWA4V1e2vk30Dcfkew15rOU ZFCh3Q8RE6CMhkcPlFvd4OyJ7TyE4M5mfMNRRQgItCdN8HV1+bTrTikQF/RpCUq1s/FK EtOZT2sXZidQMzXCqy0fomsP0VOEMWBl7p2Xo/uYdKOhPmwY1VOhoBxIbhX6swXW94GK Q4zIlgdoncQAchrsseo8WRPtO5AfxmT1N7O+Iy71+qF3xZlLfPtjOEdk1fYqxkFUOpU+ JoMMY6Cb1+s9eMG88eZV5rK0H8wXSiySrH+nfP1SSm7HyuzQCerkjxOFI2adDxmT/L3B THKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=ugBu4LZN; 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 q74-v6si1020139pfa.272.2018.07.03.05.28.15; Tue, 03 Jul 2018 05:28:30 -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=ugBu4LZN; 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 S1753156AbeGCM1f (ORCPT + 99 others); Tue, 3 Jul 2018 08:27:35 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33854 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752552AbeGCM1d (ORCPT ); Tue, 3 Jul 2018 08:27:33 -0400 Received: by mail-wr0-f195.google.com with SMTP id a12-v6so1790263wro.1 for ; Tue, 03 Jul 2018 05:27:32 -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=ldC5P7njACjAGpU1TBHpK/e8MVvVmPN7LyLSGiGYAcY=; b=ugBu4LZNEgd1ME5ETJVrEl+T0toX9MZ6HhIbOjEfmFx8k4RtS4StFF565z8/Lwg59t 7xEOhXYKAocvgIcwwibqX3nOcr4sJ6ma2fp8Ipr0UDp4qRPwX6/1+ixQus348JrTM9sm 6nBrBfZKlLbbY6u4JoAuMNUJA54gexTS1IaUIiZMA5otbGDej8rxic3aWNZRkgE3ix22 b2jciDhwwtHMiD0NYb0wJFxTzqTJBuHab2oQmMpx+tDXxRr2Y6kqQIRbrJHg6nkQQd7x p9PwnCRxXd282EEC8gwdnBF1XaWaMxFCeurkRaQ71lSFk60GwdsXNJNu2xdI0c2fL2XO rIyg== 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=ldC5P7njACjAGpU1TBHpK/e8MVvVmPN7LyLSGiGYAcY=; b=RgY/ROsCufFoyzKw1jQbuUYpy0pMdR3D30hKX4vgrAD6wt8b7xeOpxoeRuXEV2SGdn ZfCJ0NM7uwkpHe6WB2QiukRszCkACtiEPrvZxgjP7FQkZmB7Ul/WuqECmi1bwYVhnp8n izIelCwOlMk9ZBz+9YL16DWvEjdVpLtxp0Kulfbe+4o1qBwmY2Mdealqsm07H7XT3DJV 45LYRtBLfEIUb6d+PhdXnXJfBhpSy/sANfSZDVihBR/EVL34Ws3Tsxr14DbHlHBdg6l1 IGJtZDoTYQY+wRe0ZHM6OSa5IuO7/RH4RJz505hD23bkCp9viqtiURdfp+vzhHPsQOQ2 m0Tw== X-Gm-Message-State: APt69E3RoClh6d6kXQb8K7X4ECiLMqqt+uiqo+DrbaMw5D0shvo0hA+z 312TucNIax5tp/6Q7F9vRTqNRg== X-Received: by 2002:adf:8712:: with SMTP id a18-v6mr1631864wra.178.1530620851724; Tue, 03 Jul 2018 05:27:31 -0700 (PDT) Received: from [10.1.2.12] ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id n16-v6sm1785379wrg.58.2018.07.03.05.27.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 05:27:30 -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> <017e4688-4036-e606-7220-2e472afa0aac@baylibre.com> <20180703094344.GR20176@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 GyMGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheABQJX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lHnrCzq43WefRHI5XTTQbM0WUIBIcGmq38+OgUsMYu4NzLu7uZF Acmp6h8g Organization: Baylibre Message-ID: Date: Tue, 3 Jul 2018 14:27:29 +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: <20180703094344.GR20176@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 03/07/2018 11:43, Lee Jones wrote: > On Mon, 18 Jun 2018, Neil Armstrong wrote: > >> 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. > > Fix the white space issues. Ok > >>>> +} __packed; >>> >>> How come these guys have kerneldoc headers? > > Consider using kerneldoc headers (not required for this patch). I already used kerneldoc for the other patch as requested by Enric. > >> Can you explicit what should be changed here ? > > -^ Ok 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 >>> >> >