Message ID | 20230731110239.107086-1-clamor95@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1960355vqg; Mon, 31 Jul 2023 04:56:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFmDnrlHhbUNgfur9hIeQHoosDCe4JyuiCqLFpAxb3sTNh9JTO9dV14USfQVY6c0ERIMAYY X-Received: by 2002:a05:6a00:894:b0:661:4a00:1ea5 with SMTP id q20-20020a056a00089400b006614a001ea5mr11635052pfj.20.1690804574957; Mon, 31 Jul 2023 04:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690804574; cv=none; d=google.com; s=arc-20160816; b=PCcgyxw2Lfmvqejm2yqs7CyP2VFJcZ4kkVSOPVpOhgfREEs/bfN3sqVqsc3+ykJGC2 rnIKn/9gjYqNP4YynMfrgTJNILseAgSbnQV7tbzor/4cifrVQT2Qd3X0MfDGMZHa0Jqv eL/BWuWixFQAmA/mIEI0kf0UaQu8JYWINJMVV3Q8dfqsX2ViiOHRVkxsfZYr4YXP5THU 5GRzvWE9QKcI2h5jmj9zsXU1Ig8BNvldx7fC/Dnyoykv9hGbBDMu3lpK+kHW6jMajMBJ 6L0F4/fYGWBb71HGRwkUgbH5EQcnfEplIPg8lMBBTWGXnmdrLsUUMeF6Cgt/8GzY6a1+ Tmfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=n83TuKNtAFb4aHweh9x4amkqhUIBkeAPvKSvQukr0II=; fh=Cqg9bSLHI6IcMQfoPfFj/2ZMBgtP9/bxMQtC63kOWJM=; b=Hwn4Q5XMV4VNuEqexWXKW8aX7mEO4qMEIj3yPeeQCJLGaWrXwwBdI968xc37JdHuFj DKUjXr9yiv32ct6WeIgMkga79m0Es42w7wJiVAV6uth0x8Ncq8r808n+JE/LewcSHbPT LufVi8ilfCWHXmZpcvBLBfGLQf+8yFpZa6FAdfjkKPjQqEQvXVkJslucqhR6yJaYB+Ig RGDNZ323lMvLOaXSZ5XRjlbki4E6W8yBhj16vQzn/s6It4ppabTgbxGmSzBrBxQMwUNz 03snWtfJjgWGav5m9cM8yG66Trr+vO82dCTQOF7qqjlhiYFgLQlXNZg4TLZWvhC5uzRn /Sxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VhKLvpLP; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fi18-20020a056a00399200b006634db9e11dsi6902181pfb.313.2023.07.31.04.56.02; Mon, 31 Jul 2023 04:56:14 -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=20221208 header.b=VhKLvpLP; 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 S231130AbjGaLDR (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Mon, 31 Jul 2023 07:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232367AbjGaLDE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 31 Jul 2023 07:03:04 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 210B711B; Mon, 31 Jul 2023 04:03:03 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4fe3c7f16bbso494188e87.0; Mon, 31 Jul 2023 04:03:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690801381; x=1691406181; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=n83TuKNtAFb4aHweh9x4amkqhUIBkeAPvKSvQukr0II=; b=VhKLvpLPA5Zm/laVXQYsAT2V/s1BvK0P63FQcvyabqU8qIVvb4BxJ/Be+ekTsa216S P/kc3Li6gESqr88cwaEUOv/RfauYZ+Zd7stFQYsk0Uvv/8IcQE5PYM6woEnmynHlP9/x M8IobLcsNE3rhRVlSbLo5ETKJefrPatR1z9GgZMKHLrNj42gzW/q2ErkafFsLwbmYDkw A0n//i2hEBSoOqceBqgAHmqvO19I47AybccBWOj3mKo7HXkn3eIre/2S+NAWTKzebjmo qRGgrHPjv8xhb0kIjqW9RxdbAvIK0Zk0HW4RTBmMVHBL21ujuUpNvwUuGxzMBE6h+NYP kXBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690801381; x=1691406181; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n83TuKNtAFb4aHweh9x4amkqhUIBkeAPvKSvQukr0II=; b=coeqb6KnJBFByVfQxRd6nDCiKnAK/P8YEA90axKXZgrB3K9Xz/oCKKYlUdLNKBr0dr pDvMPppho6bkrPjGmHHspXBQo8VwriEKweY6e92qtzqlHufJ+IQz3BZc0+gerECjcYR6 4dFTjtgjhyIk+/zYRuGpNVBKfZy8/illNhroDFBM9nHz8+iANtUSdthjPNdk5wXb0JI3 78f2MnK6L75qZsqKU6FoMsnRQ97aLtnnCxKW+paXdTscGURhsxgiyRLegAH9yvJcJBjj 13X+QsRgQpFr7lQBnuobpfVIEFnTZ/DPNSPXWvMmq0XRWArhNPDQ8toawxmNcA9MwUQV RTmQ== X-Gm-Message-State: ABy/qLYt2lHRIVRiIfjDk9+Ps1A9pU7oDKMJP2MVb8oDH18IfLkPxOgq xVIJVcb7S46ZCsDSL54Vf7g= X-Received: by 2002:a05:651c:120a:b0:2b7:33b9:8809 with SMTP id i10-20020a05651c120a00b002b733b98809mr6243104lja.16.1690801381028; Mon, 31 Jul 2023 04:03:01 -0700 (PDT) Received: from xeon.. ([188.163.112.48]) by smtp.gmail.com with ESMTPSA id p2-20020a2e8042000000b002b9bf5b071bsm74607ljg.20.2023.07.31.04.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 04:03:00 -0700 (PDT) From: Svyatoslav Ryhel <clamor95@gmail.com> To: Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Arnd Bergmann <arnd@arndb.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Svyatoslav Ryhel <clamor95@gmail.com>, Samu Onkalo <samu.p.onkalo@nokia.com> Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 0/2] Update APDS990x ALS to support device trees Date: Mon, 31 Jul 2023 14:02:37 +0300 Message-Id: <20230731110239.107086-1-clamor95@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_BLOCKED,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772937097815639335 X-GMAIL-MSGID: 1772937097815639335 |
Series |
Update APDS990x ALS to support device trees
|
|
Message
Svyatoslav Ryhel
July 31, 2023, 11:02 a.m. UTC
This patchset is the successor of a wider patch called 'Update APDS990x ALS to support IIO'. I have decided to divide it into two separate patches to ease review and submitting. All suggestions from the previous patchset were applied. This part is dedicated to including device tree support into APDS990x. APDS990x is a combined ambient light and proximity sensor. ALS and proximity functionality are highly connected. From mandatory properties required by device (apart of compatible and address on i2c line) are two supplies, interrupt, pdrive (LED drive current) and ppcount (the number of IR calibration pulses). These patches are oriented ONLY on bringing support of device tree into driver, pdrive and ppcount are mandatory and datasheet nor driver does not provide any reference values. Namings and compatible properties derive from the original driver name. Svyatoslav Ryhel (2): dt-bindings: iio: light: add apds990x binding misc: adps990x: convert to OF .../bindings/iio/light/avago,apds990x.yaml | 87 +++++++++++++++++++ drivers/misc/apds990x.c | 55 ++++++++++-- 2 files changed, 135 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds990x.yaml
Comments
On Mon, Jul 31, 2023, at 13:02, Svyatoslav Ryhel wrote:
> Add ability to use device tree bindings keeping existing setup.
I see that there are no more in-tree users of the old
apds990x_platform_data, so I think it would be best to completely
remove that codepath and merge that structure into struct
apds990x_chip, to simplify the probing and avoid the extra
allocation.
Arnd
31 липня 2023 р. 16:18:16 GMT+03:00, Arnd Bergmann <arnd@arndb.de> написав(-ла): >On Mon, Jul 31, 2023, at 13:02, Svyatoslav Ryhel wrote: >> Add ability to use device tree bindings keeping existing setup. > >I see that there are no more in-tree users of the old >apds990x_platform_data, so I think it would be best to completely >remove that codepath and merge that structure into struct >apds990x_chip, to simplify the probing and avoid the extra >allocation. Thank you very much for your review, but is it mandatory to drop pdata in this particular patch set? To be honest this driver needs serious upgrades and refactoring, and I have no dedication to invest my time into refactoring it, moreover, I am not a maintainer of this driver, nor a full time kernel maintainer of any kind. I am doing what I am doing only because one of my devices uses this als but it is not something crucial. Best regards, Svyatoslav R. > Arnd
On Mon, Jul 31, 2023, at 16:58, Svyatoslav Ryhel wrote: > 31 липня 2023 р. 16:18:16 GMT+03:00, Arnd Bergmann <arnd@arndb.de> написав(-ла): >>On Mon, Jul 31, 2023, at 13:02, Svyatoslav Ryhel wrote: >>> Add ability to use device tree bindings keeping existing setup. >> >>I see that there are no more in-tree users of the old >>apds990x_platform_data, so I think it would be best to completely >>remove that codepath and merge that structure into struct >>apds990x_chip, to simplify the probing and avoid the extra >>allocation. > > Thank you very much for your review, but is it mandatory to drop pdata > in this particular patch set? To be honest this driver needs serious > upgrades and refactoring, and I have no dedication to invest my time > into refactoring it, moreover, I am not a maintainer of this driver, > nor a full time kernel maintainer of any kind. I am doing what I am > doing only because one of my devices uses this als but it is not > something crucial. We have a lot of drivers that are lacking the cleanup I'm asking for, so I don't think I'd mandate it at this point, but I don't actually expect the patch to be any more complicated in the end, so just try it out. I think at the minimum, please remove the include/platform_data header and move the contents into the driver itself, I'd be fine with that. If you can easily do further cleanup by dropping the separate allocation and folding the apds990x_fw_probe() function back into apds990x_probe(), please do that, just stop at the point where you feel it gets too complicated. Arnd
On Mon, 31 Jul 2023 17:38:59 +0200 "Arnd Bergmann" <arnd@arndb.de> wrote: > On Mon, Jul 31, 2023, at 16:58, Svyatoslav Ryhel wrote: > > 31 липня 2023 р. 16:18:16 GMT+03:00, Arnd Bergmann <arnd@arndb.de> написав(-ла): > >>On Mon, Jul 31, 2023, at 13:02, Svyatoslav Ryhel wrote: > >>> Add ability to use device tree bindings keeping existing setup. > >> > >>I see that there are no more in-tree users of the old > >>apds990x_platform_data, so I think it would be best to completely > >>remove that codepath and merge that structure into struct > >>apds990x_chip, to simplify the probing and avoid the extra > >>allocation. > > > > Thank you very much for your review, but is it mandatory to drop pdata > > in this particular patch set? To be honest this driver needs serious > > upgrades and refactoring, and I have no dedication to invest my time > > into refactoring it, moreover, I am not a maintainer of this driver, > > nor a full time kernel maintainer of any kind. I am doing what I am > > doing only because one of my devices uses this als but it is not > > something crucial. > > We have a lot of drivers that are lacking the cleanup I'm asking > for, so I don't think I'd mandate it at this point, but I don't > actually expect the patch to be any more complicated in the end, > so just try it out. > > I think at the minimum, please remove the include/platform_data > header and move the contents into the driver itself, I'd be fine > with that. If you can easily do further cleanup by dropping > the separate allocation and folding the apds990x_fw_probe() > function back into apds990x_probe(), please do that, just stop > at the point where you feel it gets too complicated. > It's a long shot, but this looks pretty close in register map to the apds9960 in IIO. Maybe try adding the ID to that driver and cross your fingers? There is some stuff going on around the register address / commands that I haven't figured out but it looks similar for the byte access path and that may be all the IIO driver is using. If you are fine testing, it's possible someone else might do the leg work (if me I'll emulate just enough to convince myself I didn't break it too badly). Won't be high on my list, but maybe I'll get a boring wet weekend sometime... Jonathan > Arnd
1 серпня 2023 р. 21:10:26 GMT+03:00, Jonathan Cameron <jic23@kernel.org> написав(-ла): >On Mon, 31 Jul 2023 17:38:59 +0200 >"Arnd Bergmann" <arnd@arndb.de> wrote: > >> On Mon, Jul 31, 2023, at 16:58, Svyatoslav Ryhel wrote: >> > 31 липня 2023 р. 16:18:16 GMT+03:00, Arnd Bergmann <arnd@arndb.de> написав(-ла): >> >>On Mon, Jul 31, 2023, at 13:02, Svyatoslav Ryhel wrote: >> >>> Add ability to use device tree bindings keeping existing setup. >> >> >> >>I see that there are no more in-tree users of the old >> >>apds990x_platform_data, so I think it would be best to completely >> >>remove that codepath and merge that structure into struct >> >>apds990x_chip, to simplify the probing and avoid the extra >> >>allocation. >> > >> > Thank you very much for your review, but is it mandatory to drop pdata >> > in this particular patch set? To be honest this driver needs serious >> > upgrades and refactoring, and I have no dedication to invest my time >> > into refactoring it, moreover, I am not a maintainer of this driver, >> > nor a full time kernel maintainer of any kind. I am doing what I am >> > doing only because one of my devices uses this als but it is not >> > something crucial. >> >> We have a lot of drivers that are lacking the cleanup I'm asking >> for, so I don't think I'd mandate it at this point, but I don't >> actually expect the patch to be any more complicated in the end, >> so just try it out. >> >> I think at the minimum, please remove the include/platform_data >> header and move the contents into the driver itself, I'd be fine >> with that. If you can easily do further cleanup by dropping >> the separate allocation and folding the apds990x_fw_probe() >> function back into apds990x_probe(), please do that, just stop >> at the point where you feel it gets too complicated. >> > >It's a long shot, but this looks pretty close in register map to >the apds9960 in IIO. > >Maybe try adding the ID to that driver and cross your fingers? If you pay me for a broken phone or repair if smth goes wrong, sure, why not. >There is some stuff going on around the register address / commands >that I haven't figured out but it looks similar for the byte access >path and that may be all the IIO driver is using. > >If you are fine testing, it's possible someone else might do the >leg work (if me I'll emulate just enough to convince myself I didn't >break it too badly). Won't be high on my list, but maybe I'll get >a boring wet weekend sometime... > >Jonathan > >> Arnd >