pwm-lpss-pci.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  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. #include <linux/kernel.h>
  13. #include <linux/module.h>
  14. #include <linux/pci.h>
  15. #include "pwm-lpss.h"
  16. static int pwm_lpss_probe_pci(struct pci_dev *pdev,
  17. const struct pci_device_id *id)
  18. {
  19. const struct pwm_lpss_boardinfo *info;
  20. struct pwm_lpss_chip *lpwm;
  21. int err;
  22. err = pcim_enable_device(pdev);
  23. if (err < 0)
  24. return err;
  25. info = (struct pwm_lpss_boardinfo *)id->driver_data;
  26. lpwm = pwm_lpss_probe(&pdev->dev, &pdev->resource[0], info);
  27. if (IS_ERR(lpwm))
  28. return PTR_ERR(lpwm);
  29. pci_set_drvdata(pdev, lpwm);
  30. return 0;
  31. }
  32. static void pwm_lpss_remove_pci(struct pci_dev *pdev)
  33. {
  34. struct pwm_lpss_chip *lpwm = pci_get_drvdata(pdev);
  35. pwm_lpss_remove(lpwm);
  36. }
  37. static const struct pci_device_id pwm_lpss_pci_ids[] = {
  38. { PCI_VDEVICE(INTEL, 0x0ac8), (unsigned long)&pwm_lpss_bsw_info},
  39. { PCI_VDEVICE(INTEL, 0x0f08), (unsigned long)&pwm_lpss_byt_info},
  40. { PCI_VDEVICE(INTEL, 0x0f09), (unsigned long)&pwm_lpss_byt_info},
  41. { PCI_VDEVICE(INTEL, 0x1ac8), (unsigned long)&pwm_lpss_bsw_info},
  42. { PCI_VDEVICE(INTEL, 0x2288), (unsigned long)&pwm_lpss_bsw_info},
  43. { PCI_VDEVICE(INTEL, 0x2289), (unsigned long)&pwm_lpss_bsw_info},
  44. { },
  45. };
  46. MODULE_DEVICE_TABLE(pci, pwm_lpss_pci_ids);
  47. static struct pci_driver pwm_lpss_driver_pci = {
  48. .name = "pwm-lpss",
  49. .id_table = pwm_lpss_pci_ids,
  50. .probe = pwm_lpss_probe_pci,
  51. .remove = pwm_lpss_remove_pci,
  52. };
  53. module_pci_driver(pwm_lpss_driver_pci);
  54. MODULE_DESCRIPTION("PWM PCI driver for Intel LPSS");
  55. MODULE_LICENSE("GPL v2");