xref: /OK3568_Linux_fs/kernel/drivers/media/pci/cx23885/cx23885-av.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-or-later
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  *  Driver for the Conexant CX23885/7/8 PCIe bridge
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  *  AV device support routines - non-input, non-vl42_subdev routines
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  *  Copyright (C) 2010  Andy Walls <awalls@md.metrocast.net>
8*4882a593Smuzhiyun  */
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include "cx23885.h"
11*4882a593Smuzhiyun #include "cx23885-av.h"
12*4882a593Smuzhiyun #include "cx23885-video.h"
13*4882a593Smuzhiyun 
cx23885_av_work_handler(struct work_struct * work)14*4882a593Smuzhiyun void cx23885_av_work_handler(struct work_struct *work)
15*4882a593Smuzhiyun {
16*4882a593Smuzhiyun 	struct cx23885_dev *dev =
17*4882a593Smuzhiyun 			   container_of(work, struct cx23885_dev, cx25840_work);
18*4882a593Smuzhiyun 	bool handled = false;
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun 	v4l2_subdev_call(dev->sd_cx25840, core, interrupt_service_routine,
21*4882a593Smuzhiyun 			 PCI_MSK_AV_CORE, &handled);
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun 	/* Getting here with the interrupt not handled
24*4882a593Smuzhiyun 	   then probbaly flatiron does have pending interrupts.
25*4882a593Smuzhiyun 	*/
26*4882a593Smuzhiyun 	if (!handled) {
27*4882a593Smuzhiyun 		/* clear left and right adc channel interrupt request flag */
28*4882a593Smuzhiyun 		cx23885_flatiron_write(dev, 0x1f,
29*4882a593Smuzhiyun 			cx23885_flatiron_read(dev, 0x1f) | 0x80);
30*4882a593Smuzhiyun 		cx23885_flatiron_write(dev, 0x23,
31*4882a593Smuzhiyun 			cx23885_flatiron_read(dev, 0x23) | 0x80);
32*4882a593Smuzhiyun 	}
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun 	cx23885_irq_enable(dev, PCI_MSK_AV_CORE);
35*4882a593Smuzhiyun }
36