From: Lan Tianyu <tianyu.lan@intel.com>
To: wsa@the-dreams.de, rjw@rjwysocki.net, lenb@kernel.org,
mika.westerberg@linux.intel.com, awilliam@redhat.com
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/9] I2C ACPI operation region handler support
Date: Wed, 16 Apr 2014 21:33:33 +0800 [thread overview]
Message-ID: <534E86AD.6000204@intel.com> (raw)
In-Reply-To: <1397654682-7094-1-git-send-email-tianyu.lan@intel.com>
[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]
On 04/16/2014 09:24 PM, Lan Tianyu wrote:
> ACPI 5.0 spec(5.5.2.4.5) defines GenericSerialBus(i2c, spi, uart) operation
> region. It allows ACPI aml code able to access such kind of devices to
> implement some ACPI standard method.
>
> On the Asus T100TA, Bios use GenericSerialBus operation region to access
> i2c device to get battery info. So battery function depends on the I2C
> operation region support. Here is the bug link.
> https://bugzilla.kernel.org/show_bug.cgi?id=69011
Completely fixing battery issue on the Asus T100TA also needs ACPI _DEP
support. The feature is under developing. Attach a temporary patch
for test.
>
> This patchset is to add I2C ACPI operation region handler support.
>
> [PATCH 1/9] ACPICA: Executer: Fix buffer allocation issue for
> [PATCH 2/9] ACPICA: Export acpi_buffer_to_resource symbol
> [PATCH 3/9] ACPI: Add acpi_bus_attach_private_data() to facilitate to
> [PATCH 4/9] ACPI/Thermal: Use acpi_bus_attach_private_data() to
> [PATCH 5/9] I2C: Add smbus quick read/write helper function
> [PATCH 6/9] I2C: Add smbus word/block process call helper function
> [PATCH 7/9] I2C/ACPI: Add i2c ACPI operation region support
> [PATCH 8/9] I2C/ACPI: Move ACPI related code to i2c-acpi.c
> [PATCH 9/9] I2C/ACPI: Add CONFIG_I2C_ACPI config
>
[-- Attachment #2: 0001-ACPI-temporary-dep-solution-for-battery-support.patch --]
[-- Type: text/x-patch, Size: 4184 bytes --]
>From bbadbc67de278123e28dd6f9ee7e88b6ada56ce4 Mon Sep 17 00:00:00 2001
From: Lan Tianyu <tianyu.lan@intel.com>
Date: Fri, 21 Mar 2014 16:42:12 +0800
Subject: [PATCH] ACPI: temporary dep solution for battery support
This is a dep workaround for battery support on Asus T100TA and the formal
dep solution is under developing. This patch is just for test and will
not be upstreamed.
---
drivers/acpi/scan.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++---
drivers/i2c/i2c-acpi.c | 1 +
include/linux/acpi.h | 1 +
3 files changed, 63 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7efe546..254afb7 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -36,6 +36,7 @@ bool acpi_force_hot_remove;
static const char *dummy_hid = "device";
+static LIST_HEAD(acpi_bus_dep_device_list);
static LIST_HEAD(acpi_bus_id_list);
static DEFINE_MUTEX(acpi_scan_lock);
static LIST_HEAD(acpi_scan_handlers_list);
@@ -43,6 +44,12 @@ DEFINE_MUTEX(acpi_device_lock);
LIST_HEAD(acpi_wakeup_device_list);
static DEFINE_MUTEX(acpi_hp_context_lock);
+
+struct acpi_dep_handle {
+ struct list_head node;
+ acpi_handle handle;
+};
+
struct acpi_device_bus_id{
char bus_id[15];
unsigned int instance_no;
@@ -2027,10 +2034,22 @@ static void acpi_scan_init_hotplug(struct acpi_device *adev)
}
}
+
+static int acpi_dep_device_check(acpi_handle handle)
+{
+ struct acpi_dep_handle *dep;
+
+ list_for_each_entry(dep, &acpi_bus_dep_device_list, node)
+ if (dep->handle == handle)
+ return -EEXIST;
+ return 0;
+}
+
static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
void *not_used, void **return_value)
{
struct acpi_device *device = NULL;
+ struct acpi_dep_handle *dep = NULL;
int type;
unsigned long long sta;
int result;
@@ -2048,9 +2067,24 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
return AE_OK;
}
- acpi_add_single_object(&device, handle, type, sta);
- if (!device)
- return AE_CTRL_DEPTH;
+ if (!acpi_dep_device_check(handle)
+ && acpi_has_method(handle, "_BIX")
+ && acpi_has_method(handle, "_DEP")) {
+ dep = kmalloc(sizeof(struct acpi_dep_handle), GFP_KERNEL);
+ if (!dep)
+ return AE_CTRL_DEPTH;
+ dep->handle = handle;
+ list_add_tail(&dep->node , &acpi_bus_dep_device_list);
+
+ acpi_handle_info(dep->handle,
+ "is added to dep device list.\n");
+
+ return AE_OK;
+ } else {
+ acpi_add_single_object(&device, handle, type, sta);
+ if (!device)
+ return AE_CTRL_DEPTH;
+ }
acpi_scan_init_hotplug(device);
@@ -2061,6 +2095,30 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
return AE_OK;
}
+int acpi_walk_dep_device_list(void)
+{
+ struct acpi_dep_handle *dep, *tmp;
+ acpi_status status;
+ unsigned long long sta;
+
+ list_for_each_entry_safe(dep, tmp, &acpi_bus_dep_device_list, node) {
+ status = acpi_evaluate_integer(dep->handle, "_STA", NULL, &sta);
+
+ if (ACPI_FAILURE(status)) {
+ acpi_handle_warn(dep->handle,
+ "Status check failed (0x%x)\n", status);
+ } else if (sta & ACPI_STA_DEVICE_ENABLED) {
+ acpi_bus_scan(dep->handle);
+ acpi_handle_info(dep->handle,
+ "Device is readly\n");
+ list_del(&dep->node);
+ kfree(dep);
+ }
+ }
+ return 0;
+}
+EXPORT_SYMBOL_GPL(acpi_walk_dep_device_list);
+
static int acpi_scan_attach_handler(struct acpi_device *device)
{
struct acpi_hardware_id *hwid;
diff --git a/drivers/i2c/i2c-acpi.c b/drivers/i2c/i2c-acpi.c
index a0ae867..471490a 100644
--- a/drivers/i2c/i2c-acpi.c
+++ b/drivers/i2c/i2c-acpi.c
@@ -349,6 +349,7 @@ int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
return -ENOMEM;
}
+ acpi_walk_dep_device_list();
return 0;
}
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 667204c..66ad0dd 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -115,6 +115,7 @@ int acpi_boot_init (void);
void acpi_boot_table_init (void);
int acpi_mps_check (void);
int acpi_numa_init (void);
+int acpi_walk_dep_device_list(void);
int acpi_table_init (void);
int acpi_table_parse(char *id, acpi_tbl_table_handler handler);
--
1.8.3.1
next prev parent reply other threads:[~2014-04-16 13:33 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-16 13:24 [PATCH 0/9] I2C ACPI operation region handler support Lan Tianyu
[not found] ` <1397654682-7094-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-16 13:24 ` [PATCH 1/9] ACPICA: Executer: Fix buffer allocation issue for generic_serial_bus region field accesses Lan Tianyu
2014-04-21 21:38 ` Rafael J. Wysocki
2014-04-22 1:14 ` Lan Tianyu
2014-04-16 13:24 ` [PATCH 2/9] ACPICA: Export acpi_buffer_to_resource symbol Lan Tianyu
2014-04-16 13:24 ` [PATCH 3/9] ACPI: Add acpi_bus_attach_private_data() to facilitate to attach data to ACPI handle Lan Tianyu
2014-04-16 13:24 ` [PATCH 4/9] ACPI/Thermal: Use acpi_bus_attach_private_data() to attach private data Lan Tianyu
2014-04-16 13:24 ` [PATCH 5/9] I2C: Add smbus quick read/write helper function Lan Tianyu
2014-04-16 13:24 ` [PATCH 6/9] I2C: Add smbus word/block process call " Lan Tianyu
2014-04-16 13:24 ` [PATCH 7/9] I2C/ACPI: Add i2c ACPI operation region support Lan Tianyu
2014-04-16 13:24 ` [PATCH 8/9] I2C/ACPI: Move ACPI related code to i2c-acpi.c Lan Tianyu
2014-04-16 13:24 ` [PATCH 9/9] I2C/ACPI: Add CONFIG_I2C_ACPI config Lan Tianyu
2014-04-16 13:33 ` Lan Tianyu [this message]
2014-04-16 16:35 ` [PATCH 0/9] I2C ACPI operation region handler support Adam Williamson
2014-04-22 6:24 ` [Resend Patch " Lan Tianyu
2014-04-22 6:24 ` [Resend Patch 1/9] ACPICA: Executer: Fix buffer allocation issue for generic_serial_bus region field accesses Lan Tianyu
[not found] ` <1398147855-9868-2-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-22 11:21 ` Mika Westerberg
2014-04-22 6:24 ` [Resend Patch 2/9] ACPICA: Export acpi_buffer_to_resource symbol Lan Tianyu
[not found] ` <1398147855-9868-3-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-22 11:21 ` Mika Westerberg
2014-04-22 6:24 ` [Resend Patch 3/9] ACPI: Add acpi_bus_attach_private_data() to facilitate to attach data to ACPI handle Lan Tianyu
[not found] ` <1398147855-9868-4-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-22 11:23 ` Mika Westerberg
2014-04-22 6:24 ` [Resend Patch 4/9] ACPI/Thermal: Use acpi_bus_attach_private_data() to attach private data Lan Tianyu
[not found] ` <1398147855-9868-5-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-22 11:24 ` Mika Westerberg
2014-04-22 6:24 ` [Resend Patch 5/9] I2C: Add smbus quick read/write helper function Lan Tianyu
[not found] ` <1398147855-9868-6-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-22 11:24 ` Mika Westerberg
2014-04-22 6:24 ` [Resend Patch 6/9] I2C: Add smbus word/block process call " Lan Tianyu
2014-04-22 11:26 ` Mika Westerberg
[not found] ` <1398147855-9868-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-22 6:24 ` [Resend Patch 7/9] I2C/ACPI: Add i2c ACPI operation region support Lan Tianyu
2014-04-22 11:36 ` Mika Westerberg
2014-04-23 1:53 ` Lan Tianyu
2014-04-23 7:28 ` Mika Westerberg
2014-04-23 7:17 ` Lan Tianyu
2014-04-22 6:24 ` [Resend Patch 8/9] I2C/ACPI: Move ACPI related code to i2c-acpi.c Lan Tianyu
[not found] ` <1398147855-9868-9-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-22 11:38 ` Mika Westerberg
2014-04-22 6:24 ` [Resend Patch 9/9] I2C/ACPI: Add CONFIG_I2C_ACPI config Lan Tianyu
2014-04-22 11:45 ` Mika Westerberg
[not found] ` <20140422114510.GM30677-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-23 5:39 ` Lan Tianyu
[not found] ` <53575227.7080407-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-23 6:47 ` Zheng, Lv
2014-04-23 7:40 ` Mika Westerberg
2014-04-23 23:03 ` [Resend Patch 0/9] I2C ACPI operation region handler support Adam Williamson
2014-04-28 14:27 ` [Patch V2 " Lan Tianyu
2014-04-28 14:27 ` [Patch V2 1/9] ACPICA: Executer: Fix buffer allocation issue for generic_serial_bus region field accesses Lan Tianyu
2014-04-28 17:52 ` Adam Williamson
2014-04-28 18:08 ` Adam Williamson
2014-04-28 22:50 ` Rafael J. Wysocki
2014-04-29 11:31 ` Wolfram Sang
2014-04-29 21:37 ` Rafael J. Wysocki
2014-04-28 14:27 ` [Patch V2 2/9] ACPICA: Export acpi_buffer_to_resource symbol Lan Tianyu
2014-04-28 14:27 ` [Patch V2 3/9] ACPI: Add acpi_bus_attach_private_data() to facilitate to attach data to ACPI handle Lan Tianyu
2014-04-28 14:27 ` [Patch V2 4/9] ACPI/Thermal: Use acpi_bus_attach_private_data() to attach private data Lan Tianyu
2014-04-28 14:27 ` [Patch V2 5/9] I2C: Add smbus quick read/write helper function Lan Tianyu
[not found] ` <1398695268-28645-6-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-17 9:41 ` Wolfram Sang
2014-05-17 13:13 ` Lan Tianyu
2014-05-17 17:15 ` Wolfram Sang
2014-04-28 14:27 ` [Patch V2 6/9] I2C: Add smbus word/block process call " Lan Tianyu
2014-05-17 10:21 ` Wolfram Sang
2014-05-17 13:59 ` Lan Tianyu
[not found] ` <53776B32.8010400-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-17 17:17 ` Wolfram Sang
2014-05-19 9:23 ` Lan Tianyu
2014-04-28 14:27 ` [Patch V2 7/9] I2C/ACPI: Add i2c ACPI operation region support Lan Tianyu
2014-04-29 8:02 ` Mika Westerberg
[not found] ` <1398695268-28645-1-git-send-email-tianyu.lan-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-04-28 14:27 ` [Patch V2 8/9] I2C/ACPI: Move ACPI related code to i2c-acpi.c Lan Tianyu
2014-04-28 22:51 ` [Patch V2 0/9] I2C ACPI operation region handler support Rafael J. Wysocki
[not found] ` <43726986.W0L99n76oE-sKB8Sp2ER+y1GS7QM15AGw@public.gmane.org>
2014-04-29 1:54 ` Lan Tianyu
2014-04-29 15:47 ` Rafael J. Wysocki
2014-05-13 13:09 ` Rolf Eike Beer
2014-05-13 14:06 ` Lan Tianyu
[not found] ` <53722700.6010001-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-15 7:50 ` Rolf Eike Beer
2014-05-15 14:49 ` Lan Tianyu
[not found] ` <5374D401.2010608-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-16 8:43 ` Rolf Eike Beer
2014-05-20 14:17 ` Rolf Eike Beer
2014-05-22 15:14 ` Lan Tianyu
[not found] ` <537E143F.7060701-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-23 6:55 ` Rolf Eike Beer
2014-04-28 14:27 ` [Patch V2 9/9] I2C/ACPI: Add CONFIG_I2C_ACPI config Lan Tianyu
2014-04-29 8:16 ` Mika Westerberg
2014-05-17 17:48 ` Wolfram Sang
2014-05-19 8:49 ` Mika Westerberg
[not found] ` <20140519084944.GH2067-3PARRvDOhMZrdx17CPfAsdBPR1lH4CV8@public.gmane.org>
2014-05-19 9:44 ` Lan Tianyu
[not found] ` <5379D28F.1020200-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-05-19 20:23 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=534E86AD.6000204@intel.com \
--to=tianyu.lan@intel.com \
--cc=awilliam@redhat.com \
--cc=lenb@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rjw@rjwysocki.net \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).