lkml.org 
[lkml]   [2022]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH v4 3/4] Input: pinephone-keyboard - Support the proxied I2C bus
    On Sat, Jun 18, 2022 at 7:12 PM Samuel Holland <samuel@sholland.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

    \
     
     \ /
      Last update: 2022-06-19 13:35    [W:2.725 / U:1.468 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site