30 #include <linux/kernel.h>
31 #include <linux/module.h>
33 #include <linux/i2c.h>
34 #include <linux/errno.h>
35 #include <linux/sched.h>
39 #include <linux/slab.h>
40 #include <linux/pci.h>
44 #define DRIVER_NAME "i2c-designware-pci"
67 #define INTEL_MID_STD_CFG (DW_IC_CON_MASTER | \
68 DW_IC_CON_SLAVE_DISABLE | \
141 static int i2c_dw_pci_suspend(
struct device *
dev)
144 struct dw_i2c_dev *i2c = pci_get_drvdata(pdev);
152 dev_err(&pdev->
dev,
"pci_save_state failed\n");
158 dev_err(&pdev->
dev,
"pci_set_power_state failed\n");
165 static int i2c_dw_pci_resume(
struct device *dev)
168 struct dw_i2c_dev *i2c = pci_get_drvdata(pdev);
178 dev_err(&pdev->
dev,
"pci_set_power_state() failed\n");
188 static int i2c_dw_pci_runtime_idle(
struct device *dev)
191 dev_dbg(dev,
"runtime_idle called\n");
198 static const struct dev_pm_ops i2c_dw_pm_ops = {
199 .resume = i2c_dw_pci_resume,
200 .suspend = i2c_dw_pci_suspend,
202 i2c_dw_pci_runtime_idle)
226 controller = &dw_pci_controllers[
id->driver_data];
230 dev_err(&pdev->
dev,
"Failed to enable I2C PCI device (%d)\n",
238 if (!start || len == 0) {
239 dev_err(&pdev->
dev,
"base address not set\n");
246 dev_err(&pdev->
dev,
"failed to request I2C region "
247 "0x%lx-0x%lx\n", start,
254 dev_err(&pdev->
dev,
"I/O memory remapping failed\n");
256 goto err_release_region;
263 goto err_release_region;
281 pci_set_drvdata(pdev, dev);
290 i2c_set_adapdata(adap, dev);
293 adap->
algo = &i2c_dw_algo;
294 adap->
dev.parent = &pdev->
dev;
301 dev_err(&pdev->
dev,
"failure requesting irq %i\n", dev->
irq);
309 dev_err(&pdev->
dev,
"failure adding adapter\n");
313 pm_runtime_put_noidle(&pdev->
dev);
322 pci_set_drvdata(pdev,
NULL);
333 struct dw_i2c_dev *dev = pci_get_drvdata(pdev);
337 pm_runtime_get_noresume(&pdev->
dev);
339 pci_set_drvdata(pdev,
NULL);
369 .id_table = i2_designware_pci_ids,
370 .probe = i2c_dw_pci_probe,
373 .pm = &i2c_dw_pm_ops,