Skip to contentSkip to conversation

cx23885: Disable analog video

PATCH New Bradford Love 1 participant 2 messages Mar 17 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover cx23885: Disable analog video

There is already the ability to disable analog audio in this driver. The attached patch goes one step further and allows disabling analog video entirely.

This helps on some modern system which can cause glitches in the DMA engine relating to analog, which breaks digital. These glitches can happen even if analog is not in use.

I'm just throwing out this patch out there, if it is not acceptable or could be done differently please let me know. Thanks.

Regards,

Bradford

Bradford Love (1):
cx23885: Module option to disable analog video

 drivers/media/pci/cx23885/cx23885-cards.c |  3 +++
 drivers/media/pci/cx23885/cx23885-core.c  | 15 ++++++++++++++-
 drivers/media/pci/cx23885/cx23885-dvb.c   |  6 ++++--
 drivers/media/pci/cx23885/cx23885.h       |  1 +
 4 files changed, 22 insertions(+), 3 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/1 media: cx23885: Module option to disable analog video

Initialized and left to themselves some boards with analog inputs, on some modern platforms can throw critical errors which prevents even digital from working thereafter. If analog is never used this module parameter allows analog to be disabled on a card by card basis.

It is already possible to disable analog audio.

For example, to disable for Hauppauge QuadHD with analog functionality:

options cx23885 disable_analog_video=56,57

can be placed insode of /etc/modprobe.d/cx23885.conf

---
 drivers/media/pci/cx23885/cx23885-cards.c |  3 +++
 drivers/media/pci/cx23885/cx23885-core.c  | 15 ++++++++++++++-
 drivers/media/pci/cx23885/cx23885-dvb.c   |  6 ++++--
 drivers/media/pci/cx23885/cx23885.h       |  1 +
 4 files changed, 22 insertions(+), 3 deletions(-)
drivers/media/pci/cx23885/cx23885-cards.c +3 -0
index da23e7dfeef5..95a84709d5a6 100644
@@ -2443,6 +2443,9 @@ void cx23885_card_setup(struct cx23885_dev *dev)
 	case CX23885_BOARD_VIEWCAST_460E:
 	case CX23885_BOARD_AVERMEDIA_CE310B:
 	case CX23885_BOARD_AVERMEDIA_H789C:
+		if (dev->disable_analog)
+			break;
+
 		dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev,
 				&dev->i2c_bus[2].i2c_adap,
 				"cx25840", 0x88 >> 1, NULL);
drivers/media/pci/cx23885/cx23885-core.c +14 -1
index 0892a5fd137d..4a8af8b88d84 100644
@@ -48,6 +48,11 @@ static unsigned int debug;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, "enable debug messages");
 
+static unsigned int disable_analog_video[8] = { 0, 0, 0, 0, 0, 0, 0, 0};
+static int disable_analog_argc;
+module_param_array(disable_analog_video, int, &disable_analog_argc, 0644);
+MODULE_PARM_DESC(disable_analog_video, "disable analog video for card type");
+
 static unsigned int card[]  = {[0 ... (CX23885_MAXBOARDS - 1)] = UNSET };
 module_param_array(card,  int, NULL, 0444);
 MODULE_PARM_DESC(card, "card type");
@@ -924,6 +929,13 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
 			dev->board = CX23885_BOARD_HAUPPAUGE_QUADHD_DVB_885;
 	}
 
+	for (i = 0; i < disable_analog_argc; i++) {
+		if (disable_analog_video[i] == dev->board) {
+			pr_warn("Disabling analog for board %d\n", dev->board);
+			dev->disable_analog = 1;
+		}
+	}
+
 	/* If the user specific a clk freq override, apply it */
 	if (cx23885_boards[dev->board].clk_freq > 0)
 		dev->clk_freq = cx23885_boards[dev->board].clk_freq;
@@ -1043,7 +1055,8 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
 		cx23885_gpio_enable(dev, 0x300, 0);
 	}
 
-	if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) {
+	if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO &&
+	    !dev->disable_analog) {
 		if (cx23885_video_register(dev) < 0) {
 			pr_err("%s() Failed to register analog video adapters on VID_A\n",
 			       __func__);
drivers/media/pci/cx23885/cx23885-dvb.c +4 -2
index 05a7859cbe57..f240ccda40ed 100644
@@ -2373,7 +2373,8 @@ static int dvb_register(struct cx23885_tsport *port)
 			port->i2c_client_tuner = client_tuner;
 
 			/* we only attach tuner for analog on the 888 version */
-			if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_DVB) {
+			if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_DVB &&
+			    !dev->disable_analog) {
 				pr_info("%s(): QUADHD_DVB analog setup\n",
 					__func__);
 				dev->ts1.analog_fe.tuner_priv = client_tuner;
@@ -2466,7 +2467,8 @@ static int dvb_register(struct cx23885_tsport *port)
 			port->i2c_client_tuner = client_tuner;
 
 			/* we only attach tuner for analog on the 888 version */
-			if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC) {
+			if (dev->board == CX23885_BOARD_HAUPPAUGE_QUADHD_ATSC &&
+			    !dev->disable_analog) {
 				pr_info("%s(): QUADHD_ATSC analog setup\n",
 					__func__);
 				dev->ts1.analog_fe.tuner_priv = client_tuner;
drivers/media/pci/cx23885/cx23885.h +1 -0
index 8ba1f306238c..8653ee1d9ba6 100644
@@ -404,6 +404,7 @@ struct cx23885_dev {
 	unsigned char              radio_addr;
 	struct v4l2_subdev	   *sd_cx25840;
 	struct work_struct	   cx25840_work;
+	unsigned int		   disable_analog;
 
 	/* Infrared */
 	struct v4l2_subdev         *sd_ir;
Signature · 1 line
2.35.1