From: Corentin Chary <corentin.chary@gmail.com>
To: Florian Echtler <floe@butterbrot.org>
Cc: linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org
Subject: Re: Looking for some pointers on WMI/EC access
Date: Tue, 20 Apr 2010 14:09:46 +0200 [thread overview]
Message-ID: <m2i71cd59b01004200509ye8fa593xc7bd5b201d484046@mail.gmail.com> (raw)
In-Reply-To: <1271762498.1537.215.camel@pancake>
On Tue, Apr 20, 2010 at 1:21 PM, Florian Echtler <floe@butterbrot.org> wrote:
> Hello Corentin,
>
>> > Looking at your dsdt:
>> >
>> > BUF1 and BUF2 contains some easy to find data:
> [...]
> You're correct, but most of the data fields within BUF1 and BUF2 are
> never referenced anywhere else. Doesn't that mean that these fields are
> probably dead?
Hum .. maybe, the best way to know would be to dump it in various
hardware states.
>> > Looking at _INI :
>> > Store (\_SB.BRNS, BRMX) probably means "set the brightness to
>> > the maximum brightness"
>> >
>> > WQIO returns both BUF1 and BUF2, you can get it with wmi_query_block()
>> >
>> > WSIO calls CPSR and CPSR store the argument in INBF.
>> > BY00, BY01, ... BY31, BGTX, BGTY, BGTZ etc ... are used to access
>> > specific bytes in INBF :
>> > CreateByteField (INBF, 0x00, BY00)
>> > CreateByteField (INBF, 0x01, BY01)
>> > CreateByteField (INBF, 0x02, BY02)
>> > CreateByteField (INBF, 0x03, BY03)
>> > CreateByteField (INBF, 0x04, BY04)
>> > CreateByteField (INBF, 0x05, BY05)
>> >
>> >
>> > CSPR wants BY00 to be 0x01 and BY01 to be 0x10 to do something.
>> > It calls CMD0 (BY08, BY09, BY10, BY11, BY16)
>> >
>> > ERQ0 (present in BUF1) is compared to Arg2 (BY09) == 0x1
>> > if true, it will store some values and call notify
> So this would then trigger the WMI event in the driver, right?
> I'd assume that EVID is the EVent ID - would make sense, since somewhere
> in the embedded controller code, there's this snippet:
>
> Method (_QEF, 0, NotSerialized)
> {
> Store (0xEF, P80H)
> \_SB.WMI2.CMD2 (0x2D, 0x01, 0x01)
> }
>
> Method (_QF1, 0, NotSerialized)
> {
> Store (0xF1, P80H)
> \_SB.WMI2.CMD2 (0x2C, 0x01, 0x01)
> }
>
> AFAICT the problem might be that ERQ0 is never initialized.. so it's
> probably zero from the start and the first code branch in CMD0 will
> never be called.
ERQ0 is initialized here (with 0x00):
Name (BUF1, Buffer (0x40)
{
/* 0000 */ 0x01, 0x00, 0x00,
0xFF, 0x00, 0xFF, 0xFF, 0xFF,
/* 0008 */ 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
/* 0010 */ 0xFF, 0xFF, 0x00,
0x00, 0x00, 0xFF, 0xFF, 0xFF,
/* 0018 */ 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
/* 0020 */ 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
/* 0028 */ 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
/* 0030 */ 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
/* 0038 */ 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF
})
>> Method (GECN, 1, NotSerialized)
>> Method (SECN, 2, Serialized)
>>
>> are very interesting:
>>
>> GECN is used to get status, and SECN to set status.
>>
>> For example, use \_SB.GECN(0x03) to get bluetooth status
>> And \_SB.SECN(0x03, 0x01) to enable bluetooth.
>> I don't really understand what DECN is used for, maybe to know if a
>> device is present (or maybe just switch GECN and DECN).
> I've gone through the binary module from Splashtop (lenovo_ec.ko) with
> objdump, and it appears that it's calling exactly those methods
> (GECN,SECN,DECN). The EC registers themselves also do look very
> interesting, especially with fields like XALM/YALM/ZALM or
> GSVX/GSVY/GSVZ which are probably related to the accelerometer.
>
> Do you perhaps have some example as to how to access the EC register
> space?
Take a look at eeepc-laptop, you can do most of the work with
acpi_evaluate_object (see write_acpi_int/read_acpi_init in
eeepc-laptop).
If you really need to access the EC directly, check ec_write()/ec_read() calls.
--
Corentin Chary
http://xf.iksaif.net
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-04-20 12:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-17 15:37 Looking for some pointers on WMI/EC access Florian Echtler
2010-04-18 19:21 ` Corentin Chary
2010-04-19 14:25 ` Florian Echtler
2010-04-19 15:46 ` Corentin Chary
[not found] ` <1271746353.16585.9.camel@flunder>
2010-04-20 7:21 ` Corentin Chary
2010-04-20 7:30 ` Corentin Chary
2010-04-20 11:21 ` Florian Echtler
2010-04-20 12:09 ` Corentin Chary [this message]
2010-04-21 12:46 ` Florian Echtler
2010-04-21 13:33 ` Matthew Garrett
2010-04-21 14:30 ` Florian Echtler
2010-04-21 14:32 ` Matthew Garrett
2010-04-22 8:21 ` Florian Echtler
2010-04-22 13:36 ` Matthew Garrett
[not found] ` <1271944219.29664.42.camel@pancake.fritz.box>
2010-04-22 13:53 ` Matthew Garrett
2010-04-22 14:05 ` Matthew Garrett
2010-04-23 11:24 ` Florian Echtler
2010-04-23 17:47 ` Matthew Garrett
2010-04-22 14:33 ` Corentin Chary
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=m2i71cd59b01004200509ye8fa593xc7bd5b201d484046@mail.gmail.com \
--to=corentin.chary@gmail.com \
--cc=floe@butterbrot.org \
--cc=linux-acpi@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/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).