blob: c15bc6d00f1aef323375584dd8f75ac0f0dbc57e [file] [log] [blame]
Andy Shevchenkoc558e392014-08-19 19:17:35 +03001/*
2 * Intel Low Power Subsystem PWM controller PCI driver
3 *
4 * Copyright (C) 2014, Intel Corporation
5 *
6 * Derived from the original pwm-lpss.c
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <linux/pci.h>
16
17#include "pwm-lpss.h"
18
19static int pwm_lpss_probe_pci(struct pci_dev *pdev,
20 const struct pci_device_id *id)
21{
22 const struct pwm_lpss_boardinfo *info;
23 struct pwm_lpss_chip *lpwm;
24 int err;
25
Andy Shevchenko90927fe2014-08-19 19:17:36 +030026 err = pcim_enable_device(pdev);
Andy Shevchenkoc558e392014-08-19 19:17:35 +030027 if (err < 0)
28 return err;
29
30 info = (struct pwm_lpss_boardinfo *)id->driver_data;
31 lpwm = pwm_lpss_probe(&pdev->dev, &pdev->resource[0], info);
32 if (IS_ERR(lpwm))
33 return PTR_ERR(lpwm);
34
35 pci_set_drvdata(pdev, lpwm);
36 return 0;
37}
38
39static void pwm_lpss_remove_pci(struct pci_dev *pdev)
40{
41 struct pwm_lpss_chip *lpwm = pci_get_drvdata(pdev);
42
43 pwm_lpss_remove(lpwm);
Andy Shevchenkoc558e392014-08-19 19:17:35 +030044}
45
46static const struct pci_device_id pwm_lpss_pci_ids[] = {
Mika Westerberg87219cb2015-10-20 16:53:06 +030047 { PCI_VDEVICE(INTEL, 0x0ac8), (unsigned long)&pwm_lpss_bxt_info},
Andy Shevchenkoc558e392014-08-19 19:17:35 +030048 { PCI_VDEVICE(INTEL, 0x0f08), (unsigned long)&pwm_lpss_byt_info},
49 { PCI_VDEVICE(INTEL, 0x0f09), (unsigned long)&pwm_lpss_byt_info},
Mika Westerberg87219cb2015-10-20 16:53:06 +030050 { PCI_VDEVICE(INTEL, 0x1ac8), (unsigned long)&pwm_lpss_bxt_info},
Andy Shevchenkoc558e392014-08-19 19:17:35 +030051 { PCI_VDEVICE(INTEL, 0x2288), (unsigned long)&pwm_lpss_bsw_info},
52 { PCI_VDEVICE(INTEL, 0x2289), (unsigned long)&pwm_lpss_bsw_info},
Mika Westerberg03f00e52015-10-20 16:53:07 +030053 { PCI_VDEVICE(INTEL, 0x5ac8), (unsigned long)&pwm_lpss_bxt_info},
Andy Shevchenkoc558e392014-08-19 19:17:35 +030054 { },
55};
56MODULE_DEVICE_TABLE(pci, pwm_lpss_pci_ids);
57
58static struct pci_driver pwm_lpss_driver_pci = {
59 .name = "pwm-lpss",
60 .id_table = pwm_lpss_pci_ids,
61 .probe = pwm_lpss_probe_pci,
62 .remove = pwm_lpss_remove_pci,
63};
64module_pci_driver(pwm_lpss_driver_pci);
65
66MODULE_DESCRIPTION("PWM PCI driver for Intel LPSS");
67MODULE_LICENSE("GPL v2");