Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2115303ioo; Mon, 23 May 2022 10:22:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeqN10ojBYLYUVM1NcndFn5jAmyG38MiiwtSPbhP0UWM5Dw03fIpEEn7zAyP3b45xe7E38 X-Received: by 2002:aa7:9255:0:b0:505:a44b:275c with SMTP id 21-20020aa79255000000b00505a44b275cmr24762851pfp.40.1653326565083; Mon, 23 May 2022 10:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326565; cv=none; d=google.com; s=arc-20160816; b=bnIOaFeE/Ydm6jC5d9QW9i6AlwkgcFFZMbiRLf+co2AHkKnlocPEmB63i0pRdvV0rT V87gB5/oSvezygel3E+72AqwvkzO58pj3wKqjXZeCUJbI5EQZyEjHzYrTiRLtZK4u5fQ 13ILAOkDQYl5PNVC3s6xiwC+oSP8pVRdohfNRVJ9B3+JDZZ83oM5QsdvBfrHqD34Hh+h 4jjM44XOsy7sHfYlF4J+ts0Z7NDlAkb2NUH0bqQueBmhegvjcYLFXrZJNepJwC4dpHzN XSNQpQ6ZDdFx1GL3B3Ne3lzf20urBRQhDd/nMK1syFWE8bCkvl6bKwld9A2W85jsvjOb 0Xzw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Nssf40U0S2+ivT3XVkqb4DRVD2QDkKx1CQZyxElW+KA=; b=pmpT0N1882B3G/+IwfMxJNyO/91oHCpqHDToBvx1g1HnTO0Qs2SgGZniv/D4RHdMqP B+SGKT/cksglPUC0t9smbAP2o02576AAunA8GDos3u9/a2T/43xg7NNqCrD0Jfv4ccq+ oT3cbh+WyKMGXvnprn2GFlYsofVCd/BbCDj1D4RM2dXtcNXd4jEFYF5WF00gdcZAA2X6 LTm0a4nl/qNvNm8F1vQhjQCskKpyqOiTDMaXbfFhvL8zurhyrtx83C08ayPRPISnq3wG VGA/IoH0c4pMiZOAbNfC1KUarwIkJF5rph3LgCyvEbbTYgtA+OQD1d+zbm7FmlAPD2dw alLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RgQukUBs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g2-20020a17090a7d0200b001dc8b655c65si13788355pjl.128.2022.05.23.10.22.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:22:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RgQukUBs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F33FC183A0; Mon, 23 May 2022 10:21:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240595AbiEWRSW (ORCPT + 99 others); Mon, 23 May 2022 13:18:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239903AbiEWRP0 (ORCPT ); Mon, 23 May 2022 13:15:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFACC60C4; Mon, 23 May 2022 10:12:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 91469614EB; Mon, 23 May 2022 17:12:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93484C385A9; Mon, 23 May 2022 17:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325921; bh=VNQl8dGsmKGY71mXz1qdZhPo1NOzDA42w45+wGdw6ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RgQukUBsKd5RNpvapGn2XceVRdfHgKpGXzk8q1WVnSQ1SscQb02jSIYdQlBUz9Olp LoRZ4hDnSzC1jEgHSxEa9ilDwQZJDyJ7pueMOId3Rh7A73vSf0j5DFP/YlBxbsSPZU Vjeb0ypENBysxqsBAJoHRrkaHhOcLnArD4GKOU4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 4.19 35/44] gpio: mvebu/pwm: Refuse requests with inverted polarity Date: Mon, 23 May 2022 19:05:19 +0200 Message-Id: <20220523165759.598875127@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165752.797318097@linuxfoundation.org> References: <20220523165752.797318097@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 From: Uwe Kleine-König [ Upstream commit 3ecb10175b1f776f076553c24e2689e42953fef5 ] The driver doesn't take struct pwm_state::polarity into account when configuring the hardware, so refuse requests for inverted polarity. Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support") Signed-off-by: Uwe Kleine-König Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin --- drivers/gpio/gpio-mvebu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 874caed72390..199b96967ca2 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -690,6 +690,9 @@ static int mvebu_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, unsigned long flags; unsigned int on, off; + if (state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + val = (unsigned long long) mvpwm->clk_rate * state->duty_cycle; do_div(val, NSEC_PER_SEC); if (val > UINT_MAX) -- 2.35.1