Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp378308ybn; Wed, 25 Sep 2019 01:03:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwd/ObmsiMM7gWkEXMOfjYqebCA9WJO7xCPJAs6nwbRTYLZSy7B1I4QpHIpT9WQoowpW9dt X-Received: by 2002:a05:6512:75:: with SMTP id i21mr4726904lfo.95.1569398601120; Wed, 25 Sep 2019 01:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569398601; cv=none; d=google.com; s=arc-20160816; b=RnANOZA1NNJrZiB7BTRYXEVt67W0zPnclpQHL6AbdHxNls5/J7JV8yZcPS6c2XTJWo SjB5Y+1T8iP1QSdqqp5T1kp/jyRZHsWccfg7XZMIi05IcnS3ztaJ47eGG5hvvOtentoQ osPlAfYmXnXCPsHm1WWyFDwBLTtqUAQZbUoK+7vXueV6Rje8dc4s+qX32Pe/HGIITVFi VYUc7zHBcjopyjzf4gR6EEd6C4Etb5zqG5JjE2CluhSVu0HDX/sNWu+I5zMe2OgW4DZQ 1P1Xe2ds4DVzQcEhgvIBrBrjq57U1MMb4tJWFy+vfWBEiXvHS9kNTBC+6Rt2ZMlfxGHL p4yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lD0e8xFBv1AR2F4JhSacxWgoKrl7ntnXXGEiOwHJH74=; b=ChhJA0HZdnn6kQ0Sxm0ELJO2XLVbf0zmDGaf6egSJuwrH0yVvkgav9M2/8SAFZhdJb /t0pl5Mo6ZshWL7EY6OwAsb0qiQANeLlvuZLBhgIDRC6lWTIHLZvx/SGEPj1E130rvgk 2WP9wLfJCFjZjtGOw8aMjQLlAHgMOaN8Yp0CfVtvl4U+GwYRqcXc6qKGqDJevK08qQVx njBdLSpWWsZu0Q7zZUpWUm8IqWZSJTR2txb66TdXZi/eJrv0O1cASjH04451rlQGWjRc ZNRNrb4WtaXyfNc4lbiXkHJ5Bvyu4Y/1d8ZFyq84khgi+DpvN8EZngiXNpwDRjLEy9Ic fuIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=HgcQ1K4t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si2708847edr.136.2019.09.25.01.02.44; Wed, 25 Sep 2019 01:03:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=HgcQ1K4t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437449AbfIWIOJ (ORCPT + 99 others); Mon, 23 Sep 2019 04:14:09 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:43089 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406607AbfIWIN4 (ORCPT ); Mon, 23 Sep 2019 04:13:56 -0400 Received: by mail-lf1-f66.google.com with SMTP id u3so9358263lfl.10 for ; Mon, 23 Sep 2019 01:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lD0e8xFBv1AR2F4JhSacxWgoKrl7ntnXXGEiOwHJH74=; b=HgcQ1K4tr0a4wAHLWjvdmktJUM3BVu3dL17gzfeF3nAdsClcj6wJpQRG6DTVB1hHUz Ocxoxx1M7JSEGyy/x1h5RDBNGIkNUresJDZanlEHiG4f+3mLRDMjpRIMk4Ihi6/cdnfz LY3qlvifzD2By4oG01tO2WS6ZIhOkjr2PMAdk= 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:mime-version:content-transfer-encoding; bh=lD0e8xFBv1AR2F4JhSacxWgoKrl7ntnXXGEiOwHJH74=; b=n6Jqt+Hfuxu3isXkoGKHE0kzTtMLTZR+YZ57d3Ubeas3ijoxUVnqZrZQotXfeDcByA oZtOZzwB/33tZr06zN5dmF+ki1MzmJg+lyAn0d50naaSykTkLDMtRFKSY/IcB7za1VWz Q8RUcUnStK6XNqstHNEH2iD6YKUHzmXA3U0F6BhFlwsaSvMjvXqgISwmYGfWZYykYqDw 5z3Dh5yjRI9fOhWfV5k7F3VtTrVfm47yVF8yxHFsZfRqX2ntGrJeRD3r0IXTls3YrEgo WNvISv8mfjzZGpi8HVAAD7LwHwknwu/FDqe0+Wrhoe++s3T2pxK3a9S92pd0Z3h8FgbX miqw== X-Gm-Message-State: APjAAAUhcvZPzc3rk+UDQY7glhedjDT+IXWYGu7bobkOe7YZkdkkDmLb 377OBSEfEPMvqngJD0PiEzmJCw== X-Received: by 2002:a19:6455:: with SMTP id b21mr16301336lfj.167.1569226434462; Mon, 23 Sep 2019 01:13:54 -0700 (PDT) Received: from prevas-ravi.prevas.se ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id c21sm2054946lff.61.2019.09.23.01.13.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Sep 2019 01:13:54 -0700 (PDT) From: Rasmus Villemoes To: Thierry Reding , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: devicetree@vger.kernel.org, Rob Herring , Rasmus Villemoes , linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] pwm: mxs: remove legacy methods Date: Mon, 23 Sep 2019 10:13:46 +0200 Message-Id: <20190923081348.6843-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190923081348.6843-1-linux@rasmusvillemoes.dk> References: <20190923081348.6843-1-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since we now have ->apply, these are no longer relevant. Signed-off-by: Rasmus Villemoes --- drivers/pwm/pwm-mxs.c | 77 ------------------------------------------- 1 file changed, 77 deletions(-) diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c index c70c26a9ff68..284107784dad 100644 --- a/drivers/pwm/pwm-mxs.c +++ b/drivers/pwm/pwm-mxs.c @@ -102,85 +102,8 @@ static int mxs_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, return 0; } -static int mxs_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, - int duty_ns, int period_ns) -{ - struct mxs_pwm_chip *mxs = to_mxs_pwm_chip(chip); - int ret, div = 0; - unsigned int period_cycles, duty_cycles; - unsigned long rate; - unsigned long long c; - - rate = clk_get_rate(mxs->clk); - while (1) { - c = rate / cdiv[div]; - c = c * period_ns; - do_div(c, 1000000000); - if (c < PERIOD_PERIOD_MAX) - break; - div++; - if (div >= PERIOD_CDIV_MAX) - return -EINVAL; - } - - period_cycles = c; - c *= duty_ns; - do_div(c, period_ns); - duty_cycles = c; - - /* - * If the PWM channel is disabled, make sure to turn on the clock - * before writing the register. Otherwise, keep it enabled. - */ - if (!pwm_is_enabled(pwm)) { - ret = clk_prepare_enable(mxs->clk); - if (ret) - return ret; - } - - writel(duty_cycles << 16, - mxs->base + PWM_ACTIVE0 + pwm->hwpwm * 0x20); - writel(PERIOD_PERIOD(period_cycles) | PERIOD_ACTIVE_HIGH | - PERIOD_INACTIVE_LOW | PERIOD_CDIV(div), - mxs->base + PWM_PERIOD0 + pwm->hwpwm * 0x20); - - /* - * If the PWM is not enabled, turn the clock off again to save power. - */ - if (!pwm_is_enabled(pwm)) - clk_disable_unprepare(mxs->clk); - - return 0; -} - -static int mxs_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) -{ - struct mxs_pwm_chip *mxs = to_mxs_pwm_chip(chip); - int ret; - - ret = clk_prepare_enable(mxs->clk); - if (ret) - return ret; - - writel(1 << pwm->hwpwm, mxs->base + PWM_CTRL + SET); - - return 0; -} - -static void mxs_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) -{ - struct mxs_pwm_chip *mxs = to_mxs_pwm_chip(chip); - - writel(1 << pwm->hwpwm, mxs->base + PWM_CTRL + CLR); - - clk_disable_unprepare(mxs->clk); -} - static const struct pwm_ops mxs_pwm_ops = { .apply = mxs_pwm_apply, - .config = mxs_pwm_config, - .enable = mxs_pwm_enable, - .disable = mxs_pwm_disable, .owner = THIS_MODULE, }; -- 2.20.1