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=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,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 1E9CEC43219 for ; Fri, 3 May 2019 22:03:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E1F652075C for ; Fri, 3 May 2019 22:03:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="UAtBg6n5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726963AbfECWDX (ORCPT ); Fri, 3 May 2019 18:03:23 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41478 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbfECWDX (ORCPT ); Fri, 3 May 2019 18:03:23 -0400 Received: by mail-pg1-f196.google.com with SMTP id f6so3334773pgs.8 for ; Fri, 03 May 2019 15:03:22 -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=q1PKEqDM378kY+fiX0biAqbBpeI8zOEYVZPaEEhsQfc=; b=UAtBg6n5bXdlAdjlBcRXonMnEy8aQ1/zsgfeP1VOfuTFsrcenQqlBXzdZfJ+5cmAum mlPVNuimtSdlNEfL/zLwb5vRtlrvi6WRou9e2lrZ+SdNsvFyd9IbXlFOXVAjyXF/JOX8 mGLPKDttdiF972NtQa4s0Y1UQfNRizf9hGaf0= 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=q1PKEqDM378kY+fiX0biAqbBpeI8zOEYVZPaEEhsQfc=; b=I6Azno4CevZMQeRbwCmhg1eWJbbfrQtxGLte4Sj9/lYtCEb1TYLf582aAegraf8/ZB h+nVzhcodH81hR/93U309KqtA8cLVKQxEExDes9CiYyemRXwtOTtouY470ZwfmoXZR/M p8lRFfj7uXsqfEgyd1tGubLeByozSwZH/QiYWhPR3xWV8SDj4BPzHdjDJBLB4flY00SY UWBMzgpr1gb7DxFzJQSk4QtCouJCo4WlKDmqUbQu9qAcGB8vERyj6KoQewkOM0dSxbm8 Zbz0D3UNg3mlpCATLlbw6IlUj0qeCGcxXFfaQg3bsE955xP5hiJ2ueFiw2Byq0rDO8no X6sA== X-Gm-Message-State: APjAAAWXCstWSUGBEVaaqEu+oZnQVqVGod4h3VNftd7q+SVE5F0YjkdK n0wrdArJa2iIZHSrbCXeFdmT6g== X-Google-Smtp-Source: APXvYqzFG5JHQMwF1zwyuVu33jSdE9Z0d14+r7tp18tTYjUtUaK8k5Wou9ZPJDFKWSjUZi67hh+qvA== X-Received: by 2002:a63:4f41:: with SMTP id p1mr13845074pgl.63.1556921002394; Fri, 03 May 2019 15:03:22 -0700 (PDT) Received: from localhost ([2620:15c:202:1:3c8f:512b:3522:dfaf]) by smtp.gmail.com with ESMTPSA id j12sm8701522pgg.79.2019.05.03.15.03.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 15:03:21 -0700 (PDT) From: Gwendal Grignou To: enric.balletbo@collabora.com, bleung@chromium.org, groeck@chromium.org, lee.jones@linaro.org, jic23@kernel.org, broonie@kernel.org, cychiang@chromium.org, tiwai@suse.com Cc: linux-iio@vger.kernel.org, alsa-devel@alsa-project.org, Gwendal Grignou Subject: [PATCH v2 24/30] mfd: cros_ec: Add API for EC-EC communication Date: Fri, 3 May 2019 15:02:27 -0700 Message-Id: <20190503220233.64546-25-gwendal@chromium.org> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog In-Reply-To: <20190503220233.64546-1-gwendal@chromium.org> References: <20190503220233.64546-1-gwendal@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@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. Acked-by: Enric Balletbo i Serra 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 59ad6bae3f9b..52fd9bfafc7f 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -5043,6 +5043,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.1020.gf2820cf01a-goog