[PATCH] cec tools: exit when CEC device is disconnected

2016-08-24 Thread Johan Fjeldtvedt
When devices are disconnected, -EIO is currently returned by ioctl, but
this will be replaced by -ENODEV. When ioctl returns that, there is no
reason to let cec-ctl, cec-follower or cec-compliance run, so just exit
them.

This patch must be applied when the CEC framework has been changed to return
ENODEV instead of EIO when devices are disconnected.

Johan Fjeldtvedt (1):
  cec tools: exit if device is disconnected

 utils/cec-compliance/cec-compliance.h |  9 +++--
 utils/cec-ctl/cec-ctl.cpp |  7 ++-
 utils/cec-follower/cec-processing.cpp | 14 --
 3 files changed, 25 insertions(+), 5 deletions(-)

-- 
2.7.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] cec tools: exit if device is disconnected

2016-08-24 Thread Hans Verkuil
On 08/24/16 12:31, Johan Fjeldtvedt wrote:
> If the CEC device is disconnected, ioctl will return ENODEV. This is
> checked for in cec-ctl (when monitoring), cec-follower and
> cec-compliance, to make these exit when the CEC device disappears.
> 
> Signed-off-by: Johan Fjeldtvedt 
> ---
>  utils/cec-compliance/cec-compliance.h |  9 +++--
>  utils/cec-ctl/cec-ctl.cpp |  7 ++-
>  utils/cec-follower/cec-processing.cpp | 14 --
>  3 files changed, 25 insertions(+), 5 deletions(-)
> 
> diff --git a/utils/cec-compliance/cec-compliance.h 
> b/utils/cec-compliance/cec-compliance.h
> index cb236fd..6b180c1 100644
> --- a/utils/cec-compliance/cec-compliance.h
> +++ b/utils/cec-compliance/cec-compliance.h
> @@ -334,10 +334,15 @@ static inline bool transmit_timeout(struct node *node, 
> struct cec_msg *msg,
>   unsigned timeout = 2000)
>  {
>   struct cec_msg original_msg = *msg;
> + int res;
>  
>   msg->timeout = timeout;
> - if (doioctl(node, CEC_TRANSMIT, msg) ||
> - !(msg->tx_status & CEC_TX_STATUS_OK))
> + res = doioctl(node, CEC_TRANSMIT, msg);
> + if (res == ENODEV) {
> + printf("No device.\n");

I think that "Device was disconnected." would be a better text to use. It's a 
bit more
descriptive.

Regards,

Hans

> + exit(1);
> + }
> + if (res || !(msg->tx_status & CEC_TX_STATUS_OK))
>   return false;
>  
>   if (((msg->rx_status & CEC_RX_STATUS_OK) || (msg->rx_status & 
> CEC_RX_STATUS_FEATURE_ABORT))
> diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
> index 2d0d9e5..10efcbd 100644
> --- a/utils/cec-ctl/cec-ctl.cpp
> +++ b/utils/cec-ctl/cec-ctl.cpp
> @@ -1945,7 +1945,12 @@ skip_la:
>   struct cec_msg msg = { };
>   __u8 from, to;
>  
> - if (doioctl(, CEC_RECEIVE, ))
> + res = doioctl(, CEC_RECEIVE, );
> + if (res == ENODEV) {
> + printf("No device.\n");
> + break;
> + }
> + if (res)
>   continue;
>  
>   from = cec_msg_initiator();
> diff --git a/utils/cec-follower/cec-processing.cpp 
> b/utils/cec-follower/cec-processing.cpp
> index 34d65e4..bbe80c5 100644
> --- a/utils/cec-follower/cec-processing.cpp
> +++ b/utils/cec-follower/cec-processing.cpp
> @@ -979,7 +979,12 @@ void testProcessing(struct node *node)
>   if (FD_ISSET(fd, _fds)) {
>   struct cec_event ev;
>  
> - if (doioctl(node, CEC_DQEVENT, ))
> + res = doioctl(node, CEC_DQEVENT, );
> + if (res == ENODEV) {
> + printf("No device.\n");
> + break;
> + }
> + if (res)
>   continue;
>   log_event(ev);
>   if (ev.event == CEC_EVENT_STATE_CHANGE) {
> @@ -995,7 +1000,12 @@ void testProcessing(struct node *node)
>   if (FD_ISSET(fd, _fds)) {
>   struct cec_msg msg = { };
>  
> - if (doioctl(node, CEC_RECEIVE, ))
> + res = doioctl(node, CEC_RECEIVE, );
> + if (res == ENODEV) {
> + printf("No device.\n");
> + break;
> + }
> + if (res)
>   continue;
>  
>   __u8 from = cec_msg_initiator();
> 
--
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


[GIT PULL] Samsung media driver updates

2016-08-24 Thread Sylwester Nawrocki
Hi Mauro,

this includes Samsung SoC media driver fixes and cleanups for v4.9.

The following changes since commit 29b4817d4018df78086157ea3a55c1d9424a7cfc:

  Linux 4.8-rc1 (2016-08-07 18:18:00 -0700)

are available in the git repository at:

  git://linuxtv.org/snawrocki/samsung.git for-v4.9/media/next

for you to fetch changes up to ba0f105e7ca81a25b58a5e57ebe30fc51f116616:

  exynos4-is: fimc-is-i2c: don't print error when adding adapter fails
(2016-08-12 16:42:21 +0200)


Bhaktipriya Shridhar (1):
  s5p-mfc: Remove deprecated create_singlethread_workqueue

Javier Martinez Canillas (5):
  s5p-jpeg: set capablity bus_info as required by VIDIOC_QUERYCAP
  exynos4-is: Fix fimc_is_parse_sensor_config() nodes handling
  s5p-jpeg: only fill driver's name in capabilities driver field
  gsc-m2m: add device name sufix to bus_info capatiliby field
  gsc-m2m: improve v4l2_capability driver and card fields

Shuah Khan (6):
  media: Doc s5p-mfc add missing fields to s5p_mfc_dev structure definition
  media: s5p-mfc fix invalid memory access from s5p_mfc_release()
  media: s5p-mfc remove void function return statement
  media: s5p-mfc Fix misspelled error message and checkpatch errors
  media: s5p-mfc remove unnecessary error messages
  media: s5p-jpeg add missing blank lines after declarations

Wei Yongjun (1):
  s5p-mfc: remove redundant return value check of platform_get_resource()

Wolfram Sang (1):
  exynos4-is: fimc-is-i2c: don't print error when adding adapter fails

 drivers/media/platform/exynos-gsc/gsc-m2m.c |  7 +++---
 drivers/media/platform/exynos4-is/fimc-is-i2c.c |  5 +---
 drivers/media/platform/exynos4-is/fimc-is.c | 16 +++-
 drivers/media/platform/s5p-jpeg/jpeg-core.c | 20 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc.c| 86
-
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |  2 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c| 11 +
 7 files changed, 90 insertions(+), 57 deletions(-)

-- 
Thanks,
Sylwester
--
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] m2m-deinterlace: Fix error print during probe

2016-08-24 Thread Sakari Ailus
Hi, Peter!

On Tue, Aug 23, 2016 at 04:39:39PM +0300, Peter Ujfalusi wrote:
> v4l2_err() can not be used for printing error for missing interleaved
> support in DMA as this point the pcdev->v4l2_dev is not valid.
> 
> Signed-off-by: Peter Ujfalusi 
> ---
>  drivers/media/platform/m2m-deinterlace.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/m2m-deinterlace.c 
> b/drivers/media/platform/m2m-deinterlace.c
> index 0fcb5c78031d..5a5dec348f4d 100644
> --- a/drivers/media/platform/m2m-deinterlace.c
> +++ b/drivers/media/platform/m2m-deinterlace.c
> @@ -1016,7 +1016,7 @@ static int deinterlace_probe(struct platform_device 
> *pdev)
>   return -ENODEV;
>  
>   if (!dma_has_cap(DMA_INTERLEAVE, pcdev->dma_chan->device->cap_mask)) {
> - v4l2_err(>v4l2_dev, "DMA does not support INTERLEAVE\n");
> + dev_err(>dev, "DMA does not support INTERLEAVE\n");
>   goto rel_dma;
>   }
>  

Acked-by: Sakari Ailus 

-- 
Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
--
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 0/9] Prepare Sphinx to build media PDF books

2016-08-24 Thread Mauro Carvalho Chehab
Markus,

Em Thu, 18 Aug 2016 17:21:27 -0600
Jonathan Corbet  escreveu:

> On Tue, 16 Aug 2016 13:25:34 -0300
> Mauro Carvalho Chehab  wrote:
> 
> > I think this patch series belong to docs-next. Feel free to merge them 
> > there, if
> > you agree. There's one extra patch that touches Documentation/conf.py,
> > re-adding the media book to the PDF build, but IMHO this one would be better
> > to be merged via the media tree, after the fixes inside the media 
> > documentation
> > to fix the build.  
> 
> It's now in docs-next.  I was able to build some nice-looking docs with it
> without too much (additional) pain...

I'm noticing a very weird behavior when I'm building documentation on
my server. There, I'm using this command:

$ make cleandocs; make V=1 DOCBOOKS="" SPHINXDIRS=media 
SPHINX_CONF="conf.py" htmldocs

This is what happens on my local machine:
http://pastebin.com/VGqvDa7T

And this is the result of the same command on my server, accessed via ssh:
http://pastebin.com/1MFi5LEG

As you can see, it seems that internally sphinx is calling a
make -C Documentation/output/latex, with is very bad, because it takes
a lot of extra time to run and produces an useless output. It also produces 
a wrong output, as it would be calling pdflatex, instead of xelatex.

Do you have any glue about what's going on?

Also, if I use the "-j33" sphinx option, it complains:

WARNING: the kernel_include extension does not declare if it is safe for 
parallel reading, assuming it isn't - please ask the extension author to check 
and make it explicit
WARNING: doing serial read

Btw, we need to add support to build just one PDF file, as we did with
the htmldocs.

Thanks,
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 for v4.8] cec: don't Feature Abort broadcast msgs when unregistered

2016-08-24 Thread Hans Verkuil
If the adapter is configured as 'Unregistered', then cec_receive_notify 
incorrectly
thinks that broadcast messages are directed messages. The destination for 
broadcast
messages is 0xf, and the logical address assigned to Unregistered devices is 
also
0xf and the logic didn't handle that correctly.

Signed-off-by: Hans Verkuil 
---
diff --git a/drivers/staging/media/cec/cec-adap.c 
b/drivers/staging/media/cec/cec-adap.c
index b2393bb..51bb581 100644
--- a/drivers/staging/media/cec/cec-adap.c
+++ b/drivers/staging/media/cec/cec-adap.c
@@ -1398,7 +1398,6 @@ static int cec_receive_notify(struct cec_adapter *adap, 
struct cec_msg *msg,
u8 init_laddr = cec_msg_initiator(msg);
u8 devtype = cec_log_addr2dev(adap, dest_laddr);
int la_idx = cec_log_addr2idx(adap, dest_laddr);
-   bool is_directed = la_idx >= 0;
bool from_unregistered = init_laddr == 0xf;
struct cec_msg tx_cec_msg = { };

@@ -1560,7 +1559,7 @@ static int cec_receive_notify(struct cec_adapter *adap, 
struct cec_msg *msg,
 * Unprocessed messages are aborted if userspace isn't doing
 * any processing either.
 */
-   if (is_directed && !is_reply && !adap->follower_cnt &&
+   if (!is_broadcast && !is_reply && !adap->follower_cnt &&
!adap->cec_follower && msg->msg[1] != CEC_MSG_FEATURE_ABORT)
return cec_feature_abort(adap, msg);
break;
--
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] cec-ctl: print correct destination address for broadcast msgs

2016-08-24 Thread Johan Fjeldtvedt
When messages are broadcast, it is not necessary to supply a --to option
to cec-ctl, but in that case the destination address was printed wrongly.

Signed-off-by: Johan Fjeldtvedt 
---
 utils/cec-ctl/cec-ctl.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 10efcbd..9db6299 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1888,7 +1888,7 @@ int main(int argc, char **argv)
}
printf("\nTransmit from %s to %s (%d to %d):\n", la2s(from),
   (cec_msg_is_broadcast() || to == 0xf) ? "all" : 
la2s(to),
-  from, to);
+  from, cec_msg_is_broadcast() ? 0xf : to);
msg.msg[0] |= (from << 4) | (cec_msg_is_broadcast() ? 0xf : 
to);
log_msg();
if (doioctl(, CEC_TRANSMIT, ))
-- 
2.7.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 0/9] Prepare Sphinx to build media PDF books

2016-08-24 Thread Markus Heiser

Am 24.08.2016 um 12:42 schrieb Mauro Carvalho Chehab :

> Markus,
> 
> Em Thu, 18 Aug 2016 17:21:27 -0600
> Jonathan Corbet  escreveu:
> 
>> On Tue, 16 Aug 2016 13:25:34 -0300
>> Mauro Carvalho Chehab  wrote:
>> 
>>> I think this patch series belong to docs-next. Feel free to merge them 
>>> there, if
>>> you agree. There's one extra patch that touches Documentation/conf.py,
>>> re-adding the media book to the PDF build, but IMHO this one would be better
>>> to be merged via the media tree, after the fixes inside the media 
>>> documentation
>>> to fix the build.  
>> 
>> It's now in docs-next.  I was able to build some nice-looking docs with it
>> without too much (additional) pain...
> 
> I'm noticing a very weird behavior when I'm building documentation on
> my server. There, I'm using this command:
> 
>   $ make cleandocs; make V=1 DOCBOOKS="" SPHINXDIRS=media 
> SPHINX_CONF="conf.py" htmldocs

Hi Mauro,

if you build a sub-folder, the conf.py is the default. You don't need 
to name conf.py it explicit and you can leave the DOCBOOKS env.

$ make V=1 SPHINXDIRS=media cleandocs htmldocs

or less verbose:

$ make SPHINXDIRS=media cleandocs htmldocs

But this does not answer your question ;)

> This is what happens on my local machine:
>   http://pastebin.com/VGqvDa7T

Seems to build fine. But this is not "make V=1" log.

> And this is the result of the same command on my server, accessed via ssh:
>   http://pastebin.com/1MFi5LEG

Same here, it is not a "make V=1" log. The errors like:

 WARNING: inline latex u"L' = L ^{\\frac{1}{2.19921875}}": latex exited with 
error

are dubious first. Which branch did you compile. It seems you are
using "inline latex" ... this seems not in Jon's docs-next.
I checked your experimental docs-next, there is a related
markup, so I think you compiling this branch.

.. math::

   L' = L ^{\frac{1}{2.19921875}}

So I guess the error message is related to one of the sphinx-extensions:

# The name of the math extension changed on Sphinx 1.4
if minor > 3:
   extensions.append("sphinx.ext.imgmath")
else:
   extensions.append("sphinx.ext.pngmath")

Since there is a log "Running Sphinx v1.4.6" (both, desktop and server) I
guess it is related to the sphinx.ext.imgmath extension.

I haven't tested math-extensions yet, I will give it a try
and send you my experience later. In the meantime you can check
your math-extensions on desktop and server ...

In general I guess: 

0.) you compiling different branches

or

1.) on your desktop the math-extension miss some latex stuff
and does not run, so you get no errors (or it runs perfect
without any error).

or / and

2.) on your server the math-extension runs and has some 
problems with the "L' = L ^{\frac{1}{2.19921875}}" expression.


> As you can see, it seems that internally sphinx is calling a
> make -C Documentation/output/latex, with is very bad, because it takes
> a lot of extra time to run and produces an useless output. It also produces 
> a wrong output, as it would be calling pdflatex, instead of xelatex.

As said, I haven't tested math-extensions yet. But the math extension 
uses "latex" as default / not xelatex 

* imgmath_latex: 
http://www.sphinx-doc.org/en/stable/ext/math.html#module-sphinx.ext.imgmath
* pngmath_latex: 
https://linuxtv.org/downloads/sphinx-1.2.3/ext/math.html#module-sphinx.ext.pngmath

> Do you have any glue about what's going on?

No ;-)  ... check the math-extension process as described above.

> Also, if I use the "-j33" sphinx option, it complains:
> 
> WARNING: the kernel_include extension does not declare if it is safe for 
> parallel reading, assuming it isn't - please ask the extension author to 
> check and make it explicit
> WARNING: doing serial read

Yes I know, it is the same with the kernel_doc extension, I can send a patch 
for both.

> Btw, we need to add support to build just one PDF file, as we did with
> the htmldocs.

You mean, when you build a subfolder (SPHINXDIRS=media), you wanted
to build a PDF with only media stuff in .. right? .. thats what 
I suggested in one of my last mails .. I can sent a patch for this.

-- Markus --


--
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] cec-compliance: fix Device OSD Transfer tests

2016-08-24 Thread Johan Fjeldtvedt
Remove a check for whether the first Set OSD String test applies, since this
test itself is used to determine whether the others apply. This bug
caused the tests to never be run.

Also fix the test for Set OSD String where the default display control
operand is given. In this case, when in interactive mode, we should wait for
at least 20 s and ask the user if there was any change (according to the CEC
1.4b CTS).

Signed-off-by: Johan Fjeldtvedt 
---
 utils/cec-compliance/cec-test.cpp | 26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/utils/cec-compliance/cec-test.cpp 
b/utils/cec-compliance/cec-test.cpp
index 5fac04a..20d818f 100644
--- a/utils/cec-compliance/cec-test.cpp
+++ b/utils/cec-compliance/cec-test.cpp
@@ -354,16 +354,13 @@ static struct remote_subtest 
device_osd_transfer_subtests[] = {
 
 static int osd_string_set_default(struct node *node, unsigned me, unsigned la, 
bool interactive)
 {
-   if (!node->remote[la].has_osd)
-   return NOTAPPLICABLE;
-
struct cec_msg msg = { };
char osd[14];
bool unsuitable = false;
 
sprintf(osd, "Rept %x from %x", la, me);
 
-   interactive_info(true, "You should see \"%s\" appear on the screen for 
approximately one second.", osd);
+   interactive_info(true, "You should see \"%s\" appear on the screen", 
osd);
cec_msg_init(, me, la);
cec_msg_set_osd_string(, CEC_OP_DISP_CTL_DEFAULT, osd);
fail_on_test(!transmit_timeout(node, ));
@@ -380,18 +377,17 @@ static int osd_string_set_default(struct node *node, 
unsigned me, unsigned la, b
warn("The device is in an unsuitable state or cannot display 
the complete message.\n");
unsuitable = true;
}
-
-   cec_msg_init(, me, la);
-   cec_msg_set_osd_string(, CEC_OP_DISP_CTL_CLEAR, "");
-   fail_on_test(!transmit_timeout(node, , 250));
-   fail_on_test(cec_msg_status_is_abort());
-   fail_on_test(!unsuitable && interactive && !question("Did the string 
appear?"));
-
node->remote[la].has_osd = true;
-   if (interactive)
-   return 0;
-   else
+   if (!interactive)
return PRESUMED_OK;
+
+   /* The CEC 1.4b CTS specifies that one should wait at least 20 seconds 
for the
+  string to be cleared on the remote device */
+   interactive_info(true, "Waiting 20s for OSD string to be cleared on the 
remote device");
+   sleep(20);
+   fail_on_test(!unsuitable && interactive && !question("Did the string 
appear and then disappear?"));
+
+   return 0;
 }
 
 static int osd_string_set_until_clear(struct node *node, unsigned me, unsigned 
la, bool interactive)
@@ -411,7 +407,7 @@ static int osd_string_set_until_clear(struct node *node, 
unsigned me, unsigned l
cec_msg_init(, me, la);
cec_msg_set_osd_string(, CEC_OP_DISP_CTL_UNTIL_CLEARED, osd);
fail_on_test(!transmit(node, ));
-   if (cec_msg_status_is_abort() && abort_reason() != 
CEC_OP_ABORT_UNRECOGNIZED_OP) {
+   if (cec_msg_status_is_abort() && !unrecognized_op()) {
warn("The device is in an unsuitable state or cannot display 
the complete message.\n");
unsuitable = true;
}
-- 
2.7.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


[PATCHv2] cec tools: exit if device is disconnected

2016-08-24 Thread Johan Fjeldtvedt
If the CEC device is disconnected, ioctl will return ENODEV. This is
checked for in cec-ctl (when monitoring), cec-follower and
cec-compliance, to make these exit when the CEC device disappears.

Signed-off-by: Johan Fjeldtvedt 
---
 utils/cec-compliance/cec-compliance.h |  9 +++--
 utils/cec-ctl/cec-ctl.cpp |  7 ++-
 utils/cec-follower/cec-processing.cpp | 14 --
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/utils/cec-compliance/cec-compliance.h 
b/utils/cec-compliance/cec-compliance.h
index cb236fd..d59ec1d 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -334,10 +334,15 @@ static inline bool transmit_timeout(struct node *node, 
struct cec_msg *msg,
unsigned timeout = 2000)
 {
struct cec_msg original_msg = *msg;
+   int res;
 
msg->timeout = timeout;
-   if (doioctl(node, CEC_TRANSMIT, msg) ||
-   !(msg->tx_status & CEC_TX_STATUS_OK))
+   res = doioctl(node, CEC_TRANSMIT, msg);
+   if (res == ENODEV) {
+   printf("Device was disconnected.\n");
+   exit(1);
+   }
+   if (res || !(msg->tx_status & CEC_TX_STATUS_OK))
return false;
 
if (((msg->rx_status & CEC_RX_STATUS_OK) || (msg->rx_status & 
CEC_RX_STATUS_FEATURE_ABORT))
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 2d0d9e5..5938971 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1945,7 +1945,12 @@ skip_la:
struct cec_msg msg = { };
__u8 from, to;
 
-   if (doioctl(, CEC_RECEIVE, ))
+   res = doioctl(, CEC_RECEIVE, );
+   if (res == ENODEV) {
+   printf("Device was disconnected.\n");
+   break;
+   }
+   if (res)
continue;
 
from = cec_msg_initiator();
diff --git a/utils/cec-follower/cec-processing.cpp 
b/utils/cec-follower/cec-processing.cpp
index 34d65e4..c20fa49 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -979,7 +979,12 @@ void testProcessing(struct node *node)
if (FD_ISSET(fd, _fds)) {
struct cec_event ev;
 
-   if (doioctl(node, CEC_DQEVENT, ))
+   res = doioctl(node, CEC_DQEVENT, );
+   if (res == ENODEV) {
+   printf("Device was disconnected.\n");
+   break;
+   }
+   if (res)
continue;
log_event(ev);
if (ev.event == CEC_EVENT_STATE_CHANGE) {
@@ -995,7 +1000,12 @@ void testProcessing(struct node *node)
if (FD_ISSET(fd, _fds)) {
struct cec_msg msg = { };
 
-   if (doioctl(node, CEC_RECEIVE, ))
+   res = doioctl(node, CEC_RECEIVE, );
+   if (res == ENODEV) {
+   printf("Device was disconnected.\n");
+   break;
+   }
+   if (res)
continue;
 
__u8 from = cec_msg_initiator();
-- 
2.7.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] [media] ad5820: fix one smatch warning

2016-08-24 Thread Mauro Carvalho Chehab
drivers/media/i2c/ad5820.c:61:24: error: dubious one-bit signed bitfield

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/i2c/ad5820.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c
index 62cc1f54622f..d7ad5c1a1219 100644
--- a/drivers/media/i2c/ad5820.c
+++ b/drivers/media/i2c/ad5820.c
@@ -58,7 +58,7 @@ struct ad5820_device {
struct mutex power_lock;
int power_count;
 
-   int standby : 1;
+   unsigned int standby : 1;
 };
 
 static int ad5820_write(struct ad5820_device *coil, u16 data)
-- 
2.7.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] [media] ad5820: fix one smatch warning

2016-08-24 Thread Sakari Ailus
Hi Mauro,

Mauro Carvalho Chehab wrote:
> drivers/media/i2c/ad5820.c:61:24: error: dubious one-bit signed bitfield
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  drivers/media/i2c/ad5820.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c
> index 62cc1f54622f..d7ad5c1a1219 100644
> --- a/drivers/media/i2c/ad5820.c
> +++ b/drivers/media/i2c/ad5820.c
> @@ -58,7 +58,7 @@ struct ad5820_device {
>   struct mutex power_lock;
>   int power_count;
>  
> - int standby : 1;
> + unsigned int standby : 1;

I guess a bool would be a better match for this one. It's what it's used
for. [01] assignments should be replaced by boolean values.

I can submit a patch for this as well, up to you.

>  };
>  
>  static int ad5820_write(struct ad5820_device *coil, u16 data)
> 


-- 
Sakari Ailus
sakari.ai...@linux.intel.com
--
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 v5 2/2] media: Add a driver for the ov5645 camera sensor.

2016-08-24 Thread Sakari Ailus
Hi Todor,

Thank you for the patch. Please see my comments below.

On Fri, Jul 08, 2016 at 05:54:39PM +0300, Todor Tomov wrote:
> The ov5645 sensor from Omnivision supports up to 2592x1944
> and CSI2 interface.
> 
> The driver adds support for the following modes:
> - 1280x960
> - 1920x1080
> - 2592x1944
> 
> Output format is packed 8bit UYVY.
> 
> Signed-off-by: Todor Tomov 
> ---
>  drivers/media/i2c/Kconfig  |   12 +
>  drivers/media/i2c/Makefile |1 +
>  drivers/media/i2c/ov5645.c | 1371 
> 
>  3 files changed, 1384 insertions(+)
>  create mode 100644 drivers/media/i2c/ov5645.c
> 
> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
> index 993dc50..0cee05b 100644
> --- a/drivers/media/i2c/Kconfig
> +++ b/drivers/media/i2c/Kconfig
> @@ -500,6 +500,18 @@ config VIDEO_OV2659
> To compile this driver as a module, choose M here: the
> module will be called ov2659.
>  
> +config VIDEO_OV5645
> + tristate "OmniVision OV5645 sensor support"
> + depends on OF
> + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
> + depends on MEDIA_CAMERA_SUPPORT
> + ---help---
> +   This is a Video4Linux2 sensor-level driver for the OmniVision
> +   OV5645 camera.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called ov5645.
> +
>  config VIDEO_OV7640
>   tristate "OmniVision OV7640 sensor support"
>   depends on I2C && VIDEO_V4L2
> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> index 94f2c99..2485aed 100644
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile
> @@ -55,6 +55,7 @@ obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o
>  obj-$(CONFIG_VIDEO_SONY_BTF_MPX) += sony-btf-mpx.o
>  obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
>  obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
> +obj-$(CONFIG_VIDEO_OV5645) += ov5645.o
>  obj-$(CONFIG_VIDEO_OV7640) += ov7640.o
>  obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
>  obj-$(CONFIG_VIDEO_OV9650) += ov9650.o
> diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
> new file mode 100644
> index 000..ec96d10
> --- /dev/null
> +++ b/drivers/media/i2c/ov5645.c
> @@ -0,0 +1,1371 @@
> +/*
> + * Driver for the OV5645 camera sensor.
> + *
> + * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
> + * Copyright (C) 2015 By Tech Design S.L. All Rights Reserved.
> + * Copyright (C) 2012-2013 Freescale Semiconductor, Inc. All Rights Reserved.
> + *
> + * Based on:
> + * - the OV5645 driver from QC msm-3.10 kernel on codeaurora.org:
> + *   https://us.codeaurora.org/cgit/quic/la/kernel/msm-3.10/tree/drivers/
> + *   media/platform/msm/camera_v2/sensor/ov5645.c?h=LA.BR.1.2.4_rb1.41
> + * - the OV5640 driver posted on linux-media:
> + *   https://www.mail-archive.com/linux-media%40vger.kernel.org/msg92671.html
> + */
> +
> +/*
> + * 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.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define OV5645_VOLTAGE_ANALOG   280
> +#define OV5645_VOLTAGE_DIGITAL_CORE 150
> +#define OV5645_VOLTAGE_DIGITAL_IO   180
> +
> +#define OV5645_XCLK  2388

Is this really a property of the sensor itself? Shouldn't this go to the DT
instead? And 23,88 MHz seems pretty unusual for an external clock frequency.

Even if your driver only could use this frequency for now, the DT still
should contain the real board specific frequency.

> +
> +#define OV5645_SYSTEM_CTRL0  0x3008

Some of the definitions here are obviously register addresses but only some
have "_REG" suffix. I'd add that to all of them. Up to you.

> +#define  OV5645_SYSTEM_CTRL0_START   0x02
> +#define  OV5645_SYSTEM_CTRL0_STOP0x42
> +#define OV5645_CHIP_ID_HIGH_REG  0x300A
> +#define  OV5645_CHIP_ID_HIGH 0x56
> +#define OV5645_CHIP_ID_LOW_REG   0x300B
> +#define  OV5645_CHIP_ID_LOW  0x45
> +#define OV5645_AWB_MANUAL_CONTROL0x3406
> +#define  OV5645_AWB_MANUAL_ENABLEBIT(0)
> +#define OV5645_AEC_PK_MANUAL 0x3503
> +#define  OV5645_AEC_MANUAL_ENABLEBIT(0)
> +#define  OV5645_AGC_MANUAL_ENABLEBIT(1)
> 

[PATCH] cec tools: exit if device is disconnected

2016-08-24 Thread Johan Fjeldtvedt
If the CEC device is disconnected, ioctl will return ENODEV. This is
checked for in cec-ctl (when monitoring), cec-follower and
cec-compliance, to make these exit when the CEC device disappears.

Signed-off-by: Johan Fjeldtvedt 
---
 utils/cec-compliance/cec-compliance.h |  9 +++--
 utils/cec-ctl/cec-ctl.cpp |  7 ++-
 utils/cec-follower/cec-processing.cpp | 14 --
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/utils/cec-compliance/cec-compliance.h 
b/utils/cec-compliance/cec-compliance.h
index cb236fd..6b180c1 100644
--- a/utils/cec-compliance/cec-compliance.h
+++ b/utils/cec-compliance/cec-compliance.h
@@ -334,10 +334,15 @@ static inline bool transmit_timeout(struct node *node, 
struct cec_msg *msg,
unsigned timeout = 2000)
 {
struct cec_msg original_msg = *msg;
+   int res;
 
msg->timeout = timeout;
-   if (doioctl(node, CEC_TRANSMIT, msg) ||
-   !(msg->tx_status & CEC_TX_STATUS_OK))
+   res = doioctl(node, CEC_TRANSMIT, msg);
+   if (res == ENODEV) {
+   printf("No device.\n");
+   exit(1);
+   }
+   if (res || !(msg->tx_status & CEC_TX_STATUS_OK))
return false;
 
if (((msg->rx_status & CEC_RX_STATUS_OK) || (msg->rx_status & 
CEC_RX_STATUS_FEATURE_ABORT))
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 2d0d9e5..10efcbd 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1945,7 +1945,12 @@ skip_la:
struct cec_msg msg = { };
__u8 from, to;
 
-   if (doioctl(, CEC_RECEIVE, ))
+   res = doioctl(, CEC_RECEIVE, );
+   if (res == ENODEV) {
+   printf("No device.\n");
+   break;
+   }
+   if (res)
continue;
 
from = cec_msg_initiator();
diff --git a/utils/cec-follower/cec-processing.cpp 
b/utils/cec-follower/cec-processing.cpp
index 34d65e4..bbe80c5 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -979,7 +979,12 @@ void testProcessing(struct node *node)
if (FD_ISSET(fd, _fds)) {
struct cec_event ev;
 
-   if (doioctl(node, CEC_DQEVENT, ))
+   res = doioctl(node, CEC_DQEVENT, );
+   if (res == ENODEV) {
+   printf("No device.\n");
+   break;
+   }
+   if (res)
continue;
log_event(ev);
if (ev.event == CEC_EVENT_STATE_CHANGE) {
@@ -995,7 +1000,12 @@ void testProcessing(struct node *node)
if (FD_ISSET(fd, _fds)) {
struct cec_msg msg = { };
 
-   if (doioctl(node, CEC_RECEIVE, ))
+   res = doioctl(node, CEC_RECEIVE, );
+   if (res == ENODEV) {
+   printf("No device.\n");
+   break;
+   }
+   if (res)
continue;
 
__u8 from = cec_msg_initiator();
-- 
2.7.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


[RESEND PATCH] [media] atmel-isc: remove the warning

2016-08-24 Thread Songjun Wu
Replace the 'IS_ERR_VALUE(irq)' with 'ret < 0' in
function 'atmel_isc_probe'.

Reported-by: Hans Verkuil 
Signed-off-by: Songjun Wu 
---

 drivers/media/platform/atmel/atmel-isc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/atmel/atmel-isc.c 
b/drivers/media/platform/atmel/atmel-isc.c
index f0c2512..db6773d 100644
--- a/drivers/media/platform/atmel/atmel-isc.c
+++ b/drivers/media/platform/atmel/atmel-isc.c
@@ -1358,7 +1358,7 @@ static int atmel_isc_probe(struct platform_device *pdev)
}
 
irq = platform_get_irq(pdev, 0);
-   if (IS_ERR_VALUE(irq)) {
+   if (irq < 0) {
ret = irq;
dev_err(dev, "failed to get irq: %d\n", ret);
return ret;
-- 
2.7.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 for v4.8] cec: fix ioctl return code when not registered

2016-08-24 Thread Hans Verkuil
Don't return the confusing -EIO error code when the device is not registered,
instead return -ENODEV which is the proper thing to do in this situation.

Signed-off-by: Hans Verkuil 
---
diff --git a/drivers/staging/media/cec/cec-api.c 
b/drivers/staging/media/cec/cec-api.c
index 7be7615..049f171 100644
--- a/drivers/staging/media/cec/cec-api.c
+++ b/drivers/staging/media/cec/cec-api.c
@@ -435,7 +435,7 @@ static long cec_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
void __user *parg = (void __user *)arg;

if (!devnode->registered)
-   return -EIO;
+   return -ENODEV;

switch (cmd) {
case CEC_ADAP_G_CAPS:
--
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 v2] docs-rst: kernel-doc: better output struct members

2016-08-24 Thread Jonathan Corbet
On Mon, 22 Aug 2016 22:02:57 -0300
Mauro Carvalho Chehab  wrote:

> So, change kernel-doc, for it to produce the output on a different way:
> 
>   **Members**
> 
>   ``prios[4]``
> 
> array with elements to store the array priorities
> 
> Also, as the type is not part of LaTeX "item[]", LaTeX will split it into
> multiple lines, if needed.
> 
> So, both LaTeX/PDF and HTML outputs will look good.

OK, I've applied this; let's see if anybody screams :)

Thanks,

jon
--
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 2/2] [media] tw5864: remove two unused vars

2016-08-24 Thread Andrey Utkin
On Wed, Aug 24, 2016 at 01:30:40PM -0300, Mauro Carvalho Chehab wrote:
> Remove those two vars that aren't used, as reported by smatch:

Acked-by: Andrey Utkin 

Sorry for missing this.
Thanks a lot.
--
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: ERRORS

2016-08-24 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:   Thu Aug 25 04:00:22 CEST 2016
git branch: test
git hash:   fb6609280db902bd5d34445fba1c926e95e63914
gcc version:i686-linux-gcc (GCC) 5.4.0
sparse version: v0.5.0-56-g7647c77
smatch version: v0.5.0-3428-gdfe27cf
host hardware:  x86_64
host os:4.6.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: WARNINGS
linux-2.6.36.4-i686: ERRORS
linux-2.6.37.6-i686: ERRORS
linux-2.6.38.8-i686: ERRORS
linux-2.6.39.4-i686: ERRORS
linux-3.0.60-i686: ERRORS
linux-3.1.10-i686: ERRORS
linux-3.2.37-i686: ERRORS
linux-3.3.8-i686: ERRORS
linux-3.4.27-i686: ERRORS
linux-3.5.7-i686: ERRORS
linux-3.6.11-i686: ERRORS
linux-3.7.4-i686: ERRORS
linux-3.8-i686: ERRORS
linux-3.9.2-i686: ERRORS
linux-3.10.1-i686: ERRORS
linux-3.11.1-i686: ERRORS
linux-3.12.23-i686: ERRORS
linux-3.13.11-i686: ERRORS
linux-3.14.9-i686: ERRORS
linux-3.15.2-i686: ERRORS
linux-3.16.7-i686: ERRORS
linux-3.17.8-i686: ERRORS
linux-3.18.7-i686: ERRORS
linux-3.19-i686: ERRORS
linux-4.0-i686: ERRORS
linux-4.1.1-i686: ERRORS
linux-4.2-i686: ERRORS
linux-4.3-i686: ERRORS
linux-4.4-i686: ERRORS
linux-4.5-i686: ERRORS
linux-4.6-i686: ERRORS
linux-4.7-i686: ERRORS
linux-4.8-rc1-i686: ERRORS
linux-2.6.36.4-x86_64: ERRORS
linux-2.6.37.6-x86_64: ERRORS
linux-2.6.38.8-x86_64: ERRORS
linux-2.6.39.4-x86_64: ERRORS
linux-3.0.60-x86_64: ERRORS
linux-3.1.10-x86_64: ERRORS
linux-3.2.37-x86_64: ERRORS
linux-3.3.8-x86_64: ERRORS
linux-3.4.27-x86_64: ERRORS
linux-3.5.7-x86_64: ERRORS
linux-3.6.11-x86_64: ERRORS
linux-3.7.4-x86_64: ERRORS
linux-3.8-x86_64: ERRORS
linux-3.9.2-x86_64: ERRORS
linux-3.10.1-x86_64: ERRORS
linux-3.11.1-x86_64: ERRORS
linux-3.12.23-x86_64: ERRORS
linux-3.13.11-x86_64: ERRORS
linux-3.14.9-x86_64: ERRORS
linux-3.15.2-x86_64: ERRORS
linux-3.16.7-x86_64: ERRORS
linux-3.17.8-x86_64: ERRORS
linux-3.18.7-x86_64: ERRORS
linux-3.19-x86_64: ERRORS
linux-4.0-x86_64: ERRORS
linux-4.1.1-x86_64: ERRORS
linux-4.2-x86_64: ERRORS
linux-4.3-x86_64: ERRORS
linux-4.4-x86_64: ERRORS
linux-4.5-x86_64: ERRORS
linux-4.6-x86_64: ERRORS
linux-4.7-x86_64: ERRORS
linux-4.8-rc1-x86_64: ERRORS
apps: OK
spec-git: OK
ABI WARNING: change for arm-at91
ABI WARNING: change for arm-davinci
ABI WARNING: change for arm-multi
ABI WARNING: change for blackfin-bf561
ABI WARNING: change for i686
ABI WARNING: change for m32r
ABI WARNING: change for mips
ABI WARNING: change for powerpc64
ABI WARNING: change for sh
ABI WARNING: change for x86_64
sparse: WARNINGS
smatch: WARNINGS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.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: [PATCH 2/2] v4l-utils: fixed dvbv5 vdr format

2016-08-24 Thread Mauro Carvalho Chehab
Hi Markus,

Em Wed, 10 Aug 2016 11:52:19 +0200
Markus Heiser  escreveu:

> From: Markus Heiser 
> 
> From: Heiser, Markus 
> 
> The vdr format was broken, I got '(null)' entries
> 
> HD:11494:S1HC23I0M5N1O35:S:(null):22000:5101:5102,5103,5106,5108:0:0:10301:0:0:0:
> 0-:1:2--:3:4-:
> 
> refering to the VDR Wikis ...
> 
> * LinuxTV: http://www.linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf
> * german comunity Wiki: 
> http://www.vdr-wiki.de/wiki/index.php/Channels.conf#Parameter_ab_VDR-1.7.4
> 
> There is no field at position 4 / in between "Source" and "SRate" which
> might have a value. I suppose the '(null):' is the result of pointing
> to *nothing*.
> 
> An other mistake is the ending colon (":") at the line. It is not
> explicit specified but adding an collon to the end of an channel entry
> will prevent players (like mpv or mplayer) from parsing the line (they
> will ignore these lines).
> 
> At least: generating a channel list with
> 
>   dvbv5-scan --output-format=vdr ...
> 
> will result in the same defective channel entry, containing "(null):"
> and the leading collon ":".

Sorry for taking too long to handle that. I usually stop handling
patches one week before the merge window, returning to merge only
after -rc1. This time, it took a little more time, due to the Sphinx
changes, as I was needing some patches to be merged upstream, in order
to change my handling scripts to work with the new way.

Anyway, with regards to this patch, not sure if you saw, but
Chris Mayo sent us a different fix for it:

https://patchwork.linuxtv.org/patch/35803/

With is meant to support VDR format as used on version 2.2. Not sure
if this format is backward-compatible with versions 1.x, but usually
VDR just adds new parameters to the lines.

So, I'm inclined to merge Chris patch instead of yours.

So, could you please test if his patch does what's needed?

Thanks!
Mauro


> 
> Signed-off-by: Markus Heiser 
> ---
>  lib/libdvbv5/dvb-vdr-format.c | 45 
> +--
>  1 file changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/lib/libdvbv5/dvb-vdr-format.c b/lib/libdvbv5/dvb-vdr-format.c
> index a4bd26b..ab0e5cf 100644
> --- a/lib/libdvbv5/dvb-vdr-format.c
> +++ b/lib/libdvbv5/dvb-vdr-format.c
> @@ -309,13 +309,14 @@ int dvb_write_format_vdr(const char *fname,
>   fprintf(fp, "%s", entry->channel);
>   if (entry->vchannel)
>   fprintf(fp, ",%s", entry->vchannel);
> + fprintf(fp, ":");
>  
>   /*
>* Output frequency:
>*  in kHz for terrestrial/cable
>*  in MHz for satellite
>*/
> - fprintf(fp, ":%i:", freq / 1000);
> + fprintf(fp, "%i:", freq / 1000);
>  
>   /* Output modulation parameters */
>   fmt = [i];
> @@ -349,20 +350,30 @@ int dvb_write_format_vdr(const char *fname,
>  
>   fprintf(fp, "%s", table->table[data]);
>   }
> -
> - /* Output format type */
> - fprintf(fp, ":%s:", id);
> + fprintf(fp, ":");
>  
>   /*
> -  * Output satellite location
> -  * FIXME: probably require some adjustments to match the
> -  *format expected by VDR.
> +  * Output sources configuration for VDR
> +  *
> +  *   S (satellite) xy.z (orbital position in degrees) E or W 
> (east or west)
> +  *
> +  *   FIXME: in case of ATSC we use "A", this is what w_scan does
>*/
> - switch(delsys) {
> - case SYS_DVBS:
> - case SYS_DVBS2:
> - fprintf(fp, "%s:", entry->location);
> +
> + if (entry->location) {
> + switch(delsys) {
> + case SYS_DVBS:
> + case SYS_DVBS2:
> + fprintf(fp, "%s", entry->location);
> + break;
> + default:
> + fprintf(fp, "%s", id);
> + break;
> + }
> + } else {
> + fprintf(fp, "%s", id);
>   }
> + fprintf(fp, ":");
>  
>   /* Output symbol rate */
>   srate = 2750;
> @@ -407,10 +418,16 @@ int dvb_write_format_vdr(const char *fname,
>   /* Output Service ID */
>   fprintf(fp, "%d:", entry->service_id);
>  
> - /* Output SID, NID, TID and RID */
> - fprintf(fp, "0:0:0:");
> + /* Output Network ID */
> + fprintf(fp, "0:");
>  
> - fprintf(fp, "\n");
> + /* Output Transport Stream ID */
> + fprintf(fp, 

Re: [PATCH 2/2] v4l-utils: fixed dvbv5 vdr format

2016-08-24 Thread Mauro Carvalho Chehab
Em Wed, 24 Aug 2016 11:49:27 -0300
Mauro Carvalho Chehab  escreveu:

> Hi Markus,
> 
> Em Wed, 10 Aug 2016 11:52:19 +0200
> Markus Heiser  escreveu:
> 
> > From: Markus Heiser 
> > 
> > From: Heiser, Markus 
> > 
> > The vdr format was broken, I got '(null)' entries
> > 
> > HD:11494:S1HC23I0M5N1O35:S:(null):22000:5101:5102,5103,5106,5108:0:0:10301:0:0:0:
> > 0-:1:2--:3:4-:
> > 
> > refering to the VDR Wikis ...
> > 
> > * LinuxTV: http://www.linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf
> > * german comunity Wiki: 
> > http://www.vdr-wiki.de/wiki/index.php/Channels.conf#Parameter_ab_VDR-1.7.4
> > 
> > There is no field at position 4 / in between "Source" and "SRate" which
> > might have a value. I suppose the '(null):' is the result of pointing
> > to *nothing*.
> > 
> > An other mistake is the ending colon (":") at the line. It is not
> > explicit specified but adding an collon to the end of an channel entry
> > will prevent players (like mpv or mplayer) from parsing the line (they
> > will ignore these lines).
> > 
> > At least: generating a channel list with
> > 
> >   dvbv5-scan --output-format=vdr ...
> > 
> > will result in the same defective channel entry, containing "(null):"
> > and the leading collon ":".  
> 
> Sorry for taking too long to handle that. I usually stop handling
> patches one week before the merge window, returning to merge only
> after -rc1. This time, it took a little more time, due to the Sphinx
> changes, as I was needing some patches to be merged upstream, in order
> to change my handling scripts to work with the new way.
> 
> Anyway, with regards to this patch, not sure if you saw, but
> Chris Mayo sent us a different fix for it:
> 
>   https://patchwork.linuxtv.org/patch/35803/
> 
> With is meant to support VDR format as used on version 2.2. Not sure
> if this format is backward-compatible with versions 1.x, but usually
> VDR just adds new parameters to the lines.
> 
> So, I'm inclined to merge Chris patch instead of yours.
> 
> So, could you please test if his patch does what's needed?

PS.: If the formats for v 1.x are not compatible with the ones for
v2.x, then the best would be to change the code to add a new format
for vdr v2.x, while keep supporting vdr v1.x.



Thanks,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 2/2] media: Add a driver for the ov5645 camera sensor.

2016-08-24 Thread Todor Tomov
Hi Sakari,

Thanks a lot for the time spent to review the driver!
I have a few responses bellow.


On 08/24/2016 01:17 PM, Sakari Ailus wrote:
> Hi Todor,
> 
> Thank you for the patch. Please see my comments below.
> 
> On Fri, Jul 08, 2016 at 05:54:39PM +0300, Todor Tomov wrote:
>> The ov5645 sensor from Omnivision supports up to 2592x1944
>> and CSI2 interface.
>>
>> The driver adds support for the following modes:
>> - 1280x960
>> - 1920x1080
>> - 2592x1944
>>
>> Output format is packed 8bit UYVY.
>>
>> Signed-off-by: Todor Tomov 
>> ---
>>  drivers/media/i2c/Kconfig  |   12 +
>>  drivers/media/i2c/Makefile |1 +
>>  drivers/media/i2c/ov5645.c | 1371 
>> 
>>  3 files changed, 1384 insertions(+)
>>  create mode 100644 drivers/media/i2c/ov5645.c
>>
>> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
>> index 993dc50..0cee05b 100644
>> --- a/drivers/media/i2c/Kconfig
>> +++ b/drivers/media/i2c/Kconfig
>> @@ -500,6 +500,18 @@ config VIDEO_OV2659
>>To compile this driver as a module, choose M here: the
>>module will be called ov2659.
>>  
>> +config VIDEO_OV5645
>> +tristate "OmniVision OV5645 sensor support"
>> +depends on OF
>> +depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
>> +depends on MEDIA_CAMERA_SUPPORT
>> +---help---
>> +  This is a Video4Linux2 sensor-level driver for the OmniVision
>> +  OV5645 camera.
>> +
>> +  To compile this driver as a module, choose M here: the
>> +  module will be called ov5645.
>> +
>>  config VIDEO_OV7640
>>  tristate "OmniVision OV7640 sensor support"
>>  depends on I2C && VIDEO_V4L2
>> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
>> index 94f2c99..2485aed 100644
>> --- a/drivers/media/i2c/Makefile
>> +++ b/drivers/media/i2c/Makefile
>> @@ -55,6 +55,7 @@ obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o
>>  obj-$(CONFIG_VIDEO_SONY_BTF_MPX) += sony-btf-mpx.o
>>  obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
>>  obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
>> +obj-$(CONFIG_VIDEO_OV5645) += ov5645.o
>>  obj-$(CONFIG_VIDEO_OV7640) += ov7640.o
>>  obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
>>  obj-$(CONFIG_VIDEO_OV9650) += ov9650.o
>> diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c
>> new file mode 100644
>> index 000..ec96d10
>> --- /dev/null
>> +++ b/drivers/media/i2c/ov5645.c
>> @@ -0,0 +1,1371 @@
>> +/*
>> + * Driver for the OV5645 camera sensor.
>> + *
>> + * Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
>> + * Copyright (C) 2015 By Tech Design S.L. All Rights Reserved.
>> + * Copyright (C) 2012-2013 Freescale Semiconductor, Inc. All Rights 
>> Reserved.
>> + *
>> + * Based on:
>> + * - the OV5645 driver from QC msm-3.10 kernel on codeaurora.org:
>> + *   https://us.codeaurora.org/cgit/quic/la/kernel/msm-3.10/tree/drivers/
>> + *   media/platform/msm/camera_v2/sensor/ov5645.c?h=LA.BR.1.2.4_rb1.41
>> + * - the OV5640 driver posted on linux-media:
>> + *   
>> https://www.mail-archive.com/linux-media%40vger.kernel.org/msg92671.html
>> + */
>> +
>> +/*
>> + * 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.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +#define OV5645_VOLTAGE_ANALOG   280
>> +#define OV5645_VOLTAGE_DIGITAL_CORE 150
>> +#define OV5645_VOLTAGE_DIGITAL_IO   180
>> +
>> +#define OV5645_XCLK 2388
> 
> Is this really a property of the sensor itself? Shouldn't this go to the DT
> instead? And 23,88 MHz seems pretty unusual for an external clock frequency.
> 
> Even if your driver only could use this frequency for now, the DT still
> should contain the real board specific frequency.

Yes, 23.88MHz is the value of the external clock frequency.
The sensor mode settings (the big sensor register settings arrays below)
are calculated over this value. Changing the external clock frequency
implies different sensor mode settings. However, the sensor mode settings
come from the reference driver by QC so we don't actually have a way to
change them and I doubt that we will ever have.

So both the external clock frequency and the sensor mode settings are
hardcoded in the driver. I have also discussed this with Rob Herring
when he reviewed the 1/2 patch 

[PATCH 2/3] doc-rst: define PDF's of the media folder

2016-08-24 Thread Markus Heiser
From: Markus Heiser 

To build only the PDF of the media folder run::

  make SPHINXDIRS=media pdfdocs

Signed-off-by: Markus Heiser 
---
 Documentation/media/conf.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/media/conf.py b/Documentation/media/conf.py
index 77cb2bb..bef927b 100644
--- a/Documentation/media/conf.py
+++ b/Documentation/media/conf.py
@@ -3,3 +3,8 @@
 project = 'Linux Media Subsystem Documentation'
 
 tags.add("subproject")
+
+latex_documents = [
+('index', 'media.tex', 'Linux Media Subsystem Documentation',
+ 'The kernel development community', 'manual'),
+]
-- 
2.7.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 3/3] doc-rst:media: build separated PDF books (experimental)

2016-08-24 Thread Markus Heiser
From: Markus Heiser 

This patch is only to demonstrate, how to build separated PDF books of
the media sub-folder and close open links with intersphinx.

It is an experimental state (I detected an build error, which I have not
yet traced deep).

Builds PDFs of:

* media_uapi.pdf:  Linux Media Infrastructure userspace API
* media_kapi.pdf:  Media subsystem kernel internal API
* dvb_drivers.pdf: Linux Digital TV driver-specific documentation
* v4l_drivers.pdf: Video4Linux (V4L) driver-specific documentation

It uses the intersphinx extension to close links which refer to content
outside of the (small) pdf-book. The intersphinx links refer to the
documentation served at url:

  https://www.linuxtv.org/downloads/v4l-dvb-apis-new/

E.g.: on page 154 of the media_kapi.pdf in paragraph """YUV Formats
lists existing packed ...""" the 'YUV Formats' text refer to url:

  
https://www.linuxtv.org/downloads/v4l-dvb-apis-new/media/uapi/v4l/subdev-formats.html#v4l2-mbus-pixelcode-yuv8

This is only a small example to illustrate how we can build small books
and link them with intersphinx.

Signed-off-by: Markus Heiser 
---
 Documentation/media/conf.py | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/Documentation/media/conf.py b/Documentation/media/conf.py
index bef927b..84575de 100644
--- a/Documentation/media/conf.py
+++ b/Documentation/media/conf.py
@@ -5,6 +5,21 @@ project = 'Linux Media Subsystem Documentation'
 tags.add("subproject")
 
 latex_documents = [
-('index', 'media.tex', 'Linux Media Subsystem Documentation',
+('media_uapi', 'media_uapi.tex', 'Linux Media Infrastructure userspace 
API',
+ 'The kernel development community', 'manual'),
+('media_kapi', 'media_kapi.tex', 'Media subsystem kernel internal API',
+ 'The kernel development community', 'manual'),
+('dvb-drivers/index', 'dvb_drivers.tex', 'Linux Digital TV driver-specific 
documentation',
+ 'The kernel development community', 'manual'),
+('v4l-drivers/index', 'v4l_drivers.tex', 'Video4Linux (V4L) 
driver-specific documentation',
  'The kernel development community', 'manual'),
 ]
+
+# Since intersphinx is not activated in the global Documentation/conf.py we
+# activate it here. If times comes where it is activated in the global conf.py,
+# we may have to drop these two lines.
+extensions.append('sphinx.ext.intersphinx')
+intersphinx_mapping = {}
+
+# add intersphinx inventory of the *complete* documentation from linuxtv.org
+intersphinx_mapping['media'] = 
('https://www.linuxtv.org/downloads/v4l-dvb-apis-new/', None)
-- 
2.7.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 1/3] doc-rst: generic way to build PDF of sub-folders

2016-08-24 Thread Markus Heiser
From: Markus Heiser 

This extends the method to build only sub-folders to the targets
"latexdocs" and "pdfdocs". To do so, a conf.py in the sub-folder is
required, where the latex_documents of the sub-folder are
defined. E.g. to build only gpu's PDF add the following to the
Documentation/gpu/conf.py::

  +latex_documents = [
  +("index", "gpu.tex", "Linux GPU Driver Developer's Guide",
  + "The kernel development community", "manual"),
  +]

and run:

  make SPHINXDIRS=gpu pdfdocs

Signed-off-by: Markus Heiser 
---
 Documentation/Makefile.sphinx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/Makefile.sphinx b/Documentation/Makefile.sphinx
index 894cfaa..92deea3 100644
--- a/Documentation/Makefile.sphinx
+++ b/Documentation/Makefile.sphinx
@@ -71,12 +71,12 @@ ifeq ($(HAVE_PDFLATEX),0)
$(warning The 'xelatex' command was not found. Make sure you have it 
installed and in PATH to produce PDF output.)
@echo "  SKIPSphinx $@ target."
 else # HAVE_PDFLATEX
-   @$(call loop_cmd,sphinx,latex,.,latex,.)
+   @$(foreach var,$(SPHINXDIRS),$(call 
loop_cmd,sphinx,latex,$(var),latex,$(var)))
 endif # HAVE_PDFLATEX
 
 pdfdocs: latexdocs
 ifneq ($(HAVE_PDFLATEX),0)
-   $(Q)$(MAKE) PDFLATEX=xelatex LATEXOPTS="-interaction=nonstopmode" -C 
$(BUILDDIR)/latex
+   $(foreach var,$(SPHINXDIRS), $(MAKE) PDFLATEX=xelatex 
LATEXOPTS="-interaction=nonstopmode" -C $(BUILDDIR)/$(var)/latex)
 endif # HAVE_PDFLATEX
 
 epubdocs:
-- 
2.7.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 0/3] doc-rst: generic way to build PDF of sub-folder

2016-08-24 Thread Markus Heiser
From: Markus Heiser 

Hi Mauro,

here is a small patch series which extends the method to build only sub-folders
to the targets "latexdocs" and "pdfdocs".

If you think, that the two first patches works for you, path them with your next
merge to Jon's doc-next.

The last patch in this series is just for you. It is a small example to
illustrate how we can build small books and link them with intersphinx.

-- Markus --

Markus Heiser (3):
  doc-rst: generic way to build PDF of sub-folders
  doc-rst: define PDF's of the media folder
  doc-rst:media: build separated PDF books (experimental)

 Documentation/Makefile.sphinx |  4 ++--
 Documentation/media/conf.py   | 20 
 2 files changed, 22 insertions(+), 2 deletions(-)

-- 
2.7.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] [media] tw5864: remove two unused vars

2016-08-24 Thread Mauro Carvalho Chehab
Remove those two vars that aren't used, as reported by smatch:

drivers/media/pci/tw5864/tw5864-video.c: In function 
'tw5864_prepare_frame_headers':
drivers/media/pci/tw5864/tw5864-video.c:1219:16: warning: variable 
'space_before_sl_hdr' set but not used [-Wunused-but-set-variable]
  unsigned long space_before_sl_hdr;
^~~
drivers/media/pci/tw5864/tw5864-video.c:1218:6: warning: variable 'sl_hdr' set 
but not used [-Wunused-but-set-variable]
  u8 *sl_hdr;
  ^~

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/pci/tw5864/tw5864-video.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/media/pci/tw5864/tw5864-video.c 
b/drivers/media/pci/tw5864/tw5864-video.c
index 3461ba9162e7..6c1685aeaea9 100644
--- a/drivers/media/pci/tw5864/tw5864-video.c
+++ b/drivers/media/pci/tw5864/tw5864-video.c
@@ -1215,8 +1215,6 @@ void tw5864_prepare_frame_headers(struct tw5864_input 
*input)
u8 *dst;
size_t dst_space;
unsigned long flags;
-   u8 *sl_hdr;
-   unsigned long space_before_sl_hdr;
 
if (!vb) {
spin_lock_irqsave(>slock, flags);
@@ -1253,8 +1251,6 @@ void tw5864_prepare_frame_headers(struct tw5864_input 
*input)
  input->width, input->height);
 
/* Put slice header */
-   sl_hdr = dst;
-   space_before_sl_hdr = dst_space;
tw5864_h264_put_slice_header(, _space, input->h264_idr_pic_id,
 input->frame_gop_seqno,
 >tail_nb_bits, >tail);
-- 
2.7.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: pwc over musb: 100% frame drop (lost) on high resolution stream

2016-08-24 Thread Matwey V. Kornilov
2016-08-22 11:32 GMT+03:00 Matwey V. Kornilov :
> 2016-08-22 1:00 GMT+03:00 Alan Stern :
>> On Sun, 21 Aug 2016, Matwey V. Kornilov wrote:
>>
>>> In both cases (with or without HCD_BH), usb_hcd_giveback_urb is called
>>> every 0.01 sec. It is not clear why behavior is so different.
>>
>> What behavior are you asking about?  The difference between HCD_BH set
>> and not set?
>>
>
> The difference between HCD_BH set and not set is that when it is not
> set then usb_hcd_giveback_urb() receive zero-length URBs. And this
> breaks my pwc webcam. And the question is how to fix it.
> As far as I can see, usb_hcd_giveback_urb is being called with the
> same rate in both cases, so zero-length URBs are probably supposed to
> be data-carrying.
>

I can't understand what makes the difference. What I found to this
moment is the following:

1) isoc transfer works in two empirical modes or regimes. I called
them 'normal' one and 'broken'.
1a) In the 'normal' mode, every package is 956 bytes long and
c->desc->pd2 (see cppi41_irq) is 149a
1b) In the 'broken' mode, every package is 0 bytes long and
c->desc->pd2 (see cppi41_irq) is 1408009a
2) In each mode cppi41_irq is invoked every 1 ms.
2a) When the time lag between two subsequent calls of cppi41_irq is
greater (up to 2 ms) or less (0.3 ms) than 1 ms then the mode is
switched. It can happen inside single URB without calling complete().
So, the data are flowing in large bulks of either empty or full packages.
3) When HCD_BH is not set, then this two regimes are being flipped
constantly breaking internal pwc logic. When HCD_BH is set, then first
dozens packages are empty, then there is a pause between cppi41_irq
and the rest packages are fine.


>> Alan Stern
>>
>
>
>
> --
> With best regards,
> Matwey V. Kornilov.
> Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia
> 119991, Moscow, Universitetsky pr-k 13, +7 (495) 9392382



-- 
With best regards,
Matwey V. Kornilov.
Sternberg Astronomical Institute, Lomonosov Moscow State University, Russia
119991, Moscow, Universitetsky pr-k 13, +7 (495) 9392382
--
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] doc-rst:sphinx-extensions: add metadata parallel-safe

2016-08-24 Thread Markus Heiser
From: Markus Heiser 

The setup() function of a Sphinx-extension can return a dictionary. This
is treated by Sphinx as metadata of the extension [1].

With metadata "parallel_read_safe = True" a extension is marked as
save for "parallel reading of source". This is needed if you want
build in parallel with N processes. E.g.:

  make SPHINXOPTS=-j4 htmldocs

will no longer log warnings like:

  WARNING: the foobar extension does not declare if it is safe for
  parallel reading, assuming it isn't - please ask the extension author
  to check and make it explicit.

Add metadata to extensions:

* kernel-doc
* flat-table
* kernel-include

[1] http://www.sphinx-doc.org/en/stable/extdev/#extension-metadata

Signed-off-by: Markus Heiser 
---
 Documentation/sphinx/kernel-doc.py | 8 
 Documentation/sphinx/kernel_include.py | 7 +++
 Documentation/sphinx/rstFlatTable.py   | 6 ++
 3 files changed, 21 insertions(+)
 mode change 100644 => 100755 Documentation/sphinx/rstFlatTable.py

diff --git a/Documentation/sphinx/kernel-doc.py 
b/Documentation/sphinx/kernel-doc.py
index f6920c0..d15e07f 100644
--- a/Documentation/sphinx/kernel-doc.py
+++ b/Documentation/sphinx/kernel-doc.py
@@ -39,6 +39,8 @@ from docutils.parsers.rst import directives
 from sphinx.util.compat import Directive
 from sphinx.ext.autodoc import AutodocReporter
 
+__version__  = '1.0'
+
 class KernelDocDirective(Directive):
 """Extract kernel-doc comments from the specified file"""
 required_argument = 1
@@ -139,3 +141,9 @@ def setup(app):
 app.add_config_value('kerneldoc_verbosity', 1, 'env')
 
 app.add_directive('kernel-doc', KernelDocDirective)
+
+return dict(
+version = __version__,
+parallel_read_safe = True,
+parallel_write_safe = True
+)
diff --git a/Documentation/sphinx/kernel_include.py 
b/Documentation/sphinx/kernel_include.py
index db57382..f523aa6 100755
--- a/Documentation/sphinx/kernel_include.py
+++ b/Documentation/sphinx/kernel_include.py
@@ -39,11 +39,18 @@ from docutils.parsers.rst import directives
 from docutils.parsers.rst.directives.body import CodeBlock, NumberLines
 from docutils.parsers.rst.directives.misc import Include
 
+__version__  = '1.0'
+
 # 
==
 def setup(app):
 # 
==
 
 app.add_directive("kernel-include", KernelInclude)
+return dict(
+version = __version__,
+parallel_read_safe = True,
+parallel_write_safe = True
+)
 
 # 
==
 class KernelInclude(Include):
diff --git a/Documentation/sphinx/rstFlatTable.py 
b/Documentation/sphinx/rstFlatTable.py
old mode 100644
new mode 100755
index 26db852..55f2757
--- a/Documentation/sphinx/rstFlatTable.py
+++ b/Documentation/sphinx/rstFlatTable.py
@@ -73,6 +73,12 @@ def setup(app):
 roles.register_local_role('cspan', c_span)
 roles.register_local_role('rspan', r_span)
 
+return dict(
+version = __version__,
+parallel_read_safe = True,
+parallel_write_safe = True
+)
+
 # 
==
 def c_span(name, rawtext, text, lineno, inliner, options=None, content=None):
 # 
==
-- 
2.7.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 0/9] Prepare Sphinx to build media PDF books

2016-08-24 Thread Mauro Carvalho Chehab
Hi Markus,

Em Wed, 24 Aug 2016 13:46:48 +0200
Markus Heiser  escreveu:

> Am 24.08.2016 um 12:42 schrieb Mauro Carvalho Chehab 
> :
> 
> > Markus,
> > 
> > Em Thu, 18 Aug 2016 17:21:27 -0600
> > Jonathan Corbet  escreveu:
> >   
> >> On Tue, 16 Aug 2016 13:25:34 -0300
> >> Mauro Carvalho Chehab  wrote:
> >>   
> >>> I think this patch series belong to docs-next. Feel free to merge them 
> >>> there, if
> >>> you agree. There's one extra patch that touches Documentation/conf.py,
> >>> re-adding the media book to the PDF build, but IMHO this one would be 
> >>> better
> >>> to be merged via the media tree, after the fixes inside the media 
> >>> documentation
> >>> to fix the build.
> >> 
> >> It's now in docs-next.  I was able to build some nice-looking docs with it
> >> without too much (additional) pain...  
> > 
> > I'm noticing a very weird behavior when I'm building documentation on
> > my server. There, I'm using this command:
> > 
> > $ make cleandocs; make V=1 DOCBOOKS="" SPHINXDIRS=media 
> > SPHINX_CONF="conf.py" htmldocs  
> 
> Hi Mauro,
> 
> if you build a sub-folder, the conf.py is the default. You don't need 
> to name conf.py it explicit and you can leave the DOCBOOKS env.
> 
> $ make V=1 SPHINXDIRS=media cleandocs htmldocs
> 
> or less verbose:
> 
> $ make SPHINXDIRS=media cleandocs htmldocs

Yeah, I know. I added the SPHINX_CONF there because my end goal
is to use the nitpick config, after cleaning it up ;)

> 
> But this does not answer your question ;)
> 
> > This is what happens on my local machine:
> > http://pastebin.com/VGqvDa7T  
> 
> Seems to build fine. But this is not "make V=1" log.
> 
> > And this is the result of the same command on my server, accessed via ssh:
> > http://pastebin.com/1MFi5LEG  
> 
> Same here, it is not a "make V=1" log. The errors like:
> 
>  WARNING: inline latex u"L' = L ^{\\frac{1}{2.19921875}}": latex exited with 
> error
> 
> are dubious first. Which branch did you compile. It seems you are
> using "inline latex" ... this seems not in Jon's docs-next.
> I checked your experimental docs-next, there is a related
> markup, so I think you compiling this branch.
> 
> .. math::
> 
>L' = L ^{\frac{1}{2.19921875}}
> 
> So I guess the error message is related to one of the sphinx-extensions:
> 
> # The name of the math extension changed on Sphinx 1.4
> if minor > 3:
>extensions.append("sphinx.ext.imgmath")
> else:
>extensions.append("sphinx.ext.pngmath")
> 
> Since there is a log "Running Sphinx v1.4.6" (both, desktop and server) I
> guess it is related to the sphinx.ext.imgmath extension.
> 
> I haven't tested math-extensions yet, I will give it a try
> and send you my experience later. In the meantime you can check
> your math-extensions on desktop and server ...
> 
> In general I guess: 
> 
> 0.) you compiling different branches
> 
> or
> 
> 1.) on your desktop the math-extension miss some latex stuff
> and does not run, so you get no errors (or it runs perfect
> without any error).

Thanks! that was the case...

I had already those two extensions that are needed by math:
texlive-amsmath-svn30645.2.14-24.fc24.1.noarch
texlive-amsfonts-svn29208.3.04-24.fc24.1.noarch

But it was missing this one on the server:
texlive-anyfontsize.noarch

> > Also, if I use the "-j33" sphinx option, it complains:
> > 
> > WARNING: the kernel_include extension does not declare if it is safe for 
> > parallel reading, assuming it isn't - please ask the extension author to 
> > check and make it explicit
> > WARNING: doing serial read  
> 
> Yes I know, it is the same with the kernel_doc extension, I can send a patch 
> for both.

That will be very much appreciated, thanks!

> > Btw, we need to add support to build just one PDF file, as we did with
> > the htmldocs.  
> 
> You mean, when you build a subfolder (SPHINXDIRS=media), you wanted
> to build a PDF with only media stuff in .. right?

Yes.

> .. thats what 
> I suggested in one of my last mails .. I can sent a patch for this.

Please do that.

Thanks!
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] [media] extended-controls.rst: fix a build warning

2016-08-24 Thread Mauro Carvalho Chehab
/devel/v4l/patchwork/Documentation/media/uapi/v4l/extended-controls.rst:2116: 
WARNING: Inline literal start-string without end-string.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/media/uapi/v4l/extended-controls.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/media/uapi/v4l/extended-controls.rst 
b/Documentation/media/uapi/v4l/extended-controls.rst
index 9c6aff3e97c1..1f1518e4859d 100644
--- a/Documentation/media/uapi/v4l/extended-controls.rst
+++ b/Documentation/media/uapi/v4l/extended-controls.rst
@@ -2112,8 +2112,8 @@ enum v4l2_mpeg_video_h264_sei_fp_arrangement_type -
 
 .. _v4l2-mpeg-video-h264-fmo-map-type:
 
-``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE`` 
-(enum)
+``V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE``
+   (enum)
 
 enum v4l2_mpeg_video_h264_fmo_map_type -
 When using FMO, the map type divides the image in different scan
-- 
2.7.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] doc-rst:sphinx-extensions: add metadata parallel-safe

2016-08-24 Thread Mauro Carvalho Chehab
Em Wed, 24 Aug 2016 15:35:24 +0200
Markus Heiser  escreveu:

> From: Markus Heiser 
> 
> The setup() function of a Sphinx-extension can return a dictionary. This
> is treated by Sphinx as metadata of the extension [1].
> 
> With metadata "parallel_read_safe = True" a extension is marked as
> save for "parallel reading of source". This is needed if you want
> build in parallel with N processes. E.g.:
> 
>   make SPHINXOPTS=-j4 htmldocs
> 
> will no longer log warnings like:
> 
>   WARNING: the foobar extension does not declare if it is safe for
>   parallel reading, assuming it isn't - please ask the extension author
>   to check and make it explicit.
> 
> Add metadata to extensions:
> 
> * kernel-doc
> * flat-table
> * kernel-include
> 
> [1] http://www.sphinx-doc.org/en/stable/extdev/#extension-metadata
> 
> Signed-off-by: Markus Heiser 

Tested here on my desktop:

$ make cleandocs; time make SPHINXOPTS="-q" DOCBOOKS="" SPHINXDIRS=media 
SPHINX_CONF="conf.py" htmldocs
  SPHINX  htmldocs --> file:///devel/v4l/patchwork/Documentation/output/media;
make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
rule.
  PARSE   include/uapi/linux/dvb/audio.h
  PARSE   include/uapi/linux/dvb/ca.h
  PARSE   include/uapi/linux/dvb/dmx.h
  PARSE   include/uapi/linux/dvb/frontend.h
  PARSE   include/uapi/linux/dvb/net.h
  PARSE   include/uapi/linux/dvb/video.h
  PARSE   include/uapi/linux/videodev2.h
  PARSE   include/uapi/linux/media.h
  PARSE   include/linux/cec.h
  PARSE   include/uapi/linux/lirc.h
load additional sphinx-config: /devel/v4l/patchwork/Documentation/media/conf.py
/devel/v4l/patchwork/Documentation/media/uapi/v4l/extended-controls.rst:2116: 
WARNING: Inline literal start-string without end-string.
/devel/v4l/patchwork/Documentation/media/uapi/v4l/extended-controls.rst:2116: 
WARNING: Inline literal start-string without end-string.
  SKIPDocBook htmldocs target (DOCBOOKS="" specified).

real0m55.837s
user0m54.620s
sys 0m1.333s

$ make cleandocs; time make SPHINXOPTS="-q -j8" DOCBOOKS="" SPHINXDIRS=media 
SPHINX_CONF="conf.py" htmldocs
  SPHINX  htmldocs --> file:///devel/v4l/patchwork/Documentation/output/media;
make[2]: warning: jobserver unavailable: using -j1.  Add '+' to parent make 
rule.
  PARSE   include/uapi/linux/dvb/audio.h
  PARSE   include/uapi/linux/dvb/ca.h
  PARSE   include/uapi/linux/dvb/dmx.h
  PARSE   include/uapi/linux/dvb/frontend.h
  PARSE   include/uapi/linux/dvb/net.h
  PARSE   include/uapi/linux/dvb/video.h
  PARSE   include/uapi/linux/videodev2.h
  PARSE   include/uapi/linux/media.h
  PARSE   include/linux/cec.h
  PARSE   include/uapi/linux/lirc.h
load additional sphinx-config: /devel/v4l/patchwork/Documentation/media/conf.py
/devel/v4l/patchwork/Documentation/media/uapi/v4l/extended-controls.rst:2116: 
WARNING: Inline literal start-string without end-string.
/devel/v4l/patchwork/Documentation/media/uapi/v4l/extended-controls.rst:2116: 
WARNING: Inline literal start-string without end-string.
  SKIPDocBook htmldocs target (DOCBOOKS="" specified).

real0m22.340s
user1m21.041s
sys 0m3.624s

Time reduced from 55 to 22 seconds. Sounds good enough!

Tested-by: Mauro Carvalho Chehab 

Thanks!
Mauro

PS: on my server with 16 dual-thread Xeon CPU, the gain with a
bigger value for -j was not impressive. Got about the same time as
with -j8 or -j32 there.

> ---
>  Documentation/sphinx/kernel-doc.py | 8 
>  Documentation/sphinx/kernel_include.py | 7 +++
>  Documentation/sphinx/rstFlatTable.py   | 6 ++
>  3 files changed, 21 insertions(+)
>  mode change 100644 => 100755 Documentation/sphinx/rstFlatTable.py
> 
> diff --git a/Documentation/sphinx/kernel-doc.py 
> b/Documentation/sphinx/kernel-doc.py
> index f6920c0..d15e07f 100644
> --- a/Documentation/sphinx/kernel-doc.py
> +++ b/Documentation/sphinx/kernel-doc.py
> @@ -39,6 +39,8 @@ from docutils.parsers.rst import directives
>  from sphinx.util.compat import Directive
>  from sphinx.ext.autodoc import AutodocReporter
>  
> +__version__  = '1.0'
> +
>  class KernelDocDirective(Directive):
>  """Extract kernel-doc comments from the specified file"""
>  required_argument = 1
> @@ -139,3 +141,9 @@ def setup(app):
>  app.add_config_value('kerneldoc_verbosity', 1, 'env')
>  
>  app.add_directive('kernel-doc', KernelDocDirective)
> +
> +return dict(
> +version = __version__,
> +parallel_read_safe = True,
> +parallel_write_safe = True
> +)
> diff --git a/Documentation/sphinx/kernel_include.py 
> b/Documentation/sphinx/kernel_include.py
> index db57382..f523aa6 100755
> --- a/Documentation/sphinx/kernel_include.py
> +++ b/Documentation/sphinx/kernel_include.py
> @@ -39,11 +39,18 @@ from docutils.parsers.rst import directives
>  from docutils.parsers.rst.directives.body import CodeBlock, NumberLines
>  from 

Re: [PATCH] [media] v4l2-async: Always unregister the subdev on failure

2016-08-24 Thread Alban Bedel
On Fri, 1 Jul 2016 13:55:44 +0200
Hans Verkuil  wrote:

> On 05/11/2016 06:32 PM, Alban Bedel wrote:
> > On Wed, 11 May 2016 12:22:44 -0400
> > Javier Martinez Canillas  wrote:
> >   
> >> Hello Alban,
> >>
> >> On 05/11/2016 11:40 AM, Alban Bedel wrote:  
> >>> In v4l2_async_test_notify() if the registered_async callback or the
> >>> complete notifier returns an error the subdev is not unregistered.
> >>> This leave paths where v4l2_async_register_subdev() can fail but
> >>> leave the subdev still registered.
> >>>
> >>> Add the required calls to v4l2_device_unregister_subdev() to plug
> >>> these holes.
> >>>
> >>> Signed-off-by: Alban Bedel 
> >>> ---
> >>>  drivers/media/v4l2-core/v4l2-async.c | 10 --
> >>>  1 file changed, 8 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/media/v4l2-core/v4l2-async.c 
> >>> b/drivers/media/v4l2-core/v4l2-async.c
> >>> index ceb28d4..43393f8 100644
> >>> --- a/drivers/media/v4l2-core/v4l2-async.c
> >>> +++ b/drivers/media/v4l2-core/v4l2-async.c
> >>> @@ -121,13 +121,19 @@ static int v4l2_async_test_notify(struct 
> >>> v4l2_async_notifier *notifier,
> >>>  
> >>>   ret = v4l2_subdev_call(sd, core, registered_async);
> >>>   if (ret < 0 && ret != -ENOIOCTLCMD) {
> >>> + v4l2_device_unregister_subdev(sd);
> >>>   if (notifier->unbind)
> >>>   notifier->unbind(notifier, sd, asd);
> >>>   return ret;
> >>>   }
> >>>  
> >>> - if (list_empty(>waiting) && notifier->complete)
> >>> - return notifier->complete(notifier);
> >>> + if (list_empty(>waiting) && notifier->complete) {
> >>> + ret = notifier->complete(notifier);
> >>> + if (ret < 0) {
> >>> + v4l2_device_unregister_subdev(sd);  
> >>
> >> Isn't a call to notifier->unbind() missing here as well?
> >>
> >> Also, I think the error path is becoming too duplicated and complex, so
> >> maybe we can have a single error path and use goto labels as is common
> >> in Linux? For example something like the following (not tested) can be
> >> squashed on top of your change:  
> > 
> > Yes, that look better. I'll test it and report tomorrow.  
> 
> I haven't heard anything back about this. Did you manage to test it?

Yes, that's working fine. Sorry for the delay, I'm sending the v2 patch.

Alban



pgpigT3AWV8I_.pgp
Description: OpenPGP digital signature


[PATCH v2] [media] v4l2-async: Always unregister the subdev on failure

2016-08-24 Thread Alban Bedel
In v4l2_async_test_notify() if the registered_async callback or the
complete notifier returns an error the subdev is not unregistered.
This leave paths where v4l2_async_register_subdev() can fail but
leave the subdev still registered.

Add the required calls to v4l2_device_unregister_subdev() to plug
these holes.

Signed-off-by: Alban Bedel 
---
Changelog:
v2: * Added the missing unbind() calls as suggested by Javier.
---
 drivers/media/v4l2-core/v4l2-async.c | 29 +
 1 file changed, 17 insertions(+), 12 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-async.c 
b/drivers/media/v4l2-core/v4l2-async.c
index ceb28d47c3f9..abe512d0b4cb 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -113,23 +113,28 @@ static int v4l2_async_test_notify(struct 
v4l2_async_notifier *notifier,
list_move(>async_list, >done);
 
ret = v4l2_device_register_subdev(notifier->v4l2_dev, sd);
-   if (ret < 0) {
-   if (notifier->unbind)
-   notifier->unbind(notifier, sd, asd);
-   return ret;
-   }
+   if (ret < 0)
+   goto err_subdev_register;
 
ret = v4l2_subdev_call(sd, core, registered_async);
-   if (ret < 0 && ret != -ENOIOCTLCMD) {
-   if (notifier->unbind)
-   notifier->unbind(notifier, sd, asd);
-   return ret;
+   if (ret < 0 && ret != -ENOIOCTLCMD)
+   goto err_subdev_call;
+
+   if (list_empty(>waiting) && notifier->complete) {
+   ret = notifier->complete(notifier);
+   if (ret < 0)
+   goto err_subdev_call;
}
 
-   if (list_empty(>waiting) && notifier->complete)
-   return notifier->complete(notifier);
-
return 0;
+
+err_subdev_call:
+   v4l2_device_unregister_subdev(sd);
+err_subdev_register:
+   if (notifier->unbind)
+   notifier->unbind(notifier, sd, asd);
+
+   return ret;
 }
 
 static void v4l2_async_cleanup(struct v4l2_subdev *sd)
-- 
2.9.3

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