From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FD13C282CE for ; Wed, 24 Apr 2019 23:30:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E59B8214AE for ; Wed, 24 Apr 2019 23:30:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="EzATWvVD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387458AbfDXXaF (ORCPT ); Wed, 24 Apr 2019 19:30:05 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:40190 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728373AbfDXXaC (ORCPT ); Wed, 24 Apr 2019 19:30:02 -0400 Received: by mail-pf1-f195.google.com with SMTP id c207so10112671pfc.7 for ; Wed, 24 Apr 2019 16:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9sjurVlyrTjlJObiv8UYwdqryjxRPhmUHxz7Yfi3KCk=; b=EzATWvVDd3u76kYg2iQ/IcgFv8XyZ06FqWhpNZ3iEOP6q2bThDvwxSvl4YpszxJBfV VaX15VZK8pNsoOE0oTP2Ze7YqQ+rKDe2lmwGqmRW34XWoxoupNWSiz99Q75oGMdmb6Vf 9D4wrZ6USjwANE0XwDQ0tJ9AmwIkFrSDMyUPs= 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:mime-version:content-transfer-encoding; bh=9sjurVlyrTjlJObiv8UYwdqryjxRPhmUHxz7Yfi3KCk=; b=kVaWKp8fknTz6/+XcsNfRNyRB5DiqgPX6ltbQLYsyrDCOpGdFBdo0P2drztUgl8SEK F+/l4TqyoX6KWkiAcqdbrecouuPmfD9mjmtVvxbaV3HeTEKXFri50YvG/eph8pwc4lLT PPYH4BrrtL3cnxK1UvPR6/GVkqO1hbz2avapr9RNm9z4JiIsDJq3VPV2EObgvrZ0xgQY vKtre9jEmOfV9jpmZ2VXuqxDAXUrz6sNnfydXlpCyWZPaV6dv11PtYex+JC4s8KfTpCh B0HyQOJG+J+xudvM3nIlaW+lpoZZa4wOnPZHX9k5hgN5x30TKVTJsL+dh903Kqvu/uKX V18A== X-Gm-Message-State: APjAAAU4zoZgsDpGxT6h0dKOGS/Kh4d659hLNbV6j6EB7uLlOVDXsg0k 1wZlauZOqtNETrI+emeM8zq56w== X-Google-Smtp-Source: APXvYqwE6JQe/D/AfGWt4GGnNI1R1xYnHvGdAWZ9aYUWhTMrvJhHWhEy68xthXv/pSIhn85SRYJDHg== X-Received: by 2002:a65:6284:: with SMTP id f4mr10195377pgv.11.1556148601464; Wed, 24 Apr 2019 16:30:01 -0700 (PDT) Received: from localhost ([2620:15c:202:1:3c8f:512b:3522:dfaf]) by smtp.gmail.com with ESMTPSA id u17sm26245785pfn.19.2019.04.24.16.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Apr 2019 16:30:00 -0700 (PDT) From: Gwendal Grignou To: enric.balletbo@collabora.com, bleung@chromium.org, groeck@chromium.org, lee.jones@linaro.org Cc: linux-kernel@vger.kernel.org, Gwendal Grignou Subject: [PATCH 25/30] mfd: cros_ec: Add API for EC-EC communication Date: Wed, 24 Apr 2019 16:29:13 -0700 Message-Id: <20190424232918.243308-26-gwendal@chromium.org> X-Mailer: git-send-email 2.21.0.593.g511ec345e18-goog In-Reply-To: <20190424232918.243308-1-gwendal@chromium.org> References: <20190424232918.243308-1-gwendal@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Allow EC to talk to other ECs that are not presented to the host. Neeed when EC are present in detachable keyboard. Signed-off-by: Gwendal Grignou --- include/linux/mfd/cros_ec_commands.h | 95 ++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index c1fe64c0957b..32d3a4e07ea8 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -5039,6 +5039,101 @@ struct ec_response_pd_chip_info_v1 { }; } __ec_align2; +/*****************************************************************************/ +/* EC-EC communication commands: range 0x0600-0x06FF */ + +#define EC_COMM_TEXT_MAX 8 + +/* + * Get battery static information, i.e. information that never changes, or + * very infrequently. + */ +#define EC_CMD_BATTERY_GET_STATIC 0x0600 + +/** + * struct ec_params_battery_static_info - Battery static info parameters + * @index: Battery index. + */ +struct ec_params_battery_static_info { + uint8_t index; +} __ec_align_size1; + +/** + * struct ec_response_battery_static_info - Battery static info response + * @design_capacity: Battery Design Capacity (mAh) + * @design_voltage: Battery Design Voltage (mV) + * @manufacturer: Battery Manufacturer String + * @model: Battery Model Number String + * @serial: Battery Serial Number String + * @type: Battery Type String + * @cycle_count: Battery Cycle Count + */ +struct ec_response_battery_static_info { + uint16_t design_capacity; + uint16_t design_voltage; + char manufacturer[EC_COMM_TEXT_MAX]; + char model[EC_COMM_TEXT_MAX]; + char serial[EC_COMM_TEXT_MAX]; + char type[EC_COMM_TEXT_MAX]; + /* TODO(crbug.com/795991): Consider moving to dynamic structure. */ + uint32_t cycle_count; +} __ec_align4; + +/* + * Get battery dynamic information, i.e. information that is likely to change + * every time it is read. + */ +#define EC_CMD_BATTERY_GET_DYNAMIC 0x0601 + +/** + * struct ec_params_battery_dynamic_info - Battery dynamic info parameters + * @index: Battery index. + */ +struct ec_params_battery_dynamic_info { + uint8_t index; +} __ec_align_size1; + +/** + * struct ec_response_battery_dynamic_info - Battery dynamic info response + * @actual_voltage: Battery voltage (mV) + * @actual_current: Battery current (mA); negative=discharging + * @remaining_capacity: Remaining capacity (mAh) + * @full_capacity: Capacity (mAh, might change occasionally) + * @flags: Flags, see EC_BATT_FLAG_* + * @desired_voltage: Charging voltage desired by battery (mV) + * @desired_current: Charging current desired by battery (mA) + */ +struct ec_response_battery_dynamic_info { + int16_t actual_voltage; + int16_t actual_current; + int16_t remaining_capacity; + int16_t full_capacity; + int16_t flags; + int16_t desired_voltage; + int16_t desired_current; +} __ec_align2; + +/* + * Control charger chip. Used to control charger chip on the slave. + */ +#define EC_CMD_CHARGER_CONTROL 0x0602 + +/** + * struct ec_params_charger_control - Charger control parameters + * @max_current: Charger current (mA). Positive to allow base to draw up to + * max_current and (possibly) charge battery, negative to request current + * from base (OTG). + * @otg_voltage: Voltage (mV) to use in OTG mode, ignored if max_current is + * >= 0. + * @allow_charging: Allow base battery charging (only makes sense if + * max_current > 0). + */ +struct ec_params_charger_control { + int16_t max_current; + uint16_t otg_voltage; + uint8_t allow_charging; +} __ec_align_size1; + /*****************************************************************************/ /* * Reserve a range of host commands for board-specific, experimental, or -- 2.21.0.593.g511ec345e18-goog