From patchwork Thu Apr 27 20:34:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 677626 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 2C7F3C7EE22 for ; Thu, 27 Apr 2023 20:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344283AbjD0Ue6 (ORCPT ); Thu, 27 Apr 2023 16:34:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344266AbjD0Ue4 (ORCPT ); Thu, 27 Apr 2023 16:34:56 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7258D3C07; Thu, 27 Apr 2023 13:34:54 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 2135FC76A8; Thu, 27 Apr 2023 20:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682627692; bh=XjGdRhsmtUEv3bL4pUwAXfQDROOKgUXLSYiUh/MFUrQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=ZgHtK0UoWneELUdHO6tFQX/gYw6e0e5yN8l3Oe5UwMDXvg3YUVGb5+SjamFpOrmVV Rh4DRAvt0gt3v1szg3AXT/3FgQIxs5NWpkMp+vCJWxNxqRv3iYe/TIrHx3kEjYcvxV u0/UiMDOE5kf4Yqbo0BpJDw2B1AiK5bU1oYig0oc= From: Luca Weiss Date: Thu, 27 Apr 2023 22:34:26 +0200 Subject: [PATCH 1/4] dt-bindings: input: pwm-vibrator: Add enable-gpio MIME-Version: 1.0 Message-Id: <20230427-hammerhead-vibra-v1-1-e87eeb94da51@z3ntu.xyz> References: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> In-Reply-To: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Sebastian Reichel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Brian Masney Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=740; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=XjGdRhsmtUEv3bL4pUwAXfQDROOKgUXLSYiUh/MFUrQ=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkStxkdAWfDnqz7TT/GzawAYKxSbg4VfTYvJYj3 9mZFU6UGb2JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZErcZAAKCRBy2EO4nU3X VqD+EAC3ymL3raVAm5oHlfbA4tZF+cRBNV+pegJxIBpJoalzqCt7AW5ZK2vLhEe7iPVFp4Lzoi3 FDTq3G9Eza2r6Nm8k7tgnRwWSAdpkG5yEWMVfFjgKkG3qUbsmxu2QOCkr4Z08OvZTv0LopyeHsy OY433yovFjEB21j5KAix4HRHFd1Ce01k4wOceHfWFSd4liia02jE8GBwBuOUYmlmY3FbCHFKn2X 9g3X9osAYzeiC2myDQ7+je6C5XaE/y8F40VxZsZx4xgVdI0jiUi9qyZow7//5EEwb2ljJlJagY1 e2dXBY8czw5UtoKGZ09KUqeRUi3dS9mRRmt7iZhzHqGjXy7YPnffBvWm4oEDFiPFl0W9tFyipHe h3y8w+jx3Bhpmob4Fb6USpKxvyF/w0008gIGYPEiewNHhSA2ITsBHmj3jMG7f52cCSDO5VOdY4R 11YY2zSpVSClI9jfwvQLlPJT+TRPav+jsEuF2aXl9ahSKpTC37nZnW+rXbskAHP3LoGKZn12FU1 haK3ztGRJDvCu3xu5pstp0vpI7+WMg7N9nxglV7c+h57Tb7wX0WehgfDZfNqlEs0+ThUNJivytF AMIQGcuC9Yhf5b+naYJ2IGkyDAOOpt1fq3ekDBXGpCiOT5SWbWeXzQcVJjyg7rsfl3jQquzEwf6 yMQKVZPy2sU5GnQ== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Some pwm vibrators have a dedicated enable GPIO that needs to be set high so that the vibrator works. Document that. Signed-off-by: Luca Weiss Reviewed-by: Brian Masney Reviewed-by: Caleb Connolly Reviewed-by: Sebastian Reichel Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/input/pwm-vibrator.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/input/pwm-vibrator.yaml b/Documentation/devicetree/bindings/input/pwm-vibrator.yaml index d32716c604fe..6398534b43c3 100644 --- a/Documentation/devicetree/bindings/input/pwm-vibrator.yaml +++ b/Documentation/devicetree/bindings/input/pwm-vibrator.yaml @@ -32,6 +32,8 @@ properties: minItems: 1 maxItems: 2 + enable-gpios: true + vcc-supply: true direction-duty-cycle-ns: From patchwork Thu Apr 27 20:34:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 677928 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 03E97C77B7E for ; Thu, 27 Apr 2023 20:35:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245540AbjD0Ufo (ORCPT ); Thu, 27 Apr 2023 16:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231563AbjD0Ufn (ORCPT ); Thu, 27 Apr 2023 16:35:43 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F70F4496; Thu, 27 Apr 2023 13:35:24 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 57E8CCE0C1; Thu, 27 Apr 2023 20:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682627692; bh=p922sNIfNiwflTrQNfKaHaOev78sv9e3hzmwAJNBX9E=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=T46tznhR2VZ1ohf0TbWvOVBzT1A52JxbtQcOoLN6aZCVG+Pcd+4EgVUm2cHhvqTC5 IMk+81b1trddhCKEXSOxwns58AWZ4libR+9Skm+RZLXundFA7P4kScNSd28dRa34rv XkVB2Uck83bitmeeaSb7tLGOw40VUDVFwr2F14D0= From: Luca Weiss Date: Thu, 27 Apr 2023 22:34:27 +0200 Subject: [PATCH 2/4] Input: pwm-vibra - add newline to dev_err prints MIME-Version: 1.0 Message-Id: <20230427-hammerhead-vibra-v1-2-e87eeb94da51@z3ntu.xyz> References: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> In-Reply-To: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Sebastian Reichel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Brian Masney Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3551; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=p922sNIfNiwflTrQNfKaHaOev78sv9e3hzmwAJNBX9E=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkStxlDv0aKCkhM1092jPP3TzJwgfzVji8WY9yL cwsMY+umYiJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZErcZQAKCRBy2EO4nU3X Vv0TEAC7PUqVbheNI7KK7uopE7LtMV0YovMzqYw4q3RPBjn4trxFOvkOM+7q4o6N6V9HW6I9S1O 4TuoB9EWFWd8pcR40AXYLSrDKrrU421qZOkDafehQP64Z4Rteeri9/3GbFL8tUCsTHrJrztL7Wx LtJyfhDZCNjOQ3uStKj3glbfQqo5eauPKaLJEOzsJEr5yOC3oj+DPdt3aeSSuHjEDvuG7vVPxA1 DGWMf5dz+hJGnTs+hiNlRdIhC9Y6FLwBcQ0MBlmtOxLz/aBUUa2EZyKbF3H1Dg1PgNwYqkotbQP AMSx9jkh5ECL6WXSt3wRTopyrK8ZObXp+GwYyx9cD4bZBbWNZRC3AbF0KIHbfnVk68qX2aHEve6 S2LbJpwtG93jYhTcOqWeNVhB9JG+HrxUMt9yGPo9WzZlsZJbFk4C8L7O3K+ZC/Dam90H8JEkokG MT8U+rHYBMjbgUcx2hP3+a+quTGv4H9zjzcoSM7X6ZughIEdsnhQ8fg+RQczNGQFrStyk81icUn ARRQm3gQKrtKEopNSTrSJhGJ8gBxY46p3lLNq2YW0R0nSgpHgRwoCNwd3anQTHnwy14x86PH/Im X4K7r/7Tc/EBX/FUDJkW3UxCAfKNUvqLKZ6srxcHefQncVT2Pu50kcrSueSEg7eZGas/XCYOv8i zEEWLyFbekmvb4w== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Make sure all printed messages end with a newline. Signed-off-by: Luca Weiss --- drivers/input/misc/pwm-vibra.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index d0e58a7cdfa3..c08971c97ad6 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -42,7 +42,7 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) if (!vibrator->vcc_on) { err = regulator_enable(vibrator->vcc); if (err) { - dev_err(pdev, "failed to enable regulator: %d", err); + dev_err(pdev, "failed to enable regulator: %d\n", err); return err; } vibrator->vcc_on = true; @@ -54,7 +54,7 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) err = pwm_apply_state(vibrator->pwm, &state); if (err) { - dev_err(pdev, "failed to apply pwm state: %d", err); + dev_err(pdev, "failed to apply pwm state: %d\n", err); return err; } @@ -65,7 +65,7 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) err = pwm_apply_state(vibrator->pwm_dir, &state); if (err) { - dev_err(pdev, "failed to apply dir-pwm state: %d", err); + dev_err(pdev, "failed to apply dir-pwm state: %d\n", err); pwm_disable(vibrator->pwm); return err; } @@ -137,7 +137,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev) err = PTR_ERR_OR_ZERO(vibrator->vcc); if (err) { if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to request regulator: %d", + dev_err(&pdev->dev, "Failed to request regulator: %d\n", err); return err; } @@ -146,7 +146,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev) err = PTR_ERR_OR_ZERO(vibrator->pwm); if (err) { if (err != -EPROBE_DEFER) - dev_err(&pdev->dev, "Failed to request main pwm: %d", + dev_err(&pdev->dev, "Failed to request main pwm: %d\n", err); return err; } @@ -158,7 +158,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev) state.enabled = false; err = pwm_apply_state(vibrator->pwm, &state); if (err) { - dev_err(&pdev->dev, "failed to apply initial PWM state: %d", + dev_err(&pdev->dev, "failed to apply initial PWM state: %d\n", err); return err; } @@ -172,7 +172,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev) state.enabled = false; err = pwm_apply_state(vibrator->pwm_dir, &state); if (err) { - dev_err(&pdev->dev, "failed to apply initial PWM state: %d", + dev_err(&pdev->dev, "failed to apply initial PWM state: %d\n", err); return err; } @@ -189,7 +189,7 @@ static int pwm_vibrator_probe(struct platform_device *pdev) break; default: - dev_err(&pdev->dev, "Failed to request direction pwm: %d", err); + dev_err(&pdev->dev, "Failed to request direction pwm: %d\n", err); fallthrough; case -EPROBE_DEFER: @@ -207,13 +207,13 @@ static int pwm_vibrator_probe(struct platform_device *pdev) err = input_ff_create_memless(vibrator->input, NULL, pwm_vibrator_play_effect); if (err) { - dev_err(&pdev->dev, "Couldn't create FF dev: %d", err); + dev_err(&pdev->dev, "Couldn't create FF dev: %d\n", err); return err; } err = input_register_device(vibrator->input); if (err) { - dev_err(&pdev->dev, "Couldn't register input dev: %d", err); + dev_err(&pdev->dev, "Couldn't register input dev: %d\n", err); return err; } From patchwork Thu Apr 27 20:34:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 677624 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 89E6AC7EE25 for ; Thu, 27 Apr 2023 20:35:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344257AbjD0Ufr (ORCPT ); Thu, 27 Apr 2023 16:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344222AbjD0Ufp (ORCPT ); Thu, 27 Apr 2023 16:35:45 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B2ED4EE2; Thu, 27 Apr 2023 13:35:24 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id 89EF7CEB9B; Thu, 27 Apr 2023 20:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682627692; bh=6GdnfYGYIClKnqTCFJOePAiIDqCEBDJIJs44RnWeNMI=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=BM38CsTAC+YX33G+87YR05wbDvYb23JPCjo0lqbtV17DCJDM8X8RZLaIMtxKcs9Rw WRz3Ta2BpFF5xlIpY/fivSlPJsRFxPyvvRMlIaqeZ5Mh0XCI7iApbWZ7JZlvbpicsy /nYoorwoxCBHxFAVGCQVCsuFY/Tz8r3PtF6uX3q4= From: Luca Weiss Date: Thu, 27 Apr 2023 22:34:28 +0200 Subject: [PATCH 3/4] Input: pwm-vibra - add support for enable GPIO MIME-Version: 1.0 Message-Id: <20230427-hammerhead-vibra-v1-3-e87eeb94da51@z3ntu.xyz> References: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> In-Reply-To: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Sebastian Reichel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Brian Masney Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2007; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=6GdnfYGYIClKnqTCFJOePAiIDqCEBDJIJs44RnWeNMI=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkStxqKLWCk5HSYfAn/q5yapUULHi+KQnW6QcqU 51pZNACtoaJAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZErcagAKCRBy2EO4nU3X VkdDD/4/kj0m621vJLriUUkQ56LQdegmfkofZe7OHLc+QWGt81G53U5PdRd7p49dS0TDhooBOYM tNeg4wWAjcySxYfn7mIAVLLON9JPCdlO6s3SaG1ERe+T6JfmnjLWTnCN+vqP6kHZFM72KJCqjNC THlLjjVEC3QqBqiZyU7MDo9EDZ5ci0Dra8daI/7rGfJYhfK4Io3SU6nHpfQgSfGkjtZ2NelrWRQ qki789fAy4F7LTfNdGDwPixoaVSto3ILUAZisMl3+FnAhgTYOBbU/kZDc91A5sx1Qs/B4+AKryg 7LJJLXhj+qxm/TaQH6Jt8XIG7Ci6u6oRCqZauWJbcF5aNlsbvYdzqUB2LWBS/brzmDAgvB1TyM0 matK94MSkmy9RMwaTSLBTXwKoRMqF5/hDnAKuJkt/NkfSzcJHcY79sPGB8oP4XVRSAq+NEq6wPx AdbIAhQSo9IMtN8IL53gRMhFmez3YJK1dMpaNmWvHNDNQ5gbSQvFqc8MWo0XtaI4sP6/d1qsEzf X4Fx047lSEK0vcUQ7I9nrhMLXJNqTwx5XoQ/v83jE+DHhz+bjqZUyNMUEAr4e00KP9SP90G/+sP ilXtQZ3xVlSQ+/fpcuuSV8AMERYnuRXsPODnO9xwgy0uMenqby57VD3GOfxx0STzUd6klW8VLFV 8zKb7kSFmESLnuA== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Some pwm vibrators have a dedicated enable GPIO that needs to be set high so that the vibrator works. Add support for that optionally. Signed-off-by: Luca Weiss Reviewed-by: Brian Masney Reviewed-by: Caleb Connolly Reviewed-by: Sebastian Reichel --- drivers/input/misc/pwm-vibra.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c index c08971c97ad6..2ba035299db8 100644 --- a/drivers/input/misc/pwm-vibra.c +++ b/drivers/input/misc/pwm-vibra.c @@ -11,6 +11,7 @@ * Copyright (C) 2010, Lars-Peter Clausen */ +#include #include #include #include @@ -23,6 +24,7 @@ struct pwm_vibrator { struct input_dev *input; + struct gpio_desc *enable_gpio; struct pwm_device *pwm; struct pwm_device *pwm_dir; struct regulator *vcc; @@ -48,6 +50,8 @@ static int pwm_vibrator_start(struct pwm_vibrator *vibrator) vibrator->vcc_on = true; } + gpiod_set_value_cansleep(vibrator->enable_gpio, 1); + pwm_get_state(vibrator->pwm, &state); pwm_set_relative_duty_cycle(&state, vibrator->level, 0xffff); state.enabled = true; @@ -80,6 +84,8 @@ static void pwm_vibrator_stop(struct pwm_vibrator *vibrator) pwm_disable(vibrator->pwm_dir); pwm_disable(vibrator->pwm); + gpiod_set_value_cansleep(vibrator->enable_gpio, 0); + if (vibrator->vcc_on) { regulator_disable(vibrator->vcc); vibrator->vcc_on = false; @@ -142,6 +148,16 @@ static int pwm_vibrator_probe(struct platform_device *pdev) return err; } + vibrator->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", + GPIOD_OUT_LOW); + err = PTR_ERR_OR_ZERO(vibrator->enable_gpio); + if (err) { + if (err != -EPROBE_DEFER) + dev_err(&pdev->dev, "Failed to request enable gpio: %d\n", + err); + return err; + } + vibrator->pwm = devm_pwm_get(&pdev->dev, "enable"); err = PTR_ERR_OR_ZERO(vibrator->pwm); if (err) { From patchwork Thu Apr 27 20:34:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Weiss X-Patchwork-Id: 677929 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 B52DBC7EE25 for ; Thu, 27 Apr 2023 20:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344284AbjD0Ue7 (ORCPT ); Thu, 27 Apr 2023 16:34:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344257AbjD0Uez (ORCPT ); Thu, 27 Apr 2023 16:34:55 -0400 Received: from mail.z3ntu.xyz (mail.z3ntu.xyz [128.199.32.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78FA43C16; Thu, 27 Apr 2023 13:34:54 -0700 (PDT) Received: from [192.168.178.23] (unknown [62.108.10.64]) by mail.z3ntu.xyz (Postfix) with ESMTPSA id C09CDCEC29; Thu, 27 Apr 2023 20:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=z3ntu.xyz; s=z3ntu; t=1682627692; bh=u0OfrZ8JQA1K+eu8S043JANNKuvEBNwR1oXhG9a518k=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=mV7fmCgl5zkebzcbzU1H4v++iAKjmTa2v7aq56EgSEyyzJ97V5M2XdGoXxdc5bB3l WMkVXNQnlJKGtIew/BwWWRUR8pTxhnKNg8LfpmZ/X8jHlRbB7N4umQsvhsOousVKzV ZpzI6N/ZteBxGLVMjzo5h/e2jfFHDgBAl4EoaV8s= From: Luca Weiss Date: Thu, 27 Apr 2023 22:34:29 +0200 Subject: [PATCH 4/4] ARM: dts: qcom: msm8974-hammerhead: Add vibrator MIME-Version: 1.0 Message-Id: <20230427-hammerhead-vibra-v1-4-e87eeb94da51@z3ntu.xyz> References: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> In-Reply-To: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> To: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Sebastian Reichel , Andy Gross , Bjorn Andersson , Konrad Dybcio , Brian Masney Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Luca Weiss X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1621; i=luca@z3ntu.xyz; h=from:subject:message-id; bh=u0OfrZ8JQA1K+eu8S043JANNKuvEBNwR1oXhG9a518k=; b=owEBbQKS/ZANAwAIAXLYQ7idTddWAcsmYgBkStxqdiW+kWCefNLPPzqQpnvWWzkWAPLg7kJEW kuWJkM6I++JAjMEAAEIAB0WIQQ5utIvCCzakboVj/py2EO4nU3XVgUCZErcagAKCRBy2EO4nU3X VhquEACXKd8YsE0/iZG3aV/sz4f2rfDYg2ZFsLJSkAmDG8FYnsH7qHaUf0AdidkoLUMrWGntbcJ zzTCUvbyr7fNXKKZhFMW/Y5RQot/4L7zGviNsyVyw7L8apKqyAnskyWbkWxg32feNKHkp924Z3f y0c2saXLto1l7SHskHaTPEohkM//l0gwcou+OcN3il4Iej3HvP5dQW7FOwcrGY4D82INL59x1Hz WYXomaitIzGgwcl1Qgs3rYAopoHwUk/PZzE/DI142JFU0d+3Swb00I9XovXIml/yMWOIfbKB8tq H8hl5Ja+z/v8FosPET5fAa6nZ7xtccXQXD/V1JC/C2puZhHGx3zfGjISuueILHpwyOMqZHo9QOl sA2o+u4Fzb+/mcDEDruM4A/bvDIpryN2HVHLQbjAnt+TIg1/CdM1ApmKQxJ6rdQ/+GLeD/Y+jXZ 2CFthrIKmZ9rxHtuj9Px40dXCRJelef5Hyw21V1XKbEET/lvrkwtTlM8StP5VlRhHpCKHLuAyvS sCm/+3BXQnBoSd7mC+2m+B50OD4NdDErZe2eFW8max6E7GhN2bhtOmwg2EFPHjzPitVWgsX5t7z 2MkVYKxlN20laGSY+Hqa+crLf968IMZr2cKH0I/IJfXOn/IIkungRbwBPIpRuaEUgkhTYaPBfP2 KTIbBaABkLs6UqQ== X-Developer-Key: i=luca@z3ntu.xyz; a=openpgp; fpr=BD04DA24C971B8D587B2B8D7FAF69CF6CD2D02CD Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The Nexus 5 has a vibrator connected to the clock output of GP1_CLK which we can use with the clk-pwm driver, then we can use that pwm with pwm-vibrator to get haptics functionality. This patch is based on Brian Masney's previous patch with clk-vibrator. Signed-off-by: Luca Weiss Reviewed-by: Konrad Dybcio --- .../dts/qcom-msm8974-lge-nexus5-hammerhead.dts | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts index ab35f2d644c0..fea8a6be9021 100644 --- a/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +++ b/arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts @@ -41,6 +41,25 @@ key-volume-down { }; }; + clk_pwm: pwm { + compatible = "clk-pwm"; + clocks = <&mmcc CAMSS_GP1_CLK>; + + pinctrl-0 = <&vibrator_pin>; + pinctrl-names = "default"; + + #pwm-cells = <2>; + }; + + vibrator { + compatible = "pwm-vibrator"; + pwms = <&clk_pwm 0 100000>; + pwm-names = "enable"; + + vcc-supply = <&pm8941_l19>; + enable-gpios = <&tlmm 60 GPIO_ACTIVE_HIGH>; + }; + vreg_wlan: wlan-regulator { compatible = "regulator-fixed"; @@ -637,6 +656,22 @@ shutdown-pins { function = "gpio"; }; }; + + vibrator_pin: vibrator-state { + core-pins { + pins = "gpio27"; + function = "gp1_clk"; + drive-strength = <6>; + bias-disable; + }; + + enable-pins { + pins = "gpio60"; + function = "gpio"; + drive-strength = <2>; + bias-disable; + }; + }; }; &usb {