Re: [PATCH v3 09/10] v4l: Aptina-style sensor PLL support

2012-03-04 Thread Laurent Pinchart
Hi Sakari,

On Sunday 04 March 2012 00:37:07 Sakari Ailus wrote:
 On Sat, Mar 03, 2012 at 04:28:14PM +0100, Laurent Pinchart wrote:
  Add a generic helper function to compute PLL parameters for PLL found in
  several Aptina sensors.

[snip]

  diff --git a/drivers/media/video/aptina-pll.c
  b/drivers/media/video/aptina-pll.c new file mode 100644
  index 000..55e4a40
  --- /dev/null
  +++ b/drivers/media/video/aptina-pll.c

[snip]

  +int aptina_pll_configure(struct device *dev, struct aptina_pll *pll,
  +const struct aptina_pll_limits *limits)
 
 I've done the same to the SMIA++ PLL: it can be used separately from the
 driver now; it'll be part of the next patchset.
 
 Do you think it could make sense to swap pll and limits parameters?

Why ? :-)

 I call the function smiapp_pll_calculate().

I've renamed the function to aptina_pll_calculate().

  +{
  +   unsigned int mf_min;
  +   unsigned int mf_max;
  +   unsigned int p1_min;
  +   unsigned int p1_max;
  +   unsigned int p1;
  +   unsigned int div;
  +
  +   if (pll-ext_clock  limits-ext_clock_min ||
  +   pll-ext_clock  limits-ext_clock_max) {
  +   dev_err(dev, pll: invalid external clock frequency.\n);
  +   return -EINVAL;
  +   }
  +
  +   if (pll-pix_clock  limits-pix_clock_max) {
  +   dev_err(dev, pll: invalid pixel clock frequency.\n);
  +   return -EINVAL;
  +   }
 
 You could check that pix_clock isn't zero.

OK.

[snip]

  +   for (p1 = p1_max  ~1; p1 = p1_min; p1 -= 2) {
  +   unsigned int mf_inc = lcm(div, p1) / div;
 
 I think you could avoid division by using p1 * gcd(div, p1) instead.

That's not the same. lcm(div, p1) / div == p1 / gcd(div, p1). There's still a 
division, but it's slightly better, so I'll use that.

  +   unsigned int mf_high;
  +   unsigned int mf_low;
  +
  +   mf_low = max(roundup(mf_min, mf_inc),
  +DIV_ROUND_UP(pll-ext_clock * p1,
  +  limits-int_clock_max * div));
  +   mf_high = min(mf_max, pll-ext_clock * p1 /
  + (limits-int_clock_min * div));
  +
  +   if (mf_low = mf_high) {
  +   pll-n = div * mf_low / p1;
  +   pll-m *= mf_low;
  +   pll-p1 = p1;
  +   break;
 
 You could return already here.

OK.

  +   }
  +   }
  +
  +   if (p1  p1_min) {
  +   dev_err(dev, pll: no valid N and P1 divisors found.\n);
  +   return -EINVAL;
  +   }
  +
  +   dev_dbg(dev, PLL: ext clock %u N %u M %u P1 %u pix clock %u\n,
  +pll-ext_clock, pll-n, pll-m, pll-p1, pll-pix_clock);
  +
  +   return 0;
  +}

-- 
Regards,

Laurent Pinchart

--
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 v3 09/10] v4l: Aptina-style sensor PLL support

2012-03-04 Thread Laurent Pinchart
Hi Andy,

Thanks for the review.

On Saturday 03 March 2012 12:35:09 Andy Walls wrote:
 On Sat, 2012-03-03 at 16:28 +0100, Laurent Pinchart wrote:
  Add a generic helper function to compute PLL parameters for PLL found in
  several Aptina sensors.

[snip]

  +int aptina_pll_configure(struct device *dev, struct aptina_pll *pll,
  +const struct aptina_pll_limits *limits)
  +{
  +   unsigned int mf_min;
  +   unsigned int mf_max;
  +   unsigned int p1_min;
  +   unsigned int p1_max;
  +   unsigned int p1;
  +   unsigned int div;
  +
  +   if (pll-ext_clock  limits-ext_clock_min ||
  +   pll-ext_clock  limits-ext_clock_max) {
  +   dev_err(dev, pll: invalid external clock frequency.\n);
  +   return -EINVAL;
  +   }
  +
  +   if (pll-pix_clock  limits-pix_clock_max) {
  +   dev_err(dev, pll: invalid pixel clock frequency.\n);
  +   return -EINVAL;
  +   }
  +
  +   /* Compute the multiplier M and combined N*P1 divisor. */
  +   div = gcd(pll-pix_clock, pll-ext_clock);
  +   pll-m = pll-pix_clock / div;
  +   div = pll-ext_clock / div;
  +
  +   /* We now have the smallest M and N*P1 values that will result in the
  +* desired pixel clock frequency, but they might be out of the valid
  +* range. Compute the factor by which we should multiply them given
  +* the following constraints:
  +*
  +* - minimum/maximum multiplier
  +* - minimum/maximum multiplier output clock frequency assuming the
  +*   minimum/maximum N value
  +* - minimum/maximum combined N*P1 divisor
  +*/
  +   mf_min = DIV_ROUND_UP(limits-m_min, pll-m);
  +   mf_min = max(mf_min, limits-out_clock_min /
  +(pll-ext_clock / limits-n_min * pll-m));
  +   mf_min = max(mf_min, limits-n_min * limits-p1_min / div);
  +   mf_max = limits-m_max / pll-m;
  +   mf_max = min(mf_max, limits-out_clock_max /
  +   (pll-ext_clock / limits-n_max * pll-m));
  +   mf_max = min(mf_max, DIV_ROUND_UP(limits-n_max * limits-p1_max, 
div));
  +
  +   dev_dbg(dev, pll: mf min %u max %u\n, mf_min, mf_max);
  +   if (mf_min  mf_max) {
  +   dev_err(dev, pll: no valid combined N*P1 divisor.\n);
  +   return -EINVAL;
  +   }
  +
  +   /*
  +* We're looking for the highest acceptable P1 value
 
 Why the *highest* acceptable post-divide (P1) value?

According to the Aptina datasheets, it is desirable to keep (fEXTCLK / n) as 
large as possible within the limits.

  for which a
  +* multiplier factor MF exists that fulfills the following 
conditions:
  +*
  +* 1. p1 is in the [p1_min, p1_max] range given by the limits and is
  +*even
  +* 2. mf is in the [mf_min, mf_max] range computed above
  +* 3. div * mf is a multiple of p1, in order to compute
  +*  n = div * mf / p1
  +*  m = pll-m * mf
  +* 4. the internal clock frequency, given by ext_clock / n, is in the
  +*[int_clock_min, int_clock_max] range given by the limits
  +* 5. the output clock frequency, given by ext_clock / n * m, is in 
the
  +*[out_clock_min, out_clock_max] range given by the limits
  +*
 
 So just to make your constrained optimzation problem even more complex:
 
 I would imagine you would get faster PLL lock and less phase noise by
 having the VCO operate near its center frequency.
 
 If you think that is a sensible constraint, then that translates to
 having the PLL output before post-divide (i.e. ext_clock / n * m), to be
 as close as possible to the center frequency of the VCO (i.e.
 (out_clock_max - out_clock_min) / 2 ).

Good point. But... *ouch* :-)

Do you think it's worth it ?

-- 
Regards,

Laurent Pinchart

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


Terratec H7

2012-03-04 Thread Roger Mårtensson

Hi!

I noticed that support for Terratec H7 arrived not long ago. Thank you 
very much.


It works very well in kaffeine and gnutv(the only applications tested at 
the moment). I have tried it with DVB-C without any problems as long as 
I choose unencrypted channels.
I haven't tried DVB-T but I guess it will work too. I do have access to 
it if testing is needed.


I now wonder if CI support is planned to get implemented?
It is a feature I am missing.

I have access to DVB-C in both unencrypted and encrypted channels and 
may be able to help in testing.
I have access to a Smit CAM(conax) if that does matter. I may be able to 
test encrypted DVB-T too but since I'm not using that at the moment I'm 
not sure I have the right CAM.


 * Okänt - identifierat
 * Engelska
 * Svenska
 * Franska
 * Tyska

 * Engelska
 * Svenska
 * Franska
 * Tyska

 javascript:void(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


[media] dvb: Buffer Overfolow in cx24110_set_fec

2012-03-04 Thread santosh prasad nayak
Hi,

I am getting following error:

drivers/media/dvb/frontends/cx24110.c:210 cx24110_set_fec() error:
buffer overflow 'rate' 7 = 8

 In cx24110_set_fec, arrays  rate[] , g1[], g2[]  have only 7 values.


typedef enum fe_code_rate {

FEC_6_7,   // index 7
FEC_7_8,   // index 8
FEC_8_9,
FEC_AUTO,
 .
  
} fe_code_rate_t;


For FEC_6_7   fecFEC_AUTO  , rate[fec]. g1[fec], g2[fec]
values are not defined initially.
Is it expected or bug ?


regards
Santosh
--
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 v3 09/10] v4l: Aptina-style sensor PLL support

2012-03-04 Thread Sakari Ailus

Hi Laurent,

Laurent Pinchart wrote:

On Sunday 04 March 2012 00:37:07 Sakari Ailus wrote:

On Sat, Mar 03, 2012 at 04:28:14PM +0100, Laurent Pinchart wrote:

Add a generic helper function to compute PLL parameters for PLL found in
several Aptina sensors.


[snip]


diff --git a/drivers/media/video/aptina-pll.c
b/drivers/media/video/aptina-pll.c new file mode 100644
index 000..55e4a40
--- /dev/null
+++ b/drivers/media/video/aptina-pll.c


[snip]


+int aptina_pll_configure(struct device *dev, struct aptina_pll *pll,
+const struct aptina_pll_limits *limits)


I've done the same to the SMIA++ PLL: it can be used separately from the
driver now; it'll be part of the next patchset.

Do you think it could make sense to swap pll and limits parameters?


Why ? :-)


Uh, I have it that way. ;-) Also both dev and limits contain perhaps 
less interesting or const information than pll, which contains both 
input and output parameters.



I call the function smiapp_pll_calculate().


I've renamed the function to aptina_pll_calculate().


+{
+   unsigned int mf_min;
+   unsigned int mf_max;
+   unsigned int p1_min;
+   unsigned int p1_max;
+   unsigned int p1;
+   unsigned int div;
+
+   if (pll-ext_clock  limits-ext_clock_min ||
+   pll-ext_clock  limits-ext_clock_max) {
+   dev_err(dev, pll: invalid external clock frequency.\n);
+   return -EINVAL;
+   }
+
+   if (pll-pix_clock  limits-pix_clock_max) {
+   dev_err(dev, pll: invalid pixel clock frequency.\n);
+   return -EINVAL;
+   }


You could check that pix_clock isn't zero.


OK.

[snip]


+   for (p1 = p1_max  ~1; p1= p1_min; p1 -= 2) {
+   unsigned int mf_inc = lcm(div, p1) / div;


I think you could avoid division by using p1 * gcd(div, p1) instead.


That's not the same. lcm(div, p1) / div == p1 / gcd(div, p1). There's still a
division, but it's slightly better, so I'll use that.


Right; you can put that on the late hour I was writing this at. ;-)


+   unsigned int mf_high;
+   unsigned int mf_low;
+
+   mf_low = max(roundup(mf_min, mf_inc),
+DIV_ROUND_UP(pll-ext_clock * p1,
+  limits-int_clock_max * div));
+   mf_high = min(mf_max, pll-ext_clock * p1 /
+ (limits-int_clock_min * div));
+
+   if (mf_low= mf_high) {
+   pll-n = div * mf_low / p1;
+   pll-m *= mf_low;
+   pll-p1 = p1;
+   break;


You could return already here.


OK.


Or even:

if (mf_low  mf_high)
continue;

dev_dbg(stuff);
return 0;

I find this often easier to read. It's up to you.


+   }
+   }
+
+   if (p1  p1_min) {
+   dev_err(dev, pll: no valid N and P1 divisors found.\n);
+   return -EINVAL;
+   }
+
+   dev_dbg(dev, PLL: ext clock %u N %u M %u P1 %u pix clock %u\n,
+pll-ext_clock, pll-n, pll-m, pll-p1, pll-pix_clock);
+
+   return 0;
+}





--
Sakari Ailus
sakari.ai...@iki.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 v3 2/2] v4l2: add new pixel formats supported on dm365

2012-03-04 Thread Sakari Ailus
Hi Manju,

Thanks for the patch.

On Tue, Feb 07, 2012 at 03:35:14PM +0530, Manjunath Hadli wrote:
 add new macro V4L2_PIX_FMT_SGRBG10ALAW8 and associated formats
 to represent Bayer format frames compressed by A-LAW algorithm,
 add V4L2_PIX_FMT_UV8 to represent storage of C data (UV interleaved)
 only.
 
 Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  .../DocBook/media/v4l/pixfmt-srggb10alaw8.xml  |   34 +++
  Documentation/DocBook/media/v4l/pixfmt-uv8.xml |   62 
 
  Documentation/DocBook/media/v4l/pixfmt.xml |2 +
  include/linux/videodev2.h  |9 +++
  4 files changed, 107 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml
  create mode 100644 Documentation/DocBook/media/v4l/pixfmt-uv8.xml
 
 diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml 
 b/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml
 new file mode 100644
 index 000..b20f525
 --- /dev/null
 +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml
 @@ -0,0 +1,34 @@
 + refentry
 +   refmeta
 + refentrytitle
 +   V4L2_PIX_FMT_SRGGB10ALAW8 ('aRA8'),
 +   V4L2_PIX_FMT_SGBRG10ALAW8 ('aGA8'),
 +   V4L2_PIX_FMT_SGRBG10ALAW8 ('agA8'),
 +   V4L2_PIX_FMT_SBGGR10ALAW8 ('aBA8'),
 + /refentrytitle
 + manvol;
 +   /refmeta
 +   refnamediv
 + refname id=V4L2-PIX-FMT-SRGGB10ALAW8
 +   constantV4L2_PIX_FMT_SRGGB10ALAW8/constant
 + /refname
 + refname id=V4L2-PIX-FMT-SGRBG10ALAW8
 +   constantV4L2_PIX_FMT_SGRBG10ALAW8/constant
 + /refname
 + refname id=V4L2-PIX-FMT-SGBRG10ALAW8
 +   constantV4L2_PIX_FMT_SGBRG10ALAW8/constant
 + /refname

The order here is different than earlier.

 + refname id=V4L2-PIX-FMT-SBGGR10ALAW8
 +   constantV4L2_PIX_FMT_SBGGR10ALAW8/constant
 + /refname
 + refpurpose10-bit Bayer formats compressed to 8 bits/refpurpose
 +   /refnamediv
 +   refsect1
 + titleDescription/title
 + paraThe following four pixel formats are raw sRGB / Bayer
 + formats with 10 bits per colour compressed to 8 bits each,
 + using the A-LAW algorithm. Each colour component consumes 8
 + bits of memory. In other respects this format is similar to
 + xref linkend=V4L2-PIX-FMT-SRGGB8./xref/para
 +   /refsect1
 + /refentry
 diff --git a/Documentation/DocBook/media/v4l/pixfmt-uv8.xml 
 b/Documentation/DocBook/media/v4l/pixfmt-uv8.xml
 new file mode 100644
 index 000..e3e6b11
 --- /dev/null
 +++ b/Documentation/DocBook/media/v4l/pixfmt-uv8.xml
 @@ -0,0 +1,62 @@
 + refentry id=V4L2-PIX-FMT-UV8
 +   refmeta
 + refentrytitleV4L2_PIX_FMT_UV8  ('UV8')/refentrytitle
 + manvol;
 +   /refmeta
 +   refnamediv
 + refnameconstantV4L2_PIX_FMT_UV8/constant/refname
 + refpurposeUV plane interleaved/refpurpose
 +   /refnamediv
 +   refsect1
 + titleDescription/title
 + paraIn this format there is no Y plane, Only C plane. ie
 + (UV interleaved)/para

How about referring to CbCr instead of C?

 + example
 + title
 +   constantV4L2_PIX_FMT_UV8/constant
 +pixel image
 + /title
 +
 + formalpara
 +   titleByte Order./title
 +   paraEach cell is one byte.
 + informaltable frame=none
 + tgroup cols=5 align=center
 +   colspec align=left colwidth=2* /
 +   tbody valign=top
 + row
 +   entrystartnbsp;+nbsp;0:/entry
 +   entryCbsubscript00/subscript/entry
 +   entryCrsubscript00/subscript/entry
 +   entryCbsubscript01/subscript/entry
 +   entryCrsubscript01/subscript/entry
 + /row
 + row
 +   entrystartnbsp;+nbsp;4:/entry
 +   entryCbsubscript10/subscript/entry
 +   entryCrsubscript10/subscript/entry
 +   entryCbsubscript11/subscript/entry
 +   entryCrsubscript11/subscript/entry
 + /row
 + row
 +   entrystartnbsp;+nbsp;8:/entry
 +   entryCbsubscript20/subscript/entry
 +   entryCrsubscript20/subscript/entry
 +   entryCbsubscript21/subscript/entry
 +   entryCrsubscript21/subscript/entry
 + /row
 + row
 +   entrystartnbsp;+nbsp;12:/entry
 +   entryCbsubscript30/subscript/entry
 +   entryCrsubscript30/subscript/entry
 +   entryCbsubscript31/subscript/entry
 +   entryCrsubscript31/subscript/entry
 +

[PATCH] ivtv: Fix build warning

2012-03-04 Thread Larry Finger
In driver ivtv, there is a mismatch between the type of the radio module 
parameter
and the storage variable, which leads to the following warning:

  CC [M]  drivers/media/video/ivtv/ivtv-driver.o
drivers/media/video/ivtv/ivtv-driver.c: In function ‘__check_radio’:
drivers/media/video/ivtv/ivtv-driver.c:142: warning: return from incompatible 
pointer type
drivers/media/video/ivtv/ivtv-driver.c: At top level:
drivers/media/video/ivtv/ivtv-driver.c:142: warning: initialization from 
incompatible pointer type

Signed-off-by: Larry Finger larry.fin...@lwfinger.net
---

Index: linux-2.6/drivers/media/video/ivtv/ivtv-driver.c
===
--- linux-2.6.orig/drivers/media/video/ivtv/ivtv-driver.c
+++ linux-2.6/drivers/media/video/ivtv/ivtv-driver.c
@@ -99,7 +99,7 @@ static int i2c_clock_period[IVTV_MAX_CAR
 
 static unsigned int cardtype_c = 1;
 static unsigned int tuner_c = 1;
-static bool radio_c = 1;
+static int radio_c = 1;
 static unsigned int i2c_clock_period_c = 1;
 static char pal[] = ---;
 static char secam[] = --;
@@ -139,7 +139,7 @@ static int tunertype = -1;
 static int newi2c = -1;
 
 module_param_array(tuner, int, tuner_c, 0644);
-module_param_array(radio, bool, radio_c, 0644);
+module_param_array(radio, int, radio_c, 0644);
 module_param_array(cardtype, int, cardtype_c, 0644);
 module_param_string(pal, pal, sizeof(pal), 0644);
 module_param_string(secam, secam, sizeof(secam), 0644);
--
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


cron job: media_tree daily build: WARNINGS

2012-03-04 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:Sun Mar  4 19:00:16 CET 2012
git hash:e8ca6d20a65d9d94693a0ed99b12d95b882dc859
gcc version:  i686-linux-gcc (GCC) 4.6.2
host hardware:x86_64
host os:  3.1-2.slh.1-amd64

linux-git-arm-eabi-enoxys: WARNINGS
linux-git-arm-eabi-omap: WARNINGS
linux-git-armv5-ixp: 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-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-rc1-i686: 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-rc1-x86_64: WARNINGS
apps: WARNINGS
spec-git: WARNINGS
sparse: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.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


[PATCH] media, cx231xx: Fix double free on close

2012-03-04 Thread Jesper Juhl
In cx231xx_v4l2_close() there are two calls to
cx231xx_release_resources(dev) followed by kfree(dev). That is a
problem since cx231xx_release_resources() already kfree()'s its
argument, so we end up doing a double free.

Easily resolved by just removing the redundant kfree() calls after the
calls to cx231xx_release_resources().

I also changed the 'dev = NULL' assignments (which are rather
pointless since 'dev' is about to go out of scope), to 'fh-dev = NULL'
since it looks to me that that is what was actually intended.
And I removed the 'dev = NULL' assignment at the end of
cx231xx_release_resources() since it is pointless.

Signed-off-by: Jesper Juhl j...@chaosbits.net
---
 drivers/media/video/cx231xx/cx231xx-cards.c |1 -
 drivers/media/video/cx231xx/cx231xx-video.c |6 ++
 2 files changed, 2 insertions(+), 5 deletions(-)

 Please note that I do not have hardware to actually test this properly, 
 so this patch is compile tested only.
 I also do not have very intimate knowledge of this driver, so please 
 review carefully before applying.

diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c 
b/drivers/media/video/cx231xx/cx231xx-cards.c
index 875a7ce..8ed460d 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -861,7 +861,6 @@ void cx231xx_release_resources(struct cx231xx *dev)
kfree(dev-sliced_cc_mode.alt_max_pkt_size);
kfree(dev-ts1_mode.alt_max_pkt_size);
kfree(dev);
-   dev = NULL;
 }
 
 /*
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c 
b/drivers/media/video/cx231xx/cx231xx-video.c
index 829a41b..7f916f0 100644
--- a/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/drivers/media/video/cx231xx/cx231xx-video.c
@@ -2319,8 +2319,7 @@ static int cx231xx_v4l2_close(struct file *filp)
if (dev-state  DEV_DISCONNECTED) {
if (atomic_read(dev-devlist_count)  0) {
cx231xx_release_resources(dev);
-   kfree(dev);
-   dev = NULL;
+   fh-dev = NULL;
return 0;
}
return 0;
@@ -2350,8 +2349,7 @@ static int cx231xx_v4l2_close(struct file *filp)
   free the remaining resources */
if (dev-state  DEV_DISCONNECTED) {
cx231xx_release_resources(dev);
-   kfree(dev);
-   dev = NULL;
+   fh-dev = NULL;
return 0;
}
 
-- 
1.7.9.2


-- 
Jesper Juhl j...@chaosbits.net   http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.

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


dvb lock patch

2012-03-04 Thread Josu Lazkano
Hello all, I am using this patch to get virtual adapters for DVB
devices: 
https://aur.archlinux.org/packages/sa/sascng-linux3-patch/sascng-linux3-patch.tar.gz

Here is more info: https://aur.archlinux.org/packages.php?ID=51325

Is it possible to add this patch on the dvb source?

This patch is needed for people who not have a CI and need to create
virtual adapters to get a working pay-tv system.

Best regards.

-- 
Josu Lazkano
--
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: My Microdia (SN9C201) webcam doesn't work properly in Linux anymore

2012-03-04 Thread Xavion
Hi Jean-Francois

I can confirm that GSPCA v2.15.1 removes the bad pixels when I use
Cheese or VLC.  However, I'm sorry to report that the Motion problems
unfortunately still remain.  Is there something else I must do to
overcome the below errors?  I'm happy to keep testing newer GSPCA
versions for you until we get this fixed.


`-- tail /var/log/kernel.log
Mar  5 08:25:52 Desktop kernel: [ 6673.781987] gspca_main: frame
overflow 156309  155648
Mar  5 08:25:52 Desktop kernel: [ 6673.813992] gspca_main: frame
overflow 156309  155648
Mar  5 08:25:53 Desktop kernel: [ 6673.849986] gspca_main: frame
overflow 155693  155648
Mar  5 08:25:53 Desktop kernel: [ 6673.881989] gspca_main: frame
overflow 156021  155648
Mar  5 08:25:53 Desktop kernel: [ 6673.917991] gspca_main: frame
overflow 156309  155648
Mar  5 08:25:53 Desktop kernel: [ 6673.949993] gspca_main: frame
overflow 156309  155648
Mar  5 08:25:53 Desktop kernel: [ 6673.985990] gspca_main: frame
overflow 156309  155648
Mar  5 08:25:53 Desktop kernel: [ 6674.021981] gspca_main: frame
overflow 156309  155648
Mar  5 08:25:53 Desktop kernel: [ 6674.053985] gspca_main: frame
overflow 156309  155648
Mar  5 08:25:53 Desktop kernel: [ 6674.089989] gspca_main: frame
overflow 156309  155648


`-- tail /var/log/errors.log
Mar  5 08:24:16 Desktop motion: [1] v4l2_next: VIDIOC_QBUF: Invalid argument
Mar  5 08:24:16 Desktop motion: [1] Video device fatal error - Closing
video device
Mar  5 08:24:20 Desktop motion: [1] Retrying until successful
connection with camera
Mar  5 08:24:27 Desktop motion: [1] v4l2_next: VIDIOC_DQBUF: EIO
(s-pframe 3): Input/output error
Mar  5 08:24:27 Desktop motion: [1] v4l2_next: VIDIOC_QBUF: Invalid argument
Mar  5 08:24:27 Desktop motion: [1] Video device fatal error - Closing
video device
Mar  5 08:24:30 Desktop motion: [1] Retrying until successful
connection with camera
Mar  5 08:24:33 Desktop motion: [1] v4l2_next: VIDIOC_DQBUF: EIO
(s-pframe 0): Input/output error
Mar  5 08:24:33 Desktop motion: [1] v4l2_next: VIDIOC_QBUF: Invalid argument
Mar  5 08:24:33 Desktop motion: [1] Video device fatal error - Closing
video device
--
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: rtl2830: __udivdi3 undefined

2012-03-04 Thread Gianluca Gennari
Il 29/02/2012 22:30, Geert Uytterhoeven ha scritto:
 http://kisskb.ellerman.id.au/kisskb/buildresult/5759200/ ERROR:
 __udivdi3 [drivers/media/dvb/frontends/rtl2830.ko] undefined!
 
 I didn't look too deeply into it, but I think it's caused by the
 num /= priv-cfg.xtal in rtl2830_init() (with num being u64).
 
 Can't it use do_div() instead?
 
 Gr{oetje,eeting}s,
 
 Geert
 
 -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 --
 ge...@linux-m68k.org
 
 In personal conversations with technical people, I call myself a
 hacker. But when I'm talking to journalists I just say programmer
 or something like that. -- Linus Torvalds -- 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
 

Probably the best solution is to use div_u64.
The following patch fixed the warning on my 32 bit system.

Signed-off-by: Gianluca Gennari gennar...@gmail.com
---
 drivers/media/dvb/frontends/rtl2830.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/dvb/frontends/rtl2830.c
b/drivers/media/dvb/frontends/rtl2830.c
index f971d94..45196c5 100644
--- a/drivers/media/dvb/frontends/rtl2830.c
+++ b/drivers/media/dvb/frontends/rtl2830.c
@@ -244,7 +244,7 @@ static int rtl2830_init(struct dvb_frontend *fe)

num = priv-cfg.if_dvbt % priv-cfg.xtal;
num *= 0x40;
-   num /= priv-cfg.xtal;
+   num = div_u64(num, priv-cfg.xtal);
num = -num;
if_ctl = num  0x3f;
dbg(%s: if_ctl=%08x, __func__, if_ctl);
-- 
1.7.0.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: [PATCH v3 09/10] v4l: Aptina-style sensor PLL support

2012-03-04 Thread Laurent Pinchart
Hi Sakari,

On Sunday 04 March 2012 17:01:30 Sakari Ailus wrote:
 Laurent Pinchart wrote:
  On Sunday 04 March 2012 00:37:07 Sakari Ailus wrote:
  On Sat, Mar 03, 2012 at 04:28:14PM +0100, Laurent Pinchart wrote:
  Add a generic helper function to compute PLL parameters for PLL found in
  several Aptina sensors.
  
  [snip]
  
  diff --git a/drivers/media/video/aptina-pll.c
  b/drivers/media/video/aptina-pll.c new file mode 100644
  index 000..55e4a40
  --- /dev/null
  +++ b/drivers/media/video/aptina-pll.c
  
  [snip]
  
  +int aptina_pll_configure(struct device *dev, struct aptina_pll *pll,
  +  const struct aptina_pll_limits *limits)
  
  I've done the same to the SMIA++ PLL: it can be used separately from the
  driver now; it'll be part of the next patchset.
  
  Do you think it could make sense to swap pll and limits parameters?
  
  Why ? :-)
 
 Uh, I have it that way. ;-) Also both dev and limits contain perhaps
 less interesting or const information than pll, which contains both
 input and output parameters.

You're lucky, I'm in a good mood, I'll change that ;-)

-- 
Regards,

Laurent Pinchart

--
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] Add CI support to az6007 driver

2012-03-04 Thread Jose Alberto Reguero
This patch add CI support to az6007 driver.

Signed-off-by: Jose Alberto Reguero jaregu...@telefonica.netdiff -urN linux/drivers/media/dvb/dvb-usb/az6007.c linux.new/drivers/media/dvb/dvb-usb/az6007.c
--- linux/drivers/media/dvb/dvb-usb/az6007.c	2012-01-22 02:53:17.0 +0100
+++ linux.new/drivers/media/dvb/dvb-usb/az6007.c	2012-02-11 00:32:35.534490502 +0100
@@ -54,6 +54,7 @@
 
 struct az6007_device_state {
 	struct mutex		mutex;
+	struct mutex		ca_mutex;
 	struct dvb_ca_en50221	ca;
 	unsigned		warm:1;
 	int			(*gate_ctrl) (struct dvb_frontend *, int);
@@ -218,6 +219,371 @@
 	return 0;
 }
 
+static int az6007_ci_read_attribute_mem(struct dvb_ca_en50221 *ca,
+	int slot,
+	int address)
+{
+	struct dvb_usb_device *d = (struct dvb_usb_device *)ca-data;
+	struct az6007_device_state *state = (struct az6007_device_state *)d-priv;
+
+	int ret;
+	u8 req;
+	u16 value;
+	u16 index;
+	int blen;
+	u8 *b;
+
+	if (slot != 0)
+		return -EINVAL;
+
+	b = kmalloc(12, GFP_KERNEL);
+	if (!b)
+		return -ENOMEM;
+
+	mutex_lock(state-ca_mutex);
+
+	req = 0xC1;
+	value = address;
+	index = 0;
+	blen = 1;
+
+	ret = az6007_read(d, req, value, index, b, blen);
+	if (ret  0) {
+		warn(usb in operation failed. (%d), ret);
+		ret = -EINVAL;
+	} else {
+		ret = b[0];
+	}
+
+	mutex_unlock(state-ca_mutex);
+	kfree(b);
+	return ret;
+}
+
+static int az6007_ci_write_attribute_mem(struct dvb_ca_en50221 *ca,
+	 int slot,
+	 int address,
+	 u8 value)
+{
+	struct dvb_usb_device *d = (struct dvb_usb_device *)ca-data;
+	struct az6007_device_state *state = (struct az6007_device_state *)d-priv;
+
+	int ret;
+	u8 req;
+	u16 value1;
+	u16 index;
+	int blen;
+
+	deb_info(%s %d, __func__, slot);
+	if (slot != 0)
+		return -EINVAL;
+
+	mutex_lock(state-ca_mutex);
+	req = 0xC2;
+	value1 = address;
+	index = value;
+	blen = 0;
+
+	ret = az6007_write(d, req, value1, index, NULL, blen);
+	if (ret != 0)
+		warn(usb out operation failed. (%d), ret);
+
+	mutex_unlock(state-ca_mutex);
+	return ret;
+}
+
+static int az6007_ci_read_cam_control(struct dvb_ca_en50221 *ca,
+  int slot,
+  u8 address)
+{
+	struct dvb_usb_device *d = (struct dvb_usb_device *)ca-data;
+	struct az6007_device_state *state = (struct az6007_device_state *)d-priv;
+
+	int ret;
+	u8 req;
+	u16 value;
+	u16 index;
+	int blen;
+	u8 *b;
+
+	if (slot != 0)
+		return -EINVAL;
+
+	b = kmalloc(12, GFP_KERNEL);
+	if (!b)
+		return -ENOMEM;
+
+	mutex_lock(state-ca_mutex);
+
+	req = 0xC3;
+	value = address;
+	index = 0;
+	blen = 2;
+
+	ret = az6007_read(d, req, value, index, b, blen);
+	if (ret  0) {
+		warn(usb in operation failed. (%d), ret);
+		ret = -EINVAL;
+	} else {
+		if (b[0] == 0)
+			warn(Read CI IO error);
+
+		ret = b[1];
+		deb_info(read cam data = %x from 0x%x, b[1], value);
+	}
+
+	mutex_unlock(state-ca_mutex);
+	kfree(b);
+	return ret;
+}
+
+static int az6007_ci_write_cam_control(struct dvb_ca_en50221 *ca,
+   int slot,
+   u8 address,
+   u8 value)
+{
+	struct dvb_usb_device *d = (struct dvb_usb_device *)ca-data;
+	struct az6007_device_state *state = (struct az6007_device_state *)d-priv;
+
+	int ret;
+	u8 req;
+	u16 value1;
+	u16 index;
+	int blen;
+
+	if (slot != 0)
+		return -EINVAL;
+
+	mutex_lock(state-ca_mutex);
+	req = 0xC4;
+	value1 = address;
+	index = value;
+	blen = 0;
+
+	ret = az6007_write(d, req, value1, index, NULL, blen);
+	if (ret != 0) {
+		warn(usb out operation failed. (%d), ret);
+		goto failed;
+	}
+
+failed:
+	mutex_unlock(state-ca_mutex);
+	return ret;
+}
+
+static int CI_CamReady(struct dvb_ca_en50221 *ca, int slot)
+{
+	struct dvb_usb_device *d = (struct dvb_usb_device *)ca-data;
+
+	int ret;
+	u8 req;
+	u16 value;
+	u16 index;
+	int blen;
+	u8 *b;
+
+	b = kmalloc(12, GFP_KERNEL);
+	if (!b)
+		return -ENOMEM;
+
+	req = 0xC8;
+	value = 0;
+	index = 0;
+	blen = 1;
+
+	ret = az6007_read(d, req, value, index, b, blen);
+	if (ret  0) {
+		warn(usb in operation failed. (%d), ret);
+		ret = -EIO;
+	} else{
+		ret = b[0];
+	}
+	kfree(b);
+	return ret;
+}
+
+static int az6007_ci_slot_reset(struct dvb_ca_en50221 *ca, int slot)
+{
+	struct dvb_usb_device *d = (struct dvb_usb_device *)ca-data;
+	struct az6007_device_state *state = (struct az6007_device_state *)d-priv;
+
+	int ret, i;
+	u8 req;
+	u16 value;
+	u16 index;
+	int blen;
+
+	mutex_lock(state-ca_mutex);
+
+	req = 0xC6;
+	value = 1;
+	index = 0;
+	blen = 0;
+
+	ret = az6007_write(d, req, value, index, NULL, blen);
+	if (ret != 0) {
+		warn(usb out operation failed. (%d), ret);
+		goto failed;
+	}
+
+	msleep(500);
+	req = 0xC6;
+	value = 0;
+	index = 0;
+	blen = 0;
+
+	ret = az6007_write(d, req, value, index, NULL, blen);
+	if (ret != 0) {
+		warn(usb out operation failed. (%d), ret);
+		goto failed;
+	}
+
+	for (i = 0; i  15; i++) {
+		msleep(100);
+
+		if (CI_CamReady(ca, slot)) {
+			deb_info(CAM Ready);
+			break;
+		}
+	}
+	msleep(5000);
+
+failed:
+	mutex_unlock(state-ca_mutex);
+	return ret;
+}
+
+static int az6007_ci_slot_shutdown(struct 

[bug?] ov519 fails to handle Hercules Deluxe webcam

2012-03-04 Thread Jonathan Nieder
Hi,

Skippy le Grand Gourou wrote[1]:

 Hercules Deluxe USB webcam won't work, see the end of the kernel
 log.
[...]
 [521041.808976] gspca: probing 05a9:4519
 [521042.469094] ov519: I2C synced in 3 attempt(s)
 [521042.469097] ov519: starting OV7xx0 configuration
 [521042.469793] ov519: Unknown image sensor version: 2
 [521042.469795] ov519: Failed to configure OV7xx0
 [521042.469797] ov519: OV519 Config failed
 [521042.469807] ov519: probe of 3-1.4:1.0 failed with error -16
 [521042.469884] gspca: probing 05a9:4519
 [521467.885255] usbcore: deregistering interface driver ov519
 [521467.885278] ov519: deregistered
 [521467.900288] gspca: main deregistered
 [521809.376462] dialog[12612]: segfault at 0 ip b77c6125 sp bf8861b0 error 4 
 in libncursesw.so.5.7[b77b5000+43000]
 [524303.418813] usb 3-1.3: USB disconnect, address 9
[...]
 [528511.174900] usb 3-1.4: USB disconnect, address 10
 [528513.420812] usb 3-1.4: new full speed USB device using ehci_hcd and 
 address 13
 [528513.515013] usb 3-1.4: New USB device found, idVendor=05a9, idProduct=4519
 [528513.515018] usb 3-1.4: New USB device strings: Mfr=1, Product=2, 
 SerialNumber=0
 [528513.515021] usb 3-1.4: Product: USB Camera
 [528513.515023] usb 3-1.4: Manufacturer: OmniVision Technologies, Inc.
 [528513.515116] usb 3-1.4: configuration #1 chosen from 1 choice
 [528513.524620] Linux video capture interface: v2.00
 [528513.526783] gspca: main v2.7.0 registered
 [528513.527299] gspca: probing 05a9:4519
 [528514.190995] ov519: I2C synced in 3 attempt(s)
 [528514.190998] ov519: starting OV7xx0 configuration
 [528514.192570] ov519: Sensor is an OV7610
 [528514.417110] ov519: probe of 3-1.4:1.0 failed with error -5
 [528514.417139] usbcore: registered new interface driver ov519
 [528514.417143] ov519: registered
[...]
 00:1a.0 USB Controller [0c03]: Intel Corporation Cougar Point USB Enhanced 
 Host Controller #2 [8086:1c2d] (rev 05) (prog-if 20 [EHCI])
 Subsystem: ASUSTeK Computer Inc. Device [1043:844d]
[...]
 Bus 001 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
 Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
 Bus 003 Device 012: ID 9e88:9e8f  
 Bus 003 Device 013: ID 05a9:4519 OmniVision Technologies, Inc. Webcam Classic
 Bus 003 Device 005: ID 04a9:221c Canon, Inc. CanoScan LiDE 60
 Bus 003 Device 006: ID 046d:c50e Logitech, Inc. Cordless Mouse Receiver
[...]

Kernel is Debian 2.6.32-41, which is closely based on stable
2.6.32.54.  I don't see any obvious potential fixes in the diff
relative to linux-next.

Known problem?  Any hints for tracking this down?

Thanks,
Jonathan

[1] http://bugs.debian.org/662246
--
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 v3 09/10] v4l: Aptina-style sensor PLL support

2012-03-04 Thread Andy Walls
On Sun, 2012-03-04 at 11:20 +0100, Laurent Pinchart wrote:
 Hi Andy,
 
 Thanks for the review.
 
 On Saturday 03 March 2012 12:35:09 Andy Walls wrote:
  On Sat, 2012-03-03 at 16:28 +0100, Laurent Pinchart wrote:
   Add a generic helper function to compute PLL parameters for PLL found in
   several Aptina sensors.
 
 [snip]
 
   +int aptina_pll_configure(struct device *dev, struct aptina_pll *pll,
   +  const struct aptina_pll_limits *limits)
   +{
   + unsigned int mf_min;
   + unsigned int mf_max;
   + unsigned int p1_min;
   + unsigned int p1_max;
   + unsigned int p1;
   + unsigned int div;
   +
   + if (pll-ext_clock  limits-ext_clock_min ||
   + pll-ext_clock  limits-ext_clock_max) {
   + dev_err(dev, pll: invalid external clock frequency.\n);
   + return -EINVAL;
   + }
   +
   + if (pll-pix_clock  limits-pix_clock_max) {
   + dev_err(dev, pll: invalid pixel clock frequency.\n);
   + return -EINVAL;
   + }
   +
   + /* Compute the multiplier M and combined N*P1 divisor. */
   + div = gcd(pll-pix_clock, pll-ext_clock);
   + pll-m = pll-pix_clock / div;
   + div = pll-ext_clock / div;
   +
   + /* We now have the smallest M and N*P1 values that will result in the
   +  * desired pixel clock frequency, but they might be out of the valid
   +  * range. Compute the factor by which we should multiply them given
   +  * the following constraints:
   +  *
   +  * - minimum/maximum multiplier
   +  * - minimum/maximum multiplier output clock frequency assuming the
   +  *   minimum/maximum N value
   +  * - minimum/maximum combined N*P1 divisor
   +  */
   + mf_min = DIV_ROUND_UP(limits-m_min, pll-m);
   + mf_min = max(mf_min, limits-out_clock_min /
   +  (pll-ext_clock / limits-n_min * pll-m));
   + mf_min = max(mf_min, limits-n_min * limits-p1_min / div);
   + mf_max = limits-m_max / pll-m;
   + mf_max = min(mf_max, limits-out_clock_max /
   + (pll-ext_clock / limits-n_max * pll-m));
   + mf_max = min(mf_max, DIV_ROUND_UP(limits-n_max * limits-p1_max, 
 div));
   +
   + dev_dbg(dev, pll: mf min %u max %u\n, mf_min, mf_max);
   + if (mf_min  mf_max) {
   + dev_err(dev, pll: no valid combined N*P1 divisor.\n);
   + return -EINVAL;
   + }
   +
   + /*
   +  * We're looking for the highest acceptable P1 value
  
  Why the *highest* acceptable post-divide (P1) value?
 
 According to the Aptina datasheets, it is desirable to keep (fEXTCLK / n) as 
 large as possible within the limits.

OK.  I'm looking ath the MT9P031 datasheet now.

The PLL implemented looks like a Classical Digital PLL (DPLL) with
- a Phase/Frequency Detector (PFD) phase detector
- a prescaler (divide by n) of the external reference (ext_clock) in
front of of the PFD
- a post-divider (divide by p1) for dividing the VCO's operating
frequency down (out_clock) for use as an output
- a divider in the feedback loop to multiply (by m) the locked operating
frequency of the VCO compared to the prescaled ext_clock (ext_clock/n)


Aptina's recommendation to keep ext_clock/n as large as possible for
best performance makes sense intuitively: more frequent phase error
measurements probably leads to better phase tracking.  


Since
pix_clock = ext_clock / n * m / p1
 
I guess the objective is really to minimize m/p1 in order to meet the
recommendation.

  for which a
   +  * multiplier factor MF exists that fulfills the following 
 conditions:
   +  *
   +  * 1. p1 is in the [p1_min, p1_max] range given by the limits and is
   +  *even
   +  * 2. mf is in the [mf_min, mf_max] range computed above
   +  * 3. div * mf is a multiple of p1, in order to compute
   +  *  n = div * mf / p1
   +  *  m = pll-m * mf
   +  * 4. the internal clock frequency, given by ext_clock / n, is in the
   +  *[int_clock_min, int_clock_max] range given by the limits
   +  * 5. the output clock frequency, given by ext_clock / n * m, is in 
 the
   +  *[out_clock_min, out_clock_max] range given by the limits
   +  *
  
  So just to make your constrained optimzation problem even more complex:
  
  I would imagine you would get faster PLL lock and less phase noise by
  having the VCO operate near its center frequency.
  
  If you think that is a sensible constraint, then that translates to
  having the PLL output before post-divide (i.e. ext_clock / n * m), to be
  as close as possible to the center frequency of the VCO (i.e.
  (out_clock_max - out_clock_min) / 2 ).
 
 Good point. But... *ouch* :-)

Sorry.  However, upon more research and reflection, I'll revise my
suggestion to be: set m as close as possible to m_mean =
sqrt(m_min*m_max), as that may be optimal for the PLL's operation.  (See
below).

 Do you think it's worth it ?

Well, that depends on the chip design details, but I'm guessing the
answer is No. ;)

For frequency synthesis, one normally doesn't worry much about phase
noise, unless clock jitter will somehow adversely affect the results of
the 

RE: [PATCH v3 2/2] v4l2: add new pixel formats supported on dm365

2012-03-04 Thread Hadli, Manjunath
Sakari,

On Sun, Mar 04, 2012 at 20:49:36, Sakari Ailus wrote:
 Hi Manju,
 
 Thanks for the patch.
 
 On Tue, Feb 07, 2012 at 03:35:14PM +0530, Manjunath Hadli wrote:
  add new macro V4L2_PIX_FMT_SGRBG10ALAW8 and associated formats to 
  represent Bayer format frames compressed by A-LAW algorithm, add 
  V4L2_PIX_FMT_UV8 to represent storage of C data (UV interleaved) only.
  
  Signed-off-by: Manjunath Hadli manjunath.ha...@ti.com
  Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
  ---
   .../DocBook/media/v4l/pixfmt-srggb10alaw8.xml  |   34 +++
   Documentation/DocBook/media/v4l/pixfmt-uv8.xml |   62 
  
   Documentation/DocBook/media/v4l/pixfmt.xml |2 +
   include/linux/videodev2.h  |9 +++
   4 files changed, 107 insertions(+), 0 deletions(-)  create mode 
  100644 Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml
   create mode 100644 Documentation/DocBook/media/v4l/pixfmt-uv8.xml
  
  diff --git a/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml 
  b/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml
  new file mode 100644
  index 000..b20f525
  --- /dev/null
  +++ b/Documentation/DocBook/media/v4l/pixfmt-srggb10alaw8.xml
  @@ -0,0 +1,34 @@
  +   refentry
  + refmeta
  +   refentrytitle
  + V4L2_PIX_FMT_SRGGB10ALAW8 ('aRA8'),
  + V4L2_PIX_FMT_SGBRG10ALAW8 ('aGA8'),
  + V4L2_PIX_FMT_SGRBG10ALAW8 ('agA8'),
  + V4L2_PIX_FMT_SBGGR10ALAW8 ('aBA8'),
  +   /refentrytitle
  +   manvol;
  + /refmeta
  + refnamediv
  +   refname id=V4L2-PIX-FMT-SRGGB10ALAW8
  + constantV4L2_PIX_FMT_SRGGB10ALAW8/constant
  +   /refname
  +   refname id=V4L2-PIX-FMT-SGRBG10ALAW8
  + constantV4L2_PIX_FMT_SGRBG10ALAW8/constant
  +   /refname
  +   refname id=V4L2-PIX-FMT-SGBRG10ALAW8
  + constantV4L2_PIX_FMT_SGBRG10ALAW8/constant
  +   /refname
 
 The order here is different than earlier.
  I had taken a reference from your v3 patch series (v4l: Add DPCM compressed 
formats). Do you want me to change it?

 
  +   refname id=V4L2-PIX-FMT-SBGGR10ALAW8
  + constantV4L2_PIX_FMT_SBGGR10ALAW8/constant
  +   /refname
  +   refpurpose10-bit Bayer formats compressed to 8 bits/refpurpose
  + /refnamediv
  + refsect1
  +   titleDescription/title
  +   paraThe following four pixel formats are raw sRGB / Bayer
  +   formats with 10 bits per colour compressed to 8 bits each,
  +   using the A-LAW algorithm. Each colour component consumes 8
  +   bits of memory. In other respects this format is similar to
  +   xref linkend=V4L2-PIX-FMT-SRGGB8./xref/para
  + /refsect1
  +   /refentry
  diff --git a/Documentation/DocBook/media/v4l/pixfmt-uv8.xml 
  b/Documentation/DocBook/media/v4l/pixfmt-uv8.xml
  new file mode 100644
  index 000..e3e6b11
  --- /dev/null
  +++ b/Documentation/DocBook/media/v4l/pixfmt-uv8.xml
  @@ -0,0 +1,62 @@
  +   refentry id=V4L2-PIX-FMT-UV8
  + refmeta
  +   refentrytitleV4L2_PIX_FMT_UV8  ('UV8')/refentrytitle
  +   manvol;
  + /refmeta
  + refnamediv
  +   refnameconstantV4L2_PIX_FMT_UV8/constant/refname
  +   refpurposeUV plane interleaved/refpurpose
  + /refnamediv
  + refsect1
  +   titleDescription/title
  +   paraIn this format there is no Y plane, Only C plane. ie
  +   (UV interleaved)/para
 
 How about referring to CbCr instead of C?
Ok.
 
  +   example
  +   title
  + constantV4L2_PIX_FMT_UV8/constant
  +  pixel image
  +   /title
  +
  +   formalpara
  + titleByte Order./title
  + paraEach cell is one byte.
  +   informaltable frame=none
  +   tgroup cols=5 align=center
  + colspec align=left colwidth=2* /
  + tbody valign=top
  +   row
  + entrystartnbsp;+nbsp;0:/entry
  + entryCbsubscript00/subscript/entry
  + entryCrsubscript00/subscript/entry
  + entryCbsubscript01/subscript/entry
  + entryCrsubscript01/subscript/entry
  +   /row
  +   row
  + entrystartnbsp;+nbsp;4:/entry
  + entryCbsubscript10/subscript/entry
  + entryCrsubscript10/subscript/entry
  + entryCbsubscript11/subscript/entry
  + entryCrsubscript11/subscript/entry
  +   /row
  +   row
  + entrystartnbsp;+nbsp;8:/entry
  + entryCbsubscript20/subscript/entry
  + entryCrsubscript20/subscript/entry
  + entryCbsubscript21/subscript/entry
  + entryCrsubscript21/subscript/entry
  +   /row
  +   row
  + entrystartnbsp;+nbsp;12:/entry
  + entryCbsubscript30/subscript/entry
  +