Re: XC4000: setting registers

2011-06-05 Thread Istvan Varga
On 06/05/2011 02:05 PM, Mauro Carvalho Chehab wrote:

> This one breaks compilation:
>
> drivers/media/common/tuners/xc4000.c: In function
‘xc4000_set_analog_params’:
> drivers/media/common/tuners/xc4000.c:1340: error: ‘type’ undeclared
(first use in this function)
> drivers/media/common/tuners/xc4000.c:1340: error: (Each undeclared
identifier is reported only once
> drivers/media/common/tuners/xc4000.c:1340: error: for each function it
appears in.)
> make[3]: ** [drivers/media/common/tuners/xc4000.o] Erro 1
> make[2]: ** [drivers/media/common/tuners] Erro 2
> make[1]: ** [drivers/media/common] Erro 2
> make: ** [drivers/media/] Erro 2

Yes, it depends on the 'unsigned int type = 0;' declaration that is in
the xc4000_analog.patch posted later. Sorry for this mistake. Although
perhaps it would have been a better idea to make all the changes to
xc4000_set_analog_params() in the analog patch as well, since the
function does not work correctly until that is applied.

> I didn't made any review of them. Please let me know when you finish
> submitting the patches for me to do a review at the resulting code.

For now, I do not have more patches. I will wait for the modified code
to appear on GIT, and use that as a base for further patches.

> Ah, I'd appreciate if you could fix your emails. It takes me some
> time to reformat the patches, as you're sending the patches as
> attachments, but my email scripts aren't ready for patches with
> multiple mime types. Patchwork might help, but it also got only 4
> patches from you (not sure if this is due to patchwork bugs or due to
> the attachments). It also helps if you could add [PATCH] at the email
> subject. I'm setting a backup process due to the constant patchwork
> failures, but my alternative logic relies on having [PATCH] at the
> subject logic, to move the patches into a separate mail directory.

OK, I have changed the name in "from", and will send any later patches
as plain text with [PATCH] in the subject. Should I re-send the previous
patches in this format ?
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: XC4000: setting registers

2011-06-05 Thread Istvan Varga
On 06/05/2011 02:56 PM, Mauro Carvalho Chehab wrote:

> Ok, just pushed it (I forgot to use the -f tag). Please double check
> if the code is working on the devices you have.

I did not try building it, but the code now seems to be identical to the
xc4000.c/h driver I am currently using. There is one minor difference:
at line 1446, the use of the 'type' variable is still commented out; it
does not actually affect the operation of the driver, though, since the
NOGD bit is currently never set.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: xc4000 patches folded

2011-06-05 Thread Istvan Varga
On 06/05/2011 03:58 PM, Mauro Carvalho Chehab wrote:

> Don't add \n\t\t at the beginning of the param_desc. Even the extra \t and \n
> format stuff in the middle of the description is unusual. It is better to 
> avoid,
> as it may break scripts.

OK, I will remove the tabs. Is the use of \n allowed in the description?

> Please put all parameters together.

Does this mean that the macro definitions should be moved from between
the parameter definitions ?

> Don't add a card_type. Just add the features that are needed for
> XC4000_CARD_WINFAST_CX88 to work.

Yes, this is a change I have already planned. The following parameters
will be added to the priv and config structures:
  - the default enabling of power management
  - amplitude for DVB-T
The other conditionals might not actually be necessary, they were just
added to avoid changing the behavior of the driver with the PCTV 340e
which I cannot test. A third parameter could be added to enable/disable
the use of XREG_SMOOTHEDCVBS, although it is not really needed with the
currently supported cards (always enabling it should not be a problem).

> Please use a generic parameter. In this case, it seems that it is just
> disabling one video mode. I don't think you need this here, as the better
> is to disable such video mode in cx88. Hard to tell without seeing the
> cx88 code that adds support for the Winfast xc4000-based card.

I do not think making it card-specific is really needed. It is probably
best to just remove the card_type check here. Also, the code is there
only to improve support for old (1.2) firmware versions.

For xc4000.c and xc4000.h, is it enough to create the following three
patches, or should the changes be broken up into more smaller patches ?
  - removing the use of card_type
  - uncommenting the firmware version check
  - coding style / cleanup
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] XC4000: code cleanup

2011-06-06 Thread Istvan Varga
Various coding style changes:
  - removed unused / commented out code
  - changed C++ style comments to C format
  - renamed functions and variables that included upper case letters in the name
  - removed tabs from module parameter descriptions
  - replaced the use of XC_RESULT_* with standard error codes

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/common/tuners/xc4000.c 
xc4000/drivers/media/common/tuners/xc4000.c
--- xc4000_orig/drivers/media/common/tuners/xc4000.c2011-06-06 
14:10:12.0 +0200
+++ xc4000/drivers/media/common/tuners/xc4000.c 2011-06-06 14:37:35.0 
+0200
@@ -5,6 +5,7 @@
  *  Copyright (c) 2007 Steven Toth 
  *  Copyright (c) 2009 Devin Heitmueller 
  *  Copyright (c) 2009 Davide Ferri 
+ *  Copyright (c) 2010 Istvan Varga 
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -14,7 +15,6 @@
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
@@ -39,44 +39,29 @@
 
 static int debug;
 module_param(debug, int, 0644);
-MODULE_PARM_DESC(debug, "\n\t\tDebugging level (0 to 2, default: 0 (off)).");
+MODULE_PARM_DESC(debug, "Debugging level (0 to 2, default: 0 (off)).");
 
 static int no_poweroff;
 module_param(no_poweroff, int, 0644);
-MODULE_PARM_DESC(no_poweroff, "\n\t\t1: keep device energized and with tuner "
-   "ready all the times.\n"
-   "\t\tFaster, but consumes more power and keeps the device hotter.\n"
-   "\t\t2: powers device off when not used.\n"
-   "\t\t0 (default): use device-specific default mode.");
-
-#define XC4000_AUDIO_STD_B  1
-#define XC4000_AUDIO_STD_A2 2
-#define XC4000_AUDIO_STD_K3 4
-#define XC4000_AUDIO_STD_L  8
-#define XC4000_AUDIO_STD_INPUT116
-#define XC4000_AUDIO_STD_MONO  32
+MODULE_PARM_DESC(no_poweroff, "Power management (1: disabled, 2: enabled, "
+   "0 (default): use device-specific default mode).");
 
 static int audio_std;
 module_param(audio_std, int, 0644);
