From patchwork Sun Nov 6 01:56:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Alejandro_Concepci=C3=B3n_Rodr=C3=ADguez?= X-Patchwork-Id: 16058 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1277031wru; Sat, 5 Nov 2022 19:20:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Uhl9XhIbYZjWVWauzCeWoiBZb1hdxRWfd40j3e/EEpNEbnw7sin+pPsrdJZBBYOgwXoC2 X-Received: by 2002:a17:903:183:b0:187:4914:1def with SMTP id z3-20020a170903018300b0018749141defmr21563359plg.91.1667701204875; Sat, 05 Nov 2022 19:20:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667701204; cv=none; d=google.com; s=arc-20160816; b=opoX0ENfhTbLL4+RYSc2iSG2ip85ayjkP1Y3VTHCDhZHQ+/W1pNt9xPWQSgkYQ/e9x sGlx3I2slPbtac5kkEv8Ebaworj86bNq18cgJOrFpjur/o8fkNsyWGu+Enb3yDChUORc jzzH5Xbm40exYzo5xkhhphJMqIpJS7f3G0VtCkL/bnSv8FvZ8Z0IZ91T/HL0q1QisR19 SBxwUWAE4NwUzTM4NxUJ02QDyGGQG9CaqDkkS9xuNdgFeuyLtBCgYS7wX7AF7lQ49cKC hT0pdhZbGzEez0DqF/j3DOKQkHb760aMc/ColV+Gcpcb0ak7JPXQWFEr5m91XZiV6HdL A+4Q== 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 :feedback-id:message-id:subject:from:to:dkim-signature:date; bh=mQo/LrxITE3DqpUIqglGeTMcTvldRTD81SH3Ss+5aSc=; b=g6IF9K6MYL9OB5K4CAN9amgPBhowEOE/NRmXoEeFBzScvLMmElkBr2r4J/ejFD3SYz gVb6iw2kSBno3HIXaEsAQzmwSuAeh64H2YwS16D6RFANZ+SfDOjT5aC+aalx8QKa3mFS pOyf0cWcDRw9y2BUmlRpvY06nNzDh/uLTtk4uMD6tUe/stQT7pS4u60Bt87cJhTB2z5C AErMRbZ+FT6zeL2pUgf8BKziW7OIVMIuoVydSJDj6EKB+Ey7EaQ1ZOpon8GE0wKj6+h8 gzE+AQP0FlPPRlMmf3/lfjqm4RcDeokarJQiQDoz3syecE40DiyvUmLx0kHMoBI8DS0M u6IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@acoro.eu header.s=protonmail2 header.b=Q90Mc13z; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d2-20020a17090a02c200b00202880e0827si8289074pjd.28.2022.11.05.19.19.38; Sat, 05 Nov 2022 19:20:04 -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=@acoro.eu header.s=protonmail2 header.b=Q90Mc13z; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbiKFB5C (ORCPT + 99 others); Sat, 5 Nov 2022 21:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229579AbiKFB5A (ORCPT ); Sat, 5 Nov 2022 21:57:00 -0400 Received: from mail-4323.proton.ch (mail-4323.proton.ch [185.70.43.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7259410FEC for ; Sat, 5 Nov 2022 18:56:58 -0700 (PDT) Date: Sun, 06 Nov 2022 01:56:51 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acoro.eu; s=protonmail2; t=1667699815; x=1667959015; bh=mQo/LrxITE3DqpUIqglGeTMcTvldRTD81SH3Ss+5aSc=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=Q90Mc13zK3an+OLi+M1g7Kn33zBw0Vbdlk/A+9nx35u0KsLpflK1TYr81OpbTkBrx nGhUErXbzsxHwOiBcrYlQqlWp6p6s0g0yTyVoWo0g+xnk11WDPATO0F4Cu8Yd9ZlWS L0OzSu+DGUMfTMgDJPpS0gZ+/CrBw4m3faiVK0V7/72vKoiL4H7fIIrImsFV95jqRc TqInnJBd1Z6cw8G9dOh2f7WYurArojs/LGOaPTZljSedd0NJdN0KUYLflnoleIU+DX enF9mkqwIOqF/3IZuQMYcLDVftrGkyg3MznQv1Rc6381deJ4xD8sDRGz1vNpnc3+zL Bp6nkgqI0X7Kw== To: "matt.ranostay@konsulko.com" , "jic23@kernel.org" , "lars@metafoo.de" , "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" From: =?utf-8?q?Alejandro_Concepci=C3=B3n_Rodr=C3=ADguez?= Subject: [PATCH] iio: light: apds9960: fix wrong register for gesture gain Message-ID: Feedback-ID: 31930248:user:proton MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748711458444544285?= X-GMAIL-MSGID: =?utf-8?q?1748711458444544285?= Gesture Gain Control is in REG_GCONF_2 (0xa3), not in REG_CONFIG_2 (0x90). Fixes: aff268cd532e ("iio: light: add APDS9960 ALS + promixity driver") Signed-off-by: Alejandro Concepcion-Rodriguez Acked-by: Matt Ranostay --- drivers/iio/light/apds9960.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/apds9960.c b/drivers/iio/light/apds9960.c index b62c139baf41..38d4c7644bef 100644 --- a/drivers/iio/light/apds9960.c +++ b/drivers/iio/light/apds9960.c @@ -54,9 +54,6 @@ #define APDS9960_REG_CONTROL_PGAIN_MASK_SHIFT 2 #define APDS9960_REG_CONFIG_2 0x90 -#define APDS9960_REG_CONFIG_2_GGAIN_MASK 0x60 -#define APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT 5 - #define APDS9960_REG_ID 0x92 #define APDS9960_REG_STATUS 0x93 @@ -77,6 +74,9 @@ #define APDS9960_REG_GCONF_1_GFIFO_THRES_MASK_SHIFT 6 #define APDS9960_REG_GCONF_2 0xa3 +#define APDS9960_REG_GCONF_2_GGAIN_MASK 0x60 +#define APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT 5 + #define APDS9960_REG_GOFFSET_U 0xa4 #define APDS9960_REG_GOFFSET_D 0xa5 #define APDS9960_REG_GPULSE 0xa6 @@ -396,9 +396,9 @@ static int apds9960_set_pxs_gain(struct apds9960_data *data, int val) } ret = regmap_update_bits(data->regmap, - APDS9960_REG_CONFIG_2, - APDS9960_REG_CONFIG_2_GGAIN_MASK, - idx << APDS9960_REG_CONFIG_2_GGAIN_MASK_SHIFT); + APDS9960_REG_GCONF_2, + APDS9960_REG_GCONF_2_GGAIN_MASK, + idx << APDS9960_REG_GCONF_2_GGAIN_MASK_SHIFT); if (!ret) data->pxs_gain = idx; mutex_unlock(&data->lock);