[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZfeGkHp8kc-Uv+5Q6xRN1NwiZD-kLWS93x0jV=kn30MA@mail.gmail.com>
Date: Fri, 14 Mar 2014 11:53:30 +0100
From: Linus Walleij <linus.walleij@...aro.org>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Alexandre Courbot <gnurou@...il.com>,
Lan Tianyu <tianyu.lan@...el.com>,
Lv Zheng <lv.zheng@...el.com>, Alan Cox <alan.cox@...el.com>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 5/5] gpio / ACPI: Add support for ACPI GPIO operation regions
On Thu, Mar 13, 2014 at 4:18 PM, Mika Westerberg
<mika.westerberg@...ux.intel.com> wrote:
> On Thu, Mar 13, 2014 at 03:32:01PM +0100, Linus Walleij wrote:
>> > + case ACPI_IO_RESTRICT_OUTPUT:
>> > + gpiod_direction_output(desc, pull);
>>
>> Can you explain why the fact that the line is pulled down affects the
>> default output value like this? I don't get it.
>
> That's the thing - ACPI doesn't tell us what is the initial value of the
> pin. There is no such field in GpioIo() resource.
>
> So I'm assuming here that if it says that the pin is pulled up, the default
> value will be high.
OK! So exactly that statement is what I want to see as a comment
in this switch case.
>> > + if (function == ACPI_WRITE)
>> > + gpiod_set_raw_value(desc, !!((1 << i) & *value));
>>
>> What is this? How can the expression !!((1 << i) possibly evaluate to
>> anything else than "true"? I don't get it. Just (desc, *value) seem more
>> apropriate.
>
> We are dealing with multiple pins here. So for example if
> agpio->pin_table_length == 2 and *value == 0x2 we get:
>
> i == 0: !!((1 << 0) & 0x2) --> false
> i == 1: !!((1 << 1) & 0x2) --> true
Yeah, Alan already pointed out my parse error... this is OK.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists