[PATCH 9/15] - tm6000 analog digital switch

2010-02-03 Thread Stefan Ringel
signed-off-by: Stefan Ringel stefan.rin...@arcor.de

--- a/drivers/media/common/tuners/tuner-xc2028.c
+++ b/drivers/media/common/tuners/tuner-xc2028.c
@@ -15,6 +15,7 @@
 #include linux/delay.h
 #include media/tuner.h
 #include linux/mutex.h
+#include compat.h
 #include asm/unaligned.h
 #include tuner-i2c.h
 #include tuner-xc2028.h
@@ -994,6 +995,13 @@ static int generic_set_freq(struct dvb_frontend
*fe, u32 freq /* in HZ */,
buf[0], buf[1], buf[2], buf[3],
freq / 100, (freq % 100) / 1000);
 
+if (priv-ctrl.switch_mode) {
+if (new_mode == T_ANALOG_TV)
+do_tuner_callback(fe, SWITCH_TV_MODE, 0);
+if (new_mode == T_DIGITAL_TV)
+do_tuner_callback(fe, SWITCH_TV_MODE, 1);
+}
+   
 rc = 0;
 
 ret:
--- a/drivers/media/common/tuners/tuner-xc2028.h
+++ b/drivers/media/common/tuners/tuner-xc2028.h
@@ -42,6 +42,7 @@ struct xc2028_ctrl {
 unsigned intdisable_power_mgmt:1;
 unsigned intread_not_reliable:1;
 unsigned intdemod;
+unsigned intswitch_mode:1;
 enum firmware_typetype:2;
 };
 
@@ -54,6 +55,7 @@ struct xc2028_config {
 /* xc2028 commands for callback */
 #define XC2028_TUNER_RESET0
 #define XC2028_RESET_CLK1
+#define SWITCH_TV_MODE2
 
 #if defined(CONFIG_MEDIA_TUNER_XC2028) ||
(defined(CONFIG_MEDIA_TUNER_XC2028_MODULE)  defined(MODULE))
 extern struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe,
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -269,13 +291,33 @@ static int tm6000_tuner_callback(void *ptr, int
component, int command, int arg)
 TM6000_GPIO_CLK, 0);
 if (rc0)
 return rc;
-msleep(100);
+msleep(10);
 rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
 TM6000_GPIO_CLK, 1);
-msleep(100);
+msleep(10);
+break;
+}
+break;
+   
+case SWITCH_TV_MODE:
+/* switch between analog and  digital */
+switch (arg) {
+case 0:
+printk(KERN_INFO switch to analog);
+tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+TM6010_GPIO_5, 1);
+printk(KERN_INFO analog);
+break;
+case 1:
+printk(KERN_INFO switch to digital);
+tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+TM6010_GPIO_5, 0);
+printk(KERN_INFO digital);
 break;
 }
+break;
 }
+   
 return (rc);
 }
 
--- a/drivers/staging/tm6000/tm6000-dvb.c
+++ b/drivers/staging/tm6000/tm6000-dvb.c
@@ -235,7 +268,8 @@ int tm6000_dvb_register(struct tm6000_core *dev)
 .i2c_adap = dev-i2c_adap,
 .i2c_addr = dev-tuner_addr,
 };
-
+   
+dvb-frontend-callback = tm6000_tuner_callback;
 ret = dvb_register_frontend(dvb-adapter, dvb-frontend);
 if (ret  0) {
 printk(KERN_ERR
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -269,13 +291,33 @@ static int tm6000_tuner_callback(void *ptr, int
component, int command, int arg)
 TM6000_GPIO_CLK, 0);
 if (rc0)
 return rc;
-msleep(100);
+msleep(10);
 rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
 TM6000_GPIO_CLK, 1);
-msleep(100);
+msleep(10);
+break;
+}
+break;
+   
+case SWITCH_TV_MODE:
+/* switch between analog and  digital */
+switch (arg) {
+case 0:
+printk(KERN_INFO switch to analog);
+tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+TM6010_GPIO_5, 1);
+printk(KERN_INFO analog);
+break;
+case 1:
+printk(KERN_INFO switch to digital);
+tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN,
+TM6010_GPIO_5, 0);
+printk(KERN_INFO digital);
 break;
 }
+break;
 }
+   
 return (rc);
 }
 

-- 
Stefan Ringel stefan.rin...@arcor.de

--
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 9/15] - tm6000 analog digital switch

2010-02-03 Thread Mauro Carvalho Chehab
Stefan Ringel wrote:

 @@ -994,6 +995,13 @@ static int generic_set_freq(struct dvb_frontend
 *fe, u32 freq /* in HZ */,

Your emailer is damaging the patches. The above should be in the same line,
otherwise the patch won't apply.

It seems that you're using Thunderbird, right?

User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.5) Gecko/20091130 
SUSE/3.0.0-1.1.1 Thunderbird/3.0

You should really read the README.patches 
(http://linuxtv.org/hg/v4l-dvb/raw-file/tip/README.patches)
before submitting your work. In particular, at the end of Part II, there are 
the procedures for
submissions via email. It ends with:

 BE CAREFUL: several emailers including Thunderdird breaks long lines, causing
  patch corruption.
  In the specific case of Thunderbird, an extension is needed to send the
  patches, called Asalted Patches:
https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/;

So, please get the asalted-patches extension, apply it on your Thunderbird, 
review your patch
series based on the contents of README.patches and re-submit.

-- 

Cheers,
Mauro
--
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 9/15] - tm6000 analog digital switch

2010-02-03 Thread Stefan Ringel
Am 03.02.2010 21:40, schrieb Mauro Carvalho Chehab:
 Stefan Ringel wrote:

   
 @@ -994,6 +995,13 @@ static int generic_set_freq(struct dvb_frontend
 *fe, u32 freq /* in HZ */,
 
 Your emailer is damaging the patches. The above should be in the same line,
 otherwise the patch won't apply.

 It seems that you're using Thunderbird, right?

 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.1.5) Gecko/20091130 
 SUSE/3.0.0-1.1.1 Thunderbird/3.0

 You should really read the README.patches 
 (http://linuxtv.org/hg/v4l-dvb/raw-file/tip/README.patches)
 before submitting your work. In particular, at the end of Part II, there are 
 the procedures for
 submissions via email. It ends with:

  BE CAREFUL: several emailers including Thunderdird breaks long lines, 
 causing
   patch corruption.
   In the specific case of Thunderbird, an extension is needed to send the
   patches, called Asalted Patches:
   https://hg.mozilla.org/users/clarkbw_gnome.org/asalted-patches/;

 So, please get the asalted-patches extension, apply it on your Thunderbird, 
 review your patch
 series based on the contents of README.patches and re-submit.

   
I use thunderbird 3, but the patch is for 2. It that compatible ?

-- 
Stefan Ringel stefan.rin...@arcor.de

--
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 9/15] - tm6000 analog digital switch

2010-02-03 Thread Mauro Carvalho Chehab
Stefan Ringel wrote:
 Am 03.02.2010 21:40, schrieb Mauro Carvalho Chehab:

 So, please get the asalted-patches extension, apply it on your Thunderbird, 
 review your patch
 series based on the contents of README.patches and re-submit.

   
 I use thunderbird 3, but the patch is for 2. It that compatible ?

Yes. I have it applied to Fedora 12 thunderbird 3, and to RHEL5 thunderbird 2. 
It works
fine on both.

-- 

Cheers,
Mauro
--
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