public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch 1/3] Kworld 315U
@ 2010-01-18  7:03 Franklin Meng
  2010-01-18  7:07 ` [Patch 2/3] " Franklin Meng
  2010-01-25 13:59 ` [Patch 1/3] " Mauro Carvalho Chehab
  0 siblings, 2 replies; 4+ messages in thread
From: Franklin Meng @ 2010-01-18  7:03 UTC (permalink / raw)
  To: linux-media
  Cc:  Mauro Carvalho ChehabDevin Heitmueller <dheitmueller@kernellabs.com>,
	Douglas Schilling Landgraf

Patch to add the s_power function to the saa7115.c code.

Signed-off-by: Franklin Meng<fmeng2002@yahoo.com>


diff -r b6b82258cf5e linux/drivers/media/video/saa7115.c                              
--- a/linux/drivers/media/video/saa7115.c       Thu Dec 31 19:14:54 2009 -0200        
+++ b/linux/drivers/media/video/saa7115.c       Sun Jan 17 22:54:21 2010 -0800        
@@ -1338,6 +1338,59 @@                                                                
        return 0;                                                                     
 }                                                                                    
                                                                                      
+static int saa711x_s_power(struct v4l2_subdev *sd, int val)                          
+{                                                                                    
+       struct saa711x_state *state = to_state(sd);                                   
+                                                                                     
+       if(val > 1 || val < 0)                                                        
+               return -EINVAL;                                                       
+                                                                                     
+       /* There really isn't a way to put the chip into power saving                 
+               other than by pulling CE to ground so all we do is return             
+               out of this function                                                  
+       */                                                                            
+       if(val == 0)                                                                  
+               return 0;                                                             
+                                                                                     
+       /* When enabling the chip again we need to reinitialize the                   
+               all the values                                                        
+       */                                                                            
+       state->input = -1;                                                            
+       state->output = SAA7115_IPORT_ON;                                             
+       state->enable = 1;                                                            
+       state->radio = 0;                                                             
+       state->bright = 128;                                                          
+       state->contrast = 64;                                                         
+       state->hue = 0;                                                               
+       state->sat = 64;                                                              
+                                                                                     
+       state->audclk_freq = 48000;                                                   
+                                                                                     
+       v4l2_dbg(1, debug, sd, "writing init values s_power\n");                      
+                                                                                     
+       /* init to 60hz/48khz */                                                      
+       state->crystal_freq = SAA7115_FREQ_24_576_MHZ;                                
+       switch (state->ident) {                                                       
+       case V4L2_IDENT_SAA7111:                                                      
+               saa711x_writeregs(sd, saa7111_init);                                  
+               break;                                                                
+       case V4L2_IDENT_SAA7113:                                                      
+               saa711x_writeregs(sd, saa7113_init);
+               break;
+       default:
+               state->crystal_freq = SAA7115_FREQ_32_11_MHZ;
+               saa711x_writeregs(sd, saa7115_init_auto_input);
+       }
+       if (state->ident != V4L2_IDENT_SAA7111)
+               saa711x_writeregs(sd, saa7115_init_misc);
+       saa711x_set_v4lstd(sd, V4L2_STD_NTSC);
+
+       v4l2_dbg(1, debug, sd, "status: (1E) 0x%02x, (1F) 0x%02x\n",
+               saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC),
+               saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC));
+       return 0;
+}
+
 static int saa711x_reset(struct v4l2_subdev *sd, u32 val)
 {
        v4l2_dbg(1, debug, sd, "decoder RESET\n");
@@ -1513,6 +1566,7 @@
        .s_std = saa711x_s_std,
        .reset = saa711x_reset,
        .s_gpio = saa711x_s_gpio,
+       .s_power = saa711x_s_power,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
        .g_register = saa711x_g_register,
        .s_register = saa711x_s_register,








      

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Patch 2/3] Kworld 315U
  2010-01-18  7:03 [Patch 1/3] Kworld 315U Franklin Meng
@ 2010-01-18  7:07 ` Franklin Meng
  2010-01-25 14:15   ` Mauro Carvalho Chehab
  2010-01-25 13:59 ` [Patch 1/3] " Mauro Carvalho Chehab
  1 sibling, 1 reply; 4+ messages in thread
From: Franklin Meng @ 2010-01-18  7:07 UTC (permalink / raw)
  To: linux-media
  Cc: Mauro Carvalho Chehab, Douglas Schilling Landgraf,
	Devin Heitmueller

Patch with updated GPIOs and enable analog inputs for the Kworld 315U

Signed-off-by: Franklin Meng<fmeng2002@yahoo.com>

diff -r b6b82258cf5e linux/drivers/media/video/em28xx/em28xx-cards.c
--- a/linux/drivers/media/video/em28xx/em28xx-cards.c   Thu Dec 31 19:14:54 2009 -0200
+++ b/linux/drivers/media/video/em28xx/em28xx-cards.c   Sun Jan 17 22:54:21 2010 -0800
@@ -122,13 +122,31 @@                                                                 
 };                                                                                   
 #endif                                                                               
                                                                                      
+/* Kworld 315U                                                                       
+   GPIO0 - Enable digital power (lgdt3303) - low to enable                           
+   GPIO1 - Enable analog power (saa7113/emp202) - low to enable                      
+   GPIO7 - enables something ?                                                       
+   GOP2  - ?? some sort of reset ?                                                   
+   GOP3  - lgdt3303 reset                                                            
+ */                                                                                  
 /* Board - EM2882 Kworld 315U digital */                                             
 static struct em28xx_reg_seq em2882_kworld_315u_digital[] = {                        
-       {EM28XX_R08_GPIO,       0xff,   0xff,           10},                          
-       {EM28XX_R08_GPIO,       0xfe,   0xff,           10},                          
+       {EM28XX_R08_GPIO,       0x7e,   0xff,           10},                          
        {EM2880_R04_GPO,        0x04,   0xff,           10},                          
        {EM2880_R04_GPO,        0x0c,   0xff,           10},                          
-       {EM28XX_R08_GPIO,       0x7e,   0xff,           10},                          
+       {  -1,                  -1,     -1,             -1},                          
+};                                                                                   
+                                                                                     
+/* Board - EM2882 Kworld 315U analog1 analog tv */                                   
+static struct em28xx_reg_seq em2882_kworld_315u_analog1[] = {                        
+       {EM28XX_R08_GPIO,       0xfd,   0xff,           10},                          
+       {EM28XX_R08_GPIO,       0x7d,   0xff,           10},                          
+       {  -1,                  -1,     -1,             -1},                          
+};                                                                                   
+                                                                                     
+/* Board - EM2882 Kworld 315U analog2 component/svideo */                            
+static struct em28xx_reg_seq em2882_kworld_315u_analog2[] = {                        
+       {EM28XX_R08_GPIO,       0xfd,   0xff,           10},                          
        {  -1,                  -1,     -1,             -1},                          
 };                                                                                   
                                                                                      
@@ -140,6 +158,14 @@                                                                  
        {  -1,                  -1,     -1,             -1},                          
 };                                                                                   
                                                                                      
+/* Board - EM2882 Kworld 315U suspend */                                             
+static struct em28xx_reg_seq em2882_kworld_315u_suspend[] = {                        
+       {EM28XX_R08_GPIO,       0xff,   0xff,           10},                          
+       {EM2880_R04_GPO,        0x08,   0xff,           10},                          
+       {EM2880_R04_GPO,        0x0c,   0xff,           10},                          
+       {  -1,                  -1,     -1,             -1},                          
+};                                                                                   
+                                                                                     
 static struct em28xx_reg_seq kworld_330u_analog[] = {                                
        {EM28XX_R08_GPIO,       0x6d,   ~EM_GPIO_4,     10},                          
        {EM2880_R04_GPO,        0x00,   0xff,           10},                          
@@ -1314,28 +1340,28 @@                                                               
                .decoder        = EM28XX_SAA711X,                                     
                .has_dvb        = 1,                                                  
                .dvb_gpio       = em2882_kworld_315u_digital,                         
+               .suspend_gpio   = em2882_kworld_315u_suspend,                         
                .xclk           = EM28XX_XCLK_FREQUENCY_12MHZ,                        
                .i2c_speed      = EM28XX_I2C_CLK_WAIT_ENABLE,                         
-               /* Analog mode - still not ready */                                   
-               /*.input        = { {                                                 
+               .input        = { {                                                   
                        .type = EM28XX_VMUX_TELEVISION,                               
                        .vmux = SAA7115_COMPOSITE2,                                   
                        .amux = EM28XX_AMUX_VIDEO,                                    
-                       .gpio = em2882_kworld_315u_analog,                            
+                       .gpio = em2882_kworld_315u_analog1,                           
                        .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,          
                }, {                                                                  
                        .type = EM28XX_VMUX_COMPOSITE1,                               
                        .vmux = SAA7115_COMPOSITE0,                                   
                        .amux = EM28XX_AMUX_LINE_IN,                                  
-                       .gpio = em2882_kworld_315u_analog1,                           
+                       .gpio = em2882_kworld_315u_analog2,                           
                        .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,          
                }, {                                                                  
                        .type = EM28XX_VMUX_SVIDEO,                                   
                        .vmux = SAA7115_SVIDEO3,                                      
                        .amux = EM28XX_AMUX_LINE_IN,                                  
-                       .gpio = em2882_kworld_315u_analog1,                           
+                       .gpio = em2882_kworld_315u_analog2,                           
                        .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,          
-               } }, */                                                               
+               } },                                                                  
        },                                                                            
        [EM2880_BOARD_EMPIRE_DUAL_TV] = {                                             
                .name = "Empire dual TV",                                       


      

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch 1/3] Kworld 315U
  2010-01-18  7:03 [Patch 1/3] Kworld 315U Franklin Meng
  2010-01-18  7:07 ` [Patch 2/3] " Franklin Meng
@ 2010-01-25 13:59 ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2010-01-25 13:59 UTC (permalink / raw)
  To: Franklin Meng; +Cc: linux-media, Douglas Schilling Landgraf

Franklin Meng wrote:
> Patch to add the s_power function to the saa7115.c code.
> 
> Signed-off-by: Franklin Meng<fmeng2002@yahoo.com>

I got an error while applying:

No file to patch.  Skipping patch.
patch: **** malformed patch at line 22:         return 0;                                        Patch may be line wrapped

I suspect that your email is destroying your patch.


> 
> 
> diff -r b6b82258cf5e linux/drivers/media/video/saa7115.c                              
> --- a/linux/drivers/media/video/saa7115.c       Thu Dec 31 19:14:54 2009 -0200        
> +++ b/linux/drivers/media/video/saa7115.c       Sun Jan 17 22:54:21 2010 -0800        
> @@ -1338,6 +1338,59 @@                                                                
>         return 0;                                                                     
>  }                                                                                    
>                                                                                       
> +static int saa711x_s_power(struct v4l2_subdev *sd, int val)                          
> +{                                                                                    
> +       struct saa711x_state *state = to_state(sd);                                   
> +                                                                                     
> +       if(val > 1 || val < 0)                                                        
> +               return -EINVAL; 

Also, please validade your patch against coding style, with checkpatch.pl (you can use
make checkpatch, if you're using the -hg tree).

Basically, you need a space between if and ( at the above line.

                                                      
> +                                                                                     
> +       /* There really isn't a way to put the chip into power saving                 
> +               other than by pulling CE to ground so all we do is return             
> +               out of this function                                                  
> +       */                                                                            
> +       if(val == 0)                                                                  
> +               return 0;                                                             
> +                                                                                     
> +       /* When enabling the chip again we need to reinitialize the                   
> +               all the values                                                        
> +       */                                                                            
> +       state->input = -1;                                                            
> +       state->output = SAA7115_IPORT_ON;                                             
> +       state->enable = 1;                                                            
> +       state->radio = 0;                                                             
> +       state->bright = 128;                                                          
> +       state->contrast = 64;                                                         
> +       state->hue = 0;                                                               
> +       state->sat = 64;                                                              
> +                                                                                     
> +       state->audclk_freq = 48000;                                                   
> +                                                                                     
> +       v4l2_dbg(1, debug, sd, "writing init values s_power\n");                      
> +                                                                                     
> +       /* init to 60hz/48khz */                                                      
> +       state->crystal_freq = SAA7115_FREQ_24_576_MHZ;                                
> +       switch (state->ident) {                                                       
> +       case V4L2_IDENT_SAA7111:                                                      
> +               saa711x_writeregs(sd, saa7111_init);                                  
> +               break;                                                                
> +       case V4L2_IDENT_SAA7113:                                                      
> +               saa711x_writeregs(sd, saa7113_init);
> +               break;
> +       default:
> +               state->crystal_freq = SAA7115_FREQ_32_11_MHZ;
> +               saa711x_writeregs(sd, saa7115_init_auto_input);
> +       }
> +       if (state->ident != V4L2_IDENT_SAA7111)
> +               saa711x_writeregs(sd, saa7115_init_misc);
> +       saa711x_set_v4lstd(sd, V4L2_STD_NTSC);
> +
> +       v4l2_dbg(1, debug, sd, "status: (1E) 0x%02x, (1F) 0x%02x\n",
> +               saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC),
> +               saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC));
> +       return 0;
> +}
> +
>  static int saa711x_reset(struct v4l2_subdev *sd, u32 val)
>  {
>         v4l2_dbg(1, debug, sd, "decoder RESET\n");
> @@ -1513,6 +1566,7 @@
>         .s_std = saa711x_s_std,
>         .reset = saa711x_reset,
>         .s_gpio = saa711x_s_gpio,
> +       .s_power = saa711x_s_power,
>  #ifdef CONFIG_VIDEO_ADV_DEBUG
>         .g_register = saa711x_g_register,
>         .s_register = saa711x_s_register,
> 
> 
> 
> 
> 
> 
> 
> 
>       
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch 2/3] Kworld 315U
  2010-01-18  7:07 ` [Patch 2/3] " Franklin Meng
@ 2010-01-25 14:15   ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 4+ messages in thread
From: Mauro Carvalho Chehab @ 2010-01-25 14:15 UTC (permalink / raw)
  To: Franklin Meng; +Cc: linux-media, Douglas Schilling Landgraf, Devin Heitmueller

Franklin Meng wrote:
> Patch with updated GPIOs and enable analog inputs for the Kworld 315U
> 
> Signed-off-by: Franklin Meng<fmeng2002@yahoo.com>

Also, didn't apply.

Cheers,
Mauro.

> 
> diff -r b6b82258cf5e linux/drivers/media/video/em28xx/em28xx-cards.c
> --- a/linux/drivers/media/video/em28xx/em28xx-cards.c   Thu Dec 31 19:14:54 2009 -0200
> +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c   Sun Jan 17 22:54:21 2010 -0800
> @@ -122,13 +122,31 @@                                                                 
>  };                                                                                   
>  #endif                                                                               
>                                                                                       
> +/* Kworld 315U                                                                       
> +   GPIO0 - Enable digital power (lgdt3303) - low to enable                           
> +   GPIO1 - Enable analog power (saa7113/emp202) - low to enable                      
> +   GPIO7 - enables something ?                                                       
> +   GOP2  - ?? some sort of reset ?                                                   
> +   GOP3  - lgdt3303 reset                                                            
> + */                                                                                  
>  /* Board - EM2882 Kworld 315U digital */                                             
>  static struct em28xx_reg_seq em2882_kworld_315u_digital[] = {                        
> -       {EM28XX_R08_GPIO,       0xff,   0xff,           10},                          
> -       {EM28XX_R08_GPIO,       0xfe,   0xff,           10},                          
> +       {EM28XX_R08_GPIO,       0x7e,   0xff,           10},                          
>         {EM2880_R04_GPO,        0x04,   0xff,           10},                          
>         {EM2880_R04_GPO,        0x0c,   0xff,           10},                          
> -       {EM28XX_R08_GPIO,       0x7e,   0xff,           10},                          
> +       {  -1,                  -1,     -1,             -1},                          
> +};                                                                                   
> +                                                                                     
> +/* Board - EM2882 Kworld 315U analog1 analog tv */                                   
> +static struct em28xx_reg_seq em2882_kworld_315u_analog1[] = {                        
> +       {EM28XX_R08_GPIO,       0xfd,   0xff,           10},                          
> +       {EM28XX_R08_GPIO,       0x7d,   0xff,           10},                          
> +       {  -1,                  -1,     -1,             -1},                          
> +};                                                                                   
> +                                                                                     
> +/* Board - EM2882 Kworld 315U analog2 component/svideo */                            
> +static struct em28xx_reg_seq em2882_kworld_315u_analog2[] = {                        
> +       {EM28XX_R08_GPIO,       0xfd,   0xff,           10},                          
>         {  -1,                  -1,     -1,             -1},                          
>  };                                                                                   
>                                                                                       
> @@ -140,6 +158,14 @@                                                                  
>         {  -1,                  -1,     -1,             -1},                          
>  };                                                                                   
>                                                                                       
> +/* Board - EM2882 Kworld 315U suspend */                                             
> +static struct em28xx_reg_seq em2882_kworld_315u_suspend[] = {                        
> +       {EM28XX_R08_GPIO,       0xff,   0xff,           10},                          
> +       {EM2880_R04_GPO,        0x08,   0xff,           10},                          
> +       {EM2880_R04_GPO,        0x0c,   0xff,           10},                          
> +       {  -1,                  -1,     -1,             -1},                          
> +};                                                                                   
> +                                                                                     
>  static struct em28xx_reg_seq kworld_330u_analog[] = {                                
>         {EM28XX_R08_GPIO,       0x6d,   ~EM_GPIO_4,     10},                          
>         {EM2880_R04_GPO,        0x00,   0xff,           10},                          
> @@ -1314,28 +1340,28 @@                                                               
>                 .decoder        = EM28XX_SAA711X,                                     
>                 .has_dvb        = 1,                                                  
>                 .dvb_gpio       = em2882_kworld_315u_digital,                         
> +               .suspend_gpio   = em2882_kworld_315u_suspend,                         
>                 .xclk           = EM28XX_XCLK_FREQUENCY_12MHZ,                        
>                 .i2c_speed      = EM28XX_I2C_CLK_WAIT_ENABLE,                         
> -               /* Analog mode - still not ready */                                   
> -               /*.input        = { {                                                 
> +               .input        = { {                                                   
>                         .type = EM28XX_VMUX_TELEVISION,                               
>                         .vmux = SAA7115_COMPOSITE2,                                   
>                         .amux = EM28XX_AMUX_VIDEO,                                    
> -                       .gpio = em2882_kworld_315u_analog,                            
> +                       .gpio = em2882_kworld_315u_analog1,                           
>                         .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,          
>                 }, {                                                                  
>                         .type = EM28XX_VMUX_COMPOSITE1,                               
>                         .vmux = SAA7115_COMPOSITE0,                                   
>                         .amux = EM28XX_AMUX_LINE_IN,                                  
> -                       .gpio = em2882_kworld_315u_analog1,                           
> +                       .gpio = em2882_kworld_315u_analog2,                           
>                         .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,          
>                 }, {                                                                  
>                         .type = EM28XX_VMUX_SVIDEO,                                   
>                         .vmux = SAA7115_SVIDEO3,                                      
>                         .amux = EM28XX_AMUX_LINE_IN,                                  
> -                       .gpio = em2882_kworld_315u_analog1,                           
> +                       .gpio = em2882_kworld_315u_analog2,                           
>                         .aout = EM28XX_AOUT_PCM_IN | EM28XX_AOUT_PCM_STEREO,          
> -               } }, */                                                               
> +               } },                                                                  
>         },                                                                            
>         [EM2880_BOARD_EMPIRE_DUAL_TV] = {                                             
>                 .name = "Empire dual TV",                                       
> 
> 
>       
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-01-25 14:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18  7:03 [Patch 1/3] Kworld 315U Franklin Meng
2010-01-18  7:07 ` [Patch 2/3] " Franklin Meng
2010-01-25 14:15   ` Mauro Carvalho Chehab
2010-01-25 13:59 ` [Patch 1/3] " Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox