From patchwork Wed Nov 12 00:25:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 409787 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7A2F114012C for ; Wed, 12 Nov 2014 11:32:49 +1100 (AEDT) Received: from localhost ([::1]:51600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLrb-0004e9-M8 for incoming@patchwork.ozlabs.org; Tue, 11 Nov 2014 19:32:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38003) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLlW-00024U-O6 for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoLlQ-0000CH-7N for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:30 -0500 Received: from mail-oi0-f47.google.com ([209.85.218.47]:57336) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLlP-0000BZ-WC for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:24 -0500 Received: by mail-oi0-f47.google.com with SMTP id a3so7849146oib.20 for ; Tue, 11 Nov 2014 16:26:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CGTY11WglC+KzSvGawyXG4iPhMVKz2KxvVjvAZ4xrVI=; b=SqRt7iVD/i4Hh3FU8IpAfvmu4F/5QZ+Uwz8A/iqRnhPBcPfCQQjhqTY8EpzxSSN6m3 1XOC/3tE6HTyHFreHHg0ltggzU5QWLrqNIo1NyvkKQHjmT74IQTRWYir1noy8/RlO3ML mcsvpmJUVIKRD3HuRI+wD3fejugVrD0CBynXeEzSblSybHx3cW9aws/ks4Op7GjXot9D d5zkrUCdCIOYjn8oWg2tVbDc6Dg4G/kFDoWllpHejZx54Lx3s16bjU6xDJ69zJ2Lclj5 GPSmZLyLHwwcp9pSkJ82JcbacLDs3d71En5+4xzzHb8Ij95kDf6yjDPKqMIfS2JNJe+F 2AiQ== X-Gm-Message-State: ALoCoQmQvziEG/gtAkjdxwh84hNaZ2SwLjkjlFwHWWQWuZ5gv29jgPiO1A8JD3ebgB14Jp3H2VT8 X-Received: by 10.202.79.13 with SMTP id d13mr4546974oib.71.1415751983675; Tue, 11 Nov 2014 16:26:23 -0800 (PST) Received: from gbellows-linaro.bellowshome.net (99-179-1-128.lightspeed.austtx.sbcglobal.net. [99.179.1.128]) by mx.google.com with ESMTPSA id d3sm6239765obs.18.2014.11.11.16.26.22 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Nov 2014 16:26:23 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org, alex.bennee@linaro.org Date: Tue, 11 Nov 2014 18:25:56 -0600 Message-Id: <1415751963-4081-9-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415751963-4081-1-git-send-email-greg.bellows@linaro.org> References: <1415751963-4081-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.218.47 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v1 08/15] android-console: Add header for battery externs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Added goldfish_battery.h to share power and battery constants and externs between the Goldfish battery code and the Android console code. Signed-off-by: Greg Bellows --- hw/misc/goldfish_battery.c | 4 +-- include/hw/misc/goldfish_battery.h | 71 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 include/hw/misc/goldfish_battery.h diff --git a/hw/misc/goldfish_battery.c b/hw/misc/goldfish_battery.c index 11a2561..c956eb2 100644 --- a/hw/misc/goldfish_battery.c +++ b/hw/misc/goldfish_battery.c @@ -12,6 +12,7 @@ #include "hw/hw.h" #include "hw/sysbus.h" #include "qemu/error-report.h" +#include "hw/misc/goldfish_battery.h" enum { /* status register */ @@ -30,9 +31,6 @@ enum { BATTERY_INT_MASK = BATTERY_STATUS_CHANGED | AC_STATUS_CHANGED, }; -const uint32_t POWER_SUPPLY_STATUS_CHARGING = 1; -const uint32_t POWER_SUPPLY_HEALTH_GOOD = 1; - #define TYPE_GOLDFISH_BATTERY "goldfish_battery" #define GOLDFISH_BATTERY(obj) OBJECT_CHECK(struct goldfish_battery_state, (obj), TYPE_GOLDFISH_BATTERY) diff --git a/include/hw/misc/goldfish_battery.h b/include/hw/misc/goldfish_battery.h new file mode 100644 index 0000000..85a9f2f --- /dev/null +++ b/include/hw/misc/goldfish_battery.h @@ -0,0 +1,71 @@ +/* Copyright (C) 2007-2013 The Android Open Source Project +** +** This software is licensed under the terms of the GNU General Public +** License version 2, as published by the Free Software Foundation, and +** may be copied, distributed, and modified under those terms. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +*/ +#ifndef _HW_GOLDFISH_BATTERY_H +#define _HW_GOLDFISH_BATTERY_H + +enum { + POWER_SUPPLY_STATUS_UNKNOWN = 0, + POWER_SUPPLY_STATUS_CHARGING, + POWER_SUPPLY_STATUS_DISCHARGING, + POWER_SUPPLY_STATUS_NOT_CHARGING, + POWER_SUPPLY_STATUS_FULL, +}; + +enum { + POWER_SUPPLY_HEALTH_UNKNOWN = 0, + POWER_SUPPLY_HEALTH_GOOD, + POWER_SUPPLY_HEALTH_OVERHEAT, + POWER_SUPPLY_HEALTH_DEAD, + POWER_SUPPLY_HEALTH_OVERVOLTAGE, + POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, +}; + + +enum power_supply_property { + /* Properties of type `int' */ + POWER_SUPPLY_PROP_STATUS = 0, + POWER_SUPPLY_PROP_HEALTH, + POWER_SUPPLY_PROP_PRESENT, + POWER_SUPPLY_PROP_ONLINE, + POWER_SUPPLY_PROP_TECHNOLOGY, + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, + POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, + POWER_SUPPLY_PROP_VOLTAGE_NOW, + POWER_SUPPLY_PROP_VOLTAGE_AVG, + POWER_SUPPLY_PROP_CURRENT_NOW, + POWER_SUPPLY_PROP_CURRENT_AVG, + POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN, + POWER_SUPPLY_PROP_CHARGE_EMPTY_DESIGN, + POWER_SUPPLY_PROP_CHARGE_FULL, + POWER_SUPPLY_PROP_CHARGE_EMPTY, + POWER_SUPPLY_PROP_CHARGE_NOW, + POWER_SUPPLY_PROP_CHARGE_AVG, + POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN, + POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN, + POWER_SUPPLY_PROP_ENERGY_FULL, + POWER_SUPPLY_PROP_ENERGY_EMPTY, + POWER_SUPPLY_PROP_ENERGY_NOW, + POWER_SUPPLY_PROP_ENERGY_AVG, + POWER_SUPPLY_PROP_CAPACITY, /* in percents! */ + POWER_SUPPLY_PROP_CAPACITY_LEVEL, + POWER_SUPPLY_PROP_TEMP, + POWER_SUPPLY_PROP_TEMP_AMBIENT, + POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW, + POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG, + POWER_SUPPLY_PROP_TIME_TO_FULL_NOW, + POWER_SUPPLY_PROP_TIME_TO_FULL_AVG, + /* Properties of type `const char *' */ + POWER_SUPPLY_PROP_MODEL_NAME, + POWER_SUPPLY_PROP_MANUFACTURER, +}; + +#endif /* _HW_GOLDFISH_BATTERY_H */