@@ -2231,6 +2231,28 @@ static void cx23885_finidev(struct pci_dev *pci_dev)
kfree(dev);
}
+static int __maybe_unused cx23885_suspend(struct device *dev_d)
+{
+ struct pci_dev *pci_dev = to_pci_dev(dev_d);
+ struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
+ struct cx23885_dev *dev = to_cx23885(v4l2_dev);
+
+ cx23885_shutdown(dev);
+
+ return 0;
+}
+
+static int __maybe_unused cx23885_resume(struct device *dev_d)
+{
+ struct pci_dev *pci_dev = to_pci_dev(dev_d);
+ struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
+ struct cx23885_dev *dev = to_cx23885(v4l2_dev);
+
+ cx23885_reset(dev);
+
+ return 0;
+}
+
static const struct pci_device_id cx23885_pci_tbl[] = {
{
/* CX23885 */
@@ -2250,11 +2272,14 @@ static const struct pci_device_id cx23885_pci_tbl[] = {
};
MODULE_DEVICE_TABLE(pci, cx23885_pci_tbl);
+static SIMPLE_DEV_PM_OPS(cx23885_pm_ops, cx23885_suspend, cx23885_resume);
+
static struct pci_driver cx23885_pci_driver = {
- .name = "cx23885",
- .id_table = cx23885_pci_tbl,
- .probe = cx23885_initdev,
- .remove = cx23885_finidev,
+ .name = "cx23885",
+ .id_table = cx23885_pci_tbl,
+ .probe = cx23885_initdev,
+ .remove = cx23885_finidev,
+ .driver.pm = &cx23885_pm_ops,
};
static int __init cx23885_init(void)
After suspend-to-memory or suspend-to-disk, additional chips are no longer reachable via i2c. Trying to tune to DVB-C on a cx23885 based Hauppauge WinTV-HVR-4400-HD: si2165 8-0064: could not set chip_mode tda18271: performing RF tracking filter calibration This patch implements the simplest possible suspend/resume that is enough to tune to dvb-c channel after resume. Afterwards dmesg looks like this: si2165 8-0064: downloading firmware from file 'dvb-demod-si2165.fw' size=5768 si2165 8-0064: si2165_upload_firmware: extracted patch_version=0x9a, block_count=0x27, crc_expected=0xcc0a si2165 8-0064: fw load finished tda18271: performing RF tracking filter calibration tda18271: RF tracking filter calibration complete Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> --- drivers/media/pci/cx23885/cx23885-core.c | 33 +++++++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-)