1c942fddfSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
2b285192aSMauro Carvalho Chehab /*
3b285192aSMauro Carvalho Chehab  *  Driver for the Conexant CX23885/7/8 PCIe bridge
4b285192aSMauro Carvalho Chehab  *
5b285192aSMauro Carvalho Chehab  *  AV device support routines - non-input, non-vl42_subdev routines
6b285192aSMauro Carvalho Chehab  *
7b285192aSMauro Carvalho Chehab  *  Copyright (C) 2010  Andy Walls <awalls@md.metrocast.net>
8b285192aSMauro Carvalho Chehab  */
9b285192aSMauro Carvalho Chehab 
10b285192aSMauro Carvalho Chehab #include "cx23885.h"
11ada73eeeSMauro Carvalho Chehab #include "cx23885-av.h"
125bc08e19SLuis Alves #include "cx23885-video.h"
13b285192aSMauro Carvalho Chehab 
cx23885_av_work_handler(struct work_struct * work)14b285192aSMauro Carvalho Chehab void cx23885_av_work_handler(struct work_struct *work)
15b285192aSMauro Carvalho Chehab {
16b285192aSMauro Carvalho Chehab 	struct cx23885_dev *dev =
17b285192aSMauro Carvalho Chehab 			   container_of(work, struct cx23885_dev, cx25840_work);
1860587bd0SDan Carpenter 	bool handled = false;
19b285192aSMauro Carvalho Chehab 
20b285192aSMauro Carvalho Chehab 	v4l2_subdev_call(dev->sd_cx25840, core, interrupt_service_routine,
21b285192aSMauro Carvalho Chehab 			 PCI_MSK_AV_CORE, &handled);
225bc08e19SLuis Alves 
235bc08e19SLuis Alves 	/* Getting here with the interrupt not handled
245bc08e19SLuis Alves 	   then probbaly flatiron does have pending interrupts.
255bc08e19SLuis Alves 	*/
265bc08e19SLuis Alves 	if (!handled) {
275bc08e19SLuis Alves 		/* clear left and right adc channel interrupt request flag */
285bc08e19SLuis Alves 		cx23885_flatiron_write(dev, 0x1f,
295bc08e19SLuis Alves 			cx23885_flatiron_read(dev, 0x1f) | 0x80);
305bc08e19SLuis Alves 		cx23885_flatiron_write(dev, 0x23,
315bc08e19SLuis Alves 			cx23885_flatiron_read(dev, 0x23) | 0x80);
325bc08e19SLuis Alves 	}
335bc08e19SLuis Alves 
34b285192aSMauro Carvalho Chehab 	cx23885_irq_enable(dev, PCI_MSK_AV_CORE);
35b285192aSMauro Carvalho Chehab }
36