Commit eefe1010 authored by Andy Walls's avatar Andy Walls Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (10759): cx18: Convert GPIO connected functions to act as v4l2_subdevices



Convert GPIO line functions, such a audio routing and device resets, to
v4l2_subdevices.  This essentially completes the conversion of cx18 to the
v4l2_device/v4l2_subdevice framework.  No regression testing has taken place as
of yet.  Also an ivtv legacy bug with GPIO mux routing and going to/from radio
mode was commented, but not fixed.

Signed-off-by: default avatarAndy Walls <awalls@radix.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ff2a2001
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static const struct cx18_card cx18_card_hvr1600_esmt = {
	.hw_audio_ctrl = CX18_HW_418_AV,
	.hw_muxer = CX18_HW_CS5345,
	.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
		  CX18_HW_CS5345 | CX18_HW_DVB,
		  CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
	.video_inputs = {
		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE7 },
		{ CX18_CARD_INPUT_SVIDEO1,    1, CX18_AV_SVIDEO1    },
@@ -102,7 +102,7 @@ static const struct cx18_card cx18_card_hvr1600_samsung = {
	.hw_audio_ctrl = CX18_HW_418_AV,
	.hw_muxer = CX18_HW_CS5345,
	.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
		  CX18_HW_CS5345 | CX18_HW_DVB,
		  CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
	.video_inputs = {
		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE7 },
		{ CX18_CARD_INPUT_SVIDEO1,    1, CX18_AV_SVIDEO1    },
@@ -155,7 +155,7 @@ static const struct cx18_card cx18_card_h900 = {
	.comment = "Analog TV capture supported\n",
	.v4l2_capabilities = CX18_CAP_ENCODER,
	.hw_audio_ctrl = CX18_HW_418_AV,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
	.video_inputs = {
		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
		{ CX18_CARD_INPUT_SVIDEO1,    1,
@@ -202,7 +202,7 @@ static const struct cx18_card cx18_card_mpc718 = {
	.comment = "Analog video capture works; some audio line in may not.\n",
	.v4l2_capabilities = CX18_CAP_ENCODER,
	.hw_audio_ctrl = CX18_HW_418_AV,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
	.video_inputs = {
		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
		{ CX18_CARD_INPUT_SVIDEO1,    1,
@@ -252,8 +252,8 @@ static const struct cx18_card cx18_card_cnxt_raptor_pal = {
	.comment = "Analog TV capture supported\n",
	.v4l2_capabilities = CX18_CAP_ENCODER,
	.hw_audio_ctrl = CX18_HW_418_AV,
	.hw_muxer = CX18_HW_GPIO_AUDIO_MUX,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_AUDIO_MUX,
	.hw_muxer = CX18_HW_GPIO_MUX,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX,
	.video_inputs = {
		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
		{ CX18_CARD_INPUT_SVIDEO1,    1,
@@ -307,7 +307,7 @@ static const struct cx18_card cx18_card_toshiba_qosmio_dvbt = {
		  "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
	.v4l2_capabilities = CX18_CAP_ENCODER,
	.hw_audio_ctrl = CX18_HW_418_AV,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
	.video_inputs = {
		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE6 },
		{ CX18_CARD_INPUT_SVIDEO1,    1,
@@ -351,8 +351,9 @@ static const struct cx18_card cx18_card_leadtek_pvr2100 = {
		  "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
	.v4l2_capabilities = CX18_CAP_ENCODER,
	.hw_audio_ctrl = CX18_HW_418_AV,
	.hw_muxer = CX18_HW_GPIO_AUDIO_MUX,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_AUDIO_MUX,
	.hw_muxer = CX18_HW_GPIO_MUX,
	.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
		  CX18_HW_GPIO_RESET_CTRL,
	.video_inputs = {
		{ CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
		{ CX18_CARD_INPUT_SVIDEO1,    1,
+2 −1
Original line number Diff line number Diff line
@@ -27,7 +27,8 @@
#define CX18_HW_CS5345		(1 << 2)
#define CX18_HW_DVB		(1 << 3)
#define CX18_HW_418_AV		(1 << 4)
#define CX18_HW_GPIO_AUDIO_MUX	(1 << 5)
#define CX18_HW_GPIO_MUX	(1 << 5)
#define CX18_HW_GPIO_RESET_CTRL	(1 << 6)

/* video inputs */
#define	CX18_CARD_INPUT_VID_TUNER	1
+0 −2
Original line number Diff line number Diff line
@@ -22,11 +22,9 @@
 */

#include "cx18-driver.h"
#include "cx18-av-core.h"
#include "cx18-cards.h"
#include "cx18-ioctl.h"
#include "cx18-audio.h"
#include "cx18-i2c.h"
#include "cx18-mailbox.h"
#include "cx18-controls.h"

+19 −3
Original line number Diff line number Diff line
@@ -684,7 +684,6 @@ static void cx18_init_subdevs(struct cx18 *cx)
			continue;

		switch (device) {
		case CX18_HW_GPIO_AUDIO_MUX:
		case CX18_HW_DVB:
		case CX18_HW_TVEEPROM:
			/* These subordinate devices do not use probing */
@@ -695,6 +694,16 @@ static void cx18_init_subdevs(struct cx18 *cx)
			/* Just note that the card uses it (i.e. has analog) */
			cx->hw_flags |= device;
			break;
		case CX18_HW_GPIO_RESET_CTRL:
			/*
			 * The Reset Controller gets probed and added to
			 * hw_flags earlier for i2c adapter/bus initialization
			 */
			break;
		case CX18_HW_GPIO_MUX:
			if (cx18_gpio_register(cx, device) == 0)
				cx->hw_flags |= device;
			break;
		default:
			if (cx18_i2c_register(cx, i) == 0)
				cx->hw_flags |= device;
@@ -793,7 +802,6 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
	cx->scb = (struct cx18_scb __iomem *)(cx->enc_mem + SCB_OFFSET);
	cx18_init_scb(cx);

	/* Initialize GPIO early so I2C device resets can be performed */
	cx18_gpio_init(cx);

	/* Initialize integrated A/V decoder early to set PLLs, just in case */
@@ -802,9 +810,17 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
		CX18_ERR("Could not register A/V decoder subdevice\n");
		goto free_map;
	}
	/* Initialize the A/V decoder PLLs to sane defaults */
	cx18_call_hw(cx, CX18_HW_418_AV, core, init, (u32) CX18_AV_INIT_PLLS);

	/* Initialize GPIO Reset Controller to do chip resets during i2c init */
	if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) {
		if (cx18_gpio_register(cx, CX18_HW_GPIO_RESET_CTRL) != 0)
			CX18_WARN("Could not register GPIO reset controller"
				  "subdevice; proceeding anyway.\n");
		else
			cx->hw_flags |= CX18_HW_GPIO_RESET_CTRL;
	}

	/* active i2c  */
	CX18_DEBUG_INFO("activating i2c...\n");
	retval = init_cx18_i2c(cx);
+3 −1
Original line number Diff line number Diff line
@@ -449,7 +449,7 @@ struct cx18 {
	struct pci_dev *pci_dev;
	struct v4l2_device v4l2_dev;
	struct v4l2_subdev *sd_av;     /* A/V decoder/digitizer sub-device */
	struct v4l2_subdev *sd_extmux; /* External audio multiplexer sub-dev */
	struct v4l2_subdev *sd_extmux; /* External multiplexer sub-dev */

	const struct cx18_card *card;	/* card information */
	const char *card_name;  /* full name of the card */
@@ -534,6 +534,8 @@ struct cx18 {
	u32 gpio_dir;
	u32 gpio_val;
	struct mutex gpio_lock;
	struct v4l2_subdev sd_gpiomux;
	struct v4l2_subdev sd_resetctrl;

	/* v4l2 and User settings */

Loading