Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1998745iog; Sun, 19 Jun 2022 04:48:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sbBcHIt2DpgmkunGFbOFJHnV/XgICQHQYnv86+n9f/Xcc3T/AmTEONFuCRysau2KLn0SV8 X-Received: by 2002:a17:906:c7c8:b0:70c:a62c:d0e8 with SMTP id dc8-20020a170906c7c800b0070ca62cd0e8mr16484535ejb.545.1655639287485; Sun, 19 Jun 2022 04:48:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655639287; cv=none; d=google.com; s=arc-20160816; b=fLteKXOKGl+WTT/he2rqG3FsrxOUlpINOoQ1/sqHe7IEpMpmCoz/PRFeIq4V+uzbI8 RnzH+riWW8d+yL6bmEOPZ+kJ2Iab17uHTWtd4rBsRCCeA7HiXqit6Nt0hqlMqNlGpywS hTQySZeL8LSjKiGsPMCGaVQ2XbRa1VQK3vrvuWzvsK11vIm4sDmibgnO/M6xj/o/IFCN MgEx5AuFsfErjZmIzhk9jY4fFhurCvDDokZwFU0N91pOWhpKqGXMgJtAXDrtbFtm+7nZ rNZDG/8gIWCGYEUckjMuYYdNje4Vmhr7hgKXHpgLXd62pklUKhtKwv+hm0q6GIRnEshz Xekg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=utuT6cM/eVUrce22kFa8LNAWsGwMTCB+s3XUZ2ZFqjM=; b=XqXHN+ahh0SUeZRuKQmnyPJPdQPOn9Vip+fh45aidQ+BWo1dFLyhiGK6BZRHLerg21 kpEI/G7hIZdQA5MJaYlIN/MGxXKZs+f1MD0ru/NW5D1aBjPi6AsSACLOyFoAjbils9oL AgACGTGcmgMSITd+bICthrK4QKTVFgkAdd3T2H1WT0UCTCLbng5Sc6E0uGV1Y17qY8Yy G6F9vT8qqItmKFDxuv63SnIcP6qhiCkYY/vAtfB/+tcCDpfgEl1pZh1mbNrXrUMHteuK 0L4pfy9qfzq/guXuFcM+Pu28xvMZu8SLLw3MeEhjClN/f20edUm6zmbHChQj8vZnrZCe 2hbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mXgpt+1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne40-20020a1709077ba800b006f42a32ebcdsi8184657ejc.753.2022.06.19.04.47.42; Sun, 19 Jun 2022 04:48:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mXgpt+1B; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236149AbiFSLew (ORCPT + 99 others); Sun, 19 Jun 2022 07:34:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232931AbiFSLev (ORCPT ); Sun, 19 Jun 2022 07:34:51 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8974611A2B; Sun, 19 Jun 2022 04:34:50 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id v1so16189728ejg.13; Sun, 19 Jun 2022 04:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=utuT6cM/eVUrce22kFa8LNAWsGwMTCB+s3XUZ2ZFqjM=; b=mXgpt+1B6pqO42lHUT4jA1tBiM52Ug3Jpsxo+tK8ynedBHMa0VbC/QlOY/k4MQWMIL sZ09fZTms2b0ER5ORbUV+AX0NpK9/vcWO6oxJlfxH6/poht8DdvaFuHJGhHEaQtJsE1P OcwbY/e+e2vNcoQeajDAVuJh4IYmXG2JL0WOvgETVXPqR7IcYrGQzerGpV/X0B9bhIw+ iMuN8X4ElDnEYoEBQUr5TUkYPfadYvNEmbfNJL/1SzKuJSSRoLDx2bl3NNAk6ghs/cRs 7HoejQdHbldmsGCRLJrfObwS8N7DKAUIfrzn1imoD3QRQbik5i3O0P4KqtqbfhZvYM5j d/8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=utuT6cM/eVUrce22kFa8LNAWsGwMTCB+s3XUZ2ZFqjM=; b=QZ0GGwh21avu0JOI3p725dk20yUNXQqF3Pa8F8YeVTcQPfxHLL3w9tdW4wSwMGrMCn EcWrWsDHn/KaLN7T9tXbkMwhzX6VdIP5NQnbSyq502Tx6cWqcP7MFd2sfTdvE7E580ff hEPslnXJIw5GV8Qe29l5QfKMqqnnievSN4kNzUJKGW8C9IO0PMgroCLKnZ+RPjwIK7QU r+vxjgL1D4kLOsXdHlw6DCdXC5vu5Wa423lvTWd2oBfXja+ZhJ6L362mV45RouJEOSbH IHnBKLHfZVOB8DXrn9TGYlmjDBMzvwK+t/25zyYAkmcCth9TcMKuOoa+PeAB7Y7LNii7 eJZw== X-Gm-Message-State: AJIora+iqQspd3763niDHp5gbpXzZFYlPJum66k6DmMS8P3oDyEhZfCc ElnNSUCwaN3J0kWAf/RSTPV9p+MFCz1eYFS1exs= X-Received: by 2002:a17:906:149:b0:711:fca6:bc2f with SMTP id 9-20020a170906014900b00711fca6bc2fmr16875033ejh.497.1655638489111; Sun, 19 Jun 2022 04:34:49 -0700 (PDT) MIME-Version: 1.0 References: <20220618165747.55709-1-samuel@sholland.org> <20220618165747.55709-4-samuel@sholland.org> In-Reply-To: <20220618165747.55709-4-samuel@sholland.org> From: Andy Shevchenko Date: Sun, 19 Jun 2022 13:34:12 +0200 Message-ID: Subject: Re: [PATCH v4 3/4] Input: pinephone-keyboard - Support the proxied I2C bus To: Samuel Holland Cc: Dmitry Torokhov , linux-input , Linux Kernel Mailing List , Rob Herring , Ondrej Jirman , Krzysztof Kozlowski , devicetree , Andy Shevchenko , Chen-Yu Tsai , Colin Ian King , David Gow , Jernej Skrabec , Krzysztof Kozlowski , Marco Felsch , Mattijs Korpershoek , Stephen Boyd , Yassine Oudjana , "fengping.yu" , linux-arm Mailing List , linux-sunxi@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 18, 2022 at 7:12 PM Samuel Holland 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