FILE
pwm-lpss-pci.c
File preview with syntax highlighting.
linux-6.19.14/drivers/pwm/pwm-lpss-pci.c
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Intel Low Power Subsystem PWM controller PCI driver 4 * 5 * Copyright (C) 2014, Intel Corporation 6 * 7 * Derived from the original pwm-lpss.c 8 */ 9 10#include <linux/kernel.h> 11#include <linux/module.h> 12#include <linux/pci.h> 13#include <linux/pm_runtime.h> 14 15#include "pwm-lpss.h" 16 17static int pwm_lpss_probe_pci(struct pci_dev *pdev, 18 const struct pci_device_id *id) 19{ 20 const struct pwm_lpss_boardinfo *info; 21 void __iomem *io_base; 22 struct pwm_chip *chip; 23 int err; 24 25 err = pcim_enable_device(pdev); 26 if (err < 0) 27 return err; 28 29 io_base = pcim_iomap_region(pdev, 0, "pwm-lpss"); 30 if (IS_ERR(io_base)) 31 return PTR_ERR(io_base); 32 33 info = (struct pwm_lpss_boardinfo *)id->driver_data; 34 chip = devm_pwm_lpss_probe(&pdev->dev, io_base, info); 35 if (IS_ERR(chip)) 36 return PTR_ERR(chip); 37 38 pm_runtime_put(&pdev->dev); 39 pm_runtime_allow(&pdev->dev); 40 41 return 0; 42} 43 44static void pwm_lpss_remove_pci(struct pci_dev *pdev) 45{ 46 pm_runtime_forbid(&pdev->dev); 47 pm_runtime_get_sync(&pdev->dev); 48} 49 50static const struct pci_device_id pwm_lpss_pci_ids[] = { 51 { PCI_VDEVICE(INTEL, 0x0ac8), (unsigned long)&pwm_lpss_bxt_info}, 52 { PCI_VDEVICE(INTEL, 0x0f08), (unsigned long)&pwm_lpss_byt_info}, 53 { PCI_VDEVICE(INTEL, 0x0f09), (unsigned long)&pwm_lpss_byt_info}, 54 { PCI_VDEVICE(INTEL, 0x11a5), (unsigned long)&pwm_lpss_tng_info}, 55 { PCI_VDEVICE(INTEL, 0x1ac8), (unsigned long)&pwm_lpss_bxt_info}, 56 { PCI_VDEVICE(INTEL, 0x2288), (unsigned long)&pwm_lpss_bsw_info}, 57 { PCI_VDEVICE(INTEL, 0x2289), (unsigned long)&pwm_lpss_bsw_info}, 58 { PCI_VDEVICE(INTEL, 0x31c8), (unsigned long)&pwm_lpss_bxt_info}, 59 { PCI_VDEVICE(INTEL, 0x5ac8), (unsigned long)&pwm_lpss_bxt_info}, 60 { }, 61}; 62MODULE_DEVICE_TABLE(pci, pwm_lpss_pci_ids); 63 64static struct pci_driver pwm_lpss_driver_pci = { 65 .name = "pwm-lpss", 66 .id_table = pwm_lpss_pci_ids, 67 .probe = pwm_lpss_probe_pci, 68 .remove = pwm_lpss_remove_pci, 69}; 70module_pci_driver(pwm_lpss_driver_pci); 71 72MODULE_DESCRIPTION("PWM PCI driver for Intel LPSS"); 73MODULE_LICENSE("GPL v2"); 74MODULE_IMPORT_NS("PWM_LPSS");
~/
Read-only file preview.