[PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-06 Thread Federico Vaga
This patch re-write the driver and use the videobuf2
interface instead of the old videobuf. Moreover, it uses also
the control framework which allows the driver to inherit
controls from its subdevice (ADV7180)

Signed-off-by: Federico Vaga 
Acked-by: Giancarlo Asnaghi 
---
 drivers/media/pci/sta2x11/Kconfig   |2 +-
 drivers/media/pci/sta2x11/sta2x11_vip.c | 1239 ++-
 2 file modificati, 409 inserzioni(+), 832 rimozioni(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig 
b/drivers/media/pci/sta2x11/Kconfig
index 6749f67..654339f 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -2,7 +2,7 @@ config STA2X11_VIP
tristate "STA2X11 VIP Video For Linux"
depends on STA2X11
select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
-   select VIDEOBUF_DMA_CONTIG
+   select VIDEOBUF2_DMA_STREAMING
depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
help
  Say Y for support for STA2X11 VIP (Video Input Port) capture
diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c 
b/drivers/media/pci/sta2x11/sta2x11_vip.c
index 4c10205..ee61acc 100644
--- a/drivers/media/pci/sta2x11/sta2x11_vip.c
+++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
@@ -1,7 +1,11 @@
 /*
  * This is the driver for the STA2x11 Video Input Port.
  *
+ * Copyright (C) 2012   ST Microelectronics
+ * author: Federico Vaga 
  * Copyright (C) 2010   WindRiver Systems, Inc.
+ * authors: Andreas Kies 
+ *  Vlad Lungu   
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -19,36 +23,30 @@
  * The full GNU General Public License is included in this distribution in
  * the file called "COPYING".
  *
- * Author: Andreas Kies 
- * Vlad Lungu 
- *
  */
 
 #include 
 #include 
 #include 
 #include 
-#include 
-
 #include 
-
 #include 
-
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
+#include 
+#include 
+#include 
 
 #include "sta2x11_vip.h"
 
-#define DRV_NAME "sta2x11_vip"
 #define DRV_VERSION "1.3"
 
 #ifndef PCI_DEVICE_ID_STMICRO_VIP
@@ -63,8 +61,8 @@
 #define DVP_TFS0x08
 #define DVP_BFO0x0C
 #define DVP_BFS0x10
-#define DVP_VTP 0x14
-#define DVP_VBP 0x18
+#define DVP_VTP0x14
+#define DVP_VBP0x18
 #define DVP_VMP0x1C
 #define DVP_ITM0x98
 #define DVP_ITS0x9C
@@ -84,43 +82,20 @@
 
 #define DVP_HLFLN_SD   0x0001
 
-#define REG_WRITE(vip, reg, value) iowrite32((value), (vip->iomem)+(reg))
-#define REG_READ(vip, reg) ioread32((vip->iomem)+(reg))
-
 #define SAVE_COUNT 8
 #define AUX_COUNT 3
 #define IRQ_COUNT 1
 
-/**
- * struct sta2x11_vip - All internal data for one instance of device
- * @v4l2_dev: device registered in v4l layer
- * @video_dev: properties of our device
- * @pdev: PCI device
- * @adapter: contains I2C adapter information
- * @register_save_area: All relevant register are saved here during suspend
- * @decoder: contains information about video DAC
- * @format: pixel format, fixed UYVY
- * @std: video standard (e.g. PAL/NTSC)
- * @input: input line for video signal ( 0 or 1 )
- * @users: Number of open of device ( max. 1 )
- * @disabled: Device is in power down state
- * @mutex: ensures exclusive opening of device
- * @slock: for excluse acces of registers
- * @vb_vidq: queue maintained by videobuf layer
- * @capture: linked list of capture buffer
- * @active: struct videobuf_buffer currently beingg filled
- * @started: device is ready to capture frame
- * @closing: device will be shut down
- * @tcount: Number of top frames
- * @bcount: Number of bottom frames
- * @overflow: Number of FIFO overflows
- * @mem_spare: small buffer of unused frame
- * @dma_spare: dma addres of mem_spare
- * @iomem: hardware base address
- * @config: I2C and gpio config from platform
- *
- * All non-local data is accessed via this structure.
- */
+
+struct vip_buffer {
+   struct vb2_buffer   vb;
+   struct list_headlist;
+   dma_addr_t  dma;
+};
+static inline struct vip_buffer *to_vip_buffer(struct vb2_buffer *vb2)
+{
+   return container_of(vb2, struct vip_buffer, vb);
+}
 
 struct sta2x11_vip {
struct v4l2_device v4l2_dev;
@@ -129,21 +104,27 @@ struct sta2x11_vip {
struct i2c_adapter *adapter;
unsigned int register_save_area[IRQ_COUNT + SAVE_COUNT + AUX_COUNT];
struct v4l2_subdev *decoder;
-   struct v4l2_pix_format format;
-   v4l2_std_id std;
-   unsigned int input;
-   int users;
-   int disabled;
-   struct mutex mutex; /* exclusive access during open */
-   spinlock_t slock;   /* spin lock for hardware and queue access */
-   struct videobuf_queue vb_vidq;
-   struct list_he

Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-05 Thread Federico Vaga
> Not sure if you got my point: the main point of removing MODULE_AUTHOR
> and other copyright stuff is that such patch may easily be doing something
> that could be considered a copyright violation, being bad not only to
> the affected driver, but to the entire Kernel.
> 
> So, we need to handle it with due care. Getting other authors's
> acks on such patch seems to be the only safe way of doing that.

Yes I got the point.

Thank you

-- 
Federico Vaga
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-05 Thread Mauro Carvalho Chehab

Em 05-12-2012 11:27, Federico Vaga escreveu:

Ok, I understand. I will write something like this.

   * Copyright (C) 2012   ST Microelectronics
   *  author: Federico Vaga 
   * Copyright (C) 2010   WindRiver Systems, Inc.
   *  authors: Andreas Kies 
   *   Vlad Lungu 


Sounds perfect to me.


I will answer to this with a patch


Thanks!


As you said, the best place to discuss about it is likely at LKML.
[...]
Btw, this is why it is called "git blame", and not "git authorship":
it is a tool to identify who was the last one that modified the code.
Its main usage is to identify who might have introduced a bug on the
code.


I know I know, it was just a stupid example to expose the problem that I have
in my mind. I know that it is very difficult (impossible?) to assign the
authorship of a single line, and git blame it is not the tool to do this :)

I think you understand what I mean despite the stupid example


Yeah, I hear you.

Not sure if you got my point: the main point of removing MODULE_AUTHOR
and other copyright stuff is that such patch may easily be doing something
that could be considered a copyright violation, being bad not only to
the affected driver, but to the entire Kernel.

So, we need to handle it with due care. Getting other authors's
acks on such patch seems to be the only safe way of doing that.

Regards,
Mauro

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-05 Thread Federico Vaga
> > Ok, I understand. I will write something like this.
> > 
> >   * Copyright (C) 2012   ST Microelectronics
> >   *  author: Federico Vaga 
> >   * Copyright (C) 2010   WindRiver Systems, Inc.
> >   *  authors: Andreas Kies 
> >   *   Vlad Lungu 
> 
> Sounds perfect to me.

I will answer to this with a patch

> As you said, the best place to discuss about it is likely at LKML.
> [...]
> Btw, this is why it is called "git blame", and not "git authorship":
> it is a tool to identify who was the last one that modified the code.
> Its main usage is to identify who might have introduced a bug on the
> code.

I know I know, it was just a stupid example to expose the problem that I have 
in my mind. I know that it is very difficult (impossible?) to assign the 
authorship of a single line, and git blame it is not the tool to do this :)

I think you understand what I mean despite the stupid example

-- 
Federico Vaga
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-05 Thread Mauro Carvalho Chehab

Em 05-12-2012 10:24, Federico Vaga escreveu:

Thank you Mauro for the good explanation


Yeah, there are many changes there that justifies adding you at its
authorship, and that's ok. Also, anyone saying the size of your patch
will recognize your and ST efforts to improve the driver.

However, as some parts of the code were preserved, dropping the old
authors doesn't sound right (and can even be illegal, in the light
of the GPL license). It would be ok, though, if you would be
changing it to something like:

Copyright (c) 2010 by ...
or
Original driver from ...


Ok, I understand. I will write something like this.
  * Copyright (C) 2012   ST Microelectronics
  *  author: Federico Vaga 
  * Copyright (C) 2010   WindRiver Systems, Inc.
  *  authors: Andreas Kies 
  *   Vlad Lungu 


Sounds perfect to me.


So, IMHO, there's not much point on dropping authorship messages.


So the MODULE_AUTHOR will be Windriver forever until they drop authorship?
Also if in the next future 0 windriver lines will be in the code?

(general talking, not about this driver)
If I do git blame on a driver with MODULE_AUTHOR("Mr. X"); but only the
MODULE_AUTHOR line is from Mr X; there is not an automatically system which
remove the MODULE_AUTHOR? Ok, probably it was the original author of the code
and the comment header with the copyright history gives to Mr X all the
honours, but there is nothing from him in the code. It is not better to remove
MODULE_AUTHOR or replace it with who wrotes most of the code?
I know that this is not the best place to talk about this, just a little
curiosity


As you said, the best place to discuss about it is likely at LKML.
It could make sense to have some policy with regards to MODULE_AUTHOR(),
stating when it could be modified, preferably reviewed by some experienced
open source lawyers. I'm not aware of any.

In any case, I don't think anyone should rely on "git blame" for it.
The tool that helps to get code authorship is "git log -M", but
to get the real authorship requires a lot more of just calling it.

A trivial case where git blame will likely be giving wrong "credits"
is if a driver has all functions reordered. It may happen that git blame
will give credits to the one that reordered the functions, and not to
the original code's author.

There are more subtle cases, though. For example, please assume that
the original driver has to call a certain function to do some needed
work to initialize the device:

call_function_foo();

And a reviewer latter add a logic to deal with errors, like:

ret = call_function_foo();
if (ret)
return ret;

The reviewer wrote 2 additional lines, and modified 1 original line.
Yet, his contribution didn't make the code to work. The one that did it
was the single-line patch that added call_function_foo(). So, in this
case, a single line change was more significant for the driver than a
3 line addition[1]. Also, again, git blame will give the "credits"
for the line that calls call_function_foo() to the wrong guy.

Btw, this is why it is called "git blame", and not "git authorship":
it is a tool to identify who was the last one that modified the code.
Its main usage is to identify who might have introduced a bug on the
code.

Let's assume that call_function_foo() could be returning some non-error
positive values, under certain circumstances. In that case, the above
code would actually be introducing a bug by using:
if (ret)
instead of
if (ret < 0)

So, the 3 line patch is not only be less relevant for the driver to
work than the original author's code, but it is actually wrong
and introduced a serious driver regression, preventing it to work.
Git blame was made to address such cases: once a bug got bisected, it
helps to get the changelog that made the change, pointing to who made
the changes and why. So, a proper fix for the bug can be better
prepared, to not only fix the bug, but to also address the issue
pointed by the blamed patchset.

Regards,
Mauro

[1] Please, don't get be wrong on that: we do want patches adding
proper error handling. They are important to improve the driver's
reliability.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-05 Thread Federico Vaga
Thank you Mauro for the good explanation

> Yeah, there are many changes there that justifies adding you at its
> authorship, and that's ok. Also, anyone saying the size of your patch
> will recognize your and ST efforts to improve the driver.
> 
> However, as some parts of the code were preserved, dropping the old
> authors doesn't sound right (and can even be illegal, in the light
> of the GPL license). It would be ok, though, if you would be
> changing it to something like:
> 
>   Copyright (c) 2010 by ...
> or
>   Original driver from ...

Ok, I understand. I will write something like this.
 * Copyright (C) 2012   ST Microelectronics
 *  author: Federico Vaga 
 * Copyright (C) 2010   WindRiver Systems, Inc.
 *  authors: Andreas Kies 
 *   Vlad Lungu 


> The only way of not preserving the original authors here were if you
> start from scratch, without looking at the original code (and you can
> somehow, be able to proof it), otherwise, the code will be fit as a
> "derivative work", in the light of GPL, and should be preserving the
> original authorship.
> 
> Something started from scratch like that will hardly be accepted upstream,
> as regressions will likely be introduced, and previously supported
> hardware/features may be lost in the process.

I understand
 
> Of course the original author can abdicate to his rights of keeping his
> name on it. Yet, even if he opt/accept to not keep his name explicitly
> there, his copyrights are preserved, with the help of the git history.
> 
> That's said, no single kernel developer/company has full copyrights on
> any part of the Kernel, as their code are based on someone else's work.
> For example, all Kernel drivers depend on drivers/base, with in turn,
> depends on memory management, generic helper functions, arch code, etc.

yeah I know :)

> So, IMHO, there's not much point on dropping authorship messages.

So the MODULE_AUTHOR will be Windriver forever until they drop authorship? 
Also if in the next future 0 windriver lines will be in the code?

(general talking, not about this driver)
If I do git blame on a driver with MODULE_AUTHOR("Mr. X"); but only the 
MODULE_AUTHOR line is from Mr X; there is not an automatically system which 
remove the MODULE_AUTHOR? Ok, probably it was the original author of the code 
and the comment header with the copyright history gives to Mr X all the 
honours, but there is nothing from him in the code. It is not better to remove 
MODULE_AUTHOR or replace it with who wrotes most of the code?
I know that this is not the best place to talk about this, just a little 
curiosity

-- 
Federico Vaga
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-05 Thread Mauro Carvalho Chehab

Hi Federico,

Em 04-12-2012 23:12, Federico Vaga escreveu:

On Tuesday 04 December 2012 14:15:15 Mauro Carvalho Chehab wrote:

Em 24-09-2012 07:58, Federico Vaga escreveu:

This patch re-write the driver and use the videobuf2
interface instead of the old videobuf. Moreover, it uses also
the control framework which allows the driver to inherit
controls from its subdevice (ADV7180)

Signed-off-by: Federico Vaga 
Acked-by: Giancarlo Asnaghi 

[..]

   /*

* This is the driver for the STA2x11 Video Input Port.
*

+ * Copyright (C) 2012   ST Microelectronics

* Copyright (C) 2010   WindRiver Systems, Inc.
*
* This program is free software; you can redistribute it and/or modify
it

@@ -19,36 +20,30 @@

* The full GNU General Public License is included in this distribution
in
* the file called "COPYING".
*

- * Author: Andreas Kies 
- * Vlad Lungu 


Why are you dropping those authorship data?

Ok, it is clear to me that most of the code there got rewritten, and,
while IANAL, I think they still have some copyrights on it.

So, if you're willing to do that, you need to get authors ack
on such patch.


I re-write the driver, and also the first version of the driver has many
modification made by me, many bug fix, style review, remove useless code.
The first time I didn't add myself as author because the logic of the driver
did not change. This time, plus the old change I think there is nothing of the
original driver because I rewrite it from the hardware manual. Practically, It
is a new driver for the same device.


Yeah, there are many changes there that justifies adding you at its
authorship, and that's ok. Also, anyone saying the size of your patch
will recognize your and ST efforts to improve the driver.

However, as some parts of the code were preserved, dropping the old
authors doesn't sound right (and can even be illegal, in the light
of the GPL license). It would be ok, though, if you would be
changing it to something like:

Copyright (c) 2010 by ...
or
Original driver from ...

or some other similar wording that would preserve their names
there. We do that even when something is rewritten, like, for
example, drivers/media/v4l2-core/videobuf-core.c:

 * (c) 2007 Mauro Carvalho Chehab, 
 *
 * Highly based on video-buf written originally by:
 * (c) 2001,02 Gerd Knorr 
 * (c) 2006 Mauro Carvalho Chehab, 
 * (c) 2006 Ted Walther and John Sokol



Anyway I will try to contact the original authors for the acked-by.


   MODULE_DESCRIPTION("STA2X11 Video Input Port driver");

-MODULE_AUTHOR("Wind River");


Same note applies here: we need Wind River's ack on that to drop it.


I will try also for this. But I think that this is not a windriver driver
because I re-wrote it from the hardware manual. I used the old driver because
I thought that it was better than propose a patch that remove the old driver
and add my driver.
I did not remove the 2010 Copyright from windriver, because they did the job,
but this work was paid by ST (copyright 2012) and made completely by me.


The same reason why you didn't drop windriver's copyright also applies here:
while most of the code changed, there are still a few things left from the
original driver.


Is my thinking wrong?

Just a question for the future so I avoid to redo the same error. If I re-
wrote most of a driver I cannot change the authorship automatically without
the acked-by of the previous author. If I ask to the previous author and he
does not give me the acked-by (or he is unreachable, he change email address),
then the driver is written by me but the author is someone else? Right? So, it
is better if I propose a patch which remove a driver and a patch which add my
driver?


The only way of not preserving the original authors here were if you
start from scratch, without looking at the original code (and you can
somehow, be able to proof it), otherwise, the code will be fit as a
"derivative work", in the light of GPL, and should be preserving the
original authorship.

Something started from scratch like that will hardly be accepted upstream,
as regressions will likely be introduced, and previously supported
hardware/features may be lost in the process.

Of course the original author can abdicate to his rights of keeping his
name on it. Yet, even if he opt/accept to not keep his name explicitly
there, his copyrights are preserved, with the help of the git history.

That's said, no single kernel developer/company has full copyrights on
any part of the Kernel, as their code are based on someone else's work.
For example, all Kernel drivers depend on drivers/base, with in turn,
depends on memory management, generic helper functions, arch code, etc.

So, IMHO, there's not much point on dropping authorship messages.

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

Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-04 Thread Federico Vaga
On Tuesday 04 December 2012 14:15:15 Mauro Carvalho Chehab wrote:
> Em 24-09-2012 07:58, Federico Vaga escreveu:
> > This patch re-write the driver and use the videobuf2
> > interface instead of the old videobuf. Moreover, it uses also
> > the control framework which allows the driver to inherit
> > controls from its subdevice (ADV7180)
> > 
> > Signed-off-by: Federico Vaga 
> > Acked-by: Giancarlo Asnaghi 
> >
> > [..]
> > 
> >   /*
> >   
> >* This is the driver for the STA2x11 Video Input Port.
> >*
> > 
> > + * Copyright (C) 2012   ST Microelectronics
> > 
> >* Copyright (C) 2010   WindRiver Systems, Inc.
> >*
> >* This program is free software; you can redistribute it and/or modify
> >it
> > 
> > @@ -19,36 +20,30 @@
> > 
> >* The full GNU General Public License is included in this distribution
> >in
> >* the file called "COPYING".
> >*
> > 
> > - * Author: Andreas Kies 
> > - * Vlad Lungu 
> 
> Why are you dropping those authorship data?
> 
> Ok, it is clear to me that most of the code there got rewritten, and,
> while IANAL, I think they still have some copyrights on it.
> 
> So, if you're willing to do that, you need to get authors ack
> on such patch.

I re-write the driver, and also the first version of the driver has many 
modification made by me, many bug fix, style review, remove useless code.
The first time I didn't add myself as author because the logic of the driver 
did not change. This time, plus the old change I think there is nothing of the 
original driver because I rewrite it from the hardware manual. Practically, It 
is a new driver for the same device.

Anyway I will try to contact the original authors for the acked-by.

> >   MODULE_DESCRIPTION("STA2X11 Video Input Port driver");
> > 
> > -MODULE_AUTHOR("Wind River");
> 
> Same note applies here: we need Wind River's ack on that to drop it.

I will try also for this. But I think that this is not a windriver driver 
because I re-wrote it from the hardware manual. I used the old driver because 
I thought that it was better than propose a patch that remove the old driver 
and add my driver.
I did not remove the 2010 Copyright from windriver, because they did the job, 
but this work was paid by ST (copyright 2012) and made completely by me.

Is my thinking wrong?

Just a question for the future so I avoid to redo the same error. If I re-
wrote most of a driver I cannot change the authorship automatically without 
the acked-by of the previous author. If I ask to the previous author and he 
does not give me the acked-by (or he is unreachable, he change email address), 
then the driver is written by me but the author is someone else? Right? So, it 
is better if I propose a patch which remove a driver and a patch which add my 
driver?

Thank you

-- 
Federico Vaga
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-12-04 Thread Mauro Carvalho Chehab

Em 24-09-2012 07:58, Federico Vaga escreveu:

This patch re-write the driver and use the videobuf2
interface instead of the old videobuf. Moreover, it uses also
the control framework which allows the driver to inherit
controls from its subdevice (ADV7180)

Signed-off-by: Federico Vaga 
Acked-by: Giancarlo Asnaghi 
---
  drivers/media/pci/sta2x11/Kconfig   |2 +-
  drivers/media/pci/sta2x11/sta2x11_vip.c | 1238 ++-
  2 file modificati, 407 inserzioni(+), 833 rimozioni(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig 
b/drivers/media/pci/sta2x11/Kconfig
index 6749f67..654339f 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -2,7 +2,7 @@ config STA2X11_VIP
tristate "STA2X11 VIP Video For Linux"
depends on STA2X11
select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
-   select VIDEOBUF_DMA_CONTIG
+   select VIDEOBUF2_DMA_STREAMING
depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
help
  Say Y for support for STA2X11 VIP (Video Input Port) capture
diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c 
b/drivers/media/pci/sta2x11/sta2x11_vip.c
index 4c10205..b9ff926 100644
--- a/drivers/media/pci/sta2x11/sta2x11_vip.c
+++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
@@ -1,6 +1,7 @@
  /*
   * This is the driver for the STA2x11 Video Input Port.
   *
+ * Copyright (C) 2012   ST Microelectronics
   * Copyright (C) 2010   WindRiver Systems, Inc.
   *
   * This program is free software; you can redistribute it and/or modify it
@@ -19,36 +20,30 @@
   * The full GNU General Public License is included in this distribution in
   * the file called "COPYING".
   *
- * Author: Andreas Kies 
- * Vlad Lungu 



Why are you dropping those authorship data?

Ok, it is clear to me that most of the code there got rewritten, and,
while IANAL, I think they still have some copyrights on it.

So, if you're willing to do that, you need to get authors ack
on such patch.

...



  MODULE_DESCRIPTION("STA2X11 Video Input Port driver");
-MODULE_AUTHOR("Wind River");


Same note applies here: we need Wind River's ack on that to drop it.


+MODULE_AUTHOR("Federico Vaga ");
  MODULE_LICENSE("GPL v2");
  MODULE_SUPPORTED_DEVICE("sta2x11 video input");
  MODULE_VERSION(DRV_VERSION);



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/4] sta2x11_vip: convert to videobuf2 and control framework

2012-09-24 Thread Federico Vaga
This patch re-write the driver and use the videobuf2
interface instead of the old videobuf. Moreover, it uses also
the control framework which allows the driver to inherit
controls from its subdevice (ADV7180)

Signed-off-by: Federico Vaga 
Acked-by: Giancarlo Asnaghi 
---
 drivers/media/pci/sta2x11/Kconfig   |2 +-
 drivers/media/pci/sta2x11/sta2x11_vip.c | 1238 ++-
 2 file modificati, 407 inserzioni(+), 833 rimozioni(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig 
b/drivers/media/pci/sta2x11/Kconfig
index 6749f67..654339f 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -2,7 +2,7 @@ config STA2X11_VIP
tristate "STA2X11 VIP Video For Linux"
depends on STA2X11
select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
-   select VIDEOBUF_DMA_CONTIG
+   select VIDEOBUF2_DMA_STREAMING
depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
help
  Say Y for support for STA2X11 VIP (Video Input Port) capture
diff --git a/drivers/media/pci/sta2x11/sta2x11_vip.c 
b/drivers/media/pci/sta2x11/sta2x11_vip.c
index 4c10205..b9ff926 100644
--- a/drivers/media/pci/sta2x11/sta2x11_vip.c
+++ b/drivers/media/pci/sta2x11/sta2x11_vip.c
@@ -1,6 +1,7 @@
 /*
  * This is the driver for the STA2x11 Video Input Port.
  *
+ * Copyright (C) 2012   ST Microelectronics
  * Copyright (C) 2010   WindRiver Systems, Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -19,36 +20,30 @@
  * The full GNU General Public License is included in this distribution in
  * the file called "COPYING".
  *
- * Author: Andreas Kies 
- * Vlad Lungu 
- *
  */
 
 #include 
 #include 
 #include 
 #include 
