Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2120758ioo; Mon, 23 May 2022 10:30:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDbjZoFk1hXhubkwkfc0BiremM2Johm7jyYgjbkI4WMbJg49z8SCoDU/w8k7o4MjrT93hC X-Received: by 2002:a17:90b:4a07:b0:1e0:4c9e:e52f with SMTP id kk7-20020a17090b4a0700b001e04c9ee52fmr92904pjb.246.1653327021436; Mon, 23 May 2022 10:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653327021; cv=none; d=google.com; s=arc-20160816; b=WCTf4UbOEcf85poR6S81Oy2vd47RY2mPCr/A4/rNnZeEFkNs3AUczk7OG4ksBRrcLw FvXTsImxxYZaDw789gqq1wZqqIQ1T2sD4sYCsQPUWIaNtAss0c7XSO75spl7ybnOX616 5YOt0MhuxwzD6i5MI4MAI2Y2Git0yIs1oDFnKOukAF5FDtTjOwMsMR8Dv1jgJmfJbm1s vBVF8xO0yIEffvZQ2YsLNvH8RePTa3g39xHehPxUCl/nrLiVHRCvXe/CiSuLK3Jy2Qvr 7uuOYLK9uC5ZVu3cuIvyYwHb44BiJILzlesERsDKVx5Fxb8BcbXqMbxCIzy7a3dwYVBH jWhQ== 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=ZZAE4nb9e5oscePnD34n5ocqMVB2EK4pZWYUoZVARFY=; b=ENAsTa/uO0u+Fm58UifKgEIQ0czY7a8x6dCgQkx839yn5lnLce/+eKJT6XaXdImtMe h1XuB7wTNdGVjJN3KFPIdVtWKUqGG8xyyqblF3kQJQe2oRlIS+ankXClh3pgdRLKO+bv xorME/hdExwg5ou3tQ1OhIUMz+3xYT5if8L8bbJszE5HTNtNIfcWVICCNinD2BFTTIGd rmgIITLi8s2LGQZUb2QSD+uiUu6bywxEvPtJcJpbHRl4w6zjzOmbXvqzmbkqra8YXUNM jN1JI0pzwjUPByCyTEnVxXKXSRXyGzsweh8viYu8UqP1wG/Lk9XrdTu1hVAWTzqHbJJ+ MUiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iaQzmdGX; 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 bd1-20020a170902830100b0015ec0ebd289si9959916plb.211.2022.05.23.10.30.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:30:21 -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=iaQzmdGX; 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 ABA9A9154D; Mon, 23 May 2022 10:30:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240927AbiEWR0K (ORCPT + 99 others); Mon, 23 May 2022 13:26:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240564AbiEWRQ3 (ORCPT ); Mon, 23 May 2022 13:16:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F4AD71D9D; Mon, 23 May 2022 10:15:48 -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 6BA54B811FF; Mon, 23 May 2022 17:14:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92BA6C385A9; Mon, 23 May 2022 17:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653326076; bh=PtMOftg5FnU6hxsGIPr5YdOoW8FziP18jnoUCn4A8SA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iaQzmdGXlE8c4OJSNNpFfd6ICc+0MBm7GsDKwvtOWBRx4RgHChPd5p4yMjTOBXpH5 tXwee94ArdwGVrPg3mhjbaSmL4oSvC2tK1hh11Q3uKL4L2rwaA3HMyLIAayAvRtHiJ y3J4xRheNAzLJ5U2a89QscNAxtNgOb22SKSQdS8I= 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.4 51/68] gpio: mvebu/pwm: Refuse requests with inverted polarity Date: Mon, 23 May 2022 19:05:18 +0200 Message-Id: <20220523165810.967849159@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@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 89a053b1d279..b5ae28fce9a8 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c @@ -697,6 +697,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