Skip to contentSkip to conversation

Assorted DVB and TV patches

PATCH In review Bradford Love 3 participants 19 messages Mar 12 – Mar 19

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Assorted DVB and TV patches

Hello,

Attached here is a series of accumlated fixes from integrations and deployments.

The first five patches are related to fixing issues with a variety of analog video formats.

The si2168 i2c timeout patch is something that has been found to be critical on a variety of ARM platforms and Nvidia SOC. Something in these platforms has USB i2c not consistently responding within the embedded deadline in the driver.

There are two firmware fixes. With Hauppauge hardware fw 4.0-11 si2168 devices definitely lose warm state and cannot function after sleep. The saa7164 REV2 firmware had an incorrect filename and has been fixed.

Last up is adding some new Hauppauge USB id's and removing an invalid analog input from the Hauppauge DVB DualHD.

Addressing checkpatch warnings:
- 0001 palN is not misspelled
- 0003 adding dprintk like driver already does

Regards,

Bradford

Bradford Love (11):
si2157: Analog format fixes
cx25840: Fix NTSC-J, PAL-N, and SECAM standards
xc5000: Add rf strength function
cx231xx: Fix AGC levels for NTSC-M
au0828: Fix green screen in analog
si2168: Fix i2c command timeout on embedded platforms
si2168: fw 4.0-11 loses warm state during sleep
saa7164: Fix REV2 firmware filename
au0828: Add new Hauppauge HVR1265 and ImpactVCB-e
em28xx: Add a variety of DualHD usb id
em28xx: remove tuner type from Hauppauge DVB DualHD

 drivers/media/dvb-frontends/au8522_decoder.c |  1 +
 drivers/media/dvb-frontends/si2168.c         |  8 ++--
 drivers/media/i2c/cx25840/cx25840-core.c     | 29 +++++++++++-
 drivers/media/pci/saa7164/saa7164-fw.c       |  4 +-
 drivers/media/tuners/si2157.c                | 15 ++++--
 drivers/media/tuners/xc5000.c                | 13 ++++-
 drivers/media/usb/au0828/au0828-cards.c      | 50 ++++++++++++++++++++
 drivers/media/usb/au0828/au0828-cards.h      |  2 +
 drivers/media/usb/au0828/au0828-dvb.c        |  1 +
 drivers/media/usb/au0828/au0828-input.c      |  1 +
 drivers/media/usb/au0828/au0828-video.c      | 30 +++++++++++-
 drivers/media/usb/cx231xx/cx231xx-avcore.c   |  7 ++-
 drivers/media/usb/em28xx/em28xx-cards.c      | 19 +++++---
 13 files changed, 156 insertions(+), 24 deletions(-)
Signature · 1 line
2.35.1
#1 lore raw

PATCH 1/11 si2157: Analog format fixes

Updates to support PAL-N and PAL-Nc
Verifies PAL-I and PAL-DK standards are working
Fixes and verifies SECAM-L now works

---
 drivers/media/tuners/si2157.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/tuners/si2157.c +11 -4
index 4ca42114da8a..b041cd854732 100644
@@ -638,20 +638,27 @@ static int si2157_set_analog_params(struct dvb_frontend *fe,
 				color = 0x10;
 			}
 		}
-	} else if (params->std & V4L2_STD_MN) {
+	} else if (params->std & (V4L2_STD_MN | V4L2_STD_NTSC_443)) {
 		std = "MN";
 		bandwidth = 6000000;
 		if_frequency = 5400000;
 		system = 2;
+		if (params->std & V4L2_STD_PAL_N) {
+			std = "palN";
+			color = 0x10;
+		} else if (params->std & V4L2_STD_PAL_Nc) {
+			std = "palNc";
+			color = 0x10;
+		}
 	} else if (params->std & V4L2_STD_PAL_I) {
 		std = "palI";
 		bandwidth = 8000000;
-		if_frequency = 7250000; /* TODO: does not work yet */
+		if_frequency = 7250000;
 		system = 4;
 	} else if (params->std & V4L2_STD_DK) {
 		std = "palDK";
 		bandwidth = 8000000;
-		if_frequency = 6900000; /* TODO: does not work yet */
+		if_frequency = 6900000;
 		system = 5;
 		if (params->std & V4L2_STD_SECAM_DK) {
 			std = "secamDK";
@@ -660,7 +667,7 @@ static int si2157_set_analog_params(struct dvb_frontend *fe,
 	} else if (params->std & V4L2_STD_SECAM_L) {
 		std = "secamL";
 		bandwidth = 8000000;
-		if_frequency = 6750000; /* TODO: untested */
+		if_frequency = 6900000;
 		system = 6;
 		color = 0x10;
 	} else if (params->std & V4L2_STD_SECAM_LC) {
Signature · 1 line
2.35.1
#2 lore raw

PATCH 2/11 cx25840: Fix NTSC-J, PAL-N, and SECAM standards

In reply to Bradford Love

Formats did not correctly decode prior.

Modifications are based off cx25840 datasheet.

---
 drivers/media/i2c/cx25840/cx25840-core.c | 29 ++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
drivers/media/i2c/cx25840/cx25840-core.c +27 -2
index a86306304330..69d5cc648c0f 100644
@@ -1652,10 +1652,14 @@ static int set_v4lstd(struct i2c_client *client)
 	struct cx25840_state *state = to_state(i2c_get_clientdata(client));
 	u8 fmt = 0;	/* zero is autodetect */
 	u8 pal_m = 0;
+	u8 pal_n = 0;
+	u8 ntsc_j = 0;
+	u8 tmp_reg = 0;
 
 	/* First tests should be against specific std */
 	if (state->std == V4L2_STD_NTSC_M_JP) {
 		fmt = 0x2;
+		ntsc_j = 0x80;
 	} else if (state->std == V4L2_STD_NTSC_443) {
 		fmt = 0x3;
 	} else if (state->std == V4L2_STD_PAL_M) {
@@ -1663,6 +1667,7 @@ static int set_v4lstd(struct i2c_client *client)
 		fmt = 0x5;
 	} else if (state->std == V4L2_STD_PAL_N) {
 		fmt = 0x6;
+		pal_n = 0x40;
 	} else if (state->std == V4L2_STD_PAL_Nc) {
 		fmt = 0x7;
 	} else if (state->std == V4L2_STD_PAL_60) {
@@ -1689,10 +1694,30 @@ static int set_v4lstd(struct i2c_client *client)
 		/* Set format to NTSC-M */
 		cx25840_and_or(client, 0x400, ~0xf, 1);
 		/* Turn off LCOMB */
-		cx25840_and_or(client, 0x47b, ~6, 0);
+		cx25840_and_or(client, 0x47b, ~0x6, 0);
+	} else if (fmt == 0xc) { /* SECAM - Step 9c - toggle CKILLEN */
+		tmp_reg = cx25840_read(client, 0x401);
+		cx25840_and_or(client, 0x401, ~0x20, tmp_reg & 0x20 ? 0x00 : 0x20);
+		cx25840_and_or(client, 0x401, ~0x20, tmp_reg & 0x20 ? 0x20 : 0x00);
 	}
+
 	cx25840_and_or(client, 0x400, ~0xf, fmt);
-	cx25840_and_or(client, 0x403, ~0x3, pal_m);
+
+	if (fmt >= 4 && fmt < 8) {
+		tmp_reg = cx25840_read(client, 0x401);
+		cx25840_and_or(client, 0x401, ~0x40, tmp_reg & 0x40 ? 0x00 : 0x40); /* CAGCEN */
+		cx25840_and_or(client, 0x401, ~0x40, tmp_reg & 0x40 ? 0x40 : 0x00);
+		cx25840_and_or(client, 0x401, ~0x20, tmp_reg & 0x20 ? 0x00 : 0x20); /* CKILLEN */
+		cx25840_and_or(client, 0x401, ~0x20, tmp_reg & 0x20 ? 0x20 : 0x00);
+	}
+
+	if (pal_m)
+		cx25840_and_or(client, 0x403, ~0x3, pal_m);
+	else if (pal_n)         /* cx25840 datasheet table 3-19 */
+		cx25840_and_or(client, 0x403, ~0x40, pal_n);
+	else if (ntsc_j)        /* cx25840 datasheet table 3-19 */
+		cx25840_and_or(client, 0x403, ~0x80, ntsc_j);
+
 	if (is_cx23888(state))
 		cx23888_std_setup(client);
 	else
Signature · 1 line
2.35.1
#3 lore raw

PATCH 3/11 xc5000: Add rf strength function

In reply to Bradford Love

Without a rf strength function implemented, analog lock cannot be detected by standardized command line tools.

---
 drivers/media/tuners/xc5000.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/media/tuners/xc5000.c +12 -1
index a28481edd22e..d3eb7e19bf2c 100644
@@ -1333,6 +1333,16 @@ static int xc5000_set_config(struct dvb_frontend *fe, void *priv_cfg)
 }
 
 
+static int xc5000_get_rf_strength(struct dvb_frontend *fe, u16 *rssi)
+{
+	struct xc5000_priv *priv = fe->tuner_priv;
+
+	dprintk(1, "%s()\n", __func__);
+
+	return xc_get_lock_status(priv, rssi);
+}
+
+
 static const struct dvb_tuner_ops xc5000_tuner_ops = {
 	.info = {
 		.name              = "Xceive XC5000",
@@ -1353,7 +1363,8 @@ static const struct dvb_tuner_ops xc5000_tuner_ops = {
 	.get_frequency	   = xc5000_get_frequency,
 	.get_if_frequency  = xc5000_get_if_frequency,
 	.get_bandwidth	   = xc5000_get_bandwidth,
-	.get_status	   = xc5000_get_status
+	.get_status	   = xc5000_get_status,
+	.get_rf_strength   = xc5000_get_rf_strength,
 };
 
 struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe,
Signature · 1 line
2.35.1
#4 lore raw

PATCH 4/11 cx231xx: Fix AGC levels for NTSC-M

In reply to Bradford Love

Windows uses the implemented command sequence to set AGC for NTSC-M. The previous Linux values work, mostly, but on some embedded platforms NTSC-M is very unstable. The Windows default values completely fix any signal stability issues and produce clear iamge.

---
 drivers/media/usb/cx231xx/cx231xx-avcore.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/media/usb/cx231xx/cx231xx-avcore.c +3 -4
index 1cfec76b72f3..0a5c635da040 100644
@@ -2027,10 +2027,9 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard)
 		status = vid_blk_write_word(dev, DIF_SRC_GAIN_CONTROL,
 						0x000035e8);
 
-		status = vid_blk_write_word(dev, DIF_AGC_CTRL_IF, 0xC2262600);
-		status = vid_blk_write_word(dev, DIF_AGC_CTRL_INT,
-						0xC2262600);
-		status = vid_blk_write_word(dev, DIF_AGC_CTRL_RF, 0xC2262600);
+		status = vid_blk_write_word(dev, DIF_AGC_CTRL_IF,  0xC2262600);
+		status = vid_blk_write_word(dev, DIF_AGC_CTRL_INT, 0xC2260000);
+		status = vid_blk_write_word(dev, DIF_AGC_CTRL_RF,  0xC2260000);
 
 		/* Save the Spec Inversion value */
 		dif_misc_ctrl_value &= FLD_DIF_SPEC_INV;
Signature · 1 line
2.35.1
#5 lore raw

PATCH 5/11 au0828: Fix green screen in analog

In reply to Bradford Love

When the driver was converted to VB2 the original function to fix green frame detection was removed and a default vb2 dqbuf function was used instead. This vb2 dqbuf function leads to green frames not being detected and correupting stream captures.

The vidioc_dqbuf function checks the greenscreen flag, and, if set resets the stream to discard the green frame and decode a real frame.

---
 drivers/media/usb/au0828/au0828-video.c | 30 +++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/media/usb/au0828/au0828-video.c +28 -2
index fbaa542c8259..f65f15b1d92a 100644
@@ -1671,6 +1671,32 @@ static int vidioc_log_status(struct file *file, void *fh)
 	return 0;
 }
 
+static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+	struct video_device *vdev = video_devdata(file);
+	struct au0828_dev *dev = video_drvdata(file);
+	int rc;
+
+	rc = check_dev(dev);
+	if (rc < 0)
+		return rc;
+
+	/* Workaround for a bug in the au0828 hardware design that
+	 * sometimes results in the colorspace being inverted
+	 */
+	if (dev->greenscreen_detected == 1) {
+		dprintk(1, "Detected green frame.  Resetting stream...\n");
+		au0828_analog_stream_reset(dev);
+		dev->greenscreen_detected = 0;
+	}
+
+	if (vdev->queue->owner && vdev->queue->owner != file->private_data)
+		return -EBUSY;
+
+	return vb2_dqbuf(vdev->queue, b, file->f_flags & O_NONBLOCK);
+}
+
+
 void au0828_v4l2_suspend(struct au0828_dev *dev)
 {
 	struct urb *urb;
@@ -1764,8 +1790,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
 	.vidioc_prepare_buf         = vb2_ioctl_prepare_buf,
 	.vidioc_querybuf            = vb2_ioctl_querybuf,
 	.vidioc_qbuf                = vb2_ioctl_qbuf,
-	.vidioc_dqbuf               = vb2_ioctl_dqbuf,
-	.vidioc_expbuf               = vb2_ioctl_expbuf,
+	.vidioc_dqbuf               = vidioc_dqbuf,
+	.vidioc_expbuf              = vb2_ioctl_expbuf,
 
 	.vidioc_s_std               = vidioc_s_std,
 	.vidioc_g_std               = vidioc_g_std,
Signature · 1 line
2.35.1
#6 lore raw

Re: [PATCH 05/11] au0828: Fix green screen in analog

Quoted 34 lines · Bradford Love

When the driver was converted to VB2 the original function to fix green frame detection was removed and a default vb2 dqbuf function was used instead. This vb2 dqbuf function leads to green frames not being detected and correupting stream captures.

The vidioc_dqbuf function checks the greenscreen flag, and, if set resets the stream to discard the green frame and decode a real frame.

---
 drivers/media/usb/au0828/au0828-video.c | 30 +++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)
drivers/media/usb/au0828/au0828-video.c +13 -0
index fbaa542c8259..f65f15b1d92a 100644
@@ -1671,6 +1671,32 @@ static int vidioc_log_status(struct file *file, void *fh)
 	return 0;
 }
 
+static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+	struct video_device *vdev = video_devdata(file);
+	struct au0828_dev *dev = video_drvdata(file);
+	int rc;
+
+	rc = check_dev(dev);
+	if (rc < 0)
+		return rc;
+
+	/* Workaround for a bug in the au0828 hardware design that
+	 * sometimes results in the colorspace being inverted
+	 */

drivers/media/usb/au0828/au0828-video.c static int vidioc_log_status(struct file *file, void *fh) · line 1696

Quoted 10 lines
drivers/media/usb/au0828/au0828-video.c +10 -0
+	if (dev->greenscreen_detected == 1) {
+		dprintk(1, "Detected green frame.  Resetting stream...\n");
+		au0828_analog_stream_reset(dev);
+		dev->greenscreen_detected = 0;
+	}
+
+	if (vdev->queue->owner && vdev->queue->owner != file->private_data)
+		return -EBUSY;
+
+	return vb2_dqbuf(vdev->queue, b, file->f_flags & O_NONBLOCK);

Please replace those last 4 lines with:

	return vb2_ioctl_dqbuf(file, priv, b);

It's cleaner that way.

Regards,

Hans

Quoted 17 lines
drivers/media/usb/au0828/au0828-video.c +5 -2
+}
+
+
 void au0828_v4l2_suspend(struct au0828_dev *dev)
 {
 	struct urb *urb;
@@ -1764,8 +1790,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
 	.vidioc_prepare_buf         = vb2_ioctl_prepare_buf,
 	.vidioc_querybuf            = vb2_ioctl_querybuf,
 	.vidioc_qbuf                = vb2_ioctl_qbuf,
-	.vidioc_dqbuf               = vb2_ioctl_dqbuf,
-	.vidioc_expbuf               = vb2_ioctl_expbuf,
+	.vidioc_dqbuf               = vidioc_dqbuf,
+	.vidioc_expbuf              = vb2_ioctl_expbuf,
 
 	.vidioc_s_std               = vidioc_s_std,
 	.vidioc_g_std               = vidioc_g_std,
#7 lore raw

PATCH v2 1/1 media: au0828: Fix green screen in analog

In reply to Bradford Love

When the driver was converted to VB2 the original function to fix green frame detection was removed and a default vb2 dqbuf function was used instead. This vb2 dqbuf function leads to green frames not being detected and correupting stream captures.

The vidioc_dqbuf function checks the greenscreen flag, and, if set resets the stream to discard the green frame and decode a real frame.

---
Changes since v1:
- swtiched to called vb2_ioctl_dqbuf directly after checking green screen

 drivers/media/usb/au0828/au0828-video.c | 27 +++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/media/usb/au0828/au0828-video.c +25 -2
index fbaa542c8259..35cb97cac91f 100644
@@ -1671,6 +1671,29 @@ static int vidioc_log_status(struct file *file, void *fh)
 	return 0;
 }
 
+static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+	struct video_device *vdev = video_devdata(file);
+	struct au0828_dev *dev = video_drvdata(file);
+	int rc;
+
+	rc = check_dev(dev);
+	if (rc < 0)
+		return rc;
+
+	/* Workaround for a bug in the au0828 hardware design that
+	 * sometimes results in the colorspace being inverted
+	 */
+	if (dev->greenscreen_detected == 1) {
+		dprintk(1, "Detected green frame.  Resetting stream...\n");
+		au0828_analog_stream_reset(dev);
+		dev->greenscreen_detected = 0;
+	}
+
+	return vb2_ioctl_dqbuf(file, priv, b);
+}
+
+
 void au0828_v4l2_suspend(struct au0828_dev *dev)
 {
 	struct urb *urb;
@@ -1764,8 +1787,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
 	.vidioc_prepare_buf         = vb2_ioctl_prepare_buf,
 	.vidioc_querybuf            = vb2_ioctl_querybuf,
 	.vidioc_qbuf                = vb2_ioctl_qbuf,
-	.vidioc_dqbuf               = vb2_ioctl_dqbuf,
-	.vidioc_expbuf               = vb2_ioctl_expbuf,
+	.vidioc_dqbuf               = vidioc_dqbuf,
+	.vidioc_expbuf              = vb2_ioctl_expbuf,
 
 	.vidioc_s_std               = vidioc_s_std,
 	.vidioc_g_std               = vidioc_g_std,
Signature · 1 line
2.35.1
#8 lore raw

PATCH v3 1/1 media: au0828: Fix green screen in analog

When the driver was converted to VB2 the original function to fix green frame detection was removed and a default vb2 dqbuf function was used instead. This vb2 dqbuf function leads to green frames not being detected and correupting stream captures.

The vidioc_dqbuf function checks the greenscreen flag, and, if set resets the stream to discard the green frame and decode a real frame.

---
Changes since v2:
- Fixed extra blank line
- removed now unused variable
Changes since v1:
- swtiched to called vb2_ioctl_dqbuf directly after checking green screen

 drivers/media/usb/au0828/au0828-video.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)
drivers/media/usb/au0828/au0828-video.c +23 -2
index fbaa542c8259..3c53105f3d2b 100644
@@ -1671,6 +1671,27 @@ static int vidioc_log_status(struct file *file, void *fh)
 	return 0;
 }
 
+static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+	struct au0828_dev *dev = video_drvdata(file);
+	int rc;
+
+	rc = check_dev(dev);
+	if (rc < 0)
+		return rc;
+
+	/* Workaround for a bug in the au0828 hardware design that
+	 * sometimes results in the colorspace being inverted
+	 */
+	if (dev->greenscreen_detected == 1) {
+		dprintk(1, "Detected green frame.  Resetting stream...\n");
+		au0828_analog_stream_reset(dev);
+		dev->greenscreen_detected = 0;
+	}
+
+	return vb2_ioctl_dqbuf(file, priv, b);
+}
+
 void au0828_v4l2_suspend(struct au0828_dev *dev)
 {
 	struct urb *urb;
@@ -1764,8 +1785,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
 	.vidioc_prepare_buf         = vb2_ioctl_prepare_buf,
 	.vidioc_querybuf            = vb2_ioctl_querybuf,
 	.vidioc_qbuf                = vb2_ioctl_qbuf,
-	.vidioc_dqbuf               = vb2_ioctl_dqbuf,
-	.vidioc_expbuf               = vb2_ioctl_expbuf,
+	.vidioc_dqbuf               = vidioc_dqbuf,
+	.vidioc_expbuf              = vb2_ioctl_expbuf,
 
 	.vidioc_s_std               = vidioc_s_std,
 	.vidioc_g_std               = vidioc_g_std,
Signature · 1 line
2.35.1
#9 lore raw

Re: [PATCH v2] media: au0828: Fix green screen in analog

In reply to Bradford Love
kernel test robot noticed the following build warnings:

Hi Bradford,

kernel test robot noticed the following build warnings:

url:    https://github.com/intel-lab-lkp/linux/commits/UPDATE-20260318-180458/Bradford-Love/si2157-Analog-format-fixes/20260314-162352
base:   the 5th patch of https://lore.kernel.org/r/20260312213532.2907276-6-brad%40nextdimension.cc
patch link:    https://lore.kernel.org/r/20260317172820.2959499-1-brad%40nextdimension.cc
patch subject: [PATCH v2] media: au0828: Fix green screen in analog
config: hexagon-randconfig-001-20260319 (https://download.01.org/0day-ci/archive/20260319/[email protected]/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 4abb927bacf37f18f6359a41639a6d1b3bffffb5)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260319/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/media/usb/au0828/au0828-video.c:1676:23: warning: unused variable 'vdev' [-Wunused-variable]
    1676 |         struct video_device *vdev = video_devdata(file);
         |                              ^~~~

1 warning generated.

vim +/vdev +1676 drivers/media/usb/au0828/au0828-video.c

1673
1674 static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
1675 {

> 1676		struct video_device *vdev = video_devdata(file);

1677 struct au0828_dev *dev = video_drvdata(file);
1678 int rc;
1679
1680 rc = check_dev(dev);
1681 if (rc < 0)
1682 return rc;
1683
1684 /* Workaround for a bug in the au0828 hardware design that
1685 * sometimes results in the colorspace being inverted
1686 */
1687 if (dev->greenscreen_detected == 1) {
1688 dprintk(1, "Detected green frame. Resetting stream...\n");
1689 au0828_analog_stream_reset(dev);
1690 dev->greenscreen_detected = 0;
1691 }
1692
1693 return vb2_ioctl_dqbuf(file, priv, b);
1694 }
1695

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#10 lore raw

PATCH 6/11 si2168: Fix i2c command timeout on embedded platforms

In reply to Bradford Love

On many embedded platforms i2c responses through USB are not returned as quickly, plus constantly banging on the i2c master receive essentially deadlocks the driver. Inserting a 3ms delay between i2c receive calls and extending the timeout fixes all tested platforms.

---
 drivers/media/dvb-frontends/si2168.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/dvb-frontends/si2168.c +3 -1
index c4bbcd127cac..9f2c503ec331 100644
@@ -40,7 +40,7 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
 
 	if (cmd->rlen) {
 		/* wait cmd execution terminate */
-		#define TIMEOUT 70
+		#define TIMEOUT 140
 		timeout = jiffies + msecs_to_jiffies(TIMEOUT);
 		while (!time_after(jiffies, timeout)) {
 			ret = i2c_master_recv(client, cmd->args, cmd->rlen);
@@ -54,6 +54,8 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
 			/* firmware ready? */
 			if ((cmd->args[0] >> 7) & 0x01)
 				break;
+
+			usleep_range(2500, 3500);
 		}
 
 		dev_dbg(&client->dev, "cmd execution took %d ms\n",
Signature · 1 line
2.35.1
#11 lore raw

PATCH 7/11 si2168: fw 4.0-11 loses warm state during sleep

In reply to Bradford Love

Ignoring version 4.0-11 firmware leads to non functional devices after sleep on all Hauppauge DVB devices containing the si2168 and firwmare version 4.0-11.

---
 drivers/media/dvb-frontends/si2168.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-frontends/si2168.c +2 -2
index 9f2c503ec331..91d959dddcb5 100644
@@ -574,8 +574,8 @@ static int si2168_sleep(struct dvb_frontend *fe)
 	if (ret)
 		goto err;
 
-	/* Firmware later than B 4.0-11 loses warm state during sleep */
-	if (dev->version > ('B' << 24 | 4 << 16 | 0 << 8 | 11 << 0))
+	/* Firmware B 4.0-11 and later lose warm state during sleep */
+	if (dev->version >= ('B' << 24 | 4 << 16 | 0 << 8 | 11 << 0))
 		dev->warm = false;
 
 	cmd_init(&cmd, "\x13", 1, 0);
Signature · 1 line
2.35.1
#12 lore raw

PATCH 8/11 saa7164: Fix REV2 firmware filename

In reply to Bradford Love

The wrong firmware file is listed, leading to non functional devices on REV2 models.

---
 drivers/media/pci/saa7164/saa7164-fw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/pci/saa7164/saa7164-fw.c +2 -2
index cc9f384f7f1e..341cef62452f 100644
@@ -10,8 +10,8 @@
 
 #include "saa7164.h"
 
-#define SAA7164_REV2_FIRMWARE		"NXP7164-2010-03-10.1.fw"
-#define SAA7164_REV2_FIRMWARE_SIZE	4019072
+#define SAA7164_REV2_FIRMWARE		"v4l-saa7164-1.0.2-3.fw"
+#define SAA7164_REV2_FIRMWARE_SIZE	4038864
 
 #define SAA7164_REV3_FIRMWARE		"NXP7164-2010-03-10.1.fw"
 #define SAA7164_REV3_FIRMWARE_SIZE	4019072
Signature · 1 line
2.35.1
#13 lore raw

PATCH 9/11 au0828: Add new Hauppauge HVR1265 and ImpactVCB-e

In reply to Bradford Love

New HVR1265 and ImpactVCB-e devices are PCIe baords with USB controller and essentially embedded Hauppauge 950Q.

HVR1265 - digital+analog TV, S-Video, and audio inputs ImpactVCB-e - Composite, S-Video, and audio inputs

This also fixes AU8522_COMPOSITE_CH4, which was missing from video routing.

---
 drivers/media/dvb-frontends/au8522_decoder.c |  1 +
 drivers/media/usb/au0828/au0828-cards.c      | 50 ++++++++++++++++++++
 drivers/media/usb/au0828/au0828-cards.h      |  2 +
 drivers/media/usb/au0828/au0828-dvb.c        |  1 +
 drivers/media/usb/au0828/au0828-input.c      |  1 +
 5 files changed, 55 insertions(+)
drivers/media/dvb-frontends/au8522_decoder.c +1 -0
index 58c4c489bf97..58b959b272c6 100644
@@ -567,6 +567,7 @@ static int au8522_s_video_routing(struct v4l2_subdev *sd,
 	case AU8522_COMPOSITE_CH1:
 	case AU8522_SVIDEO_CH13:
 	case AU8522_COMPOSITE_CH4_SIF:
+	case AU8522_COMPOSITE_CH4:
 		state->vid_input = input;
 		break;
 	default:
drivers/media/usb/au0828/au0828-cards.c +50 -0

80 lines not on this page · raw message

drivers/media/usb/au0828/au0828-cards.h +2 -0
index a9cdf85f98f5..a438aeb334a0 100644
@@ -11,3 +11,5 @@
 #define AU0828_BOARD_DVICO_FUSIONHDTV7	3
 #define AU0828_BOARD_HAUPPAUGE_HVR950Q_MXL	4
 #define AU0828_BOARD_HAUPPAUGE_WOODBURY	5
+#define AU0828_BOARD_HAUPPAUGE_IMPACTVCBE	6
+#define AU0828_BOARD_HAUPPAUGE_HVR1265		7
drivers/media/usb/au0828/au0828-dvb.c +1 -0
index 5d0447ff7d06..31123e6f9fc3 100644
@@ -571,6 +571,7 @@ int au0828_dvb_register(struct au0828_dev *dev)
 	switch (dev->boardnr) {
 	case AU0828_BOARD_HAUPPAUGE_HVR850:
 	case AU0828_BOARD_HAUPPAUGE_HVR950Q:
+	case AU0828_BOARD_HAUPPAUGE_HVR1265:
 		dvb->frontend = dvb_attach(au8522_attach,
 				&hauppauge_hvr950q_config,
 				&dev->i2c_adap);
drivers/media/usb/au0828/au0828-input.c +1 -0
index 7dec1a360da6..319be7509c82 100644
@@ -300,6 +300,7 @@ int au0828_rc_register(struct au0828_dev *dev)
 	if (dev->board.has_ir_i2c) {	/* external i2c device */
 		switch (dev->boardnr) {
 		case AU0828_BOARD_HAUPPAUGE_HVR950Q:
+		case AU0828_BOARD_HAUPPAUGE_HVR1265:
 			rc->map_name = RC_MAP_HAUPPAUGE;
 			ir->get_key_i2c = au0828_get_key_au8522;
 			break;
Signature · 1 line
2.35.1
#14 lore raw

PATCH 10/11 em28xx: Add a variety of DualHD usb id

In reply to Bradford Love

Include possible vid:pid combination of DualHD models that are in the wild.

---
 drivers/media/usb/em28xx/em28xx-cards.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/media/usb/em28xx/em28xx-cards.c +12 -0
index 59a2e4db75b7..2d19f8ecd685 100644
@@ -2757,10 +2757,22 @@ struct usb_device_id em28xx_id_table[] = {
 			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB },
 	{ USB_DEVICE(0x2040, 0x8265),
 			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB },
+	{ USB_DEVICE(0x2040, 0x8269),
+			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB },
+	{ USB_DEVICE(0x2040, 0x8278),
+			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB },
 	{ USB_DEVICE(0x2040, 0x026d),
 			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 },
 	{ USB_DEVICE(0x2040, 0x826d),
 			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 },
+	{ USB_DEVICE(0x2040, 0x826e),
+			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 },
+	{ USB_DEVICE(0x2040, 0x826f),
+			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 },
+	{ USB_DEVICE(0x2040, 0x8270),
+			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 },
+	{ USB_DEVICE(0x2040, 0x8271),
+			.driver_info = EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 },
 	{ USB_DEVICE(0x2040, 0x846d),
 			.driver_info = EM2874_BOARD_HAUPPAUGE_USB_QUADHD },
 	{ USB_DEVICE(0x0438, 0xb002),
Signature · 1 line
2.35.1
#15 lore raw

PATCH 11/11 em28xx: remove tuner type from Hauppauge DVB DualHD

In reply to Bradford Love

This reverts a patch which was perhaps inadvertently added.

This was changed during the 5.15-rc4 merge. The faulty commit appears lost in the pull request somehow, I cannot find it to check the explanation.

commit c52e7b855b33 ("Merge tag 'v5.15-rc4' into media_tree")

There was nothing wrong with this device and no reason to moodify the board profile. The DVB capabilities are added via dvb_module_probe. Additionally, the device contains *zero* analog inputs, so I'm not sure why one was added.

---
 drivers/media/usb/em28xx/em28xx-cards.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/media/usb/em28xx/em28xx-cards.c +1 -6
index 2d19f8ecd685..d7075ebabceb 100644
@@ -2522,17 +2522,12 @@ const struct em28xx_board em28xx_boards[] = {
 		.def_i2c_bus   = 1,
 		.i2c_speed     = EM28XX_I2C_CLK_WAIT_ENABLE |
 				 EM28XX_I2C_FREQ_400_KHZ,
-		.tuner_type    = TUNER_SI2157,
+		.tuner_type    = TUNER_ABSENT,
 		.tuner_gpio    = hauppauge_dualhd_dvb,
 		.has_dvb       = 1,
 		.has_dual_ts   = 1,
 		.ir_codes      = RC_MAP_HAUPPAUGE,
 		.leds          = hauppauge_dualhd_leds,
-		.input         = { {
-			.type     = EM28XX_VMUX_COMPOSITE,
-			.vmux     = TVP5150_COMPOSITE1,
-			.amux     = EM28XX_AMUX_LINE_IN,
-		} },
 	},
 	/*
 	 * 2040:026d Hauppauge WinTV-dualHD (model 01595 - ATSC/QAM) Isoc.
Signature · 1 line
2.35.1
#16 lore raw
In reply to Bradford Love

Hi Brad,

Thank you for this cleanup series!

I'll take them all, except for the "au0828: Fix green screen in analog" patch, which needs a v2. So no need to post a v2 of the whole series, just post a v2 of that au0828 patch.

Regards,

Hans

Quoted 60 lines · Bradford Love

Hello,

Attached here is a series of accumlated fixes from integrations and deployments.

The first five patches are related to fixing issues with a variety of analog video formats.

The si2168 i2c timeout patch is something that has been found to be critical on a variety of ARM platforms and Nvidia SOC. Something in these platforms has USB i2c not consistently responding within the embedded deadline in the driver.

There are two firmware fixes. With Hauppauge hardware fw 4.0-11 si2168 devices definitely lose warm state and cannot function after sleep. The saa7164 REV2 firmware had an incorrect filename and has been fixed.

Last up is adding some new Hauppauge USB id's and removing an invalid analog input from the Hauppauge DVB DualHD.

Addressing checkpatch warnings:
- 0001 palN is not misspelled
- 0003 adding dprintk like driver already does

Regards,

Bradford

Bradford Love (11):
si2157: Analog format fixes
cx25840: Fix NTSC-J, PAL-N, and SECAM standards
xc5000: Add rf strength function
cx231xx: Fix AGC levels for NTSC-M
au0828: Fix green screen in analog
si2168: Fix i2c command timeout on embedded platforms
si2168: fw 4.0-11 loses warm state during sleep
saa7164: Fix REV2 firmware filename
au0828: Add new Hauppauge HVR1265 and ImpactVCB-e
em28xx: Add a variety of DualHD usb id
em28xx: remove tuner type from Hauppauge DVB DualHD

 drivers/media/dvb-frontends/au8522_decoder.c |  1 +
 drivers/media/dvb-frontends/si2168.c         |  8 ++--
 drivers/media/i2c/cx25840/cx25840-core.c     | 29 +++++++++++-
 drivers/media/pci/saa7164/saa7164-fw.c       |  4 +-
 drivers/media/tuners/si2157.c                | 15 ++++--
 drivers/media/tuners/xc5000.c                | 13 ++++-
 drivers/media/usb/au0828/au0828-cards.c      | 50 ++++++++++++++++++++
 drivers/media/usb/au0828/au0828-cards.h      |  2 +
 drivers/media/usb/au0828/au0828-dvb.c        |  1 +
 drivers/media/usb/au0828/au0828-input.c      |  1 +
 drivers/media/usb/au0828/au0828-video.c      | 30 +++++++++++-
 drivers/media/usb/cx231xx/cx231xx-avcore.c   |  7 ++-
 drivers/media/usb/em28xx/em28xx-cards.c      | 19 +++++---
 13 files changed, 156 insertions(+), 24 deletions(-)
#17 lore raw
Quoted 7 lines · Hans Verkuil

Hi Brad,

Thank you for this cleanup series!

I'll take them all, except for the "au0828: Fix green screen in analog" patch, which needs a v2. So no need to post a v2 of the whole series, just post a v2 of that au0828 patch.

BTW, for future reference, please prefix media patches with "media: " in the Subject line. I added it manually for these patches.

Regards,

Hans

Quoted 68 lines

Regards,

Hans

Quoted 60 lines · Bradford Love

Hello,

Attached here is a series of accumlated fixes from integrations and deployments.

The first five patches are related to fixing issues with a variety of analog video formats.

The si2168 i2c timeout patch is something that has been found to be critical on a variety of ARM platforms and Nvidia SOC. Something in these platforms has USB i2c not consistently responding within the embedded deadline in the driver.

There are two firmware fixes. With Hauppauge hardware fw 4.0-11 si2168 devices definitely lose warm state and cannot function after sleep. The saa7164 REV2 firmware had an incorrect filename and has been fixed.

Last up is adding some new Hauppauge USB id's and removing an invalid analog input from the Hauppauge DVB DualHD.

Addressing checkpatch warnings:
- 0001 palN is not misspelled
- 0003 adding dprintk like driver already does

Regards,

Bradford

Bradford Love (11):
si2157: Analog format fixes
cx25840: Fix NTSC-J, PAL-N, and SECAM standards
xc5000: Add rf strength function
cx231xx: Fix AGC levels for NTSC-M
au0828: Fix green screen in analog
si2168: Fix i2c command timeout on embedded platforms
si2168: fw 4.0-11 loses warm state during sleep
saa7164: Fix REV2 firmware filename
au0828: Add new Hauppauge HVR1265 and ImpactVCB-e
em28xx: Add a variety of DualHD usb id
em28xx: remove tuner type from Hauppauge DVB DualHD

 drivers/media/dvb-frontends/au8522_decoder.c |  1 +
 drivers/media/dvb-frontends/si2168.c         |  8 ++--
 drivers/media/i2c/cx25840/cx25840-core.c     | 29 +++++++++++-
 drivers/media/pci/saa7164/saa7164-fw.c       |  4 +-
 drivers/media/tuners/si2157.c                | 15 ++++--
 drivers/media/tuners/xc5000.c                | 13 ++++-
 drivers/media/usb/au0828/au0828-cards.c      | 50 ++++++++++++++++++++
 drivers/media/usb/au0828/au0828-cards.h      |  2 +
 drivers/media/usb/au0828/au0828-dvb.c        |  1 +
 drivers/media/usb/au0828/au0828-input.c      |  1 +
 drivers/media/usb/au0828/au0828-video.c      | 30 +++++++++++-
 drivers/media/usb/cx231xx/cx231xx-avcore.c   |  7 ++-
 drivers/media/usb/em28xx/em28xx-cards.c      | 19 +++++---
 13 files changed, 156 insertions(+), 24 deletions(-)
#18 lore raw

Hi Hans,

Thank you for grabbing these patches. I will generate a new au0828 patch and get that v2 sent out. I noticed the media: subject issue too late for the first couple series I mailed in, but will add from now on.

Regards,

Bradford

Quoted 86 lines · Hans Verkuil
Quoted 7 lines · Hans Verkuil

Hi Brad,

Thank you for this cleanup series!

I'll take them all, except for the "au0828: Fix green screen in analog" patch, which needs a v2. So no need to post a v2 of the whole series, just post a v2 of that au0828 patch.

BTW, for future reference, please prefix media patches with "media: " in the Subject line. I added it manually for these patches.

Regards,

Hans

Quoted 68 lines

Regards,

Hans

Quoted 60 lines · Bradford Love

Hello,

Attached here is a series of accumlated fixes from integrations and deployments.

The first five patches are related to fixing issues with a variety of analog video formats.

The si2168 i2c timeout patch is something that has been found to be critical on a variety of ARM platforms and Nvidia SOC. Something in these platforms has USB i2c not consistently responding within the embedded deadline in the driver.

There are two firmware fixes. With Hauppauge hardware fw 4.0-11 si2168 devices definitely lose warm state and cannot function after sleep. The saa7164 REV2 firmware had an incorrect filename and has been fixed.

Last up is adding some new Hauppauge USB id's and removing an invalid analog input from the Hauppauge DVB DualHD.

Addressing checkpatch warnings:
- 0001 palN is not misspelled
- 0003 adding dprintk like driver already does

Regards,

Bradford

Bradford Love (11):
si2157: Analog format fixes
cx25840: Fix NTSC-J, PAL-N, and SECAM standards
xc5000: Add rf strength function
cx231xx: Fix AGC levels for NTSC-M
au0828: Fix green screen in analog
si2168: Fix i2c command timeout on embedded platforms
si2168: fw 4.0-11 loses warm state during sleep
saa7164: Fix REV2 firmware filename
au0828: Add new Hauppauge HVR1265 and ImpactVCB-e
em28xx: Add a variety of DualHD usb id
em28xx: remove tuner type from Hauppauge DVB DualHD

 drivers/media/dvb-frontends/au8522_decoder.c |  1 +
 drivers/media/dvb-frontends/si2168.c         |  8 ++--
 drivers/media/i2c/cx25840/cx25840-core.c     | 29 +++++++++++-
 drivers/media/pci/saa7164/saa7164-fw.c       |  4 +-
 drivers/media/tuners/si2157.c                | 15 ++++--
 drivers/media/tuners/xc5000.c                | 13 ++++-
 drivers/media/usb/au0828/au0828-cards.c      | 50 ++++++++++++++++++++
 drivers/media/usb/au0828/au0828-cards.h      |  2 +
 drivers/media/usb/au0828/au0828-dvb.c        |  1 +
 drivers/media/usb/au0828/au0828-input.c      |  1 +
 drivers/media/usb/au0828/au0828-video.c      | 30 +++++++++++-
 drivers/media/usb/cx231xx/cx231xx-avcore.c   |  7 ++-
 drivers/media/usb/em28xx/em28xx-cards.c      | 19 +++++---
 13 files changed, 156 insertions(+), 24 deletions(-)