Re: [RFC PATCH 14/26] [media] Add i.MX SoC wide media device driver

2014-06-24 Thread Dave Müller
Hello

Philipp Zabel p.za...@pengutronix.de writes:

 diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
 index 8e9c26c..3fe7e28 100644
 --- a/drivers/media/platform/Kconfig
 +++ b/drivers/media/platform/Kconfig
 @@ -35,6 +35,8 @@  source drivers/media/platform/omap/Kconfig
 
  source drivers/media/platform/blackfin/Kconfig
 
 +source drivers/media/platform/imx/Kconfig
 +

This was added already in patch #8 of this serie.


--
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 05/23] v4l: vb2: Fix stream start and buffer completion race

2014-06-24 Thread Hans Verkuil
On 06/24/14 01:54, Laurent Pinchart wrote:
 videobuf2 stores the driver streaming state internally in the queue in
 the start_streaming_called variable. The state is set right after the
 driver start_stream operation returns, and checked in the
 vb2_buffer_done() function, typically called from the frame completion
 interrupt handler. A race condition exists if the hardware finishes
 processing the first frame before the start_stream operation returns.
 
 Fix this by setting start_streaming_called to 1 before calling the
 start_stream operation, and resetting it to 0 if the operation fails.
 
 Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com

Reviewed-by: Hans Verkuil hans.verk...@cisco.com

Good catch!

This needs a:

Cc: sta...@vger.kernel.org  # for v3.15 and up

Regards,

Hans

 ---
  drivers/media/v4l2-core/videobuf2-core.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/v4l2-core/videobuf2-core.c 
 b/drivers/media/v4l2-core/videobuf2-core.c
 index 7c4489c..1d67e95 100644
 --- a/drivers/media/v4l2-core/videobuf2-core.c
 +++ b/drivers/media/v4l2-core/videobuf2-core.c
 @@ -1750,12 +1750,14 @@ static int vb2_start_streaming(struct vb2_queue *q)
   __enqueue_in_driver(vb);
  
   /* Tell the driver to start streaming */
 + q-start_streaming_called = 1;
   ret = call_qop(q, start_streaming, q,
  atomic_read(q-owned_by_drv_count));
 - q-start_streaming_called = ret == 0;
   if (!ret)
   return 0;
  
 + q-start_streaming_called = 0;
 +
   dprintk(1, driver refused to start streaming\n);
   if (WARN_ON(atomic_read(q-owned_by_drv_count))) {
   unsigned i;
 

--
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 00/22] Add and use pci_zalloc_consistent

2014-06-24 Thread Johannes Berg
On Tue, 2014-06-24 at 09:27 +1000, Julian Calaby wrote:

  - x = (T)pci_alloc_consistent(E1,E2,E3);
  + x = pci_zalloc_consistent(E1,E2,E3);
if ((x==NULL) || ...) S
  - memset((T2)x,0,E2);
 
 I don't know much about SmPL, but wouldn't having that if statement
 there reduce your matches?

Code that matched without the if statement would be buggy, since it
wouldn't be checking the pci_zalloc_consistent return value properly.l

johannes

--
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 07/23] v4l: vsp1: Release buffers at stream stop

2014-06-24 Thread Sergei Shtylyov

Hello.

On 06/24/2014 03:54 AM, Laurent Pinchart wrote:


videobuf2 expects no buffer to be owned by the driver when the
stop_stream queue operation returns. As the vsp1 driver fails to do so,
a warning is generated at stream top time.



Fix this by mark releasing all buffers queued on the IRQ queue in the


   Mark releasing?


stop_stream operation handler and marking them as erroneous.



Signed-off-by: Laurent Pinchart laurent.pinchart+rene...@ideasonboard.com


WBR, Sergei

--
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] af9035: override tuner id when bad value set into eeprom

2014-06-24 Thread Antti Palosaari
Tuner ID set into EEPROM is wrong in some cases, which causes driver
to select wrong tuner profile. That leads device non-working. Fix
issue by overriding known bad tuner IDs with suitable default value.

Cc: sta...@vger.kernel.org # v3.15+
Signed-off-by: Antti Palosaari cr...@iki.fi
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 40 +--
 1 file changed, 33 insertions(+), 7 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c 
b/drivers/media/usb/dvb-usb-v2/af9035.c
index 021e4d3..7b9b75f 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -704,15 +704,41 @@ static int af9035_read_config(struct dvb_usb_device *d)
if (ret  0)
goto err;
 
-   if (tmp == 0x00)
-   dev_dbg(d-udev-dev,
-   %s: [%d]tuner not set, using 
default\n,
-   __func__, i);
-   else
+   dev_dbg(d-udev-dev, %s: [%d]tuner=%02x\n,
+   __func__, i, tmp);
+
+   /* tuner sanity check */
+   if (state-chip_type == 0x9135) {
+   if (state-chip_version == 0x02) {
+   /* IT9135 BX (v2) */
+   switch (tmp) {
+   case AF9033_TUNER_IT9135_60:
+   case AF9033_TUNER_IT9135_61:
+   case AF9033_TUNER_IT9135_62:
+   state-af9033_config[i].tuner = tmp;
+   break;
+   }
+   } else {
+   /* IT9135 AX (v1) */
+   switch (tmp) {
+   case AF9033_TUNER_IT9135_38:
+   case AF9033_TUNER_IT9135_51:
+   case AF9033_TUNER_IT9135_52:
+   state-af9033_config[i].tuner = tmp;
+   break;
+   }
+   }
+   } else {
+   /* AF9035 */
state-af9033_config[i].tuner = tmp;
+   }
 
-   dev_dbg(d-udev-dev, %s: [%d]tuner=%02x\n,
-   __func__, i, state-af9033_config[i].tuner);
+   if (state-af9033_config[i].tuner != tmp) {
+   dev_info(d-udev-dev,
+   %s: [%d] overriding tuner from %02x to 
%02x\n,
+   KBUILD_MODNAME, i, tmp,
+   state-af9033_config[i].tuner);
+   }
 
switch (state-af9033_config[i].tuner) {
case AF9033_TUNER_TUA9001:
-- 
1.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


Re: [RFC 1/2] gspca: provide a mechanism to select a specific transfer endpoint

2014-06-24 Thread Antonio Ospite
On Thu, 19 Jun 2014 16:27:59 +0200
Hans de Goede hdego...@redhat.com wrote:

 Hi Antonio,
 
 Thanks for working on this.
 
 On 06/04/2014 10:24 PM, Antonio Ospite wrote:
  Add a xfer_ep_index field to struct gspca_dev, and change alt_xfer() so
  that it accepts a parameter which represents a specific endpoint to look
  for.
  
  If a subdriver wants to specify a value for gspca_dev-xfer_ep_index it
  can do that in its sd_config() callback.
  
  Signed-off-by: Antonio Ospite a...@ao2.it
  ---
  
  I am not sure if it is OK to specify an endpoint _index_ or if it would be
  better to specify the endpoint address directly (in Kinect 0x81 is for video
  data and 0x82 is for depth data).
 
  Hans, any comment on that?
 
 I think it would be better to use the endpoint address directly for this,
 relying on the order in which the endpoints are listed in the descriptor
 feels wrong to me.


I see.

If I declare the new field as __u8 (same type of a bEndpointAddress), I
could mark an invalid ep address with ~(USB_ENDPOINT_DIR_MASK | 
USB_ENDPOINT_NUMBER_MASK) in gspca_dev_probe2(), instead of using an
int set to -1; how does that sound?

 Other then that this patch looks good.
 
 Regards,
 
 Hans
 
 
  
  Thanks,
 Antonio
  
   drivers/media/usb/gspca/gspca.c | 20 ++--
   drivers/media/usb/gspca/gspca.h |  1 +
   2 files changed, 15 insertions(+), 6 deletions(-)
  
  diff --git a/drivers/media/usb/gspca/gspca.c 
  b/drivers/media/usb/gspca/gspca.c
  index f3a7ace..7e5226c 100644
  --- a/drivers/media/usb/gspca/gspca.c
  +++ b/drivers/media/usb/gspca/gspca.c
  @@ -603,10 +603,13 @@ static void gspca_stream_off(struct gspca_dev 
  *gspca_dev)
   }
   
   /*
  - * look for an input transfer endpoint in an alternate setting
  + * look for an input transfer endpoint in an alternate setting.
  + *
  + * If xfer_ep_index is negative, return the first valid one found, 
  otherwise
  + * look for exactly the one in position xfer_ep.
*/
   static struct usb_host_endpoint *alt_xfer(struct usb_host_interface *alt,
  - int xfer)
  + int xfer, int xfer_ep_index)
   {
  struct usb_host_endpoint *ep;
  int i, attr;
  @@ -616,8 +619,10 @@ static struct usb_host_endpoint *alt_xfer(struct 
  usb_host_interface *alt,
  attr = ep-desc.bmAttributes  USB_ENDPOINT_XFERTYPE_MASK;
  if (attr == xfer
   ep-desc.wMaxPacketSize != 0
  -usb_endpoint_dir_in(ep-desc))
  +usb_endpoint_dir_in(ep-desc)
  +(xfer_ep_index  0 || i == xfer_ep_index)) {
  return ep;
  +   }
  }
  return NULL;
   }
  @@ -689,7 +694,7 @@ static int build_isoc_ep_tb(struct gspca_dev *gspca_dev,
  found = 0;
  for (j = 0; j  nbalt; j++) {
  ep = alt_xfer(intf-altsetting[j],
  - USB_ENDPOINT_XFER_ISOC);
  + USB_ENDPOINT_XFER_ISOC, 
  gspca_dev-xfer_ep_index);
  if (ep == NULL)
  continue;
  if (ep-desc.bInterval == 0) {
  @@ -862,7 +867,8 @@ static int gspca_init_transfer(struct gspca_dev 
  *gspca_dev)
  /* if bulk or the subdriver forced an altsetting, get the endpoint */
  if (gspca_dev-alt != 0) {
  gspca_dev-alt--;   /* (previous version compatibility) */
  -   ep = alt_xfer(intf-altsetting[gspca_dev-alt], xfer);
  +   ep = alt_xfer(intf-altsetting[gspca_dev-alt], xfer,
  + gspca_dev-xfer_ep_index);
  if (ep == NULL) {
  pr_err(bad altsetting %d\n, gspca_dev-alt);
  return -EIO;
  @@ -904,7 +910,8 @@ static int gspca_init_transfer(struct gspca_dev 
  *gspca_dev)
  if (!gspca_dev-cam.no_urb_create) {
  PDEBUG(D_STREAM, init transfer alt %d, alt);
  ret = create_urbs(gspca_dev,
  -   alt_xfer(intf-altsetting[alt], xfer));
  +   alt_xfer(intf-altsetting[alt], xfer,
  +gspca_dev-xfer_ep_index));
  if (ret  0) {
  destroy_urbs(gspca_dev);
  goto out;
  @@ -2030,6 +2037,7 @@ int gspca_dev_probe2(struct usb_interface *intf,
  }
  gspca_dev-dev = dev;
  gspca_dev-iface = intf-cur_altsetting-desc.bInterfaceNumber;
  +   gspca_dev-xfer_ep_index = -1;
   
  /* check if any audio device */
  if (dev-actconfig-desc.bNumInterfaces != 1) {
  diff --git a/drivers/media/usb/gspca/gspca.h 
  b/drivers/media/usb/gspca/gspca.h
  index 300642d..92317af 100644
  --- a/drivers/media/usb/gspca/gspca.h
  +++ b/drivers/media/usb/gspca/gspca.h
  @@ -205,6 +205,7 @@ struct gspca_dev {
  char memory;/* memory type (V4L2_MEMORY_xxx) */
  

Re: [RFC PATCH 14/26] [media] Add i.MX SoC wide media device driver

2014-06-24 Thread Dave Müller
Hello again

Philipp Zabel p.za...@pengutronix.de writes:

 +struct media_device *ipu_find_media_device(void)
 +{
 + return ipu_media-mdev;
 +}
 +EXPORT_SYMBOL_GPL(ipu_find_media_device);

Where is ipu_find_media_device() being called?

 +int ipu_media_device_register(struct device *dev)
 +{

[snip]

 +
 + return 0;
 +}
 +EXPORT_SYMBOL_GPL(ipu_media_device_register);

Where is ipu_media_device_register() being called?


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


Re: [RFC 1/2] gspca: provide a mechanism to select a specific transfer endpoint

2014-06-24 Thread Hans de Goede
Hi,

On 06/24/2014 03:35 PM, Antonio Ospite wrote:
 On Thu, 19 Jun 2014 16:27:59 +0200
 Hans de Goede hdego...@redhat.com wrote:
 
 Hi Antonio,

 Thanks for working on this.

 On 06/04/2014 10:24 PM, Antonio Ospite wrote:
 Add a xfer_ep_index field to struct gspca_dev, and change alt_xfer() so
 that it accepts a parameter which represents a specific endpoint to look
 for.

 If a subdriver wants to specify a value for gspca_dev-xfer_ep_index it
 can do that in its sd_config() callback.

 Signed-off-by: Antonio Ospite a...@ao2.it
 ---

 I am not sure if it is OK to specify an endpoint _index_ or if it would be
 better to specify the endpoint address directly (in Kinect 0x81 is for video
 data and 0x82 is for depth data).

 Hans, any comment on that?

 I think it would be better to use the endpoint address directly for this,
 relying on the order in which the endpoints are listed in the descriptor
 feels wrong to me.

 
 I see.
 
 If I declare the new field as __u8 (same type of a bEndpointAddress), I
 could mark an invalid ep address with ~(USB_ENDPOINT_DIR_MASK | 
 USB_ENDPOINT_NUMBER_MASK) in gspca_dev_probe2(), instead of using an
 int set to -1; how does that sound?

I would prefer an int with a simple -1 value of invalid.

Regards,

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


[PATCH v2 08/29] [media] coda: add selection API support for h.264 decoder

2014-06-24 Thread Philipp Zabel
The h.264 decoder produces capture frames that are a multiple of the macroblock
size (16 pixels). To inform userspace about invalid pixel data at the edges,
use the active and padded composing rectangles on the capture queue.
The cropping information is obtained from the h.264 sequence parameter set.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v1:
 - Rewrote g_selection to only allow CROP target on OUTPUT and
   COMPOSE target on CAPTURE buffers.
---
 drivers/media/platform/coda.c | 94 +++
 1 file changed, 94 insertions(+)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index f00b2aa..965b0d9 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -119,6 +119,7 @@ struct coda_q_data {
unsigned intheight;
unsigned intsizeimage;
unsigned intfourcc;
+   struct v4l2_rectrect;
 };
 
 struct coda_aux_buf {
@@ -735,6 +736,10 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct 
v4l2_format *f)
q_data-width = f-fmt.pix.width;
q_data-height = f-fmt.pix.height;
q_data-sizeimage = f-fmt.pix.sizeimage;
+   q_data-rect.left = 0;
+   q_data-rect.top = 0;
+   q_data-rect.width = f-fmt.pix.width;
+   q_data-rect.height = f-fmt.pix.height;
 
v4l2_dbg(1, coda_debug, ctx-dev-v4l2_dev,
Setting format for type %d, wxh: %dx%d, fmt: %d\n,
@@ -871,6 +876,50 @@ static int coda_streamoff(struct file *file, void *priv,
return ret;
 }
 
+static int coda_g_selection(struct file *file, void *fh,
+   struct v4l2_selection *s)
+{
+   struct coda_ctx *ctx = fh_to_ctx(fh);
+   struct coda_q_data *q_data;
+   struct v4l2_rect r, *rsel;
+
+   q_data = get_q_data(ctx, s-type);
+   if (!q_data)
+   return -EINVAL;
+
+   r.left = 0;
+   r.top = 0;
+   r.width = q_data-width;
+   r.height = q_data-height;
+   rsel = q_data-rect;
+
+   switch (s-target) {
+   case V4L2_SEL_TGT_CROP_DEFAULT:
+   case V4L2_SEL_TGT_CROP_BOUNDS:
+   rsel = r;
+   /* fallthrough */
+   case V4L2_SEL_TGT_CROP:
+   if (s-type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
+   return -EINVAL;
+   break;
+   case V4L2_SEL_TGT_COMPOSE_BOUNDS:
+   case V4L2_SEL_TGT_COMPOSE_PADDED:
+   rsel = r;
+   /* fallthrough */
+   case V4L2_SEL_TGT_COMPOSE:
+   case V4L2_SEL_TGT_COMPOSE_DEFAULT:
+   if (s-type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
+   return -EINVAL;
+   break;
+   default:
+   return -EINVAL;
+   }
+
+   s-r = *rsel;
+
+   return 0;
+}
+
 static int coda_try_decoder_cmd(struct file *file, void *fh,
struct v4l2_decoder_cmd *dc)
 {
@@ -949,6 +998,8 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = {
.vidioc_streamon= coda_streamon,
.vidioc_streamoff   = coda_streamoff,
 
+   .vidioc_g_selection = coda_g_selection,
+
.vidioc_try_decoder_cmd = coda_try_decoder_cmd,
.vidioc_decoder_cmd = coda_decoder_cmd,
 
@@ -1504,6 +1555,10 @@ static void set_default_params(struct coda_ctx *ctx)
ctx-q_data[V4L2_M2M_DST].width = max_w;
ctx-q_data[V4L2_M2M_DST].height = max_h;
ctx-q_data[V4L2_M2M_DST].sizeimage = CODA_MAX_FRAME_SIZE;
+   ctx-q_data[V4L2_M2M_SRC].rect.width = max_w;
+   ctx-q_data[V4L2_M2M_SRC].rect.height = max_h;
+   ctx-q_data[V4L2_M2M_DST].rect.width = max_w;
+   ctx-q_data[V4L2_M2M_DST].rect.height = max_h;
 
if (ctx-dev-devtype-product == CODA_960)
coda_set_tiled_map_type(ctx, GDI_LINEAR_FRAME_MAP);
@@ -2031,6 +2086,21 @@ static int coda_start_decoding(struct coda_ctx *ctx)
return -EINVAL;
}
 
+   if (src_fourcc == V4L2_PIX_FMT_H264) {
+   u32 left_right;
+   u32 top_bottom;
+
+   left_right = coda_read(dev, CODA_RET_DEC_SEQ_CROP_LEFT_RIGHT);
+   top_bottom = coda_read(dev, CODA_RET_DEC_SEQ_CROP_TOP_BOTTOM);
+
+   q_data_dst-rect.left = (left_right  10)  0x3ff;
+   q_data_dst-rect.top = (top_bottom  10)  0x3ff;
+   q_data_dst-rect.width = width - q_data_dst-rect.left -
+(left_right  0x3ff);
+   q_data_dst-rect.height = height - q_data_dst-rect.top -
+ (top_bottom  0x3ff);
+   }
+
ret = coda_alloc_framebuffers(ctx, q_data_dst, src_fourcc);
if (ret  0)
return ret;
@@ -2937,6 +3007,30 @@ static void coda_finish_decode(struct coda_ctx *ctx)
 
q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
 
+   /* frame crop information */
+   if (src_fourcc == 

[PATCH v2 19/29] [media] coda: try to schedule a decode run after a stop command

2014-06-24 Thread Philipp Zabel
From: Michael Olbrich m.olbr...@pengutronix.de

In case no further buffers are queued after the stop command, restart
job scheduling explicitly.

Signed-off-by: Michael Olbrich m.olbr...@pengutronix.de
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index d531f0b..0f83166 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -909,6 +909,8 @@ static int coda_decoder_cmd(struct file *file, void *fh,
/* If this context is currently running, update the hardware 
flag */
coda_write(dev, ctx-bit_stream_param, 
CODA_REG_BIT_BIT_STREAM_PARAM);
}
+   ctx-prescan_failed = false;
+   v4l2_m2m_try_schedule(ctx-fh.m2m_ctx);
 
return 0;
 }
-- 
2.0.0

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


[PATCH v2 05/29] [media] coda: simplify IRAM setup

2014-06-24 Thread Philipp Zabel
OVL and BTP IRAM buffers are never used, setup the bits for
for DBK/BIT/IP usage depending on CODA version in one place.
Also, use a simple allocator function and group IRAM addresses
and size in a coda_aux_buf structure.
This is done in preparation for CODA960 support.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 175 ++
 1 file changed, 74 insertions(+), 101 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index e3dddcb..50051fe 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -135,9 +135,7 @@ struct coda_dev {
struct coda_aux_buf tempbuf;
struct coda_aux_buf workbuf;
struct gen_pool *iram_pool;
-   long unsigned int   iram_vaddr;
-   long unsigned int   iram_paddr;
-   unsigned long   iram_size;
+   struct coda_aux_buf iram;
 
spinlock_t  irqlock;
struct mutexdev_mutex;
@@ -175,6 +173,8 @@ struct coda_iram_info {
phys_addr_t buf_btp_use;
phys_addr_t search_ram_paddr;
int search_ram_size;
+   int remaining;
+   phys_addr_t next_paddr;
 };
 
 struct coda_ctx {
@@ -1580,23 +1580,43 @@ static int coda_h264_padding(int size, char *p)
return nal_size;
 }
 
+static phys_addr_t coda_iram_alloc(struct coda_iram_info *iram, size_t size)
+{
+   phys_addr_t ret;
+
+   size = round_up(size, 1024);
+   if (size  iram-remaining)
+   return 0;
+   iram-remaining -= size;
+
+   ret = iram-next_paddr;
+   iram-next_paddr += size;
+
+   return ret;
+}
+
 static void coda_setup_iram(struct coda_ctx *ctx)
 {
struct coda_iram_info *iram_info = ctx-iram_info;
struct coda_dev *dev = ctx-dev;
-   int ipacdc_size;
-   int bitram_size;
-   int dbk_size;
-   int ovl_size;
int mb_width;
-   int me_size;
-   int size;
+   int dbk_bits;
+   int bit_bits;
+   int ip_bits;
 
memset(iram_info, 0, sizeof(*iram_info));
-   size = dev-iram_size;
+   iram_info-next_paddr = dev-iram.paddr;
+   iram_info-remaining = dev-iram.size;
 
-   if (dev-devtype-product == CODA_DX6)
+   switch (dev-devtype-product) {
+   case CODA_7541:
+   dbk_bits = CODA7_USE_HOST_DBK_ENABLE | CODA7_USE_DBK_ENABLE;
+   bit_bits = CODA7_USE_HOST_BIT_ENABLE | CODA7_USE_BIT_ENABLE;
+   ip_bits = CODA7_USE_HOST_IP_ENABLE | CODA7_USE_IP_ENABLE;
+   break;
+   default: /* CODA_DX6 */
return;
+   }
 
if (ctx-inst_type == CODA_INST_ENCODER) {
struct coda_q_data *q_data_src;
@@ -1605,111 +1625,63 @@ static void coda_setup_iram(struct coda_ctx *ctx)
mb_width = DIV_ROUND_UP(q_data_src-width, 16);
 
/* Prioritize in case IRAM is too small for everything */
-   me_size = round_up(round_up(q_data_src-width, 16) * 36 + 2048,
-  1024);
-   iram_info-search_ram_size = me_size;
-   if (size = iram_info-search_ram_size) {
-   if (dev-devtype-product == CODA_7541)
-   iram_info-axi_sram_use |= 
CODA7_USE_HOST_ME_ENABLE;
-   iram_info-search_ram_paddr = dev-iram_paddr;
-   size -= iram_info-search_ram_size;
-   } else {
-   pr_err(IRAM is smaller than the search ram size\n);
-   goto out;
+   if (dev-devtype-product == CODA_7541) {
+   iram_info-search_ram_size = round_up(mb_width * 16 *
+ 36 + 2048, 1024);
+   iram_info-search_ram_paddr = coda_iram_alloc(iram_info,
+   
iram_info-search_ram_size);
+   if (!iram_info-search_ram_paddr) {
+   pr_err(IRAM is smaller than the search ram 
size\n);
+   goto out;
+   }
+   iram_info-axi_sram_use |= CODA7_USE_HOST_ME_ENABLE |
+  CODA7_USE_ME_ENABLE;
}
 
/* Only H.264BP and H.263P3 are considered */
-   dbk_size = round_up(128 * mb_width, 1024);
-   if (size = dbk_size) {
-   iram_info-axi_sram_use |= CODA7_USE_HOST_DBK_ENABLE;
-   iram_info-buf_dbk_y_use = dev-iram_paddr +
-  iram_info-search_ram_size;
-   iram_info-buf_dbk_c_use = iram_info-buf_dbk_y_use +
-  dbk_size / 2;
-   size -= 

[PATCH v2 12/29] [media] coda: Add runtime pm support

2014-06-24 Thread Philipp Zabel
This patch allows to use the runtime pm and generic pm domain frameworks
to completely gate power to the VPU if it is unused. This functionality
is available on i.MX6.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v1:
 - Use pm_runtime_enabled()
---
 drivers/media/platform/coda.c | 65 +++
 1 file changed, 60 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 0a0b1ed..bd243ed 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -22,6 +22,7 @@
 #include linux/module.h
 #include linux/of_device.h
 #include linux/platform_device.h
+#include linux/pm_runtime.h
 #include linux/slab.h
 #include linux/videodev2.h
 #include linux/of.h
@@ -2766,6 +2767,13 @@ static int coda_open(struct file *file)
ctx-reg_idx = idx;
}
 
+   /* Power up and upload firmware if necessary */
+   ret = pm_runtime_get_sync(dev-plat_dev-dev);
+   if (ret  0) {
+   v4l2_err(dev-v4l2_dev, failed to power up: %d\n, ret);
+   goto err_pm_get;
+   }
+
ret = clk_prepare_enable(dev-clk_per);
if (ret)
goto err_clk_per;
@@ -2835,6 +2843,8 @@ err_ctx_init:
 err_clk_ahb:
clk_disable_unprepare(dev-clk_per);
 err_clk_per:
+   pm_runtime_put_sync(dev-plat_dev-dev);
+err_pm_get:
v4l2_fh_del(ctx-fh);
v4l2_fh_exit(ctx-fh);
clear_bit(ctx-idx, dev-instance_mask);
@@ -2876,6 +2886,7 @@ static int coda_release(struct file *file)
v4l2_ctrl_handler_free(ctx-ctrls);
clk_disable_unprepare(dev-clk_ahb);
clk_disable_unprepare(dev-clk_per);
+   pm_runtime_put_sync(dev-plat_dev-dev);
v4l2_fh_del(ctx-fh);
v4l2_fh_exit(ctx-fh);
clear_bit(ctx-idx, dev-instance_mask);
@@ -3190,7 +3201,7 @@ static int coda_hw_init(struct coda_dev *dev)
 
ret = clk_prepare_enable(dev-clk_per);
if (ret)
-   return ret;
+   goto err_clk_per;
 
ret = clk_prepare_enable(dev-clk_ahb);
if (ret)
@@ -3316,6 +3327,7 @@ static int coda_hw_init(struct coda_dev *dev)
 
 err_clk_ahb:
clk_disable_unprepare(dev-clk_per);
+err_clk_per:
return ret;
 }
 
@@ -3341,10 +3353,29 @@ static void coda_fw_callback(const struct firmware *fw, 
void *context)
memcpy(dev-codebuf.vaddr, fw-data, fw-size);
release_firmware(fw);
 
-   ret = coda_hw_init(dev);
-   if (ret) {
-   v4l2_err(dev-v4l2_dev, HW initialization failed\n);
-   return;
+   if (pm_runtime_enabled(pdev-dev)  pdev-dev.pm_domain) {
+   /*
+* Enabling power temporarily will cause coda_hw_init to be
+* called via coda_runtime_resume by the pm domain.
+*/
+   ret = pm_runtime_get_sync(dev-plat_dev-dev);
+   if (ret  0) {
+   v4l2_err(dev-v4l2_dev, failed to power on: %d\n,
+ret);
+   return;
+   }
+
+   pm_runtime_put_sync(dev-plat_dev-dev);
+   } else {
+   /*
+* If runtime pm is disabled or pm_domain is not set,
+* initialize once manually.
+*/
+   ret = coda_hw_init(dev);
+   if (ret  0) {
+   v4l2_err(dev-v4l2_dev, HW initialization failed\n);
+   return;
+   }
}
 
dev-vfd.fops   = coda_fops,
@@ -3582,6 +3613,8 @@ static int coda_probe(struct platform_device *pdev)
 
platform_set_drvdata(pdev, dev);
 
+   pm_runtime_enable(pdev-dev);
+
return coda_firmware_request(dev);
 }
 
@@ -3592,6 +3625,7 @@ static int coda_remove(struct platform_device *pdev)
video_unregister_device(dev-vfd);
if (dev-m2m_dev)
v4l2_m2m_release(dev-m2m_dev);
+   pm_runtime_disable(pdev-dev);
if (dev-alloc_ctx)
vb2_dma_contig_cleanup_ctx(dev-alloc_ctx);
v4l2_device_unregister(dev-v4l2_dev);
@@ -3605,6 +3639,26 @@ static int coda_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_RUNTIME
+static int coda_runtime_resume(struct device *dev)
+{
+   struct coda_dev *cdev = dev_get_drvdata(dev);
+   int ret = 0;
+
+   if (dev-pm_domain) {
+   ret = coda_hw_init(cdev);
+   if (ret)
+   v4l2_err(cdev-v4l2_dev, HW initialization failed\n);
+   }
+
+   return ret;
+}
+#endif
+
+static const struct dev_pm_ops coda_pm_ops = {
+   SET_RUNTIME_PM_OPS(NULL, coda_runtime_resume, NULL)
+};
+
 static struct platform_driver coda_driver = {
.probe  = coda_probe,
.remove = coda_remove,
@@ -3612,6 +3666,7 @@ static struct platform_driver coda_driver = {
.name   = CODA_NAME,
.owner  = 

[PATCH v2 01/29] [media] coda: fix decoder I/P/B frame detection

2014-06-24 Thread Philipp Zabel
Currently the rotator unit is used to copy decoded frames out into buffers
provided by videobuf2. Since the CODA reports the I/P/B frame type of the
last decoded frame, and this frame will be copied out in a later device_run,
depending on display order, we have to store the frame type until such time.
This patch also adds the B-frame type.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
Changes since v1:
 - Also clear V4L2_BUF_FLAG_BFRAME
---
 drivers/media/platform/coda.c | 23 ++-
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index b178379..a7c5ac5 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -209,6 +209,7 @@ struct coda_ctx {
struct coda_aux_buf psbuf;
struct coda_aux_buf slicebuf;
struct coda_aux_buf internal_frames[CODA_MAX_FRAMEBUFFERS];
+   u32 frame_types[CODA_MAX_FRAMEBUFFERS];
struct coda_aux_buf workbuf;
int num_internal_frames;
int idx;
@@ -2693,15 +2694,6 @@ static void coda_finish_decode(struct coda_ctx *ctx)
 
q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
 
-   val = coda_read(dev, CODA_RET_DEC_PIC_TYPE);
-   if ((val  0x7) == 0) {
-   dst_buf-v4l2_buf.flags |= V4L2_BUF_FLAG_KEYFRAME;
-   dst_buf-v4l2_buf.flags = ~V4L2_BUF_FLAG_PFRAME;
-   } else {
-   dst_buf-v4l2_buf.flags |= V4L2_BUF_FLAG_PFRAME;
-   dst_buf-v4l2_buf.flags = ~V4L2_BUF_FLAG_KEYFRAME;
-   }
-
val = coda_read(dev, CODA_RET_DEC_PIC_ERR_MB);
if (val  0)
v4l2_err(dev-v4l2_dev,
@@ -2748,6 +2740,14 @@ static void coda_finish_decode(struct coda_ctx *ctx)
} else if (decoded_idx  0 || decoded_idx = ctx-num_internal_frames) {
v4l2_err(dev-v4l2_dev,
 decoded frame index out of range: %d\n, decoded_idx);
+   } else {
+   val = coda_read(dev, CODA_RET_DEC_PIC_TYPE)  0x7;
+   if (val == 0)
+   ctx-frame_types[decoded_idx] = V4L2_BUF_FLAG_KEYFRAME;
+   else if (val == 1)
+   ctx-frame_types[decoded_idx] = V4L2_BUF_FLAG_PFRAME;
+   else
+   ctx-frame_types[decoded_idx] = V4L2_BUF_FLAG_BFRAME;
}
 
if (display_idx == -1) {
@@ -2770,6 +2770,11 @@ static void coda_finish_decode(struct coda_ctx *ctx)
dst_buf = v4l2_m2m_dst_buf_remove(ctx-m2m_ctx);
dst_buf-v4l2_buf.sequence = ctx-osequence++;
 
+   dst_buf-v4l2_buf.flags = ~(V4L2_BUF_FLAG_KEYFRAME |
+V4L2_BUF_FLAG_PFRAME |
+V4L2_BUF_FLAG_BFRAME);
+   dst_buf-v4l2_buf.flags |= ctx-frame_types[ctx-display_idx];
+
vb2_set_plane_payload(dst_buf, 0, width * height * 3 / 2);
 
v4l2_m2m_buf_done(dst_buf, success ? VB2_BUF_STATE_DONE :
-- 
2.0.0

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


[PATCH v2 26/29] [media] coda: allow odd width, but still round up bytesperline

2014-06-24 Thread Philipp Zabel
Even though the CODA h.264 decoder always decodes complete macroblocks, we can
set the stride to the corresponding multiple of 16 and use a value smaller than
that as real width. Unfortunately the same doesn't work for height, as there
is no vertical linesperframe stride for discontiguous planar YUV frames.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 5c00d6e..cc41ab3 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -740,9 +740,9 @@ static int coda_try_fmt_vid_cap(struct file *file, void 
*priv,
 
/* The h.264 decoder only returns complete 16x16 macroblocks */
if (codec  codec-src_fourcc == V4L2_PIX_FMT_H264) {
-   f-fmt.pix.width = round_up(f-fmt.pix.width, 16);
+   f-fmt.pix.width = f-fmt.pix.width;
f-fmt.pix.height = round_up(f-fmt.pix.height, 16);
-   f-fmt.pix.bytesperline = f-fmt.pix.width;
+   f-fmt.pix.bytesperline = round_up(f-fmt.pix.width, 16);
f-fmt.pix.sizeimage = f-fmt.pix.bytesperline *
   f-fmt.pix.height * 3 / 2;
}
-- 
2.0.0

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


[PATCH v2 25/29] [media] coda: add bytesperline to queue data

2014-06-24 Thread Philipp Zabel
bytesperline is calculated in multiple places, store it in the coda_q_data
structure. This will be more useful later when adding JPEG support.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 27 ---
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 061c3a2..5c00d6e 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -119,6 +119,7 @@ struct coda_devtype {
 struct coda_q_data {
unsigned intwidth;
unsigned intheight;
+   unsigned intbytesperline;
unsigned intsizeimage;
unsigned intfourcc;
struct v4l2_rectrect;
@@ -636,10 +637,7 @@ static int coda_g_fmt(struct file *file, void *priv,
f-fmt.pix.pixelformat  = q_data-fourcc;
f-fmt.pix.width= q_data-width;
f-fmt.pix.height   = q_data-height;
-   if (coda_format_is_yuv(f-fmt.pix.pixelformat))
-   f-fmt.pix.bytesperline = round_up(f-fmt.pix.width, 2);
-   else /* encoded formats h.264/mpeg4 */
-   f-fmt.pix.bytesperline = 0;
+   f-fmt.pix.bytesperline = q_data-bytesperline;
 
f-fmt.pix.sizeimage= q_data-sizeimage;
f-fmt.pix.colorspace   = ctx-colorspace;
@@ -789,6 +787,7 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct 
v4l2_format *f)
q_data-fourcc = f-fmt.pix.pixelformat;
q_data-width = f-fmt.pix.width;
q_data-height = f-fmt.pix.height;
+   q_data-bytesperline = f-fmt.pix.bytesperline;
q_data-sizeimage = f-fmt.pix.sizeimage;
q_data-rect.left = 0;
q_data-rect.top = 0;
@@ -1349,14 +1348,16 @@ static void coda_prepare_encode(struct coda_ctx *ctx)
switch (q_data_src-fourcc) {
case V4L2_PIX_FMT_YVU420:
/* Switch Cb and Cr for YVU420 format */
-   picture_cr = picture_y + q_data_src-width * q_data_src-height;
-   picture_cb = picture_cr + q_data_src-width / 2 *
+   picture_cr = picture_y + q_data_src-bytesperline *
+   q_data_src-height;
+   picture_cb = picture_cr + q_data_src-bytesperline / 2 *
q_data_src-height / 2;
break;
case V4L2_PIX_FMT_YUV420:
default:
-   picture_cb = picture_y + q_data_src-width * q_data_src-height;
-   picture_cr = picture_cb + q_data_src-width / 2 *
+   picture_cb = picture_y + q_data_src-bytesperline *
+   q_data_src-height;
+   picture_cr = picture_cb + q_data_src-bytesperline / 2 *
q_data_src-height / 2;
break;
}
@@ -1598,9 +1599,11 @@ static void set_default_params(struct coda_ctx *ctx)
ctx-q_data[V4L2_M2M_DST].fourcc = ctx-codec-dst_fourcc;
ctx-q_data[V4L2_M2M_SRC].width = max_w;
ctx-q_data[V4L2_M2M_SRC].height = max_h;
+   ctx-q_data[V4L2_M2M_SRC].bytesperline = max_w;
ctx-q_data[V4L2_M2M_SRC].sizeimage = (max_w * max_h * 3) / 2;
ctx-q_data[V4L2_M2M_DST].width = max_w;
ctx-q_data[V4L2_M2M_DST].height = max_h;
+   ctx-q_data[V4L2_M2M_DST].bytesperline = 0;
ctx-q_data[V4L2_M2M_DST].sizeimage = CODA_MAX_FRAME_SIZE;
ctx-q_data[V4L2_M2M_SRC].rect.width = max_w;
ctx-q_data[V4L2_M2M_SRC].rect.height = max_h;
@@ -2533,10 +2536,12 @@ static int coda_start_encoding(struct coda_ctx *ctx)
}
 
coda_write(dev, ctx-num_internal_frames, CODA_CMD_SET_FRAME_BUF_NUM);
-   coda_write(dev, round_up(q_data_src-width, 8), 
CODA_CMD_SET_FRAME_BUF_STRIDE);
-   if (dev-devtype-product == CODA_7541)
-   coda_write(dev, round_up(q_data_src-width, 8),
+   coda_write(dev, q_data_src-bytesperline,
+   CODA_CMD_SET_FRAME_BUF_STRIDE);
+   if (dev-devtype-product == CODA_7541) {
+   coda_write(dev, q_data_src-bytesperline,
CODA7_CMD_SET_FRAME_SOURCE_BUF_STRIDE);
+   }
if (dev-devtype-product != CODA_DX6) {
coda_write(dev, ctx-iram_info.buf_bit_use,
CODA7_CMD_SET_FRAME_AXI_BIT_ADDR);
-- 
2.0.0

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


[PATCH v2 27/29] [media] coda: round up internal frames to multiples of macroblock size for h.264

2014-06-24 Thread Philipp Zabel
CODA7541 only supports encoding h.264 frames with width and height that are
multiples of the macroblock size.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index cc41ab3..9796bfd 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1746,15 +1746,21 @@ static void coda_free_framebuffers(struct coda_ctx *ctx)
 static int coda_alloc_framebuffers(struct coda_ctx *ctx, struct coda_q_data 
*q_data, u32 fourcc)
 {
struct coda_dev *dev = ctx-dev;
-   int height = q_data-height;
+   int width, height;
dma_addr_t paddr;
int ysize;
int ret;
int i;
 
-   if (ctx-codec  ctx-codec-src_fourcc == V4L2_PIX_FMT_H264)
-   height = round_up(height, 16);
-   ysize = round_up(q_data-width, 8) * height;
+   if (ctx-codec  (ctx-codec-src_fourcc == V4L2_PIX_FMT_H264 ||
+ctx-codec-dst_fourcc == V4L2_PIX_FMT_H264)) {
+   width = round_up(q_data-width, 16);
+   height = round_up(q_data-height, 16);
+   } else {
+   width = round_up(q_data-width, 8);
+   height = q_data-height;
+   }
+   ysize = width * height;
 
/* Allocate frame buffers */
for (i = 0; i  ctx-num_internal_frames; i++) {
@@ -2377,7 +2383,16 @@ static int coda_start_encoding(struct coda_ctx *ctx)
value = (q_data_src-width  CODADX6_PICWIDTH_MASK)  
CODADX6_PICWIDTH_OFFSET;
value |= (q_data_src-height  CODADX6_PICHEIGHT_MASK)  
CODA_PICHEIGHT_OFFSET;
break;
-   default:
+   case CODA_7541:
+   if (dst_fourcc == V4L2_PIX_FMT_H264) {
+   value = (round_up(q_data_src-width, 16) 
+CODA7_PICWIDTH_MASK)  CODA7_PICWIDTH_OFFSET;
+   value |= (round_up(q_data_src-height, 16) 
+ CODA7_PICHEIGHT_MASK)  
CODA_PICHEIGHT_OFFSET;
+   break;
+   }
+   /* fallthrough */
+   case CODA_960:
value = (q_data_src-width  CODA7_PICWIDTH_MASK)  
CODA7_PICWIDTH_OFFSET;
value |= (q_data_src-height  CODA7_PICHEIGHT_MASK)  
CODA_PICHEIGHT_OFFSET;
}
-- 
2.0.0

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


[PATCH v2 07/29] [media] coda: remove BUG() in get_q_data

2014-06-24 Thread Philipp Zabel
This allows us to get rid of the now superfluous v4l2_m2m_get_vq check
in G_FMT. Also, we can use this to check the buffer type in G_SELECTION
later.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 2da7e29..f00b2aa 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -326,9 +326,8 @@ static struct coda_q_data *get_q_data(struct coda_ctx *ctx,
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
return (ctx-q_data[V4L2_M2M_DST]);
default:
-   BUG();
+   return NULL;
}
-   return NULL;
 }
 
 /*
@@ -571,15 +570,12 @@ static int coda_enum_fmt_vid_out(struct file *file, void 
*priv,
 static int coda_g_fmt(struct file *file, void *priv,
  struct v4l2_format *f)
 {
-   struct vb2_queue *vq;
struct coda_q_data *q_data;
struct coda_ctx *ctx = fh_to_ctx(priv);
 
-   vq = v4l2_m2m_get_vq(ctx-m2m_ctx, f-type);
-   if (!vq)
-   return -EINVAL;
-
q_data = get_q_data(ctx, f-type);
+   if (!q_data)
+   return -EINVAL;
 
f-fmt.pix.field= V4L2_FIELD_NONE;
f-fmt.pix.pixelformat  = q_data-fourcc;
@@ -628,6 +624,8 @@ static int coda_try_fmt(struct coda_ctx *ctx, struct 
coda_codec *codec,
break;
default:
q_data = get_q_data(ctx, f-type);
+   if (!q_data)
+   return -EINVAL;
f-fmt.pix.pixelformat = q_data-fourcc;
}
 
-- 
2.0.0

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


[PATCH v2 22/29] [media] coda: add sequence counter offset

2014-06-24 Thread Philipp Zabel
The coda h.264 decoder also counts PIC_RUNs where no frame was decoded but
a frame was rotated out / marked as ready to be displayed. This causes an
offset between the incoming encoded frame's sequence number and the decode
sequence number returned by the coda. This patch introduces a sequence
counter offset variable to keep track of the difference.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 6e65ab9..4548c84 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -222,6 +222,7 @@ struct coda_ctx {
u32 isequence;
u32 qsequence;
u32 osequence;
+   u32 sequence_offset;
struct coda_q_data  q_data[2];
enum coda_inst_type inst_type;
struct coda_codec   *codec;
@@ -2620,6 +2621,7 @@ static void coda_stop_streaming(struct vb2_queue *q)
ctx-streamon_cap = 0;
 
ctx-osequence = 0;
+   ctx-sequence_offset = 0;
}
 
if (!ctx-streamon_out  !ctx-streamon_cap) {
@@ -3125,7 +3127,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
 
if (decoded_idx == -1) {
/* no frame was decoded, but we might have a display frame */
-   if (display_idx  0  ctx-display_idx  0)
+   if (display_idx = 0  display_idx  ctx-num_internal_frames)
+   ctx-sequence_offset++;
+   else if (ctx-display_idx  0)
ctx-prescan_failed = true;
} else if (decoded_idx == -2) {
/* no frame was decoded, we still return the remaining buffers 
*/
@@ -3137,10 +3141,11 @@ static void coda_finish_decode(struct coda_ctx *ctx)
  struct coda_timestamp, list);
list_del(ts-list);
val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
+   val -= ctx-sequence_offset;
if (val != ts-sequence) {
v4l2_err(dev-v4l2_dev,
-sequence number mismatch (%d != %d)\n,
-val, ts-sequence);
+sequence number mismatch (%d(%d) != %d)\n,
+val, ctx-sequence_offset, ts-sequence);
}
ctx-frame_timestamps[decoded_idx] = *ts;
kfree(ts);
-- 
2.0.0

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


[PATCH v2 04/29] [media] coda: fix internal framebuffer allocation size

2014-06-24 Thread Philipp Zabel
This error was introduced by 5677e3b04d3b3961200aa2bb9cc715e709eafeb9
[media] coda: update CODA7541 to firmware 1.4.50.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 10e1d98..e3dddcb 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1527,10 +1527,10 @@ static int coda_alloc_framebuffers(struct coda_ctx 
*ctx, struct coda_q_data *q_d
for (i = 0; i  ctx-num_internal_frames; i++) {
size_t size;
 
-   size = q_data-sizeimage;
+   size = ysize + ysize / 2;
if (ctx-codec-src_fourcc == V4L2_PIX_FMT_H264 
dev-devtype-product != CODA_DX6)
-   ctx-internal_frames[i].size += ysize/4;
+   size += ysize / 4;
ret = coda_alloc_context_buf(ctx, ctx-internal_frames[i], 
size);
if (ret  0) {
coda_free_framebuffers(ctx);
-- 
2.0.0

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


[PATCH v2 20/29] [media] coda: add decoder timestamp queue

2014-06-24 Thread Philipp Zabel
The coda driver advertises timestamp_type V4L2_BUF_FLAG_TIMESTAMP_COPY on
both queues, so we have to copy timestamps from input v4l2 buffers to the
corresponding destination v4l2 buffers. Since the h.264 decoder can reorder
frames, a timestamp queue is needed to keep track of and assign the correct
timestamp to destination buffers.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 50 ++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 0f83166..a929bbd 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -201,6 +201,13 @@ struct gdi_tiled_map {
 #define GDI_LINEAR_FRAME_MAP 0
 };
 
+struct coda_timestamp {
+   struct list_headlist;
+   u32 sequence;
+   struct v4l2_timecodetimecode;
+   struct timeval  timestamp;
+};
+
 struct coda_ctx {
struct coda_dev *dev;
struct mutexbuffer_mutex;
@@ -235,6 +242,8 @@ struct coda_ctx {
struct coda_aux_buf slicebuf;
struct coda_aux_buf internal_frames[CODA_MAX_FRAMEBUFFERS];
u32 frame_types[CODA_MAX_FRAMEBUFFERS];
+   struct coda_timestamp   frame_timestamps[CODA_MAX_FRAMEBUFFERS];
+   struct list_headtimestamp_list;
struct coda_aux_buf workbuf;
int num_internal_frames;
int idx;
@@ -1013,7 +1022,7 @@ static int coda_bitstream_queue(struct coda_ctx *ctx, 
struct vb2_buffer *src_buf
dma_sync_single_for_device(ctx-dev-plat_dev-dev, 
ctx-bitstream.paddr,
   ctx-bitstream.size, DMA_TO_DEVICE);
 
-   ctx-qsequence++;
+   src_buf-v4l2_buf.sequence = ctx-qsequence++;
 
return 0;
 }
@@ -1049,12 +1058,26 @@ static bool coda_bitstream_try_queue(struct coda_ctx 
*ctx,
 static void coda_fill_bitstream(struct coda_ctx *ctx)
 {
struct vb2_buffer *src_buf;
+   struct coda_timestamp *ts;
 
while (v4l2_m2m_num_src_bufs_ready(ctx-fh.m2m_ctx)  0) {
src_buf = v4l2_m2m_next_src_buf(ctx-fh.m2m_ctx);
 
if (coda_bitstream_try_queue(ctx, src_buf)) {
+   /*
+* Source buffer is queued in the bitstream ringbuffer;
+* queue the timestamp and mark source buffer as done
+*/
src_buf = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx);
+
+   ts = kmalloc(sizeof(*ts), GFP_KERNEL);
+   if (ts) {
+   ts-sequence = src_buf-v4l2_buf.sequence;
+   ts-timecode = src_buf-v4l2_buf.timecode;
+   ts-timestamp = src_buf-v4l2_buf.timestamp;
+   list_add_tail(ts-list, ctx-timestamp_list);
+   }
+
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
} else {
break;
@@ -2599,6 +2622,14 @@ static void coda_stop_streaming(struct vb2_queue *q)
}
 
if (!ctx-streamon_out  !ctx-streamon_cap) {
+   struct coda_timestamp *ts;
+
+   while (!list_empty(ctx-timestamp_list)) {
+   ts = list_first_entry(ctx-timestamp_list,
+ struct coda_timestamp, list);
+   list_del(ts-list);
+   kfree(ts);
+   }
kfifo_init(ctx-bitstream_fifo,
ctx-bitstream.vaddr, ctx-bitstream.size);
ctx-runcounter = 0;
@@ -2886,6 +2917,7 @@ static int coda_open(struct file *file)
ctx-bitstream.vaddr, ctx-bitstream.size);
mutex_init(ctx-bitstream_mutex);
mutex_init(ctx-buffer_mutex);
+   INIT_LIST_HEAD(ctx-timestamp_list);
 
coda_lock(ctx);
list_add(ctx-list, dev-instances);
@@ -2977,6 +3009,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
struct coda_q_data *q_data_src;
struct coda_q_data *q_data_dst;
struct vb2_buffer *dst_buf;
+   struct coda_timestamp *ts;
int width, height;
int decoded_idx;
int display_idx;
@@ -3098,6 +3131,18 @@ static void coda_finish_decode(struct coda_ctx *ctx)
v4l2_err(dev-v4l2_dev,
 decoded frame index out of range: %d\n, decoded_idx);
} else {
+   ts = list_first_entry(ctx-timestamp_list,
+ struct coda_timestamp, list);
+   list_del(ts-list);
+   val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
+   if (val != ts-sequence) {
+   

[PATCH v2 03/29] [media] coda: fix h.264 quantization parameter range

2014-06-24 Thread Philipp Zabel
If bitrate is not set, the encoder is running in VBR mode, with the
I- and P-frame quantization parameters configured from userspace.
For the quantization parameters, 0 is a valid value.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 1770fc2..10e1d98 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -2385,9 +2385,9 @@ static int coda_ctrls_setup(struct coda_ctx *ctx)
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
V4L2_CID_MPEG_VIDEO_GOP_SIZE, 1, 60, 1, 16);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
-   V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP, 1, 51, 1, 25);
+   V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP, 0, 51, 1, 25);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
-   V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP, 1, 51, 1, 25);
+   V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP, 0, 51, 1, 25);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP, 1, 31, 1, 2);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
-- 
2.0.0

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


[PATCH v2 23/29] [media] coda: use prescan_failed variable to stop stream after a timeout

2014-06-24 Thread Philipp Zabel
This variable should be renamed to hold instead (temporarily stopping streaming
until new data is fed into the bitstream buffer).

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 4548c84..cded081 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1423,6 +1423,8 @@ static void coda_pic_run_work(struct work_struct *work)
 
if (!wait_for_completion_timeout(ctx-completion, 
msecs_to_jiffies(1000))) {
dev_err(dev-plat_dev-dev, CODA PIC_RUN timeout\n);
+
+   ctx-prescan_failed = true;
} else if (!ctx-aborting) {
if (ctx-inst_type == CODA_INST_DECODER)
coda_finish_decode(ctx);
-- 
2.0.0

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


[PATCH v2 29/29] [media] coda: export auxiliary buffers via debugfs

2014-06-24 Thread Philipp Zabel
This patch exports all auxiliary buffers, including SRAM, as debugfs binary
blobs for debugging purposes. It shows, for example, that psbuf currently
doesn't seem to be used at all on CODA7541, and that slicebuf and workbuf
usage is far from the maximum. It can also be used to validate SRAM size
allocation.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 64 +++
 1 file changed, 53 insertions(+), 11 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index ec2b183..8978489 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -12,6 +12,7 @@
  */
 
 #include linux/clk.h
+#include linux/debugfs.h
 #include linux/delay.h
 #include linux/firmware.h
 #include linux/genalloc.h
@@ -129,6 +130,8 @@ struct coda_aux_buf {
void*vaddr;
dma_addr_t  paddr;
u32 size;
+   struct debugfs_blob_wrapper blob;
+   struct dentry   *dentry;
 };
 
 struct coda_dev {
@@ -156,6 +159,7 @@ struct coda_dev {
struct vb2_alloc_ctx*alloc_ctx;
struct list_headinstances;
unsigned long   instance_mask;
+   struct dentry   *debugfs_root;
 };
 
 struct coda_params {
@@ -259,6 +263,7 @@ struct coda_ctx {
u32 frm_dis_flg;
u32 frame_mem_ctrl;
int display_idx;
+   struct dentry   *debugfs_entry;
 };
 
 static const u8 coda_filler_nal[14] = { 0x00, 0x00, 0x00, 0x01, 0x0c, 0xff,
@@ -1706,7 +1711,8 @@ static void coda_parabuf_write(struct coda_ctx *ctx, int 
index, u32 value)
 }
 
 static int coda_alloc_aux_buf(struct coda_dev *dev,
- struct coda_aux_buf *buf, size_t size)
+ struct coda_aux_buf *buf, size_t size,
+ const char *name, struct dentry *parent)
 {
buf-vaddr = dma_alloc_coherent(dev-plat_dev-dev, size, buf-paddr,
GFP_KERNEL);
@@ -1715,13 +1721,23 @@ static int coda_alloc_aux_buf(struct coda_dev *dev,
 
buf-size = size;
 
+   if (name  parent) {
+   buf-blob.data = buf-vaddr;
+   buf-blob.size = size;
+   buf-dentry = debugfs_create_blob(name, 0644, parent, 
buf-blob);
+   if (!buf-dentry)
+   dev_warn(dev-plat_dev-dev,
+failed to create debugfs entry %s\n, name);
+   }
+
return 0;
 }
 
 static inline int coda_alloc_context_buf(struct coda_ctx *ctx,
-struct coda_aux_buf *buf, size_t size)
+struct coda_aux_buf *buf, size_t size,
+const char *name)
 {
-   return coda_alloc_aux_buf(ctx-dev, buf, size);
+   return coda_alloc_aux_buf(ctx-dev, buf, size, name, 
ctx-debugfs_entry);
 }
 
 static void coda_free_aux_buf(struct coda_dev *dev,
@@ -1733,6 +1749,7 @@ static void coda_free_aux_buf(struct coda_dev *dev,
buf-vaddr = NULL;
buf-size = 0;
}
+   debugfs_remove(buf-dentry);
 }
 
 static void coda_free_framebuffers(struct coda_ctx *ctx)
@@ -1765,12 +1782,16 @@ static int coda_alloc_framebuffers(struct coda_ctx 
*ctx, struct coda_q_data *q_d
/* Allocate frame buffers */
for (i = 0; i  ctx-num_internal_frames; i++) {
size_t size;
+   char *name;
 
size = ysize + ysize / 2;
if (ctx-codec-src_fourcc == V4L2_PIX_FMT_H264 
dev-devtype-product != CODA_DX6)
size += ysize / 4;
-   ret = coda_alloc_context_buf(ctx, ctx-internal_frames[i], 
size);
+   name = kasprintf(GFP_KERNEL, fb%d, i);
+   ret = coda_alloc_context_buf(ctx, ctx-internal_frames[i],
+size, name);
+   kfree(name);
if (ret  0) {
coda_free_framebuffers(ctx);
return ret;
@@ -1994,7 +2015,7 @@ static int coda_alloc_context_buffers(struct coda_ctx 
*ctx,
/* worst case slice size */
size = (DIV_ROUND_UP(q_data-width, 16) *
DIV_ROUND_UP(q_data-height, 16)) * 3200 / 8 + 512;
-   ret = coda_alloc_context_buf(ctx, ctx-slicebuf, size);
+   ret = coda_alloc_context_buf(ctx, ctx-slicebuf, size, 
slicebuf);
if (ret  0) {
v4l2_err(dev-v4l2_dev, failed to allocate %d byte 
slice buffer,
 ctx-slicebuf.size);
@@ -2003,14 +2024,14 @@ static int coda_alloc_context_buffers(struct coda_ctx 
*ctx,
}
 
if (dev-devtype-product == CODA_7541) {
-  

[PATCH v2 28/29] [media] coda: increase frame stride to 16 for h.264

2014-06-24 Thread Philipp Zabel
When encoding into h.264, the input frame stride needs to be a multiple of 16.
During allocation of the input buffers, it may not be known yet whether the
encoder should create h.264 or not. Assume the worst and always use a frame
stride that is a multiple of 16.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 9796bfd..ec2b183 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -685,8 +685,8 @@ static int coda_try_fmt(struct coda_ctx *ctx, struct 
coda_codec *codec,
switch (f-fmt.pix.pixelformat) {
case V4L2_PIX_FMT_YUV420:
case V4L2_PIX_FMT_YVU420:
-   /* Frame stride must be multiple of 8 */
-   f-fmt.pix.bytesperline = round_up(f-fmt.pix.width, 8);
+   /* Frame stride must be multiple of 8, but 16 for h.264 */
+   f-fmt.pix.bytesperline = round_up(f-fmt.pix.width, 16);
f-fmt.pix.sizeimage = f-fmt.pix.bytesperline *
f-fmt.pix.height * 3 / 2;
break;
-- 
2.0.0

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


[PATCH v2 21/29] [media] coda: alert userspace about macroblock errors

2014-06-24 Thread Philipp Zabel
If the CODA reports macroblock errors, also set the VB2_BUF_STATE_ERROR flag
to alert userspace.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 14 +-
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index a929bbd..6e65ab9 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -243,6 +243,7 @@ struct coda_ctx {
struct coda_aux_buf internal_frames[CODA_MAX_FRAMEBUFFERS];
u32 frame_types[CODA_MAX_FRAMEBUFFERS];
struct coda_timestamp   frame_timestamps[CODA_MAX_FRAMEBUFFERS];
+   u32 frame_errors[CODA_MAX_FRAMEBUFFERS];
struct list_headtimestamp_list;
struct coda_aux_buf workbuf;
int num_internal_frames;
@@ -3015,6 +3016,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
int display_idx;
u32 src_fourcc;
int success;
+   u32 err_mb;
u32 val;
 
dst_buf = v4l2_m2m_next_dst_buf(ctx-fh.m2m_ctx);
@@ -3084,10 +3086,10 @@ static void coda_finish_decode(struct coda_ctx *ctx)
/* no cropping */
}
 
-   val = coda_read(dev, CODA_RET_DEC_PIC_ERR_MB);
-   if (val  0)
+   err_mb = coda_read(dev, CODA_RET_DEC_PIC_ERR_MB);
+   if (err_mb  0)
v4l2_err(dev-v4l2_dev,
-errors in %d macroblocks\n, val);
+errors in %d macroblocks\n, err_mb);
 
if (dev-devtype-product == CODA_7541) {
val = coda_read(dev, CODA_RET_DEC_PIC_OPTION);
@@ -3150,6 +3152,8 @@ static void coda_finish_decode(struct coda_ctx *ctx)
ctx-frame_types[decoded_idx] = V4L2_BUF_FLAG_PFRAME;
else
ctx-frame_types[decoded_idx] = V4L2_BUF_FLAG_BFRAME;
+
+   ctx-frame_errors[decoded_idx] = err_mb;
}
 
if (display_idx == -1) {
@@ -3182,8 +3186,8 @@ static void coda_finish_decode(struct coda_ctx *ctx)
 
vb2_set_plane_payload(dst_buf, 0, width * height * 3 / 2);
 
-   v4l2_m2m_buf_done(dst_buf, success ? VB2_BUF_STATE_DONE :
-VB2_BUF_STATE_ERROR);
+   v4l2_m2m_buf_done(dst_buf, ctx-frame_errors[display_idx] ?
+ VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
 
v4l2_dbg(1, coda_debug, dev-v4l2_dev,
job finished: decoding frame (%d) (%s)\n,
-- 
2.0.0

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


[PATCH v2 24/29] [media] coda: add reset control support

2014-06-24 Thread Philipp Zabel
On i.MX53 and i.MX6, the CODA VPU can be reset by the System Reset Controller.
We can use this to get out of dire situations, for example after a PIC_RUN
timeout.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 51 +++
 1 file changed, 51 insertions(+)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index cded081..061c3a2 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -27,6 +27,7 @@
 #include linux/videodev2.h
 #include linux/of.h
 #include linux/platform_data/coda.h
+#include linux/reset.h
 
 #include media/v4l2-ctrls.h
 #include media/v4l2-device.h
@@ -138,6 +139,7 @@ struct coda_dev {
void __iomem*regs_base;
struct clk  *clk_per;
struct clk  *clk_ahb;
+   struct reset_control*rstc;
 
struct coda_aux_buf codebuf;
struct coda_aux_buf tempbuf;
@@ -337,6 +339,39 @@ static int coda_command_sync(struct coda_ctx *ctx, int cmd)
return coda_wait_timeout(dev);
 }
 
+static int coda_hw_reset(struct coda_ctx *ctx)
+{
+   struct coda_dev *dev = ctx-dev;
+   unsigned long timeout;
+   unsigned int idx;
+   int ret;
+
+   if (!dev-rstc)
+   return -ENOENT;
+
+   idx = coda_read(dev, CODA_REG_BIT_RUN_INDEX);
+
+   timeout = jiffies + msecs_to_jiffies(100);
+   coda_write(dev, 0x11, CODA9_GDI_BUS_CTRL);
+   while (coda_read(dev, CODA9_GDI_BUS_STATUS) != 0x77) {
+   if (time_after(jiffies, timeout))
+   return -ETIME;
+   cpu_relax();
+   }
+
+   ret = reset_control_reset(dev-rstc);
+   if (ret  0)
+   return ret;
+
+   coda_write(dev, 0x00, CODA9_GDI_BUS_CTRL);
+   coda_write(dev, CODA_REG_BIT_BUSY_FLAG, CODA_REG_BIT_BUSY);
+   coda_write(dev, CODA_REG_RUN_ENABLE, CODA_REG_BIT_CODE_RUN);
+   ret = coda_wait_timeout(dev);
+   coda_write(dev, idx, CODA_REG_BIT_RUN_INDEX);
+
+   return ret;
+}
+
 static struct coda_q_data *get_q_data(struct coda_ctx *ctx,
 enum v4l2_buf_type type)
 {
@@ -1425,6 +1460,8 @@ static void coda_pic_run_work(struct work_struct *work)
dev_err(dev-plat_dev-dev, CODA PIC_RUN timeout\n);
 
ctx-prescan_failed = true;
+
+   coda_hw_reset(ctx);
} else if (!ctx-aborting) {
if (ctx-inst_type == CODA_INST_DECODER)
coda_finish_decode(ctx);
@@ -3332,6 +3369,9 @@ static int coda_hw_init(struct coda_dev *dev)
if (ret)
goto err_clk_ahb;
 
+   if (dev-rstc)
+   reset_control_reset(dev-rstc);
+
/*
 * Copy the first CODA_ISRAM_SIZE in the internal SRAM.
 * The 16-bit chars in the code buffer are in memory access
@@ -3690,6 +3730,17 @@ static int coda_probe(struct platform_device *pdev)
return -ENOENT;
}
 
+   dev-rstc = devm_reset_control_get(pdev-dev, NULL);
+   if (IS_ERR(dev-rstc)) {
+   ret = PTR_ERR(dev-rstc);
+   if (ret == -ENOENT) {
+   dev-rstc = NULL;
+   } else {
+   dev_err(pdev-dev, failed get reset control: %d\n, 
ret);
+   return ret;
+   }
+   }
+
/* Get IRAM pool from device tree or platform data */
pool = of_get_named_gen_pool(np, iram, 0);
if (!pool  pdata)
-- 
2.0.0

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


[PATCH v2 17/29] [media] coda: add cyclic intra refresh control

2014-06-24 Thread Philipp Zabel
Allow userspace to enable cyclic intra refresh by setting the number of
intra macroblocks per frame to a non-zero value.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 9ac8c9a..d531f0b 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -167,6 +167,7 @@ struct coda_params {
u8  mpeg4_intra_qp;
u8  mpeg4_inter_qp;
u8  gop_size;
+   int intra_refresh;
int codec_mode;
int codec_mode_aux;
enum v4l2_mpeg_video_multi_slice_mode slice_mode;
@@ -2379,7 +2380,8 @@ static int coda_start_encoding(struct coda_ctx *ctx)
coda_write(dev, value, CODA_CMD_ENC_SEQ_RC_PARA);
 
coda_write(dev, 0, CODA_CMD_ENC_SEQ_RC_BUF_SIZE);
-   coda_write(dev, 0, CODA_CMD_ENC_SEQ_INTRA_REFRESH);
+   coda_write(dev, ctx-params.intra_refresh,
+  CODA_CMD_ENC_SEQ_INTRA_REFRESH);
 
coda_write(dev, bitstream_buf, CODA_CMD_ENC_SEQ_BB_START);
coda_write(dev, bitstream_size / 1024, CODA_CMD_ENC_SEQ_BB_SIZE);
@@ -2677,6 +2679,9 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl)
break;
case V4L2_CID_MPEG_VIDEO_HEADER_MODE:
break;
+   case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB:
+   ctx-params.intra_refresh = ctrl-val;
+   break;
default:
v4l2_dbg(1, coda_debug, ctx-dev-v4l2_dev,
Invalid control, id=%d, val=%d\n,
@@ -2738,6 +2743,8 @@ static int coda_ctrls_setup(struct coda_ctx *ctx)
V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME,
(1  V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE),
V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME);
+   v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
+   V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB, 0, 1920 * 1088 / 
256, 1, 0);
 
if (ctx-ctrls.error) {
v4l2_err(ctx-dev-v4l2_dev, control initialization error 
(%d),
-- 
2.0.0

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


[PATCH v2 09/29] [media] coda: add workqueue to serialize hardware commands

2014-06-24 Thread Philipp Zabel
Using the coda_mutex lock to serialize hardware access would cause
INFO: possible circular locking dependency detected lockdep warnings.
Since the possible locking paths are hard to follow, serialize hardware
access with a single workqueue thread. Ultimately the workqueue could
be converted to only do register setup and readout for per-command work
items.
Using the initialized context property, SEQ_END is only queued in
coda_release when needed.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 162 +++---
 1 file changed, 74 insertions(+), 88 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 965b0d9..bc5b6c0 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -147,11 +147,11 @@ struct coda_dev {
spinlock_t  irqlock;
struct mutexdev_mutex;
struct mutexcoda_mutex;
+   struct workqueue_struct *workqueue;
struct v4l2_m2m_dev *m2m_dev;
struct vb2_alloc_ctx*alloc_ctx;
struct list_headinstances;
unsigned long   instance_mask;
-   struct delayed_work timeout;
 };
 
 struct coda_params {
@@ -198,7 +198,9 @@ struct coda_ctx {
struct coda_dev *dev;
struct mutexbuffer_mutex;
struct list_headlist;
-   struct work_struct  skip_run;
+   struct work_struct  pic_run_work;
+   struct work_struct  seq_end_work;
+   struct completion   completion;
int aborting;
int initialized;
int streamon_out;
@@ -1009,13 +1011,6 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = {
 
 static int coda_start_decoding(struct coda_ctx *ctx);
 
-static void coda_skip_run(struct work_struct *work)
-{
-   struct coda_ctx *ctx = container_of(work, struct coda_ctx, skip_run);
-
-   v4l2_m2m_job_finish(ctx-dev-m2m_dev, ctx-m2m_ctx);
-}
-
 static inline int coda_get_bitstream_payload(struct coda_ctx *ctx)
 {
return kfifo_len(ctx-bitstream_fifo);
@@ -1170,7 +1165,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
v4l2_dbg(1, coda_debug, dev-v4l2_dev,
 bitstream payload: %d, skipping\n,
 coda_get_bitstream_payload(ctx));
-   schedule_work(ctx-skip_run);
+   v4l2_m2m_job_finish(ctx-dev-m2m_dev, ctx-m2m_ctx);
return -EAGAIN;
}
 
@@ -1179,7 +1174,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
int ret = coda_start_decoding(ctx);
if (ret  0) {
v4l2_err(dev-v4l2_dev, failed to start decoding\n);
-   schedule_work(ctx-skip_run);
+   v4l2_m2m_job_finish(ctx-dev-m2m_dev, ctx-m2m_ctx);
return -EAGAIN;
} else {
ctx-initialized = 1;
@@ -1387,24 +1382,48 @@ static void coda_device_run(void *m2m_priv)
 {
struct coda_ctx *ctx = m2m_priv;
struct coda_dev *dev = ctx-dev;
-   int ret;
+
+   queue_work(dev-workqueue, ctx-pic_run_work);
+}
+
+static void coda_free_framebuffers(struct coda_ctx *ctx);
+static void coda_free_context_buffers(struct coda_ctx *ctx);
+
+static void coda_seq_end_work(struct work_struct *work)
+{
+   struct coda_ctx *ctx = container_of(work, struct coda_ctx, 
seq_end_work);
+   struct coda_dev *dev = ctx-dev;
 
mutex_lock(ctx-buffer_mutex);
+   mutex_lock(dev-coda_mutex);
 
-   /*
-* If streamoff dequeued all buffers before we could get the lock,
-* just bail out immediately.
-*/
-   if ((!v4l2_m2m_num_src_bufs_ready(ctx-m2m_ctx) 
-   ctx-inst_type != CODA_INST_DECODER) ||
-   !v4l2_m2m_num_dst_bufs_ready(ctx-m2m_ctx)) {
-   v4l2_dbg(1, coda_debug, dev-v4l2_dev,
-   %d: device_run without buffers\n, ctx-idx);
-   mutex_unlock(ctx-buffer_mutex);
-   schedule_work(ctx-skip_run);
-   return;
+   v4l2_dbg(1, coda_debug, dev-v4l2_dev,
+%d: %s: sent command 'SEQ_END' to coda\n, ctx-idx, 
__func__);
+   if (coda_command_sync(ctx, CODA_COMMAND_SEQ_END)) {
+   v4l2_err(dev-v4l2_dev,
+CODA_COMMAND_SEQ_END failed\n);
}
 
+   kfifo_init(ctx-bitstream_fifo,
+   ctx-bitstream.vaddr, ctx-bitstream.size);
+
+   coda_free_framebuffers(ctx);
+   coda_free_context_buffers(ctx);
+
+   mutex_unlock(dev-coda_mutex);
+   mutex_unlock(ctx-buffer_mutex);
+}
+
+static void coda_finish_decode(struct coda_ctx *ctx);
+static void coda_finish_encode(struct coda_ctx *ctx);
+
+static void 

[PATCH v2 11/29] [media] coda: use ctx-fh.m2m_ctx instead of ctx-m2m_ctx

2014-06-24 Thread Philipp Zabel
v4l2_fh already contains a mem2mem context pointer. Use it.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 66 +--
 1 file changed, 32 insertions(+), 34 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 742187c..0a0b1ed 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -213,7 +213,6 @@ struct coda_ctx {
struct coda_codec   *codec;
enum v4l2_colorspacecolorspace;
struct coda_params  params;
-   struct v4l2_m2m_ctx *m2m_ctx;
struct v4l2_ctrl_handlerctrls;
struct v4l2_fh  fh;
int gopcounter;
@@ -553,7 +552,7 @@ static int coda_enum_fmt_vid_cap(struct file *file, void 
*priv,
struct coda_q_data *q_data_src;
 
/* If the source format is already fixed, only list matching formats */
-   src_vq = v4l2_m2m_get_vq(ctx-m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+   src_vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
if (vb2_is_streaming(src_vq)) {
q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
 
@@ -667,7 +666,7 @@ static int coda_try_fmt_vid_cap(struct file *file, void 
*priv,
 * If the source format is already fixed, try to find a codec that
 * converts to the given destination format
 */
-   src_vq = v4l2_m2m_get_vq(ctx-m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+   src_vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
if (vb2_is_streaming(src_vq)) {
struct coda_q_data *q_data_src;
 
@@ -721,7 +720,7 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct 
v4l2_format *f)
struct coda_q_data *q_data;
struct vb2_queue *vq;
 
-   vq = v4l2_m2m_get_vq(ctx-m2m_ctx, f-type);
+   vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, f-type);
if (!vq)
return -EINVAL;
 
@@ -785,7 +784,7 @@ static int coda_qbuf(struct file *file, void *priv,
 {
struct coda_ctx *ctx = fh_to_ctx(priv);
 
-   return v4l2_m2m_qbuf(file, ctx-m2m_ctx, buf);
+   return v4l2_m2m_qbuf(file, ctx-fh.m2m_ctx, buf);
 }
 
 static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx,
@@ -793,7 +792,7 @@ static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx,
 {
struct vb2_queue *src_vq;
 
-   src_vq = v4l2_m2m_get_vq(ctx-m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
+   src_vq = v4l2_m2m_get_vq(ctx-fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
 
return ((ctx-bit_stream_param  CODA_BIT_STREAM_END_FLAG) 
(buf-sequence == (ctx-qsequence - 1)));
@@ -805,7 +804,7 @@ static int coda_dqbuf(struct file *file, void *priv,
struct coda_ctx *ctx = fh_to_ctx(priv);
int ret;
 
-   ret = v4l2_m2m_dqbuf(file, ctx-m2m_ctx, buf);
+   ret = v4l2_m2m_dqbuf(file, ctx-fh.m2m_ctx, buf);
 
/* If this is the last capture buffer, emit an end-of-stream event */
if (buf-type == V4L2_BUF_TYPE_VIDEO_CAPTURE 
@@ -1042,11 +1041,11 @@ static void coda_fill_bitstream(struct coda_ctx *ctx)
 {
struct vb2_buffer *src_buf;
 
-   while (v4l2_m2m_num_src_bufs_ready(ctx-m2m_ctx)  0) {
-   src_buf = v4l2_m2m_next_src_buf(ctx-m2m_ctx);
+   while (v4l2_m2m_num_src_bufs_ready(ctx-fh.m2m_ctx)  0) {
+   src_buf = v4l2_m2m_next_src_buf(ctx-fh.m2m_ctx);
 
if (coda_bitstream_try_queue(ctx, src_buf)) {
-   src_buf = v4l2_m2m_src_buf_remove(ctx-m2m_ctx);
+   src_buf = v4l2_m2m_src_buf_remove(ctx-fh.m2m_ctx);
v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE);
} else {
break;
@@ -1086,7 +1085,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
u32 stridey, height;
u32 picture_y, picture_cb, picture_cr;
 
-   dst_buf = v4l2_m2m_next_dst_buf(ctx-m2m_ctx);
+   dst_buf = v4l2_m2m_next_dst_buf(ctx-fh.m2m_ctx);
q_data_dst = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
 
if (ctx-params.rot_mode  CODA_ROT_90) {
@@ -1107,7 +1106,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
v4l2_dbg(1, coda_debug, dev-v4l2_dev,
 bitstream payload: %d, skipping\n,
 coda_get_bitstream_payload(ctx));
-   v4l2_m2m_job_finish(ctx-dev-m2m_dev, ctx-m2m_ctx);
+   v4l2_m2m_job_finish(ctx-dev-m2m_dev, ctx-fh.m2m_ctx);
return -EAGAIN;
}
 
@@ -1116,7 +1115,7 @@ static int coda_prepare_decode(struct coda_ctx *ctx)
int ret = coda_start_decoding(ctx);
if (ret  0) {
v4l2_err(dev-v4l2_dev, failed to start decoding\n);
-   v4l2_m2m_job_finish(ctx-dev-m2m_dev, ctx-m2m_ctx);
+   

[PATCH v2 18/29] [media] v4l2-mem2mem: export v4l2_m2m_try_schedule

2014-06-24 Thread Philipp Zabel
From: Michael Olbrich m.olbr...@pengutronix.de

Some drivers might allow to decode remaining frames from an internal ringbuffer
after a decoder stop command. Allow those to call v4l2_m2m_try_schedule
directly.

Signed-off-by: Michael Olbrich m.olbr...@pengutronix.de
Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/v4l2-core/v4l2-mem2mem.c | 3 ++-
 include/media/v4l2-mem2mem.h   | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c 
b/drivers/media/v4l2-core/v4l2-mem2mem.c
index 178ce96..5f5c175 100644
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
@@ -208,7 +208,7 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev)
  * An example of the above could be an instance that requires more than one
  * src/dst buffer per transaction.
  */
-static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
+void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx)
 {
struct v4l2_m2m_dev *m2m_dev;
unsigned long flags_job, flags_out, flags_cap;
@@ -274,6 +274,7 @@ static void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx 
*m2m_ctx)
 
v4l2_m2m_try_run(m2m_dev);
 }
+EXPORT_SYMBOL(v4l2_m2m_try_schedule);
 
 /**
  * v4l2_m2m_cancel_job() - cancel pending jobs for the context
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
index 12ea5a6..c5f3914 100644
--- a/include/media/v4l2-mem2mem.h
+++ b/include/media/v4l2-mem2mem.h
@@ -95,6 +95,8 @@ void *v4l2_m2m_get_curr_priv(struct v4l2_m2m_dev *m2m_dev);
 struct vb2_queue *v4l2_m2m_get_vq(struct v4l2_m2m_ctx *m2m_ctx,
   enum v4l2_buf_type type);
 
+void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx);
+
 void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
 struct v4l2_m2m_ctx *m2m_ctx);
 
-- 
2.0.0

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


[PATCH v2 15/29] [media] coda: add h.264 min/max qp controls

2014-06-24 Thread Philipp Zabel
If the bitrate control is set, the encoder works in CBR mode, dynamically
changing the quantization parameters to achieve a constant bitrate.
With the min/max QP controls the quantization parameters can be limited
to a given range.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 27 +++
 1 file changed, 27 insertions(+)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index c93e9bf..3697a17 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -159,6 +159,8 @@ struct coda_params {
u8  rot_mode;
u8  h264_intra_qp;
u8  h264_inter_qp;
+   u8  h264_min_qp;
+   u8  h264_max_qp;
u8  mpeg4_intra_qp;
u8  mpeg4_inter_qp;
u8  gop_size;
@@ -2379,7 +2381,16 @@ static int coda_start_encoding(struct coda_ctx *ctx)
coda_write(dev, (gamma  CODA_GAMMA_MASK)  CODA_GAMMA_OFFSET,
   CODA_CMD_ENC_SEQ_RC_GAMMA);
}
+
+   if (ctx-params.h264_min_qp || ctx-params.h264_max_qp) {
+   coda_write(dev,
+  ctx-params.h264_min_qp  CODA_QPMIN_OFFSET |
+  ctx-params.h264_max_qp  CODA_QPMAX_OFFSET,
+  CODA_CMD_ENC_SEQ_RC_QP_MIN_MAX);
+   }
if (dev-devtype-product == CODA_960) {
+   if (ctx-params.h264_max_qp)
+   value |= 1  CODA9_OPTION_RCQPMAX_OFFSET;
if (CODA_DEFAULT_GAMMA  0)
value |= 1  CODA9_OPTION_GAMMA_OFFSET;
} else {
@@ -2389,6 +2400,10 @@ static int coda_start_encoding(struct coda_ctx *ctx)
else
value |= 1  CODA7_OPTION_GAMMA_OFFSET;
}
+   if (ctx-params.h264_min_qp)
+   value |= 1  CODA7_OPTION_RCQPMIN_OFFSET;
+   if (ctx-params.h264_max_qp)
+   value |= 1  CODA7_OPTION_RCQPMAX_OFFSET;
}
coda_write(dev, value, CODA_CMD_ENC_SEQ_OPTION);
 
@@ -2616,6 +2631,12 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP:
ctx-params.h264_inter_qp = ctrl-val;
break;
+   case V4L2_CID_MPEG_VIDEO_H264_MIN_QP:
+   ctx-params.h264_min_qp = ctrl-val;
+   break;
+   case V4L2_CID_MPEG_VIDEO_H264_MAX_QP:
+   ctx-params.h264_max_qp = ctrl-val;
+   break;
case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP:
ctx-params.mpeg4_intra_qp = ctrl-val;
break;
@@ -2663,6 +2684,12 @@ static int coda_ctrls_setup(struct coda_ctx *ctx)
V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP, 0, 51, 1, 25);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP, 0, 51, 1, 25);
+   if (ctx-dev-devtype-product != CODA_960) {
+   v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
+   V4L2_CID_MPEG_VIDEO_H264_MIN_QP, 0, 51, 1, 12);
+   }
+   v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
+   V4L2_CID_MPEG_VIDEO_H264_MAX_QP, 0, 51, 1, 51);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP, 1, 31, 1, 2);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
-- 
2.0.0

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


[PATCH v2 14/29] [media] coda: select GENERIC_ALLOCATOR

2014-06-24 Thread Philipp Zabel
The driver uses the genalloc API, which doesn't have stubs in
case GENERIC_ALLOCATOR is disabled.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 8108c69..a204e8d 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -142,6 +142,7 @@ config VIDEO_CODA
select SRAM
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
+   select GENERIC_ALLOCATOR
---help---
   Coda is a range of video codec IPs that supports
   H.264, MPEG-4, and other video formats.
-- 
2.0.0

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


Re: [PATCH v14 06/10] drm: drm_display_mode: add signal polarity flags

2014-06-24 Thread Russell King - ARM Linux
On Mon, Jun 16, 2014 at 12:11:20PM +0200, Denis Carikli wrote:
 We need a way to pass signal polarity informations
   between DRM panels, and the display drivers.
 
 To do that, a pol_flags field was added to drm_display_mode.
 
 Signed-off-by: Denis Carikli de...@eukrea.com

This patch needs an ack from the DRM people - can someone review it
please?  This series has now been round 14 revisions and it's about
time it was properly reviewed - or a statement made if it's
unacceptable.

 ---
 ChangeLog v13-v14:
 - Fixed DRM_MODE_FLAG_POL_DE_HIGH's description.
 ChangeLog v12-v13:
 - Added Docbook documentation for pol_flags the struct field.
 - Removed the _PRESERVE   defines: it was used by patches
   against the imx_drm driver. Now theses patches have been
   adapted not to require that defines.
 ChangeLog v11-v12:
 - Rebased: This patch now applies against drm_modes.h
 - Rebased: It now uses the new DRM_MODE_FLAG_POL_DE flags defines names
 
 ChangeLog v10-v11:
 - Since the imx-drm won't be able to retrive its regulators
   from the device tree when using display-timings nodes,
   and that I was told that the drm simple-panel driver 
   already supported that, I then, instead, added what was
   lacking to make the eukrea displays work with the
   drm-simple-panel driver.
 
   That required a way to get back the display polarity
   informations from the imx-drm driver without affecting
   userspace.
 ---
  Documentation/DocBook/drm.tmpl |   30 ++
  include/drm/drm_modes.h|6 ++
  2 files changed, 36 insertions(+)
 
 diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl
 index 7df3134..22d435f 100644
 --- a/Documentation/DocBook/drm.tmpl
 +++ b/Documentation/DocBook/drm.tmpl
 @@ -2292,6 +2292,36 @@ void intel_crt_init(struct drm_device *dev)
  and structfieldheight_mm/structfield fields are only used 
 internally
  during EDID parsing and should not be set when creating modes 
 manually.
/para
 +  para
 +The structfieldpol_flags/structfield value represents the 
 display
 +signal polarity flags, it can be a combination of
 +variablelist
 +  varlistentry
 +termDRM_MODE_FLAG_POL_PIXDATA_NEGEDGE/term
 + listitempara
 + drive pixel data on falling edge, sample data on rising 
 edge.
 + /para/listitem
 +  /varlistentry
 +  varlistentry
 +termDRM_MODE_FLAG_POL_PIXDATA_POSEDGE/term
 +listitempara
 +  Drive pixel data on rising edge, sample data on falling 
 edge.
 +/para/listitem
 +  /varlistentry
 +  varlistentry
 +termDRM_MODE_FLAG_POL_DE_LOW/term
 +listitempara
 +  data-enable pulse is active low
 +/para/listitem
 +  /varlistentry
 +  varlistentry
 +termDRM_MODE_FLAG_POL_DE_HIGH/term
 +listitempara
 +  data-enable pulse is active high
 +/para/listitem
 +  /varlistentry
 +/variablelist
 +  /para
  /listitem
  listitem
synopsisint (*mode_valid)(struct drm_connector *connector,
 diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
 index 91d0582..c5cbe31 100644
 --- a/include/drm/drm_modes.h
 +++ b/include/drm/drm_modes.h
 @@ -93,6 +93,11 @@ enum drm_mode_status {
  
  #define DRM_MODE_FLAG_3D_MAX DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF
  
 +#define DRM_MODE_FLAG_POL_PIXDATA_NEGEDGEBIT(1)
 +#define DRM_MODE_FLAG_POL_PIXDATA_POSEDGEBIT(2)
 +#define DRM_MODE_FLAG_POL_DE_LOW BIT(3)
 +#define DRM_MODE_FLAG_POL_DE_HIGHBIT(4)
 +
  struct drm_display_mode {
   /* Header */
   struct list_head head;
 @@ -144,6 +149,7 @@ struct drm_display_mode {
   int vrefresh;   /* in Hz */
   int hsync;  /* in kHz */
   enum hdmi_picture_aspect picture_aspect_ratio;
 + unsigned int pol_flags;
  };
  
  /* mode specified on the command line */
 -- 
 1.7.9.5
 

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
--
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 v2 02/29] [media] coda: fix readback of CODA_RET_DEC_SEQ_FRAME_NEED

2014-06-24 Thread Philipp Zabel
Previously we'd add one to this value, allocating one additional, superfluous
internal buffer.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index a7c5ac5..1770fc2 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -1889,7 +1889,7 @@ static int coda_start_decoding(struct coda_ctx *ctx)
v4l2_dbg(1, coda_debug, dev-v4l2_dev, %s instance %d now: %dx%d\n,
 __func__, ctx-idx, width, height);
 
-   ctx-num_internal_frames = coda_read(dev, CODA_RET_DEC_SEQ_FRAME_NEED) 
+ 1;
+   ctx-num_internal_frames = coda_read(dev, CODA_RET_DEC_SEQ_FRAME_NEED);
if (ctx-num_internal_frames  CODA_MAX_FRAMEBUFFERS) {
v4l2_err(dev-v4l2_dev,
 not enough framebuffers to decode (%d  %d)\n,
-- 
2.0.0

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


[PATCH v2 06/29] [media] coda: Add encoder/decoder support for CODA960

2014-06-24 Thread Philipp Zabel
This patch adds support for the CODA960 VPU in Freescale i.MX6 SoCs.

It enables h.264 and MPEG4 encoding and decoding support. Besides the usual
register shifting, the CODA960 gains frame memory control and GDI registers
that are set up for linear mapping right now, needs ENC_PIC_SRC_INDEX to be
set beyond the number of internal buffers for some reason, and has subsampling
buffers that need to be set up. Also, the work buffer size is increased to
80 KiB.

The CODA960 firmware spins if there is not enough input data in the bitstream
buffer. To make it continue, buffers need to be copied into the bitstream as
soon as they are queued. As the bitstream fifo is written into from two places,
it must be protected with a mutex. For that, using a threaded interrupt handler
is necessary.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 397 +-
 drivers/media/platform/coda.h | 115 +++-
 2 files changed, 464 insertions(+), 48 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 50051fe..2da7e29 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -44,19 +44,24 @@
 #define CODA_FMO_BUF_SIZE  32
 #define CODADX6_WORK_BUF_SIZE  (288 * 1024 + CODA_FMO_BUF_SIZE * 8 * 1024)
 #define CODA7_WORK_BUF_SIZE(128 * 1024)
+#define CODA9_WORK_BUF_SIZE(80 * 1024)
 #define CODA7_TEMP_BUF_SIZE(304 * 1024)
+#define CODA9_TEMP_BUF_SIZE(204 * 1024)
 #define CODA_PARA_BUF_SIZE (10 * 1024)
 #define CODA_ISRAM_SIZE(2048 * 2)
 #define CODADX6_IRAM_SIZE  0xb000
 #define CODA7_IRAM_SIZE0x14000
+#define CODA9_IRAM_SIZE0x21000
 
 #define CODA7_PS_BUF_SIZE  0x28000
+#define CODA9_PS_SAVE_SIZE (512 * 1024)
 
 #define CODA_MAX_FRAMEBUFFERS  8
 
 #define CODA_MAX_FRAME_SIZE0x10
 #define FMO_SLICE_SAVE_BUF_SIZE (32)
 #define CODA_DEFAULT_GAMMA 4096
+#define CODA9_DEFAULT_GAMMA24576   /* 0.75 * 32768 */
 
 #define MIN_W 176
 #define MIN_H 144
@@ -84,6 +89,7 @@ enum coda_inst_type {
 enum coda_product {
CODA_DX6 = 0xf001,
CODA_7541 = 0xf012,
+   CODA_960 = 0xf020,
 };
 
 struct coda_fmt {
@@ -177,6 +183,16 @@ struct coda_iram_info {
phys_addr_t next_paddr;
 };
 
+struct gdi_tiled_map {
+   int xy2ca_map[16];
+   int xy2ba_map[16];
+   int xy2ra_map[16];
+   int rbc2axi_map[32];
+   int xy2rbc_config;
+   int map_type;
+#define GDI_LINEAR_FRAME_MAP 0
+};
+
 struct coda_ctx {
struct coda_dev *dev;
struct mutexbuffer_mutex;
@@ -215,8 +231,10 @@ struct coda_ctx {
int idx;
int reg_idx;
struct coda_iram_info   iram_info;
+   struct gdi_tiled_maptiled_map;
u32 bit_stream_param;
u32 frm_dis_flg;
+   u32 frame_mem_ctrl;
int display_idx;
 };
 
@@ -265,15 +283,23 @@ static void coda_command_async(struct coda_ctx *ctx, int 
cmd)
 {
struct coda_dev *dev = ctx-dev;
 
-   if (dev-devtype-product == CODA_7541) {
+   if (dev-devtype-product == CODA_960 ||
+   dev-devtype-product == CODA_7541) {
/* Restore context related registers to CODA */
coda_write(dev, ctx-bit_stream_param,
CODA_REG_BIT_BIT_STREAM_PARAM);
coda_write(dev, ctx-frm_dis_flg,
CODA_REG_BIT_FRM_DIS_FLG(ctx-reg_idx));
+   coda_write(dev, ctx-frame_mem_ctrl,
+   CODA_REG_BIT_FRAME_MEM_CTRL);
coda_write(dev, ctx-workbuf.paddr, CODA_REG_BIT_WORK_BUF_ADDR);
}
 
+   if (dev-devtype-product == CODA_960) {
+   coda_write(dev, 1, CODA9_GDI_WPROT_ERR_CLR);
+   coda_write(dev, 0, CODA9_GDI_WPROT_RGN_EN);
+   }
+
coda_write(dev, CODA_REG_BIT_BUSY_FLAG, CODA_REG_BIT_BUSY);
 
coda_write(dev, ctx-idx, CODA_REG_BIT_RUN_INDEX);
@@ -349,6 +375,13 @@ static struct coda_codec coda7_codecs[] = {
CODA_CODEC(CODA7_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
V4L2_PIX_FMT_YUV420, 1920, 1080),
 };
 
+static struct coda_codec coda9_codecs[] = {
+   CODA_CODEC(CODA9_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_H264,   1920, 1080),
+   CODA_CODEC(CODA9_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420, 
V4L2_PIX_FMT_MPEG4,  1920, 1080),
+   CODA_CODEC(CODA9_MODE_DECODE_H264, V4L2_PIX_FMT_H264,   
V4L2_PIX_FMT_YUV420, 1920, 1080),
+   CODA_CODEC(CODA9_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
V4L2_PIX_FMT_YUV420, 1920, 1080),
+};
+
 static bool coda_format_is_yuv(u32 fourcc)
 {
switch (fourcc) {
@@ -427,6 +460,8 @@ static char *coda_product_name(int 

[PATCH v2 16/29] [media] coda: add h.264 deblocking filter controls

2014-06-24 Thread Philipp Zabel
This adds controls for the h.264 deblocking loop filter.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 33 -
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index 3697a17..9ac8c9a 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -161,6 +161,9 @@ struct coda_params {
u8  h264_inter_qp;
u8  h264_min_qp;
u8  h264_max_qp;
+   u8  h264_deblk_enabled;
+   u8  h264_deblk_alpha;
+   u8  h264_deblk_beta;
u8  mpeg4_intra_qp;
u8  mpeg4_inter_qp;
u8  gop_size;
@@ -2326,7 +2329,17 @@ static int coda_start_encoding(struct coda_ctx *ctx)
coda_write(dev, CODA9_STD_H264, 
CODA_CMD_ENC_SEQ_COD_STD);
else
coda_write(dev, CODA_STD_H264, 
CODA_CMD_ENC_SEQ_COD_STD);
-   coda_write(dev, 0, CODA_CMD_ENC_SEQ_264_PARA);
+   if (ctx-params.h264_deblk_enabled) {
+   value = ((ctx-params.h264_deblk_alpha 
+ CODA_264PARAM_DEBLKFILTEROFFSETALPHA_MASK) 
+CODA_264PARAM_DEBLKFILTEROFFSETALPHA_OFFSET) |
+   ((ctx-params.h264_deblk_beta 
+ CODA_264PARAM_DEBLKFILTEROFFSETBETA_MASK) 
+CODA_264PARAM_DEBLKFILTEROFFSETBETA_OFFSET);
+   } else {
+   value = 1  CODA_264PARAM_DISABLEDEBLK_OFFSET;
+   }
+   coda_write(dev, value, CODA_CMD_ENC_SEQ_264_PARA);
break;
default:
v4l2_err(v4l2_dev,
@@ -2637,6 +2650,16 @@ static int coda_s_ctrl(struct v4l2_ctrl *ctrl)
case V4L2_CID_MPEG_VIDEO_H264_MAX_QP:
ctx-params.h264_max_qp = ctrl-val;
break;
+   case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA:
+   ctx-params.h264_deblk_alpha = ctrl-val;
+   break;
+   case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA:
+   ctx-params.h264_deblk_beta = ctrl-val;
+   break;
+   case V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE:
+   ctx-params.h264_deblk_enabled = (ctrl-val ==
+   V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED);
+   break;
case V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP:
ctx-params.mpeg4_intra_qp = ctrl-val;
break;
@@ -2691,6 +2714,14 @@ static int coda_ctrls_setup(struct coda_ctx *ctx)
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
V4L2_CID_MPEG_VIDEO_H264_MAX_QP, 0, 51, 1, 51);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
+   V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA, 0, 15, 1, 0);
+   v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
+   V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA, 0, 15, 1, 0);
+   v4l2_ctrl_new_std_menu(ctx-ctrls, coda_ctrl_ops,
+   V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE,
+   V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED, 0x0,
+   V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED);
+   v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP, 1, 31, 1, 2);
v4l2_ctrl_new_std(ctx-ctrls, coda_ctrl_ops,
V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP, 1, 31, 1, 2);
-- 
2.0.0

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


[PATCH v2 10/29] [media] coda: Use mem-to-mem ioctl helpers

2014-06-24 Thread Philipp Zabel
Use the mem2mem helpers introduced to get rid of some duplicated code.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 113 ++
 1 file changed, 14 insertions(+), 99 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index bc5b6c0..742187c 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -780,22 +780,6 @@ static int coda_s_fmt_vid_out(struct file *file, void 
*priv,
return ret;
 }
 
-static int coda_reqbufs(struct file *file, void *priv,
-   struct v4l2_requestbuffers *reqbufs)
-{
-   struct coda_ctx *ctx = fh_to_ctx(priv);
-
-   return v4l2_m2m_reqbufs(file, ctx-m2m_ctx, reqbufs);
-}
-
-static int coda_querybuf(struct file *file, void *priv,
-struct v4l2_buffer *buf)
-{
-   struct coda_ctx *ctx = fh_to_ctx(priv);
-
-   return v4l2_m2m_querybuf(file, ctx-m2m_ctx, buf);
-}
-
 static int coda_qbuf(struct file *file, void *priv,
 struct v4l2_buffer *buf)
 {
@@ -804,14 +788,6 @@ static int coda_qbuf(struct file *file, void *priv,
return v4l2_m2m_qbuf(file, ctx-m2m_ctx, buf);
 }
 
-static int coda_expbuf(struct file *file, void *priv,
-  struct v4l2_exportbuffer *eb)
-{
-   struct coda_ctx *ctx = fh_to_ctx(priv);
-
-   return v4l2_m2m_expbuf(file, ctx-m2m_ctx, eb);
-}
-
 static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx,
  struct v4l2_buffer *buf)
 {
@@ -844,40 +820,6 @@ static int coda_dqbuf(struct file *file, void *priv,
return ret;
 }
 
-static int coda_create_bufs(struct file *file, void *priv,
-   struct v4l2_create_buffers *create)
-{
-   struct coda_ctx *ctx = fh_to_ctx(priv);
-
-   return v4l2_m2m_create_bufs(file, ctx-m2m_ctx, create);
-}
-
-static int coda_streamon(struct file *file, void *priv,
-enum v4l2_buf_type type)
-{
-   struct coda_ctx *ctx = fh_to_ctx(priv);
-
-   return v4l2_m2m_streamon(file, ctx-m2m_ctx, type);
-}
-
-static int coda_streamoff(struct file *file, void *priv,
- enum v4l2_buf_type type)
-{
-   struct coda_ctx *ctx = fh_to_ctx(priv);
-   int ret;
-
-   /*
-* This indirectly calls __vb2_queue_cancel, which dequeues all buffers.
-* We therefore have to lock it against running hardware in this 
context,
-* which still needs the buffers.
-*/
-   mutex_lock(ctx-buffer_mutex);
-   ret = v4l2_m2m_streamoff(file, ctx-m2m_ctx, type);
-   mutex_unlock(ctx-buffer_mutex);
-
-   return ret;
-}
-
 static int coda_g_selection(struct file *file, void *fh,
struct v4l2_selection *s)
 {
@@ -989,16 +931,16 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = {
.vidioc_try_fmt_vid_out = coda_try_fmt_vid_out,
.vidioc_s_fmt_vid_out   = coda_s_fmt_vid_out,
 
-   .vidioc_reqbufs = coda_reqbufs,
-   .vidioc_querybuf= coda_querybuf,
+   .vidioc_reqbufs = v4l2_m2m_ioctl_reqbufs,
+   .vidioc_querybuf= v4l2_m2m_ioctl_querybuf,
 
.vidioc_qbuf= coda_qbuf,
-   .vidioc_expbuf  = coda_expbuf,
+   .vidioc_expbuf  = v4l2_m2m_ioctl_expbuf,
.vidioc_dqbuf   = coda_dqbuf,
-   .vidioc_create_bufs = coda_create_bufs,
+   .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs,
 
-   .vidioc_streamon= coda_streamon,
-   .vidioc_streamoff   = coda_streamoff,
+   .vidioc_streamon= v4l2_m2m_ioctl_streamon,
+   .vidioc_streamoff   = v4l2_m2m_ioctl_streamoff,
 
.vidioc_g_selection = coda_g_selection,
 
@@ -1677,18 +1619,6 @@ static void coda_buf_queue(struct vb2_buffer *vb)
}
 }
 
-static void coda_wait_prepare(struct vb2_queue *q)
-{
-   struct coda_ctx *ctx = vb2_get_drv_priv(q);
-   coda_unlock(ctx);
-}
-
-static void coda_wait_finish(struct vb2_queue *q)
-{
-   struct coda_ctx *ctx = vb2_get_drv_priv(q);
-   coda_lock(ctx);
-}
-
 static void coda_parabuf_write(struct coda_ctx *ctx, int index, u32 value)
 {
struct coda_dev *dev = ctx-dev;
@@ -2647,10 +2577,10 @@ static struct vb2_ops coda_qops = {
.queue_setup= coda_queue_setup,
.buf_prepare= coda_buf_prepare,
.buf_queue  = coda_buf_queue,
-   .wait_prepare   = coda_wait_prepare,
-   .wait_finish= coda_wait_finish,
.start_streaming= coda_start_streaming,
.stop_streaming = coda_stop_streaming,
+   .wait_prepare   = vb2_ops_wait_prepare,
+   .wait_finish= vb2_ops_wait_finish,
 };
 
 static int coda_s_ctrl(struct v4l2_ctrl *ctrl)
@@ -2773,6 +2703,7 @@ static int coda_queue_init(void *priv, struct vb2_queue 
*src_vq,
 

[PATCH v2 00/29] Initial CODA960 (i.MX6 VPU) support

2014-06-24 Thread Philipp Zabel
Hi,

this is a second shot at adding support for the CODA960 Video
Processing Unit on i.MX6Q/D/DL/S SoCs to the coda driver.

Changes since v1:
 - Dropped force IDR patch.
 - Dropped enum_framesizes for now.
 - Clear B frame flag for decoder I/P/B frame detection.
 - Rewrote g_selection to only allow CROP target on OUTPUT and
   COMPOSE target on CAPTURE buffers.
 - Use pm_runtime_enabled()

This series contains a few fixes and preparations, the CODA960
support patch, a rework of the hardware access serialization
into a single threaded workqueue, some cleanups to use more
infrastructure that is available in the meantime, runtime PM
support, a few h.264 related v4l2 controls and fixes, support
for hard resets via the i.MX system reset controller, and a
patch that exports internal buffers to debugfs.

regards
Philipp

Michael Olbrich (2):
  [media] v4l2-mem2mem: export v4l2_m2m_try_schedule
  [media] coda: try to schedule a decode run after a stop command

Philipp Zabel (27):
  [media] coda: fix decoder I/P/B frame detection
  [media] coda: fix readback of CODA_RET_DEC_SEQ_FRAME_NEED
  [media] coda: fix h.264 quantization parameter range
  [media] coda: fix internal framebuffer allocation size
  [media] coda: simplify IRAM setup
  [media] coda: Add encoder/decoder support for CODA960
  [media] coda: remove BUG() in get_q_data
  [media] coda: add selection API support for h.264 decoder
  [media] coda: add workqueue to serialize hardware commands
  [media] coda: Use mem-to-mem ioctl helpers
  [media] coda: use ctx-fh.m2m_ctx instead of ctx-m2m_ctx
  [media] coda: Add runtime pm support
  [media] coda: split firmware version check out of coda_hw_init
  [media] coda: select GENERIC_ALLOCATOR
  [media] coda: add h.264 min/max qp controls
  [media] coda: add h.264 deblocking filter controls
  [media] coda: add cyclic intra refresh control
  [media] coda: add decoder timestamp queue
  [media] coda: alert userspace about macroblock errors
  [media] coda: add sequence counter offset
  [media] coda: use prescan_failed variable to stop stream after a
timeout
  [media] coda: add reset control support
  [media] coda: add bytesperline to queue data
  [media] coda: allow odd width, but still round up bytesperline
  [media] coda: round up internal frames to multiples of macroblock size
for h.264
  [media] coda: increase frame stride to 16 for h.264
  [media] coda: export auxiliary buffers via debugfs

 drivers/media/platform/Kconfig |1 +
 drivers/media/platform/coda.c  | 1444 ++--
 drivers/media/platform/coda.h  |  115 ++-
 drivers/media/v4l2-core/v4l2-mem2mem.c |3 +-
 include/media/v4l2-mem2mem.h   |2 +
 5 files changed, 1140 insertions(+), 425 deletions(-)

-- 
2.0.0

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


[PATCH v2 13/29] [media] coda: split firmware version check out of coda_hw_init

2014-06-24 Thread Philipp Zabel
This adds a new function coda_check_firmware that does the firmware
version checks so that this can be done only once from coda_probe
instead of every time the runtime pm framework resumes the coda.

Signed-off-by: Philipp Zabel p.za...@pengutronix.de
---
 drivers/media/platform/coda.c | 42 +-
 1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
index bd243ed..c93e9bf 100644
--- a/drivers/media/platform/coda.c
+++ b/drivers/media/platform/coda.c
@@ -3194,7 +3194,6 @@ static bool coda_firmware_supported(u32 vernum)
 
 static int coda_hw_init(struct coda_dev *dev)
 {
-   u16 product, major, minor, release;
u32 data;
u16 *p;
int i, ret;
@@ -3275,17 +3274,40 @@ static int coda_hw_init(struct coda_dev *dev)
coda_write(dev, data, CODA_REG_BIT_CODE_RESET);
coda_write(dev, CODA_REG_RUN_ENABLE, CODA_REG_BIT_CODE_RUN);
 
-   /* Load firmware */
+   clk_disable_unprepare(dev-clk_ahb);
+   clk_disable_unprepare(dev-clk_per);
+
+   return 0;
+
+err_clk_ahb:
+   clk_disable_unprepare(dev-clk_per);
+err_clk_per:
+   return ret;
+}
+
+static int coda_check_firmware(struct coda_dev *dev)
+{
+   u16 product, major, minor, release;
+   u32 data;
+   int ret;
+
+   ret = clk_prepare_enable(dev-clk_per);
+   if (ret)
+   goto err_clk_per;
+
+   ret = clk_prepare_enable(dev-clk_ahb);
+   if (ret)
+   goto err_clk_ahb;
+
coda_write(dev, 0, CODA_CMD_FIRMWARE_VERNUM);
coda_write(dev, CODA_REG_BIT_BUSY_FLAG, CODA_REG_BIT_BUSY);
coda_write(dev, 0, CODA_REG_BIT_RUN_INDEX);
coda_write(dev, 0, CODA_REG_BIT_RUN_COD_STD);
coda_write(dev, CODA_COMMAND_FIRMWARE_GET, CODA_REG_BIT_RUN_COMMAND);
if (coda_wait_timeout(dev)) {
-   clk_disable_unprepare(dev-clk_per);
-   clk_disable_unprepare(dev-clk_ahb);
v4l2_err(dev-v4l2_dev, firmware get command error\n);
-   return -EIO;
+   ret = -EIO;
+   goto err_run_cmd;
}
 
if (dev-devtype-product == CODA_960) {
@@ -3325,6 +3347,8 @@ static int coda_hw_init(struct coda_dev *dev)
 
return 0;
 
+err_run_cmd:
+   clk_disable_unprepare(dev-clk_ahb);
 err_clk_ahb:
clk_disable_unprepare(dev-clk_per);
 err_clk_per:
@@ -3365,6 +3389,10 @@ static void coda_fw_callback(const struct firmware *fw, 
void *context)
return;
}
 
+   ret = coda_check_firmware(dev);
+   if (ret  0)
+   return;
+
pm_runtime_put_sync(dev-plat_dev-dev);
} else {
/*
@@ -3376,6 +3404,10 @@ static void coda_fw_callback(const struct firmware *fw, 
void *context)
v4l2_err(dev-v4l2_dev, HW initialization failed\n);
return;
}
+
+   ret = coda_check_firmware(dev);
+   if (ret  0)
+   return;
}
 
dev-vfd.fops   = coda_fops,
-- 
2.0.0

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


Re: [PATCH v14 05/10] ARM: dts: imx5*, imx6*: correct display-timings nodes.

2014-06-24 Thread Russell King - ARM Linux
On Mon, Jun 16, 2014 at 12:11:19PM +0200, Denis Carikli wrote:
 The imx-drm driver can't use the de-active and
 pixelclk-active display-timings properties yet.
 
 Instead the data-enable and the pixel data clock
 polarity are hardcoded in the imx-drm driver.
 
 So theses properties are now set to keep
 the same behaviour when imx-drm will start
 using them.
 
 Signed-off-by: Denis Carikli de...@eukrea.com

This patch needs either an ack from the arm-soc/iMX maintainers, or
they need to merge it.  As there's little positive agreement on the
series, I can understand why there's reluctance to merge it.

So, can we start having some acks from people please, or at least
commitments to merge this patch when the others are deemed to be
acceptable.  If not, can we have explanations why this should not
be merged.

Thanks.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
--
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 v14 08/10] drm/panel: Add Eukrea mbimxsd51 displays.

2014-06-24 Thread Russell King - ARM Linux
Denis,

This patch creates binding documentation.  Any patch which does so
should be copied to the DT people so they can review the bindings
and give appropriate acks.  It would be better if you separate the
binding documentation updates from the other functional changes too.

I've added them on this reply to see whether they'll feel friendly
enough to comment on the patch as it stands to avoid having to go
through two more rounds on this already-fourteen revision patch set.

On Mon, Jun 16, 2014 at 12:11:22PM +0200, Denis Carikli wrote:
 Signed-off-by: Denis Carikli de...@eukrea.com
 ---
 ChangeLog v13-v14:
 - None
 
 ChangeLog v12-v13:
 - Added a note explaining why the size is zero in
   the eukrea_mbimxsd51_dvi(s)vga structs.
 ChangeLog v11-v12:
 - Rebased: It now uses the new DRM_MODE_FLAG_POL_DE flags defines names
 
 ChangeLog v10-v11:
 - New patch.
 ---
  .../bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt   |7 ++
  .../bindings/panel/eukrea,mbimxsd51-dvi-svga.txt   |7 ++
  .../bindings/panel/eukrea,mbimxsd51-dvi-vga.txt|7 ++
  drivers/gpu/drm/panel/panel-simple.c   |   83 
 
  4 files changed, 104 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
  create mode 100644 
 Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
  create mode 100644 
 Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
 
 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
 new file mode 100644
 index 000..03679d0
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
 @@ -0,0 +1,7 @@
 +Eukrea CMO-QVGA (320x240 pixels) TFT LCD panel
 +
 +Required properties:
 +- compatible: should be eukrea,mbimxsd51-cmo-qvga
 +
 +This binding is compatible with the simple-panel binding, which is specified
 +in simple-panel.txt in this directory.
 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
 new file mode 100644
 index 000..f408c9a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
 @@ -0,0 +1,7 @@
 +Eukrea DVI-SVGA (800x600 pixels) DVI output.
 +
 +Required properties:
 +- compatible: should be eukrea,mbimxsd51-dvi-svga
 +
 +This binding is compatible with the simple-panel binding, which is specified
 +in simple-panel.txt in this directory.
 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
 new file mode 100644
 index 000..8ea90da
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
 @@ -0,0 +1,7 @@
 +Eukrea DVI-VGA (640x480 pixels) DVI output.
 +
 +Required properties:
 +- compatible: should be eukrea,mbimxsd51-dvi-vga
 +
 +This binding is compatible with the simple-panel binding, which is specified
 +in simple-panel.txt in this directory.
 diff --git a/drivers/gpu/drm/panel/panel-simple.c 
 b/drivers/gpu/drm/panel/panel-simple.c
 index a251361..adc40a7 100644
 --- a/drivers/gpu/drm/panel/panel-simple.c
 +++ b/drivers/gpu/drm/panel/panel-simple.c
 @@ -403,6 +403,80 @@ static const struct panel_desc edt_etm0700g0dh6 = {
   },
  };
  
 +static const struct drm_display_mode eukrea_mbimxsd51_cmoqvga_mode = {
 + .clock = 6500,
 + .hdisplay = 320,
 + .hsync_start = 320 + 38,
 + .hsync_end = 320 + 38 + 20,
 + .htotal = 320 + 38 + 20 + 30,
 + .vdisplay = 240,
 + .vsync_start = 240 + 15,
 + .vsync_end = 240 + 15 + 4,
 + .vtotal = 240 + 15 + 4 + 3,
 + .vrefresh = 60,
 + .pol_flags = DRM_MODE_FLAG_POL_PIXDATA_NEGEDGE |
 +  DRM_MODE_FLAG_POL_DE_LOW,
 +};
 +
 +static const struct panel_desc eukrea_mbimxsd51_cmoqvga = {
 + .modes = eukrea_mbimxsd51_cmoqvga_mode,
 + .num_modes = 1,
 + .size = {
 + .width = 73,
 + .height = 56,
 + },
 +};
 +
 +static const struct drm_display_mode eukrea_mbimxsd51_dvisvga_mode = {
 + .clock = 44333,
 + .hdisplay = 800,
 + .hsync_start = 800 + 112,
 + .hsync_end = 800 + 112 + 32,
 + .htotal = 800 + 112 + 32 + 80,
 + .vdisplay = 600,
 + .vsync_start = 600 + 3,
 + .vsync_end = 600 + 3 + 17,
 + .vtotal = 600 + 3 + 17 + 4,
 + .vrefresh = 60,
 + .pol_flags = DRM_MODE_FLAG_POL_PIXDATA_POSEDGE |
 +  DRM_MODE_FLAG_POL_DE_HIGH,
 +};
 +
 +static const struct panel_desc eukrea_mbimxsd51_dvisvga = {
 + .modes = eukrea_mbimxsd51_dvisvga_mode,
 + .num_modes = 1,
 + /* This is a DVI adapter for external displays */
 + .size = {
 + .width = 0,
 + .height = 0,
 + },
 +};
 +
 +static const struct drm_display_mode eukrea_mbimxsd51_dvivga_mode = {
 +

Re: [PATCH 00/30] Initial CODA960 (i.MX6 VPU) support

2014-06-24 Thread Philipp Zabel
Hi Hans,

Am Montag, den 16.06.2014, 10:35 +0200 schrieb Hans Verkuil:
 Hi Philipp,
 
 I went through this patch series and replied with some comments.

thank you for the comments. I have dropped the force IDR patch in
v2 and will send a separate RFC for the VFU / forced keyframe
support.
I have also dropped the enum_framesizes patch for now.

 I have two more general questions:
 
 1) can you post the output of 'v4l2-compliance'?

This is for the v2 series, the previously posted patches still had
one TRY_FMT(G_FMT) != G_FMT error introduced by the [media] coda:
add bytesperline to queue data patch:

$ v4l2-compliance -d /dev/video8
Driver Info:
Driver name   : coda
Card type : CODA960
Bus info  : platform:coda
Driver version: 3.16.0
Capabilities  : 0x84008003
Video Capture
Video Output
Video Memory-to-Memory
Streaming
Device Capabilities
Device Caps   : 0x04008003
Video Capture
Video Output
Video Memory-to-Memory
Streaming

Compliance test for device /dev/video8 (not using libv4l2):

Required ioctls:
warn: v4l2-compliance.cpp(366): VIDIOC_QUERYCAP: m2m with video 
input and output caps
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
warn: v4l2-compliance.cpp(366): VIDIOC_QUERYCAP: m2m with video 
input and output caps
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported)
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported)
test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
test VIDIOC_ENUMAUDOUT: OK (Not Supported)
test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported)
test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported)
test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported)
test VIDIOC_G/S_EDID: OK (Not Supported)

Control ioctls:
test VIDIOC_QUERYCTRL/MENU: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK
test VIDIOC_G/S_JPEGCOMP: OK (Not Supported)
Standard Controls: 19 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK
test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported)
test VIDIOC_G_ENC_INDEX: OK (Not Supported)
test VIDIOC_(TRY_)DECODER_CMD: OK

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK

Total: 38, Succeeded: 38, Failed: 0, Warnings: 2

 2) what would be needed for 'v4l2-compliance -s' to work?

I haven't looked at this in detail yet. v4l2-compliance -s curently fails:

Buffer ioctls:
info: test buftype Video Capture
info: test buftype Video Output
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK
test VIDIOC_EXPBUF: OK
test read/write: OK (Not Supported)
fail: v4l2-test-buffers.cpp(859): ret != EINVAL
test MMAP: FAIL
fail: v4l2-test-buffers.cpp(936): buf.qbuf(q)
fail: v4l2-test-buffers.cpp(976): setupUserPtr(node, q)
test USERPTR: FAIL
test DMABUF: Cannot test, specify --expbuf-device

In principle the h.264 encoder should work, as you can just feed it
one frame at a time and then pick up the encoded result on the capture
side.

 For the encoder 'v4l2-compliance -s' will probably work OK, but for
 the decoder you need to feed v4l2-compliance -s some compressed
 stream. I assume each buffer should contain a single P/B/I frame?

Yes, for h.264 we currently expect all NAL units for a complete frame
in the source buffers.

 The v4l2-ctl utility has already support for writing captured data
 to a file, but it has no support to store the 

Re: [PATCH 08/30] [media] coda: add support for frame size enumeration

2014-06-24 Thread Philipp Zabel
Am Montag, den 16.06.2014, 10:08 +0200 schrieb Hans Verkuil:
 On 06/13/2014 06:08 PM, Philipp Zabel wrote:
  This patch adds support for the VIDIOC_ENUM_FRAMESIZES ioctl.
  When decoding H.264, the output frame size is rounded up to the
  next multiple of the macroblock size (16 pixels).
 
 Why do you need this? Implementing VIDIOC_ENUM_FRAMESIZES for a m2m device
 seems odd.

As soon as the OUTPUT side starts streaming, the possible buffer
dimensions on the CAPTURE side are fixed, but not necessarily the same
as on the OUTPUT side. Since GStreamer checks ENUM_FRAMESIZES before
trying to find the possible min/max dimensions via TRY_FMT, I just
implemented that.
Right now I could (and probably should) also implement this using just
TRY_FMT, but the JPEG decoder will also support decoding to half, 1/4
and 1/8 size, and I'd like to report that to userspace.

I'll postpone this patch for now.

regards
Philipp

--
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 v14 04/10] imx-drm: use defines for clock polarity settings

2014-06-24 Thread Russell King - ARM Linux
On Mon, Jun 16, 2014 at 12:11:18PM +0200, Denis Carikli wrote:
 Signed-off-by: Denis Carikli de...@eukrea.com

It would be nice to have a little more explanation in the commit messages
for these patches.  If you'd like to send me better commit messages for
these patches, I'll add them to what I already have:

imx-drm: use defines for clock polarity settings

imx-drm: add RGB666 support for parallel display.

It may also be worth describing the RGB666 format in the commit message
for:

v4l2: add new V4L2_PIX_FMT_RGB666 pixel format.

And... getting some more acks for these patches would be very useful,
I think I'd like to see Sascha's ack for these... Sascha?

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
--
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 18/30] [media] coda: let userspace force IDR frames by enabling the keyframe flag in the source buffer

2014-06-24 Thread Philipp Zabel
Am Montag, den 16.06.2014, 10:24 +0200 schrieb Hans Verkuil:
 On 06/13/2014 06:08 PM, Philipp Zabel wrote:
  This disables forcing IDR frames at GOP size intervals on CODA7541 and 
  CODA960,
  which is only needed to work around a firmware bug on CodaDx6.
  Instead, the V4L2_BUF_FLAG_KEYFRAME v4l2 buffer flag is cleared before 
  marking
  the source buffer done for dequeueing. Userspace can set it before queueing 
  a
  frame to force an IDR frame, to implement VFU (Video Fast Update).
 
 I'd like to see an RFC for this feature. Rather than 'misuse' it, I think this
 should be standardized. I have nothing against using KEYFRAME in order to
 implement VFU (in fact, I like it!), but it should be documented and 
 well-defined.

Thanks, I'll prepare a separate RFC for this.
The other possibility would be to use a V4L2_ENC_CMD for this feature.

One thing I'm not sure about is how to signal to userspace that this
feature is available when using the KEYFRAME clearing. With encoder
commands, TRY_COMMAND could be used. But when using the buffer KEYFRAME
bits, I suppose a flag would have to be introduced somewhere?

regards
Philipp

--
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 00/11] OMAP3 ISP BT.656 support

2014-06-24 Thread Enrico
On Tue, May 27, 2014 at 10:38 AM, Enrico ebut...@users.berlios.de wrote:
 On Mon, May 26, 2014 at 9:50 PM, Laurent Pinchart
 laurent.pinch...@ideasonboard.com wrote:
 Hello,

 This patch sets implements support for BT.656 and interlaced formats in the
 OMAP3 ISP driver. Better late than never I suppose, although given how long
 this has been on my to-do list there's probably no valid excuse.

 Thanks Laurent!

 I hope to have time soon to test it :)

Hi Laurent,

i wanted to try your patches but i'm having a problem (probably not
caused by your patches).

I merged media_tree master and omap3isp branches, applied your patches
and added camera platform data in pdata-quirks, but when loading the
omap3-isp driver i have:

omap3isp: clk_set_rate for cam_mclk failed

The returned value from clk_set_rate is -22 (EINVAL), but i can't see
any other debug message to track it down. Any ides?
I'm testing it on an igep proton (omap3530 version).

Thanks,

Enrico
--
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 06/29] [media] coda: Add encoder/decoder support for CODA960

2014-06-24 Thread Nicolas Dufresne
Le mardi 24 juin 2014 à 16:55 +0200, Philipp Zabel a écrit :
 This patch adds support for the CODA960 VPU in Freescale i.MX6 SoCs.
 
 It enables h.264 and MPEG4 encoding and decoding support. Besides the usual
 register shifting, the CODA960 gains frame memory control and GDI registers
 that are set up for linear mapping right now, needs ENC_PIC_SRC_INDEX to be
 set beyond the number of internal buffers for some reason, and has subsampling
 buffers that need to be set up. Also, the work buffer size is increased to
 80 KiB.
 
 The CODA960 firmware spins if there is not enough input data in the bitstream
 buffer. To make it continue, buffers need to be copied into the bitstream as
 soon as they are queued. As the bitstream fifo is written into from two 
 places,
 it must be protected with a mutex. For that, using a threaded interrupt 
 handler
 is necessary.
 
 Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 ---
  drivers/media/platform/coda.c | 397 
 +-
  drivers/media/platform/coda.h | 115 +++-
  2 files changed, 464 insertions(+), 48 deletions(-)
 
 diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
 index 50051fe..2da7e29 100644
 --- a/drivers/media/platform/coda.c
 +++ b/drivers/media/platform/coda.c
 @@ -44,19 +44,24 @@
  #define CODA_FMO_BUF_SIZE32
  #define CODADX6_WORK_BUF_SIZE(288 * 1024 + CODA_FMO_BUF_SIZE * 8 * 
 1024)
  #define CODA7_WORK_BUF_SIZE  (128 * 1024)
 +#define CODA9_WORK_BUF_SIZE  (80 * 1024)
  #define CODA7_TEMP_BUF_SIZE  (304 * 1024)
 +#define CODA9_TEMP_BUF_SIZE  (204 * 1024)
  #define CODA_PARA_BUF_SIZE   (10 * 1024)
  #define CODA_ISRAM_SIZE  (2048 * 2)
  #define CODADX6_IRAM_SIZE0xb000
  #define CODA7_IRAM_SIZE  0x14000
 +#define CODA9_IRAM_SIZE  0x21000
  
  #define CODA7_PS_BUF_SIZE0x28000
 +#define CODA9_PS_SAVE_SIZE   (512 * 1024)
  
  #define CODA_MAX_FRAMEBUFFERS8
  
  #define CODA_MAX_FRAME_SIZE  0x10
  #define FMO_SLICE_SAVE_BUF_SIZE (32)
  #define CODA_DEFAULT_GAMMA   4096
 +#define CODA9_DEFAULT_GAMMA  24576   /* 0.75 * 32768 */
  
  #define MIN_W 176
  #define MIN_H 144
 @@ -84,6 +89,7 @@ enum coda_inst_type {
  enum coda_product {
   CODA_DX6 = 0xf001,
   CODA_7541 = 0xf012,
 + CODA_960 = 0xf020,
  };
  
  struct coda_fmt {
 @@ -177,6 +183,16 @@ struct coda_iram_info {
   phys_addr_t next_paddr;
  };
  
 +struct gdi_tiled_map {
 + int xy2ca_map[16];
 + int xy2ba_map[16];
 + int xy2ra_map[16];
 + int rbc2axi_map[32];
 + int xy2rbc_config;
 + int map_type;
 +#define GDI_LINEAR_FRAME_MAP 0
 +};
 +
  struct coda_ctx {
   struct coda_dev *dev;
   struct mutexbuffer_mutex;
 @@ -215,8 +231,10 @@ struct coda_ctx {
   int idx;
   int reg_idx;
   struct coda_iram_info   iram_info;
 + struct gdi_tiled_maptiled_map;
   u32 bit_stream_param;
   u32 frm_dis_flg;
 + u32 frame_mem_ctrl;
   int display_idx;
  };
  
 @@ -265,15 +283,23 @@ static void coda_command_async(struct coda_ctx *ctx, 
 int cmd)
  {
   struct coda_dev *dev = ctx-dev;
  
 - if (dev-devtype-product == CODA_7541) {
 + if (dev-devtype-product == CODA_960 ||
 + dev-devtype-product == CODA_7541) {
   /* Restore context related registers to CODA */
   coda_write(dev, ctx-bit_stream_param,
   CODA_REG_BIT_BIT_STREAM_PARAM);
   coda_write(dev, ctx-frm_dis_flg,
   CODA_REG_BIT_FRM_DIS_FLG(ctx-reg_idx));
 + coda_write(dev, ctx-frame_mem_ctrl,
 + CODA_REG_BIT_FRAME_MEM_CTRL);
   coda_write(dev, ctx-workbuf.paddr, CODA_REG_BIT_WORK_BUF_ADDR);
   }
  
 + if (dev-devtype-product == CODA_960) {
 + coda_write(dev, 1, CODA9_GDI_WPROT_ERR_CLR);
 + coda_write(dev, 0, CODA9_GDI_WPROT_RGN_EN);
 + }
 +
   coda_write(dev, CODA_REG_BIT_BUSY_FLAG, CODA_REG_BIT_BUSY);
  
   coda_write(dev, ctx-idx, CODA_REG_BIT_RUN_INDEX);
 @@ -349,6 +375,13 @@ static struct coda_codec coda7_codecs[] = {
   CODA_CODEC(CODA7_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
 V4L2_PIX_FMT_YUV420, 1920, 1080),
  };
  
 +static struct coda_codec coda9_codecs[] = {
 + CODA_CODEC(CODA9_MODE_ENCODE_H264, V4L2_PIX_FMT_YUV420, 
 V4L2_PIX_FMT_H264,   1920, 1080),
 + CODA_CODEC(CODA9_MODE_ENCODE_MP4,  V4L2_PIX_FMT_YUV420, 
 V4L2_PIX_FMT_MPEG4,  1920, 1080),
 + CODA_CODEC(CODA9_MODE_DECODE_H264, V4L2_PIX_FMT_H264,   
 V4L2_PIX_FMT_YUV420, 1920, 1080),
 + CODA_CODEC(CODA9_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
 V4L2_PIX_FMT_YUV420, 1920, 1080),
 +};
 +
  static bool coda_format_is_yuv(u32 

Re: [PATCH v14 04/10] imx-drm: use defines for clock polarity settings

2014-06-24 Thread Denis Carikli

On 06/24/2014 05:13 PM, Russell King - ARM Linux wrote:
[...]

If you'd like to send me better commit messages for
these patches, I'll add them to what I already have:



imx-drm: use defines for clock polarity settings
The comment of the clk_pol field of the ipu_di_signal_cfg struct was 
inverted.

Instead of merely inverting the comment, the values of clk_pol were defined.


imx-drm: add RGB666 support for parallel display.

This permits to drive parallel displays that expect the RGB666 color format.


It may also be worth describing the RGB666 format in the commit message
for:

v4l2: add new V4L2_PIX_FMT_RGB666 pixel format.
The RGB666 color format encodes 6 bits for each color(red, green and 
blue), linearly.

It looks like this in memory:
017
RRGGBB

Denis.
--
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 v14 04/10] imx-drm: use defines for clock polarity settings

2014-06-24 Thread Russell King - ARM Linux
On Tue, Jun 24, 2014 at 06:25:19PM +0200, Denis Carikli wrote:
 On 06/24/2014 05:13 PM, Russell King - ARM Linux wrote:
 [...]
 If you'd like to send me better commit messages for
 these patches, I'll add them to what I already have:

  imx-drm: use defines for clock polarity settings
 The comment of the clk_pol field of the ipu_di_signal_cfg struct was  
 inverted.
 Instead of merely inverting the comment, the values of clk_pol were defined.

s/inverting/fixing/


  imx-drm: add RGB666 support for parallel display.
 This permits to drive parallel displays that expect the RGB666 color format.

This allows imx-drm to drive ...


 It may also be worth describing the RGB666 format in the commit message
 for:

  v4l2: add new V4L2_PIX_FMT_RGB666 pixel format.
 The RGB666 color format encodes 6 bits for each color(red, green and  
 blue), linearly.
 It looks like this in memory:
 017
 RRGGBB

Thanks! I've tweaked them very slightly as detailed above so they read a
bit better.

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.
--
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 06/30] [media] coda: Add encoder/decoder support for CODA960

2014-06-24 Thread Nicolas Dufresne
Le vendredi 13 juin 2014 à 18:08 +0200, Philipp Zabel a écrit :
 This patch adds support for the CODA960 VPU in Freescale i.MX6 SoCs.

I might be confused, but is this driver sharing the same device node for
the encoder and the decoder ? If so why ? I know the spec might not be
preventing it, but I don't know how in userspace I'm supposed to figure
the type of m2m node this is ? Other drivers have decided to split
encoding, decoding and transformation into their own node, which made it
easier to use generically.

 
 It enables h.264 and MPEG4 encoding and decoding support. Besides the usual
 register shifting, the CODA960 gains frame memory control and GDI registers
 that are set up for linear mapping right now, needs ENC_PIC_SRC_INDEX to be
 set beyond the number of internal buffers for some reason, and has subsampling
 buffers that need to be set up. Also, the work buffer size is increased to
 80 KiB.
 
 The CODA960 firmware spins if there is not enough input data in the bitstream
 buffer. To make it continue, buffers need to be copied into the bitstream as
 soon as they are queued. As the bitstream fifo is written into from two 
 places,
 it must be protected with a mutex. For that, using a threaded interrupt 
 handler
 is necessary.
 
 Signed-off-by: Philipp Zabel p.za...@pengutronix.de
 ---
  drivers/media/platform/coda.c | 397 
 +-
  drivers/media/platform/coda.h | 115 +++-
  2 files changed, 464 insertions(+), 48 deletions(-)
 
 diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
 index 2b27998..10cc031 100644
 --- a/drivers/media/platform/coda.c
 +++ b/drivers/media/platform/coda.c
 @@ -44,19 +44,24 @@
  #define CODA_FMO_BUF_SIZE32
  #define CODADX6_WORK_BUF_SIZE(288 * 1024 + CODA_FMO_BUF_SIZE * 8 * 
 1024)
  #define CODA7_WORK_BUF_SIZE  (128 * 1024)
 +#define CODA9_WORK_BUF_SIZE  (80 * 1024)
  #define CODA7_TEMP_BUF_SIZE  (304 * 1024)
 +#define CODA9_TEMP_BUF_SIZE  (204 * 1024)
  #define CODA_PARA_BUF_SIZE   (10 * 1024)
  #define CODA_ISRAM_SIZE  (2048 * 2)
  #define CODADX6_IRAM_SIZE0xb000
  #define CODA7_IRAM_SIZE  0x14000
 +#define CODA9_IRAM_SIZE  0x21000
  
  #define CODA7_PS_BUF_SIZE0x28000
 +#define CODA9_PS_SAVE_SIZE   (512 * 1024)
  
  #define CODA_MAX_FRAMEBUFFERS8
  
  #define CODA_MAX_FRAME_SIZE  0x10
  #define FMO_SLICE_SAVE_BUF_SIZE (32)
  #define CODA_DEFAULT_GAMMA   4096
 +#define CODA9_DEFAULT_GAMMA  24576   /* 0.75 * 32768 */
  
  #define MIN_W 176
  #define MIN_H 144
 @@ -84,6 +89,7 @@ enum coda_inst_type {
  enum coda_product {
   CODA_DX6 = 0xf001,
   CODA_7541 = 0xf012,
 + CODA_960 = 0xf020,
  };
  
  struct coda_fmt {
 @@ -177,6 +183,16 @@ struct coda_iram_info {
   phys_addr_t next_paddr;
  };
  
 +struct gdi_tiled_map {
 + int xy2ca_map[16];
 + int xy2ba_map[16];
 + int xy2ra_map[16];
 + int rbc2axi_map[32];
 + int xy2rbc_config;
 + int map_type;
 +#define GDI_LINEAR_FRAME_MAP 0
 +};
 +
  struct coda_ctx {
   struct coda_dev *dev;
   struct mutexbuffer_mutex;
 @@ -215,8 +231,10 @@ struct coda_ctx {
   int idx;
   int reg_idx;
   struct coda_iram_info   iram_info;
 + struct gdi_tiled_maptiled_map;
   u32 bit_stream_param;
   u32 frm_dis_flg;
 + u32 frame_mem_ctrl;
   int display_idx;
  };
  
 @@ -265,15 +283,23 @@ static void coda_command_async(struct coda_ctx *ctx, 
 int cmd)
  {
   struct coda_dev *dev = ctx-dev;
  
 - if (dev-devtype-product == CODA_7541) {
 + if (dev-devtype-product == CODA_960 ||
 + dev-devtype-product == CODA_7541) {
   /* Restore context related registers to CODA */
   coda_write(dev, ctx-bit_stream_param,
   CODA_REG_BIT_BIT_STREAM_PARAM);
   coda_write(dev, ctx-frm_dis_flg,
   CODA_REG_BIT_FRM_DIS_FLG(ctx-reg_idx));
 + coda_write(dev, ctx-frame_mem_ctrl,
 + CODA_REG_BIT_FRAME_MEM_CTRL);
   coda_write(dev, ctx-workbuf.paddr, CODA_REG_BIT_WORK_BUF_ADDR);
   }
  
 + if (dev-devtype-product == CODA_960) {
 + coda_write(dev, 1, CODA9_GDI_WPROT_ERR_CLR);
 + coda_write(dev, 0, CODA9_GDI_WPROT_RGN_EN);
 + }
 +
   coda_write(dev, CODA_REG_BIT_BUSY_FLAG, CODA_REG_BIT_BUSY);
  
   coda_write(dev, ctx-idx, CODA_REG_BIT_RUN_INDEX);
 @@ -349,6 +375,13 @@ static struct coda_codec coda7_codecs[] = {
   CODA_CODEC(CODA7_MODE_DECODE_MP4,  V4L2_PIX_FMT_MPEG4,  
 V4L2_PIX_FMT_YUV420, 1920, 1080),
  };
  
 +static struct coda_codec coda9_codecs[] = {
 + CODA_CODEC(CODA9_MODE_ENCODE_H264, 

Re: [PATCH 00/11] OMAP3 ISP BT.656 support

2014-06-24 Thread Stefan Herbrechtsmeier

Am 24.06.2014 17:19, schrieb Enrico:

On Tue, May 27, 2014 at 10:38 AM, Enrico ebut...@users.berlios.de wrote:

On Mon, May 26, 2014 at 9:50 PM, Laurent Pinchart
laurent.pinch...@ideasonboard.com wrote:

Hello,

This patch sets implements support for BT.656 and interlaced formats in the
OMAP3 ISP driver. Better late than never I suppose, although given how long
this has been on my to-do list there's probably no valid excuse.

Thanks Laurent!

I hope to have time soon to test it :)

i wanted to try your patches but i'm having a problem (probably not
caused by your patches).

I merged media_tree master and omap3isp branches, applied your patches
and added camera platform data in pdata-quirks, but when loading the
omap3-isp driver i have:

omap3isp: clk_set_rate for cam_mclk failed

The returned value from clk_set_rate is -22 (EINVAL), but i can't see
any other debug message to track it down. Any ides?
I'm testing it on an igep proton (omap3530 version).

Hi Enrico,

please test the attached patch. It is based on Laurent's patches for the 
clock and boot testes on an Gumstix Overo with an OMAP3530.


Regards,
  Stefan

From 9f8162ddebf7636e60101f0831d071e73ab6df75 Mon Sep 17 00:00:00 2001
From: Stefan Herbrechtsmeier ste...@herbrechtsmeier.net
Date: Fri, 13 Jun 2014 18:15:56 +0200
Subject: [PATCH 21/25] ARM: dts: set 'ti,set-rate-parent' for dpll4_m5x2 clock

Set 'ti,set-rate-parent' property for the dpll4_m5x2_ck clock, which
is used for the ISP functional clock. This fixes the OMAP3 ISP driver's
clock rate configuration on OMAP34xx, which needs the rate to be
propagated properly to the divider node (dpll4_m5_ck).

Signed-off-by: Stefan Herbrechtsmeier ste...@herbrechtsmeier.net
---
 arch/arm/boot/dts/omap3xxx-clocks.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/omap3xxx-clocks.dtsi b/arch/arm/boot/dts/omap3xxx-clocks.dtsi
index 25adab1..beeff7c 100644
--- a/arch/arm/boot/dts/omap3xxx-clocks.dtsi
+++ b/arch/arm/boot/dts/omap3xxx-clocks.dtsi
@@ -465,6 +465,7 @@
 		ti,bit-shift = 0x1e;
 		reg = 0x0d00;
 		ti,set-bit-to-disable;
+		ti,set-rate-parent;
 	};
 
 	dpll4_m6_ck: dpll4_m6_ck {
-- 
2.0.0



Re: [PATCH v14 08/10] drm/panel: Add Eukrea mbimxsd51 displays.

2014-06-24 Thread Rob Herring
On Tue, Jun 24, 2014 at 10:06 AM, Russell King - ARM Linux
li...@arm.linux.org.uk wrote:
 Denis,

 This patch creates binding documentation.  Any patch which does so
 should be copied to the DT people so they can review the bindings
 and give appropriate acks.  It would be better if you separate the
 binding documentation updates from the other functional changes too.

 I've added them on this reply to see whether they'll feel friendly
 enough to comment on the patch as it stands to avoid having to go
 through two more rounds on this already-fourteen revision patch set.

 On Mon, Jun 16, 2014 at 12:11:22PM +0200, Denis Carikli wrote:
 Signed-off-by: Denis Carikli de...@eukrea.com
 ---
 ChangeLog v13-v14:
 - None

 ChangeLog v12-v13:
 - Added a note explaining why the size is zero in
   the eukrea_mbimxsd51_dvi(s)vga structs.
 ChangeLog v11-v12:
 - Rebased: It now uses the new DRM_MODE_FLAG_POL_DE flags defines names

 ChangeLog v10-v11:
 - New patch.
 ---
  .../bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt   |7 ++
  .../bindings/panel/eukrea,mbimxsd51-dvi-svga.txt   |7 ++
  .../bindings/panel/eukrea,mbimxsd51-dvi-vga.txt|7 ++
  drivers/gpu/drm/panel/panel-simple.c   |   83 
 
  4 files changed, 104 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
  create mode 100644 
 Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
  create mode 100644 
 Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt

 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
 new file mode 100644
 index 000..03679d0
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-cmo-qvga.txt
 @@ -0,0 +1,7 @@
 +Eukrea CMO-QVGA (320x240 pixels) TFT LCD panel
 +
 +Required properties:
 +- compatible: should be eukrea,mbimxsd51-cmo-qvga
 +
 +This binding is compatible with the simple-panel binding, which is specified
 +in simple-panel.txt in this directory.
 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
 new file mode 100644
 index 000..f408c9a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
 @@ -0,0 +1,7 @@
 +Eukrea DVI-SVGA (800x600 pixels) DVI output.
 +
 +Required properties:
 +- compatible: should be eukrea,mbimxsd51-dvi-svga
 +
 +This binding is compatible with the simple-panel binding, which is specified
 +in simple-panel.txt in this directory.
 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
 new file mode 100644
 index 000..8ea90da
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
 @@ -0,0 +1,7 @@
 +Eukrea DVI-VGA (640x480 pixels) DVI output.
 +
 +Required properties:
 +- compatible: should be eukrea,mbimxsd51-dvi-vga
 +
 +This binding is compatible with the simple-panel binding, which is specified
 +in simple-panel.txt in this directory.

Seems like we could just have a list of compatible strings rather than
a mostly duplicated file.

 diff --git a/drivers/gpu/drm/panel/panel-simple.c 
 b/drivers/gpu/drm/panel/panel-simple.c
 index a251361..adc40a7 100644
 --- a/drivers/gpu/drm/panel/panel-simple.c
 +++ b/drivers/gpu/drm/panel/panel-simple.c
 @@ -403,6 +403,80 @@ static const struct panel_desc edt_etm0700g0dh6 = {
   },
  };

 +static const struct drm_display_mode eukrea_mbimxsd51_cmoqvga_mode = {
 + .clock = 6500,
 + .hdisplay = 320,
 + .hsync_start = 320 + 38,
 + .hsync_end = 320 + 38 + 20,
 + .htotal = 320 + 38 + 20 + 30,
 + .vdisplay = 240,
 + .vsync_start = 240 + 15,
 + .vsync_end = 240 + 15 + 4,
 + .vtotal = 240 + 15 + 4 + 3,
 + .vrefresh = 60,
 + .pol_flags = DRM_MODE_FLAG_POL_PIXDATA_NEGEDGE |
 +  DRM_MODE_FLAG_POL_DE_LOW,

Why aren't you using:

Documentation/devicetree/bindings/video/display-timing.txt

Rob
--
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][libdvbv5] dvb-sat: add universal Ku band (extended) LNBF def

2014-06-24 Thread Reynaldo H. Verdejo Pinochet
These are quite common and off the shelf, universal
Ku band LBNFs. They started been used in Europe
after the lunch of the Astra 1E and can be found
pretty much everywhere.

Signed-off-by: Reynaldo H. Verdejo Pinochet r.verd...@sisa.samsung.com
---
 lib/libdvbv5/dvb-sat.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/lib/libdvbv5/dvb-sat.c b/lib/libdvbv5/dvb-sat.c
index df2ffcd..4c7d2cd 100644
--- a/lib/libdvbv5/dvb-sat.c
+++ b/lib/libdvbv5/dvb-sat.c
@@ -44,6 +44,16 @@ static const struct dvb_sat_lnb lnb[] = {
.freqrange = {
{ 12200, 12700 }
}
+}, {
+.name = Astra 1E, European Universal Ku (extended),
+.alias = EXTENDEDU,
+   .lowfreq = 9750,
+   .highfreq = 10600,
+   .rangeswitch = 11700,
+   .freqrange = {
+   { 10700, 11700 },
+   { 11700, 12750 },
+   }
}, {
.name = Standard,
.alias = STANDARD,
-- 
2.0.0

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


[PATCH 1/2] [media] Remove checks of struct member addresses

2014-06-24 Thread Emil Goode
This removes checks of struct member addresses since they likely result
in the condition always being true. Also in the stb6100_get_bandwidth
and tda8261_get_bandwidth functions the pointers frontend_ops and
tuner_ops are assigned the same addresses twice.

Signed-off-by: Emil Goode emilgo...@gmail.com
---
 drivers/media/dvb-frontends/stb6100_cfg.h  |   30 +++-
 drivers/media/dvb-frontends/stb6100_proc.h |   34 
 drivers/media/dvb-frontends/stv0367.c  |9 ++--
 drivers/media/dvb-frontends/tda8261_cfg.h  |   21 -
 4 files changed, 25 insertions(+), 69 deletions(-)

diff --git a/drivers/media/dvb-frontends/stb6100_cfg.h 
b/drivers/media/dvb-frontends/stb6100_cfg.h
index 6314d18..0e10ad89 100644
--- a/drivers/media/dvb-frontends/stb6100_cfg.h
+++ b/drivers/media/dvb-frontends/stb6100_cfg.h
@@ -21,15 +21,11 @@
 
 static int stb6100_get_frequency(struct dvb_frontend *fe, u32 *frequency)
 {
-   struct dvb_frontend_ops *frontend_ops = NULL;
-   struct dvb_tuner_ops*tuner_ops = NULL;
+   struct dvb_frontend_ops *frontend_ops = fe-ops;
+   struct dvb_tuner_ops*tuner_ops = frontend_ops-tuner_ops;
struct tuner_state  t_state;
int err = 0;
 
-   if (fe-ops)
-   frontend_ops = fe-ops;
-   if (frontend_ops-tuner_ops)
-   tuner_ops = frontend_ops-tuner_ops;
if (tuner_ops-get_state) {
if ((err = tuner_ops-get_state(fe, DVBFE_TUNER_FREQUENCY, 
t_state))  0) {
printk(%s: Invalid parameter\n, __func__);
@@ -42,16 +38,13 @@ static int stb6100_get_frequency(struct dvb_frontend *fe, 
u32 *frequency)
 
 static int stb6100_set_frequency(struct dvb_frontend *fe, u32 frequency)
 {
-   struct dvb_frontend_ops *frontend_ops = NULL;
-   struct dvb_tuner_ops*tuner_ops = NULL;
+   struct dvb_frontend_ops *frontend_ops = fe-ops;
+   struct dvb_tuner_ops*tuner_ops = frontend_ops-tuner_ops;
struct tuner_state  t_state;
int err = 0;
 
t_state.frequency = frequency;
-   if (fe-ops)
-   frontend_ops = fe-ops;
-   if (frontend_ops-tuner_ops)
-   tuner_ops = frontend_ops-tuner_ops;
+
if (tuner_ops-set_state) {
if ((err = tuner_ops-set_state(fe, DVBFE_TUNER_FREQUENCY, 
t_state))  0) {
printk(%s: Invalid parameter\n, __func__);
@@ -68,10 +61,6 @@ static int stb6100_get_bandwidth(struct dvb_frontend *fe, 
u32 *bandwidth)
struct tuner_state  t_state;
int err = 0;
 
-   if (fe-ops)
-   frontend_ops = fe-ops;
-   if (frontend_ops-tuner_ops)
-   tuner_ops = frontend_ops-tuner_ops;
if (tuner_ops-get_state) {
if ((err = tuner_ops-get_state(fe, DVBFE_TUNER_BANDWIDTH, 
t_state))  0) {
printk(%s: Invalid parameter\n, __func__);
@@ -84,16 +73,13 @@ static int stb6100_get_bandwidth(struct dvb_frontend *fe, 
u32 *bandwidth)
 
 static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
 {
-   struct dvb_frontend_ops *frontend_ops = NULL;
-   struct dvb_tuner_ops*tuner_ops = NULL;
+   struct dvb_frontend_ops *frontend_ops = fe-ops;
+   struct dvb_tuner_ops*tuner_ops = frontend_ops-tuner_ops;
struct tuner_state  t_state;
int err = 0;
 
t_state.bandwidth = bandwidth;
-   if (fe-ops)
-   frontend_ops = fe-ops;
-   if (frontend_ops-tuner_ops)
-   tuner_ops = frontend_ops-tuner_ops;
+
if (tuner_ops-set_state) {
if ((err = tuner_ops-set_state(fe, DVBFE_TUNER_BANDWIDTH, 
t_state))  0) {
printk(%s: Invalid parameter\n, __func__);
diff --git a/drivers/media/dvb-frontends/stb6100_proc.h 
b/drivers/media/dvb-frontends/stb6100_proc.h
index 112163a..bd8a0ec 100644
--- a/drivers/media/dvb-frontends/stb6100_proc.h
+++ b/drivers/media/dvb-frontends/stb6100_proc.h
@@ -19,15 +19,11 @@
 
 static int stb6100_get_freq(struct dvb_frontend *fe, u32 *frequency)
 {
-   struct dvb_frontend_ops *frontend_ops = NULL;
-   struct dvb_tuner_ops*tuner_ops = NULL;
+   struct dvb_frontend_ops *frontend_ops = fe-ops;
+   struct dvb_tuner_ops*tuner_ops = frontend_ops-tuner_ops;
struct tuner_state  state;
int err = 0;
 
-   if (fe-ops)
-   frontend_ops = fe-ops;
-   if (frontend_ops-tuner_ops)
-   tuner_ops = frontend_ops-tuner_ops;
if (tuner_ops-get_state) {
if (frontend_ops-i2c_gate_ctrl)
frontend_ops-i2c_gate_ctrl(fe, 1);
@@ -49,16 +45,13 @@ static int stb6100_get_freq(struct dvb_frontend *fe, u32 
*frequency)
 
 static int stb6100_set_freq(struct dvb_frontend *fe, u32 frequency)
 {
-   struct dvb_frontend_ops *frontend_ops = NULL;
-   struct dvb_tuner_ops*tuner_ops = NULL;
+   struct 

[PATCH 2/2] [media] Cleanup line 80 character violations

2014-06-24 Thread Emil Goode
This cleans up some line over 80 character violations.

Signed-off-by: Emil Goode emilgo...@gmail.com
---
 drivers/media/dvb-frontends/stb6100_cfg.h |   12 
 drivers/media/dvb-frontends/tda8261_cfg.h |9 ++---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/media/dvb-frontends/stb6100_cfg.h 
b/drivers/media/dvb-frontends/stb6100_cfg.h
index 0e10ad89..6edc153 100644
--- a/drivers/media/dvb-frontends/stb6100_cfg.h
+++ b/drivers/media/dvb-frontends/stb6100_cfg.h
@@ -27,7 +27,8 @@ static int stb6100_get_frequency(struct dvb_frontend *fe, u32 
*frequency)
int err = 0;
 
if (tuner_ops-get_state) {
-   if ((err = tuner_ops-get_state(fe, DVBFE_TUNER_FREQUENCY, 
t_state))  0) {
+   err = tuner_ops-get_state(fe, DVBFE_TUNER_FREQUENCY, t_state);
+   if (err  0) {
printk(%s: Invalid parameter\n, __func__);
return err;
}
@@ -46,7 +47,8 @@ static int stb6100_set_frequency(struct dvb_frontend *fe, u32 
frequency)
t_state.frequency = frequency;
 
if (tuner_ops-set_state) {
-   if ((err = tuner_ops-set_state(fe, DVBFE_TUNER_FREQUENCY, 
t_state))  0) {
+   err = tuner_ops-set_state(fe, DVBFE_TUNER_FREQUENCY, t_state);
+   if (err  0) {
printk(%s: Invalid parameter\n, __func__);
return err;
}
@@ -62,7 +64,8 @@ static int stb6100_get_bandwidth(struct dvb_frontend *fe, u32 
*bandwidth)
int err = 0;
 
if (tuner_ops-get_state) {
-   if ((err = tuner_ops-get_state(fe, DVBFE_TUNER_BANDWIDTH, 
t_state))  0) {
+   err = tuner_ops-get_state(fe, DVBFE_TUNER_BANDWIDTH, t_state);
+   if (err  0) {
printk(%s: Invalid parameter\n, __func__);
return err;
}
@@ -81,7 +84,8 @@ static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 
bandwidth)
t_state.bandwidth = bandwidth;
 
if (tuner_ops-set_state) {
-   if ((err = tuner_ops-set_state(fe, DVBFE_TUNER_BANDWIDTH, 
t_state))  0) {
+   err = tuner_ops-set_state(fe, DVBFE_TUNER_BANDWIDTH, t_state);
+   if (err  0) {
printk(%s: Invalid parameter\n, __func__);
return err;
}
diff --git a/drivers/media/dvb-frontends/tda8261_cfg.h 
b/drivers/media/dvb-frontends/tda8261_cfg.h
index 7de65c3..04a19e1 100644
--- a/drivers/media/dvb-frontends/tda8261_cfg.h
+++ b/drivers/media/dvb-frontends/tda8261_cfg.h
@@ -25,7 +25,8 @@ static int tda8261_get_frequency(struct dvb_frontend *fe, u32 
*frequency)
int err = 0;
 
if (tuner_ops-get_state) {
-   if ((err = tuner_ops-get_state(fe, DVBFE_TUNER_FREQUENCY, 
t_state))  0) {
+   err = tuner_ops-get_state(fe, DVBFE_TUNER_FREQUENCY, t_state);
+   if (err  0) {
printk(%s: Invalid parameter\n, __func__);
return err;
}
@@ -45,7 +46,8 @@ static int tda8261_set_frequency(struct dvb_frontend *fe, u32 
frequency)
t_state.frequency = frequency;
 
if (tuner_ops-set_state) {
-   if ((err = tuner_ops-set_state(fe, DVBFE_TUNER_FREQUENCY, 
t_state))  0) {
+   err = tuner_ops-set_state(fe, DVBFE_TUNER_FREQUENCY, t_state);
+   if (err  0) {
printk(%s: Invalid parameter\n, __func__);
return err;
}
@@ -62,7 +64,8 @@ static int tda8261_get_bandwidth(struct dvb_frontend *fe, u32 
*bandwidth)
int err = 0;
 
if (tuner_ops-get_state) {
-   if ((err = tuner_ops-get_state(fe, DVBFE_TUNER_BANDWIDTH, 
t_state))  0) {
+   err = tuner_ops-get_state(fe, DVBFE_TUNER_BANDWIDTH, t_state);
+   if (err  0) {
printk(%s: Invalid parameter\n, __func__);
return err;
}
-- 
1.7.10.4

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


Re: [PATCH v14 08/10] drm/panel: Add Eukrea mbimxsd51 displays.

2014-06-24 Thread Thierry Reding
On Mon, Jun 16, 2014 at 12:11:22PM +0200, Denis Carikli wrote:
[...]
 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
[...]
 @@ -0,0 +1,7 @@
 +Eukrea DVI-SVGA (800x600 pixels) DVI output.
[...]
 diff --git 
 a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt 
 b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
[...]
 @@ -0,0 +1,7 @@
 +Eukrea DVI-VGA (640x480 pixels) DVI output.

DVI outputs shouldn't be using the panel framework and this binding at
all. DVI usually has the means to determine all of this by itself. Why
do you need to represent this as a panel in device tree?

Thierry


pgpuEcZ4BBFxh.pgp
Description: PGP signature


Re: [PATCH v14 08/10] drm/panel: Add Eukrea mbimxsd51 displays.

2014-06-24 Thread Eric Bénard
Hi Thierry,

Le Tue, 24 Jun 2014 23:49:37 +0200,
Thierry Reding thierry.red...@gmail.com a écrit :

 On Mon, Jun 16, 2014 at 12:11:22PM +0200, Denis Carikli wrote:
 [...]
  diff --git 
  a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt 
  b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
 [...]
  @@ -0,0 +1,7 @@
  +Eukrea DVI-SVGA (800x600 pixels) DVI output.
 [...]
  diff --git 
  a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt 
  b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
 [...]
  @@ -0,0 +1,7 @@
  +Eukrea DVI-VGA (640x480 pixels) DVI output.
 
 DVI outputs shouldn't be using the panel framework and this binding at
 all. DVI usually has the means to determine all of this by itself. Why
 do you need to represent this as a panel in device tree?
 
because on this very simple display board, we only have DVI LVDS signals
without the I2C to detect the display.

Best regards
Eric
--
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 v14 08/10] drm/panel: Add Eukrea mbimxsd51 displays.

2014-06-24 Thread Thierry Reding
On Tue, Jun 24, 2014 at 02:52:11PM -0500, Rob Herring wrote:
 On Tue, Jun 24, 2014 at 10:06 AM, Russell King - ARM Linux 
 li...@arm.linux.org.uk wrote:
[...]
  On Mon, Jun 16, 2014 at 12:11:22PM +0200, Denis Carikli wrote:
[...]
  diff --git 
  a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt 
  b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
[...]
  @@ -0,0 +1,7 @@
  +Eukrea DVI-VGA (640x480 pixels) DVI output.
  +
  +Required properties:
  +- compatible: should be eukrea,mbimxsd51-dvi-vga
  +
  +This binding is compatible with the simple-panel binding, which is 
  specified
  +in simple-panel.txt in this directory.
 
 Seems like we could just have a list of compatible strings rather than
 a mostly duplicated file.

We've been doing it this way for all other panels.

  diff --git a/drivers/gpu/drm/panel/panel-simple.c 
  b/drivers/gpu/drm/panel/panel-simple.c
  index a251361..adc40a7 100644
  --- a/drivers/gpu/drm/panel/panel-simple.c
  +++ b/drivers/gpu/drm/panel/panel-simple.c
  @@ -403,6 +403,80 @@ static const struct panel_desc edt_etm0700g0dh6 = {
},
   };
 
  +static const struct drm_display_mode eukrea_mbimxsd51_cmoqvga_mode = {
  + .clock = 6500,
  + .hdisplay = 320,
  + .hsync_start = 320 + 38,
  + .hsync_end = 320 + 38 + 20,
  + .htotal = 320 + 38 + 20 + 30,
  + .vdisplay = 240,
  + .vsync_start = 240 + 15,
  + .vsync_end = 240 + 15 + 4,
  + .vtotal = 240 + 15 + 4 + 3,
  + .vrefresh = 60,
  + .pol_flags = DRM_MODE_FLAG_POL_PIXDATA_NEGEDGE |
  +  DRM_MODE_FLAG_POL_DE_LOW,
 
 Why aren't you using:
 
 Documentation/devicetree/bindings/video/display-timing.txt

Because it's redundant information. We need to have a compatible for the
panel in the device tree anyway and that already implicitly defines the
display mode.

Thierry


pgprSon35YW3J.pgp
Description: PGP signature


Re: [PATCH v14 08/10] drm/panel: Add Eukrea mbimxsd51 displays.

2014-06-24 Thread Thierry Reding
On Tue, Jun 24, 2014 at 11:56:39PM +0200, Eric Bénard wrote:
 Hi Thierry,
 
 Le Tue, 24 Jun 2014 23:49:37 +0200,
 Thierry Reding thierry.red...@gmail.com a écrit :
 
  On Mon, Jun 16, 2014 at 12:11:22PM +0200, Denis Carikli wrote:
  [...]
   diff --git 
   a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt 
   b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-svga.txt
  [...]
   @@ -0,0 +1,7 @@
   +Eukrea DVI-SVGA (800x600 pixels) DVI output.
  [...]
   diff --git 
   a/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt 
   b/Documentation/devicetree/bindings/panel/eukrea,mbimxsd51-dvi-vga.txt
  [...]
   @@ -0,0 +1,7 @@
   +Eukrea DVI-VGA (640x480 pixels) DVI output.
  
  DVI outputs shouldn't be using the panel framework and this binding at
  all. DVI usually has the means to determine all of this by itself. Why
  do you need to represent this as a panel in device tree?
  
 because on this very simple display board, we only have DVI LVDS signals
 without the I2C to detect the display.

That's unfortunate. In that case perhaps a better approach would be to
add a video timings node to the device that provides the DVI output?

The panel bindings are really for internal panels and should define all
of their properties. That's also why they need a specific compatible
string.

What the above two bindings define are really connectors with a fixed
resolution rather than panels.

Thierry


pgpB2GyghDLMb.pgp
Description: PGP signature


Re: [PATCH v14 06/10] drm: drm_display_mode: add signal polarity flags

2014-06-24 Thread Thierry Reding
On Tue, Jun 24, 2014 at 03:57:46PM +0100, Russell King - ARM Linux wrote:
 On Mon, Jun 16, 2014 at 12:11:20PM +0200, Denis Carikli wrote:
  We need a way to pass signal polarity informations
between DRM panels, and the display drivers.
  
  To do that, a pol_flags field was added to drm_display_mode.
  
  Signed-off-by: Denis Carikli de...@eukrea.com
 
 This patch needs an ack from the DRM people - can someone review it
 please?  This series has now been round 14 revisions and it's about
 time it was properly reviewed - or a statement made if it's
 unacceptable.

I didn't follow all of the earlier discussions around this, but it seems
to me like data-enable polarity and the pixel data edge flags are
properties of the interface rather than the video mode.

struct drm_display_mode represents the video timings and I'm not sure if
it's a good idea to extend it with this type of information.

Maybe we need to add a separate type of device to store these parameters
(much like we've done for MIPI DSI devices).

Thierry


pgpS04DEW9Xje.pgp
Description: PGP signature


[PATCH 0/4] media: tuner large grain locking

2014-06-24 Thread Shuah Khan
Add a managed token resource that can be created at device level
which can be used as a large grain lock by diverse group of drivers
such as the media drivers that share a resource.

Token resource manages a unique named string resource which is
derived from common bus_name, and hardware address fields from
the struct device.

au0828 is changed to use token devres as a large locking
for exclusive access to tuner function. A new tuner_tkn
field is added to struct au0828_dev. Tuner token is created
from au0828 probe() and destroyed from disconnect().

Two new routines au0828_create_token_resources() and
au0828_destroy_token_resources() create and destroy the
tuner token.

au0828-dvb exports the tuner token to dvb-frontend when
it registers the digital frontend using the tuner_tkn
field in struct dvb_frontend.

au0828-video exports the tuner token to v4l2-core when
it registers the analog function using tuner_tkn field
in struct video_device.

Before this change:

- digital tv app disrupts an active analog app when it
  tries to use the tuner
  e.g:  tvtime analog video stream stops when kaffeine starts
- analog tv app disrupts another analog app when it tries to
  use the tuner
  e.g: tvtime audio glitches when xawtv starts and vice versa.
- analog tv app disrupts an active digital app when it tries
  to use the tuner
  e.g: kaffeine digital stream stops when tvtime starts
- digital tv app disrupts another digital tv app when it tries
  to use the tuner
  e.g: kaffeine digital stream stops when vlc starts and vice
  versa

After this change:
- digital tv app detects tuner is busy without disrupting
  the active app.
- analog tv app detects tuner is busy without disrupting
  the active analog app.
- analog tv app detects tuner is busy without disrupting
  the active digital app.
- digital tv app detects tuner is busy without disrupting
  the active digital app.

Requesting feedback on any use-cases I missed and overall
approach to solving the contention between media functions.

Shuah Khan (4):
  drivers/base: add managed token dev resource
  media: dvb-fe changes to use tuner token
  media: v4l2-core changes to use tuner token
  media: au0828 changes to use token devres for tuner access

 drivers/base/Makefile   |2 +-
 drivers/base/token_devres.c |  134 +++
 drivers/media/dvb-core/dvb_frontend.c   |   21 +
 drivers/media/dvb-core/dvb_frontend.h   |1 +
 drivers/media/usb/au0828/au0828-core.c  |   42 ++
 drivers/media/usb/au0828/au0828-dvb.c   |1 +
 drivers/media/usb/au0828/au0828-video.c |4 +
 drivers/media/usb/au0828/au0828.h   |4 +
 drivers/media/v4l2-core/v4l2-dev.c  |   23 +-
 include/linux/token_devres.h|   19 +
 include/media/v4l2-dev.h|1 +
 11 files changed, 250 insertions(+), 2 deletions(-)
 create mode 100644 drivers/base/token_devres.c
 create mode 100644 include/linux/token_devres.h

-- 
1.7.10.4

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


[PATCH 1/4] drivers/base: add managed token dev resource

2014-06-24 Thread Shuah Khan
Add a managed token resource that can be created at device level
which can be used as a large grain lock by diverse group of drivers
such as the media drivers that share a resource.

Media devices often have hardware resources that are shared
across several functions. These devices appear as a group of
independent devices. Each device implements a function which
could be shared by one or more functions supported by the same
device. For example, tuner is shared by analog and digital TV
functions.

Media drivers that control a single media TV stick are a
diversified group. Analog and digital TV function drivers have
to coordinate access to their shared functions.

Some media devices provide multiple almost-independent functions.
USB and PCI core aids in allowing multiple drivers to handle these
almost-independent functions. In this model, a media device could
have snd-usb-audio driving the audio function.

As a result, snd-usb-audio driver has to coordinate with the media
driver analog and digital function drivers.

A shared managed resource framework at drivers/base level will
allow a media device to be controlled by drivers that don't
fall under drivers/media and share functions with other media
drivers.

Token resource manages a unique named string resource which is
derived from common bus_name, and hardware address fields from
the struct device.

Interfaces:
devm_token_create()
devm_token_destroy()
devm_token_lock()
devm_token_unlock()
Usage:
Create token: Call devm_token_create() with a token id string.
Lock token: Call devm_token_lock() to lock or try lock a token.
Unlock token: Call devm_token_unlock().
Destroy token: Call devm_token_destroy() to delete the token.

Signed-off-by: Shuah Khan shuah...@samsung.com
---
 drivers/base/Makefile|2 +-
 drivers/base/token_devres.c  |  134 ++
 include/linux/token_devres.h |   19 ++
 3 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100644 drivers/base/token_devres.c
 create mode 100644 include/linux/token_devres.h

diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 04b314e..924665b 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -4,7 +4,7 @@ obj-y   := component.o core.o bus.o dd.o 
syscore.o \
   driver.o class.o platform.o \
   cpu.o firmware.o init.o map.o devres.o \
   attribute_container.o transport_class.o \
-  topology.o container.o
+  topology.o container.o token_devres.o
 obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
 obj-$(CONFIG_DMA_CMA) += dma-contiguous.o
 obj-y  += power/
diff --git a/drivers/base/token_devres.c b/drivers/base/token_devres.c
new file mode 100644
index 000..86bcd25
--- /dev/null
+++ b/drivers/base/token_devres.c
@@ -0,0 +1,134 @@
+/*
+ * drivers/base/token_devres.c - managed token resource
+ *
+ * Copyright (c) 2014 Shuah Khan shuah...@samsung.com
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * This file is released under the GPLv2.
+ */
+/*
+ * Media devices often have hardware resources that are shared
+ * across several functions. For instance, TV tuner cards often
+ * have MUXes, converters, radios, tuners, etc. that are shared
+ * across various functions. However, v4l2, alsa, DVB, usbfs, and
+ * all other drivers have no knowledge of what resources are
+ * shared. For example, users can't access DVB and alsa at the same
+ * time, or the DVB and V4L analog API at the same time, since many
+ * only have one converter that can be in either analog or digital
+ * mode. Accessing and/or changing mode of a converter while it is
+ * in use by another function results in video stream error.
+ *
+ * A shared devres that can be locked and unlocked by various drivers
+ * that control media functions on a single media device is needed to
+ * address the above problems.
+ *
+ * A token devres that can be looked up by a token for locking, try
+ * locking, unlocking will help avoid adding data structure
+ * dependencies between various media drivers. This token is a unique
+ * string that can be constructed from a common data structure such as
+ * struct device, bus_name, and hardware address.
+ *
+ * The devm_token_* interfaces manage access to token resource.
+ *
+ * Interfaces:
+ * devm_token_create()
+ * devm_token_destroy()
+ * devm_token_lock()
+ * devm_token_unlock()
+ * Usage:
+ * Create token:
+ * Call devm_token_create() with a token id which is
+ * a unique string.
+ * Lock token:
+ * Call devm_token_lock() to lock or try lock a token.
+ * Unlock token:
+ * Call devm_token_unlock().
+ * Destroy token:
+ * Call devm_token_destroy() to delete the token.
+ *
+*/
+#include linux/device.h
+#include linux/token_devres.h
+
+struct token_devres {
+   struct 

[PATCH 2/4] media: dvb-fe changes to use tuner token

2014-06-24 Thread Shuah Khan
Add a new field tuner_tkn to struct dvb_frontend. Drivers can
create tuner token using devm_token_create() and initialize
the tuner_tkn when frontend is registered with the dvb-core.
This change enables drivers to provide a token devres for tuner
access control.

Change dvb_frontend to lock tuner token for exclusive access to
tuner function for digital TV function use. When Tuner token is
present, dvb_frontend_start() calls devm_token_lock() to lock
the token. If token is busy, -EBUSY is returned to the user-space.
Tuner token is unlocked if kdvb adapter fe kthread fails to start.
This token is held in use as long as the kdvb adapter fe kthread
is running. Tuner token is unlocked in dvb_frontend_thread() when
kdvb adapter fe thread exits.

Signed-off-by: Shuah Khan shuah...@samsung.com
---
 drivers/media/dvb-core/dvb_frontend.c |   21 +
 drivers/media/dvb-core/dvb_frontend.h |1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_frontend.c 
b/drivers/media/dvb-core/dvb_frontend.c
index 6cc2631..37d3a4e 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -41,6 +41,7 @@
 #include linux/jiffies.h
 #include linux/kthread.h
 #include asm/processor.h
+#include linux/token_devres.h
 
 #include dvb_frontend.h
 #include dvbdev.h
@@ -747,6 +748,11 @@ restart:
if (semheld)
up(fepriv-sem);
dvb_frontend_wakeup(fe);
+
+   if (fe-tuner_tkn) {
+   devm_token_unlock(fe-dvb-device, fe-tuner_tkn);
+   dev_info(fe-dvb-device, dvb: Tuner is unlocked\n);
+   }
return 0;
 }
 
@@ -840,6 +846,17 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
fepriv-state = FESTATE_IDLE;
fepriv-exit = DVB_FE_NO_EXIT;
fepriv-thread = NULL;
+
+   if (fe-tuner_tkn) {
+   ret = devm_token_lock(fe-dvb-device, fe-tuner_tkn);
+   if (ret) {
+   dev_info(fe-dvb-device,
+   dvb: Tuner is busy %d\n, ret);
+   return ret;
+   }
+   dev_info(fe-dvb-device, dvb: Tuner is locked\n);
+   }
+
mb();
 
fe_thread = kthread_run(dvb_frontend_thread, fe,
@@ -850,6 +867,10 @@ static int dvb_frontend_start(struct dvb_frontend *fe)
dvb_frontend_start: failed to start kthread 
(%d)\n,
ret);
up(fepriv-sem);
+   if (fe-tuner_tkn) {
+   devm_token_unlock(fe-dvb-device, fe-tuner_tkn);
+   dev_info(fe-dvb-device, dvb: Tuner is unlocked\n);
+   }
return ret;
}
fepriv-thread = fe_thread;
diff --git a/drivers/media/dvb-core/dvb_frontend.h 
b/drivers/media/dvb-core/dvb_frontend.h
index 371b6ca..c9ba5fd 100644
--- a/drivers/media/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb-core/dvb_frontend.h
@@ -418,6 +418,7 @@ struct dvb_frontend {
 #define DVB_FRONTEND_COMPONENT_DEMOD 1
int (*callback)(void *adapter_priv, int component, int cmd, int arg);
int id;
+   char *tuner_tkn;
 };
 
 extern int dvb_register_frontend(struct dvb_adapter *dvb,
-- 
1.7.10.4

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


[PATCH 3/4] media: v4l2-core changes to use tuner token

2014-06-24 Thread Shuah Khan
Add a new field tuner_tkn to struct video_device. Drivers can
create tuner token using devm_token_create() and initialize
the tuner_tkn when frontend is registered with the dvb-core.
This change enables drivers to provide a token devres for tuner
access control.

Change v4l2-core to lock tuner token for exclusive access to
tuner function for analog TV function use. When Tuner token is
present, v4l2_open() calls devm_token_lock() to lock the token.
If token is busy, -EBUSY is returned to the user-space.

Tuner token is unlocked in error paths in v4l2_open(). This token
is held as long as the v4l2 device is open and unlocked from
v4l2_release().

Signed-off-by: Shuah Khan shuah...@samsung.com
---
 drivers/media/v4l2-core/v4l2-dev.c |   23 ++-
 include/media/v4l2-dev.h   |1 +
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/media/v4l2-core/v4l2-dev.c 
b/drivers/media/v4l2-core/v4l2-dev.c
index 634d863..8dff809 100644
--- a/drivers/media/v4l2-core/v4l2-dev.c
+++ b/drivers/media/v4l2-core/v4l2-dev.c
@@ -26,6 +26,7 @@
 #include linux/kmod.h
 #include linux/slab.h
 #include asm/uaccess.h
+#include linux/token_devres.h
 
 #include media/v4l2-common.h
 #include media/v4l2-device.h
@@ -445,6 +446,17 @@ static int v4l2_open(struct inode *inode, struct file 
*filp)
mutex_unlock(videodev_lock);
return -ENODEV;
}
+   /* check if tuner is busy first */
+   if (vdev-tuner_tkn  vdev-dev_parent) {
+   ret = devm_token_lock(vdev-dev_parent, vdev-tuner_tkn);
+   if (ret) {
+   mutex_unlock(videodev_lock);
+   dev_info(vdev-dev_parent, v4l2: Tuner is busy\n);
+   return ret;
+   }
+   dev_info(vdev-dev_parent, v4l2: Tuner is locked\n);
+   }
+
/* and increase the device refcount */
video_get(vdev);
mutex_unlock(videodev_lock);
@@ -459,8 +471,13 @@ static int v4l2_open(struct inode *inode, struct file 
*filp)
printk(KERN_DEBUG %s: open (%d)\n,
video_device_node_name(vdev), ret);
/* decrease the refcount in case of an error */
-   if (ret)
+   if (ret) {
video_put(vdev);
+   if (vdev-tuner_tkn  vdev-dev_parent) {
+   devm_token_unlock(vdev-dev_parent, vdev-tuner_tkn);
+   dev_info(vdev-dev_parent, v4l2: Tuner is unlocked\n);
+   }
+   }
return ret;
 }
 
@@ -479,6 +496,10 @@ static int v4l2_release(struct inode *inode, struct file 
*filp)
/* decrease the refcount unconditionally since the release()
   return value is ignored. */
video_put(vdev);
+   if (vdev-tuner_tkn  vdev-dev_parent) {
+   devm_token_unlock(vdev-dev_parent, vdev-tuner_tkn);
+   dev_info(vdev-dev_parent, v4l2: Tuner is unlocked\n);
+   }
return ret;
 }
 
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index eec6e46..1676349 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -141,6 +141,7 @@ struct video_device
/* serialization lock */
DECLARE_BITMAP(disable_locking, BASE_VIDIOC_PRIVATE);
struct mutex *lock;
+   char *tuner_tkn;
 };
 
 #define media_entity_to_video_device(__e) \
-- 
1.7.10.4

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


[PATCH 4/4] media: au0828 changes to use token devres for tuner access

2014-06-24 Thread Shuah Khan
au0828 is changed to use token devres as a large locking
for exclusive access to tuner function. A new tuner_tkn
field is added to struct au0828_dev. Tuner token is created
from au0828 probe() and destroyed from disconnect().

Two new routines au0828_create_token_resources() and
au0828_destroy_token_resources() create and destroy the
tuner token.

au0828-dvb exports the tuner token to dvb-frontend when
it registers the digital frontend using the tuner_tkn
field in struct dvb_frontend.

au0828-video exports the tuner token to v4l2-core when
it registers the analog function using tuner_tkn field
in struct video_device.

Before this change:

- digital tv app disrupts an active analog app when it
  tries to use the tuner
  e.g:  tvtime analog video stream stops when kaffeine starts
- analog tv app disrupts another analog app when it tries to
  use the tuner
  e.g: tvtime audio glitches when xawtv starts and vice versa.
- analog tv app disrupts an active digital app when it tries
  to use the tuner
  e.g: kaffeine digital stream stops when tvtime starts
- digital tv app disrupts another digital tv app when it tries
  to use the tuner
  e.g: kaffeine digital stream stops when vlc starts and vice
  versa

After this change:
- digital tv app detects tuner is busy without disrupting
  the active app.
- analog tv app detects tuner is busy without disrupting
  the active analog app.
- analog tv app detects tuner is busy without disrupting
  the active digital app.
- digital tv app detects tuner is busy without disrupting
  the active digital app.

Signed-off-by: Shuah Khan shuah...@samsung.com
---
 drivers/media/usb/au0828/au0828-core.c  |   42 +++
 drivers/media/usb/au0828/au0828-dvb.c   |1 +
 drivers/media/usb/au0828/au0828-video.c |4 +++
 drivers/media/usb/au0828/au0828.h   |4 +++
 4 files changed, 51 insertions(+)

diff --git a/drivers/media/usb/au0828/au0828-core.c 
b/drivers/media/usb/au0828/au0828-core.c
index ab45a6f..df04a99 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -125,6 +125,37 @@ static int recv_control_msg(struct au0828_dev *dev, u16 
request, u32 value,
return status;
 }
 
+/* interfaces to create and destroy token resources */
+static int au0828_create_token_resources(struct au0828_dev *dev)
+{
+   int rc = 0, len;
+   char buf[64];
+
+   /* create token devres for tuner */
+   len = snprintf(buf, sizeof(buf),
+   tuner:%s-%s-%d,
+   dev_name(dev-usbdev-dev),
+   dev-usbdev-bus-bus_name,
+   dev-board.tuner_addr);
+
+   dev-tuner_tkn = devm_kzalloc(dev-usbdev-dev, len + 1, GFP_KERNEL);
+   if (!dev-tuner_tkn)
+   return -ENOMEM;
+
+   strcpy(dev-tuner_tkn, buf);
+   rc = devm_token_create(dev-usbdev-dev, dev-tuner_tkn);
+   if (rc)
+   return rc;
+
+   pr_info(au0828_create_token_resources(): Tuner token created\n);
+   return rc;
+}
+
+static void au0828_destroy_token_resources(struct au0828_dev *dev)
+{
+   devm_token_destroy(dev-usbdev-dev, dev-tuner_tkn);
+}
+
 static void au0828_usb_release(struct au0828_dev *dev)
 {
/* I2C */
@@ -154,6 +185,8 @@ static void au0828_usb_disconnect(struct usb_interface 
*interface)
/* Digital TV */
au0828_dvb_unregister(dev);
 
+   au0828_destroy_token_resources(dev);
+
usb_set_intfdata(interface, NULL);
mutex_lock(dev-mutex);
dev-usbdev = NULL;
@@ -213,6 +246,13 @@ static int au0828_usb_probe(struct usb_interface 
*interface,
dev-usbdev = usbdev;
dev-boardnr = id-driver_info;
 
+   /* create token resources */
+   if (au0828_create_token_resources(dev)) {
+   mutex_unlock(dev-lock);
+   kfree(dev);
+   return -ENOMEM;
+   }
+
 #ifdef CONFIG_VIDEO_AU0828_V4L2
dev-v4l2_dev.release = au0828_usb_v4l2_release;
 
@@ -221,6 +261,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
if (retval) {
pr_err(%s() v4l2_device_register failed\n,
   __func__);
+   au0828_destroy_token_resources(dev);
mutex_unlock(dev-lock);
kfree(dev);
return retval;
@@ -230,6 +271,7 @@ static int au0828_usb_probe(struct usb_interface *interface,
if (retval) {
pr_err(%s() v4l2_ctrl_handler_init failed\n,
   __func__);
+   au0828_destroy_token_resources(dev);
mutex_unlock(dev-lock);
kfree(dev);
return retval;
diff --git a/drivers/media/usb/au0828/au0828-dvb.c 
b/drivers/media/usb/au0828/au0828-dvb.c
index d8b5d94..1195d29 100755
--- a/drivers/media/usb/au0828/au0828-dvb.c
+++ b/drivers/media/usb/au0828/au0828-dvb.c
@@ -412,6 +412,7 @@ static int dvb_register(struct au0828_dev *dev)
goto fail_adapter;
}

Re: [PATCH v14 05/10] ARM: dts: imx5*, imx6*: correct display-timings nodes.

2014-06-24 Thread Shawn Guo
On Tue, Jun 24, 2014 at 04:01:58PM +0100, Russell King - ARM Linux wrote:
 On Mon, Jun 16, 2014 at 12:11:19PM +0200, Denis Carikli wrote:
  The imx-drm driver can't use the de-active and
  pixelclk-active display-timings properties yet.
  
  Instead the data-enable and the pixel data clock
  polarity are hardcoded in the imx-drm driver.
  
  So theses properties are now set to keep
  the same behaviour when imx-drm will start
  using them.
  
  Signed-off-by: Denis Carikli de...@eukrea.com
 
 This patch needs either an ack from the arm-soc/iMX maintainers, or
 they need to merge it.  As there's little positive agreement on the
 series, I can understand why there's reluctance to merge it.
 
 So, can we start having some acks from people please, or at least
 commitments to merge this patch when the others are deemed to be
 acceptable.  If not, can we have explanations why this should not
 be merged.

I will be happy to merge dts change through IMX tree once the
binding/diver part gets accepted/applied.

Shawn
--
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: OK

2014-06-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:   Wed Jun 25 04:00:27 CEST 2014
git branch: test
git hash:   1fe3a8fe494463cfe2556a25ae41a1499725c178
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: v0.5.0-14-gf11dd94
host hardware:  x86_64
host os:3.14-5.slh.5-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: 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: OK
linux-2.6.31.14-i686: OK
linux-2.6.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12-i686: OK
linux-3.13-i686: OK
linux-3.14-i686: OK
linux-3.15-i686: OK
linux-3.16-rc1-i686: OK
linux-2.6.31.14-x86_64: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12-x86_64: OK
linux-3.13-x86_64: OK
linux-3.14-x86_64: OK
linux-3.15-x86_64: OK
linux-3.16-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v14 04/10] imx-drm: use defines for clock polarity settings

2014-06-24 Thread Sascha Hauer
On Mon, Jun 16, 2014 at 12:11:18PM +0200, Denis Carikli wrote:
 Signed-off-by: Denis Carikli de...@eukrea.com
 ---
 ChangeLog v13-v14:
 - Rebased
 ChangeLog 12-v13:
 - No changes
 ChangeLog 11-v12:
 - Improved the define names to match the hardware:
   ENABLE_POL is not a clock signal but instead an enable signal.
 
 ChangeLog v9-v10:
 - New patch which was splitted out from:
   staging: imx-drm: Use de-active and pixelclk-active display-timings..
 - Fixes many issues in staging: imx-drm: Use de-active and pixelclk-active
   display-timings.:
   - More clear meaning of the polarity settings.
   - The SET_CLK_POL and SET_DE_POL masks are not
 needed anymore.
 ---
  drivers/gpu/ipu-v3/ipu-di.c  |4 ++--
  drivers/staging/imx-drm/ipuv3-crtc.c |4 ++--
  include/video/imx-ipu-v3.h   |8 +++-
  3 files changed, 11 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c
 index c490ba4..d00f357 100644
 --- a/drivers/gpu/ipu-v3/ipu-di.c
 +++ b/drivers/gpu/ipu-v3/ipu-di.c
 @@ -595,7 +595,7 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct 
 ipu_di_signal_cfg *sig)
   }
   }
  
 - if (sig-clk_pol)
 + if (sig-clk_pol == CLK_POL_POSEDGE)
   di_gen |= DI_GEN_POLARITY_DISP_CLK;
  
   ipu_di_write(di, di_gen, DI_GENERAL);
 @@ -606,7 +606,7 @@ int ipu_di_init_sync_panel(struct ipu_di *di, struct 
 ipu_di_signal_cfg *sig)
   reg = ipu_di_read(di, DI_POL);
   reg = ~(DI_POL_DRDY_DATA_POLARITY | DI_POL_DRDY_POLARITY_15);
  
 - if (sig-enable_pol)
 + if (sig-enable_pol == ENABLE_POL_HIGH)
   reg |= DI_POL_DRDY_POLARITY_15;
   if (sig-data_pol)
   reg |= DI_POL_DRDY_DATA_POLARITY;
 diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c 
 b/drivers/staging/imx-drm/ipuv3-crtc.c
 index 720868b..7fec438 100644
 --- a/drivers/staging/imx-drm/ipuv3-crtc.c
 +++ b/drivers/staging/imx-drm/ipuv3-crtc.c
 @@ -165,8 +165,8 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc,
   if (mode-flags  DRM_MODE_FLAG_PVSYNC)
   sig_cfg.Vsync_pol = 1;
  
 - sig_cfg.enable_pol = 1;
 - sig_cfg.clk_pol = 0;
 + sig_cfg.enable_pol = ENABLE_POL_HIGH;
 + sig_cfg.clk_pol = CLK_POL_NEGEDGE;
   sig_cfg.width = mode-hdisplay;
   sig_cfg.height = mode-vdisplay;
   sig_cfg.pixel_fmt = out_pixel_fmt;
 diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
 index 3e43e22..305 100644
 --- a/include/video/imx-ipu-v3.h
 +++ b/include/video/imx-ipu-v3.h
 @@ -27,6 +27,12 @@ enum ipuv3_type {
  
  #define IPU_PIX_FMT_GBR24v4l2_fourcc('G', 'B', 'R', '3')
  
 +#define CLK_POL_NEGEDGE  0
 +#define CLK_POL_POSEDGE  1
 +
 +#define ENABLE_POL_LOW   0
 +#define ENABLE_POL_HIGH  1

Adding defines without a proper namespace (IPU_) outside a driver
private header file is not nice. Anyway, instead of adding the
defines ...

 +
  /*
   * Bitfield of Display Interface signal polarities.
   */
 @@ -37,7 +43,7 @@ struct ipu_di_signal_cfg {
   unsigned clksel_en:1;
   unsigned clkidle_en:1;
   unsigned data_pol:1;/* true = inverted */
 - unsigned clk_pol:1; /* true = rising edge */
 + unsigned clk_pol:1;
   unsigned enable_pol:1;
   unsigned Hsync_pol:1;   /* true = active high */
   unsigned Vsync_pol:1;

...can we rename the flags to more meaningful names instead?

unsigned clk_pol_rising_edge:1;
unsigned enable_pol_high:1;
unsigned hsync_active_high:1;
unsigned vsync_active_high:1;

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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