Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2108824ioo; Mon, 23 May 2022 10:14:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzse0Wlmwus11kytZTiXjLIZSiVO+GFJykkn35qoIJSwezYUjUIiNeXNSShB66wUFQBcPVZ X-Received: by 2002:a17:90b:2189:b0:1df:7963:3315 with SMTP id ku9-20020a17090b218900b001df79633315mr57941pjb.68.1653326051425; Mon, 23 May 2022 10:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326051; cv=none; d=google.com; s=arc-20160816; b=YEaPN74wMKeo0KuXblGSYZDOCCIN9p6bWAtGEJ5RiFjnJfBYgfedFCwYuUzXwX61Kc kvd/mF/kDIOraC4cTPEfXy1c3cMsEfY0FU+W5UsE03eJfgam0503hDf4oYoqgpFnLu2l ynXVTI8KiDQzoK0Rs7zi1U7V2/SxkiWzhGcQyorX4Y3eLunzug0d3w8edNsg/ko00cjL xdk9W+id9/oU9bvZ1FEHuX7QJpq43ora/2cqJRupq4eQJ25b0n4Ab26pwHYT8J0VovCH nw1xjf592vv7bo6r+DFOvmaFlWaPtLBMiCiJuoWrjb+FWmpgnwhI5F4BajGty4BvOAf2 T15w== 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=CwlEeVjSpM7u1wthiYe6p3qxXyrKXjSfObG0ieOE8Uw=; b=v1kos7uYBn1vt5HJMAdg+Mc/NOTdWBimLMh+xTwJwQtFqnIvlqMURqsF+UzgMpoA/A kRXsQ/F3OJ6AnqpJj930hW79Qh8LAhclb8HY+dJfbLTobeVLW+SMhTicKEwgyLadGifX xbzRLjMQhiyoP+h7cgmU2OA3w0npeL851yrnmzcckAULN+MF1A/ZOnGl3iDQB6a6mQ/7 PxFxyZmbf7PD5GtErDRgvOcX16Y/VXPulMfYasXHaSlyjdqVHC38m4o+EaZO2UNLbBdy 9P/hRRz65EKxygrMdiCP1Hcbk9H1jjKoIM7OaTJiYt/o4s3qOphV3YE78Fjn9miyKqqG miBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CmE8cE8X; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id o12-20020a65520c000000b003f8a46f7eebsi10230386pgp.497.2022.05.23.10.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:14:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CmE8cE8X; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 533E56F497; Mon, 23 May 2022 10:13:54 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239819AbiEWRLX (ORCPT + 99 others); Mon, 23 May 2022 13:11:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239654AbiEWRJn (ORCPT ); Mon, 23 May 2022 13:09:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 510156BFF9; Mon, 23 May 2022 10:09:27 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3A820B81204; Mon, 23 May 2022 17:08:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95A38C385A9; Mon, 23 May 2022 17:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325731; bh=Iz1rFFV2zMZoyT84NHl2an8DW4gPUQsmz3WeEuVpS74=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CmE8cE8XqeywmwTM6plmw5U+kWZbNlfeiofS3T5K5YcUAMpPtNQYiPPn+ypocn7J2 W0C/Z4omV/7QTT7sulNBFcx0hZc24RDFi8kYAIpa0QMtMrQ7bw1uwJyqfVCUlISgOP 5I1x3h/L+JXw+aec0YsFWUwdGAsJyKlrpwIVsLnw= 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.14 25/33] gpio: mvebu/pwm: Refuse requests with inverted polarity Date: Mon, 23 May 2022 19:05:14 +0200 Message-Id: <20220523165752.546367189@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165746.957506211@linuxfoundation.org> References: <20220523165746.957506211@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 b14d481ab7db..cbad11029c67 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -694,6 +694,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