Skip to contentSkip to conversation

How to proceed ? => [PATCH ?] EM28xx driver ?

PATCH mjs 4 participants 7 messages Apr 23, 2018 – Apr 26, 2018 Media (V4L/DVB)

lore
Share & tools
lore

mjs

author
#0 lore raw

Hello,

4 years ago I started to try to make a dvb-t ":ZOLID Hybrid TV Stick" to work with linux.

Today there is success at least for the digital part, not the analog or remote part.

If and how to proceed adding this patch to the global source.

Greatings,
Marcel Stork

Git result:

From ccea81c2a3c6e937d304a87fad823dd557937968 Mon Sep 17 00:00:00 2001
From: mjs <mjs@toshiba>
Date: Sun, 1 Apr 2018 19:10:33 +0200
Subject: [PATCH] Committer: mjs <mjs@toshiba> On branch master
zolid-em28xx-driver Changes to be committed: modified: em28xx-cards.c
modified: em28xx-dvb.c modified: em28xx.h

---
 em28xx-cards.c | 32 +++++++++++++++++++++++++++++---
 em28xx-dvb.c   |  1 +
 em28xx.h       |  1 +
 3 files changed, 31 insertions(+), 3 deletions(-)
em28xx-cards.c +29 -3
index e397f54..5024dd7 100644
@@ -92,6 +92,20 @@ static struct em28xx_reg_seq default_digital[] = {
 	{	-1,		-1,	-1,		-1},
 };
 
+static struct em28xx_reg_seq zolid_tuner[] = {
+	{EM2820_R08_GPIO_CTRL,		0xfd,		0xff,	100},
+	{EM2820_R08_GPIO_CTRL,		0xfe,		0xff,	100},
+	{		-1,					-1,			-1,		 -1},
+};
+
+static struct em28xx_reg_seq zolid_digital[] = {
+	{EM2820_R08_GPIO_CTRL,		0x6a,		0xff,	100},
+	{EM2820_R08_GPIO_CTRL,		0x7a,		0xff,	100},
+	{EM2880_R04_GPO,			0x04,		0xff,	100},
+	{EM2880_R04_GPO,			0x0c,		0xff,	100},
+	{	-1,						-1,			-1,		 -1},
+};
+
 /* Board Hauppauge WinTV HVR 900 analog */
 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
 	{EM2820_R08_GPIO_CTRL,	0x2d,	~EM_GPIO_4,	10},
