| From ltsi-dev-bounces@lists.linuxfoundation.org Wed Oct 29 09:53:47 2014 |
| From: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> |
| Date: Wed, 29 Oct 2014 08:52:54 +0800 |
| Subject: [LTSI-dev] [PATCH 4/8] pwm: lpss: remove dependency on clk framework |
| To: LTSI Mailing List <ltsi-dev@lists.linuxfoundation.org> |
| Cc: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> |
| Message-ID: <1414543978-24145-5-git-send-email-rebecca.swee.fun.chang@intel.com> |
| |
| |
| From: Heikki Krogerus <heikki.krogerus@linux.intel.com> |
| |
| 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 <heikki.krogerus@linux.intel.com> |
| Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> |
| Reviewed-by: Chew, Chiau Ee <chiau.ee.chew@intel.com> |
| Signed-off-by: Thierry Reding <thierry.reding@gmail.com> |
| (cherry picked from commit 65accd87381ed96bf8893124b149bae08edd2740) |
| |
| Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com> |
| --- |
| drivers/pwm/pwm-lpss.c | 32 ++++++++++---------------------- |
| 1 file changed, 10 insertions(+), 22 deletions(-) |
| |
| --- a/drivers/pwm/pwm-lpss.c |
| +++ b/drivers/pwm/pwm-lpss.c |
| @@ -14,7 +14,6 @@ |
| */ |
| |
| #include <linux/acpi.h> |
| -#include <linux/clk.h> |
| #include <linux/device.h> |
| #include <linux/kernel.h> |
| #include <linux/module.h> |
| @@ -37,7 +36,6 @@ static int pci_drv, plat_drv; /* So we k |
| 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_ch |
| { |
| 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_ |
| |
| 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_pr |
| 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 |
| |
| 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(stru |
| } |
| |
| 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); |