Lines Matching refs:cam
129 #define cam_err(cam, fmt, arg...) \ argument
130 dev_err(&(cam)->pdev->dev, fmt, ##arg);
131 #define cam_warn(cam, fmt, arg...) \ argument
132 dev_warn(&(cam)->pdev->dev, fmt, ##arg);
166 static int cafe_smbus_write_data(struct cafe_camera *cam, in cafe_smbus_write_data() argument
171 struct mcam_camera *mcam = &cam->mcam; in cafe_smbus_write_data()
204 wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(mcam), in cafe_smbus_write_data()
212 cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, in cafe_smbus_write_data()
217 cam_err(cam, "SMBUS write (%02x/%02x/%02x) error\n", addr, in cafe_smbus_write_data()
245 static int cafe_smbus_read_data(struct cafe_camera *cam, in cafe_smbus_read_data() argument
250 struct mcam_camera *mcam = &cam->mcam; in cafe_smbus_read_data()
265 wait_event_timeout(cam->smbus_wait, in cafe_smbus_read_data()
272 cam_err(cam, "SMBUS read (%02x/%02x) error\n", addr, command); in cafe_smbus_read_data()
276 cam_err(cam, "SMBUS read (%02x/%02x) timed out\n", addr, in cafe_smbus_read_data()
292 struct cafe_camera *cam = i2c_get_adapdata(adapter); in cafe_smbus_xfer() local
300 cam_err(cam, "funky xfer size %d\n", size); in cafe_smbus_xfer()
305 ret = cafe_smbus_write_data(cam, addr, command, data->byte); in cafe_smbus_xfer()
307 ret = cafe_smbus_read_data(cam, addr, command, &data->byte); in cafe_smbus_xfer()
312 static void cafe_smbus_enable_irq(struct cafe_camera *cam) in cafe_smbus_enable_irq() argument
316 spin_lock_irqsave(&cam->mcam.dev_lock, flags); in cafe_smbus_enable_irq()
317 mcam_reg_set_bit(&cam->mcam, REG_IRQMASK, TWSIIRQS); in cafe_smbus_enable_irq()
318 spin_unlock_irqrestore(&cam->mcam.dev_lock, flags); in cafe_smbus_enable_irq()
332 static int cafe_smbus_setup(struct cafe_camera *cam) in cafe_smbus_setup() argument
343 adap->dev.parent = &cam->pdev->dev; in cafe_smbus_setup()
344 i2c_set_adapdata(adap, cam); in cafe_smbus_setup()
352 cam->i2c_adapter = adap; in cafe_smbus_setup()
353 cafe_smbus_enable_irq(cam); in cafe_smbus_setup()
357 static void cafe_smbus_shutdown(struct cafe_camera *cam) in cafe_smbus_shutdown() argument
359 i2c_del_adapter(cam->i2c_adapter); in cafe_smbus_shutdown()
360 kfree(cam->i2c_adapter); in cafe_smbus_shutdown()
437 struct cafe_camera *cam = data; in cafe_irq() local
438 struct mcam_camera *mcam = &cam->mcam; in cafe_irq()
443 handled = cam->registered && mccic_irq(mcam, irqs); in cafe_irq()
446 wake_up(&cam->smbus_wait); in cafe_irq()
486 struct cafe_camera *cam; in cafe_pci_probe() local
495 cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); in cafe_pci_probe()
496 if (cam == NULL) in cafe_pci_probe()
498 pci_set_drvdata(pdev, cam); in cafe_pci_probe()
499 cam->pdev = pdev; in cafe_pci_probe()
500 mcam = &cam->mcam; in cafe_pci_probe()
503 init_waitqueue_head(&cam->smbus_wait); in cafe_pci_probe()
529 ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam); in cafe_pci_probe()
543 ret = cafe_smbus_setup(cam); in cafe_pci_probe()
550 i2c_adapter_id(cam->i2c_adapter), in cafe_pci_probe()
562 i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr); in cafe_pci_probe()
564 i2c_dev = i2c_new_client_device(cam->i2c_adapter, &ov7670_info); in cafe_pci_probe()
570 cam->registered = 1; in cafe_pci_probe()
576 cafe_smbus_shutdown(cam); in cafe_pci_probe()
579 free_irq(pdev->irq, cam); in cafe_pci_probe()
585 kfree(cam); in cafe_pci_probe()
594 static void cafe_shutdown(struct cafe_camera *cam) in cafe_shutdown() argument
596 mccic_shutdown(&cam->mcam); in cafe_shutdown()
597 cafe_smbus_shutdown(cam); in cafe_shutdown()
598 free_irq(cam->pdev->irq, cam); in cafe_shutdown()
599 pci_iounmap(cam->pdev, cam->mcam.regs); in cafe_shutdown()
605 struct cafe_camera *cam = pci_get_drvdata(pdev); in cafe_pci_remove() local
607 if (cam == NULL) { in cafe_pci_remove()
611 cafe_shutdown(cam); in cafe_pci_remove()
612 kfree(cam); in cafe_pci_remove()
621 struct cafe_camera *cam = dev_get_drvdata(dev); in cafe_pci_suspend() local
623 mccic_suspend(&cam->mcam); in cafe_pci_suspend()
630 struct cafe_camera *cam = dev_get_drvdata(dev); in cafe_pci_resume() local
632 cafe_ctlr_init(&cam->mcam); in cafe_pci_resume()
633 return mccic_resume(&cam->mcam); in cafe_pci_resume()