Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1899348rwr; Fri, 28 Apr 2023 03:29:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5xV5MQioyKkY4aTvTJspbwTAU/ohH42+lYo4mqmpG+xrMTI/xeItoz2/geBKuegrjzILT+ X-Received: by 2002:a17:90b:1e4c:b0:247:53b4:ec52 with SMTP id pi12-20020a17090b1e4c00b0024753b4ec52mr5118233pjb.8.1682677772316; Fri, 28 Apr 2023 03:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682677772; cv=none; d=google.com; s=arc-20160816; b=beP+AjgFDghZ460bc+eLYLRFuPELqX6wxjiIWDleUvPMmjmHoXUpxrOV2n6N9D7KPw 2Ho9m5CaGtw9kd5isdU8+WonVEIwpx6Mr73M6fLHVQYDiZv3tKEVZKFDlPBM9lds3U/R qTzW+rle4faxVAjvqct/ljKEaamef/v9FnaXx2y6SkatZ7mYINg44+9mnIPgcKRsHhXC vxmKr/+n3fXzjra181gPv8krB7ZL0rZqPOg+YnGWrWIznNQMMFz3DiuDEgCQPMxCcEWb HcKCCDmG5UCpsHRcsYbuNpXt42XQsoJmfFqivPC6/+Gt4/IdSuC28EqlR29bP8bOwKp6 OgEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=wXzFdP+bsCom1eIU4RjGMEhTHDjKgk0txNlrf8+QKjQ=; b=lUsbhUVoaQCfMCoLBqSGgErvfPYpAeT26Oipk96Bw+z87Jnl87jxwMSBDoayKBL6xP BHNAQyHC0RykDfyBDBzgPnNlnuUQU/GWg7XQJFN8GOg1DY9tzDCD90Is9d9QgSellHhS 0oYKTJ1/HXBh7ALr6hzFD6I659xnmQD5AmzzyYkAfh6NSKWqunvx3LWPAOeY9excr7Kd QY/+GI6t96OJ+yghdb0Dh54HxhxPuSCzIZYQKTd4+oFnF2opQftrp97JlNNO7N11jOOt bNqqO3UsgC0/BVMPFof+vfgXh+j8DNIfIWu8T7m1TWIqIPx0DUwxH3GlUmf91BroxQol R1rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BTJadbAU; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a635446000000b00519b9bfd44bsi19536538pgm.569.2023.04.28.03.29.18; Fri, 28 Apr 2023 03:29:32 -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=@linaro.org header.s=google header.b=BTJadbAU; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346049AbjD1KLY (ORCPT + 99 others); Fri, 28 Apr 2023 06:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345970AbjD1KLP (ORCPT ); Fri, 28 Apr 2023 06:11:15 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 375385584 for ; Fri, 28 Apr 2023 03:11:11 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3f315712406so54035385e9.0 for ; Fri, 28 Apr 2023 03:11:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682676669; x=1685268669; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=wXzFdP+bsCom1eIU4RjGMEhTHDjKgk0txNlrf8+QKjQ=; b=BTJadbAUme0Sy1hlHP/K4faG9iF+975AHqUFdEcWjuUQLtvs65XD2KY+1siMxyE9/l o6FKRidLgEQa3A9pzVkgzokqaVHcHAnrb+4s1Q4UEVWfLL0/1joAGQSDuB+dlS23akBL eyqrZ39sZx5ejMhovbd+YTearPccBC6fmWVBlfU4oU9YrcIQtMQk9gn4ejgAdj6FPium Ekk9tv02jYMShgZvwUbLrSolY+Hp2a23GnYESMDuGqgnAoIfs5r83sLzmZ+IWdbiAFP8 AXtXAzYYNSLywuEY5PSdMDNAQYWU2M92PldMuAQnBZomC5xqs2niHsqIvpYctk5pV5HT rwLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682676669; x=1685268669; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wXzFdP+bsCom1eIU4RjGMEhTHDjKgk0txNlrf8+QKjQ=; b=HMICl0ggrhSewhaSwyvZCKTlliNv8uOhXSLfVagNSWrJRfFEQG2ligMBIwwv7lK+2E kDADpB/NOrI/cCkaiz6aKo9Er++gKRmgnQQMYEx+btoFDcp/IzPhVOwoTDOezaCczuUS VxDdCU8TwfKZ1VCBbPFY76T22+SnU7RYGop6HoAWuR1ooCw7KijCVbr7IKG2GmA2lQDO HCEX3vE5earO+4WWYGgw0sOdhY6s1/Lb0Zx0zMgorTRsTx1XVCzvelPirQOORbBz69I8 O6mp2L7LQob16pOpBacdixrDwW+dY3/Kth1N4fJAMNsdMGcSInMVnVpzf99EdHGe+NxI 0nYA== X-Gm-Message-State: AC+VfDzuRso4Fls5ycoQgiEyP1AuBpdpCuKdZvJvX0MH6P9/kLT6uYM0 L1Rwn3hGNW3314i73hFUxejaUqMo3AYG6V2qiKaSlQ== X-Received: by 2002:a7b:cb86:0:b0:3f1:8129:2c53 with SMTP id m6-20020a7bcb86000000b003f181292c53mr3712923wmi.16.1682676669381; Fri, 28 Apr 2023 03:11:09 -0700 (PDT) Received: from [172.23.3.169] ([195.167.132.10]) by smtp.gmail.com with ESMTPSA id x8-20020a05600c21c800b003f2390bdd0csm15200964wmj.32.2023.04.28.03.11.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 28 Apr 2023 03:11:09 -0700 (PDT) Message-ID: <7d481097-9ffc-6ac5-a53e-09772b2d5b33@linaro.org> Date: Fri, 28 Apr 2023 11:11:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH 3/4] Input: pwm-vibra - add support for enable GPIO Content-Language: en-US To: Luca Weiss , ~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 References: <20230427-hammerhead-vibra-v1-0-e87eeb94da51@z3ntu.xyz> <20230427-hammerhead-vibra-v1-3-e87eeb94da51@z3ntu.xyz> From: Caleb Connolly In-Reply-To: <20230427-hammerhead-vibra-v1-3-e87eeb94da51@z3ntu.xyz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 On 27/04/2023 21:34, Luca Weiss wrote: > 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: Caleb Connolly > --- > 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) { >