-#include 
-
 #include 
-
 #include 
-
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
-#include 
+#include 
+#include 
+#include 
 
 #include "sta2x11_vip.h"
 
-#define DRV_NAME "sta2x11_vip"
 #define DRV_VERSION "1.3"
 
 #ifndef PCI_DEVICE_ID_STMICRO_VIP
@@ -63,8 +58,8 @@
 #define DVP_TFS0x08
 #define DVP_BFO0x0C
 #define DVP_BFS0x10
-#define DVP_VTP 0x14
-#define DVP_VBP 0x18
+#define DVP_VTP0x14
+#define DVP_VBP0x18
 #define DVP_VMP0x1C
 #define DVP_ITM0x98
 #define DVP_ITS0x9C
@@ -84,43 +79,20 @@
 
 #define DVP_HLFLN_SD   0x0001
 
-#define REG_WRITE(vip, reg, value) iowrite32((value), (vip->iomem)+(reg))
-#define REG_READ(vip, reg) ioread32((vip->iomem)+(reg))
-
 #define SAVE_COUNT 8
 #define AUX_COUNT 3
 #define IRQ_COUNT 1
 
-/**
- * struct sta2x11_vip - All internal data for one instance of device
- * @v4l2_dev: device registered in v4l layer
- * @video_dev: properties of our device
- * @pdev: PCI device
- * @adapter: contains I2C adapter information
- * @register_save_area: All relevant register are saved here during suspend
- * @decoder: contains information about video DAC
- * @format: pixel format, fixed UYVY
- * @std: video standard (e.g. PAL/NTSC)
- * @input: input line for video signal ( 0 or 1 )
- * @users: Number of open of device ( max. 1 )
- * @disabled: Device is in power down state
- * @mutex: ensures exclusive opening of device
- * @slock: for excluse acces of registers
- * @vb_vidq: queue maintained by videobuf layer
- * @capture: linked list of capture buffer
- * @active: struct videobuf_buffer currently beingg filled
- * @started: device is ready to capture frame
- * @closing: device will be shut down
- * @tcount: Number of top frames
- * @bcount: Number of bottom frames
- * @overflow: Number of FIFO overflows
- * @mem_spare: small buffer of unused frame
- * @dma_spare: dma addres of mem_spare
- * @iomem: hardware base address
- * @config: I2C and gpio config from platform
- *
- * All non-local data is accessed via this structure.
- */
+
+struct vip_buffer {
+   struct vb2_buffer   vb;
+   struct list_headlist;
+   dma_addr_t  dma;
+};
+static inline struct vip_buffer *to_vip_buffer(struct vb2_buffer *vb2)
+{
+   return container_of(vb2, struct vip_buffer, vb);
+}
 
 struct sta2x11_vip {
struct v4l2_device v4l2_dev;
@@ -129,21 +101,27 @@ struct sta2x11_vip {
struct i2c_adapter *adapter;
unsigned int register_save_area[IRQ_COUNT + SAVE_COUNT + AUX_COUNT];
struct v4l2_subdev *decoder;
-   struct v4l2_pix_format format;
-   v4l2_std_id std;
-   unsigned int input;
-   int users;
-   int disabled;
-   struct mutex mutex; /* exclusive access during open */
-   spinlock_t slock;   /* spin lock for hardware and queue access */
-   struct videobuf_queue vb_vidq;
-   struct list_head capture;
-   struct videobuf_buffer *active;
-   int started, closing, tcount, bcount;
+   struct v4l2_ctrl_handler ctrl_hdl;
+
+
+   struct v4l2