-MODULE_PARM_DESC(audio_std, "\n\t\tAudio standard. XC4000 audio decoder "
-   "explicitly needs to know\n"
-   "\t\twhat audio standard is needed for some video standards with\n"
-   "\t\taudio A2 or NICAM.\n"
-   "\t\tThe valid settings are a sum of:\n"
-   "\t\t 1: use NICAM/B or A2/B instead of NICAM/A or A2/A\n"
-   "\t\t 2: use A2 instead of NICAM or BTSC\n"
-   "\t\t 4: use SECAM/K3 instead of K1\n"
-   "\t\t 8: use PAL-D/K audio for SECAM-D/K\n"
-   "\t\t16: use FM radio input 1 instead of input 2\n"
-   "\t\t32: use mono audio (the lower three bits are ignored)");
-
-#define XC4000_DEFAULT_FIRMWARE "xc4000.fw"
+MODULE_PARM_DESC(audio_std, "Audio standard. XC4000 audio decoder explicitly "
+   "needs to know what audio standard is needed for some video standards "
+   "with audio A2 or NICAM. The valid settings are a sum of:\n"
+   " 1: use NICAM/B or A2/B instead of NICAM/A or A2/A\n"
+   " 2: use A2 instead of NICAM or BTSC\n"
+   " 4: use SECAM/K3 instead of K1\n"
+   " 8: use PAL-D/K audio for SECAM-D/K\n"
+   "16: use FM radio input 1 instead of input 2\n"
+   "32: use mono audio (the lower three bits are ignored)");
 
 static char firmware_name[30];
 module_param_string(firmware_name, firmware_name, sizeof(firmware_name), 0);
-MODULE_PARM_DESC(firmware_name, "\n\t\tFirmware file name. Allows overriding "
-   "the default firmware\n"
-   "\t\tname.");
+MODULE_PARM_DESC(firmware_name, "Firmware file name. Allows overriding the "
+   "default firmware name.");
 
 static DEFINE_MUTEX(xc4000_list_mutex);
 static LIST_HEAD(hybrid_tuner_instance_list);
@@ -115,13 +100,21 @@
u8  rf_mode;
u8  card_type;
u8  ignore_i2c_write_errors;
- /*struct xc2028_ctrl  ctrl; */
struct firmware_properties cur_fw;
__u16   hwmodel;
__u16   hwvers;
struct mutexlock;
 };
 
+#define XC4000_AUDIO_STD_B  1
+#define XC4000_AUDIO_STD_A2 2
+#define XC4000_AUDIO_STD_K3 4
+#define XC4000_AUDIO_STD_L  8
+#define XC4000_AUDIO_STD_INPUT116
+#define XC4000_AUDIO_STD_MONO  32
+
+#define XC4000_DEFAULT_FIRMWARE "dvb-fe-xc4000-1.4.

[PATCH 2/4] XC4000: auto-select XC4000 tuner

2011-06-06 Thread Istvan Varga
Automatically select the xc4000 module for dib0700 if the tuner selection is
not customized.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/dvb/dvb-usb/Kconfig 
xc4000/drivers/media/dvb/dvb-usb/Kconfig
--- xc4000_orig/drivers/media/dvb/dvb-usb/Kconfig   2011-06-06 
14:10:12.0 +0200
+++ xc4000/drivers/media/dvb/dvb-usb/Kconfig2011-06-06 14:43:39.0 
+0200
@@ -81,6 +81,7 @@
select MEDIA_TUNER_MT2266 if !MEDIA_TUNER_CUSTOMISE
select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE
select MEDIA_TUNER_XC5000 if !MEDIA_TUNER_CUSTOMISE
+   select MEDIA_TUNER_XC4000 if !MEDIA_TUNER_CUSTOMISE
select MEDIA_TUNER_MXL5007T if !MEDIA_TUNER_CUSTOMISE
help
  Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. 
The
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] XC4000: check firmware version

2011-06-06 Thread Istvan Varga
Enabled code to check if the version of the firmware reported by the hardware
is correct after uploading it.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/common/tuners/xc4000.c 
xc4000/drivers/media/common/tuners/xc4000.c
--- xc4000_orig/drivers/media/common/tuners/xc4000.c2011-06-06 
14:40:53.0 +0200
+++ xc4000/drivers/media/common/tuners/xc4000.c 2011-06-06 15:01:25.0 
+0200
@@ -919,7 +919,7 @@
struct xc4000_priv *priv = fe->tuner_priv;
struct firmware_properties new_fw;
intrc = 0, is_retry = 0;
-   u16version = 0, hwmodel;
+   u16hwmodel;
v4l2_std_idstd0;
u8 hw_major, hw_minor, fw_major, fw_minor;
 
@@ -1032,23 +1032,23 @@
hwmodel, hw_major, hw_minor, fw_major, fw_minor);
 
/* Check firmware version against what we downloaded. */
-#ifdef DJH_DEBUG
-   if (priv->firm_version != ((version & 0xf0) << 4 | (version & 0x0f))) {
-   printk("Incorrect readback of firmware version %x.\n",
-  (version & 0xff));
+   if (priv->firm_version != ((fw_major << 8) | fw_minor)) {
+   printk(KERN_WARNING
+  "Incorrect readback of firmware version %d.%d.\n",
+  fw_major, fw_minor);
goto fail;
}
-#endif
 
/* Check that the tuner hardware model remains consistent over time. */
if (priv->hwmodel == 0 &&
(hwmodel == XC_PRODUCT_ID_XC4000 ||
 hwmodel == XC_PRODUCT_ID_XC4100)) {
priv->hwmodel = hwmodel;
-   priv->hwvers  = version & 0xff00;
+   priv->hwvers = (hw_major << 8) | hw_minor;
} else if (priv->hwmodel == 0 || priv->hwmodel != hwmodel ||
-  priv->hwvers != (version & 0xff00)) {
-   printk("Read invalid device hardware information - tuner "
+  priv->hwvers != ((hw_major << 8) | hw_minor)) {
+   printk(KERN_WARNING
+  "Read invalid device hardware information - tuner "
   "hung?\n");
goto fail;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] XC4000: removed card_type

2011-06-06 Thread Istvan Varga
Removed the use of 'card_type' from the tuner configuration structure, and
replaced it with separate parameters to set board-specific configuration.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/common/tuners/xc4000.c 
xc4000/drivers/media/common/tuners/xc4000.c
--- xc4000_orig/drivers/media/common/tuners/xc4000.c2011-06-06 
15:02:03.0 +0200
+++ xc4000/drivers/media/common/tuners/xc4000.c 2011-06-06 16:53:27.0 
+0200
@@ -92,14 +92,16 @@
struct list_head hybrid_tuner_instance_list;
struct firmware_description *firm;
int firm_size;
-   __u16   firm_version;
u32 if_khz;
u32 freq_hz;
u32 bandwidth;
u8  video_standard;
u8  rf_mode;
-   u8  card_type;
+   u8  default_pm;
+   u8  dvb_amplitude;
+   u8  set_smoothedcvbs;
u8  ignore_i2c_write_errors;
+   __u16   firm_version;
struct firmware_properties cur_fw;
__u16   hwmodel;
__u16   hwvers;
@@ -1226,19 +1228,22 @@
}
}
 
-   if (priv->card_type == XC4000_CARD_WINFAST_CX88) {
-   if (xc_write_reg(priv, XREG_D_CODE, 0) == 0)
-   ret = 0;
+   if (xc_write_reg(priv, XREG_D_CODE, 0) == 0)
+   ret = 0;
+   if (priv->dvb_amplitude != 0) {
if (xc_write_reg(priv, XREG_AMPLITUDE,
-(priv->firm_version == 0x0102 ? 132 : 134))
-   != 0)
+(priv->firm_version != 0x0102 ||
+ priv->dvb_amplitude != 134 ?
+ priv->dvb_amplitude : 132)) != 0)
ret = -EREMOTEIO;
+   }
+   if (priv->set_smoothedcvbs != 0) {
if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0)
ret = -EREMOTEIO;
-   if (ret != 0) {
-   printk(KERN_ERR "xc4000: setting registers failed\n");
-   /* goto fail; */
-   }
+   }
+   if (ret != 0) {
+   printk(KERN_ERR "xc4000: setting registers failed\n");
+   /* goto fail; */
}
 
xc_tune_channel(priv, priv->freq_hz);
@@ -1412,8 +1417,7 @@
if (type & NOGD)
video_mode &= 0xFF7F;
} else if (priv->video_standard < XC4000_I_PAL_NICAM) {
-   if (priv->card_type == XC4000_CARD_WINFAST_CX88 &&
-   priv->firm_version == 0x0102)
+   if (priv->firm_version == 0x0102)
video_mode &= 0xFEFF;
if (audio_std & XC4000_AUDIO_STD_B)
video_mode |= 0x0080;
@@ -1425,17 +1429,17 @@
}
}
 
-   if (priv->card_type == XC4000_CARD_WINFAST_CX88) {
-   if (xc_write_reg(priv, XREG_D_CODE, 0) == 0)
-   ret = 0;
-   if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0)
-   ret = -EREMOTEIO;
+   if (xc_write_reg(priv, XREG_D_CODE, 0) == 0)
+   ret = 0;
+   if (xc_write_reg(priv, XREG_AMPLITUDE, 1) != 0)
+   ret = -EREMOTEIO;
+   if (priv->set_smoothedcvbs != 0) {
if (xc_write_reg(priv, XREG_SMOOTHEDCVBS, 1) != 0)
ret = -EREMOTEIO;
-   if (ret != 0) {
-   printk(KERN_ERR "xc4000: setting registers failed\n");
-   goto fail;
-   }
+   }
+   if (ret != 0) {
+   printk(KERN_ERR "xc4000: setting registers failed\n");
+   goto fail;
}
 
xc_tune_channel(priv, priv->freq_hz);
@@ -1516,8 +1520,7 @@
 
/* Avoid firmware reload on slow devices */
if ((no_poweroff == 2 ||
-(no_poweroff == 0 &&
- priv->card_type != XC4000_CARD_WINFAST_CX88)) &&
+(no_poweroff == 0 && priv->default_pm != 0)) &&
(priv->cur_fw.type & BASE) != 0) {
/* force reset and firmware reload */
priv->cur_fw.type = XC_POWERED_DOWN;
@@ -1588,16 +1591,6 @@
int instance;
u16 id = 0;
 
-   if (cfg->card_type != XC4000_CARD_GENERIC) {
-   if (cfg->card_type == XC4000_CARD_WINFAST_CX88) {
-   cfg->i2c_address = 0x61;
-   cfg->if_khz = 4560;
-   } else {/* default to PCTV 340E */
-   cfg->i2c_address = 0x61;
-   cfg->if_khz = 5400;
-   }
-   }
-
dprintk(1, "%s(%d-%04x)\n"

[PATCH 1/4] cx88: added XC4000 tuner callback and DVB attach functions

2011-06-07 Thread Istvan Varga
Added functions for XC4000 tuner reset and attaching DVB frontend.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-cards.c 
xc4000/drivers/media/video/cx88/cx88-cards.c
--- xc4000_orig/drivers/media/video/cx88/cx88-cards.c   2011-06-07 
14:33:39.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-cards.c2011-06-07 
15:28:03.0 +0200
@@ -28,6 +28,7 @@
 
 #include "cx88.h"
 #include "tea5767.h"
+#include "xc4000.h"
 
 static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
 static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET };
@@ -2948,6 +2949,15 @@
return -EINVAL;
 }
 
+static int cx88_xc4000_tuner_callback(struct cx88_core *core,
+ int command, int arg)
+{
+   /* Board-specific callbacks */
+   switch (core->boardnr) {
+   }
+   return -EINVAL;
+}
+
 /* --- */
 /* Tuner callback function. Currently only needed for the Pinnacle*
  * PCTV HD 800i with an xc5000 sillicon tuner. This is used for both  *
@@ -3022,6 +3032,9 @@
case TUNER_XC2028:
info_printk(core, "Calling XC2028/3028 callback\n");
return cx88_xc2028_tuner_callback(core, command, arg);
+   case TUNER_XC4000:
+   info_printk(core, "Calling XC4000 callback\n");
+   return cx88_xc4000_tuner_callback(core, command, arg);
case TUNER_XC5000:
info_printk(core, "Calling XC5000 callback\n");
return cx88_xc5000_tuner_callback(core, command, arg);
diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-dvb.c 
xc4000/drivers/media/video/cx88/cx88-dvb.c
--- xc4000_orig/drivers/media/video/cx88/cx88-dvb.c 2011-06-07 
14:33:39.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-dvb.c  2011-06-07 15:33:09.0 
+0200
@@ -41,6 +41,7 @@
 #include "or51132.h"
 #include "lgdt330x.h"
 #include "s5h1409.h"
+#include "xc4000.h"
 #include "xc5000.h"
 #include "nxt200x.h"
 #include "cx24123.h"
@@ -604,6 +605,39 @@
 
return 0;
 }
+
+static int attach_xc4000(struct cx8802_dev *dev, struct xc4000_config *cfg)
+{
+   struct dvb_frontend *fe;
+   struct videobuf_dvb_frontend *fe0 = NULL;
+
+   /* Get the first frontend */
+   fe0 = videobuf_dvb_get_frontend(&dev->frontends, 1);
+   if (!fe0)
+   return -EINVAL;
+
+   if (!fe0->dvb.frontend) {
+   printk(KERN_ERR "%s/2: dvb frontend not attached. "
+   "Can't attach xc4000\n",
+  dev->core->name);
+   return -EINVAL;
+   }
+
+   fe = dvb_attach(xc4000_attach, fe0->dvb.frontend, &dev->core->i2c_adap,
+   cfg);
+   if (!fe) {
+   printk(KERN_ERR "%s/2: xc4000 attach failed\n",
+  dev->core->name);
+   dvb_frontend_detach(fe0->dvb.frontend);
+   dvb_unregister_frontend(fe0->dvb.frontend);
+   fe0->dvb.frontend = NULL;
+   return -EINVAL;
+   }
+
+   printk(KERN_INFO "%s/2: xc4000 attached\n", dev->core->name);
+
+   return 0;
+}
 
 static int cx24116_set_ts_param(struct dvb_frontend *fe,
int is_punctured)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] cx88: added support for Leadtek WinFast DTV2000 H Plus

