From patchwork Wed Oct 29 00:52:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chang, Rebecca Swee Fun" X-Patchwork-Id: 5183071 Return-Path: X-Original-To: patchwork-ltsi-dev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5224C11AC for ; Wed, 29 Oct 2014 00:53:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CCF7220172 for ; Wed, 29 Oct 2014 00:53:47 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D79EF20165 for ; Wed, 29 Oct 2014 00:53:46 +0000 (UTC) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8E00DB37; Wed, 29 Oct 2014 00:53:37 +0000 (UTC) X-Original-To: ltsi-dev@lists.linuxfoundation.org Delivered-To: ltsi-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 24DAFB21 for ; Wed, 29 Oct 2014 00:53:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id B621A1FD46 for ; Wed, 29 Oct 2014 00:53:35 +0000 (UTC) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 28 Oct 2014 17:53:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,806,1406617200"; d="scan'208";a="622447198" Received: from rebeccas-ilbpg2.png.intel.com ([10.88.227.41]) by fmsmga002.fm.intel.com with ESMTP; 28 Oct 2014 17:53:33 -0700 From: Chang Rebecca Swee Fun To: LTSI Mailing List Date: Wed, 29 Oct 2014 08:52:54 +0800 Message-Id: <1414543978-24145-5-git-send-email-rebecca.swee.fun.chang@intel.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1414543978-24145-1-git-send-email-rebecca.swee.fun.chang@intel.com> References: <1414543978-24145-1-git-send-email-rebecca.swee.fun.chang@intel.com> X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Cc: Chang Rebecca Swee Fun Subject: [LTSI-dev] [PATCH 4/8] pwm: lpss: remove dependency on clk framework X-BeenThere: ltsi-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "A list to discuss patches, development, and other things related to the LTSI project" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ltsi-dev-bounces@lists.linuxfoundation.org Errors-To: ltsi-dev-bounces@lists.linuxfoundation.org X-Virus-Scanned: ClamAV using ClamSMTP From: Heikki Krogerus Unlike other Intel LPSS devices, the PWM does not have the clock dividers or the gate. All we get from the clock is the rate. Since PCI case uses the driver data to get the rate, we can drop the clk and use the same data also in case of ACPI. The frequency is the same. Signed-off-by: Heikki Krogerus Reviewed-by: Mika Westerberg Reviewed-by: Chew, Chiau Ee Signed-off-by: Thierry Reding (cherry picked from commit 65accd87381ed96bf8893124b149bae08edd2740) Signed-off-by: Chang Rebecca Swee Fun --- drivers/pwm/pwm-lpss.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c index 44ce6c6..4df994f 100644 --- a/drivers/pwm/pwm-lpss.c +++ b/drivers/pwm/pwm-lpss.c @@ -14,7 +14,6 @@ */ #include -#include #include #include #include @@ -37,7 +36,6 @@ static int pci_drv, plat_drv; /* So we know which drivers registered */ struct pwm_lpss_chip { struct pwm_chip chip; void __iomem *regs; - struct clk *clk; unsigned long clk_rate; }; @@ -97,11 +95,6 @@ static int pwm_lpss_enable(struct pwm_chip *chip, struct pwm_device *pwm) { struct pwm_lpss_chip *lpwm = to_lpwm(chip); u32 ctrl; - int ret; - - ret = clk_prepare_enable(lpwm->clk); - if (ret) - return ret; ctrl = readl(lpwm->regs + PWM); writel(ctrl | PWM_ENABLE, lpwm->regs + PWM); @@ -116,8 +109,6 @@ static void pwm_lpss_disable(struct pwm_chip *chip, struct pwm_device *pwm) ctrl = readl(lpwm->regs + PWM); writel(ctrl & ~PWM_ENABLE, lpwm->regs + PWM); - - clk_disable_unprepare(lpwm->clk); } static const struct pwm_ops pwm_lpss_ops = { @@ -142,17 +133,7 @@ static struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, if (IS_ERR(lpwm->regs)) return ERR_CAST(lpwm->regs); - if (info) { - lpwm->clk_rate = info->clk_rate; - } else { - lpwm->clk = devm_clk_get(dev, NULL); - if (IS_ERR(lpwm->clk)) { - dev_err(dev, "failed to get PWM clock\n"); - return ERR_CAST(lpwm->clk); - } - lpwm->clk_rate = clk_get_rate(lpwm->clk); - } - + lpwm->clk_rate = info->clk_rate; lpwm->chip.dev = dev; lpwm->chip.ops = &pwm_lpss_ops; lpwm->chip.base = -1; @@ -221,12 +202,19 @@ static struct pci_driver pwm_lpss_driver_pci = { static int pwm_lpss_probe_platform(struct platform_device *pdev) { + const struct pwm_lpss_boardinfo *info; + const struct acpi_device_id *id; struct pwm_lpss_chip *lpwm; struct resource *r; + id = acpi_match_device(pdev->dev.driver->acpi_match_table, &pdev->dev); + if (!id) + return -ENODEV; + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - lpwm = pwm_lpss_probe(&pdev->dev, r, NULL); + info = (struct pwm_lpss_boardinfo *)id->driver_data; + lpwm = pwm_lpss_probe(&pdev->dev, r, info); if (IS_ERR(lpwm)) return PTR_ERR(lpwm); @@ -242,7 +230,7 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev) } static const struct acpi_device_id pwm_lpss_acpi_match[] = { - { "80860F09", 0 }, + { "80860F09", (unsigned long)&byt_info }, { }, }; MODULE_DEVICE_TABLE(acpi, pwm_lpss_acpi_match);