From patchwork Wed Aug 2 07:35:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13337776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 156F6C001DE for ; Wed, 2 Aug 2023 07:36:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232999AbjHBHgr (ORCPT ); Wed, 2 Aug 2023 03:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233010AbjHBHg3 (ORCPT ); Wed, 2 Aug 2023 03:36:29 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8183E30D1; Wed, 2 Aug 2023 00:36:13 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4fe3b86cec1so4497417e87.2; Wed, 02 Aug 2023 00:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690961772; x=1691566572; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=B1ZhT/lHz8oBBSrpqok+uROkQ5qtTNN4HBw8QF0pmww=; b=Y2moqdbfXuUNkormsrVnJvvkrKNbq0M27AkpjnXDF7a0MNdHYFYP1ewxzZ1ATBhQer TONlv6D4eCl5smoinRHY8UR/RNzvnU7yq66tgSxDx0eIe11Mo+8opQQhq2U6LXeroaEs KfavP03BNuRfPK+dXRJt2A7Gt0sw51fzApqBIzBiivJTeMwwiq3v65P0x4ncmi6CF248 NbKasNQ/jD27XA5wwUFGjyrma/XWOp0A6g87DSnhy8mNJ4hzfMweBWTcraC4MxuOvXbF P3jYB4ziks5dP7gCsQnzuBpKAVOpBnq1jCY7iS63kkRAhkjnIwT49DEJbu4HYPinYiJ+ yd2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690961772; x=1691566572; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=B1ZhT/lHz8oBBSrpqok+uROkQ5qtTNN4HBw8QF0pmww=; b=d/JWz+KvmLHMR8lkhXVYk4E2SxAjlBTchg9Bpvbz+x34S1pjSU8HjXVndCmt9ry3hb j9o8xk0Vc9FRHWVhOXwXIWBw36xTyPzcIZ8dqKH1+cLcxL0g8hw9+d0W/AM+0FvsE41t JKReEPH66mVaAfK5eBgwU30koBd29YfnjwbJ/Ts2G3ssj0JpffIbzcs6T/xKkqsYlGYh o8lCjO2HvDmfy52cavFdbLE9LuThzIKHuK8mqUDyZQnTLgTwJv0icQN6d5bC+YWjuYlu FSDrVQ6gIS0It+B18dfa5hXSqDnRFdH8BSWPSJQ7ZPUbo28LvhFX7WN2ANM9M/Wgf7hI sq8A== X-Gm-Message-State: ABy/qLb260Xe9rjSX8p6INSXncCs0XXaNdrSzJyinYLdnPECpnX4CF0q UWV9UGWTMD0kPGKbwJyyQhTWwizJ0x8= X-Google-Smtp-Source: APBJJlEPli/uvxt6waH+HmaHgCHrH5VSsORRq/CzNW+jEMgkY46K93/aj4rLHpHlODwm94AuRNlksA== X-Received: by 2002:ac2:5e34:0:b0:4f8:6d54:72fb with SMTP id o20-20020ac25e34000000b004f86d5472fbmr3508354lfg.62.1690961771582; Wed, 02 Aug 2023 00:36:11 -0700 (PDT) Received: from dc78bmyyyyyyyyyyyyyct-3.rev.dnainternet.fi (dc78bmyyyyyyyyyyyyyct-3.rev.dnainternet.fi. [2001:14ba:16f8:1500::5]) by smtp.gmail.com with ESMTPSA id y4-20020ac24e64000000b004fdda72ec16sm2845547lfs.274.2023.08.02.00.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 00:36:10 -0700 (PDT) Date: Wed, 2 Aug 2023 10:35:55 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/3] Support ROHM BU27010 RGBC sensor Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Support ROHM BU27010 RGBC + flickering sensor. Following description copied from commit log: > The ROHM BU27010 is an RGBC sensor with a flickering detection FIFO. The > RGBC+IR sensor functionality is largely similar to what the BU27008 has. > There are some notable things though: > - gain setting is once again new and exotic. Now, there is 6bit gain > setting where 4 of the bits are common to all channels and 2 bits > can be configured separately for each channel. The BU27010 has > similar "1X on other channels vs 2X on IR when selector is 0x0" > gain design as BU27008 had. So, we use same gain setting policy for > BU27010 as we did for BU27008 - driver sets same gain selector for > all channels but shows the gains separately for all channels so users > can (at least in theory) detect this 1X vs 2X madness... > - BU27010 has suffled all the control register bitfields to new > addresses and bit positions while still keeping the register naming > same. > - Some more power/reset control is added. > - FIFO for "flickering detection" is added. > > The control register suffling made this slightly nasty. Still, it is > easier for maintenance perspective to add the BU27010 support in BU27008 > driver because - even though the bit positions/addresses were changed - > most of the driver structure can be re-used. Writing own driver for > BU27010 would mean plenty of duplicate code albeit a tad more clarity. Revision history: v2 => v3: - minor styling and added comment - rebased on iio-fixes-for-6.5a which contains prerequisite patches v1 => v2: - make vdd-supply required binding. - Some re-ordering for struct member init. - Some re-ordering for code to get rid of function declarations. - Tidy up the mess from patch 2/3. - Refactor parts from 3/3 to 2/3. - Clean-up commented out code and tidy things in general. --- Matti Vaittinen (3): dt-bindings: iio: ROHM BU27010 RGBC + flickering sensor iio: light: bu27008: add chip info iio: light: bd27008: Support BD27010 RGB .../bindings/iio/light/rohm,bu27010.yaml | 49 ++ drivers/iio/light/rohm-bu27008.c | 630 ++++++++++++++---- 2 files changed, 565 insertions(+), 114 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/light/rohm,bu27010.yaml base-commit: 8a4629055ef55177b5b63dab1ecce676bd8cccdd