mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	i2c: designware-pci: Switch over to MSI interrupts
Some devices support MSI interrupts. Let's at least try to use them in platforms that provide MSI capability. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
		
							parent
							
								
									f0b576801d
								
							
						
					
					
						commit
						21aa3983d6
					
				
					 1 changed files with 14 additions and 3 deletions
				
			
		| 
						 | 
					@ -225,6 +225,8 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 | 
				
			||||||
		return r;
 | 
							return r;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pci_set_master(pdev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r = pcim_iomap_regions(pdev, 1 << 0, pci_name(pdev));
 | 
						r = pcim_iomap_regions(pdev, 1 << 0, pci_name(pdev));
 | 
				
			||||||
	if (r) {
 | 
						if (r) {
 | 
				
			||||||
		dev_err(&pdev->dev, "I/O memory remapping failed\n");
 | 
							dev_err(&pdev->dev, "I/O memory remapping failed\n");
 | 
				
			||||||
| 
						 | 
					@ -235,19 +237,25 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 | 
				
			||||||
	if (!dev)
 | 
						if (!dev)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -ENOMEM;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						r = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
 | 
				
			||||||
 | 
						if (r < 0)
 | 
				
			||||||
 | 
							return r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dev->clk = NULL;
 | 
						dev->clk = NULL;
 | 
				
			||||||
	dev->controller = controller;
 | 
						dev->controller = controller;
 | 
				
			||||||
	dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
 | 
						dev->get_clk_rate_khz = i2c_dw_get_clk_rate_khz;
 | 
				
			||||||
	dev->base = pcim_iomap_table(pdev)[0];
 | 
						dev->base = pcim_iomap_table(pdev)[0];
 | 
				
			||||||
	dev->dev = &pdev->dev;
 | 
						dev->dev = &pdev->dev;
 | 
				
			||||||
	dev->irq = pdev->irq;
 | 
						dev->irq = pci_irq_vector(pdev, 0);
 | 
				
			||||||
	dev->flags |= controller->flags;
 | 
						dev->flags |= controller->flags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (controller->setup) {
 | 
						if (controller->setup) {
 | 
				
			||||||
		r = controller->setup(pdev, controller);
 | 
							r = controller->setup(pdev, controller);
 | 
				
			||||||
		if (r)
 | 
							if (r) {
 | 
				
			||||||
 | 
								pci_free_irq_vectors(pdev);
 | 
				
			||||||
			return r;
 | 
								return r;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	dev->functionality = controller->functionality |
 | 
						dev->functionality = controller->functionality |
 | 
				
			||||||
				DW_IC_DEFAULT_FUNCTIONALITY;
 | 
									DW_IC_DEFAULT_FUNCTIONALITY;
 | 
				
			||||||
| 
						 | 
					@ -274,8 +282,10 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 | 
				
			||||||
	adap->nr = controller->bus_num;
 | 
						adap->nr = controller->bus_num;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	r = i2c_dw_probe(dev);
 | 
						r = i2c_dw_probe(dev);
 | 
				
			||||||
	if (r)
 | 
						if (r) {
 | 
				
			||||||
 | 
							pci_free_irq_vectors(pdev);
 | 
				
			||||||
		return r;
 | 
							return r;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
 | 
						pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
 | 
				
			||||||
	pm_runtime_use_autosuspend(&pdev->dev);
 | 
						pm_runtime_use_autosuspend(&pdev->dev);
 | 
				
			||||||
| 
						 | 
					@ -294,6 +304,7 @@ static void i2c_dw_pci_remove(struct pci_dev *pdev)
 | 
				
			||||||
	pm_runtime_get_noresume(&pdev->dev);
 | 
						pm_runtime_get_noresume(&pdev->dev);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	i2c_del_adapter(&dev->adapter);
 | 
						i2c_del_adapter(&dev->adapter);
 | 
				
			||||||
 | 
						pci_free_irq_vectors(pdev);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* work with hotplug and coldplug */
 | 
					/* work with hotplug and coldplug */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue