Re: [PATCH] DVB-S2 multistream support

2012-08-10 Thread CrazyCat
Stream can be anything :) But for DVB standards this anyway DVBS transport 
stream 188 byte. Most media-bridges can handle only this stream. Specific 
generic-continous DVB-S2/T2/C2 streams require extended bus for passing 
frame-based stream, so this out of V4L DVB.

Now MIS used often for distribution multiple digital terrestial muxes over one 
satellite carrier (implemented in my patch, now i make patches for VDR and 
TVHeadend for MIS). DVB-T2 PLP is same, but i not see any real-life 
implementation (have some tda18712/cxd2820r-based hardware and 
T2/256QAM-in-air, but only one PLP). Don't know anything about ISDB :)

11.08.2012, 04:07, "Antti Palosaari" :
> #define DTV_ISDBS_TS_ID   42
> #define DTV_DVBT2_PLP_ID  43
>  +#define DTV_DVBS2_MIS_ID   43
  It would be better to define it as:

  #define DTV_DVBS2_MIS_ID    DTV_DVBT2_PLP_ID

  Even better, we should instead find a better name that would cover both
  DVB-T2 and DVB-S2 program ID fields, like:
--
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] DVB-S2 multistream support

2012-08-10 Thread Manu Abraham
On Sat, Aug 11, 2012 at 6:37 AM, Antti Palosaari  wrote:
> On 08/11/2012 03:31 AM, Manu Abraham wrote:
>>
>> On Sat, Aug 11, 2012 at 5:44 AM, Antti Palosaari  wrote:
>>>
>>> On 08/11/2012 01:12 AM, Mauro Carvalho Chehab wrote:


 Em 13-07-2012 20:15, CrazyCat escreveu:
>>>
>>>
>>>
>#define DTV_ISDBS_TS_ID   42
>
>#define DTV_DVBT2_PLP_ID  43
> +#define DTV_DVBS2_MIS_ID   43



 It would be better to define it as:

 #define DTV_DVBS2_MIS_IDDTV_DVBT2_PLP_ID

 Even better, we should instead find a better name that would cover both
 DVB-T2 and DVB-S2 program ID fields, like:

 #define DTV_DVB_MULT43
 #define DTV_DVBT2_PLP_IDDTV_DVB_MULT

 And use the new symbol for both DVB-S2 and DVB-T2, deprecating the
 legacy symbol.
>>>
>>>
>>>
>>> Also DTV_ISDBS_TS_ID means same. All these three DTV_ISDBS_TS_ID,
>>> DTV_DVBT2_PLP_ID and DTV_DVBS2_MIS_ID are same thing - just named
>>> differently between standards. I vote for common name TS ID (I have said
>>> that already enough many times...).
>>
>>
>> I agree, but a still more generic term like STREAM_ID would be more
>> appropriate,
>
>
> Ack. Since this stream could be something else than MPEG2-TS better to give
> more generic name.
>
>
>> as it happens at different layers for different delivery
>> systems.DVB-S2 additionally
>> provides BBHEADER at Physical Layer. In any case setting PLP_ID for DVB-S2
>> is completely confusing.
>>
>> Anyway, the demuxer part is also missing ..
>
>
> Demuxer for MIS? I am not any familiar with MIS but I know there is "raw"
> demux payload used already for ATSC-M/H. It just passes all the data coming
> from demod "TS".

Just grabbing and sending the DMA'd data to userspace is not nice.

With ATSC-M/H you don't simply have a TS. With an ATSC-M/H capable
demod, which supports ATSC (standard) outputs a TS. the M/H part is not
a TS at all.

Even with ATSC-M/H passing raw data causes all the IP (network) packets to
be parsed in userspace, which should have been properly done in kernel
space as a filter. If we were to do everything similarly, then we don't need
any API at all, just a simple read and let each application do whatever it
wants.

Regards,
Manu
--
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] DVB-S2 multistream support

2012-08-10 Thread Antti Palosaari

On 08/11/2012 03:31 AM, Manu Abraham wrote:

On Sat, Aug 11, 2012 at 5:44 AM, Antti Palosaari  wrote:

On 08/11/2012 01:12 AM, Mauro Carvalho Chehab wrote:


Em 13-07-2012 20:15, CrazyCat escreveu:




   #define DTV_ISDBS_TS_ID   42

   #define DTV_DVBT2_PLP_ID  43
+#define DTV_DVBS2_MIS_ID   43



It would be better to define it as:

#define DTV_DVBS2_MIS_IDDTV_DVBT2_PLP_ID

Even better, we should instead find a better name that would cover both
DVB-T2 and DVB-S2 program ID fields, like:

#define DTV_DVB_MULT43
#define DTV_DVBT2_PLP_IDDTV_DVB_MULT

And use the new symbol for both DVB-S2 and DVB-T2, deprecating the
legacy symbol.



Also DTV_ISDBS_TS_ID means same. All these three DTV_ISDBS_TS_ID,
DTV_DVBT2_PLP_ID and DTV_DVBS2_MIS_ID are same thing - just named
differently between standards. I vote for common name TS ID (I have said
that already enough many times...).


I agree, but a still more generic term like STREAM_ID would be more
appropriate,


Ack. Since this stream could be something else than MPEG2-TS better to 
give more generic name.



as it happens at different layers for different delivery
systems.DVB-S2 additionally
provides BBHEADER at Physical Layer. In any case setting PLP_ID for DVB-S2
is completely confusing.

Anyway, the demuxer part is also missing ..


Demuxer for MIS? I am not any familiar with MIS but I know there is 
"raw" demux payload used already for ATSC-M/H. It just passes all the 
data coming from demod "TS".



If you look a bit more deeper, you will see that the framing structure
with ISDB-T
is exactly the same as with ISDB-S, which makes ISDB-T also no different, just
that the frontend userspace header is just fucked up with junk.

The major chunk for the ISDB-T stuff in the frontend header is
completely redundant.

Regards,
Manu



regards
Antti

--
http://palosaari.fi/
--
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] DVB-S2 multistream support

2012-08-10 Thread Manu Abraham
On Sat, Aug 11, 2012 at 5:44 AM, Antti Palosaari  wrote:
> On 08/11/2012 01:12 AM, Mauro Carvalho Chehab wrote:
>>
>> Em 13-07-2012 20:15, CrazyCat escreveu:
>
>
>>>   #define DTV_ISDBS_TS_ID   42
>>>
>>>   #define DTV_DVBT2_PLP_ID  43
>>> +#define DTV_DVBS2_MIS_ID   43
>>
>>
>> It would be better to define it as:
>>
>> #define DTV_DVBS2_MIS_IDDTV_DVBT2_PLP_ID
>>
>> Even better, we should instead find a better name that would cover both
>> DVB-T2 and DVB-S2 program ID fields, like:
>>
>> #define DTV_DVB_MULT43
>> #define DTV_DVBT2_PLP_IDDTV_DVB_MULT
>>
>> And use the new symbol for both DVB-S2 and DVB-T2, deprecating the
>> legacy symbol.
>
>
> Also DTV_ISDBS_TS_ID means same. All these three DTV_ISDBS_TS_ID,
> DTV_DVBT2_PLP_ID and DTV_DVBS2_MIS_ID are same thing - just named
> differently between standards. I vote for common name TS ID (I have said
> that already enough many times...).

I agree, but a still more generic term like STREAM_ID would be more
appropriate,
as it happens at different layers for different delivery
systems.DVB-S2 additionally
provides BBHEADER at Physical Layer. In any case setting PLP_ID for DVB-S2
is completely confusing.

Anyway, the demuxer part is also missing ..

If you look a bit more deeper, you will see that the framing structure
with ISDB-T
is exactly the same as with ISDB-S, which makes ISDB-T also no different, just
that the frontend userspace header is just fucked up with junk.

The major chunk for the ISDB-T stuff in the frontend header is
completely redundant.

Regards,
Manu
--
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] DVB-S2 multistream support

2012-08-10 Thread Antti Palosaari

On 08/11/2012 01:12 AM, Mauro Carvalho Chehab wrote:

Em 13-07-2012 20:15, CrazyCat escreveu:



  #define DTV_ISDBS_TS_ID   42

  #define DTV_DVBT2_PLP_ID  43
+#define DTV_DVBS2_MIS_ID   43


It would be better to define it as:

#define DTV_DVBS2_MIS_IDDTV_DVBT2_PLP_ID

Even better, we should instead find a better name that would cover both
DVB-T2 and DVB-S2 program ID fields, like:

#define DTV_DVB_MULT43
#define DTV_DVBT2_PLP_IDDTV_DVB_MULT

And use the new symbol for both DVB-S2 and DVB-T2, deprecating the
legacy symbol.


Also DTV_ISDBS_TS_ID means same. All these three DTV_ISDBS_TS_ID, 
DTV_DVBT2_PLP_ID and DTV_DVBS2_MIS_ID are same thing - just named 
differently between standards. I vote for common name TS ID (I have said 
that already enough many times...).


Research paper [1] ISDB-S says:
"
New technologies like the trellis-coded 8PSK (TC8PSK) modulation scheme 
were adopted for this section to improve transmission capacity as much 
as possible and to enable multiple transport streams (TSs) to be handled 
by one carrier. This channel coding system has consequently become a 
system standard known for its flexibility and extendibility.

"
"
It enables multiple MPEG-TSs to be transmitted with one transponder, and 
because transmission systems can be switched for each TS signal, it 
enables TS signals produced by each broadcaster to be transmitted 
independently.

"

[1] http://www.tijbc.com/pruebas-7419/I0782925.pdf

regards
Antti

--
http://palosaari.fi/
--
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] DVB-S2 multistream support

2012-08-10 Thread Manu Abraham
On Sat, Aug 11, 2012 at 3:42 AM, Mauro Carvalho Chehab
 wrote:
> Em 13-07-2012 20:15, CrazyCat escreveu:
>> Now present DTV_DVBT2_PLP_ID property for DVB-T2, so i add alias 
>> DTV_DVBS2_MIS_ID (same feature for advanced DVB-S2). Now DVB-S2 multistream 
>> filtration supported for current STV090x demod cut 3.0, so i implement 
>> support for stv090x demod driver. Additional fe-caps FE_CAN_MULTISTREAM also 
>> added.
>>
>>
>> frontend-mis.patch
>
> Please provide your Signed-off-by: (with your real name).
>
>>
>>
>> diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
>> index f50d405..f625f8d 100644
>> --- a/include/linux/dvb/frontend.h
>> +++ b/include/linux/dvb/frontend.h
>> @@ -62,6 +62,7 @@ typedef enum fe_caps {
>>   FE_CAN_8VSB = 0x20,
>>   FE_CAN_16VSB= 0x40,
>>   FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
>> for newer APIs, indicate this. */
>> + FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
>> DVB-S2 multistream filtering */
>
> Not sure if this is really needed. Are there any DVB-S2 frontends that
> don't support MIS, or they don't implement it just because this weren't
> defined yet? In the latter case, it would be better to not adding an
> special flag for it.

There are some demods that do not support Advanced Modes ..

>
>>   FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
>> "turbo fec modulation" */
>>   FE_CAN_2G_MODULATION= 0x1000, /* frontend supports 
>> "2nd generation modulation" (DVB-S2) */
>>   FE_NEEDS_BENDING= 0x2000, /* not supported 
>> anymore, don't use (frontend requires frequency bending) */
>> @@ -317,6 +318,7 @@ struct dvb_frontend_event {
>>  #define DTV_ISDBS_TS_ID  42
>>
>>  #define DTV_DVBT2_PLP_ID 43
>> +#define DTV_DVBS2_MIS_ID 43
>
> It would be better to define it as:
>
> #define DTV_DVBS2_MIS_IDDTV_DVBT2_PLP_ID
>
> Even better, we should instead find a better name that would cover both
> DVB-T2 and DVB-S2 program ID fields, like:
>
> #define DTV_DVB_MULT43
> #define DTV_DVBT2_PLP_IDDTV_DVB_MULT


In fact that is also incorrect.

DVB-S2 uses TS ID at Link Layer
at Physical layer there is BBHEADER.

DVB-T2 uses PLP ID at Physical Layer

ISDB-S uses Stream ID

ISDB-T uses Layer A, LayerB, Layer C


>
> And use the new symbol for both DVB-S2 and DVB-T2, deprecating the
> legacy symbol.
>
> Also, DocBook needs to be changed to reflect this change.
>
>>
>>  #define DTV_ENUM_DELSYS  44
>>
>> diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
>> b/drivers/media/dvb/dvb-core/dvb_frontend.c
>> index aebcdf2..83e51f9 100644
>> --- a/drivers/media/dvb/dvb-core/dvb_frontend.c
>> +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
>> @@ -947,7 +947,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend 
>> *fe)
>>   }
>>
>>   c->isdbs_ts_id = 0;
>> - c->dvbt2_plp_id = 0;
>> + c->dvbt2_plp_id = -1;
>>
>>   switch (c->delivery_system) {
>>   case SYS_DVBS:
>> diff --git a/drivers/media/dvb/frontends/stv090x.c 
>> b/drivers/media/dvb/frontends/stv090x.c
>> index ea86a56..eb6f1cf 100644
>> --- a/drivers/media/dvb/frontends/stv090x.c
>> +++ b/drivers/media/dvb/frontends/stv090x.c
>> @@ -3425,6 +3425,33 @@ err:
>>   return -1;
>>  }
>>
>> +static int stv090x_set_mis(struct stv090x_state *state, int mis)
>> +{
>> + u32 reg;
>> +
>> + if (mis<0 || mis>255) {
>
> You should be checking your patch using scripts/checkpatch.pl.
> Due to Documentation/CodingStyle, the above should be written, instead, as:
> if (mis < 0 || mis > 255) {
>
>
>> + dprintk(FE_DEBUG, 1, "Disable MIS filtering");
>> + reg = STV090x_READ_DEMOD(state, PDELCTRL1);
>> + STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
>> + if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg) < 0)
>> + goto err;
>> + } else {
>> + dprintk(FE_DEBUG, 1, "Enable MIS filtering - %d", mis);
>> + reg = STV090x_READ_DEMOD(state, PDELCTRL1);
>> + STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
>> + if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg) < 0)
>> + goto err;
>> + if (STV090x_WRITE_DEMOD(state, ISIENTRY, mis) < 0)
>> + goto err;
>> + if (STV090x_WRITE_DEMOD(state, ISIBITENA, 0xff) < 0)
>> + goto err;
>> + }
>> + return 0;
>> +err:
>> + dprintk(FE_ERROR, 1, "I/O error");
>> + return -1;
>> +}
>> +
>>  static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
>>  {
>>   struct stv090x_state *state = fe->demodulator_priv;
>> @@ -3433,6 +3460,8 @@ static enum dvbfe_search stv090x_search(struct 
>> dvb_frontend *fe)
>>   if (props->frequency == 0)
>>   return DVBFE_ALGO_SEARCH_INVALID;
>>
>> + 

Re: [git:v4l-dvb/for_v3.7] [media] mantis: Terratec Cinergy C PCI HD (CI)

2012-08-10 Thread Manu Abraham
Mauro,

Please revert this patch. Patch is incorrect. There is the VP-20300,
VP-20330, VP-2040, with differences in tuner types TDA10021, TDA10023,
MK-I, MK-II and MK-III. I have detailed this issue in an earlier mail.
Terratec Cinregy C is VP-2033 and not VP-2040.

Thanks!


On Sat, Aug 11, 2012 at 1:34 AM, Mauro Carvalho Chehab
 wrote:
> This is an automatic generated email to let you know that the following patch 
> were queued at the
> http://git.linuxtv.org/media_tree.git tree:
>
> Subject: [media] mantis: Terratec Cinergy C PCI HD (CI)
> Author:  Igor M. Liplianin 
> Date:Wed May 9 07:23:14 2012 -0300
>
> This patch seems for rectifying a typo. But actually the difference between
> mantis_vp2040.c and mantis_vp2033.c code is a card name only.
>
> Signed-off-by: Igor M. Liplianin 
> Signed-off-by: Mauro Carvalho Chehab 
>
>  drivers/media/dvb/mantis/mantis_cards.c |2 +-
>  drivers/media/dvb/mantis/mantis_core.c  |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> ---
>
> http://git.linuxtv.org/media_tree.git?a=commitdiff;h=9fa4d6a102ebb06663a03554b57fb93ad618b72e
>
> diff --git a/drivers/media/dvb/mantis/mantis_cards.c 
> b/drivers/media/dvb/mantis/mantis_cards.c
> index 095cf3a..0207d1f 100644
> --- a/drivers/media/dvb/mantis/mantis_cards.c
> +++ b/drivers/media/dvb/mantis/mantis_cards.c
> @@ -275,7 +275,7 @@ static struct pci_device_id mantis_pci_table[] = {
> MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2033_DVB_C, 
> &vp2033_config),
> MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_2040_DVB_C, 
> &vp2040_config),
> MAKE_ENTRY(TECHNISAT, CABLESTAR_HD2, &vp2040_config),
> -   MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2033_config),
> +   MAKE_ENTRY(TERRATEC, CINERGY_C, &vp2040_config),
> MAKE_ENTRY(TWINHAN_TECHNOLOGIES, MANTIS_VP_3030_DVB_T, 
> &vp3030_config),
> { }
>  };
> diff --git a/drivers/media/dvb/mantis/mantis_core.c 
> b/drivers/media/dvb/mantis/mantis_core.c
> index 22524a8..684d906 100644
> --- a/drivers/media/dvb/mantis/mantis_core.c
> +++ b/drivers/media/dvb/mantis/mantis_core.c
> @@ -121,7 +121,7 @@ static void mantis_load_config(struct mantis_pci *mantis)
> mantis->hwconfig = &vp2033_mantis_config;
> break;
> case MANTIS_VP_2040_DVB_C:  /* VP-2040 */
> -   case TERRATEC_CINERGY_C_PCI:/* VP-2040 clone */
> +   case CINERGY_C: /* VP-2040 clone */
> case TECHNISAT_CABLESTAR_HD2:
> mantis->hwconfig = &vp2040_mantis_config;
> break;
>
> ___
> linuxtv-commits mailing list
> linuxtv-comm...@linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
--
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]Omicom S2 PCI support

2012-08-10 Thread Mauro Carvalho Chehab
Em 14-07-2012 18:40, CrazyCat escreveu:
> Support for yet another SAA7146-based budget card (very similar to TT 
> S2-1600, but use LNBH23 instead ISL6423).
> diff --git a/drivers/media/dvb/ttpci/budget.c 
> b/drivers/media/dvb/ttpci/budget.c

...
WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
#86: FILE: drivers/media/dvb/ttpci/budget.c:735:
+   printk(KERN_ERR "%s: No STV6110(A) 
Silicon Tuner found!\n", __func__);

ERROR: Missing Signed-off-by: line(s)

total: 2 errors, 21 warnings, 85 lines checked

Again, missing to check it against checkpatch and to add your SOB.

Regards,
Mauro

> index b21bcce..1774c53 100644
> --- a/drivers/media/dvb/ttpci/budget.c
> +++ b/drivers/media/dvb/ttpci/budget.c
> @@ -50,6 +50,8 @@
>  #include "stv6110x.h"
>  #include "stv090x.h"
>  #include "isl6423.h"
> +#include "lnbh24.h"
> +
>  
>  static int diseqc_method;
>  module_param(diseqc_method, int, 0444);
> @@ -679,6 +681,63 @@ static void frontend_init(struct budget *budget)
>   }
>   }
>   break;
> +
> + case 0x1020: { /* Omicom S2 */
> + struct stv6110x_devctl *ctl;
> + saa7146_setgpio(budget->dev, 2, SAA7146_GPIO_OUTLO);
> + msleep(50);
> + saa7146_setgpio(budget->dev, 2, SAA7146_GPIO_OUTHI);
> + msleep(250);
> +
> + budget->dvb_frontend = dvb_attach(stv090x_attach,
> +   
> &tt1600_stv090x_config,
> +   &budget->i2c_adap,
> +   
> STV090x_DEMODULATOR_0);
> +
> + if (budget->dvb_frontend) {
> + printk(KERN_INFO "budget: Omicom S2 
> detected\n");
> +
> + ctl = dvb_attach(stv6110x_attach,
> +  budget->dvb_frontend,
> +  &tt1600_stv6110x_config,
> +  &budget->i2c_adap);
> +
> + if (ctl) {
> + tt1600_stv090x_config.tuner_init
>   = ctl->tuner_init;
> + tt1600_stv090x_config.tuner_sleep   
>   = ctl->tuner_sleep;
> + tt1600_stv090x_config.tuner_set_mode
>   = ctl->tuner_set_mode;
> + 
> tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency;
> + 
> tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency;
> + 
> tt1600_stv090x_config.tuner_set_bandwidth = ctl->tuner_set_bandwidth;
> + 
> tt1600_stv090x_config.tuner_get_bandwidth = ctl->tuner_get_bandwidth;
> + tt1600_stv090x_config.tuner_set_bbgain  
>   = ctl->tuner_set_bbgain;
> + tt1600_stv090x_config.tuner_get_bbgain  
>   = ctl->tuner_get_bbgain;
> + tt1600_stv090x_config.tuner_set_refclk  
>   = ctl->tuner_set_refclk;
> + tt1600_stv090x_config.tuner_get_status  
>   = ctl->tuner_get_status;
> +
> + /* call the init function once to 
> initialize
> +tuner's clock output divider and 
> demod's
> +master clock */
> + if (budget->dvb_frontend->ops.init)
> + 
> budget->dvb_frontend->ops.init(budget->dvb_frontend);
> +
> + if (dvb_attach(lnbh24_attach,
> + budget->dvb_frontend,
> + &budget->i2c_adap,
> + LNBH24_PCL | LNBH24_TTX,
> + LNBH24_TEN, 0x14>>1) == 
> NULL)
> + {
> + printk(KERN_ERR
> + "No LNBH24 found!\n");
> + goto error_out;
> + }
> + } else {
> + printk(KERN_ERR "%s: No STV6110(A) 
> Silicon Tuner found!\n", __func__);
> + goto error_out;
> + }
> + }
> + }
> + break;
>   }
>  
>   if (budget->dvb_frontend == NULL) {
> @@ -759,6 +818,7 @@ MAKE_BUDGET_INFO(fsacs0, "Fujitsu Siemens Activy Budget-S 
> PCI (rev GR/grundig fr
>  MAKE_BUDGET

Re: [PATCH] DVB-S2 multistream support

2012-08-10 Thread Mauro Carvalho Chehab
Em 13-07-2012 20:15, CrazyCat escreveu:
> Now present DTV_DVBT2_PLP_ID property for DVB-T2, so i add alias 
> DTV_DVBS2_MIS_ID (same feature for advanced DVB-S2). Now DVB-S2 multistream 
> filtration supported for current STV090x demod cut 3.0, so i implement 
> support for stv090x demod driver. Additional fe-caps FE_CAN_MULTISTREAM also 
> added.
> 
> 
> frontend-mis.patch

Please provide your Signed-off-by: (with your real name).

> 
> 
> diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h
> index f50d405..f625f8d 100644
> --- a/include/linux/dvb/frontend.h
> +++ b/include/linux/dvb/frontend.h
> @@ -62,6 +62,7 @@ typedef enum fe_caps {
>   FE_CAN_8VSB = 0x20,
>   FE_CAN_16VSB= 0x40,
>   FE_HAS_EXTENDED_CAPS= 0x80,   /* We need more bitspace 
> for newer APIs, indicate this. */
> + FE_CAN_MULTISTREAM  = 0x400,  /* frontend supports 
> DVB-S2 multistream filtering */

Not sure if this is really needed. Are there any DVB-S2 frontends that
don't support MIS, or they don't implement it just because this weren't
defined yet? In the latter case, it would be better to not adding an
special flag for it.

>   FE_CAN_TURBO_FEC= 0x800,  /* frontend supports 
> "turbo fec modulation" */
>   FE_CAN_2G_MODULATION= 0x1000, /* frontend supports "2nd 
> generation modulation" (DVB-S2) */
>   FE_NEEDS_BENDING= 0x2000, /* not supported anymore, 
> don't use (frontend requires frequency bending) */
> @@ -317,6 +318,7 @@ struct dvb_frontend_event {
>  #define DTV_ISDBS_TS_ID  42
>  
>  #define DTV_DVBT2_PLP_ID 43
> +#define DTV_DVBS2_MIS_ID 43

It would be better to define it as:

#define DTV_DVBS2_MIS_IDDTV_DVBT2_PLP_ID

Even better, we should instead find a better name that would cover both
DVB-T2 and DVB-S2 program ID fields, like:

#define DTV_DVB_MULT43
#define DTV_DVBT2_PLP_IDDTV_DVB_MULT

And use the new symbol for both DVB-S2 and DVB-T2, deprecating the
legacy symbol.

Also, DocBook needs to be changed to reflect this change.

>  
>  #define DTV_ENUM_DELSYS  44
>  
> diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c 
> b/drivers/media/dvb/dvb-core/dvb_frontend.c
> index aebcdf2..83e51f9 100644
> --- a/drivers/media/dvb/dvb-core/dvb_frontend.c
> +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
> @@ -947,7 +947,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend 
> *fe)
>   }
>  
>   c->isdbs_ts_id = 0;
> - c->dvbt2_plp_id = 0;
> + c->dvbt2_plp_id = -1;
>  
>   switch (c->delivery_system) {
>   case SYS_DVBS:
> diff --git a/drivers/media/dvb/frontends/stv090x.c 
> b/drivers/media/dvb/frontends/stv090x.c
> index ea86a56..eb6f1cf 100644
> --- a/drivers/media/dvb/frontends/stv090x.c
> +++ b/drivers/media/dvb/frontends/stv090x.c
> @@ -3425,6 +3425,33 @@ err:
>   return -1;
>  }
>  
> +static int stv090x_set_mis(struct stv090x_state *state, int mis)
> +{
> + u32 reg;
> +
> + if (mis<0 || mis>255) {

You should be checking your patch using scripts/checkpatch.pl.
Due to Documentation/CodingStyle, the above should be written, instead, as:
if (mis < 0 || mis > 255) {


> + dprintk(FE_DEBUG, 1, "Disable MIS filtering");
> + reg = STV090x_READ_DEMOD(state, PDELCTRL1);
> + STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x00);
> + if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg) < 0)
> + goto err;
> + } else {
> + dprintk(FE_DEBUG, 1, "Enable MIS filtering - %d", mis);
> + reg = STV090x_READ_DEMOD(state, PDELCTRL1);
> + STV090x_SETFIELD_Px(reg, FILTER_EN_FIELD, 0x01);
> + if (STV090x_WRITE_DEMOD(state, PDELCTRL1, reg) < 0)
> + goto err;
> + if (STV090x_WRITE_DEMOD(state, ISIENTRY, mis) < 0)
> + goto err;
> + if (STV090x_WRITE_DEMOD(state, ISIBITENA, 0xff) < 0)
> + goto err;
> + }
> + return 0;
> +err:
> + dprintk(FE_ERROR, 1, "I/O error");
> + return -1;
> +}
> +
>  static enum dvbfe_search stv090x_search(struct dvb_frontend *fe)
>  {
>   struct stv090x_state *state = fe->demodulator_priv;
> @@ -3433,6 +3460,8 @@ static enum dvbfe_search stv090x_search(struct 
> dvb_frontend *fe)
>   if (props->frequency == 0)
>   return DVBFE_ALGO_SEARCH_INVALID;
>  
> + stv090x_set_mis(state,props->dvbt2_plp_id);
> +
>   state->delsys = props->delivery_system;
>   state->frequency = props->frequency;
>   state->srate = props->symbol_rate;
> @@ -3447,6 +3476,8 @@ static enum dvbfe_search stv090x_search(struct 
> dvb_frontend *fe)
>   state->search_range = 500;
>   }
>  
> + stv090x_set_mis(state,props->dvbt2_plp_id);
> +
>   if (stv090x_algo(state) == STV090x_RANGEOK) {
> 

HVR 1600 - Analog goes south again

2012-08-10 Thread Bob Lightfoot
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dear Media List Members:
I have been using my Hauppage HVR1600 on Centos 6 for some time
and getting good analog reception.  Now the other day for a reason I
have not been able to determine the Analog quit working and I have not
had success restoring it.  I'm looking for the usual helpful
suggestions I've gotten from this group in the past. Here has been my
troubleshooting to date.
1.  Verified that analog signal is present in cable by hooking a TV to
cable.
2.  Reinstalled all latest v4l and v4l2 drivers from atrpms.net
packages.  These are what has worked in past.

v4l2-ctl --log-status shows video signal not present
> Status Log:
> 
> cx18-0: =  START STATUS CARD #0  = 
> cx18-0: Version: 1.5.1  Card: Hauppauge HVR-1600 tveeprom 4-0050:
> Hauppauge model 74041, rev C6B2, serial# 5267091 tveeprom 4-0050:
> MAC address is 00:0d:fe:50:5e:93 tveeprom 4-0050: tuner model is
> TCL M2523_5N_E (idx 112, type 50) tveeprom 4-0050: TV standards
> NTSC(M) (eeprom 0x08) tveeprom 4-0050: audio processor is CX23418
> (idx 38) tveeprom 4-0050: decoder processor is CX23418 (idx 31) 
> tveeprom 4-0050: has no radio, has IR receiver, has IR transmitter 
> cx18-0 843: Video signal:  not present cx18-0 843:
> Detected format:   NTSC-M cx18-0 843: Specified standard:
> NTSC-M cx18-0 843: Specified video input: Composite 7 cx18-0
> 843: Specified audioclock freq: 48000 Hz cx18-0 843: Detected audio
> mode:   mono cx18-0 843: Detected audio standard:   no detected
> audio standard cx18-0 843: Audio muted:   yes cx18-0
> 843: Audio microcontroller: running cx18-0 843: Configured
> audio standard: automatic detection cx18-0 843: Configured audio
> system:   BTSC cx18-0 843: Specified audio input: Tuner (In8) 
> cx18-0 843: Preferred audio mode:  stereo cx18-0
> gpio-reset-ctrl: GPIO:  direction 0x3001, value 0x3001 
> tuner 5-0061: Tuner mode:  analog TV tuner 5-0061: Frequency:
> 67.25 MHz tuner 5-0061: Standard:0x1000 cs5345 4-004c:
> Input:  1 cs5345 4-004c: Volume: 0 dB cx18-0: Video Input: Tuner 1 
> cx18-0: Audio Input: Tuner 1 cx18-0: GPIO:  direction 0x3001,
> value 0x3001 cx18-0: Tuner: TV cx18-0: Stream Type: MPEG-2
> Program Stream cx18-0: Stream VBI Format: No VBI cx18-0: Audio
> Sampling Frequency: 48 kHz cx18-0: Audio Encoding: MPEG-1/2 Layer
> II cx18-0: Audio Layer II Bitrate: 224 kbps cx18-0: Audio Stereo
> Mode: Stereo cx18-0: Audio Stereo Mode Extension: Bound 4 inactive 
> cx18-0: Audio Emphasis: No Emphasis cx18-0: Audio CRC: No CRC 
> cx18-0: Audio Mute: false cx18-0: Video Encoding: MPEG-2 cx18-0:
> Video Aspect: 4x3 cx18-0: Video B Frames: 2 cx18-0: Video GOP Size:
> 15 cx18-0: Video GOP Closure: true cx18-0: Video Bitrate Mode:
> Variable Bitrate cx18-0: Video Bitrate: 600 cx18-0: Video Peak
> Bitrate: 800 cx18-0: Video Temporal Decimation: 0 cx18-0: Video
> Mute: false cx18-0: Video Mute YUV: 32896 cx18-0: Spatial Filter
> Mode: Manual cx18-0: Spatial Filter: 0 cx18-0: Spatial Luma Filter
> Type: 1D Horizontal cx18-0: Spatial Chroma Filter Type: 1D
> Horizontal cx18-0: Temporal Filter Mode: Manual cx18-0: Temporal
> Filter: 8 cx18-0: Median Filter Type: Off cx18-0: Median Luma
> Filter Minimum: 0 inactive cx18-0: Median Luma Filter Maximum: 255
> inactive cx18-0: Median Chroma Filter Minimum: 0 inactive cx18-0:
> Median Chroma Filter Maximum: 255 inactive cx18-0: Insert
> Navigation Packets: false cx18-0: Status flags: 0x0021 cx18-0:
> Stream encoder MPEG: status 0x, 0% of 2048 KiB (64 buffers) in
> use cx18-0: Stream encoder YUV: status 0x, 0% of 2025 KiB (20
> buffers) in use cx18-0: Stream encoder VBI: status 0x, 0% of
> 1015 KiB (20 buffers) in use cx18-0: Stream encoder PCM audio:
> status 0x, 0% of 1024 KiB (256 buffers) in use cx18-0: Read
> MPEG/VBI: 0/0 bytes cx18-0: ==  END STATUS CARD #0
> ==

I have been modprobing the cx18 in /etc/rc.local > # This section is
added to make the HVR1600 Analog Audio Work
> # service mythbackend stop modprobe -vv cx18 modprobe -v cx18_alsa 
> # service mythbackend start

Even disabling the mythbackend so that it doesn't affect things until
this is sorted out.
> [root@mythbox bob]# lspci -s 01:00.0 -vv 01:00.0 Multimedia video
> controller: Conexant Systems, Inc. CX23418 Single-Chip MPEG-2
> Encoder with Integrated Analog Video/Broadcast Audio Decoder 
> Subsystem: Hauppauge computer works Inc. WinTV HVR-1600 Control:
> I/O- Mem+ BusMaster+ SpecCycle- MemWINV+ VGASnoop- ParErr-
> Stepping- SERR- FastB2B- DisINTx- Status: Cap+ 66MHz- UDF- FastB2B+
> ParErr- DEVSEL=medium >TAbort- SERR-  INTx- Latency: 64 (500ns min, 5ns max), Cache Line Size: 32
> bytes Interrupt: pin A routed to IRQ 17 Region 0: Memory at
> f400 (32-bit, non-prefetchable) [size=64M] Capabilities: [44]
> Vital Product Data pcilib: sysfs_read_vpd: read failed: Conne

cron job: media_tree daily build: WARNINGS

2012-08-10 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:Fri Aug 10 19:00:26 CEST 2012
git hash:3de5bffddbf5fa9d04f3d181dadcaedc1efa0158
gcc version:  i686-linux-gcc (GCC) 4.7.1
host hardware:x86_64
host os:  3.4.07-marune

linux-git-arm-eabi-davinci: WARNINGS
linux-git-arm-eabi-exynos: OK
linux-git-arm-eabi-omap: WARNINGS
linux-git-i686: WARNINGS
linux-git-m32r: WARNINGS
linux-git-mips: WARNINGS
linux-git-powerpc64: WARNINGS
linux-git-x86_64: WARNINGS
linux-2.6.31.12-x86_64: WARNINGS
linux-2.6.32.6-x86_64: WARNINGS
linux-2.6.33-x86_64: WARNINGS
linux-2.6.34-x86_64: WARNINGS
linux-2.6.35.3-x86_64: WARNINGS
linux-2.6.36-x86_64: WARNINGS
linux-2.6.37-x86_64: WARNINGS
linux-2.6.38.2-x86_64: WARNINGS
linux-2.6.39.1-x86_64: WARNINGS
linux-3.0-x86_64: WARNINGS
linux-3.1-x86_64: WARNINGS
linux-3.2.1-x86_64: WARNINGS
linux-3.3-x86_64: WARNINGS
linux-3.4-x86_64: WARNINGS
linux-3.5-x86_64: WARNINGS
linux-2.6.31.12-i686: WARNINGS
linux-2.6.32.6-i686: WARNINGS
linux-2.6.33-i686: WARNINGS
linux-2.6.34-i686: WARNINGS
linux-2.6.35.3-i686: WARNINGS
linux-2.6.36-i686: WARNINGS
linux-2.6.37-i686: WARNINGS
linux-2.6.38.2-i686: WARNINGS
linux-2.6.39.1-i686: WARNINGS
linux-3.0-i686: WARNINGS
linux-3.1-i686: WARNINGS
linux-3.2.1-i686: WARNINGS
linux-3.3-i686: WARNINGS
linux-3.4-i686: WARNINGS
linux-3.5-i686: WARNINGS
apps: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.tar.bz2

The V4L-DVB specification from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
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: [Linaro-mm-sig] [PATCH 2/4] dma-fence: dma-buf synchronization (v8 )

2012-08-10 Thread Daniel Vetter
On Fri, Aug 10, 2012 at 04:57:52PM +0200, Maarten Lankhorst wrote:
> A dma-fence can be attached to a buffer which is being filled or consumed
> by hw, to allow userspace to pass the buffer without waiting to another
> device.  For example, userspace can call page_flip ioctl to display the
> next frame of graphics after kicking the GPU but while the GPU is still
> rendering.  The display device sharing the buffer with the GPU would
> attach a callback to get notified when the GPU's rendering-complete IRQ
> fires, to update the scan-out address of the display, without having to
> wake up userspace.
> 
> A dma-fence is transient, one-shot deal.  It is allocated and attached
> to one or more dma-buf's.  When the one that attached it is done, with
> the pending operation, it can signal the fence.
> 
>   + dma_fence_signal()
> 
> The dma-buf-mgr handles tracking, and waiting on, the fences associated
> with a dma-buf.
> 
> TODO maybe need some helper fxn for simple devices, like a display-
> only drm/kms device which simply wants to wait for exclusive fence to
> be signaled, and then attach a non-exclusive fence while scanout is in
> progress.
> 
> The one pending on the fence can add an async callback:
>   + dma_fence_add_callback()
> The callback can optionally be cancelled with remove_wait_queue()
> 
> Or wait synchronously (optionally with timeout or interruptible):
>   + dma_fence_wait()
> 
> A default software-only implementation is provided, which can be used
> by drivers attaching a fence to a buffer when they have no other means
> for hw sync.  But a memory backed fence is also envisioned, because it
> is common that GPU's can write to, or poll on some memory location for
> synchronization.  For example:
> 
>   fence = dma_buf_get_fence(dmabuf);
>   if (fence->ops == &bikeshed_fence_ops) {
> dma_buf *fence_buf;
> dma_bikeshed_fence_get_buf(fence, &fence_buf, &offset);
> ... tell the hw the memory location to wait on ...
>   } else {
> /* fall-back to sw sync * /
> dma_fence_add_callback(fence, my_cb);
>   }
> 
> On SoC platforms, if some other hw mechanism is provided for synchronizing
> between IP blocks, it could be supported as an alternate implementation
> with it's own fence ops in a similar way.
> 
> To facilitate other non-sw implementations, the enable_signaling callback
> can be used to keep track if a device not supporting hw sync is waiting
> on the fence, and in this case should arrange to call dma_fence_signal()
> at some point after the condition has changed, to notify other devices
> waiting on the fence.  If there are no sw waiters, this can be skipped to
> avoid waking the CPU unnecessarily. The handler of the enable_signaling
> op should take a refcount until the fence is signaled, then release its ref.
> 
> The intention is to provide a userspace interface (presumably via eventfd)
> later, to be used in conjunction with dma-buf's mmap support for sw access
> to buffers (or for userspace apps that would prefer to do their own
> synchronization).

I think the commit message should be cleaned up: Kill the TODO, rip out
the bikeshed_fence and otherwise update it to the latest code.

> 
> v1: Original
> v2: After discussion w/ danvet and mlankhorst on #dri-devel, we decided
> that dma-fence didn't need to care about the sw->hw signaling path
> (it can be handled same as sw->sw case), and therefore the fence->ops
> can be simplified and more handled in the core.  So remove the signal,
> add_callback, cancel_callback, and wait ops, and replace with a simple
> enable_signaling() op which can be used to inform a fence supporting
> hw->hw signaling that one or more devices which do not support hw
> signaling are waiting (and therefore it should enable an irq or do
> whatever is necessary in order that the CPU is notified when the
> fence is passed).
> v3: Fix locking fail in attach_fence() and get_fence()
> v4: Remove tie-in w/ dma-buf..  after discussion w/ danvet and mlankorst
> we decided that we need to be able to attach one fence to N dma-buf's,
> so using the list_head in dma-fence struct would be problematic.
> v5: [ Maarten Lankhorst ] Updated for dma-bikeshed-fence and dma-buf-manager.
> v6: [ Maarten Lankhorst ] I removed dma_fence_cancel_callback and some 
> comments
> about checking if fence fired or not. This is broken by design.
> waitqueue_active during destruction is now fatal, since the signaller
> should be holding a reference in enable_signalling until it signalled
> the fence. Pass the original dma_fence_cb along, and call __remove_wait
> in the dma_fence_callback handler, so that no cleanup needs to be
> performed.
> v7: [ Maarten Lankhorst ] Set cb->func and only enable sw signaling if
> fence wasn't signaled yet, for example for hardware fences that may
> choose to signal blindly.
> v8: [ Maarten Lankhorst ] Tons of tiny fixes, moved __dma_fence_init to
> header and fixed 

Re: [PATCH 1/2] radio-shark: Only compile led support when CONFIG_LED_CLASS is set

2012-08-10 Thread Mauro Carvalho Chehab
Em 10-08-2012 16:58, Hans de Goede escreveu:
> Reported-by: Dadiv Rientjes 
> Signed-off-by: Hans de Goede 
> ---
>  drivers/media/radio/radio-shark.c | 26 --
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/radio/radio-shark.c 
> b/drivers/media/radio/radio-shark.c
> index c2ead23..f746ed0 100644
> --- a/drivers/media/radio/radio-shark.c
> +++ b/drivers/media/radio/radio-shark.c
> @@ -27,7 +27,6 @@
>  
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -35,6 +34,12 @@
>  #include 
>  #include 
>  
> +#if defined(CONFIG_LEDS_CLASS) || \
> +(defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_RADIO_SHARK_MODULE))
> +#include 

Conditionally including headers is not a good thing.

...
>  static void usb_shark_disconnect(struct usb_interface *intf)
>  {
>   struct v4l2_device *v4l2_dev = usb_get_intfdata(intf);
>   struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev);
> +#ifdef SHARK_USE_LEDS
>   int i;
> +#endif
>  
>   mutex_lock(&shark->tea.mutex);
>   v4l2_device_disconnect(&shark->v4l2_dev);
>   snd_tea575x_exit(&shark->tea);
>   mutex_unlock(&shark->tea.mutex);
>  
> +#ifdef SHARK_USE_LEDS
>   for (i = 0; i < NO_LEDS; i++)
>   led_classdev_unregister(&shark->leds[i]);
> +#endif
>  
>   v4l2_device_put(&shark->v4l2_dev);
>  }

That looks ugly. Maybe you could code it on a different way.

You could be move all shark_use_leds together into the same place at
the code, like:

#if defined(CONFIG_LEDS_CLASS) || \
(defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_RADIO_SHARK_MODULE))

 static void shark_led_set_blue(struct led_classdev *led_cdev,
...
.brightness_set = shark_led_set_red,
},
 };

static void shark_led_disconnect(...)
{
...
}

static void shark_led_release(...)
{
...
}

static void shark_led_register(...)
{
...
}
#else
static inline void shark_led_disconnect(...) { };
static inline void shark_led_release(...) { };
static inline void shark_led_register(...)
{
printk(KERN_WARN "radio-shark: CONFIG_LED_CLASS not enabled. LEDs won't 
work\n");
}
#endif

And let the rest of the code to call the shark_led functions, as if LEDS aren't 
enabled,
the function stubs won't produce any code (well, except for the above error 
notice).

The same comment also applies to patch 2.

Regards,
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


[PATCH 1/2] radio-shark: Only compile led support when CONFIG_LED_CLASS is set

2012-08-10 Thread Hans de Goede
Reported-by: Dadiv Rientjes 
Signed-off-by: Hans de Goede 
---
 drivers/media/radio/radio-shark.c | 26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/media/radio/radio-shark.c 
b/drivers/media/radio/radio-shark.c
index c2ead23..f746ed0 100644
--- a/drivers/media/radio/radio-shark.c
+++ b/drivers/media/radio/radio-shark.c
@@ -27,7 +27,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -35,6 +34,12 @@
 #include 
 #include 
 
+#if defined(CONFIG_LEDS_CLASS) || \
+(defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_RADIO_SHARK_MODULE))
+#include 
+#define SHARK_USE_LEDS 1
+#endif
+
 /*
  * Version Information
  */
@@ -54,6 +59,7 @@ MODULE_LICENSE("GPL");
 
 #define v4l2_dev_to_shark(d) container_of(d, struct shark_device, v4l2_dev)
 
+#ifdef SHARK_USE_LEDS
 enum { BLUE_LED, BLUE_PULSE_LED, RED_LED, NO_LEDS };
 
 static void shark_led_set_blue(struct led_classdev *led_cdev,
@@ -83,17 +89,20 @@ static const struct led_classdev 
shark_led_templates[NO_LEDS] = {
.brightness_set = shark_led_set_red,
},
 };
+#endif
 
 struct shark_device {
struct usb_device *usbdev;
struct v4l2_device v4l2_dev;
struct snd_tea575x tea;
 
+#ifdef SHARK_USE_LEDS
struct work_struct led_work;
struct led_classdev leds[NO_LEDS];
char led_names[NO_LEDS][32];
atomic_t brightness[NO_LEDS];
unsigned long brightness_new;
+#endif
 
u8 *transfer_buffer;
u32 last_val;
@@ -175,6 +184,7 @@ static struct snd_tea575x_ops shark_tea_ops = {
.read_val  = shark_read_val,
 };
 
+#ifdef SHARK_USE_LEDS
 static void shark_led_work(struct work_struct *work)
 {
struct shark_device *shark =
@@ -244,20 +254,25 @@ static void shark_led_set_red(struct led_classdev 
*led_cdev,
set_bit(RED_LED, &shark->brightness_new);
schedule_work(&shark->led_work);
 }
+#endif
 
 static void usb_shark_disconnect(struct usb_interface *intf)
 {
struct v4l2_device *v4l2_dev = usb_get_intfdata(intf);
struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev);
+#ifdef SHARK_USE_LEDS
int i;
+#endif
 
mutex_lock(&shark->tea.mutex);
v4l2_device_disconnect(&shark->v4l2_dev);
snd_tea575x_exit(&shark->tea);
mutex_unlock(&shark->tea.mutex);
 
+#ifdef SHARK_USE_LEDS
for (i = 0; i < NO_LEDS; i++)
led_classdev_unregister(&shark->leds[i]);
+#endif
 
v4l2_device_put(&shark->v4l2_dev);
 }
@@ -266,7 +281,9 @@ static void usb_shark_release(struct v4l2_device *v4l2_dev)
 {
struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev);
 
+#ifdef SHARK_USE_LEDS
cancel_work_sync(&shark->led_work);
+#endif
v4l2_device_unregister(&shark->v4l2_dev);
kfree(shark->transfer_buffer);
kfree(shark);
@@ -276,7 +293,10 @@ static int usb_shark_probe(struct usb_interface *intf,
   const struct usb_device_id *id)
 {
struct shark_device *shark;
-   int i, retval = -ENOMEM;
+   int retval = -ENOMEM;
+#ifdef SHARK_USE_LEDS
+   int i;
+#endif
 
shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL);
if (!shark)
@@ -321,6 +341,7 @@ static int usb_shark_probe(struct usb_interface *intf,
goto err_init_tea;
}
 
+#ifdef SHARK_USE_LEDS
INIT_WORK(&shark->led_work, shark_led_work);
for (i = 0; i < NO_LEDS; i++) {
shark->leds[i] = shark_led_templates[i];
@@ -341,6 +362,7 @@ static int usb_shark_probe(struct usb_interface *intf,
 "couldn't register led: %s\n",
 shark->led_names[i]);
}
+#endif
 
return 0;
 
-- 
1.7.11.4

--
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] radio-shark2: Only compile led support when CONFIG_LED_CLASS is set

2012-08-10 Thread Hans de Goede
Reported-by: Dadiv Rientjes 
Signed-off-by: Hans de Goede 
---
 drivers/media/radio/radio-shark2.c | 27 ---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/media/radio/radio-shark2.c 
b/drivers/media/radio/radio-shark2.c
index b9575de..e593d5a 100644
--- a/drivers/media/radio/radio-shark2.c
+++ b/drivers/media/radio/radio-shark2.c
@@ -27,7 +27,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -35,6 +34,12 @@
 #include 
 #include "radio-tea5777.h"
 
+#if defined(CONFIG_LEDS_CLASS) || \
+(defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_RADIO_SHARK2_MODULE))
+#include 
+#define SHARK_USE_LEDS 1
+#endif
+
 MODULE_AUTHOR("Hans de Goede ");
 MODULE_DESCRIPTION("Griffin radioSHARK2, USB radio receiver driver");
 MODULE_LICENSE("GPL");
@@ -43,7 +48,6 @@ static int debug;
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Debug level (0-1)");
 
-
 #define SHARK_IN_EP0x83
 #define SHARK_OUT_EP   0x05
 
@@ -52,6 +56,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
 
 #define v4l2_dev_to_shark(d) container_of(d, struct shark_device, v4l2_dev)
 
+#ifdef SHARK_USE_LEDS
 enum { BLUE_LED, RED_LED, NO_LEDS };
 
 static void shark_led_set_blue(struct led_classdev *led_cdev,
@@ -73,17 +78,20 @@ static const struct led_classdev 
shark_led_templates[NO_LEDS] = {
.brightness_set = shark_led_set_red,
},
 };
+#endif
 
 struct shark_device {
struct usb_device *usbdev;
struct v4l2_device v4l2_dev;
struct radio_tea5777 tea;
 
+#ifdef SHARK_USE_LEDS
struct work_struct led_work;
struct led_classdev leds[NO_LEDS];
char led_names[NO_LEDS][32];
atomic_t brightness[NO_LEDS];
unsigned long brightness_new;
+#endif
 
u8 *transfer_buffer;
 };
@@ -161,6 +169,7 @@ static struct radio_tea5777_ops shark_tea_ops = {
.read_reg  = shark_read_reg,
 };
 
+#ifdef SHARK_USE_LEDS
 static void shark_led_work(struct work_struct *work)
 {
struct shark_device *shark =
@@ -216,20 +225,25 @@ static void shark_led_set_red(struct led_classdev 
*led_cdev,
set_bit(RED_LED, &shark->brightness_new);
schedule_work(&shark->led_work);
 }
+#endif
 
 static void usb_shark_disconnect(struct usb_interface *intf)
 {
struct v4l2_device *v4l2_dev = usb_get_intfdata(intf);
struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev);
+#ifdef SHARK_USE_LEDS
int i;
+#endif
 
mutex_lock(&shark->tea.mutex);
v4l2_device_disconnect(&shark->v4l2_dev);
radio_tea5777_exit(&shark->tea);
mutex_unlock(&shark->tea.mutex);
 
+#ifdef SHARK_USE_LEDS
for (i = 0; i < NO_LEDS; i++)
led_classdev_unregister(&shark->leds[i]);
+#endif
 
v4l2_device_put(&shark->v4l2_dev);
 }
@@ -238,7 +252,9 @@ static void usb_shark_release(struct v4l2_device *v4l2_dev)
 {
struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev);
 
+#ifdef SHARK_USE_LEDS
cancel_work_sync(&shark->led_work);
+#endif
v4l2_device_unregister(&shark->v4l2_dev);
kfree(shark->transfer_buffer);
kfree(shark);
@@ -248,7 +264,10 @@ static int usb_shark_probe(struct usb_interface *intf,
   const struct usb_device_id *id)
 {
struct shark_device *shark;
-   int i, retval = -ENOMEM;
+   int retval = -ENOMEM;
+#ifdef SHARK_USE_LEDS
+   int i;
+#endif
 
shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL);
if (!shark)
@@ -292,6 +311,7 @@ static int usb_shark_probe(struct usb_interface *intf,
goto err_init_tea;
}
 
+#ifdef SHARK_USE_LEDS
INIT_WORK(&shark->led_work, shark_led_work);
for (i = 0; i < NO_LEDS; i++) {
shark->leds[i] = shark_led_templates[i];
@@ -312,6 +332,7 @@ static int usb_shark_probe(struct usb_interface *intf,
 "couldn't register led: %s\n",
 shark->led_names[i]);
}
+#endif
 
return 0;
 
-- 
1.7.11.4

--
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: [Linaro-mm-sig] [PATCH 3/4] dma-seqno-fence: Hardware dma-buf implementation of fencing (v2)

2012-08-10 Thread Daniel Vetter
On Fri, Aug 10, 2012 at 04:57:58PM +0200, Maarten Lankhorst wrote:
> This type of fence can be used with hardware synchronization for simple
> hardware that can block execution until the condition
> (dma_buf[offset] - value) >= 0 has been met.
> 
> A software fallback still has to be provided in case the fence is used
> with a device that doesn't support this mechanism. It is useful to expose
> this for graphics cards that have an op to support this.
> 
> Some cards like i915 can export those, but don't have an option to wait,
> so they need the software fallback.
> 
> I extended the original patch by Rob Clark.
> 
> v1: Original
> v2: Renamed from bikeshed to seqno, moved into dma-fence.c since
> not much was left of the file. Lots of documentation added.
> 
> Signed-off-by: Maarten Lankhorst 

Patch looks good, two bikesheds inline. Either way
Reviewed-by: Daniel Vetter 

> ---
>  drivers/base/dma-fence.c  |   21 +++
>  include/linux/dma-fence.h |   61 
> +
>  2 files changed, 82 insertions(+)
> 
> diff --git a/drivers/base/dma-fence.c b/drivers/base/dma-fence.c
> index 93448e4..4092a58 100644
> --- a/drivers/base/dma-fence.c
> +++ b/drivers/base/dma-fence.c
> @@ -266,3 +266,24 @@ struct dma_fence *dma_fence_create(void *priv)
>   return fence;
>  }
>  EXPORT_SYMBOL_GPL(dma_fence_create);
> +
> +static int seqno_enable_signaling(struct dma_fence *fence)
> +{
> + struct dma_seqno_fence *seqno_fence = to_seqno_fence(fence);
> + return seqno_fence->enable_signaling(seqno_fence);
> +}
> +
> +static void seqno_release(struct dma_fence *fence)
> +{
> + struct dma_seqno_fence *f = to_seqno_fence(fence);
> +
> + if (f->release)
> + f->release(f);
> + dma_buf_put(f->sync_buf);
> +}
> +
> +const struct dma_fence_ops dma_seqno_fence_ops = {
> + .enable_signaling = seqno_enable_signaling,
> + .release = seqno_release
> +};
> +EXPORT_SYMBOL_GPL(dma_seqno_fence_ops);
> diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
> index e0ceddd..3ef0da0 100644
> --- a/include/linux/dma-fence.h
> +++ b/include/linux/dma-fence.h
> @@ -91,6 +91,19 @@ struct dma_fence_ops {
>   void (*release)(struct dma_fence *fence);
>  };
>  
> +struct dma_seqno_fence {
> + struct dma_fence base;
> +
> + struct dma_buf *sync_buf;
> + uint32_t seqno_ofs;
> + uint32_t seqno;
> +
> + int (*enable_signaling)(struct dma_seqno_fence *fence);
> + void (*release)(struct dma_seqno_fence *fence);

I think using dma_fence_ops here is the better color. We lose type-safety
at compile-time, but still keep type-safety at runtime (thanks to
to_dma_seqno_fence). In addition people seem to like to constify function
pointers, we'd save a pointer and if we extend the sw dma_fence interface.

> +};
> +
> +extern const struct dma_fence_ops dma_seqno_fence_ops;
> +
>  struct dma_fence *dma_fence_create(void *priv);
>  
>  /**
> @@ -121,4 +134,52 @@ int dma_fence_wait(struct dma_fence *fence, bool intr, 
> unsigned long timeout);
>  int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,
>  dma_fence_func_t func, void *priv);
>  
> +/**
> + * to_seqno_fence - cast a dma_fence to a dma_seqno_fence
> + * @fence: dma_fence to cast to a dma_seqno_fence
> + *
> + * Returns NULL if the dma_fence is not a dma_seqno_fence,
> + * or the dma_seqno_fence otherwise.
> + */
> +static inline struct dma_seqno_fence *
> +to_seqno_fence(struct dma_fence *fence)
> +{
> + if (fence->ops != &dma_seqno_fence_ops)
> + return NULL;
> + return container_of(fence, struct dma_seqno_fence, base);
> +}

I think adding an is_dma_seqno_fence would be nice ...

> +
> +/**
> + * dma_seqno_fence_init - initialize a seqno fence
> + * @fence: dma_seqno_fence to initialize
> + * @sync_buf: buffer containing the memory location to signal on
> + * @seqno_ofs: the offset within @sync_buf
> + * @seqno: the sequence # to signal on
> + * @priv: value of priv member
> + * @enable_signaling: callback which is called when some other device is
> + *waiting for sw notification of fence
> + * @release: callback called during destruction before object is freed.
> + *
> + * This function initializes a struct dma_seqno_fence with passed parameters,
> + * and takes a reference on sync_buf which is released on fence destruction.
> + */
> +static inline void
> +dma_seqno_fence_init(struct dma_seqno_fence *fence,
> + struct dma_buf *sync_buf,
> + uint32_t seqno_ofs, uint32_t seqno, void *priv,
> + int (*enable_signaling)(struct dma_seqno_fence *),
> + void (*release)(struct dma_seqno_fence *))
> +{
> + BUG_ON(!fence || !sync_buf || !enable_signaling);
> +
> + __dma_fence_init(&fence->base, &dma_seqno_fence_ops, priv);
> +
> + get_dma_buf(sync_buf);
> + fence->sync_buf = sync_buf;
> + fence->seqno_ofs = seqno_ofs

Re: [Linaro-mm-sig] [PATCH 1/4] dma-buf: remove fallback for !CONFIG_DMA_SHARED_BUFFER

2012-08-10 Thread Daniel Vetter
On Fri, Aug 10, 2012 at 04:57:43PM +0200, Maarten Lankhorst wrote:
> Documentation says that code requiring dma-buf should add it to
> select, so inline fallbacks are not going to be used. A link error
> will make it obvious what went wrong, instead of silently doing
> nothing at runtime.
> 
> Signed-off-by: Maarten Lankhorst 

I've botched it more than once to update these when creating new dma-buf
code. Hence

Reviewed-by: Daniel Vetter 
-- 
Daniel Vetter
Mail: dan...@ffwll.ch
Mobile: +41 (0)79 365 57 48
--
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 6/6] [staging] lirc: lirc_ene0100.h is not referenced anywhere

2012-08-10 Thread Sean Young
There is a proper ene0100 driver anyway.

Signed-off-by: Sean Young 
---
 drivers/staging/media/lirc/lirc_ene0100.h | 169 --
 1 file changed, 169 deletions(-)
 delete mode 100644 drivers/staging/media/lirc/lirc_ene0100.h

diff --git a/drivers/staging/media/lirc/lirc_ene0100.h 
b/drivers/staging/media/lirc/lirc_ene0100.h
deleted file mode 100644
index 06bebd6..000
--- a/drivers/staging/media/lirc/lirc_ene0100.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * driver for ENE KB3926 B/C/D CIR (also known as ENE0100)
- *
- * Copyright (C) 2009 Maxim Levitsky 
- *
- * 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 the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * 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
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include 
-#include 
-
-/* hardware address */
-#define ENE_STATUS 0/* hardware status - unused */
-#define ENE_ADDR_HI1/* hi byte of register address */
-#define ENE_ADDR_LO2/* low byte of register address */
-#define ENE_IO 3/* read/write window */
-#define ENE_MAX_IO 4
-
-/* 8 bytes of samples, divided in 2 halfs*/
-#define ENE_SAMPLE_BUFFER  0xF8F0   /* regular sample buffer */
-#define ENE_SAMPLE_SPC_MASK(1 << 7) /* sample is space */
-#define ENE_SAMPLE_VALUE_MASK  0x7F
-#define ENE_SAMPLE_OVERFLOW0x7F
-#define ENE_SAMPLES_SIZE   4
-
-/* fan input sample buffer */
-#define ENE_SAMPLE_BUFFER_FAN  0xF8FB   /* this buffer holds high byte of */
-/* each sample of normal buffer */
-
-#define ENE_FAN_SMPL_PULS_MSK  0x8000   /* this bit of combined sample */
-/* if set, says that sample is pulse */
-#define ENE_FAN_VALUE_MASK 0x0FFF   /* mask for valid bits of the value */
-
-/* first firmware register */
-#define ENE_FW10xF8F8
-#defineENE_FW1_ENABLE  (1 << 0) /* enable fw processing */
-#define ENE_FW1_TXIRQ  (1 << 1) /* TX interrupt pending */
-#define ENE_FW1_WAKE   (1 << 6) /* enable wake from S3 */
-#define ENE_FW1_IRQ(1 << 7) /* enable interrupt */
-
-/* second firmware register */
-#define ENE_FW20xF8F9
-#define ENE_FW2_BUF_HIGH   (1 << 0) /* which half of the buffer to read */
-#define ENE_FW2_IRQ_CLR(1 << 2) /* clear this on IRQ */
-#define ENE_FW2_GP40_AS_LEARN  (1 << 4) /* normal input is used as */
-/* learning input */
-#define ENE_FW2_FAN_AS_NRML_IN (1 << 6) /* fan is used as normal input */
-#define ENE_FW2_LEARNING   (1 << 7) /* hardware supports learning and TX */
-
-/* fan as input settings - only if learning capable */
-#define ENE_FAN_AS_IN1 0xFE30   /* fan init reg 1 */
-#define ENE_FAN_AS_IN1_EN  0xCD
-#define ENE_FAN_AS_IN2 0xFE31   /* fan init reg 2 */
-#define ENE_FAN_AS_IN2_EN  0x03
-#define ENE_SAMPLE_PERIOD_FAN   61  /* fan input has fixed sample period */
-
-/* IRQ registers block (for revision B) */
-#define ENEB_IRQ   0xFD09   /* IRQ number */
-#define ENEB_IRQ_UNK1  0xFD17   /* unknown setting = 1 */
-#define ENEB_IRQ_STATUS0xFD80   /* irq status */
-#define ENEB_IRQ_STATUS_IR (1 << 5) /* IR irq */
-
-/* IRQ registers block (for revision C,D) */
-#define ENEC_IRQ   0xFE9B   /* new irq settings register */
-#define ENEC_IRQ_MASK  0x0F /* irq number mask */
-#define ENEC_IRQ_UNK_EN(1 << 4) /* always enabled */
-#define ENEC_IRQ_STATUS(1 << 5) /* irq status and ACK */
-
-/* CIR block settings */
-#define ENE_CIR_CONF1  0xFEC0
-#define ENE_CIR_CONF1_ADC_ON   0x7  /* receiver on gpio40 enabled */
-#define ENE_CIR_CONF1_LEARN1   (1 << 3) /* enabled on learning mode */
-#define ENE_CIR_CONF1_TX_ON0x30 /* enabled on transmit */
-#define ENE_CIR_CONF1_TX_CARR  (1 << 7) /* send TX carrier or not */
-
-#define ENE_CIR_CONF2  0xFEC1   /* unknown setting = 0 */
-#define ENE_CIR_CONF2_LEARN2   (1 << 4) /* set on enable learning */
-#define ENE_CIR_CONF2_GPIO40DIS(1 << 5) /* disable normal input via 
gpio40 */
-
-#define ENE_CIR_SAMPLE_PERIOD  0xFEC8   /* sample period in us */
-#define ENE_CIR_SAMPLE_OVERFLOW(1 << 7) /* interrupt on overflows if 
set */
-
-
-/* transmitter - not i

[PATCH 3/6] [media] rc: Add support for the TechnoTrend USB IR Receiver

2012-08-10 Thread Sean Young
This driver is loosely based on the lirc_ttusbir driver in the staging area,
but adds more accurate sampling and led control.

Signed-off-by: Sean Young 
---
 drivers/media/rc/Kconfig  |  13 ++
 drivers/media/rc/Makefile |   1 +
 drivers/media/rc/keymaps/rc-tt-1500.c |   2 +-
 drivers/media/rc/ttusbir.c| 400 ++
 4 files changed, 415 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/rc/ttusbir.c

diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 4ca77ccf..a874cd5 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -269,6 +269,19 @@ config IR_IGUANA
   To compile this driver as a module, choose M here: the module will
   be called iguanair.
 
+config IR_TTUSBIR
+   tristate "TechnoTrend USB IR Receiver"
+   depends on RC_CORE
+   select USB
+   select NEW_LEDS
+   select LEDS_CLASS
+   ---help---
+  Say Y here if you want to use the TechnoTrend USB IR Receiver. The
+  driver can control the led.
+
+  To compile this driver as a module, choose M here: the module will
+  be called ttusbir.
+
 config RC_LOOPBACK
tristate "Remote Control Loopback Driver"
depends on RC_CORE
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index 528c93e..5e55c1f 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -26,5 +26,6 @@ obj-$(CONFIG_IR_REDRAT3) += redrat3.o
 obj-$(CONFIG_IR_STREAMZAP) += streamzap.o
 obj-$(CONFIG_IR_WINBOND_CIR) += winbond-cir.o
 obj-$(CONFIG_IR_IGUANA) += iguanair.o
+obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o
 obj-$(CONFIG_RC_LOOPBACK) += rc-loopback.o
 obj-$(CONFIG_IR_GPIO_CIR) += gpio-ir-recv.o
diff --git a/drivers/media/rc/keymaps/rc-tt-1500.c 
b/drivers/media/rc/keymaps/rc-tt-1500.c
index caeff85..80217ff 100644
--- a/drivers/media/rc/keymaps/rc-tt-1500.c
+++ b/drivers/media/rc/keymaps/rc-tt-1500.c
@@ -61,7 +61,7 @@ static struct rc_map_list tt_1500_map = {
.map = {
.scan= tt_1500,
.size= ARRAY_SIZE(tt_1500),
-   .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
+   .rc_type = RC_TYPE_RC5,
.name= RC_MAP_TT_1500,
}
 };
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
new file mode 100644
index 000..71f03ac
--- /dev/null
+++ b/drivers/media/rc/ttusbir.c
@@ -0,0 +1,400 @@
+/*
+ * TechnoTrend USB IR Receiver
+ *
+ * Copyright (C) 2012 Sean Young 
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME"ttusbir"
+#define DRIVER_DESC"TechnoTrend USB IR Receiver"
+/*
+ * The Windows driver uses 8 URBS, the original lirc drivers has a
+ * configurable amount (2 default, 4 max). This device generates about 125
+ * messages per second (!), whether IR is idle or not.
+ */
+#define NUM_URBS   4
+#define NS_PER_BYTE62500
+#define NS_PER_BIT (NS_PER_BYTE/8)
+
+struct ttusbir {
+   struct rc_dev *rc;
+   struct device *dev;
+   struct usb_device *udev;
+
+   struct urb *urb[NUM_URBS];
+
+   struct led_classdev led;
+   struct urb *bulk_urb;
+   uint8_t bulk_buffer[5];
+   int bulk_out_endp, iso_in_endp;
+   bool led_on, is_led_on;
+   atomic_t led_complete;
+
+   char phys[64];
+};
+
+static enum led_brightness ttusbir_brightness_get(struct led_classdev *led_dev)
+{
+   struct ttusbir *tt = container_of(led_dev, struct ttusbir, led);
+
+   return tt->led_on ? LED_FULL : LED_OFF;
+}
+
+static void ttusbir_set_led(struct ttusbir *tt)
+{
+   int ret;
+
+   smp_mb();
+
+   if (tt->led_on != tt->is_led_on &&
+   atomic_add_unless(&tt->led_complete, 1, 1)) {
+   tt->bulk_buffer[4] = tt->is_led_on = tt->led_on;
+   ret = usb_submit_urb(tt->bulk_urb, GFP_ATOMIC);
+   if (ret && ret != -ENODEV) {
+   dev_warn(tt->dev, "failed to submit bulk urb: %d\n",
+   ret);
+   atomic_dec(&tt->led_complete);
+   }
+   }
+}
+
+static void ttusbir_brightn

[PATCH 4/6] [media] rc: do not wake up rc thread unless there is something to do

2012-08-10 Thread Sean Young
The TechnoTrend USB IR Receiver sends 125 ISO URBs per second, even when
there is no IR activity. Reduce the number of wake ups from the other
drivers too.

This saves about 0.25ms per second on a 2.4GHz Core 2 according to
powertop.

Signed-off-by: Sean Young 
---
 drivers/media/rc/fintek-cir.c | 11 ---
 drivers/media/rc/iguanair.c   |  7 +--
 drivers/media/rc/ir-raw.c |  6 --
 drivers/media/rc/mceusb.c | 10 +++---
 drivers/media/rc/ttusbir.c| 19 +--
 5 files changed, 37 insertions(+), 16 deletions(-)

diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index 6aabf7a..3b4e465 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -291,6 +291,7 @@ static void fintek_process_rx_ir_data(struct fintek_dev 
*fintek)
 {
DEFINE_IR_RAW_EVENT(rawir);
u8 sample;
+   bool event = false;
int i;
 
for (i = 0; i < fintek->pkts; i++) {
@@ -328,7 +329,9 @@ static void fintek_process_rx_ir_data(struct fintek_dev 
*fintek)
fit_dbg("Storing %s with duration %d",
rawir.pulse ? "pulse" : "space",
rawir.duration);
-   ir_raw_event_store_with_filter(fintek->rdev, &rawir);
+   if (ir_raw_event_store_with_filter(fintek->rdev,
+   &rawir))
+   event = true;
break;
}
 
@@ -338,8 +341,10 @@ static void fintek_process_rx_ir_data(struct fintek_dev 
*fintek)
 
fintek->pkts = 0;
 
-   fit_dbg("Calling ir_raw_event_handle");
-   ir_raw_event_handle(fintek->rdev);
+   if (event) {
+   fit_dbg("Calling ir_raw_event_handle");
+   ir_raw_event_handle(fintek->rdev);
+   }
 }
 
 /* copy data from hardware rx register into driver buffer */
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index 437aa42..4ef7ea9 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -151,6 +151,7 @@ static void process_ir_data(struct iguanair *ir, unsigned 
len)
} else if (len >= 7) {
DEFINE_IR_RAW_EVENT(rawir);
unsigned i;
+   bool event = false;
 
init_ir_raw_event(&rawir);
 
@@ -164,10 +165,12 @@ static void process_ir_data(struct iguanair *ir, unsigned 
len)
 RX_RESOLUTION;
}
 
-   ir_raw_event_store_with_filter(ir->rc, &rawir);
+   if (ir_raw_event_store_with_filter(ir->rc, &rawir))
+   event = true;
}
 
-   ir_raw_event_handle(ir->rc);
+   if (event)
+   ir_raw_event_handle(ir->rc);
}
 }
 
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
index a820251..97dc8d1 100644
--- a/drivers/media/rc/ir-raw.c
+++ b/drivers/media/rc/ir-raw.c
@@ -157,7 +157,9 @@ EXPORT_SYMBOL_GPL(ir_raw_event_store_edge);
  * This routine (which may be called from an interrupt context) works
  * in similar manner to ir_raw_event_store_edge.
  * This routine is intended for devices with limited internal buffer
- * It automerges samples of same type, and handles timeouts
+ * It automerges samples of same type, and handles timeouts. Returns non-zero
+ * if the event was added, and zero if the event was ignored due to idle
+ * processing.
  */
 int ir_raw_event_store_with_filter(struct rc_dev *dev, struct ir_raw_event *ev)
 {
@@ -184,7 +186,7 @@ int ir_raw_event_store_with_filter(struct rc_dev *dev, 
struct ir_raw_event *ev)
dev->raw->this_ev.duration >= dev->timeout)
ir_raw_event_set_idle(dev, true);
 
-   return 0;
+   return 1;
 }
 EXPORT_SYMBOL_GPL(ir_raw_event_store_with_filter);
 
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 84e06d3..573c174 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -969,6 +969,7 @@ static void mceusb_handle_command(struct mceusb_dev *ir, 
int index)
 static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
 {
DEFINE_IR_RAW_EVENT(rawir);
+   bool event = false;
int i = 0;
 
/* skip meaningless 0xb1 0x60 header bytes on orig receiver */
@@ -999,7 +1000,8 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, 
int buf_len)
rawir.pulse ? "pulse" : "space",
rawir.duration);
 
-   ir_raw_event_store_with_filter(ir->rc, &rawir);
+   if (ir_raw_event_store_with_filter(ir->rc, &rawir))
+   event = true;
break;
case CMD_DATA:
ir->rem--;
@@ -1027,8 +1029,10 @

[PATCH 5/6] [staging] lirc: remove lirc_ttusbir driver

2012-08-10 Thread Sean Young
We now have a proper driver which uses rc-core.

Signed-off-by: Sean Young 
---
 drivers/staging/media/lirc/Kconfig|   6 -
 drivers/staging/media/lirc/Makefile   |   1 -
 drivers/staging/media/lirc/lirc_ttusbir.c | 376 --
 3 files changed, 383 deletions(-)
 delete mode 100644 drivers/staging/media/lirc/lirc_ttusbir.c

diff --git a/drivers/staging/media/lirc/Kconfig 
b/drivers/staging/media/lirc/Kconfig
index 526ec0f..e60a59f 100644
--- a/drivers/staging/media/lirc/Kconfig
+++ b/drivers/staging/media/lirc/Kconfig
@@ -63,12 +63,6 @@ config LIRC_SIR
help
  Driver for the SIR IrDA port
 
-config LIRC_TTUSBIR
-   tristate "Technotrend USB IR Receiver"
-   depends on LIRC && USB
-   help
- Driver for the Technotrend USB IR Receiver
-
 config LIRC_ZILOG
tristate "Zilog/Hauppauge IR Transmitter"
depends on LIRC && I2C
diff --git a/drivers/staging/media/lirc/Makefile 
b/drivers/staging/media/lirc/Makefile
index d76b0fa..b90fcab 100644
--- a/drivers/staging/media/lirc/Makefile
+++ b/drivers/staging/media/lirc/Makefile
@@ -10,5 +10,4 @@ obj-$(CONFIG_LIRC_PARALLEL)   += lirc_parallel.o
 obj-$(CONFIG_LIRC_SASEM)   += lirc_sasem.o
 obj-$(CONFIG_LIRC_SERIAL)  += lirc_serial.o
 obj-$(CONFIG_LIRC_SIR) += lirc_sir.o
-obj-$(CONFIG_LIRC_TTUSBIR) += lirc_ttusbir.o
 obj-$(CONFIG_LIRC_ZILOG)   += lirc_zilog.o
diff --git a/drivers/staging/media/lirc/lirc_ttusbir.c 
b/drivers/staging/media/lirc/lirc_ttusbir.c
deleted file mode 100644
index 3bb865c..000
--- a/drivers/staging/media/lirc/lirc_ttusbir.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/*
- * lirc_ttusbir.c
- *
- * lirc_ttusbir - LIRC device driver for the TechnoTrend USB IR Receiver
- *
- * Copyright (C) 2007 Stefan Macher 
- *
- * This LIRC driver provides access to the TechnoTrend USB IR Receiver.
- * The receiver delivers the IR signal as raw sampled true/false data in
- * isochronous USB packets each of size 128 byte.
- * Currently the driver reduces the sampling rate by factor of 8 as this
- * is still more than enough to decode RC-5 - others should be analyzed.
- * But the driver does not rely on RC-5 it should be able to decode every
- * IR signal that is not too fast.
- */
-
-/*
- *  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
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  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
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-
-MODULE_DESCRIPTION("TechnoTrend USB IR device driver for LIRC");
-MODULE_AUTHOR("Stefan Macher (st_maker-l...@yahoo.de)");
-MODULE_LICENSE("GPL");
-
-/* #define DEBUG */
-#ifdef DEBUG
-#define DPRINTK printk
-#else
-#define DPRINTK(_x_, a...)
-#endif
-
-/* function declarations */
-static int probe(struct usb_interface *intf, const struct usb_device_id *id);
-static void disconnect(struct usb_interface *intf);
-static void urb_complete(struct urb *urb);
-static int set_use_inc(void *data);
-static void set_use_dec(void *data);
-
-static int num_urbs = 2;
-module_param(num_urbs, int, S_IRUGO);
-MODULE_PARM_DESC(num_urbs,
-"Number of URBs in queue. Try to increase to 4 in case "
-"of problems (default: 2; minimum: 2)");
-
-/* table of devices that work with this driver */
-static struct usb_device_id device_id_table[] = {
-   /* TechnoTrend USB IR Receiver */
-   { USB_DEVICE(0x0B48, 0x2003) },
-   /* Terminating entry */
-   { }
-};
-MODULE_DEVICE_TABLE(usb, device_id_table);
-
-/* USB driver definition */
-static struct usb_driver usb_driver = {
-   .name = "TTUSBIR",
-   .id_table = &(device_id_table[0]),
-   .probe = probe,
-   .disconnect = disconnect,
-};
-
-/* USB device definition */
-struct ttusbir_device {
-   struct usb_driver *usb_driver;
-   struct usb_device *udev;
-   struct usb_interface *interf;
-   struct usb_class_driver class_driver;
-   unsigned int ifnum; /* Interface number to use */
-   unsigned int alt_setting; /* alternate setting to use */
-   unsigned int endpoint; /* Endpoint to use */
-   struct urb **urb; /* num_urb URB pointers*/
-   char **buffer; /* 128 byte buffer for each URB */
-   struct lirc_buffer rbuf; /* Buffer towards LIRC */
-   struct lirc_driver driver;
-   int minor;
-   int last_pulse; /* remembers if la

[PATCH 2/6] [media] rc: transmit on device which does not support it should fail

2012-08-10 Thread Sean Young
Currently write() will return 0 if an IR device does not support sending.

Signed-off-by: Sean Young 
---
 drivers/media/rc/ir-lirc-codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 5faba2a..d2fd064 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -105,7 +105,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const 
char __user *buf,
struct lirc_codec *lirc;
struct rc_dev *dev;
unsigned int *txbuf; /* buffer with values to transmit */
-   ssize_t ret = 0;
+   ssize_t ret = -EINVAL;
size_t count;
 
lirc = lirc_get_pdata(file);
-- 
1.7.11.2

--
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/6] [media] iguanair: Fix return value on transmit

2012-08-10 Thread Sean Young
Transmit returned 0 after sending and failed to send anything if the amount
exceeded its buffer size. Also fix some minor errors.

Signed-off-by: Sean Young 
---
 drivers/media/rc/iguanair.c | 34 --
 1 file changed, 20 insertions(+), 14 deletions(-)

diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index aa7f34f..437aa42 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -75,7 +75,7 @@ struct iguanair {
 
 #define MAX_PACKET_SIZE8u
 #define TIMEOUT1000
-#define RX_RESOLUTION  21330
+#define RX_RESOLUTION  21333
 
 struct packet {
uint16_t start;
@@ -349,7 +349,7 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, 
unsigned count)
 {
struct iguanair *ir = dev->priv;
uint8_t space, *payload;
-   unsigned i, size, rc;
+   unsigned i, size, rc, bytes;
struct send_packet *packet;
 
mutex_lock(&ir->lock);
@@ -357,17 +357,22 @@ static int iguanair_tx(struct rc_dev *dev, unsigned 
*txbuf, unsigned count)
/* convert from us to carrier periods */
for (i = size = 0; i < count; i++) {
txbuf[i] = DIV_ROUND_CLOSEST(txbuf[i] * ir->carrier, 100);
-   size += (txbuf[i] + 126) / 127;
+   bytes = (txbuf[i] + 126) / 127;
+   if (size + bytes > ir->bufsize) {
+   count = i;
+   break;
+   }
+   size += bytes;
}
 
-   packet = kmalloc(sizeof(*packet) + size, GFP_KERNEL);
-   if (!packet) {
-   rc = -ENOMEM;
+   if (count == 0) {
+   rc = -EINVAL;
goto out;
}
 
-   if (size > ir->bufsize) {
-   rc = -E2BIG;
+   packet = kmalloc(sizeof(*packet) + size, GFP_KERNEL);
+   if (!packet) {
+   rc = -ENOMEM;
goto out;
}
 
@@ -398,7 +403,7 @@ static int iguanair_tx(struct rc_dev *dev, unsigned *txbuf, 
unsigned count)
rc = iguanair_receiver(ir, false);
if (rc) {
dev_warn(ir->dev, "disable receiver before transmit 
failed\n");
-   goto out;
+   goto out_kfree;
}
}
 
@@ -414,11 +419,12 @@ static int iguanair_tx(struct rc_dev *dev, unsigned 
*txbuf, unsigned count)
dev_warn(ir->dev, "re-enable receiver after transmit 
failed\n");
}
 
+out_kfree:
+   kfree(packet);
 out:
mutex_unlock(&ir->lock);
-   kfree(packet);
 
-   return rc;
+   return rc ? rc : count;
 }
 
 static int iguanair_open(struct rc_dev *rdev)
@@ -466,16 +472,16 @@ static int __devinit iguanair_probe(struct usb_interface 
*intf,
ir = kzalloc(sizeof(*ir), GFP_KERNEL);
rc = rc_allocate_device();
if (!ir || !rc) {
-   ret = ENOMEM;
+   ret = -ENOMEM;
goto out;
}
 
-   ir->buf_in = usb_alloc_coherent(udev, MAX_PACKET_SIZE, GFP_ATOMIC,
+   ir->buf_in = usb_alloc_coherent(udev, MAX_PACKET_SIZE, GFP_KERNEL,
&ir->dma_in);
ir->urb_in = usb_alloc_urb(0, GFP_KERNEL);
 
if (!ir->buf_in || !ir->urb_in) {
-   ret = ENOMEM;
+   ret = -ENOMEM;
goto out;
}
 
-- 
1.7.11.2

--
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: Philips saa7134 IR remote problem with linux kernel v2.6.35

2012-08-10 Thread Partha Guha Roy
Hi Sean,

I am not an expert on the kernel. So please excuse me if I give the
wrong answer somewhere.

On Fri, Aug 10, 2012 at 3:47 PM, Sean Young  wrote:
>
> Are you runnning the lircd user space process for input or relying on
> the in-kernel decoders?

For my testing, I booted the vanilla kernel into ubuntu recovery mode
and just pressed a few keys on the remote. No lircd process was
running at that point. So, I am guessing that I used the in-kernel
decoders.

> Also what remote are you using (or more
> specifically, what IR protocol does it use)?
>

The remove came with the analog TV card (avermedia pci pure m135a). I
am not sure what protocol the remote uses. I'd really appreciate it if
you could let me know how I can find that out.

> Can you reproduce the issue on a more contemporary kernel?
>

Yes. The buggy behavior is present in Ubuntu 12.04 (IIRC, kernel
v3.2.*). I also know that the buggy behavior is present at v3.4.x of
the kernel. I haven't tested more recent kernels.

> Note that the commit only affects kernel space IR decoders so it should
> not affect lircd.
>

Ok. But as I mentioned, I think I am using kernel space decoders.

> I wouldn't be surprised if the 15ms delay for processing in
> saa7134_raw_decode_irq (bottom of saa7134-input.c) needs increasing.
>

Thank you very much for your feedback.

Regards.

/Partha Roy
--
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


[Announcement] pcimax3000+ (RDS-transmitter) control tool

2012-08-10 Thread Konke Radlow
Hello,
during the last weeks I've been working on a RDS (Radio Data System)
decoding library
(libv4l2rds) and a corresponding test and control tool (rds-ctl), that
might make it into v4l soon.

In the course of this process I created a command line tool for
controlling the PCIMAX3000+
RDS-transmission card.
http://www.pcs-electronics.com/3000-stereo-transmitter-card-p-1664.html?

The tool was used to test the library and has reached a stage where it
is feature complete
and easy to use and setup. For this reason I wanted to share the code
in case somebody
is interested in setting up his own radio station, or test RDS :)

The most recent version of the tool can always be found in my repository:
https://github.com/koradlow/pcimax-ctl

Regards,
Konke
--
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


[RFC PATCH] Add core TMC (Traffic Message Channel) support

2012-08-10 Thread Konke Radlow

Signed-off-by: Konke Radlow 
---
 lib/include/libv4l2rds.h|   64 
 lib/libv4l2rds/libv4l2rds.c |  340 ++-
 utils/rds-ctl/rds-ctl.cpp   |   31 +++-
 3 files changed, 432 insertions(+), 3 deletions(-)

diff --git a/lib/include/libv4l2rds.h b/lib/include/libv4l2rds.h
index 37bdd2f..caefc1a 100644
--- a/lib/include/libv4l2rds.h
+++ b/lib/include/libv4l2rds.h
@@ -63,6 +63,9 @@ extern "C" {
 #define V4L2_RDS_AF0x800   /* AF (alternative freq) available */
 #define V4L2_RDS_ECC   0x1000  /* Extended County Code */
 #define V4L2_RDS_LC0x2000  /* Language Code */
+#define V4L2_RDS_TMC_SG0x4000  /* RDS-TMC single group */
+#define V4L2_RDS_TMC_MG0x8000  /* RDS-TMC multi group */
+#define V4L2_RDS_TMC_SYS   0x1 /* RDS-TMC system information */
 
 /* Define Constants for the state of the RDS decoding process
  * used to address the relevant bit in the decode_information bitmask */
@@ -76,6 +79,11 @@ extern "C" {
 #define V4L2_RDS_FLAG_COMPRESSED   0x04
 #define V4L2_RDS_FLAG_STATIC_PTY   0x08
 
+/* TMC related codes
+ * used to extract TMC fields from RDS groups */
+#define V4L2_TMC_TUNING_INFO   0x08
+#define V4L2_TMC_SINGLE_GROUP  0x04
+
 /* struct to encapsulate one complete RDS group */
 /* This structure is used internally to store data until a complete RDS
  * group was received and group id dependent decoding can be done.
@@ -137,6 +145,61 @@ struct v4l2_rds_af_set {
uint32_t af[MAX_AF_CNT];/* AFs defined in Hz */
 };
 
+/* struct to encapsulate an additional data field in a TMC message */
+struct v4l2_tmc_additional {
+   uint8_t label;
+   uint16_t data;
+};
+
+/* struct to encapsulate an arbitrary number of additional data fields
+ * belonging to one TMC message */
+struct v4l2_tmc_additional_set {
+   uint8_t size;
+   /* 28 is the maximal possible number of fields. Additional data
+* is limited to 112 bit, and the smallest optional tuple has
+* a size of 4 bit (4 bit identifier + 0 bits of data) */
+   struct v4l2_tmc_additional fields[28];
+};
+
+/* struct to encapsulate a decoded TMC message with optional additional
+ * data field (in case of a multi-group TMC message) */
+struct v4l2_rds_tmc_msg {
+   uint8_t length; /* length of multi-group message (0..4) */
+   uint8_t sid;/* service identifier at time of reception */
+   uint8_t extent;
+   uint8_t dp; /* duration and persistence */
+   uint16_t event; /* TMC event code */
+   uint16_t location;  /* TMC event location */
+   bool follow_diversion;  /* indicates if the driver is adviced to
+* follow the diversion */
+   bool neg_direction; /* indicates negative / positive direction */
+
+   /* decoded additional information (only available in multi-group
+* messages) */
+   struct v4l2_tmc_additional_set additional;
+};
+
+/* struct to encapsulate all TMC related information, including TMC System
+ * Information, TMC Tuning information and a buffer for the last decoded
+ * TMC messages */
+struct v4l2_rds_tmc {
+   uint8_t ltn;/* location_table_number */
+   bool afi;   /* alternative frequency indicator */
+   bool enhanced_mode; /* mode of transmission,
+* if false -> basic => gaps between tmc groups
+* gap defines timing behavior
+* if true -> enhanced => t_a, t_w and t_d
+* define timing behavior of tmc groups */
+   uint8_t mgs;/* message geographical scope */
+   uint8_t sid;/* service identifier (unique ID on national 
level) */
+   uint8_t gap;/* Gap parameters */
+   uint8_t t_a;/* activity time (only if mode = enhanced) */
+   uint8_t t_w;/* window time (only if mode = enhanced */
+   uint8_t t_d;/* delay time (only if mode = enhanced */
+   uint8_t spn[9]; /* service provider name */
+   struct v4l2_rds_tmc_msg tmc_msg;
+};
+
 /* struct to encapsulate state and RDS information for current decoding 
process */
 /* This is the structure that will be used by external applications, to
  * communicate with the library and get access to RDS data */
@@ -172,6 +235,7 @@ struct v4l2_rds {
struct v4l2_rds_statistics rds_statistics;
struct v4l2_rds_oda_set rds_oda;/* Open Data Services */
struct v4l2_rds_af_set rds_af;  /* Alternative Frequencies */
+   struct v4l2_rds_tmc tmc;/* TMC information */
 };
 
 /* v4l2_rds_init() - initializes a new decoding process
diff --git a/lib/libv4l2rds/libv4l2rds.c b/lib/libv4l2rds/libv4l2rds.c
index 2d6642c..f47adb8 100644
--- a/lib/libv4l2rds/libv4l2rds.c
+++ b/lib/libv4l2rds/libv4

[RFC PATCH 0/1] Adding core TMC decoding support to RDS library

2012-08-10 Thread Konke Radlow
Hello,
this patch adds the core of TMC decoding support to the RDS library.
Single and multigroup TMC messages as well as TMC system messages
are decoded into an easily accessable format and can be used as the 
basis for a complete TMC decoding implementation.

The part that's missing from the code are the extensive lookup-tables that
necessary to decode the dictionary-based TMC protocol into a human readable
representation. 

As these LUTs are just the next layer in TMC decoding and don't add a lot of
complexity or logic to the code it was decided to release an [RFC PATCH] at 
the current state, so that it might be merged into the master branch together
with the RDS-decoding library.

Regards,
Konke

--
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] dma-buf-mgr: multiple dma-buf synchronization (v3)

2012-08-10 Thread Maarten Lankhorst
Signed-off-by: Maarten Lankhorst 

dma-buf-mgr handles the case of reserving single or multiple dma-bufs
while trying to prevent deadlocks from buffers being reserved
simultaneously. For this to happen extra functions have been introduced:

  + dma_buf_reserve()
  + dma_buf_unreserve()
  + dma_buf_wait_unreserved()

Reserve a single buffer, optionally with a sequence to indicate this
is part of a multi-dmabuf reservation. This function will return
-EDEADLK and return immediately if reserving would cause a deadlock.
In case a single buffer is being reserved, no sequence is needed,
otherwise please use the dmabufmgr calls.

If you want to attach a exclusive dma-fence, you have to wait
until all shared fences have signalled completion. If there are none,
or if a shared fence has to be attached, wait until last exclusive
fence has signalled completion.

The new fence has to be attached before unreserving the buffer,
and in exclusive mode all previous fences will have be removed
from the buffer, and unreffed when done with it.

dmabufmgr methods:

  + dmabufmgr_validate_init()
This function inits a dmabufmgr_validate structure and appends
it to the tail of the list, with refcount set to 1.
  + dmabufmgr_validate_put()
Convenience function to unref and free a dmabufmgr_validate
structure. However if it's used for custom callback signalling,
a custom function should be implemented.

  + dmabufmgr_reserve_buffers()
This function takes a linked list of dmabufmgr_validate's, each one
requires the following members to be set by the caller:
- validate->head, list head
- validate->bo, must be set to the dma-buf to reserve.
- validate->shared, set to true if opened in shared mode.
- validate->priv, can be used by the caller to identify this buffer.

This function will then set the following members on succesful completion:

- validate->num_fences, amount of valid fences to wait on before this
  buffer can be accessed. This can be 0.
- validate->fences[0...num_fences-1] fences to wait on

  + dmabufmgr_backoff_reservation()
This can be used when the caller encounters an error between reservation
and usage. No new fence will be attached and all reservations will be
undone without side effects.

  + dmabufmgr_fence_buffer_objects
Upon successful completion a new fence will have to be attached.
This function releases old fences and attaches the new one.

  + dmabufmgr_wait_completed_cpu
A simple cpu waiter convenience function. Waits until all fences have
signalled completion before returning.

The rationale of refcounting dmabufmgr_validate lies in the wait
dma_fence_cb wait member. Before calling dma_fence_add_callback
you should increase the refcount on dmabufmgr_validate with
dmabufmgr_validate_get, and on signal completion you should call
kref_put(&val->refcount, custom_free_signal); after all callbacks
have added you drop the refcount by 1 also, when refcount drops to
0 all callbacks have been signalled, and dmabufmgr_validate
has been waited on and can be freed. Since this will require
atomic spinlocks to unlink the list and signal completion, a
deadlock could occur if you try to call add_callback otherwise,
so the refcount is used as a means of preventing this from
occuring by having your custom free function take a device specific
lock, removing from list and freeing the data. The nice/evil part
about this is that this will also guarantee no memory leaks can occur
behind your back. This allows delays completion by moving the
dmabufmgr_validate list to be a part of the committed reservation.

v1: Original version
v2: Use dma-fence
v3: Added refcounting to dmabufmgr-validate
v4: Fixed dmabufmgr_wait_completed_cpu prototype, added more
documentation and added Documentation/dma-buf-synchronization.txt
---
 Documentation/DocBook/device-drivers.tmpl |2 
 Documentation/dma-buf-synchronization.txt |  197 +
 drivers/base/Makefile |2 
 drivers/base/dma-buf-mgr.c|  277 +
 drivers/base/dma-buf.c|  114 
 include/linux/dma-buf-mgr.h   |  121 +
 include/linux/dma-buf.h   |   24 +++
 7 files changed, 736 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/dma-buf-synchronization.txt
 create mode 100644 drivers/base/dma-buf-mgr.c
 create mode 100644 include/linux/dma-buf-mgr.h

diff --git a/Documentation/DocBook/device-drivers.tmpl 
b/Documentation/DocBook/device-drivers.tmpl
index 36252ac..2fc050c 100644
--- a/Documentation/DocBook/device-drivers.tmpl
+++ b/Documentation/DocBook/device-drivers.tmpl
@@ -128,6 +128,8 @@ X!Edrivers/base/interface.c
 !Edrivers/base/dma-buf.c
 !Edrivers/base/dma-fence.c
 !Iinclude/linux/dma-fence.h
+!Edrivers/base/dma-buf-mgr.c
+!Iinclude/linux/dma-buf-mgr.h
 !Edrivers/base/dma-coherent.c
 !Edrivers/base/dma-mapping.c
  
diff --git a/Documentation/dma-buf-synchronization.txt 
b/Documentation/dma-buf-synchronization.txt
new

[PATCH 3/4] dma-seqno-fence: Hardware dma-buf implementation of fencing (v2)

2012-08-10 Thread Maarten Lankhorst
This type of fence can be used with hardware synchronization for simple
hardware that can block execution until the condition
(dma_buf[offset] - value) >= 0 has been met.

A software fallback still has to be provided in case the fence is used
with a device that doesn't support this mechanism. It is useful to expose
this for graphics cards that have an op to support this.

Some cards like i915 can export those, but don't have an option to wait,
so they need the software fallback.

I extended the original patch by Rob Clark.

v1: Original
v2: Renamed from bikeshed to seqno, moved into dma-fence.c since
not much was left of the file. Lots of documentation added.

Signed-off-by: Maarten Lankhorst 
---
 drivers/base/dma-fence.c  |   21 +++
 include/linux/dma-fence.h |   61 +
 2 files changed, 82 insertions(+)

diff --git a/drivers/base/dma-fence.c b/drivers/base/dma-fence.c
index 93448e4..4092a58 100644
--- a/drivers/base/dma-fence.c
+++ b/drivers/base/dma-fence.c
@@ -266,3 +266,24 @@ struct dma_fence *dma_fence_create(void *priv)
return fence;
 }
 EXPORT_SYMBOL_GPL(dma_fence_create);
+
+static int seqno_enable_signaling(struct dma_fence *fence)
+{
+   struct dma_seqno_fence *seqno_fence = to_seqno_fence(fence);
+   return seqno_fence->enable_signaling(seqno_fence);
+}
+
+static void seqno_release(struct dma_fence *fence)
+{
+   struct dma_seqno_fence *f = to_seqno_fence(fence);
+
+   if (f->release)
+   f->release(f);
+   dma_buf_put(f->sync_buf);
+}
+
+const struct dma_fence_ops dma_seqno_fence_ops = {
+   .enable_signaling = seqno_enable_signaling,
+   .release = seqno_release
+};
+EXPORT_SYMBOL_GPL(dma_seqno_fence_ops);
diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index e0ceddd..3ef0da0 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -91,6 +91,19 @@ struct dma_fence_ops {
void (*release)(struct dma_fence *fence);
 };
 
+struct dma_seqno_fence {
+   struct dma_fence base;
+
+   struct dma_buf *sync_buf;
+   uint32_t seqno_ofs;
+   uint32_t seqno;
+
+   int (*enable_signaling)(struct dma_seqno_fence *fence);
+   void (*release)(struct dma_seqno_fence *fence);
+};
+
+extern const struct dma_fence_ops dma_seqno_fence_ops;
+
 struct dma_fence *dma_fence_create(void *priv);
 
 /**
@@ -121,4 +134,52 @@ int dma_fence_wait(struct dma_fence *fence, bool intr, 
unsigned long timeout);
 int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,
   dma_fence_func_t func, void *priv);
 
+/**
+ * to_seqno_fence - cast a dma_fence to a dma_seqno_fence
+ * @fence: dma_fence to cast to a dma_seqno_fence
+ *
+ * Returns NULL if the dma_fence is not a dma_seqno_fence,
+ * or the dma_seqno_fence otherwise.
+ */
+static inline struct dma_seqno_fence *
+to_seqno_fence(struct dma_fence *fence)
+{
+   if (fence->ops != &dma_seqno_fence_ops)
+   return NULL;
+   return container_of(fence, struct dma_seqno_fence, base);
+}
+
+/**
+ * dma_seqno_fence_init - initialize a seqno fence
+ * @fence: dma_seqno_fence to initialize
+ * @sync_buf: buffer containing the memory location to signal on
+ * @seqno_ofs: the offset within @sync_buf
+ * @seqno: the sequence # to signal on
+ * @priv: value of priv member
+ * @enable_signaling: callback which is called when some other device is
+ *waiting for sw notification of fence
+ * @release: callback called during destruction before object is freed.
+ *
+ * This function initializes a struct dma_seqno_fence with passed parameters,
+ * and takes a reference on sync_buf which is released on fence destruction.
+ */
+static inline void
+dma_seqno_fence_init(struct dma_seqno_fence *fence,
+   struct dma_buf *sync_buf,
+   uint32_t seqno_ofs, uint32_t seqno, void *priv,
+   int (*enable_signaling)(struct dma_seqno_fence *),
+   void (*release)(struct dma_seqno_fence *))
+{
+   BUG_ON(!fence || !sync_buf || !enable_signaling);
+
+   __dma_fence_init(&fence->base, &dma_seqno_fence_ops, priv);
+
+   get_dma_buf(sync_buf);
+   fence->sync_buf = sync_buf;
+   fence->seqno_ofs = seqno_ofs;
+   fence->seqno = seqno;
+   fence->enable_signaling = enable_signaling;
+   fence->release = release;
+}
+
 #endif /* __DMA_FENCE_H__ */

--
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] dma-fence: dma-buf synchronization (v8 )

2012-08-10 Thread Maarten Lankhorst
A dma-fence can be attached to a buffer which is being filled or consumed
by hw, to allow userspace to pass the buffer without waiting to another
device.  For example, userspace can call page_flip ioctl to display the
next frame of graphics after kicking the GPU but while the GPU is still
rendering.  The display device sharing the buffer with the GPU would
attach a callback to get notified when the GPU's rendering-complete IRQ
fires, to update the scan-out address of the display, without having to
wake up userspace.

A dma-fence is transient, one-shot deal.  It is allocated and attached
to one or more dma-buf's.  When the one that attached it is done, with
the pending operation, it can signal the fence.

  + dma_fence_signal()

The dma-buf-mgr handles tracking, and waiting on, the fences associated
with a dma-buf.

TODO maybe need some helper fxn for simple devices, like a display-
only drm/kms device which simply wants to wait for exclusive fence to
be signaled, and then attach a non-exclusive fence while scanout is in
progress.

The one pending on the fence can add an async callback:
  + dma_fence_add_callback()
The callback can optionally be cancelled with remove_wait_queue()

Or wait synchronously (optionally with timeout or interruptible):
  + dma_fence_wait()

A default software-only implementation is provided, which can be used
by drivers attaching a fence to a buffer when they have no other means
for hw sync.  But a memory backed fence is also envisioned, because it
is common that GPU's can write to, or poll on some memory location for
synchronization.  For example:

  fence = dma_buf_get_fence(dmabuf);
  if (fence->ops == &bikeshed_fence_ops) {
dma_buf *fence_buf;
dma_bikeshed_fence_get_buf(fence, &fence_buf, &offset);
... tell the hw the memory location to wait on ...
  } else {
/* fall-back to sw sync * /
dma_fence_add_callback(fence, my_cb);
  }

On SoC platforms, if some other hw mechanism is provided for synchronizing
between IP blocks, it could be supported as an alternate implementation
with it's own fence ops in a similar way.

To facilitate other non-sw implementations, the enable_signaling callback
can be used to keep track if a device not supporting hw sync is waiting
on the fence, and in this case should arrange to call dma_fence_signal()
at some point after the condition has changed, to notify other devices
waiting on the fence.  If there are no sw waiters, this can be skipped to
avoid waking the CPU unnecessarily. The handler of the enable_signaling
op should take a refcount until the fence is signaled, then release its ref.

The intention is to provide a userspace interface (presumably via eventfd)
later, to be used in conjunction with dma-buf's mmap support for sw access
to buffers (or for userspace apps that would prefer to do their own
synchronization).

v1: Original
v2: After discussion w/ danvet and mlankhorst on #dri-devel, we decided
that dma-fence didn't need to care about the sw->hw signaling path
(it can be handled same as sw->sw case), and therefore the fence->ops
can be simplified and more handled in the core.  So remove the signal,
add_callback, cancel_callback, and wait ops, and replace with a simple
enable_signaling() op which can be used to inform a fence supporting
hw->hw signaling that one or more devices which do not support hw
signaling are waiting (and therefore it should enable an irq or do
whatever is necessary in order that the CPU is notified when the
fence is passed).
v3: Fix locking fail in attach_fence() and get_fence()
v4: Remove tie-in w/ dma-buf..  after discussion w/ danvet and mlankorst
we decided that we need to be able to attach one fence to N dma-buf's,
so using the list_head in dma-fence struct would be problematic.
v5: [ Maarten Lankhorst ] Updated for dma-bikeshed-fence and dma-buf-manager.
v6: [ Maarten Lankhorst ] I removed dma_fence_cancel_callback and some comments
about checking if fence fired or not. This is broken by design.
waitqueue_active during destruction is now fatal, since the signaller
should be holding a reference in enable_signalling until it signalled
the fence. Pass the original dma_fence_cb along, and call __remove_wait
in the dma_fence_callback handler, so that no cleanup needs to be
performed.
v7: [ Maarten Lankhorst ] Set cb->func and only enable sw signaling if
fence wasn't signaled yet, for example for hardware fences that may
choose to signal blindly.
v8: [ Maarten Lankhorst ] Tons of tiny fixes, moved __dma_fence_init to
header and fixed include mess. dma-fence.h now includes dma-buf.h
All members are now initialized, so kmalloc can be used for
allocating a dma-fence. More documentation added.

Signed-off-by: Maarten Lankhorst 
---
 Documentation/DocBook/device-drivers.tmpl |2 
 drivers/base/Makefile |2 
 drivers/base/dma-fence.c  |  268 +
 

[PATCH 1/4] dma-buf: remove fallback for !CONFIG_DMA_SHARED_BUFFER

2012-08-10 Thread Maarten Lankhorst
Documentation says that code requiring dma-buf should add it to
select, so inline fallbacks are not going to be used. A link error
will make it obvious what went wrong, instead of silently doing
nothing at runtime.

Signed-off-by: Maarten Lankhorst 
---
 include/linux/dma-buf.h |   99 ---
 1 file changed, 99 deletions(-)

diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
index eb48f38..bd2e52c 100644
--- a/include/linux/dma-buf.h
+++ b/include/linux/dma-buf.h
@@ -156,7 +156,6 @@ static inline void get_dma_buf(struct dma_buf *dmabuf)
get_file(dmabuf->file);
 }
 
-#ifdef CONFIG_DMA_SHARED_BUFFER
 struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
struct device *dev);
 void dma_buf_detach(struct dma_buf *dmabuf,
@@ -184,103 +183,5 @@ int dma_buf_mmap(struct dma_buf *, struct vm_area_struct 
*,
 unsigned long);
 void *dma_buf_vmap(struct dma_buf *);
 void dma_buf_vunmap(struct dma_buf *, void *vaddr);
-#else
-
-static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
-   struct device *dev)
-{
-   return ERR_PTR(-ENODEV);
-}
-
-static inline void dma_buf_detach(struct dma_buf *dmabuf,
- struct dma_buf_attachment *dmabuf_attach)
-{
-   return;
-}
-
-static inline struct dma_buf *dma_buf_export(void *priv,
-const struct dma_buf_ops *ops,
-size_t size, int flags)
-{
-   return ERR_PTR(-ENODEV);
-}
-
-static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags)
-{
-   return -ENODEV;
-}
-
-static inline struct dma_buf *dma_buf_get(int fd)
-{
-   return ERR_PTR(-ENODEV);
-}
-
-static inline void dma_buf_put(struct dma_buf *dmabuf)
-{
-   return;
-}
-
-static inline struct sg_table *dma_buf_map_attachment(
-   struct dma_buf_attachment *attach, enum dma_data_direction write)
-{
-   return ERR_PTR(-ENODEV);
-}
-
-static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
-   struct sg_table *sg, enum dma_data_direction dir)
-{
-   return;
-}
-
-static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
-  size_t start, size_t len,
-  enum dma_data_direction dir)
-{
-   return -ENODEV;
-}
-
-static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf,
- size_t start, size_t len,
- enum dma_data_direction dir)
-{
-}
-
-static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf,
-   unsigned long pnum)
-{
-   return NULL;
-}
-
-static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf,
-unsigned long pnum, void *vaddr)
-{
-}
-
-static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum)
-{
-   return NULL;
-}
-
-static inline void dma_buf_kunmap(struct dma_buf *dmabuf,
- unsigned long pnum, void *vaddr)
-{
-}
-
-static inline int dma_buf_mmap(struct dma_buf *dmabuf,
-  struct vm_area_struct *vma,
-  unsigned long pgoff)
-{
-   return -ENODEV;
-}
-
-static inline void *dma_buf_vmap(struct dma_buf *dmabuf)
-{
-   return NULL;
-}
-
-static inline void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
-{
-}
-#endif /* CONFIG_DMA_SHARED_BUFFER */
 
 #endif /* __DMA_BUF_H__ */

--
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 v4 2/2] v4l: Add v4l2 subdev driver for S5K4ECGX sensor

2012-08-10 Thread Sangwook Lee
This driver implements preview mode of the S5K4ECGX sensor.
capture (snapshot) operation, face detection are missing now.

Following controls are supported:
contrast/saturation/brightness/sharpness

Signed-off-by: Sangwook Lee 
---
 drivers/media/video/Kconfig|8 +
 drivers/media/video/Makefile   |1 +
 drivers/media/video/s5k4ecgx.c |  941 
 include/media/s5k4ecgx.h   |   37 ++
 4 files changed, 987 insertions(+)
 create mode 100644 drivers/media/video/s5k4ecgx.c
 create mode 100644 include/media/s5k4ecgx.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index c128fac..d405cb1 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -580,6 +580,14 @@ config VIDEO_S5K6AA
  This is a V4L2 sensor-level driver for Samsung S5K6AA(FX) 1.3M
  camera sensor with an embedded SoC image signal processor.
 
+config VIDEO_S5K4ECGX
+   tristate "Samsung S5K4ECGX sensor support"
+   depends on MEDIA_CAMERA_SUPPORT
+   depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   ---help---
+ This is a V4L2 sensor-level driver for Samsung S5K4ECGX 5M
+ camera sensor with an embedded SoC image signal processor.
+
 source "drivers/media/video/smiapp/Kconfig"
 
 comment "Flash devices"
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index b7da9fa..ec39c47 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -80,6 +80,7 @@ obj-$(CONFIG_VIDEO_SR030PC30) += sr030pc30.o
 obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
 obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/
 obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
+obj-$(CONFIG_VIDEO_S5K4ECGX)+= s5k4ecgx.o
 obj-$(CONFIG_VIDEO_SMIAPP) += smiapp/
 obj-$(CONFIG_VIDEO_ADP1653)+= adp1653.o
 obj-$(CONFIG_VIDEO_AS3645A)+= as3645a.o
diff --git a/drivers/media/video/s5k4ecgx.c b/drivers/media/video/s5k4ecgx.c
new file mode 100644
index 000..4e57738
--- /dev/null
+++ b/drivers/media/video/s5k4ecgx.c
@@ -0,0 +1,941 @@
+/*
+ * Driver for s5k4ecgx (5MP Camera) from Samsung
+ * a quarter-inch optical format 1.4 micron 5 megapixel (Mp)
+ * CMOS image sensor.
+ *
+ * Copyright (C) 2012, Linaro, Sangwook Lee 
+ * Copyright (C) 2012, Insignal Co,. Ltd,  Homin Lee 
+ *
+ * Based on s5k6aa, noon010pc30 driver
+ * Copyright (C) 2011, Samsung Electronics Co., Ltd.
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "s5k4ecgx_regs.h"
+
+static int debug;
+module_param(debug, int, 0644);
+
+#define S5K4ECGX_DRIVER_NAME   "s5k4ecgx"
+
+#define S5K4ECGX_FIRMWARE  "s5k4ecgx.fw"
+/* Firmware parsing token */
+#define FW_START_TOKEN '{'
+#define FW_END_TOKEN   '}'
+
+/* Firmware revision information */
+#define REG_FW_REVISION0x71a6
+#define REG_FW_VERSION 0x71a4
+#define S5K4ECGX_REVISION_1_1  0x11
+#define S5K4ECGX_FW_VERSION0x4ec0
+
+/* General purpose parameters */
+#define REG_USER_BRIGHTNESS0x722c /* Brigthness */
+#define REG_USER_CONTRAST  0x722e /* Contrast */
+#define REG_USER_SATURATION0x7230 /* Saturation */
+
+#define REG_USER_SHARP10x7a28
+#define REG_USER_SHARP20x7ade
+#define REG_USER_SHARP30x7b94
+#define REG_USER_SHARP40x7c4a
+#define REG_USER_SHARP50x7d00
+
+/* Reduce sharpness range for user space API */
+#define SHARPNESS_DIV  8208
+#define TOK_TERM   0x
+
+/*
+ * FIMXE: This is copied from s5k6aa, because of no information
+ * in s5k4ecgx's datasheet
+ * H/W register Interface (0xd000 - 0xdfff)
+ */
+#define AHB_MSB_ADDR_PTR   0xfcfc
+#define GEN_REG_OFFSH  0xd000
+#define REG_CMDWR_ADDRH0x0028
+#define REG_CMDWR_ADDRL0x002a
+#define REG_CMDRD_ADDRH0x002c
+#define REG_CMDRD_ADDRL0x002e
+#define REG_CMDBUF0_ADDR   0x0f12
+
+/*
+ * Preview size lists supported by sensor
+ */
+static const struct regval_list *prev_regs[] = {
+   s5k4ecgx_176_prev,
+   s5k4ecgx_352_prev,
+   s5k4ecgx_640_prev,
+   s5k4ecgx_720_prev,
+};
+
+struct s5k4ecgx_frmsize {
+   u32 idx; /* Should indicate index of prev_regs */
+   u32 width;
+   u32 height;
+};
+
+/*
+ * TODO: currently only pre

[PATCH v4 1/2] v4l: Add factory register values form S5K4ECGX sensor

2012-08-10 Thread Sangwook Lee
Add preview default settings for S5K4ECGX sensor registers,
which was copied from the reference code of Samsung S.LSI.

Signed-off-by: Sangwook Lee 
---
 drivers/media/video/s5k4ecgx_regs.h |  138 +++
 1 file changed, 138 insertions(+)
 create mode 100644 drivers/media/video/s5k4ecgx_regs.h

diff --git a/drivers/media/video/s5k4ecgx_regs.h 
b/drivers/media/video/s5k4ecgx_regs.h
new file mode 100644
index 000..e99b0e6
--- /dev/null
+++ b/drivers/media/video/s5k4ecgx_regs.h
@@ -0,0 +1,138 @@
+/*
+ * Samsung S5K4ECGX register tables for default values
+ *
+ * Copyright (C) 2012 Linaro
+ * Copyright (C) 2012 Insignal Co,. Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __DRIVERS_MEDIA_VIDEO_S5K4ECGX_H__
+#define __DRIVERS_MEDIA_VIDEO_S5K4ECGX_H__
+
+struct regval_list {
+   u32 addr;
+   u16 val;
+};
+
+/* Configure 720x480 preview size */
+static const struct regval_list s5k4ecgx_720_prev[] = {
+   { 0x7250, 0x0a00 },
+   { 0x7252, 0x06a8 },
+   { 0x7254, 0x0010 },
+   { 0x7256, 0x0078 },
+   { 0x7258, 0x0a00 },
+   { 0x725a, 0x06a8 },
+   { 0x725c, 0x0010 },
+   { 0x725e, 0x0078 },
+   { 0x7494, 0x0a00 },
+
+   /*
+* FIXME: according to the datasheet,
+* 0x7496~ 0x749c seems to be only for capture mode,
+* but without these value, it doesn't work with preview mode.
+*/
+   { 0x7496, 0x06a8 },
+   { 0x7498, 0x },
+   { 0x749a, 0x },
+   { 0x749c, 0x0a00 },
+
+   { 0x749e, 0x06a8 },
+   { 0x72a6, 0x02d0 },
+   { 0x72a8, 0x01e0 },
+   { 0x, 0x }, /* End token */
+};
+
+/* Configure 640x480 preview size */
+static const struct regval_list s5k4ecgx_640_prev[] = {
+   { 0x7250, 0x0a00 },
+   { 0x7252, 0x0780 },
+   { 0x7254, 0x0010 },
+   { 0x7256, 0x000c },
+   { 0x7258, 0x0a00 },
+   { 0x725a, 0x0780 },
+   { 0x725c, 0x0010 },
+   { 0x725e, 0x000c },
+   { 0x7494, 0x0a00 },
+   { 0x7496, 0x0780 },
+   { 0x7498, 0x },
+   { 0x749a, 0x },
+   { 0x749c, 0x0a00 },
+   { 0x749e, 0x0780 },
+   { 0x72a6, 0x0280 },
+   { 0x72a8, 0x01e0 },
+   { 0x, 0x }, /* End token */
+};
+
+/* Configure 352x288 preview size */
+static const struct regval_list s5k4ecgx_352_prev[] = {
+   { 0x7250, 0x0928 },
+   { 0x7252, 0x0780 },
+   { 0x7254, 0x007c },
+   { 0x7256, 0x000c },
+   { 0x7258, 0x0928 },
+   { 0x725a, 0x0780 },
+   { 0x725c, 0x007c },
+   { 0x725e, 0x000c },
+   { 0x7494, 0x0928 },
+   { 0x7496, 0x0780 },
+   { 0x7498, 0x },
+   { 0x749a, 0x },
+   { 0x749c, 0x0928 },
+   { 0x749e, 0x0780 },
+   { 0x72a6, 0x0160 },
+   { 0x72a8, 0x0120 },
+   { 0x, 0x }, /* End token */
+};
+
+/* Configure 176x144 preview size */
+static const struct regval_list s5k4ecgx_176_prev[] = {
+   { 0x7250, 0x0928 },
+   { 0x7252, 0x0780 },
+   { 0x7254, 0x007c },
+   { 0x7256, 0x000c },
+   { 0x7258, 0x0928 },
+   { 0x725a, 0x0780 },
+   { 0x725c, 0x007c },
+   { 0x725e, 0x000c },
+   { 0x7494, 0x0928 },
+   { 0x7496, 0x0780 },
+   { 0x7498, 0x },
+   { 0x749a, 0x },
+   { 0x749c, 0x0928 },
+   { 0x749e, 0x0780 },
+   { 0x72a6, 0x00b0 },
+   { 0x72a8, 0x0090 },
+   { 0x, 0x }, /* End token */
+};
+
+/* Common setting 1 for preview */
+static const struct regval_list s5k4ecgx_com1_prev[] = {
+   { 0x74a0, 0x },
+   { 0x74a2, 0x },
+   { 0x7262, 0x0001 },
+   { 0x7a1e, 0x0028 },
+   { 0x7ad4, 0x003c },
+   { 0x, 0x }, /* End token */
+};
+
+/* Common setting 2 for preview */
+static const struct regval_list s5k4ecgx_com2_prev[] = {
+   { 0x72aa, 0x0005 },
+   { 0x72b4, 0x0052 },
+   { 0x72be, 0x },
+   { 0x72c0, 0x0001 },
+   { 0x72c2, 0x029a },
+   { 0x72c4, 0x014d },
+   { 0x72d0, 0x },
+   { 0x72d2, 0x },
+   { 0x7266, 0x },
+   { 0x726a, 0x0001 },
+   { 0x724e, 0x0001 },
+   { 0x7268, 0x0001 },
+   { 0x, 0x }, /* End token */
+};
+
+#endif /* __DRIVERS_MEDIA_VIDEO_S5K4ECGX_H__ */
-- 
1.7.9.5

--
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 v4 0/2] Add v4l2 subdev driver for S5K4ECGX sensor with embedded SoC ISP

2012-08-10 Thread Sangwook Lee
The following 2 patches add driver for S5K4ECGX sensor with embedded ISP SoC,
and minor v4l2 control API enhancement. S5K4ECGX is 5M CMOS Image sensor from 
Samsung

Changes since v3:
- used request_firmware to configure initial settings
- added parsing functions to read initial settings
- updated regulator API
- reduced preview setting tables by experiment 

Changes since v2:
- added GPIO (reset/stby) and regulators
- updated I2C read/write, based on s5k6aa datasheet
- fixed set_fmt errors
- reduced register tables a bit
- removed vmalloc

Changes since v1:
- fixed s_stream(0) when it called twice
- changed mutex_X position to be used when strictly necessary
- add additional s_power(0) in case that error happens
- update more accurate debugging statements
- remove dummy else

Sangwook Lee (2):
  v4l: Add factory register values form S5K4ECGX sensor
  v4l: Add v4l2 subdev driver for S5K4ECGX sensor

 drivers/media/video/Kconfig |8 +
 drivers/media/video/Makefile|1 +
 drivers/media/video/s5k4ecgx.c  |  941 +++
 drivers/media/video/s5k4ecgx_regs.h |  138 +
 include/media/s5k4ecgx.h|   37 ++
 5 files changed, 1125 insertions(+)
 create mode 100644 drivers/media/video/s5k4ecgx.c
 create mode 100644 drivers/media/video/s5k4ecgx_regs.h
 create mode 100644 include/media/s5k4ecgx.h

-- 
1.7.9.5

--
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] drivers/media/video/mx2_emmaprp.c: use devm_kzalloc and devm_clk_get

2012-08-10 Thread Julia Lawall
From: Julia Lawall 

Using devm_kzalloc and devm_clk_get simplifies the code and ensures that
the use of devm_request_irq is safe.  When kzalloc and kfree were used, the
interrupt could be triggered after the handler's data argument had been
freed.

Add missing return code initializations in the error handling code for
devm_request_and_ioremap and devm_request_irq.

The problem of a free after a devm_request_irq was found using the
following semantic match (http://coccinelle.lip6.fr/)

// 
@r exists@
expression e1,e2,x,a,b,c,d;
identifier free;
position p1,p2;
@@

  devm_request_irq@p1(e1,e2,...,x)
  ... when any
  when != e2 = a
  when != x = b
  if (...) {
... when != e2 = c
when != x = d
free@p2(...,x,...);
...
return ...;
  }
// 

Signed-off-by: Julia Lawall 

---
v2: patch updated to add nearby ret initializations.  Please let me know
if some other constants should be returned on the failure of
devm_request_and_ioremap and devm_request_irq.

 drivers/media/video/mx2_emmaprp.c |   33 -
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/media/video/mx2_emmaprp.c 
b/drivers/media/video/mx2_emmaprp.c
index 5f8a6f5..9fe9ec6 100644
--- a/drivers/media/video/mx2_emmaprp.c
+++ b/drivers/media/video/mx2_emmaprp.c
@@ -874,29 +874,27 @@ static int emmaprp_probe(struct platform_device *pdev)
int irq_emma;
int ret;

-   pcdev = kzalloc(sizeof *pcdev, GFP_KERNEL);
+   pcdev = devm_kzalloc(&pdev->dev, sizeof(*pcdev), GFP_KERNEL);
if (!pcdev)
return -ENOMEM;

spin_lock_init(&pcdev->irqlock);

-   pcdev->clk_emma = clk_get(&pdev->dev, NULL);
+   pcdev->clk_emma = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pcdev->clk_emma)) {
-   ret = PTR_ERR(pcdev->clk_emma);
-   goto free_dev;
+   return PTR_ERR(pcdev->clk_emma);
}

irq_emma = platform_get_irq(pdev, 0);
res_emma = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (irq_emma < 0 || res_emma == NULL) {
dev_err(&pdev->dev, "Missing platform resources data\n");
-   ret = -ENODEV;
-   goto free_clk;
+   return -ENODEV;
}

ret = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
if (ret)
-   goto free_clk;
+   return ret;

mutex_init(&pcdev->dev_mutex);

@@ -922,21 +920,20 @@ static int emmaprp_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, pcdev);

-   if (devm_request_mem_region(&pdev->dev, res_emma->start,
-   resource_size(res_emma), MEM2MEM_NAME) == NULL)
-   goto rel_vdev;
-
-   pcdev->base_emma = devm_ioremap(&pdev->dev, res_emma->start,
-   resource_size(res_emma));
-   if (!pcdev->base_emma)
+   pcdev->base_emma = devm_request_and_ioremap(&pdev->dev, res_emma);
+   if (!pcdev->base_emma) {
+   ret = -ENXIO;
goto rel_vdev;
+   }

pcdev->irq_emma = irq_emma;
pcdev->res_emma = res_emma;

if (devm_request_irq(&pdev->dev, pcdev->irq_emma, emmaprp_irq,
-0, MEM2MEM_NAME, pcdev) < 0)
+0, MEM2MEM_NAME, pcdev) < 0) {
+   ret = -ENODEV;
goto rel_vdev;
+   }

pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev);
if (IS_ERR(pcdev->alloc_ctx)) {
@@ -969,10 +966,6 @@ rel_vdev:
video_device_release(vfd);
 unreg_dev:
v4l2_device_unregister(&pcdev->v4l2_dev);
-free_clk:
-   clk_put(pcdev->clk_emma);
-free_dev:
-   kfree(pcdev);

return ret;
 }
@@ -987,8 +980,6 @@ static int emmaprp_remove(struct platform_device *pdev)
v4l2_m2m_release(pcdev->m2m_dev);
vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx);
v4l2_device_unregister(&pcdev->v4l2_dev);
-   clk_put(pcdev->clk_emma);
-   kfree(pcdev);

return 0;
 }

--
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,RESEND] v4l/s5p-mfc: added support for end of stream handling in MFC encoder

2012-08-10 Thread Kamil Debski
Hi Andrzej,

Thank you for your patch.

Best wishes,
--
Kamil Debski
Linux Platform Group
Samsung Poland R&D Center

> From: Andrzej Hajda [mailto:a.ha...@samsung.com]
> Sent: 10 August 2012 14:47
> 
> s5p-mfc encoder after receiving V4L2_ENC_CMD_STOP command
> will instruct MFC device to release all encoded frames.
> After dequeuing last encoded frame driver will generate
> V4L2_EVENT_EOS event.
> 
> Signed-off-by: Andrzej Hajda 
> Signed-off-by: Kyungmin Park 

Acked-by: Kamil Debski 

> ---
> I have removed bank2 alignement fix from this patch.
> It is is already done by patch 's5p-mfc: Fix second memory bank alignment'.
> ---
>  drivers/media/video/s5p-mfc/s5p_mfc.c|   43 +++
>  drivers/media/video/s5p-mfc/s5p_mfc_common.h |5 +-
>  drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c   |6 +-
>  drivers/media/video/s5p-mfc/s5p_mfc_dec.c|4 +-
>  drivers/media/video/s5p-mfc/s5p_mfc_enc.c|  106
+-
>  drivers/media/video/s5p-mfc/s5p_mfc_opr.c|   48 +---
>  6 files changed, 177 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/media/video/s5p-mfc/s5p_mfc.c
b/drivers/media/video/s5p-
> mfc/s5p_mfc.c
> index 9bb68e7..dc9355c 100644
> --- a/drivers/media/video/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/video/s5p-mfc/s5p_mfc.c
> @@ -19,6 +19,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include "regs-mfc.h"
> @@ -539,6 +540,40 @@ static void s5p_mfc_handle_init_buffers(struct
s5p_mfc_ctx
> *ctx,
>   }
>  }
> 
> +static void s5p_mfc_handle_stream_complete(struct s5p_mfc_ctx *ctx,
> +  unsigned int reason, unsigned int err)
> +{
> + struct s5p_mfc_dev *dev = ctx->dev;
> + struct s5p_mfc_buf *mb_entry;
> +
> + mfc_debug(2, "Stream completed");
> +
> + s5p_mfc_clear_int_flags(dev);
> + ctx->int_type = reason;
> + ctx->int_err = err;
> + ctx->state = MFCINST_FINISHED;
> +
> + spin_lock(&dev->irqlock);
> + if (!list_empty(&ctx->dst_queue)) {
> + mb_entry = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf,
> + list);
> + list_del(&mb_entry->list);
> + ctx->dst_queue_cnt--;
> + vb2_set_plane_payload(mb_entry->b, 0, 0);
> + vb2_buffer_done(mb_entry->b, VB2_BUF_STATE_DONE);
> + }
> + spin_unlock(&dev->irqlock);
> +
> + clear_work_bit(ctx);
> +
> + if (test_and_clear_bit(0, &dev->hw_lock) == 0)
> + WARN_ON(1);
> +
> + s5p_mfc_clock_off();
> + wake_up(&ctx->queue);
> + s5p_mfc_try_run(dev);
> +}
> +
>  /* Interrupt processing */
>  static irqreturn_t s5p_mfc_irq(int irq, void *priv)
>  {
> @@ -614,6 +649,11 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
>   case S5P_FIMV_R2H_CMD_INIT_BUFFERS_RET:
>   s5p_mfc_handle_init_buffers(ctx, reason, err);
>   break;
> +
> + case S5P_FIMV_R2H_CMD_ENC_COMPLETE_RET:
> + s5p_mfc_handle_stream_complete(ctx, reason, err);
> + break;
> +
>   default:
>   mfc_debug(2, "Unknown int reason\n");
>   s5p_mfc_clear_int_flags(dev);
> @@ -882,9 +922,12 @@ static unsigned int s5p_mfc_poll(struct file *file,
>   goto end;
>   }
>   mutex_unlock(&dev->mfc_mutex);
> + poll_wait(file, &ctx->fh.wait, wait);
>   poll_wait(file, &src_q->done_wq, wait);
>   poll_wait(file, &dst_q->done_wq, wait);
>   mutex_lock(&dev->mfc_mutex);
> + if (v4l2_event_pending(&ctx->fh))
> + rc |= POLLPRI;
>   spin_lock_irqsave(&src_q->done_lock, flags);
>   if (!list_empty(&src_q->done_list))
>   src_vb = list_first_entry(&src_q->done_list, struct
vb2_buffer,
> diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_common.h
> b/drivers/media/video/s5p-mfc/s5p_mfc_common.h
> index bd5706a..8871f0d 100644
> --- a/drivers/media/video/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/video/s5p-mfc/s5p_mfc_common.h
> @@ -146,6 +146,9 @@ enum s5p_mfc_decode_arg {
>   MFC_DEC_RES_CHANGE,
>  };
> 
> +#define MFC_BUF_FLAG_USED(1 << 0)
> +#define MFC_BUF_FLAG_EOS (1 << 1)
> +
>  struct s5p_mfc_ctx;
> 
>  /**
> @@ -161,7 +164,7 @@ struct s5p_mfc_buf {
>   } raw;
>   size_t stream;
>   } cookie;
> - int used;
> + int flags;
>  };
> 
>  /**
> diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
> b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
> index 08a5cfe..002af2b 100644
> --- a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
> +++ b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
> @@ -98,7 +98,11 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev
*dev)
>   release_firmware(fw_blob);
>   return -EIO;
>   }
> - dev->bank2 = bank2_base_phys;
> + /* Valid buffers passed to MFC encoder with LAST_FRAME command
> +  * should not have address of bank2 - MFC will treat

[PATCHv2 1/2] Add libv4l2rds library

2012-08-10 Thread Konke Radlow

Signed-off-by: Konke Radlow 
---
 Makefile.am |3 +-
 configure.ac|2 +
 lib/include/libv4l2rds.h|  218 +
 lib/libv4l2rds/Makefile.am  |   11 +
 lib/libv4l2rds/libv4l2rds.c |  964 +++
 lib/libv4l2rds/libv4l2rds.pc.in |   11 +
 6 files changed, 1208 insertions(+), 1 deletion(-)
 create mode 100644 lib/include/libv4l2rds.h
 create mode 100644 lib/libv4l2rds/Makefile.am
 create mode 100644 lib/libv4l2rds/libv4l2rds.c
 create mode 100644 lib/libv4l2rds/libv4l2rds.pc.in

diff --git a/Makefile.am b/Makefile.am
index a754955..621d8d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,8 @@ SUBDIRS = \
lib/libv4lconvert \
lib/libv4l2 \
lib/libv4l1 \
-   lib/libdvbv5
+   lib/libdvbv5 \
+   lib/libv4l2rds
 
 if WITH_V4LUTILS
 SUBDIRS += \
diff --git a/configure.ac b/configure.ac
index 8ddcc9d..bc9ba14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,7 @@ AC_CONFIG_FILES([Makefile
lib/libv4l2/Makefile
lib/libv4l1/Makefile
lib/libdvbv5/Makefile
+   lib/libv4l2rds/Makefile
 
utils/libv4l2util/Makefile
utils/libmedia_dev/Makefile
@@ -36,6 +37,7 @@ AC_CONFIG_FILES([Makefile
lib/libv4l1/libv4l1.pc
lib/libv4l2/libv4l2.pc
lib/libdvbv5/libdvbv5.pc
+   lib/libv4l2rds/libv4l2rds.pc
 ])
 
 AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2 -Wno-portability]) # 1.10 is 
needed for target_LIBTOOLFLAGS
diff --git a/lib/include/libv4l2rds.h b/lib/include/libv4l2rds.h
new file mode 100644
index 000..37bdd2f
--- /dev/null
+++ b/lib/include/libv4l2rds.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ * Author: Konke Radlow 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+ */
+
+#ifndef __LIBV4L2RDS
+#define __LIBV4L2RDS
+
+
+#include 
+#include 
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#if HAVE_VISIBILITY
+#define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
+#else
+#define LIBV4L_PUBLIC
+#endif
+
+/* used to define the current version (version field) of the v4l2_rds struct */
+#define V4L2_RDS_VERSION (1)
+
+/* Constants used to define the size of arrays used to store RDS information */
+#define MAX_ODA_CNT 18 /* there are 16 groups each with type a or b. 
Of these
+* 32 distinct groups, 18 can be used for ODA purposes 
*/
+#define MAX_AF_CNT 25  /* AF Method A allows a maximum of 25 AFs to be defined
+* AF Method B does not impose a limit on the number of 
AFs
+* but it is not fully supported at the moment and will
+* not receive more than 25 AFs */
+
+/* Define Constants for the possible types of RDS information
+ * used to address the relevant bit in the valid_fields bitmask */
+#define V4L2_RDS_PI0x01/* Program Identification */
+#define V4L2_RDS_PTY   0x02/* Program Type */
+#define V4L2_RDS_TP0x04/* Traffic Program */
+#define V4L2_RDS_PS0x08/* Program Service Name */
+#define V4L2_RDS_TA0x10/* Traffic Announcement */
+#define V4L2_RDS_DI0x20/* Decoder Information */
+#define V4L2_RDS_MS0x40/* Music / Speech flag */
+#define V4L2_RDS_PTYN  0x80/* Program Type Name */
+#define V4L2_RDS_RT0x100   /* Radio-Text */
+#define V4L2_RDS_TIME  0x200   /* Date and Time information */
+#define V4L2_RDS_TMC   0x400   /* TMC availability */
+#define V4L2_RDS_AF0x800   /* AF (alternative freq) available */
+#define V4L2_RDS_ECC   0x1000  /* Extended County Code */
+#define V4L2_RDS_LC0x2000  /* Language Code */
+
+/* Define Constants for the state of the RDS decoding process
+ * used to address the relevant bit in the decode_information bitmask */
+#define V4L2_RDS_GROUP_NEW 0x01/* New group received */
+#define V4L2_RDS_ODA   0x02/* Open Data Group announced */
+
+/* Decoder Information (DI) codes
+ * used to decode the DI information according to the RDS standard */
+#define V4L2_RDS_FLAG_STEREO   0x01
+#define V4L2_RDS_FLAG_AR

[PATCHv2 2/2] Add rds-ctl tool

2012-08-10 Thread Konke Radlow

Signed-off-by: Konke Radlow 
---
 Makefile.am   |3 +-
 configure.ac  |1 +
 utils/rds-ctl/Makefile.am |5 +
 utils/rds-ctl/rds-ctl.cpp |  938 +
 4 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 utils/rds-ctl/Makefile.am
 create mode 100644 utils/rds-ctl/rds-ctl.cpp

diff --git a/Makefile.am b/Makefile.am
index 621d8d9..8ef0d00 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,8 @@ SUBDIRS += \
utils/v4l2-compliance \
utils/v4l2-ctl \
utils/v4l2-dbg \
-   utils/v4l2-sysfs-path
+   utils/v4l2-sysfs-path \
+   utils/rds-ctl
 
 if LINUX_OS
 SUBDIRS += \
diff --git a/configure.ac b/configure.ac
index bc9ba14..a1d26b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,7 @@ AC_CONFIG_FILES([Makefile
utils/v4l2-sysfs-path/Makefile
utils/xc3028-firmware/Makefile
utils/qv4l2/Makefile
+   utils/rds-ctl/Makefile
 
contrib/freebsd/Makefile
contrib/test/Makefile
diff --git a/utils/rds-ctl/Makefile.am b/utils/rds-ctl/Makefile.am
new file mode 100644
index 000..9a84257
--- /dev/null
+++ b/utils/rds-ctl/Makefile.am
@@ -0,0 +1,5 @@
+bin_PROGRAMS = rds-ctl
+
+rds_ctl_SOURCES = rds-ctl.cpp
+rds_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4l2rds/libv4l2rds.la
+
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
new file mode 100644
index 000..262773c
--- /dev/null
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -0,0 +1,938 @@
+/*
+ * rds-ctl.cpp is based on v4l2-ctl.cpp
+ *
+ * the following applies for all RDS related parts:
+ * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ * Author: Konke Radlow 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0])))
+
+typedef std::vector dev_vec;
+typedef std::map dev_map;
+
+/* Short option list
+
+   Please keep in alphabetical order.
+   That makes it easier to see which short options are still free.
+
+   In general the lower case is used to set something and the upper
+   case is used to retrieve a setting. */
+enum Option {
+   OptSetDevice = 'd',
+   OptGetDriverInfo = 'D',
+   OptGetFreq = 'F',
+   OptSetFreq = 'f',
+   OptHelp = 'h',
+   OptReadRds = 'R',
+   OptGetTuner = 'T',
+   OptSetTuner = 't',
+   OptUseWrapper = 'w',
+   OptAll = 128,
+   OptFreqSeek,
+   OptListDevices,
+   OptListFreqBands,
+   OptOpenFile,
+   OptPrintBlock,
+   OptSilent,
+   OptTunerIndex,
+   OptVerbose,
+   OptWaitLimit,
+   OptLast = 256
+};
+
+struct ctl_parameters {
+   bool terminate_decoding;
+   char options[OptLast];
+   char fd_name[80];
+   bool filemode_active;
+   double freq;
+   uint32_t wait_limit;
+   uint8_t tuner_index;
+   struct v4l2_hw_freq_seek freq_seek;
+};
+
+static struct ctl_parameters params;
+static int app_result;
+
+static struct option long_options[] = {
+   {"all", no_argument, 0, OptAll},
+   {"device", required_argument, 0, OptSetDevice},
+   {"file", required_argument, 0, OptOpenFile},
+   {"freq-seek", required_argument, 0, OptFreqSeek},
+   {"get-freq", no_argument, 0, OptGetFreq},
+   {"get-tuner", no_argument, 0, OptGetTuner},
+   {"help", no_argument, 0, OptHelp},
+   {"info", no_argument, 0, OptGetDriverInfo},
+   {"list-devices", no_argument, 0, OptListDevices},
+   {"list-freq-bands", no_argument, 0, OptListFreqBands},
+   {"print-block", no_argument, 0, OptPrintBlock},
+   {"read-rds", no_argument, 0, OptReadRds},
+   {"set-freq", required_argument, 0, OptSetFreq},
+   {"tuner-index", required_argument, 0, OptTunerIndex},
+   {"verbose", no_argument, 0, OptVerbose},
+   {"wait-limit", required_argument, 0, OptWaitLimit},
+   {"wrapper", no_argument, 0, OptUseWrapper},
+   {0, 0, 0, 0}
+};
+
+static void usage_hint(void)

[PATCHv2 0/2] Add support for RDS decoding

2012-08-10 Thread Konke Radlow
Hello,
after the positive feedback from the last RFC session, here now a patch
including all minor changes that were proposed.

embarrassingly, I missed a minor bug introduced by removing the version 
field from the v4l2_rds struct, hence the resend
 
Regards,
Konke

--
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] Add rds-ctl tool

2012-08-10 Thread Konke Radlow

Signed-off-by: Konke Radlow 
---
 Makefile.am   |3 +-
 configure.ac  |1 +
 utils/rds-ctl/Makefile.am |5 +
 utils/rds-ctl/rds-ctl.cpp |  938 +
 4 files changed, 946 insertions(+), 1 deletion(-)
 create mode 100644 utils/rds-ctl/Makefile.am
 create mode 100644 utils/rds-ctl/rds-ctl.cpp

diff --git a/Makefile.am b/Makefile.am
index 621d8d9..8ef0d00 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,8 @@ SUBDIRS += \
utils/v4l2-compliance \
utils/v4l2-ctl \
utils/v4l2-dbg \
-   utils/v4l2-sysfs-path
+   utils/v4l2-sysfs-path \
+   utils/rds-ctl
 
 if LINUX_OS
 SUBDIRS += \
diff --git a/configure.ac b/configure.ac
index bc9ba14..a1d26b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,6 +28,7 @@ AC_CONFIG_FILES([Makefile
utils/v4l2-sysfs-path/Makefile
utils/xc3028-firmware/Makefile
utils/qv4l2/Makefile
+   utils/rds-ctl/Makefile
 
contrib/freebsd/Makefile
contrib/test/Makefile
diff --git a/utils/rds-ctl/Makefile.am b/utils/rds-ctl/Makefile.am
new file mode 100644
index 000..9a84257
--- /dev/null
+++ b/utils/rds-ctl/Makefile.am
@@ -0,0 +1,5 @@
+bin_PROGRAMS = rds-ctl
+
+rds_ctl_SOURCES = rds-ctl.cpp
+rds_ctl_LDADD = ../../lib/libv4l2/libv4l2.la ../../lib/libv4l2rds/libv4l2rds.la
+
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
new file mode 100644
index 000..262773c
--- /dev/null
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -0,0 +1,938 @@
+/*
+ * rds-ctl.cpp is based on v4l2-ctl.cpp
+ *
+ * the following applies for all RDS related parts:
+ * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ * Author: Konke Radlow 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0])))
+
+typedef std::vector dev_vec;
+typedef std::map dev_map;
+
+/* Short option list
+
+   Please keep in alphabetical order.
+   That makes it easier to see which short options are still free.
+
+   In general the lower case is used to set something and the upper
+   case is used to retrieve a setting. */
+enum Option {
+   OptSetDevice = 'd',
+   OptGetDriverInfo = 'D',
+   OptGetFreq = 'F',
+   OptSetFreq = 'f',
+   OptHelp = 'h',
+   OptReadRds = 'R',
+   OptGetTuner = 'T',
+   OptSetTuner = 't',
+   OptUseWrapper = 'w',
+   OptAll = 128,
+   OptFreqSeek,
+   OptListDevices,
+   OptListFreqBands,
+   OptOpenFile,
+   OptPrintBlock,
+   OptSilent,
+   OptTunerIndex,
+   OptVerbose,
+   OptWaitLimit,
+   OptLast = 256
+};
+
+struct ctl_parameters {
+   bool terminate_decoding;
+   char options[OptLast];
+   char fd_name[80];
+   bool filemode_active;
+   double freq;
+   uint32_t wait_limit;
+   uint8_t tuner_index;
+   struct v4l2_hw_freq_seek freq_seek;
+};
+
+static struct ctl_parameters params;
+static int app_result;
+
+static struct option long_options[] = {
+   {"all", no_argument, 0, OptAll},
+   {"device", required_argument, 0, OptSetDevice},
+   {"file", required_argument, 0, OptOpenFile},
+   {"freq-seek", required_argument, 0, OptFreqSeek},
+   {"get-freq", no_argument, 0, OptGetFreq},
+   {"get-tuner", no_argument, 0, OptGetTuner},
+   {"help", no_argument, 0, OptHelp},
+   {"info", no_argument, 0, OptGetDriverInfo},
+   {"list-devices", no_argument, 0, OptListDevices},
+   {"list-freq-bands", no_argument, 0, OptListFreqBands},
+   {"print-block", no_argument, 0, OptPrintBlock},
+   {"read-rds", no_argument, 0, OptReadRds},
+   {"set-freq", required_argument, 0, OptSetFreq},
+   {"tuner-index", required_argument, 0, OptTunerIndex},
+   {"verbose", no_argument, 0, OptVerbose},
+   {"wait-limit", required_argument, 0, OptWaitLimit},
+   {"wrapper", no_argument, 0, OptUseWrapper},
+   {0, 0, 0, 0}
+};
+
+static void usage_hint(void)

[PATCH 1/2] Add libv4l2rds library

2012-08-10 Thread Konke Radlow

Signed-off-by: Konke Radlow 
---
 Makefile.am |3 +-
 configure.ac|2 +
 lib/include/libv4l2rds.h|  218 +
 lib/libv4l2rds/Makefile.am  |   11 +
 lib/libv4l2rds/libv4l2rds.c |  965 +++
 lib/libv4l2rds/libv4l2rds.pc.in |   11 +
 6 files changed, 1209 insertions(+), 1 deletion(-)
 create mode 100644 lib/include/libv4l2rds.h
 create mode 100644 lib/libv4l2rds/Makefile.am
 create mode 100644 lib/libv4l2rds/libv4l2rds.c
 create mode 100644 lib/libv4l2rds/libv4l2rds.pc.in

diff --git a/Makefile.am b/Makefile.am
index a754955..621d8d9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,7 +5,8 @@ SUBDIRS = \
lib/libv4lconvert \
lib/libv4l2 \
lib/libv4l1 \
-   lib/libdvbv5
+   lib/libdvbv5 \
+   lib/libv4l2rds
 
 if WITH_V4LUTILS
 SUBDIRS += \
diff --git a/configure.ac b/configure.ac
index 8ddcc9d..bc9ba14 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,7 @@ AC_CONFIG_FILES([Makefile
lib/libv4l2/Makefile
lib/libv4l1/Makefile
lib/libdvbv5/Makefile
+   lib/libv4l2rds/Makefile
 
utils/libv4l2util/Makefile
utils/libmedia_dev/Makefile
@@ -36,6 +37,7 @@ AC_CONFIG_FILES([Makefile
lib/libv4l1/libv4l1.pc
lib/libv4l2/libv4l2.pc
lib/libdvbv5/libdvbv5.pc
+   lib/libv4l2rds/libv4l2rds.pc
 ])
 
 AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2 -Wno-portability]) # 1.10 is 
needed for target_LIBTOOLFLAGS
diff --git a/lib/include/libv4l2rds.h b/lib/include/libv4l2rds.h
new file mode 100644
index 000..37bdd2f
--- /dev/null
+++ b/lib/include/libv4l2rds.h
@@ -0,0 +1,218 @@
+/*
+ * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ * Author: Konke Radlow 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+ */
+
+#ifndef __LIBV4L2RDS
+#define __LIBV4L2RDS
+
+
+#include 
+#include 
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#if HAVE_VISIBILITY
+#define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
+#else
+#define LIBV4L_PUBLIC
+#endif
+
+/* used to define the current version (version field) of the v4l2_rds struct */
+#define V4L2_RDS_VERSION (1)
+
+/* Constants used to define the size of arrays used to store RDS information */
+#define MAX_ODA_CNT 18 /* there are 16 groups each with type a or b. 
Of these
+* 32 distinct groups, 18 can be used for ODA purposes 
*/
+#define MAX_AF_CNT 25  /* AF Method A allows a maximum of 25 AFs to be defined
+* AF Method B does not impose a limit on the number of 
AFs
+* but it is not fully supported at the moment and will
+* not receive more than 25 AFs */
+
+/* Define Constants for the possible types of RDS information
+ * used to address the relevant bit in the valid_fields bitmask */
+#define V4L2_RDS_PI0x01/* Program Identification */
+#define V4L2_RDS_PTY   0x02/* Program Type */
+#define V4L2_RDS_TP0x04/* Traffic Program */
+#define V4L2_RDS_PS0x08/* Program Service Name */
+#define V4L2_RDS_TA0x10/* Traffic Announcement */
+#define V4L2_RDS_DI0x20/* Decoder Information */
+#define V4L2_RDS_MS0x40/* Music / Speech flag */
+#define V4L2_RDS_PTYN  0x80/* Program Type Name */
+#define V4L2_RDS_RT0x100   /* Radio-Text */
+#define V4L2_RDS_TIME  0x200   /* Date and Time information */
+#define V4L2_RDS_TMC   0x400   /* TMC availability */
+#define V4L2_RDS_AF0x800   /* AF (alternative freq) available */
+#define V4L2_RDS_ECC   0x1000  /* Extended County Code */
+#define V4L2_RDS_LC0x2000  /* Language Code */
+
+/* Define Constants for the state of the RDS decoding process
+ * used to address the relevant bit in the decode_information bitmask */
+#define V4L2_RDS_GROUP_NEW 0x01/* New group received */
+#define V4L2_RDS_ODA   0x02/* Open Data Group announced */
+
+/* Decoder Information (DI) codes
+ * used to decode the DI information according to the RDS standard */
+#define V4L2_RDS_FLAG_STEREO   0x01
+#define V4L2_RDS_FLAG_AR

[PATCH 0/2] Add support for RDS decoding

2012-08-10 Thread Konke Radlow
Hello,
after the positive feedback from the last RFC session, here now a patch
including all minor changes that were proposed.

Regards,
Konke

--
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,RESEND] v4l/s5p-mfc: added support for end of stream handling in MFC encoder

2012-08-10 Thread Andrzej Hajda
s5p-mfc encoder after receiving V4L2_ENC_CMD_STOP command
will instruct MFC device to release all encoded frames.
After dequeuing last encoded frame driver will generate
V4L2_EVENT_EOS event.

Signed-off-by: Andrzej Hajda 
Signed-off-by: Kyungmin Park 
---
I have removed bank2 alignement fix from this patch.
It is is already done by patch 's5p-mfc: Fix second memory bank alignment'.
---
 drivers/media/video/s5p-mfc/s5p_mfc.c|   43 +++
 drivers/media/video/s5p-mfc/s5p_mfc_common.h |5 +-
 drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c   |6 +-
 drivers/media/video/s5p-mfc/s5p_mfc_dec.c|4 +-
 drivers/media/video/s5p-mfc/s5p_mfc_enc.c|  106 +-
 drivers/media/video/s5p-mfc/s5p_mfc_opr.c|   48 +---
 6 files changed, 177 insertions(+), 35 deletions(-)

diff --git a/drivers/media/video/s5p-mfc/s5p_mfc.c 
b/drivers/media/video/s5p-mfc/s5p_mfc.c
index 9bb68e7..dc9355c 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "regs-mfc.h"
@@ -539,6 +540,40 @@ static void s5p_mfc_handle_init_buffers(struct s5p_mfc_ctx 
*ctx,
}
 }
 
+static void s5p_mfc_handle_stream_complete(struct s5p_mfc_ctx *ctx,
+unsigned int reason, unsigned int err)
+{
+   struct s5p_mfc_dev *dev = ctx->dev;
+   struct s5p_mfc_buf *mb_entry;
+
+   mfc_debug(2, "Stream completed");
+
+   s5p_mfc_clear_int_flags(dev);
+   ctx->int_type = reason;
+   ctx->int_err = err;
+   ctx->state = MFCINST_FINISHED;
+
+   spin_lock(&dev->irqlock);
+   if (!list_empty(&ctx->dst_queue)) {
+   mb_entry = list_entry(ctx->dst_queue.next, struct s5p_mfc_buf,
+   list);
+   list_del(&mb_entry->list);
+   ctx->dst_queue_cnt--;
+   vb2_set_plane_payload(mb_entry->b, 0, 0);
+   vb2_buffer_done(mb_entry->b, VB2_BUF_STATE_DONE);
+   }
+   spin_unlock(&dev->irqlock);
+
+   clear_work_bit(ctx);
+
+   if (test_and_clear_bit(0, &dev->hw_lock) == 0)
+   WARN_ON(1);
+
+   s5p_mfc_clock_off();
+   wake_up(&ctx->queue);
+   s5p_mfc_try_run(dev);
+}
+
 /* Interrupt processing */
 static irqreturn_t s5p_mfc_irq(int irq, void *priv)
 {
@@ -614,6 +649,11 @@ static irqreturn_t s5p_mfc_irq(int irq, void *priv)
case S5P_FIMV_R2H_CMD_INIT_BUFFERS_RET:
s5p_mfc_handle_init_buffers(ctx, reason, err);
break;
+
+   case S5P_FIMV_R2H_CMD_ENC_COMPLETE_RET:
+   s5p_mfc_handle_stream_complete(ctx, reason, err);
+   break;
+
default:
mfc_debug(2, "Unknown int reason\n");
s5p_mfc_clear_int_flags(dev);
@@ -882,9 +922,12 @@ static unsigned int s5p_mfc_poll(struct file *file,
goto end;
}
mutex_unlock(&dev->mfc_mutex);
+   poll_wait(file, &ctx->fh.wait, wait);
poll_wait(file, &src_q->done_wq, wait);
poll_wait(file, &dst_q->done_wq, wait);
mutex_lock(&dev->mfc_mutex);
+   if (v4l2_event_pending(&ctx->fh))
+   rc |= POLLPRI;
spin_lock_irqsave(&src_q->done_lock, flags);
if (!list_empty(&src_q->done_list))
src_vb = list_first_entry(&src_q->done_list, struct vb2_buffer,
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/video/s5p-mfc/s5p_mfc_common.h
index bd5706a..8871f0d 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_common.h
@@ -146,6 +146,9 @@ enum s5p_mfc_decode_arg {
MFC_DEC_RES_CHANGE,
 };
 
+#define MFC_BUF_FLAG_USED  (1 << 0)
+#define MFC_BUF_FLAG_EOS   (1 << 1)
+
 struct s5p_mfc_ctx;
 
 /**
@@ -161,7 +164,7 @@ struct s5p_mfc_buf {
} raw;
size_t stream;
} cookie;
-   int used;
+   int flags;
 };
 
 /**
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
index 08a5cfe..002af2b 100644
--- a/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/video/s5p-mfc/s5p_mfc_ctrl.c
@@ -98,7 +98,11 @@ int s5p_mfc_alloc_and_load_firmware(struct s5p_mfc_dev *dev)
release_firmware(fw_blob);
return -EIO;
}
-   dev->bank2 = bank2_base_phys;
+   /* Valid buffers passed to MFC encoder with LAST_FRAME command
+* should not have address of bank2 - MFC will treat it as a null frame.
+* To avoid such situation we set bank2 address below the pool address.
+*/
+   dev->bank2 = bank2_base_phys - (1 << MFC_BASE_ALIGN_ORDER);
memcpy(s5p_mfc_bitproc_virt, fw_blob->data, fw_blob->size);
wmb();
release_firmware(fw_blob);
diff --git a/drivers/media/video/s5p-mfc/s5p_mfc_dec.c 
b/drivers/medi

[PATCH 2/2] [media] s5p-tv: Use devm_* functions in sii9234_drv.c file

2012-08-10 Thread Sachin Kamat
devm_* functions are device managed functions and make error handling
and cleanup cleaner and simpler.

Signed-off-by: Sachin Kamat 
---
 drivers/media/video/s5p-tv/sii9234_drv.c |   17 -
 1 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/media/video/s5p-tv/sii9234_drv.c 
b/drivers/media/video/s5p-tv/sii9234_drv.c
index 6d348f9..716d484 100644
--- a/drivers/media/video/s5p-tv/sii9234_drv.c
+++ b/drivers/media/video/s5p-tv/sii9234_drv.c
@@ -323,7 +323,7 @@ static int __devinit sii9234_probe(struct i2c_client 
*client,
struct sii9234_context *ctx;
int ret;
 
-   ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+   ctx = devm_kzalloc(&client->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) {
dev_err(dev, "out of memory\n");
ret = -ENOMEM;
@@ -331,18 +331,17 @@ static int __devinit sii9234_probe(struct i2c_client 
*client,
}
ctx->client = client;
 
-   ctx->power = regulator_get(dev, "hdmi-en");
+   ctx->power = devm_regulator_get(dev, "hdmi-en");
if (IS_ERR(ctx->power)) {
dev_err(dev, "failed to acquire regulator hdmi-en\n");
-   ret = PTR_ERR(ctx->power);
-   goto fail_ctx;
+   return PTR_ERR(ctx->power);
}
 
ctx->gpio_n_reset = pdata->gpio_n_reset;
ret = gpio_request(ctx->gpio_n_reset, "MHL_RST");
if (ret) {
dev_err(dev, "failed to acquire MHL_RST gpio\n");
-   goto fail_power;
+   return ret;
}
 
v4l2_i2c_subdev_init(&ctx->sd, client, &sii9234_ops);
@@ -373,12 +372,6 @@ fail_pm:
pm_runtime_disable(dev);
gpio_free(ctx->gpio_n_reset);
 
-fail_power:
-   regulator_put(ctx->power);
-
-fail_ctx:
-   kfree(ctx);
-
 fail:
dev_err(dev, "probe failed\n");
 
@@ -393,8 +386,6 @@ static int __devexit sii9234_remove(struct i2c_client 
*client)
 
pm_runtime_disable(dev);
gpio_free(ctx->gpio_n_reset);
-   regulator_put(ctx->power);
-   kfree(ctx);
 
dev_info(dev, "remove successful\n");
 
-- 
1.7.4.1

--
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/2] [media] s5p-tv: Use devm_regulator_get() in sdo_drv.c file

2012-08-10 Thread Sachin Kamat
devm_regulator_get() is a device managed function and makes the exit code
a bit simpler and cleaner.

Signed-off-by: Sachin Kamat 
---
 drivers/media/video/s5p-tv/sdo_drv.c |   10 +++---
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/media/video/s5p-tv/sdo_drv.c 
b/drivers/media/video/s5p-tv/sdo_drv.c
index f6bca2c..ad68bbe 100644
--- a/drivers/media/video/s5p-tv/sdo_drv.c
+++ b/drivers/media/video/s5p-tv/sdo_drv.c
@@ -374,15 +374,15 @@ static int __devinit sdo_probe(struct platform_device 
*pdev)
dev_info(dev, "fout_vpll.rate = %lu\n", clk_get_rate(sclk_vpll));
 
/* acquire regulator */
-   sdev->vdac = regulator_get(dev, "vdd33a_dac");
+   sdev->vdac = devm_regulator_get(dev, "vdd33a_dac");
if (IS_ERR_OR_NULL(sdev->vdac)) {
dev_err(dev, "failed to get regulator 'vdac'\n");
goto fail_fout_vpll;
}
-   sdev->vdet = regulator_get(dev, "vdet");
+   sdev->vdet = devm_regulator_get(dev, "vdet");
if (IS_ERR_OR_NULL(sdev->vdet)) {
dev_err(dev, "failed to get regulator 'vdet'\n");
-   goto fail_vdac;
+   goto fail_fout_vpll;
}
 
/* enable gate for dac clock, because mixer uses it */
@@ -406,8 +406,6 @@ static int __devinit sdo_probe(struct platform_device *pdev)
dev_info(dev, "probe succeeded\n");
return 0;
 
-fail_vdac:
-   regulator_put(sdev->vdac);
 fail_fout_vpll:
clk_put(sdev->fout_vpll);
 fail_dacphy:
@@ -428,8 +426,6 @@ static int __devexit sdo_remove(struct platform_device 
*pdev)
 
pm_runtime_disable(&pdev->dev);
clk_disable(sdev->dac);
-   regulator_put(sdev->vdet);
-   regulator_put(sdev->vdac);
clk_put(sdev->fout_vpll);
clk_put(sdev->dacphy);
clk_put(sdev->dac);
-- 
1.7.4.1

--
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


[RFCv3 PATCH 8/8] ad9389b: driver for the Analog Devices AD9389B video encoder.

2012-08-10 Thread Hans Verkuil
Initial version of this driver.

The full datasheets are available from the Analog Devices website:

  http://ez.analog.com/docs/DOC-1741

Not all features of the receiver are supported by this driver for various
reasons. Most notably:

- No CEC support (the CEC API needs a lot more discussion)
- No HDCP repeater support (we don't use that either)

I'm sure that there are more things missing, but this driver does work
well for our hardware.

Note that I am using the register addresses instead of register names: the
datasheet containing the register descriptions is organized by register
address. Using names would make the datasheet lookup very hard. An attempt
was made to try and document what is being done when registers are used
instead.

Signed-off-by: Hans Verkuil 
---
 drivers/media/video/Kconfig |   11 +
 drivers/media/video/Makefile|1 +
 drivers/media/video/ad9389b.c   | 1328 +++
 include/media/ad9389b.h |   49 ++
 include/media/v4l2-chip-ident.h |3 +
 5 files changed, 1392 insertions(+)
 create mode 100644 drivers/media/video/ad9389b.c
 create mode 100644 include/media/ad9389b.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 6d92d2d..f2b623d 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -483,6 +483,17 @@ config VIDEO_ADV7393
  To compile this driver as a module, choose M here: the
  module will be called adv7393.
 
+config VIDEO_AD9389B
+   tristate "Analog Devices AD9389B encoder"
+   depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
+   ---help---
+ Support for the Analog Devices AD9389B video encoder.
+
+ This is a Analog Devices HDMI transmitter.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ad9389b.
+
 config VIDEO_AK881X
tristate "AK8813/AK8814 video encoders"
depends on I2C
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 133dd9b..7cb5cef 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_VIDEO_ADV7183) += adv7183.o
 obj-$(CONFIG_VIDEO_ADV7343) += adv7343.o
 obj-$(CONFIG_VIDEO_ADV7393) += adv7393.o
 obj-$(CONFIG_VIDEO_ADV7604) += adv7604.o
+obj-$(CONFIG_VIDEO_AD9389B) += ad9389b.o
 obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o
 obj-$(CONFIG_VIDEO_VS6624)  += vs6624.o
 obj-$(CONFIG_VIDEO_BT819) += bt819.o
diff --git a/drivers/media/video/ad9389b.c b/drivers/media/video/ad9389b.c
new file mode 100644
index 000..c2886b6
--- /dev/null
+++ b/drivers/media/video/ad9389b.c
@@ -0,0 +1,1328 @@
+/*
+ * Analog Devices AD9389B/AD9889B video encoder driver
+ *
+ * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ *
+ * This program is free software; you may redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/*
+ * References (c = chapter, p = page):
+ * REF_01 - Analog Devices, Programming Guide, AD9889B/AD9389B,
+ * HDMI Transitter, Rev. A, October 2010
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "debug level (0-2)");
+
+MODULE_DESCRIPTION("Analog Devices AD9389B/AD9889B video encoder driver");
+MODULE_AUTHOR("Hans Verkuil ");
+MODULE_AUTHOR("Martin Bugge ");
+MODULE_LICENSE("GPL");
+
+#define MASK_AD9389B_EDID_RDY_INT   0x04
+#define MASK_AD9389B_MSEN_INT   0x40
+#define MASK_AD9389B_HPD_INT0x80
+
+#define MASK_AD9389B_HPD_DETECT 0x40
+#define MASK_AD9389B_MSEN_DETECT0x20
+#define MASK_AD9389B_EDID_RDY   0x10
+
+#define EDID_MAX_RETRIES (8)
+#define EDID_DELAY 250
+#define EDID_MAX_SEGM 8
+
+/*
+**
+*
+*  Arrays with configuration parameters for the AD9389B
+*
+**
+*/
+
+struct i2c_reg_value {
+   u8 reg;
+   u8 value;
+};
+
+struct ad9389b_state_edid {
+   /* total number of blocks */
+   u32 blocks;
+   /* Number of segments read */
+   u32 segments;
+   u8 data[EDID_MAX_SEGM * 256];
+   /* Number of EDID read retries left */
+   unsigned read_retries;
+};
+
+struct ad938

[RFCv3 PATCH 6/8] v4l2-common: add CVT and GTF detection functions.

2012-08-10 Thread Hans Verkuil
These two helper functions detect whether the analog video timings detected
by the video receiver match the VESA CVT or GTF standards.

They basically do the inverse of the CVT and GTF modeline calculations.

This patch also adds a helper function that will determine the aspect ratio
based on the provided EDID values. This aspect ratio can be given to the GTF
helper function.

Signed-off-by: Hans Verkuil 
---
 drivers/media/video/v4l2-common.c |  325 +
 include/media/v4l2-common.h   |9 +
 2 files changed, 334 insertions(+)

diff --git a/drivers/media/video/v4l2-common.c 
b/drivers/media/video/v4l2-common.c
index 38da47c..33e57d8 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -630,6 +630,331 @@ bool v4l_match_dv_timings(const struct v4l2_dv_timings 
*t1,
 }
 EXPORT_SYMBOL_GPL(v4l_match_dv_timings);
 
+/*
+ * CVT defines
+ * Based on Coordinated Video Timings Standard
+ * version 1.1 September 10, 2003
+ */
+
+#define CVT_PXL_CLK_GRAN   25  /* pixel clock granularity */
+
+/* Normal blanking */
+#define CVT_MIN_V_BPORCH   7   /* lines */
+#define CVT_MIN_V_PORCH_RND3   /* lines */
+#define CVT_MIN_VSYNC_BP   550 /* min time of vsync + back porch (us) 
*/
+
+/* Normal blanking for CVT uses GTF to calculate horizontal blanking */
+#define CVT_CELL_GRAN  8   /* character cell granularity */
+#define CVT_M  600 /* blanking formula gradient */
+#define CVT_C  40  /* blanking formula offset */
+#define CVT_K  128 /* blanking formula scaling factor */
+#define CVT_J  20  /* blanking formula scaling factor */
+#define CVT_C_PRIME (((CVT_C - CVT_J) * CVT_K / 256) + CVT_J)
+#define CVT_M_PRIME (CVT_K * CVT_M / 256)
+
+/* Reduced Blanking */
+#define CVT_RB_MIN_V_BPORCH7   /* lines  */
+#define CVT_RB_V_FPORCH3   /* lines  */
+#define CVT_RB_MIN_V_BLANK   460 /* us */
+#define CVT_RB_H_SYNC 32   /* pixels */
+#define CVT_RB_H_BPORCH   80   /* pixels */
+#define CVT_RB_H_BLANK   160   /* pixels */
+
+/** v4l2_detect_cvt - detect if the given timings follow the CVT standard
+ * @frame_height - the total height of the frame (including blanking) in lines.
+ * @hfreq - the horizontal frequency in Hz.
+ * @vsync - the height of the vertical sync in lines.
+ * @polarities - the horizontal and vertical polarities (same as struct
+ * v4l2_bt_timings polarities).
+ * @fmt - the resulting timings.
+ *
+ * This function will attempt to detect if the given values correspond to a
+ * valid CVT format. If so, then it will return true, and fmt will be filled
+ * in with the found CVT timings.
+ */
+bool v4l2_detect_cvt(unsigned frame_height, unsigned hfreq, unsigned vsync,
+   u32 polarities, struct v4l2_dv_timings *fmt)
+{
+   int  v_fp, v_bp, h_fp, h_bp, hsync;
+   int  frame_width, image_height, image_width;
+   bool reduced_blanking;
+   unsigned pix_clk;
+
+   if (vsync < 4 || vsync > 7)
+   return false;
+
+   if (polarities == V4L2_DV_VSYNC_POS_POL)
+   reduced_blanking = false;
+   else if (polarities == V4L2_DV_HSYNC_POS_POL)
+   reduced_blanking = true;
+   else
+   return false;
+
+   /* Vertical */
+   if (reduced_blanking) {
+   v_fp = CVT_RB_V_FPORCH;
+   v_bp = (CVT_RB_MIN_V_BLANK * hfreq + 99) / 100;
+   v_bp -= vsync + v_fp;
+
+   if (v_bp < CVT_RB_MIN_V_BPORCH)
+   v_bp = CVT_RB_MIN_V_BPORCH;
+   } else {
+   v_fp = CVT_MIN_V_PORCH_RND;
+   v_bp = (CVT_MIN_VSYNC_BP * hfreq + 99) / 100 - vsync;
+
+   if (v_bp < CVT_MIN_V_BPORCH)
+   v_bp = CVT_MIN_V_BPORCH;
+   }
+   image_height = (frame_height - v_fp - vsync - v_bp + 1) & ~0x1;
+
+   /* Aspect ratio based on vsync */
+   switch (vsync) {
+   case 4:
+   image_width = (image_height * 4) / 3;
+   break;
+   case 5:
+   image_width = (image_height * 16) / 9;
+   break;
+   case 6:
+   image_width = (image_height * 16) / 10;
+   break;
+   case 7:
+   /* special case */
+   if (image_height == 1024)
+   image_width = (image_height * 5) / 4;
+   else if (image_height == 768)
+   image_width = (image_height * 15) / 9;
+   else
+   return false;
+   break;
+   default:
+   return false;
+   }
+
+   image_width = image_width & ~7;
+
+   /* Horizontal */
+   if (reduced_blanking) {
+   pix_clk = (image_width + CVT_RB_H_BLANK) * hfreq;
+   pix_clk = (pix_clk / CVT_PXL_CLK_GRAN) * CVT_PXL_

[RFCv3 PATCH 4/8] v4l2-ctrls.c: add support for the new DV controls.

2012-08-10 Thread Hans Verkuil
Signed-off-by: Hans Verkuil 
---
 drivers/media/video/v4l2-ctrls.c |   39 ++
 1 file changed, 39 insertions(+)

diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c
index b6a2ee7..6a34c30 100644
--- a/drivers/media/video/v4l2-ctrls.c
+++ b/drivers/media/video/v4l2-ctrls.c
@@ -425,6 +425,18 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
"Gray",
NULL,
};
+   static const char * const dv_tx_mode[] = {
+   "DVI-D",
+   "HDMI",
+   NULL,
+   };
+   static const char * const dv_rgb_range[] = {
+   "Automatic",
+   "RGB limited range (16-235)",
+   "RGB full range (0-255)",
+   NULL,
+   };
+
 
switch (id) {
case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ:
@@ -502,6 +514,11 @@ const char * const *v4l2_ctrl_get_menu(u32 id)
return mpeg4_profile;
case V4L2_CID_JPEG_CHROMA_SUBSAMPLING:
return jpeg_chroma_subsampling;
+   case V4L2_CID_DV_TX_MODE:
+   return dv_tx_mode;
+   case V4L2_CID_DV_TX_RGB_RANGE:
+   case V4L2_CID_DV_RX_RGB_RANGE:
+   return dv_rgb_range;
 
default:
return NULL;
@@ -733,6 +750,16 @@ const char *v4l2_ctrl_get_name(u32 id)
case V4L2_CID_LINK_FREQ:return "Link Frequency";
case V4L2_CID_PIXEL_RATE:   return "Pixel Rate";
 
+   /* DV controls */
+   case V4L2_CID_DV_CLASS: return "Digital Video Controls";
+   case V4L2_CID_DV_TX_HOTPLUG:return "Hotplug Present";
+   case V4L2_CID_DV_TX_RXSENSE:return "RxSense Present";
+   case V4L2_CID_DV_TX_EDID_PRESENT:   return "EDID Present";
+   case V4L2_CID_DV_TX_MODE:   return "Transmit Mode";
+   case V4L2_CID_DV_TX_RGB_RANGE:  return "Tx RGB Quantization 
Range";
+   case V4L2_CID_DV_RX_POWER_PRESENT:  return "Power Present";
+   case V4L2_CID_DV_RX_RGB_RANGE:  return "Rx RGB Quantization 
Range";
+
default:
return NULL;
}
@@ -832,6 +859,9 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_ISO_SENSITIVITY_AUTO:
case V4L2_CID_EXPOSURE_METERING:
case V4L2_CID_SCENE_MODE:
+   case V4L2_CID_DV_TX_MODE:
+   case V4L2_CID_DV_TX_RGB_RANGE:
+   case V4L2_CID_DV_RX_RGB_RANGE:
*type = V4L2_CTRL_TYPE_MENU;
break;
case V4L2_CID_LINK_FREQ:
@@ -853,6 +883,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_JPEG_CLASS:
case V4L2_CID_IMAGE_SOURCE_CLASS:
case V4L2_CID_IMAGE_PROC_CLASS:
+   case V4L2_CID_DV_CLASS:
*type = V4L2_CTRL_TYPE_CTRL_CLASS;
/* You can neither read not write these */
*flags |= V4L2_CTRL_FLAG_READ_ONLY | V4L2_CTRL_FLAG_WRITE_ONLY;
@@ -869,6 +900,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_JPEG_ACTIVE_MARKER:
case V4L2_CID_3A_LOCK:
case V4L2_CID_AUTO_FOCUS_STATUS:
+   case V4L2_CID_DV_TX_HOTPLUG:
+   case V4L2_CID_DV_TX_RXSENSE:
+   case V4L2_CID_DV_TX_EDID_PRESENT:
+   case V4L2_CID_DV_RX_POWER_PRESENT:
*type = V4L2_CTRL_TYPE_BITMASK;
break;
case V4L2_CID_MIN_BUFFERS_FOR_CAPTURE:
@@ -933,6 +968,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum 
v4l2_ctrl_type *type,
case V4L2_CID_FLASH_STROBE_STATUS:
case V4L2_CID_AUTO_FOCUS_STATUS:
case V4L2_CID_FLASH_READY:
+   case V4L2_CID_DV_TX_HOTPLUG:
+   case V4L2_CID_DV_TX_RXSENSE:
+   case V4L2_CID_DV_TX_EDID_PRESENT:
+   case V4L2_CID_DV_RX_POWER_PRESENT:
*flags |= V4L2_CTRL_FLAG_READ_ONLY;
break;
}
-- 
1.7.10.4

--
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


[RFCv3 PATCH 2/8] V4L2 spec: document the new DV controls and ioctls.

2012-08-10 Thread Hans Verkuil
Signed-off-by: Hans Verkuil 
---
 Documentation/DocBook/media/v4l/biblio.xml   |   40 +++
 Documentation/DocBook/media/v4l/controls.xml |  161 ++
 Documentation/DocBook/media/v4l/v4l2.xml |1 +
 3 files changed, 202 insertions(+)

diff --git a/Documentation/DocBook/media/v4l/biblio.xml 
b/Documentation/DocBook/media/v4l/biblio.xml
index 1078e45..860626a 100644
--- a/Documentation/DocBook/media/v4l/biblio.xml
+++ b/Documentation/DocBook/media/v4l/biblio.xml
@@ -226,4 +226,44 @@ in the frequency range from 87,5 to 108,0 MHz
   VESA and Industry Standards and Guidelines for Computer Display 
Monitor Timing (DMT)
 
 
+
+  EDID
+  
+   Video Electronics Standards Association
+(http://www.vesa.org";>http://www.vesa.org)
+  
+  VESA Enhanced Extended Display Identification Data 
Standard
+  Release A, Revision 2
+
+
+
+  HDCP
+  
+   Digital Content Protection LLC
+(http://www.digital-cp.com";>http://www.digital-cp.com)
+  
+  High-bandwidth Digital Content Protection System
+  Revision 1.3
+
+
+
+  HDMI
+  
+   HDMI Licensing LLC
+(http://www.hdmi.org";>http://www.hdmi.org)
+  
+  High-Definition Multimedia Interface
+  Specification Version 1.4a
+
+
+
+  DP
+  
+   Video Electronics Standards Association
+(http://www.vesa.org";>http://www.vesa.org)
+  
+  VESA DisplayPort Standard
+  Version 1, Revision 2
+
+
   
diff --git a/Documentation/DocBook/media/v4l/controls.xml 
b/Documentation/DocBook/media/v4l/controls.xml
index b0964fb..1b0b95e 100644
--- a/Documentation/DocBook/media/v4l/controls.xml
+++ b/Documentation/DocBook/media/v4l/controls.xml
@@ -4274,4 +4274,165 @@ interface and may change in the future.
   
 
 
+
+
+  Digital Video Control Reference
+
+  
+   Experimental
+
+   This is an experimental interface and may
+   change in the future.
+  
+
+  
+   The Digital Video control class is intended to control receivers
+   and transmitters for http://en.wikipedia.org/wiki/Vga";>VGA,
+   http://en.wikipedia.org/wiki/Digital_Visual_Interface";>DVI
+   (Digital Visual Interface), HDMI () and 
DisplayPort ().
+   These controls are generally expected to be private to the receiver or 
transmitter
+   subdevice that implements them, so they are only exposed on the
+   /dev/v4l-subdev* device node.
+  
+
+  Note that these devices can have multiple input or output pads 
which are
+  hooked up to e.g. HDMI connectors. Even though the subdevice will 
receive or
+  transmit video from/to only one of those pads, the other pads can still 
be
+  active when it comes to EDID (Extended Display Identification Data,
+  ) and HDCP (High-bandwidth Digital Content
+  Protection System, ) processing, allowing the 
device
+  to do the fairly slow EDID/HDCP handling in advance. This allows for 
quick
+  switching between connectors.
+
+  These pads appear in several of the controls in this section as
+  bitmasks, one bit for each pad. Bit 0 corresponds to pad 0, bit 1 to pad 
1,
+  etc. The maximum value of the control is the set of valid pads.
+
+  
+  Digital Video Control IDs
+
+  
+   
+   
+   
+   
+   
+   
+   
+ 
+   ID
+   Type
+ Description
+ 
+   
+   
+ 
+ 
+   V4L2_CID_DV_CLASS
+   class
+ 
+ 
+   The Digital Video class descriptor.
+ 
+ 
+   V4L2_CID_DV_TX_HOTPLUG
+   bitmask
+ 
+ 
+   Many connectors have a hotplug pin which is 
high
+   if EDID information is available from the source. This control 
shows the
+   state of the hotplug pin as seen by the transmitter.
+   Each bit corresponds to an output pad on the transmitter. If an 
output pad
+   does not have an associated hotplug pin, then the bit for that pad 
will be 0.
+   This read-only control is applicable to DVI-D, HDMI and DisplayPort 
connectors.
+   
+ 
+ 
+   V4L2_CID_DV_TX_RXSENSE
+   bitmask
+ 
+ 
+   Rx Sense is the detection of pull-ups on 
the TMDS
+clock lines. This normally means that the sink has left/entered 
standby (i.e.
+   the transmitter can sense that the receiver is ready to receive 
video).
+   Each bit corresponds to an output pad on the transmitter. If an 
output pad
+   does not have an associated Rx Sense, then the bit for that pad 
will be 0.
+   This read-only control is applicable to DVI-D and HDMI devices.
+   
+ 
+ 
+   V4L2_CID_DV_TX_EDID_PRESENT
+   bitmask
+ 
+ 
+   When the transmitter sees the hotplug 
signal from the
+ 

[RFCv3 PATCH 5/8] v4l2-common: add v4l_match_dv_timings.

2012-08-10 Thread Hans Verkuil
Add the v4l_match_dv_timings function that can be used to compare two
v4l2_dv_timings structs.

Signed-off-by: Hans Verkuil 
---
 drivers/media/video/v4l2-common.c |   33 +
 include/media/v4l2-common.h   |4 
 2 files changed, 37 insertions(+)

diff --git a/drivers/media/video/v4l2-common.c 
b/drivers/media/video/v4l2-common.c
index 1baec83..38da47c 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -597,6 +597,39 @@ int v4l_fill_dv_preset_info(u32 preset, struct 
v4l2_dv_enum_preset *info)
 }
 EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);
 
+/**
+ * v4l_match_dv_timings - check if two timings match
+ * @t1 - compare this v4l2_dv_timings struct...
+ * @t2 - with this struct.
+ * @pclock_delta - the allowed pixelclock deviation.
+ *
+ * Compare t1 with t2 with a given margin of error for the pixelclock.
+ */
+bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
+ const struct v4l2_dv_timings *t2,
+ unsigned pclock_delta)
+{
+   if (t1->type != t2->type || t1->type != V4L2_DV_BT_656_1120)
+   return false;
+   if (t1->bt.width == t2->bt.width &&
+   t1->bt.height == t2->bt.height &&
+   t1->bt.interlaced == t2->bt.interlaced &&
+   t1->bt.polarities == t2->bt.polarities &&
+   t1->bt.pixelclock >= t2->bt.pixelclock - pclock_delta &&
+   t1->bt.pixelclock <= t2->bt.pixelclock + pclock_delta &&
+   t1->bt.hfrontporch == t2->bt.hfrontporch &&
+   t1->bt.vfrontporch == t2->bt.vfrontporch &&
+   t1->bt.vsync == t2->bt.vsync &&
+   t1->bt.vbackporch == t2->bt.vbackporch &&
+   (!t1->bt.interlaced ||
+   (t1->bt.il_vfrontporch == t2->bt.il_vfrontporch &&
+t1->bt.il_vsync == t2->bt.il_vsync &&
+t1->bt.il_vbackporch == t2->bt.il_vbackporch)))
+   return true;
+   return false;
+}
+EXPORT_SYMBOL_GPL(v4l_match_dv_timings);
+
 const struct v4l2_frmsize_discrete *v4l2_find_nearest_format(
const struct v4l2_discrete_probe *probe,
s32 width, s32 height)
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h
index a298ec4..b43b968 100644
--- a/include/media/v4l2-common.h
+++ b/include/media/v4l2-common.h
@@ -212,4 +212,8 @@ const struct v4l2_frmsize_discrete 
*v4l2_find_nearest_format(
const struct v4l2_discrete_probe *probe,
s32 width, s32 height);
 
+bool v4l_match_dv_timings(const struct v4l2_dv_timings *t1,
+ const struct v4l2_dv_timings *t2,
+ unsigned pclock_delta);
+
 #endif /* V4L2_COMMON_H_ */
-- 
1.7.10.4

--
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


[RFCv3 PATCH 3/8] v4l2-subdev: add support for the new edid ioctls.

2012-08-10 Thread Hans Verkuil
Signed-off-by: Hans Verkuil 
---
 drivers/media/video/v4l2-compat-ioctl32.c |   57 +
 drivers/media/video/v4l2-ioctl.c  |   13 +++
 drivers/media/video/v4l2-subdev.c |6 +++
 include/media/v4l2-subdev.h   |2 +
 4 files changed, 78 insertions(+)

diff --git a/drivers/media/video/v4l2-compat-ioctl32.c 
b/drivers/media/video/v4l2-compat-ioctl32.c
index 9ebd5c5..e843705 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -729,6 +730,44 @@ static int put_v4l2_event32(struct v4l2_event *kp, struct 
v4l2_event32 __user *u
return 0;
 }
 
+struct v4l2_subdev_edid32 {
+   __u32 pad;
+   __u32 start_block;
+   __u32 blocks;
+   __u32 reserved[5];
+   compat_caddr_t edid;
+};
+
+static int get_v4l2_subdev_edid32(struct v4l2_subdev_edid *kp, struct 
v4l2_subdev_edid32 __user *up)
+{
+   u32 tmp;
+
+   if (!access_ok(VERIFY_READ, up, sizeof(struct v4l2_subdev_edid32)) ||
+   get_user(kp->pad, &up->pad) ||
+   get_user(kp->start_block, &up->start_block) ||
+   get_user(kp->blocks, &up->blocks) ||
+   get_user(tmp, &up->edid) ||
+   copy_from_user(kp->reserved, up->reserved, 
sizeof(kp->reserved)))
+   return -EFAULT;
+   kp->edid = compat_ptr(tmp);
+   return 0;
+}
+
+static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid *kp, struct 
v4l2_subdev_edid32 __user *up)
+{
+   u32 tmp = (u32)((unsigned long)kp->edid);
+
+   if (!access_ok(VERIFY_WRITE, up, sizeof(struct v4l2_subdev_edid32)) ||
+   put_user(kp->pad, &up->pad) ||
+   put_user(kp->start_block, &up->start_block) ||
+   put_user(kp->blocks, &up->blocks) ||
+   put_user(tmp, &up->edid) ||
+   copy_to_user(kp->reserved, up->reserved, sizeof(kp->reserved)))
+   return -EFAULT;
+   return 0;
+}
+
+
 #define VIDIOC_G_FMT32 _IOWR('V',  4, struct v4l2_format32)
 #define VIDIOC_S_FMT32 _IOWR('V',  5, struct v4l2_format32)
 #define VIDIOC_QUERYBUF32  _IOWR('V',  9, struct v4l2_buffer32)
@@ -738,6 +777,8 @@ static int put_v4l2_event32(struct v4l2_event *kp, struct 
v4l2_event32 __user *u
 #define VIDIOC_DQBUF32 _IOWR('V', 17, struct v4l2_buffer32)
 #define VIDIOC_ENUMSTD32   _IOWR('V', 25, struct v4l2_standard32)
 #define VIDIOC_ENUMINPUT32 _IOWR('V', 26, struct v4l2_input32)
+#define VIDIOC_SUBDEV_G_EDID32 _IOWR('V', 63, struct v4l2_subdev_edid32)
+#define VIDIOC_SUBDEV_S_EDID32 _IOWR('V', 64, struct v4l2_subdev_edid32)
 #define VIDIOC_TRY_FMT32   _IOWR('V', 64, struct v4l2_format32)
 #define VIDIOC_G_EXT_CTRLS32_IOWR('V', 71, struct v4l2_ext_controls32)
 #define VIDIOC_S_EXT_CTRLS32_IOWR('V', 72, struct v4l2_ext_controls32)
@@ -765,6 +806,7 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
struct v4l2_ext_controls v2ecs;
struct v4l2_event v2ev;
struct v4l2_create_buffers v2crt;
+   struct v4l2_subdev_edid v2edid;
unsigned long vx;
int vi;
} karg;
@@ -797,6 +839,8 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
case VIDIOC_S_OUTPUT32: cmd = VIDIOC_S_OUTPUT; break;
case VIDIOC_CREATE_BUFS32: cmd = VIDIOC_CREATE_BUFS; break;
case VIDIOC_PREPARE_BUF32: cmd = VIDIOC_PREPARE_BUF; break;
+   case VIDIOC_SUBDEV_G_EDID32: cmd = VIDIOC_SUBDEV_G_EDID; break;
+   case VIDIOC_SUBDEV_S_EDID32: cmd = VIDIOC_SUBDEV_S_EDID; break;
}
 
switch (cmd) {
@@ -814,6 +858,12 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
compatible_arg = 0;
break;
 
+   case VIDIOC_SUBDEV_G_EDID:
+   case VIDIOC_SUBDEV_S_EDID:
+   err = get_v4l2_subdev_edid32(&karg.v2edid, up);
+   compatible_arg = 0;
+   break;
+
case VIDIOC_G_FMT:
case VIDIOC_S_FMT:
case VIDIOC_TRY_FMT:
@@ -906,6 +956,11 @@ static long do_video_ioctl(struct file *file, unsigned int 
cmd, unsigned long ar
err = put_v4l2_event32(&karg.v2ev, up);
break;
 
+   case VIDIOC_SUBDEV_G_EDID:
+   case VIDIOC_SUBDEV_S_EDID:
+   err = put_v4l2_subdev_edid32(&karg.v2edid, up);
+   break;
+
case VIDIOC_G_FMT:
case VIDIOC_S_FMT:
case VIDIOC_TRY_FMT:
@@ -1026,6 +1081,8 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int 
cmd, unsigned long arg)
case VIDIOC_QUERY_DV_TIMINGS:
case VIDIOC_DV_TIMINGS_CAP:
case VIDIOC_ENUM_FREQ_BANDS:
+   case VIDIOC_SUBDEV_G_EDID32:
+   case VIDIOC_SUBDEV_S_EDID32:
ret = do

[RFCv3 PATCH 1/8] v4l2 core: add the missing pieces to support DVI/HDMI/DisplayPort.

2012-08-10 Thread Hans Verkuil
These new controls and two new ioctls make it possible to properly support
VGA, DVI-A/D/I, HDMI and DisplayPort connectors. All these controls and the
ioctls are all at the sub-device level. They are meant for V4L2 bridge/platform
drivers or to be accessed on embedded systems through /dev/v4l-subdev* device
nodes.

Signed-off-by: Hans Verkuil 
---
 include/linux/v4l2-subdev.h |   10 ++
 include/linux/videodev2.h   |   23 +++
 2 files changed, 33 insertions(+)

diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 8c57ee9..a426a78 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -148,6 +148,14 @@ struct v4l2_subdev_selection {
__u32 reserved[8];
 };
 
+struct v4l2_subdev_edid {
+   __u32 pad;
+   __u32 start_block;
+   __u32 blocks;
+   __u32 reserved[5];
+   __u8 __user *edid;
+};
+
 #define VIDIOC_SUBDEV_G_FMT_IOWR('V',  4, struct v4l2_subdev_format)
 #define VIDIOC_SUBDEV_S_FMT_IOWR('V',  5, struct v4l2_subdev_format)
 #define VIDIOC_SUBDEV_G_FRAME_INTERVAL \
@@ -166,5 +174,7 @@ struct v4l2_subdev_selection {
_IOWR('V', 61, struct v4l2_subdev_selection)
 #define VIDIOC_SUBDEV_S_SELECTION \
_IOWR('V', 62, struct v4l2_subdev_selection)
+#define VIDIOC_SUBDEV_G_EDID   _IOWR('V', 63, struct v4l2_subdev_edid)
+#define VIDIOC_SUBDEV_S_EDID   _IOWR('V', 64, struct v4l2_subdev_edid)
 
 #endif
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 7a147c8..91939a7 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -1250,6 +1250,7 @@ struct v4l2_ext_controls {
 #define V4L2_CTRL_CLASS_JPEG 0x009d/* JPEG-compression 
controls */
 #define V4L2_CTRL_CLASS_IMAGE_SOURCE 0x009e/* Image source 
controls */
 #define V4L2_CTRL_CLASS_IMAGE_PROC 0x009f  /* Image processing controls */
+#define V4L2_CTRL_CLASS_DV 0x00a0  /* Digital Video controls */
 
 #define V4L2_CTRL_ID_MASK(0x0fff)
 #define V4L2_CTRL_ID2CLASS(id)((id) & 0x0fffUL)
@@ -1993,6 +1994,28 @@ enum v4l2_jpeg_chroma_subsampling {
 #define V4L2_CID_LINK_FREQ (V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 1)
 #define V4L2_CID_PIXEL_RATE(V4L2_CID_IMAGE_PROC_CLASS_BASE 
+ 2)
 
+/*  DV-class control IDs defined by V4L2 */
+#define V4L2_CID_DV_CLASS_BASE (V4L2_CTRL_CLASS_DV | 0x900)
+#define V4L2_CID_DV_CLASS  (V4L2_CTRL_CLASS_DV | 1)
+
+#defineV4L2_CID_DV_TX_HOTPLUG  (V4L2_CID_DV_CLASS_BASE 
+ 1)
+#defineV4L2_CID_DV_TX_RXSENSE  (V4L2_CID_DV_CLASS_BASE 
+ 2)
+#defineV4L2_CID_DV_TX_EDID_PRESENT (V4L2_CID_DV_CLASS_BASE 
+ 3)
+#defineV4L2_CID_DV_TX_MODE (V4L2_CID_DV_CLASS_BASE 
+ 4)
+enum v4l2_dv_tx_mode {
+   V4L2_DV_TX_MODE_DVI_D   = 0,
+   V4L2_DV_TX_MODE_HDMI= 1,
+};
+#define V4L2_CID_DV_TX_RGB_RANGE   (V4L2_CID_DV_CLASS_BASE + 5)
+enum v4l2_dv_rgb_range {
+   V4L2_DV_RGB_RANGE_AUTO= 0,
+   V4L2_DV_RGB_RANGE_LIMITED = 1,
+   V4L2_DV_RGB_RANGE_FULL= 2,
+};
+
+#defineV4L2_CID_DV_RX_POWER_PRESENT(V4L2_CID_DV_CLASS_BASE 
+ 100)
+#define V4L2_CID_DV_RX_RGB_RANGE   (V4L2_CID_DV_CLASS_BASE + 101)
+
 /*
  * T U N I N G
  */
-- 
1.7.10.4

--
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


[RFCv3 PATCH 0/8] V4L2: add missing pieces to support HDMI et al and add adv7604/ad9389b drivers

2012-08-10 Thread Hans Verkuil
Hi all,

This is the third version of this patch series. The second version can be
found here: http://www.spinics.net/lists/linux-media/msg50413.html

I made a pull request based on that and got some feedback:

http://patchwork.linuxtv.org/patch/13442/

The feedback has been incorporated in this third version.

One suggestion I got was to run this by the video devs as well so that they
can take a look at the V4L2 EDID API, just in case I missed something, so
that's why this is being cross-posted to the dri-devel mailinglist.

Note that the EDID API at the moment is only meant to pass the EDID to userspace
and vice versa. There is no parsing at the moment. If we ever need parsing in
V4L2 (and I'm sure we will) then we will of course use shared EDID parsing code.

The second patch documents the new V4L2 API additions. So that's a good one
to review when it comes to the API.

Regards,

Hans

--
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] [media] qt1010: signedness bug in qt1010_init_meas1()

2012-08-10 Thread Antti Palosaari

On 08/10/2012 12:25 PM, Dan Carpenter wrote:

qt1010_init_meas2() returns zero on success and negative error codes on
failure so the return type should be int instead of u8.

Signed-off-by: Dan Carpenter 


Acked-by: Antti Palosaari 




diff --git a/drivers/media/common/tuners/qt1010.c 
b/drivers/media/common/tuners/qt1010.c
index 2d79b1f..bdc39e1 100644
--- a/drivers/media/common/tuners/qt1010.c
+++ b/drivers/media/common/tuners/qt1010.c
@@ -288,7 +288,7 @@ static int qt1010_init_meas1(struct qt1010_priv *priv,
return qt1010_writereg(priv, 0x1e, 0x00);
  }

-static u8 qt1010_init_meas2(struct qt1010_priv *priv,
+static int qt1010_init_meas2(struct qt1010_priv *priv,
u8 reg_init_val, u8 *retval)
  {
u8 i, val;




--
http://palosaari.fi/
--
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


[PATCHv2 1/2] media: rc: Introduce RX51 IR transmitter driver

2012-08-10 Thread Timo Kokkonen
This is the driver for the IR transmitter diode found on the Nokia
N900 (also known as RX51) device. The driver is mostly the same as
found in the original 2.6.28 based kernel that comes with the device.

The following modifications have been made compared to the original
driver version:

- Adopt to the changes that has happen in the kernel during the past
  five years, such as the change in the include paths

- The OMAP DM-timers require much more care nowadays. The timers need
  to be enabled and disabled or otherwise many actions fail. Timers
  must not be freed without first stopping them or otherwise the timer
  cannot be requested again.

The code has been tested with sending IR codes with N900 device
running Debian userland. The device receiving the codes was Anysee
DVB-C USB receiver.

Signed-off-by: Timo Kokkonen 
---
 drivers/media/rc/Kconfig   |   10 +
 drivers/media/rc/Makefile  |1 +
 drivers/media/rc/ir-rx51.c |  496 
 include/media/ir-rx51.h|   10 +
 4 files changed, 517 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/rc/ir-rx51.c
 create mode 100644 include/media/ir-rx51.h

diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 5180390..ab35d2e 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -270,6 +270,16 @@ config IR_IGUANA
   To compile this driver as a module, choose M here: the module will
   be called iguanair.
 
+config IR_RX51
+   tristate "Nokia N900 IR transmitter diode
+   depends on MACH_NOKIA_RX51 && OMAP_DM_TIMER
+   ---help---
+  Say Y or M here if you want to enable support for the IR
+  transmitter diode built in the Nokia N900 (RX51) device.
+
+  The driver uses omap DM timers for gereating the carrier
+  wave and pulses.
+
 config RC_LOOPBACK
tristate "Remote Control Loopback Driver"
depends on RC_CORE
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index f871d19..d384f30 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -23,6 +23,7 @@ obj-$(CONFIG_IR_FINTEK) += fintek-cir.o
 obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o
 obj-$(CONFIG_IR_ENE) += ene_ir.o
 obj-$(CONFIG_IR_REDRAT3) += redrat3.o
+obj-$(CONFIG_IR_RX51) += ir-rx51.o
 obj-$(CONFIG_IR_STREAMZAP) += streamzap.o
 obj-$(CONFIG_IR_WINBOND_CIR) += winbond-cir.o
 obj-$(CONFIG_RC_LOOPBACK) += rc-loopback.o
diff --git a/drivers/media/rc/ir-rx51.c b/drivers/media/rc/ir-rx51.c
new file mode 100644
index 000..9487dd3
--- /dev/null
+++ b/drivers/media/rc/ir-rx51.c
@@ -0,0 +1,496 @@
+/*
+ *  Copyright (C) 2008 Nokia Corporation
+ *
+ *  Based on lirc_serial.c
+ *
+ *  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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  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
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define LIRC_RX51_DRIVER_FEATURES (LIRC_CAN_SET_SEND_DUTY_CYCLE |  \
+  LIRC_CAN_SET_SEND_CARRIER |  \
+  LIRC_CAN_SEND_PULSE)
+
+#define DRIVER_NAME "lirc_rx51"
+
+#define WBUF_LEN 256
+
+#define TIMER_MAX_VALUE 0x
+
+struct lirc_rx51 {
+   struct omap_dm_timer *pwm_timer;
+   struct omap_dm_timer *pulse_timer;
+   struct device*dev;
+   struct lirc_rx51_platform_data *pdata;
+   wait_queue_head_t wqueue;
+
+   unsigned long   fclk_khz;
+   unsigned intfreq;   /* carrier frequency */
+   unsigned intduty_cycle; /* carrier duty cycle */
+   unsigned intirq_num;
+   unsigned intmatch;
+   int wbuf[WBUF_LEN];
+   int wbuf_index;
+   unsigned long   device_is_open;
+   unsigned intpwm_timer_num;
+};
+
+static void lirc_rx51_on(struct lirc_rx51 *lirc_rx51)
+{
+   omap_dm_timer_set_pwm(lirc_rx51->pwm_timer, 0, 1,
+ OMAP_TIMER_TRIGGER_OVERFLOW_AND_COMPARE);
+}
+
+static void lirc_rx51_off(struct lirc_rx51 *lirc_rx51)
+{
+   omap_dm_timer_set_pwm(lirc_rx51->pwm_timer, 0, 1,
+ OMAP_TIMER_TRIGGER_NONE);
+}
+
+static int init_timing_params(struct lirc_rx51 *lirc_rx51)
+{
+   u32 load, match;
+
+   load = -(lir

[PATCHv2 2/2] ARM: mach-omap2: board-rx51-peripherals: Add lirc-rx51 data

2012-08-10 Thread Timo Kokkonen
The IR diode on the RX51 is connected to the GPT9. This data is needed
for the IR driver to function.

Signed-off-by: Timo Kokkonen 
---
 arch/arm/mach-omap2/board-rx51-peripherals.c |   30 ++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c 
b/arch/arm/mach-omap2/board-rx51-peripherals.c
index df2534d..ca07264 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -46,6 +47,10 @@
 #include <../drivers/staging/iio/light/tsl2563.h>
 #include 
 
+#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
+#include 
+#endif
+
 #include "mux.h"
 #include "hsmmc.h"
 #include "common-board-devices.h"
@@ -1220,6 +1225,30 @@ static void __init rx51_init_tsc2005(void)
gpio_to_irq(RX51_TSC2005_IRQ_GPIO);
 }
 
+#if defined(CONFIG_IR_RX51) || defined(CONFIG_IR_RX51_MODULE)
+static struct lirc_rx51_platform_data rx51_lirc_data = {
+   .set_max_mpu_wakeup_lat = omap_pm_set_max_mpu_wakeup_lat,
+   .pwm_timer = 9, /* Use GPT 9 for CIR */
+};
+
+static struct platform_device rx51_lirc_device = {
+   .name   = "lirc_rx51",
+   .id = -1,
+   .dev= {
+   .platform_data = &rx51_lirc_data,
+   },
+};
+
+static void __init rx51_init_lirc(void)
+{
+   platform_device_register(&rx51_lirc_device);
+}
+#else
+static void __init rx51_init_lirc(void)
+{
+}
+#endif
+
 void __init rx51_peripherals_init(void)
 {
rx51_i2c_init();
@@ -1230,6 +1259,7 @@ void __init rx51_peripherals_init(void)
rx51_init_wl1251();
rx51_init_tsc2005();
rx51_init_si4713();
+   rx51_init_lirc();
spi_register_board_info(rx51_peripherals_spi_board_info,
ARRAY_SIZE(rx51_peripherals_spi_board_info));
 
-- 
1.7.8.6

--
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 0/2] Add Nokia N900 (RX51) IR diode support

2012-08-10 Thread Timo Kokkonen
These patches add the support for sending IR remote controller codes
on the Nokia N900 phone. The code is taken from the public N900 kernel
release and modified to work with today's kernel.

The code has been tested with a real Nokia N900 device and confirmed
to work. I can identify only one known issue; The IR pulses being sent
become *veeery* long if the device chooses to go into any sleep modes
during transmitting the IR pulses. The driver makes an attempt to set
up PM latency constraints, but apparently those don't apply as there
is currently only no-op PM layer available. Therefore, I guess this
driver doesn't actually work properly unless there is some background
load that prevents the device from enterint sleep modes or the sleep
modes are disabled altogether. However, once a proper PM layer
implementation becomes available, I expect this problem to resolve
itself. The same code used to work with the actual N900 kernel that
has those implemented.

Any comments regarding the patches are welcome.

I guess media list won't take in omap patches and omap list doesn't
take media patches. So I wrote the patches so that they can be applied
independently. If you want me to remove the #ifdef hacks from the
board file (that is needed to break the build dependency between the
patches), then the ir-rx51.c patch needs to be applied before the
board file patch. But I though it would be more flexible this way. I'm
open to suggestions on how you are willing to accept the patches.

---

Changes since v1:

- Move ir-rx51.h into include/media directory


Timo Kokkonen (2):
  media: rc: Introduce RX51 IR transmitter driver
  ARM: mach-omap2: board-rx51-peripherals: Add lirc-rx51 data

 arch/arm/mach-omap2/board-rx51-peripherals.c |   30 ++
 drivers/media/rc/Kconfig |   10 +
 drivers/media/rc/Makefile|1 +
 drivers/media/rc/ir-rx51.c   |  496 ++
 include/media/ir-rx51.h  |   10 +
 5 files changed, 547 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/rc/ir-rx51.c
 create mode 100644 include/media/ir-rx51.h

-- 
1.7.8.6

--
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: Philips saa7134 IR remote problem with linux kernel v2.6.35

2012-08-10 Thread Sean Young
On Wed, Aug 08, 2012 at 12:23:46AM +0600, Partha Guha Roy wrote:
> I have a saa7134 analog tv card (Avermedia PCI pure m135a) with an IR
> remote. The IR remote is recognized by a standard keyboard and lirc
> used to work fine with this. However, from kernel v2.6.35, the IR
> remote does not work properly. The major problem is that every
> keystroke is registered after the next keystroke. So, if I press the
> sequence "123" on the remote, it actually comes up with only "12". If
> I then if I wait for 5 seconds, the "3" gets lost.
> 
> Now I tried to bisect the kernel and it lead to the following commit:
> 
> commit e40b1127f994a427568319d1be9b9e5ab1f58dd1
> Author: David Härdeman 
> Date:   Thu Apr 15 18:46:00 2010 -0300
> 
> V4L/DVB: ir-core: change duration to be coded as a u32 integer
> 
> This patch implements the agreed upon 1:31 integer encoded pulse/duration
> struct for ir-core raw decoders. All decoders have been tested after the
> change. Comments are welcome.
> 
> Signed-off-by: David Härdeman 
> Signed-off-by: Mauro Carvalho Chehab 
> 
> I am willing to test patches if needed.

Are you runnning the lircd user space process for input or relying on
the in-kernel decoders? Also what remote are you using (or more 
specifically, what IR protocol does it use)?

Can you reproduce the issue on a more contemporary kernel?

Note that the commit only affects kernel space IR decoders so it should
not affect lircd.

I wouldn't be surprised if the 15ms delay for processing in 
saa7134_raw_decode_irq (bottom of saa7134-input.c) needs increasing.


Sean
--
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] [media] qt1010: signedness bug in qt1010_init_meas1()

2012-08-10 Thread Dan Carpenter
qt1010_init_meas2() returns zero on success and negative error codes on
failure so the return type should be int instead of u8.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/media/common/tuners/qt1010.c 
b/drivers/media/common/tuners/qt1010.c
index 2d79b1f..bdc39e1 100644
--- a/drivers/media/common/tuners/qt1010.c
+++ b/drivers/media/common/tuners/qt1010.c
@@ -288,7 +288,7 @@ static int qt1010_init_meas1(struct qt1010_priv *priv,
return qt1010_writereg(priv, 0x1e, 0x00);
 }
 
-static u8 qt1010_init_meas2(struct qt1010_priv *priv,
+static int qt1010_init_meas2(struct qt1010_priv *priv,
u8 reg_init_val, u8 *retval)
 {
u8 i, val;
--
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: [RFC PATCH 1/2] Add libv4l2rds library (with changes proposed in RFC)

2012-08-10 Thread Hans de Goede

Hi,

On 08/10/2012 09:36 AM, Hans Verkuil wrote:

On Fri 10 August 2012 09:16:34 Hans de Goede wrote:

Hi,

On 08/09/2012 02:14 PM, Hans Verkuil wrote:

On Thu August 9 2012 13:58:07 Hans de Goede wrote:

Hi Konke,

As Gregor already mentioned there is no need to define libv4l2rdssubdir in 
configure.ac ,
so please drop that.

Other then that I've some minor remarks (comments inline), with all those
fixed, this one is could to go. So hopefully the next version can be added
to git master!

On 08/07/2012 05:11 PM, Konke Radlow wrote:

---
Makefile.am |3 +-
configure.ac|7 +-
lib/include/libv4l2rds.h|  228 ++
lib/libv4l2rds/Makefile.am  |   11 +
lib/libv4l2rds/libv4l2rds.c |  953 
+++
lib/libv4l2rds/libv4l2rds.pc.in |   11 +
6 files changed, 1211 insertions(+), 2 deletions(-)
create mode 100644 lib/include/libv4l2rds.h
create mode 100644 lib/libv4l2rds/Makefile.am
create mode 100644 lib/libv4l2rds/libv4l2rds.c
create mode 100644 lib/libv4l2rds/libv4l2rds.pc.in






diff --git a/lib/include/libv4l2rds.h b/lib/include/libv4l2rds.h
new file mode 100644
index 000..4aa8593
--- /dev/null
+++ b/lib/include/libv4l2rds.h
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ * Author: Konke Radlow 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+ */
+
+#ifndef __LIBV4L2RDS
+#define __LIBV4L2RDS
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 


You should never include config.h in a public header, also
are all the headers really needed for the prototypes in this header?

I don't think so! Please move all the unneeded ones to the libv4l2rds.c
file!


+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#if HAVE_VISIBILITY
+#define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
+#else
+#define LIBV4L_PUBLIC
+#endif
+
+/* used to define the current version (version field) of the v4l2_rds struct */
+#define V4L2_RDS_VERSION (1)
+


What is the purpose of this field? Once we've released a v4l-utils with this
library we are stuck to the API we've defined, having a version field & 
changing it,
won't stop us from breaking existing apps, so once we've an official release we
simply cannot make ABI breaking changes, which is why most of my review sofar
has concentrated on the API side :)

I suggest dropping this define and the version field from the struct.


I think it is useful, actually. The v4l2_rds struct is allocated by the 
v4l2_rds_create
so at least in theory it is possible to extend the struct in the future without 
breaking
existing apps, provided you have a version number to check.


I disagree, if it gets extended only, then existing apps will just work, if an 
apps gets
compiled against a newer version with the extension then it is safe to assume 
it will run
against that newer version. The only reason I can see a version define being 
useful is
to make a newer app compile with an older version of the librarry, but that 
only requires
a version define, not a version field in the struct.


That's true, you only need the define, not the version field.

So let's keep the define and ditch the version field. I think that
should do it.


Ack.

Regards,

Hans
--
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: [RFC PATCH 1/2] Add libv4l2rds library (with changes proposed in RFC)

2012-08-10 Thread Hans Verkuil
On Fri 10 August 2012 09:16:34 Hans de Goede wrote:
> Hi,
> 
> On 08/09/2012 02:14 PM, Hans Verkuil wrote:
> > On Thu August 9 2012 13:58:07 Hans de Goede wrote:
> >> Hi Konke,
> >>
> >> As Gregor already mentioned there is no need to define libv4l2rdssubdir in 
> >> configure.ac ,
> >> so please drop that.
> >>
> >> Other then that I've some minor remarks (comments inline), with all those
> >> fixed, this one is could to go. So hopefully the next version can be added
> >> to git master!
> >>
> >> On 08/07/2012 05:11 PM, Konke Radlow wrote:
> >>> ---
> >>>Makefile.am |3 +-
> >>>configure.ac|7 +-
> >>>lib/include/libv4l2rds.h|  228 ++
> >>>lib/libv4l2rds/Makefile.am  |   11 +
> >>>lib/libv4l2rds/libv4l2rds.c |  953 
> >>> +++
> >>>lib/libv4l2rds/libv4l2rds.pc.in |   11 +
> >>>6 files changed, 1211 insertions(+), 2 deletions(-)
> >>>create mode 100644 lib/include/libv4l2rds.h
> >>>create mode 100644 lib/libv4l2rds/Makefile.am
> >>>create mode 100644 lib/libv4l2rds/libv4l2rds.c
> >>>create mode 100644 lib/libv4l2rds/libv4l2rds.pc.in
> >>>
> >>
> >> 
> >>
> >>> diff --git a/lib/include/libv4l2rds.h b/lib/include/libv4l2rds.h
> >>> new file mode 100644
> >>> index 000..4aa8593
> >>> --- /dev/null
> >>> +++ b/lib/include/libv4l2rds.h
> >>> @@ -0,0 +1,228 @@
> >>> +/*
> >>> + * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
> >>> reserved.
> >>> + * Author: Konke Radlow 
> >>> + *
> >>> + * This program is free software; you can redistribute it and/or modify
> >>> + * it under the terms of the GNU Lesser General Public License as 
> >>> published by
> >>> + * the Free Software Foundation; either version 2.1 of the License, or
> >>> + * (at your option) any later version.
> >>> + *
> >>> + * 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
> >>> + * along with this program; if not, write to the Free Software
> >>> + * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  
> >>> 02110-1335  USA
> >>> + */
> >>> +
> >>> +#ifndef __LIBV4L2RDS
> >>> +#define __LIBV4L2RDS
> >>> +
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>> +#include 
> >>
> >> You should never include config.h in a public header, also
> >> are all the headers really needed for the prototypes in this header?
> >>
> >> I don't think so! Please move all the unneeded ones to the libv4l2rds.c
> >> file!
> >>
> >>> +
> >>> +#include 
> >>> +
> >>> +#ifdef __cplusplus
> >>> +extern "C" {
> >>> +#endif /* __cplusplus */
> >>> +
> >>> +#if HAVE_VISIBILITY
> >>> +#define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
> >>> +#else
> >>> +#define LIBV4L_PUBLIC
> >>> +#endif
> >>> +
> >>> +/* used to define the current version (version field) of the v4l2_rds 
> >>> struct */
> >>> +#define V4L2_RDS_VERSION (1)
> >>> +
> >>
> >> What is the purpose of this field? Once we've released a v4l-utils with 
> >> this
> >> library we are stuck to the API we've defined, having a version field & 
> >> changing it,
> >> won't stop us from breaking existing apps, so once we've an official 
> >> release we
> >> simply cannot make ABI breaking changes, which is why most of my review 
> >> sofar
> >> has concentrated on the API side :)
> >>
> >> I suggest dropping this define and the version field from the struct.
> >
> > I think it is useful, actually. The v4l2_rds struct is allocated by the 
> > v4l2_rds_create
> > so at least in theory it is possible to extend the struct in the future 
> > without breaking
> > existing apps, provided you have a version number to check.
> 
> I disagree, if it gets extended only, then existing apps will just work, if 
> an apps gets
> compiled against a newer version with the extension then it is safe to assume 
> it will run
> against that newer version. The only reason I can see a version define being 
> useful is
> to make a newer app compile with an older version of the librarry, but that 
> only requires
> a version define, not a version field in the struct.

That's true, you only need the define, not the version field.

So let's keep the define and ditch the version field. I think that
should do it.

Regards,

Hans
--
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: [RFC PATCH 1/2] Add libv4l2rds library (with changes proposed in RFC)

2012-08-10 Thread Hans de Goede

Hi,

On 08/09/2012 02:14 PM, Hans Verkuil wrote:

On Thu August 9 2012 13:58:07 Hans de Goede wrote:

Hi Konke,

As Gregor already mentioned there is no need to define libv4l2rdssubdir in 
configure.ac ,
so please drop that.

Other then that I've some minor remarks (comments inline), with all those
fixed, this one is could to go. So hopefully the next version can be added
to git master!

On 08/07/2012 05:11 PM, Konke Radlow wrote:

---
   Makefile.am |3 +-
   configure.ac|7 +-
   lib/include/libv4l2rds.h|  228 ++
   lib/libv4l2rds/Makefile.am  |   11 +
   lib/libv4l2rds/libv4l2rds.c |  953 
+++
   lib/libv4l2rds/libv4l2rds.pc.in |   11 +
   6 files changed, 1211 insertions(+), 2 deletions(-)
   create mode 100644 lib/include/libv4l2rds.h
   create mode 100644 lib/libv4l2rds/Makefile.am
   create mode 100644 lib/libv4l2rds/libv4l2rds.c
   create mode 100644 lib/libv4l2rds/libv4l2rds.pc.in






diff --git a/lib/include/libv4l2rds.h b/lib/include/libv4l2rds.h
new file mode 100644
index 000..4aa8593
--- /dev/null
+++ b/lib/include/libv4l2rds.h
@@ -0,0 +1,228 @@
+/*
+ * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights 
reserved.
+ * Author: Konke Radlow 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * 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
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+ */
+
+#ifndef __LIBV4L2RDS
+#define __LIBV4L2RDS
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 


You should never include config.h in a public header, also
are all the headers really needed for the prototypes in this header?

I don't think so! Please move all the unneeded ones to the libv4l2rds.c
file!


+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#if HAVE_VISIBILITY
+#define LIBV4L_PUBLIC __attribute__ ((visibility("default")))
+#else
+#define LIBV4L_PUBLIC
+#endif
+
+/* used to define the current version (version field) of the v4l2_rds struct */
+#define V4L2_RDS_VERSION (1)
+


What is the purpose of this field? Once we've released a v4l-utils with this
library we are stuck to the API we've defined, having a version field & 
changing it,
won't stop us from breaking existing apps, so once we've an official release we
simply cannot make ABI breaking changes, which is why most of my review sofar
has concentrated on the API side :)

I suggest dropping this define and the version field from the struct.


I think it is useful, actually. The v4l2_rds struct is allocated by the 
v4l2_rds_create
so at least in theory it is possible to extend the struct in the future without 
breaking
existing apps, provided you have a version number to check.


I disagree, if it gets extended only, then existing apps will just work, if an 
apps gets
compiled against a newer version with the extension then it is safe to assume 
it will run
against that newer version. The only reason I can see a version define being 
useful is
to make a newer app compile with an older version of the librarry, but that 
only requires
a version define, not a version field in the struct.

Regards,

Hans
--
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 3.6-rc1] media updates part 2

2012-08-10 Thread Hans de Goede

Hi,

On 08/09/2012 10:03 PM, David Rientjes wrote:

On Thu, 9 Aug 2012, Mauro Carvalho Chehab wrote:


Yeah, that would work as well, although the code would look uglier.
IMHO, using select/depend is better.



Agreed, I think it should be "depends on LEDS_CLASS" rather than select
it if there is a hard dependency that cannot be fixed with extracting the
led support in the driver to #ifdef CONFIG_LEDS_CLASS code.


The led support could be #ifdef CONFIG_LEDS_CLASS, the problem with that
approach is the whole module versus build-in thing:

led-class   shark   enable-led-support
build-inbuild-inyes
build-inmodule  yes
module  build-inno
module  module  yes

Now this can be coded into #ifdef magic, but it won't be pretty,
of course we only need the non pretty version once at the top
to set a SHARK_USE_LEDS define, but still.

I'm fine with either solution (depends or ifdef magic), although
I think that people will get unpleasantly surprised if they want
to use the shark driver and they don't get to see it in the
menu because they don't have leds enabled.

Regards,

Hans
--
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