From patchwork Thu Feb 16 20:27:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sylvain Lemieux X-Patchwork-Id: 9578341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BC0860209 for ; Thu, 16 Feb 2017 20:29:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D6202866B for ; Thu, 16 Feb 2017 20:29:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F346D2866F; Thu, 16 Feb 2017 20:29:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_SORBS_WEB autolearn=no version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 849172866B for ; Thu, 16 Feb 2017 20:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=fc34oGnpYpM/KWRgNS88+XJlkNHXmsxH/yLV8sdCko4=; b=k5BlXBvQBWPuKo6yBjaaZ9bEUI mb0YuqNfQ5rVdVcinnjqrz1ejlSdb/nPXZaUrT3bNslcUqJQe34o0PZBiPJ553ck4bhhswCl3yGwg vsYusRwoG7LfABE+rodSqSuU3+kLlcJSRgD9oXliPVDL7wuqsfmmDeWwoAqb2wSn+UyHyVpMtMc/H wo8+nemy7jaciC9q8mNV25QKLNwTZjHEAqzsQd8CMMEJEO+v1cNfVyrsY2Qa9dp0Vzdw/XBUT4+4p KNmN2Ey8ex/NyQ3xEWpT9KFcuzu30s0pSmys6lPk0CfB8ElI8WRB6YFwqm9ptC2jcoq+2ZY0twF4b sDZsRNcA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ceSgD-0001Ob-4Z; Thu, 16 Feb 2017 20:29:29 +0000 Received: from mail-it0-x241.google.com ([2607:f8b0:4001:c0b::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ceSf8-0000Wd-KF for linux-arm-kernel@lists.infradead.org; Thu, 16 Feb 2017 20:28:26 +0000 Received: by mail-it0-x241.google.com with SMTP id 203so5989260ith.2 for ; Thu, 16 Feb 2017 12:28:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LvnzXiC3xAZr7cpvChDxrLAO9J4xbLRejT66XCF5yrw=; b=ZQq5rljlSMCL2u3VBbfuf+/eWVpAByktd40uMK+WRmPPiO9L6IUEngM25rw1FGY4tf 5t3a0oN4L87rbr6gicwy5rzactQulLt9JvsiXQsNvAhzKZPKkvYSsqmiDXqnct1Rb+4G LSyXS3r1wk7Hee55+DZ98523pGrglCmjoeXpXpTqSLVQYMzUKkBz8popdGIZW3/E8Z+l 0nImHfRKn2zFf5kpz4EE59lXI/vIuwZiqgjnXJSVkym3Xr3s2I1OQsq/0xttjzEmFZjQ 37F4tFO1O4Rq7dVuI7xDxjpBCApY7t93O+0GG2e42z4uuCiFsPrxFUDPR/DWq4CG7g/k +c8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LvnzXiC3xAZr7cpvChDxrLAO9J4xbLRejT66XCF5yrw=; b=kzgEb1dQR0UzLZXYCGtQGpaaGoqxzJWCJ7UOkt4rNV/t33vuRqXXmZ6pXkORHi+FgQ yL55ysmqGTWIwiBobPKpQIBEG8swJOvahQZTnR1+NkC6xDZI/n5oju/LaAdpYBWLjFj6 DTAENQFi238ZEznw1BbftvnOIEz8SmombB/9W9lGO/ekteyP03ZypSK1xqI7VyVi7kzS ulXUuG3IiIfjNpTT/h0j59Dmjn7yneh3wVORQM0MHCAV8QXTGTKkBC0wkxwgb7dYjnlF ExxAAkLEzw0sChguzklY3NXkzSAJIfGIkcEBUL3yrCqWI6ZddZOGzIofEnfTRjQ21ERt b6Cg== X-Gm-Message-State: AMke39napoa6ssvfRFeCsRu1Bwe4pCN8vAlVzQE3yva5+JsR3/NansatuUNHJbBH9jMc3Q== X-Received: by 10.107.28.204 with SMTP id c195mr4119786ioc.223.1487276881759; Thu, 16 Feb 2017 12:28:01 -0800 (PST) Received: from CABRO3AP00510.localdomain ([74.51.240.241]) by smtp.gmail.com with ESMTPSA id j19sm4684528iti.3.2017.02.16.12.28.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Feb 2017 12:28:01 -0800 (PST) From: slemieux.tyco@gmail.com To: thierry.reding@gmail.com, robh+dt@kernel.org, vz@mleia.com Subject: [RESEND PATCH 3/3] pwm: lpc32xx: remove handling of PWM channels Date: Thu, 16 Feb 2017 15:27:49 -0500 Message-Id: <20170216202749.20653-4-slemieux.tyco@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170216202749.20653-1-slemieux.tyco@gmail.com> References: <20170216202749.20653-1-slemieux.tyco@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170216_122822_705757_0921F44A X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vladimir Zapolskiy Because LPC32xx PWM controllers have single output which is registered as the only PWM device/channel per controller, it is known in advance that pwm->hwpwm value is always 0. On basis of this fact simplify the code by removing operations with pwm->hwpwm, there is no controls which require channel number as input. Signed-off-by: Vladimir Zapolskiy Reviewed-by: Sylvain Lemieux --- drivers/pwm/pwm-lpc32xx.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c index ce8418101e85..786c887c296d 100644 --- a/drivers/pwm/pwm-lpc32xx.c +++ b/drivers/pwm/pwm-lpc32xx.c @@ -55,10 +55,10 @@ static int lpc32xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, if (duty_cycles > 255) duty_cycles = 255; - val = readl(lpc32xx->base + (pwm->hwpwm << 2)); + val = readl(lpc32xx->base); val &= ~0xFFFF; val |= (period_cycles << 8) | duty_cycles; - writel(val, lpc32xx->base + (pwm->hwpwm << 2)); + writel(val, lpc32xx->base); return 0; } @@ -73,9 +73,9 @@ static int lpc32xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) if (ret) return ret; - val = readl(lpc32xx->base + (pwm->hwpwm << 2)); + val = readl(lpc32xx->base); val |= PWM_ENABLE; - writel(val, lpc32xx->base + (pwm->hwpwm << 2)); + writel(val, lpc32xx->base); return 0; } @@ -85,9 +85,9 @@ static void lpc32xx_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) struct lpc32xx_pwm_chip *lpc32xx = to_lpc32xx_pwm_chip(chip); u32 val; - val = readl(lpc32xx->base + (pwm->hwpwm << 2)); + val = readl(lpc32xx->base); val &= ~PWM_ENABLE; - writel(val, lpc32xx->base + (pwm->hwpwm << 2)); + writel(val, lpc32xx->base); clk_disable_unprepare(lpc32xx->clk); } @@ -147,9 +147,9 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev) } /* When PWM is disable, configure the output to the default value */ - val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); + val = readl(lpc32xx->base); val &= ~PWM_PIN_LEVEL; - writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2)); + writel(val, lpc32xx->base); platform_set_drvdata(pdev, lpc32xx); @@ -159,10 +159,8 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev) static int lpc32xx_pwm_remove(struct platform_device *pdev) { struct lpc32xx_pwm_chip *lpc32xx = platform_get_drvdata(pdev); - unsigned int i; - for (i = 0; i < lpc32xx->chip.npwm; i++) - pwm_disable(&lpc32xx->chip.pwms[i]); + pwm_disable(&lpc32xx->chip.pwms[0]); return pwmchip_remove(&lpc32xx->chip); }