Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3689282lfo; Mon, 23 May 2022 11:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2E5lmzI9vG4xtfAeV9746vNLDw8PhxecMg/cQ4L5ORW84ilnyEeOBj0JXRiukE0+vo5y7 X-Received: by 2002:a17:902:e94e:b0:158:91e6:501 with SMTP id b14-20020a170902e94e00b0015891e60501mr23903564pll.29.1653330666195; Mon, 23 May 2022 11:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330666; cv=none; d=google.com; s=arc-20160816; b=FpT5TdpqoWkI467CMriHaHlcq1j9SJiXosW85NaiySOHR5MC2Fu/Nk6EPKKRDIGvT4 i+2XaSi1nDAf/3uGg1DG8bQt7Q3RFBJkZBIpz0o+a1wo7hG4HxfF4Xn4J8aQLB+Szw2K JRI6kiMZ1w9z9Sj2WYXJrIWdqk5zSxwE/3R2OO8o/X3fITO/0s2D+xy8Uz2abErcGSuV Uv0zjXbOzy6cFtTWx21SdV2KYF4rMrrrOsxCAZ+vpozZpt3pkXcGTtxR+0Vf3iwUAaLt WjZisGhz2sdhhfOerk6I0GTwGUZD3Y8dza48dQYIuWc92oj7NZB7DKZnON/OnK40i0u8 ouhg== 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=c0rbQKwjpSwbzPj1x5kFV5UqZBKcaM0QDqlR2yT53Bc=; b=X0CQgtEa1OAGYvuhnwOu3UlDnM20dD6u96z/wb5nMdbfWUaFld4jaJDs/Qe/rnskXQ 0fxh4SO3MlFtXdDWhrFMmUeffT3zaotiKJLuAd96/Jb4S5CdODXd4KQCD+pQvgu3Ba+P DwZ3LGapUvUnUUJZkF05f1Dr0VyD74K1N4naIdDL36yc5FxMOHb3BDn2lQ5yioJKUWqM vtxJs4uITCNs95IoyebX6iWj89kpH5ukEadUB7zbTWxVu6Sa3MvlkSmpFbzF/EjjZKWv +WxTJBU0l+oNB9iN4fnNQPc46Oum33zHZph1G/GviZ5Pn9nlfGND/zYfufXLcC8FHrgC ItsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Zhg2L0FO; 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 r75-20020a632b4e000000b003c6e6ccb295si11978143pgr.624.2022.05.23.11.31.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:31:06 -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=Zhg2L0FO; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 11FD6EABA7; Mon, 23 May 2022 11:30:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243841AbiEWSO4 (ORCPT + 99 others); Mon, 23 May 2022 14:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245138AbiEWRwu (ORCPT ); Mon, 23 May 2022 13:52:50 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 940FEA006B; Mon, 23 May 2022 10:42:20 -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 sin.source.kernel.org (Postfix) with ESMTPS id 175CECE1724; Mon, 23 May 2022 17:30:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 059E7C385A9; Mon, 23 May 2022 17:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653327014; bh=/n+vh8yEh7Z64KXc6mBpDpamZt1/u0NHLVORrNngQx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zhg2L0FOdDUvjdyZcHXEAsMsBSYKLAP4EV7xFI+tmBxxOdMlSYZkdoxj8kQJhiFrl WCj5PlpVH7/5SwOI0u0KcfmBWtuiXue1EGeMp1h36scXOo6DMofz4agmlj6yvSoHpz mNV1+ytKFWIBZdwspooxU5C/1UkjRM1vJTZdbsyg= 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 5.17 128/158] gpio: mvebu/pwm: Refuse requests with inverted polarity Date: Mon, 23 May 2022 19:04:45 +0200 Message-Id: <20220523165851.783518015@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165830.581652127@linuxfoundation.org> References: <20220523165830.581652127@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 a2c8dd329b31..2db19cd640a4 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -707,6 +707,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 + 1ULL) -- 2.35.1