2011-06-07 Thread Istvan Varga
This patch implements support for the Leadtek WinFast DTV2000 H Plus card
with XC4000 tuner (107d:6f42).

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-cards.c 
xc4000/drivers/media/video/cx88/cx88-cards.c
--- xc4000_orig/drivers/media/video/cx88/cx88-cards.c   2011-06-07 
15:34:32.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-cards.c2011-06-07 
17:37:32.0 +0200
@@ -2120,6 +2120,58 @@
},
.mpeg   = CX88_MPEG_DVB,
},
+   [CX88_BOARD_WINFAST_DTV2000H_PLUS] = {
+   .name   = "Leadtek WinFast DTV2000 H PLUS",
+   .tuner_type = TUNER_XC4000,
+   .radio_type = TUNER_XC4000,
+   .tuner_addr = 0x61,
+   .radio_addr = 0x61,
+   /*
+* GPIO
+*   2: 1: mute audio
+*  12: 0: reset XC4000
+*  13: 1: audio input is line in (0: tuner)
+*  14: 0: FM radio
+*  16: 0: RF input is cable
+*/
+   .input  = {{
+   .type   = CX88_VMUX_TELEVISION,
+   .vmux   = 0,
+   .gpio0  = 0x0403,
+   .gpio1  = 0xF0D7,
+   .gpio2  = 0x0101,
+   .gpio3  = 0x,
+   }, {
+   .type   = CX88_VMUX_CABLE,
+   .vmux   = 0,
+   .gpio0  = 0x0403,
+   .gpio1  = 0xF0D7,
+   .gpio2  = 0x0100,
+   .gpio3  = 0x,
+   }, {
+   .type   = CX88_VMUX_COMPOSITE1,
+   .vmux   = 1,
+   .gpio0  = 0x0403,   /* was 0x0407 */
+   .gpio1  = 0xF0F7,
+   .gpio2  = 0x0101,
+   .gpio3  = 0x,
+   }, {
+   .type   = CX88_VMUX_SVIDEO,
+   .vmux   = 2,
+   .gpio0  = 0x0403,   /* was 0x0407 */
+   .gpio1  = 0xF0F7,
+   .gpio2  = 0x0101,
+   .gpio3  = 0x,
+   }},
+   .radio = {
+   .type   = CX88_RADIO,
+   .gpio0  = 0x0403,
+   .gpio1  = 0xF097,
+   .gpio2  = 0x0100,
+   .gpio3  = 0x,
+   },
+   .mpeg   = CX88_MPEG_DVB,
+   },
[CX88_BOARD_PROF_7301] = {
.name   = "Prof 7301 DVB-S/S2",
.tuner_type = UNSET,
@@ -2582,6 +2634,10 @@
.subdevice = 0x6654,
.card  = CX88_BOARD_WINFAST_DTV1800H,
}, {
+   .subvendor = 0x107d,
+   .subdevice = 0x6f42,
+   .card  = CX88_BOARD_WINFAST_DTV2000H_PLUS,
+   }, {
/* PVR2000 PAL Model [107d:6630] */
.subvendor = 0x107d,
.subdevice = 0x6630,
@@ -2847,6 +2903,23 @@
return -EINVAL;
 }
 
+static int cx88_xc4000_winfast2000h_plus_callback(struct cx88_core *core,
+ int command, int arg)
+{
+   switch (command) {
+   case XC4000_TUNER_RESET:
+   /* GPIO 12 (xc4000 tuner reset) */
+   cx_set(MO_GP1_IO, 0x1010);
+   mdelay(50);
+   cx_clear(MO_GP1_IO, 0x10);
+   mdelay(75);
+   cx_set(MO_GP1_IO, 0x10);
+   mdelay(75);
+   return 0;
+   }
+   return -EINVAL;
+}
+
 /* --- */
 /* some Divco specific stuff   */
 static int cx88_pv_8000gt_callback(struct cx88_core *core,
@@ -2954,6 +3027,9 @@
 {
/* Board-specific callbacks */
switch (core->boardnr) {
+   case CX88_BOARD_WINFAST_DTV2000H_PLUS:
+   return cx88_xc4000_winfast2000h_plus_callback(core,
+ command, arg);
}
return -EINVAL;
 }
@@ -3131,6 +3207,11 @@
mdelay(50);
break;
 
+   case CX88_BOARD_WINFAST_DTV2000H_PLUS:
+   cx88_xc4000_winfast2000h_plus_callback(core,
+  XC4000_TUNER_RESET, 0);
+   break;
+
case CX88_BOARD_TWINHAN_VP1027_DVBS:
cx_write(MO_GP0_IO, 0x3230);
cx_write(MO_GP0_IO, 0x3210);
diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-dvb.c 
xc4000/drivers/media/video/cx88/cx88-dvb.c
--- xc4000_orig/drivers/media/video/cx88/cx88-dvb.c 2011-06-07 
15:34:32.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-dvb.c  2011-0

[PATCH 3/4] cx88: added support for Leadtek WinFast DTV1800 H with XC4000 tuner

2011-06-07 Thread Istvan Varga
This patch implements support for the Leadtek WinFast DTV1800 H card with
XC4000 tuner (107d:6f38).

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-cards.c 
xc4000/drivers/media/video/cx88/cx88-cards.c
--- xc4000_orig/drivers/media/video/cx88/cx88-cards.c   2011-06-07 
17:42:58.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-cards.c2011-06-07 
18:01:53.0 +0200
@@ -2120,6 +2120,47 @@
},
.mpeg   = CX88_MPEG_DVB,
},
+   [CX88_BOARD_WINFAST_DTV1800H_XC4000] = {
+   .name   = "Leadtek WinFast DTV1800 H (XC4000)",
+   .tuner_type = TUNER_XC4000,
+   .radio_type = TUNER_XC4000,
+   .tuner_addr = 0x61,
+   .radio_addr = 0x61,
+   /*
+* GPIO setting
+*
+*  2: mute (0=off,1=on)
+* 12: tuner reset pin
+* 13: audio source (0=tuner audio,1=line in)
+* 14: FM (0=on,1=off ???)
+*/
+   .input  = {{
+   .type   = CX88_VMUX_TELEVISION,
+   .vmux   = 0,
+   .gpio0  = 0x0400,   /* pin 2 = 0 */
+   .gpio1  = 0x6040,   /* pin 13 = 0, pin 14 = 1 */
+   .gpio2  = 0x,
+   }, {
+   .type   = CX88_VMUX_COMPOSITE1,
+   .vmux   = 1,
+   .gpio0  = 0x0400,   /* pin 2 = 0 */
+   .gpio1  = 0x6060,   /* pin 13 = 1, pin 14 = 1 */
+   .gpio2  = 0x,
+   }, {
+   .type   = CX88_VMUX_SVIDEO,
+   .vmux   = 2,
+   .gpio0  = 0x0400,   /* pin 2 = 0 */
+   .gpio1  = 0x6060,   /* pin 13 = 1, pin 14 = 1 */
+   .gpio2  = 0x,
+   }},
+   .radio = {
+   .type   = CX88_RADIO,
+   .gpio0  = 0x0400,   /* pin 2 = 0 */
+   .gpio1  = 0x6000,   /* pin 13 = 0, pin 14 = 0 */
+   .gpio2  = 0x,
+   },
+   .mpeg   = CX88_MPEG_DVB,
+   },
[CX88_BOARD_WINFAST_DTV2000H_PLUS] = {
.name   = "Leadtek WinFast DTV2000 H PLUS",
.tuner_type = TUNER_XC4000,
@@ -2634,6 +2675,11 @@
.subdevice = 0x6654,
.card  = CX88_BOARD_WINFAST_DTV1800H,
}, {
+   /* WinFast DTV1800 H with XC4000 tuner */
+   .subvendor = 0x107d,
+   .subdevice = 0x6f38,
+   .card  = CX88_BOARD_WINFAST_DTV1800H_XC4000,
+   }, {
.subvendor = 0x107d,
.subdevice = 0x6f42,
.card  = CX88_BOARD_WINFAST_DTV2000H_PLUS,
@@ -3027,6 +3073,7 @@
 {
/* Board-specific callbacks */
switch (core->boardnr) {
+   case CX88_BOARD_WINFAST_DTV1800H_XC4000:
case CX88_BOARD_WINFAST_DTV2000H_PLUS:
return cx88_xc4000_winfast2000h_plus_callback(core,
  command, arg);
@@ -3207,6 +3254,7 @@
mdelay(50);
break;
 
+   case CX88_BOARD_WINFAST_DTV1800H_XC4000:
case CX88_BOARD_WINFAST_DTV2000H_PLUS:
cx88_xc4000_winfast2000h_plus_callback(core,
   XC4000_TUNER_RESET, 0);
diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-dvb.c 
xc4000/drivers/media/video/cx88/cx88-dvb.c
--- xc4000_orig/drivers/media/video/cx88/cx88-dvb.c 2011-06-07 
17:42:58.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-dvb.c  2011-06-07 17:56:07.0 
+0200
@@ -1328,6 +1328,7 @@
goto frontend_detach;
}
break;
+   case CX88_BOARD_WINFAST_DTV1800H_XC4000:
case CX88_BOARD_WINFAST_DTV2000H_PLUS:
fe0->dvb.frontend = dvb_attach(zl10353_attach,
   &cx88_pinnacle_hybrid_pctv,
diff -uNr xc4000_orig/drivers/media/video/cx88/cx88.h 
xc4000/drivers/media/video/cx88/cx88.h
--- xc4000_orig/drivers/media/video/cx88/cx88.h 2011-06-07 17:42:58.0 
+0200
+++ xc4000/drivers/media/video/cx88/cx88.h  2011-06-07 17:56:39.0 
+0200
@@ -243,6 +243,7 @@
 #define CX88_BOARD_TWINHAN_VP1027_DVBS 85
 #define CX88_BOARD_TEVII_S464  86
 #define CX88_BOARD_WINFAST_DTV2000H_PLUS   87
+#define CX88_BOARD_WINFAST_DTV1800H_XC4000 88
 
 enum cx88_itype {
CX88_VMUX_COMPOSITE1 = 1,
diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-input.c 
xc4000/drivers/media/video/cx88/cx88-input.c
--- xc4000_orig/drivers/media/video/cx88/cx88-input.c   

[PATCH 4/4] cx88: replaced duplicated code with function call

2011-06-07 Thread Istvan Varga
The following patch replaces code to reset the XC3028 tuner with a call
to the tuner reset callback.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-cards.c 
xc4000/drivers/media/video/cx88/cx88-cards.c
--- xc4000_orig/drivers/media/video/cx88/cx88-cards.c   2011-06-07 
18:02:28.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-cards.c2011-06-07 
18:09:01.0 +0200
@@ -3245,13 +3245,7 @@
 
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
case CX88_BOARD_WINFAST_DTV1800H:
-   /* GPIO 12 (xc3028 tuner reset) */
-   cx_set(MO_GP1_IO, 0x1010);
-   mdelay(50);
-   cx_clear(MO_GP1_IO, 0x10);
-   mdelay(50);
-   cx_set(MO_GP1_IO, 0x10);
-   mdelay(50);
+   cx88_xc3028_winfast1800h_callback(core, XC2028_TUNER_RESET, 0);
break;
 
case CX88_BOARD_WINFAST_DTV1800H_XC4000:
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] XC4000: removed card_type

2011-06-09 Thread Istvan Varga
On Monday 06 June 2011 22:10:22 you wrote:

> Please solve the firmware issue before the next merge window.

I have already received the Xceive firmware source and the program that
builds the firmware for the Linux driver from Devin Heitmueller, and
have sent back to him a modified version that builds the complete
firmware (including the analog standards) yesterday. If this version
does not have bugs, the firmware should be available soon.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/4] XC4000: removed card_type

2011-06-20 Thread Istvan Varga
On Monday 06 June 2011 22:10:22 Mauro Carvalho Chehab wrote:

> Please solve the firmware issue before the next merge window.

I have not yet received a reply from Devin Heitmueller to my post about
the changes I made to his firmware building utility, but for now here is
the modified firmware file in case someone intends to test it. Analog
support unfortunately cannot be tested with the PCTV 340e, but with the
Leadtek cx88+xc4000 cards for which I have submitted patches about two
weeks ago it can be tested.


dvb-fe-xc4000-1.4.fw
Description: Binary data
The following XC4000 firmware file "dvb-fe-xc4000-1.4.1.fw" was
created based on version 1.4 of "xc4000_firmwares.h".

Firmware provided as part of an XC4000 Linux developers kit by Brian
Mathews  to Devin Heitmueller
 on July 1, 2009.

The code was released by Xceive under the following license:

// Copyright (c) 2009, Xceive Corporation 
//
// Permission to use, copy, modify, and/or distribute this software, only
// for use with Xceive ICs, for any purpose with or without fee is hereby
// granted, provided that the above copyright notice and this permission
// notice appear in all source code copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


[PATCH] cx23885: added support for card 107d:6f39

2011-07-11 Thread Istvan Varga
This patch, based on code by Mirek Slugen, implements support for the
Leadtek WinFast PxDVR3200 H card with XC4000 tuner (107d:6f39).

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/video/cx23885/cx23885-cards.c 
xc4000/drivers/media/video/cx23885/cx23885-cards.c
--- xc4000_orig/drivers/media/video/cx23885/cx23885-cards.c 2011-07-08 
16:47:29.0 +0200
+++ xc4000/drivers/media/video/cx23885/cx23885-cards.c  2011-07-10 
13:31:15.0 +0200
@@ -31,6 +31,7 @@
 #include "tuner-xc2028.h"
 #include "netup-init.h"
 #include "altera-ci.h"
+#include "xc4000.h"
 #include "xc5000.h"
 #include "cx23888-ir.h"
 
@@ -175,6 +176,34 @@
.name   = "Leadtek Winfast PxDVR3200 H",
.portc  = CX23885_MPEG_DVB,
},
+   [CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000] = {
+   .name   = "Leadtek Winfast PxDVR3200 H XC4000",
+   .porta  = CX23885_ANALOG_VIDEO,
+   .portc  = CX23885_MPEG_DVB,
+   .tuner_type = TUNER_XC4000,
+   .tuner_addr = 0x61,
+   .radio_type = TUNER_XC4000,
+   .radio_addr = 0x61,
+   .input  = {{
+   .type   = CX23885_VMUX_TELEVISION,
+   .vmux   = CX25840_VIN2_CH1 |
+ CX25840_VIN5_CH2 |
+ CX25840_NONE0_CH3,
+   }, {
+   .type   = CX23885_VMUX_COMPOSITE1,
+   .vmux   = CX25840_COMPOSITE1,
+   }, {
+   .type   = CX23885_VMUX_SVIDEO,
+   .vmux   = CX25840_SVIDEO_LUMA3 |
+ CX25840_SVIDEO_CHROMA4,
+   }, {
+   .type   = CX23885_VMUX_COMPONENT,
+   .vmux   = CX25840_VIN7_CH1 |
+ CX25840_VIN6_CH2 |
+ CX25840_VIN8_CH3 |
+ CX25840_COMPONENT_ON,
+   } },
+   },
[CX23885_BOARD_COMPRO_VIDEOMATE_E650F] = {
.name   = "Compro VideoMate E650F",
.portc  = CX23885_MPEG_DVB,
@@ -433,6 +462,10 @@
.subdevice = 0x6681,
.card  = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H,
}, {
+   .subvendor = 0x107d,
+   .subdevice = 0x6f39,
+   .card  = CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000,
+   }, {
.subvendor = 0x185b,
.subdevice = 0xe800,
.card  = CX23885_BOARD_COMPRO_VIDEOMATE_E650F,
@@ -749,6 +782,7 @@
case CX23885_BOARD_HAUPPAUGE_HVR1500:
case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
+   case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
@@ -909,6 +943,7 @@
cx_set(GP0_IO, 0x000f000f);
break;
case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
+   case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
case CX23885_BOARD_COMPRO_VIDEOMATE_E800:
case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200:
@@ -1334,6 +1369,7 @@
case CX23885_BOARD_HAUPPAUGE_HVR1700:
case CX23885_BOARD_HAUPPAUGE_HVR1400:
case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
+   case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
case CX23885_BOARD_HAUPPAUGE_HVR1270:
case CX23885_BOARD_HAUPPAUGE_HVR1275:
@@ -1362,6 +1398,7 @@
case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
case CX23885_BOARD_HAUPPAUGE_HVR1700:
case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H:
+   case CX23885_BOARD_LEADTEK_WINFAST_PXDVR3200_H_XC4000:
case CX23885_BOARD_COMPRO_VIDEOMATE_E650F:
case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF:
diff -uNr xc4000_orig/drivers/media/video/cx23885/cx23885-dvb.c 
xc4000/drivers/media/video/cx23885/cx23885-dvb.c
--- xc4000_orig/drivers/media/video/cx23885/cx23885-dvb.c   2011-07-08 
16:47:29.0 +0200
+++ xc4000/drivers/media/video/cx23885/cx23885-dvb.c2011-07-10 
13:36:32.0 +0200
@@ -37,6 +37,7 @@
 #include "tda8290.h"
 #include "tda18271.h"
 #include "lgdt330x.h"
+#include "xc4000.h"
 #include "xc5000.h"
 #include "max2165.h"
 #include "tda10048.h"
@@ -921,6 +922,26 @@
fe->ops.tuner_ops.set_config(fe, &ctl);

[PATCH 1/2] cx88: implemented sharpness control

2011-07-11 Thread Istvan Varga
This patch implements support for a sharpness control, using the luma
peaking filter feature of cx2388x.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-core.c 
xc4000/drivers/media/video/cx88/cx88-core.c
--- xc4000_orig/drivers/media/video/cx88/cx88-core.c2011-07-08 
17:01:47.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-core.c 2011-07-11 15:21:56.0 
+0200
@@ -759,8 +759,8 @@
if (nocomb)
value |= (3 << 5); // disable comb filter
 
-   cx_write(MO_FILTER_EVEN,  value);
-   cx_write(MO_FILTER_ODD,   value);
+   cx_write(MO_FILTER_EVEN,  0x7ffc7f, value); /* preserve PEAKEN, PSEL */
+   cx_write(MO_FILTER_ODD,   0x7ffc7f, value);
dprintk(1,"set_scale: filter  0x%04x\n", value);
 
return 0;
diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-video.c 
xc4000/drivers/media/video/cx88/cx88-video.c
--- xc4000_orig/drivers/media/video/cx88/cx88-video.c   2011-07-08 
17:01:47.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-video.c2011-07-11 
15:31:32.0 +0200
@@ -221,7 +221,23 @@
.reg   = MO_UV_SATURATION,
.mask  = 0x00ff,
.shift = 0,
-   },{
+   }, {
+   .v = {
+   .id= V4L2_CID_SHARPNESS,
+   .name  = "Sharpness",
+   .minimum   = 0,
+   .maximum   = 4,
+   .step  = 1,
+   .default_value = 0x0,
+   .type  = V4L2_CTRL_TYPE_INTEGER,
+   },
+   .off   = 0,
+   /* NOTE: the value is converted and written to both even
+  and odd registers in the code */
+   .reg   = MO_FILTER_ODD,
+   .mask  = 7 << 7,
+   .shift = 7,
+   }, {
.v = {
.id= V4L2_CID_CHROMA_AGC,
.name  = "Chroma AGC",
@@ -301,6 +317,7 @@
V4L2_CID_AUDIO_VOLUME,
V4L2_CID_AUDIO_BALANCE,
V4L2_CID_AUDIO_MUTE,
+   V4L2_CID_SHARPNESS,
V4L2_CID_CHROMA_AGC,
V4L2_CID_COLOR_KILLER,
0
@@ -963,6 +980,10 @@
case V4L2_CID_AUDIO_VOLUME:
ctl->value = 0x3f - (value & 0x3f);
break;
+   case V4L2_CID_SHARPNESS:
+   ctl->value = ((value & 0x0200) ? (((value & 0x0180) >> 7) + 1)
+: 0);
+   break;
default:
ctl->value = ((value + (c->off << c->shift)) & c->mask) >> 
c->shift;
break;
@@ -1040,6 +1061,12 @@
}
mask=0x;
break;
+   case V4L2_CID_SHARPNESS:
+   /* 0b000, 0b100, 0b101, 0b110, or 0b111 */
+   value = (ctl->value < 1 ? 0 : ((ctl->value + 3) << 7));
+   /* needs to be set for both fields */
+   cx_andor(MO_FILTER_EVEN, mask, value);
+   break;
case V4L2_CID_CHROMA_AGC:
/* Do not allow chroma AGC to be enabled for SECAM */
value = ((ctl->value - c->off) << c->shift) & c->mask;
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] cx88: implemented luma notch filter control

2011-07-11 Thread Istvan Varga
The following patch adds a new control that makes it possible to set the
luma notch filter type to finetune picture quality.

Signed-off-by: Istvan Varga 

diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-core.c 
xc4000/drivers/media/video/cx88/cx88-core.c
--- xc4000_orig/drivers/media/video/cx88/cx88-core.c2011-07-11 
15:34:50.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-core.c 2011-07-11 15:44:35.0 
+0200
@@ -636,6 +636,9 @@
cx_write(MO_PCI_INTSTAT,   0x); // Clear PCI int
cx_write(MO_INT1_STAT, 0x); // Clear RISC int
 
+   /* set default notch filter */
+   cx_andor(MO_HTOTAL, 0x1800, (HLNotchFilter4xFsc << 11));
+
/* Reset on-board parts */
cx_write(MO_SRST_IO, 0);
msleep(10);
@@ -994,10 +997,10 @@
// htotal
tmp64 = norm_htotal(norm) * (u64)vdec_clock;
do_div(tmp64, fsc8);
-   htotal = (u32)tmp64 | (HLNotchFilter4xFsc << 11);
+   htotal = (u32)tmp64;
dprintk(1,"set_tvnorm: MO_HTOTAL0x%08x 
[old=0x%08x,htotal=%d]\n",
htotal, cx_read(MO_HTOTAL), (u32)tmp64);
-   cx_write(MO_HTOTAL, htotal);
+   cx_andor(MO_HTOTAL, 0x07ff, htotal);
 
// vbi stuff, set vbi offset to 10 (for 20 Clk*2 pixels), this makes
// the effective vbi offset ~244 samples, the same as the Bt8x8
diff -uNr xc4000_orig/drivers/media/video/cx88/cx88-video.c 
xc4000/drivers/media/video/cx88/cx88-video.c
--- xc4000_orig/drivers/media/video/cx88/cx88-video.c   2011-07-11 
15:34:50.0 +0200
+++ xc4000/drivers/media/video/cx88/cx88-video.c2011-07-11 
15:49:29.0 +0200
@@ -262,6 +262,20 @@
.mask  = 1 << 9,
.shift = 9,
}, {
+   .v = {
+   .id= V4L2_CID_BAND_STOP_FILTER,
+   .name  = "Notch filter",
+   .minimum   = 0,
+   .maximum   = 3,
+   .step  = 1,
+   .default_value = 0x0,
+   .type  = V4L2_CTRL_TYPE_INTEGER,
+   },
+   .off   = 0,
+   .reg   = MO_HTOTAL,
+   .mask  = 3 << 11,
+   .shift = 11,
+   }, {
/* --- audio --- */
.v = {
.id= V4L2_CID_AUDIO_MUTE,
@@ -320,6 +334,7 @@
V4L2_CID_SHARPNESS,
V4L2_CID_CHROMA_AGC,
V4L2_CID_COLOR_KILLER,
+   V4L2_CID_BAND_STOP_FILTER,
0
 };
 EXPORT_SYMBOL(cx88_user_ctrls);
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL for v3.0] media updates for v3.1