@@ -629,6 +643,17 @@ static struct em28xx_led hauppauge_dualhd_leds[] = {
  *  Board definitions
  */
 struct em28xx_board em28xx_boards[] = {
+
+	[EM2882_BOARD_ZOLID_HYBRID_TV_STICK] = {
+		.name			= ":ZOLID HYBRID TV STICK",
+		.tuner_type		= TUNER_XC2028,
+		.tuner_gpio		= zolid_tuner,
+		.decoder		= EM28XX_TVP5150,
+		.xclk			= EM28XX_XCLK_FREQUENCY_12MHZ,
+		.mts_firmware	= 1,
+		.has_dvb		= 1,
+		.dvb_gpio		= zolid_digital,
+	},
 	[EM2750_BOARD_UNKNOWN] = {
 		.name          = "EM2710/EM2750/EM2751 webcam grabber",
 		.xclk          = EM28XX_XCLK_FREQUENCY_20MHZ,
@@ -2421,7 +2446,7 @@ struct usb_device_id em28xx_id_table[] = {
 	{ USB_DEVICE(0xeb1a, 0x2881),
 			.driver_info = EM2820_BOARD_UNKNOWN },
 	{ USB_DEVICE(0xeb1a, 0x2883),
-			.driver_info = EM2820_BOARD_UNKNOWN },
+			.driver_info = EM2882_BOARD_ZOLID_HYBRID_TV_STICK },
 	{ USB_DEVICE(0xeb1a, 0x2868),
 			.driver_info = EM2820_BOARD_UNKNOWN },
 	{ USB_DEVICE(0xeb1a, 0x2875),
@@ -2599,6 +2624,7 @@ static struct em28xx_hash_table em28xx_eeprom_hash[] = {
 	{0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
 	{0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
 	{0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
+	{0x85dd871e, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
 /* I2C devicelist hash table for devices with generic USB IDs */
@@ -2610,6 +2636,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
 	{0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
 	{0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
 	{0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
+	{0x27e10080, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
 /* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
@@ -3063,8 +3090,7 @@ void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
 	case EM2880_BOARD_EMPIRE_DUAL_TV:
 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
 	case EM2882_BOARD_TERRATEC_HYBRID_XS:
-		ctl->demod = XC3028_FE_ZARLINK456;
-		break;
+	case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
 	case EM2880_BOARD_TERRATEC_HYBRID_XS:
 	case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
 	case EM2881_BOARD_PINNACLE_HYBRID_PRO:
em28xx-dvb.c +1 -0
index 1a5c012..e18d048 100644
@@ -1197,6 +1197,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
 	case EM2882_BOARD_TERRATEC_HYBRID_XS:
 	case EM2880_BOARD_EMPIRE_DUAL_TV:
+	case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
 		dvb->fe[0] = dvb_attach(zl10353_attach,
 					   &em28xx_zl10353_xc3028_no_i2c_gate,
 					   &dev->i2c_adap[dev->def_i2c_bus]);
em28xx.h +1 -0
index d148463..d786bfa 100644
@@ -147,6 +147,7 @@
 #define EM2884_BOARD_ELGATO_EYETV_HYBRID_2008     97
 #define EM28178_BOARD_PLEX_PX_BCUD                98
 #define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB  99
+#define EM2882_BOARD_ZOLID_HYBRID_TV_STICK	  100
 
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
Signature · 1 line
2.11.0
#1 lore raw

em28xx-cards.c

Quoted 4 lines · mjs

to try to make a dvb-t ":ZOLID Hybrid TV Stick" to work with linux.

em28xx-cards.c +0 -0
       ...

em28xx-cards.c void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl) · line 3096

Quoted 10 lines
em28xx-cards.c +1 -2
@@ -3063,8 +3090,7 @@ void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
 	case EM2880_BOARD_EMPIRE_DUAL_TV:
 	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
 	case EM2882_BOARD_TERRATEC_HYBRID_XS:
-		ctl->demod = XC3028_FE_ZARLINK456;
-		break;
+	case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
 	case EM2880_BOARD_TERRATEC_HYBRID_XS:
 	case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
 	case EM2881_BOARD_PINNACLE_HYBRID_PRO:

The extra line makes sense,
the removed lines shall break TERRATEC_HYBRID_XS

My appology for not telling you this earlier.

Cheers
Geert Stappers

#2 lore raw
In reply to mjs

This should give you an idea of what you need to do:
https://linuxtv.org/wiki/index.php/Development:_How_to_submit_patches

Quoted 131 lines · mjs

Hello,

4 years ago I started to try to make a dvb-t ":ZOLID Hybrid TV Stick" to work with linux.

Today there is success at least for the digital part, not the analog or remote part.

If and how to proceed adding this patch to the global source.

Greatings,
Marcel Stork

Git result:

From ccea81c2a3c6e937d304a87fad823dd557937968 Mon Sep 17 00:00:00 2001
From: mjs <mjs@toshiba>
Date: Sun, 1 Apr 2018 19:10:33 +0200
Subject: [PATCH] Committer: mjs <mjs@toshiba> On branch master
zolid-em28xx-driver Changes to be committed: modified: em28xx-cards.c
modified: em28xx-dvb.c modified: em28xx.h

---
 em28xx-cards.c | 32 +++++++++++++++++++++++++++++---
 em28xx-dvb.c   |  1 +
 em28xx.h       |  1 +
 3 files changed, 31 insertions(+), 3 deletions(-)
em28xx-cards.c +29 -3
index e397f54..5024dd7 100644
@@ -92,6 +92,20 @@ static struct em28xx_reg_seq default_digital[] = {
        {       -1,             -1,     -1,             -1},
 };
 
+static struct em28xx_reg_seq zolid_tuner[] = {
+       {EM2820_R08_GPIO_CTRL,          0xfd,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0xfe,           0xff,   100},
+       {               -1,                                     -1,                     -1,              -1},
+};
+
+static struct em28xx_reg_seq zolid_digital[] = {
+       {EM2820_R08_GPIO_CTRL,          0x6a,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0x7a,           0xff,   100},
+       {EM2880_R04_GPO,                        0x04,           0xff,   100},
+       {EM2880_R04_GPO,                        0x0c,           0xff,   100},
+       {       -1,                                             -1,                     -1,              -1},
+};
+
 /* Board Hauppauge WinTV HVR 900 analog */
 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
        {EM2820_R08_GPIO_CTRL,  0x2d,   ~EM_GPIO_4,     10},
@@ -629,6 +643,17 @@ static struct em28xx_led hauppauge_dualhd_leds[] = {
  *  Board definitions
  */
 struct em28xx_board em28xx_boards[] = {
+
+       [EM2882_BOARD_ZOLID_HYBRID_TV_STICK] = {
+               .name                   = ":ZOLID HYBRID TV STICK",
+               .tuner_type             = TUNER_XC2028,
+               .tuner_gpio             = zolid_tuner,
+               .decoder                = EM28XX_TVP5150,
+               .xclk                   = EM28XX_XCLK_FREQUENCY_12MHZ,
+               .mts_firmware   = 1,
+               .has_dvb                = 1,
+               .dvb_gpio               = zolid_digital,
+       },
        [EM2750_BOARD_UNKNOWN] = {
                .name          = "EM2710/EM2750/EM2751 webcam grabber",
                .xclk          = EM28XX_XCLK_FREQUENCY_20MHZ,
@@ -2421,7 +2446,7 @@ struct usb_device_id em28xx_id_table[] = {
        { USB_DEVICE(0xeb1a, 0x2881),
                        .driver_info = EM2820_BOARD_UNKNOWN },
        { USB_DEVICE(0xeb1a, 0x2883),
-                       .driver_info = EM2820_BOARD_UNKNOWN },
+                       .driver_info = EM2882_BOARD_ZOLID_HYBRID_TV_STICK },
        { USB_DEVICE(0xeb1a, 0x2868),
                        .driver_info = EM2820_BOARD_UNKNOWN },
        { USB_DEVICE(0xeb1a, 0x2875),
@@ -2599,6 +2624,7 @@ static struct em28xx_hash_table em28xx_eeprom_hash[] = {
        {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
        {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
        {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
+       {0x85dd871e, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
 /* I2C devicelist hash table for devices with generic USB IDs */
@@ -2610,6 +2636,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
        {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
        {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
        {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
+       {0x27e10080, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
 /* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
@@ -3063,8 +3090,7 @@ void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
        case EM2880_BOARD_EMPIRE_DUAL_TV:
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
-               ctl->demod = XC3028_FE_ZARLINK456;
-               break;
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
        case EM2880_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
        case EM2881_BOARD_PINNACLE_HYBRID_PRO:
em28xx-dvb.c +1 -0
index 1a5c012..e18d048 100644
@@ -1197,6 +1197,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_EMPIRE_DUAL_TV:
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
                dvb->fe[0] = dvb_attach(zl10353_attach,
                                           &em28xx_zl10353_xc3028_no_i2c_gate,
                                           &dev->i2c_adap[dev->def_i2c_bus]);
em28xx.h +1 -1
index d148463..d786bfa 100644
@@ -147,6 +147,7 @@
 #define EM2884_BOARD_ELGATO_EYETV_HYBRID_2008     97
 #define EM28178_BOARD_PLEX_PX_BCUD                98
 #define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB  99
+#define EM2882_BOARD_ZOLID_HYBRID_TV_STICK       100
 
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
--

2.11.0

#3 lore raw

Em Mon, 23 Apr 2018 12:35:06 -0400
Alexandre-Xavier Labonté-Lamoureux <[email protected]> escreveu:

Quoted 2 lines

This should give you an idea of what you need to do:
https://linuxtv.org/wiki/index.php/Development:_How_to_submit_patches

Yes.

In particular, you should send it against the upstream development Kernel, using "git diff", and add a proper description.

Anyway, let review a few things. See below.

Quoted 71 lines · mjs
Quoted 68 lines

Hello,

4 years ago I started to try to make a dvb-t ":ZOLID Hybrid TV Stick" to work with linux.

Today there is success at least for the digital part, not the analog or remote part.

If and how to proceed adding this patch to the global source.

Greatings,
Marcel Stork

Git result:

From ccea81c2a3c6e937d304a87fad823dd557937968 Mon Sep 17 00:00:00 2001
From: mjs <mjs@toshiba>
Date: Sun, 1 Apr 2018 19:10:33 +0200
Subject: [PATCH] Committer: mjs <mjs@toshiba> On branch master
zolid-em28xx-driver Changes to be committed: modified: em28xx-cards.c
modified: em28xx-dvb.c modified: em28xx.h

---
 em28xx-cards.c | 32 +++++++++++++++++++++++++++++---
 em28xx-dvb.c   |  1 +
 em28xx.h       |  1 +
 3 files changed, 31 insertions(+), 3 deletions(-)
em28xx-cards.c +25 -0
index e397f54..5024dd7 100644
@@ -92,6 +92,20 @@ static struct em28xx_reg_seq default_digital[] = {
        {       -1,             -1,     -1,             -1},
 };
 
+static struct em28xx_reg_seq zolid_tuner[] = {
+       {EM2820_R08_GPIO_CTRL,          0xfd,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0xfe,           0xff,   100},
+       {               -1,                                     -1,                     -1,              -1},
+};
+
+static struct em28xx_reg_seq zolid_digital[] = {
+       {EM2820_R08_GPIO_CTRL,          0x6a,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0x7a,           0xff,   100},
+       {EM2880_R04_GPO,                        0x04,           0xff,   100},
+       {EM2880_R04_GPO,                        0x0c,           0xff,   100},
+       {       -1,                                             -1,                     -1,              -1},
+};
+
 /* Board Hauppauge WinTV HVR 900 analog */
 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
        {EM2820_R08_GPIO_CTRL,  0x2d,   ~EM_GPIO_4,     10},
@@ -629,6 +643,17 @@ static struct em28xx_led hauppauge_dualhd_leds[] = {
  *  Board definitions
  */
 struct em28xx_board em28xx_boards[] = {
+
+       [EM2882_BOARD_ZOLID_HYBRID_TV_STICK] = {
+               .name                   = ":ZOLID HYBRID TV STICK",
+               .tuner_type             = TUNER_XC2028,
+               .tuner_gpio             = zolid_tuner,
+               .decoder                = EM28XX_TVP5150,
+               .xclk                   = EM28XX_XCLK_FREQUENCY_12MHZ,
+               .mts_firmware   = 1,
+               .has_dvb                = 1,
+               .dvb_gpio               = zolid_digital,
+       },
        [EM2750_BOARD_UNKNOWN] = {
Quoted 8 lines

em28xx-cards.c struct usb_device_id em28xx_id_table[] = { · line 2449

Quoted 8 lines
em28xx-cards.c +1 -1
                .name          = "EM2710/EM2750/EM2751 webcam grabber",
                .xclk          = EM28XX_XCLK_FREQUENCY_20MHZ,
@@ -2421,7 +2446,7 @@ struct usb_device_id em28xx_id_table[] = {
        { USB_DEVICE(0xeb1a, 0x2881),
                        .driver_info = EM2820_BOARD_UNKNOWN },
        { USB_DEVICE(0xeb1a, 0x2883),
-                       .driver_info = EM2820_BOARD_UNKNOWN },
+                       .driver_info = EM2882_BOARD_ZOLID_HYBRID_TV_STICK },

This is actually wrong. The USB address EB1A:2883 is the generic one with is hardcoded at the em28xx chip. All devices without eeprom (or with an eeprom that doesn't set a vendor-specific ID) will announce this address.

So, instead of hardcoding, there are 3 alternatives:

1) if the board has an eeprom (whose USB is not filled), there's a hint code that uses the eeprom to produce a hash;
2) if the board doesn't have, it could hint based on the devices reported via an i2c scan;
3) if none as above works for this board, the user has to force a modprobe parameter via card=<number>.

Quoted 18 lines
Quoted 18 lines
em28xx-cards.c +2 -0
        { USB_DEVICE(0xeb1a, 0x2868),
                        .driver_info = EM2820_BOARD_UNKNOWN },
        { USB_DEVICE(0xeb1a, 0x2875),
@@ -2599,6 +2624,7 @@ static struct em28xx_hash_table em28xx_eeprom_hash[] = {
        {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
        {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
        {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
+       {0x85dd871e, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
 /* I2C devicelist hash table for devices with generic USB IDs */
@@ -2610,6 +2636,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
        {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
        {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
        {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
+       {0x27e10080, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
Quoted 7 lines

em28xx-cards.c void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl) · line 3067

Quoted 7 lines
em28xx-cards.c +0 -2
 /* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
@@ -3063,8 +3090,7 @@ void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
        case EM2880_BOARD_EMPIRE_DUAL_TV:
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
-               ctl->demod = XC3028_FE_ZARLINK456;
-               break;

Why are you removing it? You will break support for the above boards.

Quoted 26 lines
Quoted 26 lines
em28xx-cards.c +1 -0
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
        case EM2880_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
        case EM2881_BOARD_PINNACLE_HYBRID_PRO:
em28xx-dvb.c +1 -0
index 1a5c012..e18d048 100644
@@ -1197,6 +1197,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_EMPIRE_DUAL_TV:
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
                dvb->fe[0] = dvb_attach(zl10353_attach,
                                           &em28xx_zl10353_xc3028_no_i2c_gate,
                                           &dev->i2c_adap[dev->def_i2c_bus]);
em28xx.h +1 -0
index d148463..d786bfa 100644
@@ -147,6 +147,7 @@
 #define EM2884_BOARD_ELGATO_EYETV_HYBRID_2008     97
 #define EM28178_BOARD_PLEX_PX_BCUD                98
 #define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB  99
+#define EM2882_BOARD_ZOLID_HYBRID_TV_STICK       100
 
Quoted 4 lines
Quoted 4 lines
em28xx.h +0 -1
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
--

2.11.0

Thanks,
Mauro

author
#4 lore raw

Op Mon, 23 Apr 2018 14:15:59 -0300
Mauro Carvalho Chehab <[email protected]> schreef:

Quoted 10 lines

Em Mon, 23 Apr 2018 12:35:06 -0400
Alexandre-Xavier Labonté-Lamoureux <[email protected]> escreveu:

Quoted 2 lines

This should give you an idea of what you need to do:
https://linuxtv.org/wiki/index.php/Development:_How_to_submit_patches

Yes.

In particular, you should send it against the upstream development Kernel, using "git diff", and add a proper description.

Thanks, I will read and use it.

Quoted 78 lines

Anyway, let review a few things. See below.

Quoted 76 lines · mjs
Quoted 73 lines

Hello,

4 years ago I started to try to make a dvb-t ":ZOLID Hybrid TV Stick" to work with linux.

Today there is success at least for the digital part, not the analog or remote part.

If and how to proceed adding this patch to the global source.

Greatings,
Marcel Stork

Git result:

From ccea81c2a3c6e937d304a87fad823dd557937968 Mon Sep 17 00:00:00 2001
From: mjs <mjs@toshiba>
Date: Sun, 1 Apr 2018 19:10:33 +0200
Subject: [PATCH] Committer: mjs <mjs@toshiba> On branch master
zolid-em28xx-driver Changes to be committed: modified: em28xx-cards.c
modified: em28xx-dvb.c modified: em28xx.h

---
 em28xx-cards.c | 32 +++++++++++++++++++++++++++++---
 em28xx-dvb.c   |  1 +
 em28xx.h       |  1 +
 3 files changed, 31 insertions(+), 3 deletions(-)
em28xx-cards.c +25 -0
index e397f54..5024dd7 100644
@@ -92,6 +92,20 @@ static struct em28xx_reg_seq default_digital[] = {
        {       -1,             -1,     -1,             -1},
 };
 
+static struct em28xx_reg_seq zolid_tuner[] = {
+       {EM2820_R08_GPIO_CTRL,          0xfd,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0xfe,           0xff,   100},
+       {               -1,                                     -1,                     -1,              -1},
+};
+
+static struct em28xx_reg_seq zolid_digital[] = {
+       {EM2820_R08_GPIO_CTRL,          0x6a,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0x7a,           0xff,   100},
+       {EM2880_R04_GPO,                        0x04,           0xff,   100},
+       {EM2880_R04_GPO,                        0x0c,           0xff,   100},
+       {       -1,                                             -1,                     -1,              -1},
+};
+
 /* Board Hauppauge WinTV HVR 900 analog */
 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
        {EM2820_R08_GPIO_CTRL,  0x2d,   ~EM_GPIO_4,     10},
@@ -629,6 +643,17 @@ static struct em28xx_led hauppauge_dualhd_leds[] = {
  *  Board definitions
  */
 struct em28xx_board em28xx_boards[] = {
+
+       [EM2882_BOARD_ZOLID_HYBRID_TV_STICK] = {
+               .name                   = ":ZOLID HYBRID TV STICK",
+               .tuner_type             = TUNER_XC2028,
+               .tuner_gpio             = zolid_tuner,
+               .decoder                = EM28XX_TVP5150,
+               .xclk                   = EM28XX_XCLK_FREQUENCY_12MHZ,
+               .mts_firmware   = 1,
+               .has_dvb                = 1,
+               .dvb_gpio               = zolid_digital,
+       },
        [EM2750_BOARD_UNKNOWN] = {
                .name          = "EM2710/EM2750/EM2751 webcam grabber",
                .xclk          = EM28XX_XCLK_FREQUENCY_20MHZ,
@@ -2421,7 +2446,7 @@ struct usb_device_id em28xx_id_table[] = {
        { USB_DEVICE(0xeb1a, 0x2881),
                        .driver_info = EM2820_BOARD_UNKNOWN },
Quoted 8 lines
Quoted 3 lines

em28xx-cards.c struct usb_device_id em28xx_id_table[] = { · line 2449

Quoted 3 lines
em28xx-cards.c +1 -1
        { USB_DEVICE(0xeb1a, 0x2883),
-                       .driver_info = EM2820_BOARD_UNKNOWN },
+                       .driver_info = EM2882_BOARD_ZOLID_HYBRID_TV_STICK },  

This is actually wrong. The USB address EB1A:2883 is the generic one with is hardcoded at the em28xx chip. All devices without eeprom (or with an eeprom that doesn't set a vendor-specific ID) will announce this address.

The eeprom has this vid-pid ID (according to the em2882 data sheet). em28xx #0: i2c eeprom 00: 1a eb 67 95 1a eb 83 28 d0 12 65 00 6a 22 8c 10 em28xx #0: i2c eeprom 10: 00 00 24 57 4e 37 01 00 60 00 00 00 02 00 00 00 and so on .....

Quoted 9 lines

So, instead of hardcoding, there are 3 alternatives:

1) if the board has an eeprom (whose USB is not filled), there's a hint code that uses the eeprom to produce a hash;
2) if the board doesn't have, it could hint based on the devices reported via an i2c scan;
3) if none as above works for this board, the user has to force a modprobe parameter via card=<number>.

Option 1 and 2 are available (see below).
I have to try option 3 again with the knowledge of today (dit not work 4 years ago)

Quoted 19 lines
Quoted 19 lines
Quoted 19 lines
em28xx-cards.c +2 -0
        { USB_DEVICE(0xeb1a, 0x2868),
                        .driver_info = EM2820_BOARD_UNKNOWN },
        { USB_DEVICE(0xeb1a, 0x2875),
@@ -2599,6 +2624,7 @@ static struct em28xx_hash_table em28xx_eeprom_hash[] = {
        {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
        {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
        {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
+       {0x85dd871e, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
 /* I2C devicelist hash table for devices with generic USB IDs */
@@ -2610,6 +2636,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
        {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
        {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
        {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
+       {0x27e10080, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
Quoted 10 lines
Quoted 7 lines

em28xx-cards.c void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl) · line 3067

Quoted 7 lines
em28xx-cards.c +0 -2
 /* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
@@ -3063,8 +3090,7 @@ void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
        case EM2880_BOARD_EMPIRE_DUAL_TV:
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
-               ctl->demod = XC3028_FE_ZARLINK456;
-               break;  

Why are you removing it? You will break support for the above boards.

My line of thinking:

My original source is like:

	switch (dev->model) {
	case EM2880_BOARD_EMPIRE_DUAL_TV:
	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
	case EM2882_BOARD_TERRATEC_HYBRID_XS:
		ctl->demod = XC3028_FE_ZARLINK456;
		break;
	case EM2880_BOARD_TERRATEC_HYBRID_XS:
	case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
	case EM2881_BOARD_PINNACLE_HYBRID_PRO:
		ctl->demod = XC3028_FE_ZARLINK456;
		break;

Deleting the two lines would give:

	switch (dev->model) {
	case EM2880_BOARD_EMPIRE_DUAL_TV:
	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
	case EM2882_BOARD_TERRATEC_HYBRID_XS:
	case EM2880_BOARD_TERRATEC_HYBRID_XS:
	case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
	case EM2881_BOARD_PINNACLE_HYBRID_PRO:
		ctl->demod = XC3028_FE_ZARLINK456;
		break;

Put the two blobs together to get a reduction of lines because they seems to have the same result.
I was convinced not breaking some line of code unless there is a maximum of putting a number of "case......." together. I think in this case the git-diff does not show the whole picture, additional explanation from my side would have been better.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
em28xx-cards.c +1 -0
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
        case EM2880_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
        case EM2881_BOARD_PINNACLE_HYBRID_PRO:
em28xx-dvb.c +1 -0
index 1a5c012..e18d048 100644
@@ -1197,6 +1197,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_EMPIRE_DUAL_TV:
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
                dvb->fe[0] = dvb_attach(zl10353_attach,
                                           &em28xx_zl10353_xc3028_no_i2c_gate,
                                           &dev->i2c_adap[dev->def_i2c_bus]);
em28xx.h +1 -0
index d148463..d786bfa 100644
@@ -147,6 +147,7 @@
 #define EM2884_BOARD_ELGATO_EYETV_HYBRID_2008     97
 #define EM28178_BOARD_PLEX_PX_BCUD                98
 #define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB  99
+#define EM2882_BOARD_ZOLID_HYBRID_TV_STICK       100
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
em28xx.h +0 -1
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
--

2.11.0

I'll do my best.
Thanks,

Marcel

#5 lore raw

Em Mon, 23 Apr 2018 22:21:29 +0200
mjs <[email protected]> escreveu:

Quoted 105 lines

Op Mon, 23 Apr 2018 14:15:59 -0300
Mauro Carvalho Chehab <[email protected]> schreef:

Quoted 10 lines

Em Mon, 23 Apr 2018 12:35:06 -0400
Alexandre-Xavier Labonté-Lamoureux <[email protected]> escreveu:

Quoted 2 lines

This should give you an idea of what you need to do:
https://linuxtv.org/wiki/index.php/Development:_How_to_submit_patches

Yes.

In particular, you should send it against the upstream development Kernel, using "git diff", and add a proper description.

Thanks, I will read and use it.

Quoted 78 lines

Anyway, let review a few things. See below.

Quoted 76 lines · mjs
Quoted 73 lines

Hello,

4 years ago I started to try to make a dvb-t ":ZOLID Hybrid TV Stick" to work with linux.

Today there is success at least for the digital part, not the analog or remote part.

If and how to proceed adding this patch to the global source.

Greatings,
Marcel Stork

Git result:

From ccea81c2a3c6e937d304a87fad823dd557937968 Mon Sep 17 00:00:00 2001
From: mjs <mjs@toshiba>
Date: Sun, 1 Apr 2018 19:10:33 +0200
Subject: [PATCH] Committer: mjs <mjs@toshiba> On branch master
zolid-em28xx-driver Changes to be committed: modified: em28xx-cards.c
modified: em28xx-dvb.c modified: em28xx.h

---
 em28xx-cards.c | 32 +++++++++++++++++++++++++++++---
 em28xx-dvb.c   |  1 +
 em28xx.h       |  1 +
 3 files changed, 31 insertions(+), 3 deletions(-)
em28xx-cards.c +25 -0
index e397f54..5024dd7 100644
@@ -92,6 +92,20 @@ static struct em28xx_reg_seq default_digital[] = {
        {       -1,             -1,     -1,             -1},
 };
 
+static struct em28xx_reg_seq zolid_tuner[] = {
+       {EM2820_R08_GPIO_CTRL,          0xfd,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0xfe,           0xff,   100},
+       {               -1,                                     -1,                     -1,              -1},
+};
+
+static struct em28xx_reg_seq zolid_digital[] = {
+       {EM2820_R08_GPIO_CTRL,          0x6a,           0xff,   100},
+       {EM2820_R08_GPIO_CTRL,          0x7a,           0xff,   100},
+       {EM2880_R04_GPO,                        0x04,           0xff,   100},
+       {EM2880_R04_GPO,                        0x0c,           0xff,   100},
+       {       -1,                                             -1,                     -1,              -1},
+};
+
 /* Board Hauppauge WinTV HVR 900 analog */
 static struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
        {EM2820_R08_GPIO_CTRL,  0x2d,   ~EM_GPIO_4,     10},
@@ -629,6 +643,17 @@ static struct em28xx_led hauppauge_dualhd_leds[] = {
  *  Board definitions
  */
 struct em28xx_board em28xx_boards[] = {
+
+       [EM2882_BOARD_ZOLID_HYBRID_TV_STICK] = {
+               .name                   = ":ZOLID HYBRID TV STICK",
+               .tuner_type             = TUNER_XC2028,
+               .tuner_gpio             = zolid_tuner,
+               .decoder                = EM28XX_TVP5150,
+               .xclk                   = EM28XX_XCLK_FREQUENCY_12MHZ,
+               .mts_firmware   = 1,
+               .has_dvb                = 1,
+               .dvb_gpio               = zolid_digital,
+       },
        [EM2750_BOARD_UNKNOWN] = {
                .name          = "EM2710/EM2750/EM2751 webcam grabber",
                .xclk          = EM28XX_XCLK_FREQUENCY_20MHZ,
@@ -2421,7 +2446,7 @@ struct usb_device_id em28xx_id_table[] = {
        { USB_DEVICE(0xeb1a, 0x2881),
                        .driver_info = EM2820_BOARD_UNKNOWN },
Quoted 8 lines
Quoted 3 lines

em28xx-cards.c struct usb_device_id em28xx_id_table[] = { · line 2449

Quoted 3 lines
em28xx-cards.c +1 -1
        { USB_DEVICE(0xeb1a, 0x2883),
-                       .driver_info = EM2820_BOARD_UNKNOWN },
+                       .driver_info = EM2882_BOARD_ZOLID_HYBRID_TV_STICK },    

This is actually wrong. The USB address EB1A:2883 is the generic one with is hardcoded at the em28xx chip. All devices without eeprom (or with an eeprom that doesn't set a vendor-specific ID) will announce this address.

Quoted 4 lines

The eeprom has this vid-pid ID (according to the em2882 data sheet). em28xx #0: i2c eeprom 00: 1a eb 67 95 1a eb 83 28 d0 12 65 00 6a 22 8c 10 em28xx #0: i2c eeprom 10: 00 00 24 57 4e 37 01 00 60 00 00 00 02 00 00 00 and so on .....

Lazy vendor, with either didn't buy his own USB ID block or didn't care enough to write it at the device's eeprom.

Quoted 4 lines
Quoted 4 lines

So, instead of hardcoding, there are 3 alternatives:

Quoted 8 lines
Quoted 6 lines

1) if the board has an eeprom (whose USB is not filled), there's a hint code that uses the eeprom to produce a hash;
2) if the board doesn't have, it could hint based on the devices reported via an i2c scan;
3) if none as above works for this board, the user has to force a modprobe parameter via card=<number>.

Option 1 and 2 are available (see below).

Ah, OK! Then, just drop the above hunk from the patch.

Quoted 1 line

I have to try option 3 again with the knowledge of today (dit not work 4 years ago)

Option 3 is always available. You can always force the driver to try use a different model at probing.

Quoted 57 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
em28xx-cards.c +2 -0
        { USB_DEVICE(0xeb1a, 0x2868),
                        .driver_info = EM2820_BOARD_UNKNOWN },
        { USB_DEVICE(0xeb1a, 0x2875),
@@ -2599,6 +2624,7 @@ static struct em28xx_hash_table em28xx_eeprom_hash[] = {
        {0xb8846b20, EM2881_BOARD_PINNACLE_HYBRID_PRO, TUNER_XC2028},
        {0x63f653bd, EM2870_BOARD_REDDO_DVB_C_USB_BOX, TUNER_ABSENT},
        {0x4e913442, EM2882_BOARD_DIKOM_DK300, TUNER_XC2028},
+       {0x85dd871e, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
 /* I2C devicelist hash table for devices with generic USB IDs */
@@ -2610,6 +2636,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
        {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC},
        {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
        {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
+       {0x27e10080, EM2882_BOARD_ZOLID_HYBRID_TV_STICK, TUNER_XC2028},
 };
 
Quoted 10 lines
Quoted 7 lines

em28xx-cards.c void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl) · line 3067

Quoted 7 lines
em28xx-cards.c +0 -2
 /* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
@@ -3063,8 +3090,7 @@ void em28xx_setup_xc3028(struct em28xx *dev, struct xc2028_ctrl *ctl)
        case EM2880_BOARD_EMPIRE_DUAL_TV:
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
-               ctl->demod = XC3028_FE_ZARLINK456;
-               break;    

Why are you removing it? You will break support for the above boards.

My line of thinking:

My original source is like:

	switch (dev->model) {
	case EM2880_BOARD_EMPIRE_DUAL_TV:
	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
	case EM2882_BOARD_TERRATEC_HYBRID_XS:
		ctl->demod = XC3028_FE_ZARLINK456;
		break;
	case EM2880_BOARD_TERRATEC_HYBRID_XS:
	case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
	case EM2881_BOARD_PINNACLE_HYBRID_PRO:
		ctl->demod = XC3028_FE_ZARLINK456;
		break;

Deleting the two lines would give:

	switch (dev->model) {
	case EM2880_BOARD_EMPIRE_DUAL_TV:
	case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
	case EM2882_BOARD_TERRATEC_HYBRID_XS:
	case EM2880_BOARD_TERRATEC_HYBRID_XS:
	case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
	case EM2881_BOARD_PINNACLE_HYBRID_PRO:
		ctl->demod = XC3028_FE_ZARLINK456;
		break;
Quoted 1 line

Put the two blobs together to get a reduction of lines because they seems to have the same result.

Ok, but then send it as a separate patch, as it has nothing to do with this board's addition.

Quoted 1 line

I was convinced not breaking some line of code unless there is a maximum of putting a number of "case......." together.

There's no restriction. It can have as many case... as needed.

Quoted 1 line

I think in this case the git-diff does not show the whole picture, additional explanation from my side would have been better.

Actually, a separate patch :-)

The way it was sent, it appeared that some lines were just removed by mistake.

Quoted 34 lines
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
em28xx-cards.c +1 -0
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
        case EM2880_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_TERRATEC_HYBRID_XS_FR:
        case EM2881_BOARD_PINNACLE_HYBRID_PRO:
em28xx-dvb.c +1 -0
index 1a5c012..e18d048 100644
@@ -1197,6 +1197,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
        case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
        case EM2882_BOARD_TERRATEC_HYBRID_XS:
        case EM2880_BOARD_EMPIRE_DUAL_TV:
+       case EM2882_BOARD_ZOLID_HYBRID_TV_STICK:
                dvb->fe[0] = dvb_attach(zl10353_attach,
                                           &em28xx_zl10353_xc3028_no_i2c_gate,
                                           &dev->i2c_adap[dev->def_i2c_bus]);
em28xx.h +1 -0
index d148463..d786bfa 100644
@@ -147,6 +147,7 @@
 #define EM2884_BOARD_ELGATO_EYETV_HYBRID_2008     97
 #define EM28178_BOARD_PLEX_PX_BCUD                98
 #define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB  99
+#define EM2882_BOARD_ZOLID_HYBRID_TV_STICK       100
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
em28xx.h +0 -1
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
--

2.11.0

Quoted 4 lines

I'll do my best.
Thanks,

Marcel

Thanks,
Mauro