[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfM3L-bKOLoXTz67JCWq8UX6d-LvuYDxXMtTBznGOTgSA@mail.gmail.com>
Date: Sun, 19 Jun 2022 13:34:12 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Samuel Holland <samuel@...lland.org>
Cc: Dmitry Torokhov <dmitry.torokhov@...il.com>,
linux-input <linux-input@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Rob Herring <robh+dt@...nel.org>, Ondrej Jirman <x@....cz>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
devicetree <devicetree@...r.kernel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Chen-Yu Tsai <wens@...e.org>,
Colin Ian King <colin.king@...el.com>,
David Gow <davidgow@...gle.com>,
Jernej Skrabec <jernej.skrabec@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Marco Felsch <m.felsch@...gutronix.de>,
Mattijs Korpershoek <mkorpershoek@...libre.com>,
Stephen Boyd <swboyd@...omium.org>,
Yassine Oudjana <y.oudjana@...tonmail.com>,
"fengping.yu" <fengping.yu@...iatek.com>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
linux-sunxi@...ts.linux.dev
Subject: Re: [PATCH v4 3/4] Input: pinephone-keyboard - Support the proxied
I2C bus
On Sat, Jun 18, 2022 at 7:12 PM Samuel Holland <samuel@...lland.org> wrote:
>
> The PinePhone keyboard case contains a battery managed by an integrated
> power bank IC. The power bank IC communicates over I2C, and the keyboard
> MCU firmware provides an interface to read and write its registers.
> Let's use this interface to implement a SMBus adapter, so we can reuse
> the driver for the power bank IC.
...
> + /* Read back the command status until it passes or fails. */
> + do {
> + usleep_range(300, 500);
> + ret = i2c_smbus_read_byte_data(client, PPKB_SYS_COMMAND);
> + } while (ret == buf[2]);
> + if (ret < 0)
> + return ret;
> + /* Commands return 0x00 on success and 0xff on failure. */
> + if (ret)
> + return -EIO;
Something to use from iopoll.h ?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists