Lines Matching full: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);
159 static int cafe_smbus_write_data(struct cafe_camera *cam, in cafe_smbus_write_data() argument
164 struct mcam_camera *mcam = &cam->mcam; in cafe_smbus_write_data()
197 wait_event_timeout(cam->smbus_wait, cafe_smbus_write_done(mcam), in cafe_smbus_write_data()
205 cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, in cafe_smbus_write_data()
210 cam_err(cam, "SMBUS write (%02x/%02x/%02x) error\n", addr, in cafe_smbus_write_data()
238 static int cafe_smbus_read_data(struct cafe_camera *cam, in cafe_smbus_read_data() argument
243 struct mcam_camera *mcam = &cam->mcam; in cafe_smbus_read_data()
258 wait_event_timeout(cam->smbus_wait, in cafe_smbus_read_data()
265 cam_err(cam, "SMBUS read (%02x/%02x) error\n", addr, command); in cafe_smbus_read_data()
269 cam_err(cam, "SMBUS read (%02x/%02x) timed out\n", addr, in cafe_smbus_read_data()
285 struct cafe_camera *cam = i2c_get_adapdata(adapter); in cafe_smbus_xfer() local
290 * it can do word too, but the cam chip has no use for that. in cafe_smbus_xfer()
293 cam_err(cam, "funky xfer size %d\n", size); in cafe_smbus_xfer()
298 ret = cafe_smbus_write_data(cam, addr, command, data->byte); in cafe_smbus_xfer()
300 ret = cafe_smbus_read_data(cam, addr, command, &data->byte); in cafe_smbus_xfer()
305 static void cafe_smbus_enable_irq(struct cafe_camera *cam) in cafe_smbus_enable_irq() argument
309 spin_lock_irqsave(&cam->mcam.dev_lock, flags); in cafe_smbus_enable_irq()
310 mcam_reg_set_bit(&cam->mcam, REG_IRQMASK, TWSIIRQS); in cafe_smbus_enable_irq()
311 spin_unlock_irqrestore(&cam->mcam.dev_lock, flags); in cafe_smbus_enable_irq()
325 static int cafe_smbus_setup(struct cafe_camera *cam) in cafe_smbus_setup() argument
336 adap->dev.parent = &cam->pdev->dev; in cafe_smbus_setup()
337 i2c_set_adapdata(adap, cam); in cafe_smbus_setup()
345 cam->i2c_adapter = adap; in cafe_smbus_setup()
346 cafe_smbus_enable_irq(cam); in cafe_smbus_setup()
350 static void cafe_smbus_shutdown(struct cafe_camera *cam) in cafe_smbus_shutdown() argument
352 i2c_del_adapter(cam->i2c_adapter); in cafe_smbus_shutdown()
353 kfree(cam->i2c_adapter); in cafe_smbus_shutdown()
430 struct cafe_camera *cam = data; in cafe_irq() local
431 struct mcam_camera *mcam = &cam->mcam; in cafe_irq()
436 handled = cam->registered && mccic_irq(mcam, irqs); in cafe_irq()
439 wake_up(&cam->smbus_wait); in cafe_irq()
479 struct cafe_camera *cam; in cafe_pci_probe() local
488 cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); in cafe_pci_probe()
489 if (cam == NULL) in cafe_pci_probe()
491 pci_set_drvdata(pdev, cam); in cafe_pci_probe()
492 cam->pdev = pdev; in cafe_pci_probe()
493 mcam = &cam->mcam; in cafe_pci_probe()
496 init_waitqueue_head(&cam->smbus_wait); in cafe_pci_probe()
521 ret = request_irq(pdev->irq, cafe_irq, IRQF_SHARED, "cafe-ccic", cam); in cafe_pci_probe()
535 ret = cafe_smbus_setup(cam); in cafe_pci_probe()
546 i2c_adapter_id(cam->i2c_adapter), in cafe_pci_probe()
559 i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr); in cafe_pci_probe()
561 i2c_dev = i2c_new_client_device(cam->i2c_adapter, &ov7670_info); in cafe_pci_probe()
567 cam->registered = 1; in cafe_pci_probe()
575 cafe_smbus_shutdown(cam); in cafe_pci_probe()
578 free_irq(pdev->irq, cam); in cafe_pci_probe()
584 kfree(cam); in cafe_pci_probe()
593 static void cafe_shutdown(struct cafe_camera *cam) in cafe_shutdown() argument
595 mccic_shutdown(&cam->mcam); in cafe_shutdown()
596 v4l2_device_unregister(&cam->mcam.v4l2_dev); 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()