From patchwork Sun Apr 30 18:20:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 678036 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 701F7C7EE2E for ; Sun, 30 Apr 2023 18:22:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbjD3SWN (ORCPT ); Sun, 30 Apr 2023 14:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjD3SWL (ORCPT ); Sun, 30 Apr 2023 14:22:11 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E141BD5; Sun, 30 Apr 2023 11:22:04 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id AEF0BCE0BF; Sun, 30 Apr 2023 18:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682878891; bh=Rcioak1SAMFJlnKdICBYsQ1IntIypnG/42IWMTd887s=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=e3CBwVQ+vDjjcwctlyKeDI9LBCw7lFU4H1JR5XuSc4nQr+8N6DDegJy/LhYItvnCy DI/CQ83ebAZH7rDtIaTMPsTmNi0J7N6VRp1nIG91bf82uR+L929JGDKth5b7Qg4BPc Y6SiyXzXcNTORGcyZRxtl2rWCHwEw5xxJc47LM7M= From: Luca Weiss Date: Sun, 30 Apr 2023 20:20:53 +0200 Subject: [PATCH 1/5] Input: drv260x - fix typo in register value define MIME-Version: 1.0 Message-Id: <20230430-drv260x-improvements-v1-1-1fb28b4cc698@z3ntu.xyz> References: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> In-Reply-To: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Dan Murphy , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Raffaele Tranquillini , Yassine Oudjana Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1144; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=Rcioak1SAMFJlnKdICBYsQ1IntIypnG/42IWMTd887s=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkTrGmVqx1JVXuZF03ok1L4liY6n8w5n0NzE5Pw g9IopH67DuJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZE6xpgAKCRBy2EO4nU3X VhXnD/9Ct/pZCBcdZhfz5v4cc6oT7pG6n+Lj1gY2sk3DMXkI3B8g39hQh0fU+IyBvISljIrrFvN jK7c/8P4BnnEOMGqEddSoRqXBwykY7k1aLOKQTR1nhCaTI7yIFrWFQ8cc0ojYAWym+k5pelyQd1 kAIGUysi6AM97LMOeS9PLJ+Ab1LvWTitLS1ipFTsi0qjVKrAu8MgFKCw09D/Sv6MPO/NESapDtJ 8x4mc+RyiBABxqYg6sYp9OYI13UqaSklGy4M7l679b/GwZJtDRR4OzExupJIA3bQ2bjkQnq8/pk dJjmID/21HwecrXe6OKDtwaSFP+xj31gWq8tnb9CwShjz5n1RziVh/WceLAYWfuBKcNRuEjbODb /n8yC47Hi6LkrmK1d8dz34cpuB3BzsqEjXaJq3pXIcQhO54e7Re9uTZ5l+Wh/adywdhIfhfDTzA 7j+b/aqASHj8Fb1CylnhQe0bj4ip0orjJNbs4sR21mLIUgLsgrBYXTMKmlfYfJn+EPGswzOTdUP TMZcH1YEVyhOxBXK3BPOSK66UNSXmG8o0IPxnQNvliVGnmncxW+b6dIH56hng8B84vAymPl9tRj 1FH6vx4eRQqNc04f8A0T9zwOYdOR6GBomVrxmDITQ436SFMsKT1vxgoAG/ZEyw67YvZf1x+E+F9 K35lw5u98rPQopg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org ANANLOG should be ANALOG. Fix the typo. Fixes: 7132fe4f5687 ("Input: drv260x - add TI drv260x haptics driver") Signed-off-by: Luca Weiss --- drivers/input/misc/drv260x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index 8a9ebfc04a2d..e95c4e775b5d 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -149,7 +149,7 @@ /* Control 3 Register */ #define DRV260X_LRA_OPEN_LOOP (1 << 0) -#define DRV260X_ANANLOG_IN (1 << 1) +#define DRV260X_ANALOG_IN (1 << 1) #define DRV260X_LRA_DRV_MODE (1 << 2) #define DRV260X_RTP_UNSIGNED_DATA (1 << 3) #define DRV260X_SUPPLY_COMP_DIS (1 << 4) @@ -322,7 +322,7 @@ static const struct reg_sequence drv260x_lra_init_regs[] = { DRV260X_BEMF_GAIN_3 }, { DRV260X_CTRL1, DRV260X_STARTUP_BOOST }, { DRV260X_CTRL2, DRV260X_SAMP_TIME_250 }, - { DRV260X_CTRL3, DRV260X_NG_THRESH_2 | DRV260X_ANANLOG_IN }, + { DRV260X_CTRL3, DRV260X_NG_THRESH_2 | DRV260X_ANALOG_IN }, { DRV260X_CTRL4, DRV260X_AUTOCAL_TIME_500MS }, }; From patchwork Sun Apr 30 18:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 678038 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 66CA6C77B7F for ; Sun, 30 Apr 2023 18:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229916AbjD3SVg (ORCPT ); Sun, 30 Apr 2023 14:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229513AbjD3SVf (ORCPT ); Sun, 30 Apr 2023 14:21:35 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AB6F1728; Sun, 30 Apr 2023 11:21:34 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 09A17CEB83; Sun, 30 Apr 2023 18:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682878892; bh=2KDm+MfmQDPFzRhM3HuRPWRDE4x8ieq6b/WlHIl9jK0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=YfpFwhRy8QJv97qougAH4t8sLJG+/Am0Bumbrt96VeHjGjj/Q/aOmWplSHNW46q+k RmaBlZlNEjjOai+CABQNobYyORT/0tZmBKcizGdcODdARBXmZk1agFmc+CjnLRWQXa JUXlnkHaWY24939X13CqV3E0yCFqbNeb75hq4njI= From: Luca Weiss Date: Sun, 30 Apr 2023 20:20:54 +0200 Subject: [PATCH 2/5] Input: drv260x - sleep between polling GO bit MIME-Version: 1.0 Message-Id: <20230430-drv260x-improvements-v1-2-1fb28b4cc698@z3ntu.xyz> References: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> In-Reply-To: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Dan Murphy , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Raffaele Tranquillini , Yassine Oudjana Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=830; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=2KDm+MfmQDPFzRhM3HuRPWRDE4x8ieq6b/WlHIl9jK0=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkTrGnuoEsRTAkX895HNLQSK31eIpbRae/YptSw 7CkOkDUZH6JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZE6xpwAKCRBy2EO4nU3X Vp5qEACtdUzv1B33TViLXCnVQagZdBhCzFgGnvNikuW5vMJOjg7aSJA8Aa1S0a5t5B5YOToCbCM QK2Sj28kuCYDnxaiFpfUL9Ip75zq4oM9dUudZ6VCmk0lEHs/ZXQQQYBiR/YcMzJ7yJsOXrMHPBk BmNPiU+SvcJrS69TPRDRmCUalgaiT/vpeynwcoSy4LDKLccTNYplmGrciXXERhQ7BF1inK/fz/w E8a4L4OWYuHpNqxSDAHsvw3jnE+Pk8GpGSJgO8Oivsr3yEUF7Qyt88EH5G8DiFKAScLaqabMDC1 HZIHs8pOgzz1mXKBB33DxYvS6j05WSYfKge0kFl0JVNasl4pK+DsnH1E5Q7+mFR6MqR9/+Xyyaf c7YeJwQlHXVAkPLm5A++c1wa5fmrMQEQgRMXY2ulEFvPZtfAaxcEZNOsIoPTjphPSLxJRdCzKrW KKUiem/rSn7IA6JdicfnMaySANKDSw0DL1zx0s8zW9CHt2v7+eQpnU2ErBALMzvvqqEtU0IdusZ FJwBvZAcVxNHWXLiLTsh7mS7i4zgynKjLbeae4u2+bzS2uxulMh9Xbn/Tm6Lx98eTS52wjo6wA+ V+7gKdPES8S8Y8zPfUwba7+YUNi1D9d41Ve8On8O9i/8iakZlqzfOh9esI3L0G1ambMAIhr+R4P bPfXMMt7GYldNMg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org When doing the initial startup there's no need to poll without any delay and spam the I2C bus. Let's sleep 15ms between each attempt, which is the same time as used in the vendor driver. Fixes: 7132fe4f5687 ("Input: drv260x - add TI drv260x haptics driver") Signed-off-by: Luca Weiss --- drivers/input/misc/drv260x.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index e95c4e775b5d..884d43eb4b61 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -435,6 +435,7 @@ static int drv260x_init(struct drv260x_data *haptics) } do { + usleep_range(15000, 15500); error = regmap_read(haptics->regmap, DRV260X_GO, &cal_buf); if (error) { dev_err(&haptics->client->dev, From patchwork Sun Apr 30 18:20:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 678179 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 99735C7EE2A for ; Sun, 30 Apr 2023 18:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231362AbjD3SWO (ORCPT ); Sun, 30 Apr 2023 14:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229596AbjD3SWM (ORCPT ); Sun, 30 Apr 2023 14:22:12 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 567FA2D54; Sun, 30 Apr 2023 11:22:04 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 4CEA1CEC7A; Sun, 30 Apr 2023 18:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682878892; bh=FvMcse6MLsbVxRrJLcTSsgg2rGTfDB1+G4bqmgYng0g=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=QzdUVnIMzqFjlITKUDtui4tr7rOVdAm0/LxRRS7T6mWAeMkTM2q41hQOVXIkQBlkG iM+FCyX6/PxmUftbS07lNkAbFW0cC49fNKrJ5t9CJPt3x7UyOFOjHP2+hYhzqS3u4d WMKNDCLCE3yRAoRLLtEmlxah6bSleFKONkE7vD4k= From: Luca Weiss Date: Sun, 30 Apr 2023 20:20:55 +0200 Subject: [PATCH 3/5] Input: drv260x - remove unused .reg_defaults MIME-Version: 1.0 Message-Id: <20230430-drv260x-improvements-v1-3-1fb28b4cc698@z3ntu.xyz> References: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> In-Reply-To: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Dan Murphy , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Raffaele Tranquillini , Yassine Oudjana Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2291; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=FvMcse6MLsbVxRrJLcTSsgg2rGTfDB1+G4bqmgYng0g=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkTrGozXcO/sDeRLWK6UMDpNHnsBPS252acBqw+ nkdYXgTM6CJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZE6xqAAKCRBy2EO4nU3X VmNeEADF84qF6eb0T7D21o0wIMKjLjMAlLI6jz5lemvrRO5uFx+Jt79NueiJ7F4DsCwT2O32QEH CGW5+7Ojl6DcCVbYa5JUveusxkYvIzGHzhAHkIZZqX1WC9EVmcEfhTs60YG7ITjJJp/PQUMAkWx 68xFx64MRWZPpM6xEqRiU58fzNDrBifxcJ2flHgZNPs5DVL+WTE2GwgmhqjvarmGg0vWG1Y8WX6 LEuo1k/w/fkckmfH+zbSuFsCEl2F9NeDSl9U6wDqe5f2Ju7Cz+OKe08ZdysLDF9UievUTAv9DCS +T/WudTv3LedVxWvsXO/9gT7BOk+lh3belqeresukkaDq6SmsiJHqQ2QzngyXdXdtXvTwpJ82Hl 80TwWqltK2kbZBZL1BGzuvRCG/5lV7/1lg6xxIiiRGdi9AnwvAoiiR0yIgvuaEfiW63o42hBzVF jLNwpfaZe/Tu6tceY0PuCjsQKLlaXt7jcdL2z8ZhXa8q2V5bOX42UCCdADLCwu7hX5VrcbJS4Cw gS71en1xDrBIjt7rmlWIWuOaFFZAN4/ybX/ZquS8rAD8UpcxKO4bhd58w4fI/w+IZiN+FS188xd 5gYJ00C81ni4t0V4GAtI8k3ZHV5bWBmiBPCHyps41yveNMSf9Fciya5+9W+OoMxthG5XR7VMEWO PxLxfUK8vaPJdQg== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Since the driver has disabled regmap caching with REGCACHE_NONE, it's warning us that we provide defaults that are not used. Remove them. [ 0.561159] drv260x-haptics 0-005a: No cache used with register defaults set! Fixes: 7132fe4f5687 ("Input: drv260x - add TI drv260x haptics driver") Signed-off-by: Luca Weiss --- drivers/input/misc/drv260x.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index 884d43eb4b61..a7e3120bdc13 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -193,44 +193,6 @@ struct drv260x_data { int overdrive_voltage; }; -static const struct reg_default drv260x_reg_defs[] = { - { DRV260X_STATUS, 0xe0 }, - { DRV260X_MODE, 0x40 }, - { DRV260X_RT_PB_IN, 0x00 }, - { DRV260X_LIB_SEL, 0x00 }, - { DRV260X_WV_SEQ_1, 0x01 }, - { DRV260X_WV_SEQ_2, 0x00 }, - { DRV260X_WV_SEQ_3, 0x00 }, - { DRV260X_WV_SEQ_4, 0x00 }, - { DRV260X_WV_SEQ_5, 0x00 }, - { DRV260X_WV_SEQ_6, 0x00 }, - { DRV260X_WV_SEQ_7, 0x00 }, - { DRV260X_WV_SEQ_8, 0x00 }, - { DRV260X_GO, 0x00 }, - { DRV260X_OVERDRIVE_OFF, 0x00 }, - { DRV260X_SUSTAIN_P_OFF, 0x00 }, - { DRV260X_SUSTAIN_N_OFF, 0x00 }, - { DRV260X_BRAKE_OFF, 0x00 }, - { DRV260X_A_TO_V_CTRL, 0x05 }, - { DRV260X_A_TO_V_MIN_INPUT, 0x19 }, - { DRV260X_A_TO_V_MAX_INPUT, 0xff }, - { DRV260X_A_TO_V_MIN_OUT, 0x19 }, - { DRV260X_A_TO_V_MAX_OUT, 0xff }, - { DRV260X_RATED_VOLT, 0x3e }, - { DRV260X_OD_CLAMP_VOLT, 0x8c }, - { DRV260X_CAL_COMP, 0x0c }, - { DRV260X_CAL_BACK_EMF, 0x6c }, - { DRV260X_FEEDBACK_CTRL, 0x36 }, - { DRV260X_CTRL1, 0x93 }, - { DRV260X_CTRL2, 0xfa }, - { DRV260X_CTRL3, 0xa0 }, - { DRV260X_CTRL4, 0x20 }, - { DRV260X_CTRL5, 0x80 }, - { DRV260X_LRA_LOOP_PERIOD, 0x33 }, - { DRV260X_VBAT_MON, 0x00 }, - { DRV260X_LRA_RES_PERIOD, 0x00 }, -}; - #define DRV260X_DEF_RATED_VOLT 0x90 #define DRV260X_DEF_OD_CLAMP_VOLT 0x90 @@ -453,8 +415,6 @@ static const struct regmap_config drv260x_regmap_config = { .val_bits = 8, .max_register = DRV260X_MAX_REG, - .reg_defaults = drv260x_reg_defs, - .num_reg_defaults = ARRAY_SIZE(drv260x_reg_defs), .cache_type = REGCACHE_NONE, }; From patchwork Sun Apr 30 18:20:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 678180 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 14ECAC7EE24 for ; Sun, 30 Apr 2023 18:21:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231166AbjD3SVg (ORCPT ); Sun, 30 Apr 2023 14:21:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjD3SVf (ORCPT ); Sun, 30 Apr 2023 14:21:35 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E9171735; Sun, 30 Apr 2023 11:21:34 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 941D2CEC7B; Sun, 30 Apr 2023 18:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682878892; bh=EZ5Rl1sRU/1EQS0k2DDIMWm8qZwGVK/duzJDHMh9kC0=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=WADf2dd18dVdmfXoeHoeYASPOfcjoNL2GBf3mbQUfOU6BIZ/kmc/M8kK9eLNy3CLx UrCklO1iH3o8nHiD2xJ3WRG0rbwfsr8ewLdjiEe6ztucoMkjpM6bZx3YAKUn6s4aXN c8ZkDtbsw6q6tAZ3Vw37jitXWwig+OciR7oNxMJk= From: Luca Weiss Date: Sun, 30 Apr 2023 20:20:56 +0200 Subject: [PATCH 4/5] Input: drv260x - fix magnitude handling MIME-Version: 1.0 Message-Id: <20230430-drv260x-improvements-v1-4-1fb28b4cc698@z3ntu.xyz> References: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> In-Reply-To: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Dan Murphy , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Raffaele Tranquillini , Yassine Oudjana Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3279; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=EZ5Rl1sRU/1EQS0k2DDIMWm8qZwGVK/duzJDHMh9kC0=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkTrGpFTH1r2XTDSQoOggy0k37nDYdgmhMHY8io +kbTgYBwjWJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZE6xqQAKCRBy2EO4nU3X Vp7uD/wP8XraDh/XqKDzUTo1JaxFCo/o8Q3S3iSlvep48xHb2HU2/AHSnJNlT/6osYanqta5V4P fRJR3QKt2BzYtBPwyBvaJxyrlG0lG5b4Kzpm3TY/PPzVVcWYj+uF1GauyAB2OJOLL/UU9I4/HjF g0FCNKtEUL2oQkGazD323lcD9gRwhijP6625vM3Xrqan/MihHkH/k22gt2rRfsk9iTctXTNfxH2 Q/i9gJwayvQUVD1uIfMw0glbEwjpcxVOpn1w9/rqeE2OstoS96cwkxkQUeOenFRbO1H0wmYRR2m ruTlRgNZwViC4fNKPfqJqcI5WounrCo3V5BGJOY3Xdv1FIXuuoZeImdCimK5Hr9uZTNDvcFeK66 VnNDGzyZ/41cklfT4S8h56w4OTOsPG7sScUwI+WAF9sZbemdigPBtf1/LwArRxgM7l/vbOo5O5f fCeKFK8MWlIliML/I/xqiFpAoA6pZ8QZ5cCOpsYHvfrK6gKNsrkAIKC4fyHVlBS+4wjZDBSs6Mz DvmWTb+3mYuAmm0Y9WVFUI5vPMXizhJjGgeMlzXAayzxt/c751kTME6seR/0oLc/yeLJAjLGwt0 uOQwoHptjTivwZX3b/IIylq1MDPzYLS5zJNLygRurNoIZ1Vj5oKPhmPmw6x/r9WovWGKWBe5UNG TdilpRwndiil81w== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org First of all, previously the 16-bit magnitude was written as-is to the device which actually discarded the upper 8 bits since the device has 8-bit registers only. This meant that a strong_magnitude of 0xFF00 would result in 0. To correct this shift the strong_magnitude / weak_magnitude input values so we discard the lower 8 bits and keep the upper bits instead. Secondly the RTP mode that is used by default interprets the values as signed (2s complement), so 0x81 = 0%, 0x00 = 50%, 0x7F = 100%. This doesn't match the FF_RUMBLE interface at all, so let's tell the device to interpret the data as unsigned instead which gets us 0x00 = 0% and 0xFF = 100%. As last change switch ERM to using "Closed-Loop Mode, Unidirectional" instead of "Open-Loop Mode" since it's recommended by the datasheet compared to open loop and better matches our use case of 0% - 100% vibration. Signed-off-by: Luca Weiss --- drivers/input/misc/drv260x.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index a7e3120bdc13..f5e96b36acda 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -186,7 +186,7 @@ struct drv260x_data { struct work_struct work; struct gpio_desc *enable_gpio; struct regulator *regulator; - u32 magnitude; + u8 magnitude; u32 mode; u32 library; int rated_voltage; @@ -237,10 +237,11 @@ static int drv260x_haptics_play(struct input_dev *input, void *data, haptics->mode = DRV260X_LRA_NO_CAL_MODE; + /* Scale u16 magnitude into u8 register value */ if (effect->u.rumble.strong_magnitude > 0) - haptics->magnitude = effect->u.rumble.strong_magnitude; + haptics->magnitude = effect->u.rumble.strong_magnitude >> 8; else if (effect->u.rumble.weak_magnitude > 0) - haptics->magnitude = effect->u.rumble.weak_magnitude; + haptics->magnitude = effect->u.rumble.weak_magnitude >> 8; else haptics->magnitude = 0; @@ -266,7 +267,7 @@ static void drv260x_close(struct input_dev *input) static const struct reg_sequence drv260x_lra_cal_regs[] = { { DRV260X_MODE, DRV260X_AUTO_CAL }, - { DRV260X_CTRL3, DRV260X_NG_THRESH_2 }, + { DRV260X_CTRL3, DRV260X_NG_THRESH_2 | DRV260X_RTP_UNSIGNED_DATA }, { DRV260X_FEEDBACK_CTRL, DRV260X_FB_REG_LRA_MODE | DRV260X_BRAKE_FACTOR_4X | DRV260X_LOOP_GAIN_HIGH }, }; @@ -284,7 +285,7 @@ static const struct reg_sequence drv260x_lra_init_regs[] = { DRV260X_BEMF_GAIN_3 }, { DRV260X_CTRL1, DRV260X_STARTUP_BOOST }, { DRV260X_CTRL2, DRV260X_SAMP_TIME_250 }, - { DRV260X_CTRL3, DRV260X_NG_THRESH_2 | DRV260X_ANALOG_IN }, + { DRV260X_CTRL3, DRV260X_NG_THRESH_2 | DRV260X_RTP_UNSIGNED_DATA | DRV260X_ANALOG_IN }, { DRV260X_CTRL4, DRV260X_AUTOCAL_TIME_500MS }, }; @@ -299,7 +300,7 @@ static const struct reg_sequence drv260x_erm_cal_regs[] = { { DRV260X_CTRL1, DRV260X_STARTUP_BOOST }, { DRV260X_CTRL2, DRV260X_SAMP_TIME_250 | DRV260X_BLANK_TIME_75 | DRV260X_IDISS_TIME_75 }, - { DRV260X_CTRL3, DRV260X_NG_THRESH_2 | DRV260X_ERM_OPEN_LOOP }, + { DRV260X_CTRL3, DRV260X_NG_THRESH_2 | DRV260X_RTP_UNSIGNED_DATA }, { DRV260X_CTRL4, DRV260X_AUTOCAL_TIME_500MS }, }; From patchwork Sun Apr 30 18:20:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 678178 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 4CE7FC77B7C for ; Sun, 30 Apr 2023 18:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230319AbjD3SWR (ORCPT ); Sun, 30 Apr 2023 14:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231339AbjD3SWN (ORCPT ); Sun, 30 Apr 2023 14:22:13 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78DA63A95; Sun, 30 Apr 2023 11:22:06 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id CB6AFCEC7E; Sun, 30 Apr 2023 18:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682878892; bh=6bCrTKda13xPY5f1VJTbxhuiRyrVSBhJ2Q3JkSdwSwU=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=dpzZ866qVshjzoAdtJ+fwGoSuUs5QhvD5PkvqA3QrW9Ag3VM3jM1AJ8hLhA3XrTW1 CDv8Df834l/u8zc13slqwInIDK8ERAkxBAGpHpxjFbQiF2TrXD9Q32BlXfuSji8uRR ViR/XEc7Vz2OOC7PTvDbmIzl+a7DtUeBwXMp58O0= From: Luca Weiss Date: Sun, 30 Apr 2023 20:20:57 +0200 Subject: [PATCH 5/5] ARM: dts: qcom: apq8026-huawei-sturgeon: Add vibrator MIME-Version: 1.0 Message-Id: <20230430-drv260x-improvements-v1-5-1fb28b4cc698@z3ntu.xyz> References: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> In-Reply-To: <20230430-drv260x-improvements-v1-0-1fb28b4cc698@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Dan Murphy , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Raffaele Tranquillini , Yassine Oudjana Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1566; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=6bCrTKda13xPY5f1VJTbxhuiRyrVSBhJ2Q3JkSdwSwU=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkTrGqMepVl5GlUtx/9cga8r2gsT8UvbaoHuuDc avyDq94ivuJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZE6xqgAKCRBy2EO4nU3X VqkBD/9v3tkZcH5QM/3qIv9jjRP3KRJMxw9KYu+KrkT21uShdAZxRoQ/Q4pztT99sxUcHZFtJpQ g6bNcsTKK5TPkiiUL5oJYZpkvFnC04jcQQ2O+r86sy72XmGco/8CN4t49M/1N0LMwaXgo9+IVx/ y1tsr9//8aiMPsgt196tXGS8zKYFE5M+lD2j2xi7Z4NJGejCNnDMYvFvofz+icifvMouJde5atu SDUXwrDRsqSy081qvDilRaN1onJVDcnV0N+RQ4azFSI7uzIoLwwgFNh9aMwS14vmgkV43MIVzq0 Olj+gjIZtZTBs92jCkN+ji5vku5dTRb2+dbY29SgLkFzQwuGf9PnG+AN2rOZXxG80AGUW3auJsZ iTRF5/ylGgln3q3Ff1gCcv5hHmqJsPJe5TZSKeGehJw9/0pzvcAfdeJDb+MLxqaVClz32Qx2BHL alFOi/mYdwM5+8J9cKIShzoBsNdHaD/UKJXd1NVJG3afV8Kla+Pi+l3blFf/x1J38caTex1w6Mv MKvx8Wri9/ZWp5eAYc8VxlKdgxN8h99kyG/3chOMKqUDWseFrPJ2LjqsVIyRwWTJKTkSwcOkFV8 mGZHTPhXga32gABrs6vGeMHCu4VokS/vjffQdWNiJPrpIkcbPrtgWNfFhRMLjekTPoydQyhp+WN zL0N6RvrXN3eFMw== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The watch has a DRV2605 for haptics. Add a node for it based on the values found in the downstream board file. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio --- arch/arm/boot/dts/qcom-apq8026-huawei-sturgeon.dts | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/boot/dts/qcom-apq8026-huawei-sturgeon.dts b/arch/arm/boot/dts/qcom-apq8026-huawei-sturgeon.dts index d64096028ab1..eb73b992a696 100644 --- a/arch/arm/boot/dts/qcom-apq8026-huawei-sturgeon.dts +++ b/arch/arm/boot/dts/qcom-apq8026-huawei-sturgeon.dts @@ -7,6 +7,7 @@ #include "qcom-msm8226.dtsi" #include "qcom-pm8226.dtsi" +#include /delete-node/ &adsp_region; @@ -68,6 +69,26 @@ &adsp { status = "okay"; }; +&blsp1_i2c2 { + clock-frequency = <384000>; + + status = "okay"; + + vibrator@5a { + compatible = "ti,drv2605"; + reg = <0x5a>; + enable-gpios = <&tlmm 60 GPIO_ACTIVE_HIGH>; + + mode = ; + library-sel = ; + vib-rated-mv = <2765>; + vib-overdrive-mv = <3525>; + + pinctrl-0 = <&vibrator_default_state>; + pinctrl-names = "default"; + }; +}; + &blsp1_i2c5 { clock-frequency = <384000>; @@ -347,6 +368,13 @@ reset-pins { }; }; + vibrator_default_state: vibrator-default-state { + pins = "gpio59", "gpio60"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + }; + wlan_hostwake_default_state: wlan-hostwake-default-state { pins = "gpio66"; function = "gpio";