2011-07-30 Thread Istvan Varga

On 07/29/2011 07:31 PM, Mauro Carvalho Chehab wrote:


istva...@mailbox.hu (11):
   [media] xc4000: code cleanup
   [media] dvb-usb/Kconfig: auto-select XC4000 tuner for dib0700
   [media] xc4000: check firmware version
   [media] xc4000: removed card_type


I assume a firmware file for XC4000 is still needed ? I did create a
firmware package some time ago and sent it to Devin Heitmueller so that
he can check if it is OK for being submitted, and also asked if the
Xceive sources that the firmware building utility depends on can be
redistributed, but I did not get a reply yet.
In addition to the utility that creates the firmware from the official
Xceive sources, I have written one that can extract the firmware
(version 1.2 or 1.4) from Windows drivers; both utilities produce
identical output files.

Another XC4000 issue that may need to be resolved is I2C problems on
dib0700 based devices like the PCTV 340e. I cannot test these, since
I have only a cx88 based card with XC4000, and it does not have any
I2C reliability issues. If PCTV 340e users report I2C related problems,
perhaps some code may need to be added to retry failed operations before
reporting an error. I think there is also a hack still in the driver
that ignores I2C errors during various operations.


   [media] cx88: implemented luma notch filter control


In cx88-core.c, there is a change that may be unneeded:

@@ -636,6 +636,9 @@
cx_write(MO_PCI_INTSTAT,   0x); // Clear PCI int
cx_write(MO_INT1_STAT, 0x); // Clear RISC int

+   /* set default notch filter */
+   cx_andor(MO_HTOTAL, 0x1800, (HLNotchFilter4xFsc << 11));
+
/* Reset on-board parts */
cx_write(MO_SRST_IO, 0);
msleep(10);

In fact, I have re-submitted the patch with this change removed, but
it is the first version that was incorporated. Having some look at the
cx88 sources, it seems cx88_reset() is not supposed to set/initialize
controls, because it is done elsewhere ?
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL for v3.0] media updates for v3.1

2011-07-30 Thread Istvan Varga

On 07/30/2011 04:03 PM, Mauro Carvalho Chehab wrote:


Btw, It may actually make sense to not allow using the PAL filter with a
NTSC source and vice-versa, e. g. reducing the notch filter to only 3
possible values:

0 - 4xFSC   (00)
1 - square pixel(01)
2 - std-optimized filter(10 or 11)

Where 2 would man 10 for NTSC standard or 11 for PAL standard. I suspect,
however, that the std-optimized filter only works if the sampling frequency
is set to 27 MHz. However, at cx88 code, we set the sampling frequency to
be 8xFSC, instead of fixing it to 27MHz. Due to that, I doubt that the
PAL or NTSC optimized filters will give a good result. So, maybe we can change
it to just:

0 - 4xFSC
1 - square pixel

In other words, except if you found that the std-optimized filters are giving
better results, I would change the control to only select between 00 and 01,
and initialize it at device init, with 00.


OK, I have no problem with removing the standard optimized filters and
restricting the control to 2 settings; I only used the square pixel one
anyway, as I found it often looks better than the default filter.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] cx88: notch filter control fixes

2011-07-31 Thread Istvan Varga
This patch reduces the number of available choices for the notch filter type 
control
so that the standard-specific filter types cannot be selected. It is now 
limited to
being either 0 (4xFsc, the default) or 1 (square pixel optimized).
The patch also removes the initialization of this control from cx88_reset(), 
since
that is already done by init_controls(), which is called by cx8800_initdev().

Signed-off-by: Istvan Varga 

diff -uNr a/drivers/media/video/cx88/cx88-core.c 
b/drivers/media/video/cx88/cx88-core.c
--- a/drivers/media/video/cx88/cx88-core.c  2011-07-31 11:19:03.0 
+0200
+++ b/drivers/media/video/cx88/cx88-core.c  2011-07-31 11:43:14.0 
+0200
@@ -636,9 +636,6 @@
cx_write(MO_PCI_INTSTAT,   0x); // Clear PCI int
cx_write(MO_INT1_STAT, 0x); // Clear RISC int
 
-   /* set default notch filter */
-   cx_andor(MO_HTOTAL, 0x1800, (HLNotchFilter4xFsc << 11));
-
/* Reset on-board parts */
cx_write(MO_SRST_IO, 0);
msleep(10);
diff -uNr a/drivers/media/video/cx88/cx88-video.c 
b/drivers/media/video/cx88/cx88-video.c
--- a/drivers/media/video/cx88/cx88-video.c 2011-07-31 11:19:03.0 
+0200
+++ b/drivers/media/video/cx88/cx88-video.c 2011-07-31 11:43:40.0 
+0200
@@ -266,7 +266,7 @@
.id= V4L2_CID_BAND_STOP_FILTER,
.name  = "Notch filter",
.minimum   = 0,
-   .maximum   = 3,
+   .maximum   = 1,
.step  = 1,
.default_value = 0x0,
.type  = V4L2_CTRL_TYPE_INTEGER,
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL for v3.0] media updates for v3.1

2011-07-31 Thread Istvan Varga

On 07/31/2011 03:53 PM, Devin Heitmueller wrote:


Sorry about the top post.  Replying from phone since i'm on vacation.

Haven't tested the firmware, but as long as it's based on the Xceive
sources it's ok to redistribute in terms of licensing.  Just use the
same license I provided for the original firmware.


I have uploaded the firmware package to here:
  http://juropnet.hu/~istvan_v/xc4000_firmware.tar.gz
Simply running "make" should compile the utility and create the
firmware file (dvb-fe-xc4000-1.4.fw). The package includes some files
that are not actually needed, for building the version 1.4 firmware
from the official sources, it is enough to have build_fw.c and the
two header files it depends on. I did not change any license
information, although the source files did not include it originally,
so that may still need to be added from here:
  http://www.kernellabs.com/firmware/xc4000/README.xc4000

For completeness, here is the original version of build_fw.c for
comparison, and the original firmware SDK (I have modified one of
the header files to fix a compile error):
  http://juropnet.hu/~istvan_v/build_fw.c
  http://juropnet.hu/~istvan_v/Xc4000_c_code.zip
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Leadtek PxDVR3200H and mythbuntu 11.04/11.10

2011-11-20 Thread Istvan Varga

On 11/20/2011 02:30 AM, john wrote:


I have tried downloading clean v4l repositories and trying to patch for
xc4000 but I can't get it to compile.


XC4000 support is included in the V4L repositories starting from
staging/for_v3.1, if you have recent sources, then no patching is
needed.


As well, I'm in Australia so I need the 7MHz version particular to our
transmission type.


The driver does support 7 MHz bandwidth.

You need a firmware file for XC4000, I have attached it in case it is
not included yet with the V4L sources. Note that the firmware available
at kernellabs.com is not compatible with the driver in the V4L
repositories.



dvb-fe-xc4000-1.4.fw
Description: Binary data