Re: [PATCH v4 3/4] Input: pinephone-keyboard - Support the proxied I2C bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 18, 2022 at 7:12 PM Samuel Holland <samuel@xxxxxxxxxxxx> 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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux