cron job: media_tree daily build: ERRORS

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

Results of the daily build of media_tree:

date:   Thu Jan 19 05:00:17 CET 2017
media-tree git hash:40eca140c404505c09773d1c6685d818cb55ab1a
media_build git hash:   3c6ce4ff75f19adf45869e34b376c5b9dee4d50a
v4l-utils git hash: 42ac437b3493615d5571f5f76f73979145fef1b2
gcc version:i686-linux-gcc (GCC) 6.2.0
sparse version: v0.5.0-3553-g78b2ea6
smatch version: v0.5.0-3553-g78b2ea6
host hardware:  x86_64
host os:4.8.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.11.1-i686: OK
linux-3.12.67-i686: OK
linux-3.13.11-i686: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.16.7-i686: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.18.7-i686: WARNINGS
linux-3.19-i686: WARNINGS
linux-4.0.9-i686: WARNINGS
linux-4.1.33-i686: WARNINGS
linux-4.2.8-i686: WARNINGS
linux-4.3.6-i686: WARNINGS
linux-4.4.22-i686: WARNINGS
linux-4.5.7-i686: WARNINGS
linux-4.6.7-i686: WARNINGS
linux-4.7.5-i686: WARNINGS
linux-4.8-i686: OK
linux-4.9-i686: OK
linux-4.10-rc3-i686: OK
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-x86_64: OK
linux-3.12.67-x86_64: OK
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16.7-x86_64: WARNINGS
linux-3.17.8-x86_64: WARNINGS
linux-3.18.7-x86_64: WARNINGS
linux-3.19-x86_64: WARNINGS
linux-4.0.9-x86_64: WARNINGS
linux-4.1.33-x86_64: WARNINGS
linux-4.2.8-x86_64: WARNINGS
linux-4.3.6-x86_64: WARNINGS
linux-4.4.22-x86_64: WARNINGS
linux-4.5.7-x86_64: WARNINGS
linux-4.6.7-x86_64: WARNINGS
linux-4.7.5-x86_64: WARNINGS
linux-4.8-x86_64: OK
linux-4.9-x86_64: OK
linux-4.10-rc3-x86_64: OK
apps: WARNINGS
spec-git: ERRORS
sparse: WARNINGS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: [PATCH v3 2/3] Documentation: devicetree: Add document bindings for mtk-cir

2017-01-18 Thread Sean Wang
On Wed, 2017-01-18 at 16:42 -0600, Rob Herring wrote:
> On Wed, Jan 18, 2017 at 4:23 PM, Rob Herring  wrote:
> > On Fri, Jan 13, 2017 at 03:35:38PM +0800, sean.w...@mediatek.com wrote:
> >> From: Sean Wang 
> >>
> >> This patch adds documentation for devicetree bindings for
> >> consumer Mediatek IR controller.
> >>
> >> Signed-off-by: Sean Wang 
> >> ---
> >>  .../devicetree/bindings/media/mtk-cir.txt  | 24 
> >> ++
> >>  1 file changed, 24 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/media/mtk-cir.txt
> >
> > Acked-by: Rob Herring 
> 
> I guess I rescind my ack if this email doesn't work:
> 
> "The response from the remote server was:
> 
> 550 Relaying mail to sean.w...@mediatek.com is not allowed"


sorry for causing you inconvenience.

it should be able to work because i almost use this daily
maybe that's just a sudden problem from internal server (?) 

but if the problem still continues, please let me know and 
i will try to fix this.



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


Re: [PATCH v3 16/24] media: Add i.MX media core driver

2017-01-18 Thread Steve Longerbeam



On 01/14/2017 02:42 PM, Steve Longerbeam wrote:



+/* parse inputs property from a sensor node */
+static void of_parse_sensor_inputs(struct imx_media_dev *imxmd,
+  struct imx_media_subdev *sensor,
+  struct device_node *sensor_np)
+{
+   struct imx_media_sensor_input *sinput = >input;
+   int ret, i;
+
+   for (i = 0; i < IMX_MEDIA_MAX_SENSOR_INPUTS; i++) {
+   const char *input_name;
+   u32 val;
+
+   ret = of_property_read_u32_index(sensor_np, "inputs", i, );
+   if (ret)
+   break;
+
+   sinput->value[i] = val;
+
+   ret = of_property_read_string_index(sensor_np, "input-names",
+   i, _name);
+   /*
+* if input-names not provided, they will be set using
+* the subdev name once the sensor is known during
+* async bind
+*/
+   if (!ret)
+   strncpy(sinput->name[i], input_name,
+   sizeof(sinput->name[i]));
+   }
+
+   sinput->num = i;
+
+   /* if no inputs provided just assume a single input */
+   if (sinput->num == 0)
+   sinput->num = 1;
+}

This should be parsed by the sensor driver, not imx-media.


you're probably right. I'll submit a patch for adv7180.c.


Actually, the problem here is that this parses an input routing value to
pass to s_routing, and an input name string. There would need to be
another subdev callback, maybe enum_imput, that would return this
information for the bridge driver, if this info were to be parsed and
maintained by the sensor.

But this info should really be known and parsed by the bridge anyway,
because as the header for s_routing states,

"An i2c device shouldn't know about whether an input pin is connected
 to a Composite connector, because on another board or platform it
 might be connected to something else entirely. The calling driver is
 responsible for mapping a user-level input to the right pins on the i2c
 device."

Steve


--
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] pci: drop link_reset

2017-01-18 Thread Doug Ledford
On Wed, 2017-01-18 at 23:39 +0200, Michael S. Tsirkin wrote:
> No hardware seems to actually call link_reset, and
> no driver implements it as more than a nop stub.
> 
> This drops the mentions of the callback from everywhere.
> It's dropped from the documentation as well, but
> the doc really needs to be updated to reflect
> reality better (e.g. on pcie slot reset is the link reset).
> 
> This will be done in a later patch.
> 
> Signed-off-by: Michael S. Tsirkin 

This is going to conflict with the two patches I have in my for-next
branch related to this same thing (it drops the stubs from qib and
hfi1).  It would be easiest if I just added this to my for-next and
fixed up the conflicts prior to submission.

> ---
>  Documentation/PCI/pci-error-recovery.txt | 24 +++---
> --
>  drivers/infiniband/hw/hfi1/pcie.c| 10 --
>  drivers/infiniband/hw/qib/qib_pcie.c |  8 
>  drivers/media/pci/ngene/ngene-cards.c|  7 ---
>  include/linux/pci.h  |  3 ---
>  5 files changed, 3 insertions(+), 49 deletions(-)
> 
> diff --git a/Documentation/PCI/pci-error-recovery.txt
> b/Documentation/PCI/pci-error-recovery.txt
> index ac26869..da3b217 100644
> --- a/Documentation/PCI/pci-error-recovery.txt
> +++ b/Documentation/PCI/pci-error-recovery.txt
> @@ -78,7 +78,6 @@ struct pci_error_handlers
>  {
>   int (*error_detected)(struct pci_dev *dev, enum
> pci_channel_state);
>   int (*mmio_enabled)(struct pci_dev *dev);
> - int (*link_reset)(struct pci_dev *dev);
>   int (*slot_reset)(struct pci_dev *dev);
>   void (*resume)(struct pci_dev *dev);
>  };
> @@ -104,8 +103,7 @@ if it implements any, it must implement
> error_detected(). If a callback
>  is not implemented, the corresponding feature is considered
> unsupported.
>  For example, if mmio_enabled() and resume() aren't there, then it
>  is assumed that the driver is not doing any direct recovery and
> requires
> -a slot reset. If link_reset() is not implemented, the card is
> assumed to
> -not care about link resets. Typically a driver will want to know
> about
> +a slot reset.  Typically a driver will want to know about
>  a slot_reset().
>  
>  The actual steps taken by a platform to recover from a PCI error
> @@ -232,25 +230,9 @@ proceeds to STEP 4 (Slot Reset)
>  
>  STEP 3: Link Reset
>  --
> -The platform resets the link, and then calls the link_reset()
> callback
> -on all affected device drivers.  This is a PCI-Express specific
> state
> +The platform resets the link.  This is a PCI-Express specific step
>  and is done whenever a non-fatal error has been detected that can be
> -"solved" by resetting the link. This call informs the driver of the
> -reset and the driver should check to see if the device appears to be
> -in working condition.
> -
> -The driver is not supposed to restart normal driver I/O operations
> -at this point.  It should limit itself to "probing" the device to
> -check its recoverability status. If all is right, then the platform
> -will call resume() once all drivers have ack'd link_reset().
> -
> - Result codes:
> - (identical to STEP 3 (MMIO Enabled)
> -
> -The platform then proceeds to either STEP 4 (Slot Reset) or STEP 5
> -(Resume Operations).
> -
> ->>> The current powerpc implementation does not implement this
> callback.
> +"solved" by resetting the link.
>  
>  STEP 4: Slot Reset
>  --
> diff --git a/drivers/infiniband/hw/hfi1/pcie.c
> b/drivers/infiniband/hw/hfi1/pcie.c
> index 4ac8f33..ebd941f 100644
> --- a/drivers/infiniband/hw/hfi1/pcie.c
> +++ b/drivers/infiniband/hw/hfi1/pcie.c
> @@ -598,15 +598,6 @@ pci_slot_reset(struct pci_dev *pdev)
>   return PCI_ERS_RESULT_CAN_RECOVER;
>  }
>  
> -static pci_ers_result_t
> -pci_link_reset(struct pci_dev *pdev)
> -{
> - struct hfi1_devdata *dd = pci_get_drvdata(pdev);
> -
> - dd_dev_info(dd, "HFI1 link_reset function called,
> ignored\n");
> - return PCI_ERS_RESULT_CAN_RECOVER;
> -}
> -
>  static void
>  pci_resume(struct pci_dev *pdev)
>  {
> @@ -625,7 +616,6 @@ pci_resume(struct pci_dev *pdev)
>  const struct pci_error_handlers hfi1_pci_err_handler = {
>   .error_detected = pci_error_detected,
>   .mmio_enabled = pci_mmio_enabled,
> - .link_reset = pci_link_reset,
>   .slot_reset = pci_slot_reset,
>   .resume = pci_resume,
>  };
> diff --git a/drivers/infiniband/hw/qib/qib_pcie.c
> b/drivers/infiniband/hw/qib/qib_pcie.c
> index 6abe1c6..c379b83 100644
> --- a/drivers/infiniband/hw/qib/qib_pcie.c
> +++ b/drivers/infiniband/hw/qib/qib_pcie.c
> @@ -682,13 +682,6 @@ qib_pci_slot_reset(struct pci_dev *pdev)
>   return PCI_ERS_RESULT_CAN_RECOVER;
>  }
>  
> -static pci_ers_result_t
> -qib_pci_link_reset(struct pci_dev *pdev)
> -{
> - qib_devinfo(pdev, "QIB link_reset function called,
> ignored\n");
> - return PCI_ERS_RESULT_CAN_RECOVER;
> -}
> -
>  static void
>  qib_pci_resume(struct pci_dev 

Re: [PATCH] [media] uvcvideo: change result code of debugfs_init to void

2017-01-18 Thread Laurent Pinchart
Hi Jaejoong,

Thank you for the patch.

On Thursday 12 Jan 2017 10:31:21 Jaejoong Kim wrote:
> The device driver should keep going even if debugfs initialization fails.
> So, change the return type to void.
> 
> Signed-off-by: Jaejoong Kim 

Reviewed-by: Laurent Pinchart 

and applied to my tree. I'll send a pull request for v4.11.

> ---
>  drivers/media/usb/uvc/uvc_debugfs.c | 15 ++-
>  drivers/media/usb/uvc/uvcvideo.h|  4 ++--
>  2 files changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_debugfs.c
> b/drivers/media/usb/uvc/uvc_debugfs.c index 14561a5..368f8f8 100644
> --- a/drivers/media/usb/uvc/uvc_debugfs.c
> +++ b/drivers/media/usb/uvc/uvc_debugfs.c
> @@ -75,14 +75,14 @@ static const struct file_operations
> uvc_debugfs_stats_fops = {
> 
>  static struct dentry *uvc_debugfs_root_dir;
> 
> -int uvc_debugfs_init_stream(struct uvc_streaming *stream)
> +void uvc_debugfs_init_stream(struct uvc_streaming *stream)
>  {
>   struct usb_device *udev = stream->dev->udev;
>   struct dentry *dent;
>   char dir_name[32];
> 
>   if (uvc_debugfs_root_dir == NULL)
> - return -ENODEV;
> + return;
> 
>   sprintf(dir_name, "%u-%u", udev->bus->busnum, udev->devnum);
> 
> @@ -90,7 +90,7 @@ int uvc_debugfs_init_stream(struct uvc_streaming *stream)
>   if (IS_ERR_OR_NULL(dent)) {
>   uvc_printk(KERN_INFO, "Unable to create debugfs %s "
>  "directory.\n", dir_name);
> - return -ENODEV;
> + return;
>   }
> 
>   stream->debugfs_dir = dent;
> @@ -100,10 +100,8 @@ int uvc_debugfs_init_stream(struct uvc_streaming
> *stream) if (IS_ERR_OR_NULL(dent)) {
>   uvc_printk(KERN_INFO, "Unable to create debugfs stats file.
\n");
>   uvc_debugfs_cleanup_stream(stream);
> - return -ENODEV;
> + return;
>   }
> -
> - return 0;
>  }
> 
>  void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream)
> @@ -115,18 +113,17 @@ void uvc_debugfs_cleanup_stream(struct uvc_streaming
> *stream) stream->debugfs_dir = NULL;
>  }
> 
> -int uvc_debugfs_init(void)
> +void uvc_debugfs_init(void)
>  {
>   struct dentry *dir;
> 
>   dir = debugfs_create_dir("uvcvideo", usb_debug_root);
>   if (IS_ERR_OR_NULL(dir)) {
>   uvc_printk(KERN_INFO, "Unable to create debugfs directory\n");
> - return -ENODATA;
> + return;
>   }
> 
>   uvc_debugfs_root_dir = dir;
> - return 0;
>  }
> 
>  void uvc_debugfs_cleanup(void)
> diff --git a/drivers/media/usb/uvc/uvcvideo.h
> b/drivers/media/usb/uvc/uvcvideo.h index 7e4d3ee..1d1b992 100644
> --- a/drivers/media/usb/uvc/uvcvideo.h
> +++ b/drivers/media/usb/uvc/uvcvideo.h
> @@ -745,9 +745,9 @@ void uvc_video_decode_isight(struct urb *urb, struct
> uvc_streaming *stream, struct uvc_buffer *buf);
> 
>  /* debugfs and statistics */
> -int uvc_debugfs_init(void);
> +void uvc_debugfs_init(void);
>  void uvc_debugfs_cleanup(void);
> -int uvc_debugfs_init_stream(struct uvc_streaming *stream);
> +void uvc_debugfs_init_stream(struct uvc_streaming *stream);
>  void uvc_debugfs_cleanup_stream(struct uvc_streaming *stream);
> 
>  size_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,

-- 
Regards,

Laurent Pinchart

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


[PATCH] v4l: mt9v032: Remove unneeded gpiod NULL check

2017-01-18 Thread Laurent Pinchart
The gpiod API checks for NULL descriptors, there's no need to duplicate
the check in the driver.

Signed-off-by: Laurent Pinchart 
---
 drivers/media/i2c/mt9v032.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 58eb62f1ba21..107eb3baa11f 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -266,8 +266,7 @@ static int mt9v032_power_on(struct mt9v032 *mt9v032)
struct regmap *map = mt9v032->regmap;
int ret;
 
-   if (mt9v032->reset_gpio)
-   gpiod_set_value_cansleep(mt9v032->reset_gpio, 1);
+   gpiod_set_value_cansleep(mt9v032->reset_gpio, 1);
 
ret = clk_set_rate(mt9v032->clk, mt9v032->sysclk);
if (ret < 0)
-- 
Regards,

Laurent Pinchart

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


Re: [PATCH] [media] ov9650: use msleep() for uncritical long delay

2017-01-18 Thread Laurent Pinchart
Hi Nicholas,

Thank you for the patch.

On Monday 16 Jan 2017 14:58:33 Nicholas Mc Guire wrote:
> ulseep_range() uses hrtimers and provides no advantage over msleep()
> for larger delays. Fix up the 25ms delays here to use msleep() and
> reduce the load on the hrtimer subsystem.
> 
> Link: http://lkml.org/lkml/2017/1/11/377
> Signed-off-by: Nicholas Mc Guire 

Reviewed-by: Laurent Pinchart 

and applied to my tree. I'll send a pull request for v4.11.

> ---
> Problem found by coccinelle script
> 
> Patch was compile tested with: x86_64_defconfig + CONFIG_MEDIA_SUPPORT=m
> CONFIG_MEDIA_ANALOG_TV_SUPPORT=y, CONFIG_MEDIA_CONTROLLER=y
> CONFIG_VIDEO_V4L2_SUBDEV_API=y, CONFIG_MEDIA_SUBDRV_AUTOSELECT=n
> CONFIG_VIDEO_OV9650=m
> 
> Patch is aginast 4.10-rc3 (localversion-next is next-20170116)
> 
>  drivers/media/i2c/ov9650.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
> index 502c722..2de2fbb 100644
> --- a/drivers/media/i2c/ov9650.c
> +++ b/drivers/media/i2c/ov9650.c
> @@ -522,7 +522,7 @@ static void __ov965x_set_power(struct ov965x *ov965x,
> int on) if (on) {
>   ov965x_gpio_set(ov965x->gpios[GPIO_PWDN], 0);
>   ov965x_gpio_set(ov965x->gpios[GPIO_RST], 0);
> - usleep_range(25000, 26000);
> + msleep(25);
>   } else {
>   ov965x_gpio_set(ov965x->gpios[GPIO_RST], 1);
>   ov965x_gpio_set(ov965x->gpios[GPIO_PWDN], 1);
> @@ -1438,7 +1438,7 @@ static int ov965x_detect_sensor(struct v4l2_subdev
> *sd)
> 
>   mutex_lock(>lock);
>   __ov965x_set_power(ov965x, 1);
> - usleep_range(25000, 26000);
> + msleep(25);
> 
>   /* Check sensor revision */
>   ret = ov965x_read(client, REG_PID, );

-- 
Regards,

Laurent Pinchart

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


Re: [PATCH v3 2/3] Documentation: devicetree: Add document bindings for mtk-cir

2017-01-18 Thread Rob Herring
On Wed, Jan 18, 2017 at 4:23 PM, Rob Herring  wrote:
> On Fri, Jan 13, 2017 at 03:35:38PM +0800, sean.w...@mediatek.com wrote:
>> From: Sean Wang 
>>
>> This patch adds documentation for devicetree bindings for
>> consumer Mediatek IR controller.
>>
>> Signed-off-by: Sean Wang 
>> ---
>>  .../devicetree/bindings/media/mtk-cir.txt  | 24 
>> ++
>>  1 file changed, 24 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/media/mtk-cir.txt
>
> Acked-by: Rob Herring 

I guess I rescind my ack if this email doesn't work:

"The response from the remote server was:

550 Relaying mail to sean.w...@mediatek.com is not allowed"
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 2/3] Documentation: devicetree: Add document bindings for mtk-cir

2017-01-18 Thread Rob Herring
On Fri, Jan 13, 2017 at 03:35:38PM +0800, sean.w...@mediatek.com wrote:
> From: Sean Wang 
> 
> This patch adds documentation for devicetree bindings for
> consumer Mediatek IR controller.
> 
> Signed-off-by: Sean Wang 
> ---
>  .../devicetree/bindings/media/mtk-cir.txt  | 24 
> ++
>  1 file changed, 24 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/mtk-cir.txt

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


Re: [PATCH v3 1/3] Documentation: devicetree: move shared property used by rc into a common place

2017-01-18 Thread Rob Herring
On Fri, Jan 13, 2017 at 03:35:37PM +0800, sean.w...@mediatek.com wrote:
> From: Sean Wang 
> 
> Most IR drivers uses the same label to identify the
> scancdoe/key table they used by multiple bindings and lack
> explanation well. So move the shared property into a common
> place and give better explanation.
> 
> Signed-off-by: Sean Wang 
> ---
>  .../devicetree/bindings/media/gpio-ir-receiver.txt |   3 +-
>  .../devicetree/bindings/media/hix5hd2-ir.txt   |   2 +-
>  Documentation/devicetree/bindings/media/rc.txt | 116 
> +
>  .../devicetree/bindings/media/sunxi-ir.txt |   2 +-
>  4 files changed, 120 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/media/rc.txt

Acked-by: Rob Herring 

Thanks for doing this.

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] pci: drop link_reset

2017-01-18 Thread Michael S. Tsirkin
No hardware seems to actually call link_reset, and
no driver implements it as more than a nop stub.

This drops the mentions of the callback from everywhere.
It's dropped from the documentation as well, but
the doc really needs to be updated to reflect
reality better (e.g. on pcie slot reset is the link reset).

This will be done in a later patch.

Signed-off-by: Michael S. Tsirkin 
---
 Documentation/PCI/pci-error-recovery.txt | 24 +++-
 drivers/infiniband/hw/hfi1/pcie.c| 10 --
 drivers/infiniband/hw/qib/qib_pcie.c |  8 
 drivers/media/pci/ngene/ngene-cards.c|  7 ---
 include/linux/pci.h  |  3 ---
 5 files changed, 3 insertions(+), 49 deletions(-)

diff --git a/Documentation/PCI/pci-error-recovery.txt 
b/Documentation/PCI/pci-error-recovery.txt
index ac26869..da3b217 100644
--- a/Documentation/PCI/pci-error-recovery.txt
+++ b/Documentation/PCI/pci-error-recovery.txt
@@ -78,7 +78,6 @@ struct pci_error_handlers
 {
int (*error_detected)(struct pci_dev *dev, enum pci_channel_state);
int (*mmio_enabled)(struct pci_dev *dev);
-   int (*link_reset)(struct pci_dev *dev);
int (*slot_reset)(struct pci_dev *dev);
void (*resume)(struct pci_dev *dev);
 };
@@ -104,8 +103,7 @@ if it implements any, it must implement error_detected(). 
If a callback
 is not implemented, the corresponding feature is considered unsupported.
 For example, if mmio_enabled() and resume() aren't there, then it
 is assumed that the driver is not doing any direct recovery and requires
-a slot reset. If link_reset() is not implemented, the card is assumed to
-not care about link resets. Typically a driver will want to know about
+a slot reset.  Typically a driver will want to know about
 a slot_reset().
 
 The actual steps taken by a platform to recover from a PCI error
@@ -232,25 +230,9 @@ proceeds to STEP 4 (Slot Reset)
 
 STEP 3: Link Reset
 --
-The platform resets the link, and then calls the link_reset() callback
-on all affected device drivers.  This is a PCI-Express specific state
+The platform resets the link.  This is a PCI-Express specific step
 and is done whenever a non-fatal error has been detected that can be
-"solved" by resetting the link. This call informs the driver of the
-reset and the driver should check to see if the device appears to be
-in working condition.
-
-The driver is not supposed to restart normal driver I/O operations
-at this point.  It should limit itself to "probing" the device to
-check its recoverability status. If all is right, then the platform
-will call resume() once all drivers have ack'd link_reset().
-
-   Result codes:
-   (identical to STEP 3 (MMIO Enabled)
-
-The platform then proceeds to either STEP 4 (Slot Reset) or STEP 5
-(Resume Operations).
-
->>> The current powerpc implementation does not implement this callback.
+"solved" by resetting the link.
 
 STEP 4: Slot Reset
 --
diff --git a/drivers/infiniband/hw/hfi1/pcie.c 
b/drivers/infiniband/hw/hfi1/pcie.c
index 4ac8f33..ebd941f 100644
--- a/drivers/infiniband/hw/hfi1/pcie.c
+++ b/drivers/infiniband/hw/hfi1/pcie.c
@@ -598,15 +598,6 @@ pci_slot_reset(struct pci_dev *pdev)
return PCI_ERS_RESULT_CAN_RECOVER;
 }
 
-static pci_ers_result_t
-pci_link_reset(struct pci_dev *pdev)
-{
-   struct hfi1_devdata *dd = pci_get_drvdata(pdev);
-
-   dd_dev_info(dd, "HFI1 link_reset function called, ignored\n");
-   return PCI_ERS_RESULT_CAN_RECOVER;
-}
-
 static void
 pci_resume(struct pci_dev *pdev)
 {
@@ -625,7 +616,6 @@ pci_resume(struct pci_dev *pdev)
 const struct pci_error_handlers hfi1_pci_err_handler = {
.error_detected = pci_error_detected,
.mmio_enabled = pci_mmio_enabled,
-   .link_reset = pci_link_reset,
.slot_reset = pci_slot_reset,
.resume = pci_resume,
 };
diff --git a/drivers/infiniband/hw/qib/qib_pcie.c 
b/drivers/infiniband/hw/qib/qib_pcie.c
index 6abe1c6..c379b83 100644
--- a/drivers/infiniband/hw/qib/qib_pcie.c
+++ b/drivers/infiniband/hw/qib/qib_pcie.c
@@ -682,13 +682,6 @@ qib_pci_slot_reset(struct pci_dev *pdev)
return PCI_ERS_RESULT_CAN_RECOVER;
 }
 
-static pci_ers_result_t
-qib_pci_link_reset(struct pci_dev *pdev)
-{
-   qib_devinfo(pdev, "QIB link_reset function called, ignored\n");
-   return PCI_ERS_RESULT_CAN_RECOVER;
-}
-
 static void
 qib_pci_resume(struct pci_dev *pdev)
 {
@@ -707,7 +700,6 @@ qib_pci_resume(struct pci_dev *pdev)
 const struct pci_error_handlers qib_pci_err_handler = {
.error_detected = qib_pci_error_detected,
.mmio_enabled = qib_pci_mmio_enabled,
-   .link_reset = qib_pci_link_reset,
.slot_reset = qib_pci_slot_reset,
.resume = qib_pci_resume,
 };
diff --git a/drivers/media/pci/ngene/ngene-cards.c 
b/drivers/media/pci/ngene/ngene-cards.c
index 423e8c8..8438c1c 100644
--- a/drivers/media/pci/ngene/ngene-cards.c
+++ 

Re: [PATCH v3] [media] coda: add Freescale firmware compatibility location

2017-01-18 Thread Baruch Siach
Hi Philipp,

On Wed, Jan 18, 2017 at 12:30:29PM +0100, Philipp Zabel wrote:
> On Sun, 2017-01-15 at 12:33 +0200, Baruch Siach wrote:
> > The Freescale provided imx-vpu looks for firmware files under 
> > /lib/firmware/vpu
> > by default. Make coda look there for firmware files to ease the update path.
> > 
> > Cc: Fabio Estevam 
> > Signed-off-by: Baruch Siach 
> > ---
> > v3: adjust the number of firmware locations in coda_devtype (kbuild test 
> > robot)
> > 
> > v2: add compatibility path; don't change existing path (Fabio)
> > ---
> >  drivers/media/platform/coda/coda-common.c | 4 
> >  drivers/media/platform/coda/coda.h| 2 +-
> >  2 files changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/media/platform/coda/coda-common.c 
> > b/drivers/media/platform/coda/coda-common.c
> > index 9e6bdafa16f5..ce0d00f3f3ba 100644
> > --- a/drivers/media/platform/coda/coda-common.c
> > +++ b/drivers/media/platform/coda/coda-common.c
> > @@ -2079,6 +2079,7 @@ static const struct coda_devtype coda_devdata[] = {
> > [CODA_IMX27] = {
> > .firmware = {
> > "vpu_fw_imx27_TO2.bin",
> > +   "vpu/vpu_fw_imx27_TO2.bin",
> > "v4l-codadx6-imx27.bin"
> > },
> > .product  = CODA_DX6,
> > @@ -2092,6 +2093,7 @@ static const struct coda_devtype coda_devdata[] = {
> > [CODA_IMX53] = {
> > .firmware = {
> > "vpu_fw_imx53.bin",
> > +   "vpu/vpu_fw_imx53.bin",
> > "v4l-coda7541-imx53.bin"
> > },
> > .product  = CODA_7541,
> > @@ -2106,6 +2108,7 @@ static const struct coda_devtype coda_devdata[] = {
> > [CODA_IMX6Q] = {
> > .firmware = {
> > "vpu_fw_imx6q.bin",
> > +   "vpu/vpu_fw_imx6q.bin",
> > "v4l-coda960-imx6q.bin"
> > },
> > .product  = CODA_960,
> > @@ -2120,6 +2123,7 @@ static const struct coda_devtype coda_devdata[] = {
> > [CODA_IMX6DL] = {
> > .firmware = {
> > "vpu_fw_imx6d.bin",
> > +   "vpu/vpu_fw_imx6d.bin",
> > "v4l-coda960-imx6dl.bin"
> > },
> > .product  = CODA_960,
> > diff --git a/drivers/media/platform/coda/coda.h 
> > b/drivers/media/platform/coda/coda.h
> > index 53f96661683c..8490bcb1fde2 100644
> > --- a/drivers/media/platform/coda/coda.h
> > +++ b/drivers/media/platform/coda/coda.h
> > @@ -50,7 +50,7 @@ enum coda_product {
> >  struct coda_video_device;
> >  
> >  struct coda_devtype {
> > -   char*firmware[2];
> > +   char*firmware[3];
> > enum coda_product   product;
> > const struct coda_codec *codecs;
> > unsigned intnum_codecs;
> 
> To increase the number of firmware paths, coda_fw_callback has to be
> modified, too. Otherwise it will just ignore firmware[2]:

Thanks for catching that. But shouldn't we make the firmware files list a NULL 
terminated array instead of spreading the array size knowledge all over the 
code?

I have one more question below.

>  static void coda_fw_callback(const struct firmware *fw, void *context)
>  {
>   struct coda_dev *dev = context;
>   struct platform_device *pdev = dev->plat_dev;
>   int i, ret;
> 
> - if (!fw && dev->firmware == 1) {
> + if (!fw && dev->firmware == 2) {
>   v4l2_err(>v4l2_dev, "firmware request failed\n");
>   goto put_pm;
>   }
>   if (!fw) {
> - dev->firmware = 1;
> + dev->firmware++;
>   coda_firmware_request(dev);
>   return;
>   }
> - if (dev->firmware == 1) {
> + if (dev->firmware > 0) {

Why would vpu/vpu_fw_*.bin and v4l-coda960-*.bin be considered fallback 
firmware?

>   /*  
>   
>* Since we can't suppress warnings for failed asynchronous
>* firmware requests, report that the fallback firmware was
>* found.
>*/
>   dev_info(>dev, "Using fallback firmware %s\n",
>dev->devtype->firmware[dev->firmware]);
>   }

Thanks,
baruch

-- 
 http://baruch.siach.name/blog/  ~. .~   Tk Open Systems
=}ooO--U--Ooo{=
   - bar...@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] saa7164: "first image" should be "second image" in error message

2017-01-18 Thread Colin King
From: Colin Ian King 

The error message when the second image is not available is incorrect,
replace "first image" with "second image".

Fixes CoverityScan CID#1077508 ("Copy-paste error")

Signed-off-by: Colin Ian King 
---
 drivers/media/pci/saa7164/saa7164-fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7164/saa7164-fw.c 
b/drivers/media/pci/saa7164/saa7164-fw.c
index 7f077a8..c384a94 100644
--- a/drivers/media/pci/saa7164/saa7164-fw.c
+++ b/drivers/media/pci/saa7164/saa7164-fw.c
@@ -309,7 +309,7 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev)
break;
}
if (err_flags & SAA_DEVICE_NO_IMAGE) {
-   printk(KERN_ERR "%s() no first image\n",
+   printk(KERN_ERR "%s() no second 
image\n",
__func__);
break;
}
-- 
2.10.2

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


Re: [PATCH 02/11] [media] s5p-mfc: Adding initial support for MFC v10.10

2017-01-18 Thread Andrzej Hajda
On 18.01.2017 11:02, Smitha T Murthy wrote:
> Adding the support for MFC v10.10, with new register file and
> necessary hw control, decoder, encoder and structural changes.
>
> CC: Rob Herring 
> CC: devicet...@vger.kernel.org 
> Signed-off-by: Smitha T Murthy 
> ---
>  .../devicetree/bindings/media/s5p-mfc.txt  |1 +
>  drivers/media/platform/s5p-mfc/regs-mfc-v10.h  |   36 
>  drivers/media/platform/s5p-mfc/s5p_mfc.c   |   30 +
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h|4 +-
>  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c  |4 ++
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |   44 
> +++-
>  drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   |   21 +
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c|9 +++-
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h|2 +
>  9 files changed, 118 insertions(+), 33 deletions(-)
>  create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v10.h
>
> diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt 
> b/Documentation/devicetree/bindings/media/s5p-mfc.txt
> index 2c90128..b70c613 100644
> --- a/Documentation/devicetree/bindings/media/s5p-mfc.txt
> +++ b/Documentation/devicetree/bindings/media/s5p-mfc.txt
> @@ -13,6 +13,7 @@ Required properties:
>   (c) "samsung,mfc-v7" for MFC v7 present in Exynos5420 SoC
>   (d) "samsung,mfc-v8" for MFC v8 present in Exynos5800 SoC
>   (e) "samsung,exynos5433-mfc" for MFC v8 present in Exynos5433 SoC
> + (f) "samsung,mfc-v10" for MFC v10 present in a variant of Exynos7 SoC

Could you specify explicitly SoC version(s), Exynos7 is misleading.
Btw are there plans to upstream platforms using this MFC?

>  
>- reg : Physical base address of the IP registers and length of memory
> mapped region.
> diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h 
> b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
> new file mode 100644
> index 000..bd671a5
> --- /dev/null
> +++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
> @@ -0,0 +1,36 @@
> +/*
> + * Register definition file for Samsung MFC V10.x Interface (FIMV) driver
> + *
> + * Copyright (c) 2017 Samsung Electronics Co., Ltd.
> + * http://www.samsung.com/
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef _REGS_MFC_V10_H
> +#define _REGS_MFC_V10_H
> +
> +#include 
> +#include "regs-mfc-v8.h"
> +
> +/* MFCv10 register definitions*/
> +#define S5P_FIMV_MFC_CLOCK_OFF_V10   0x7120
> +#define S5P_FIMV_MFC_STATE_V10   0x7124
> +
> +/* MFCv10 Context buffer sizes */
> +#define MFC_CTX_BUF_SIZE_V10 (30 * SZ_1K)/* 30KB */
> +#define MFC_H264_DEC_CTX_BUF_SIZE_V10(2 * SZ_1M) /* 2MB */
> +#define MFC_OTHER_DEC_CTX_BUF_SIZE_V10   (20 * SZ_1K)/* 20KB */
> +#define MFC_H264_ENC_CTX_BUF_SIZE_V10(100 * SZ_1K)   /* 100KB */
> +#define MFC_OTHER_ENC_CTX_BUF_SIZE_V10   (15 * SZ_1K)/* 15KB */
> +
> +/* MFCv10 variant defines */
> +#define MAX_FW_SIZE_V10  (SZ_1M) /* 1MB */
> +#define MAX_CPB_SIZE_V10 (3 * SZ_1M) /* 3MB */
> +#define MFC_VERSION_V10  0xA0
> +#define MFC_NUM_PORTS_V101
> +
> +#endif /*_REGS_MFC_V10_H*/
> +
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
> b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> index bb0a588..a043cce 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
> @@ -1542,6 +1542,33 @@ static int s5p_mfc_resume(struct device *dev)
>   .num_clocks = 3,
>  };
>  
> +static struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = {
> + .dev_ctx= MFC_CTX_BUF_SIZE_V10,
> + .h264_dec_ctx   = MFC_H264_DEC_CTX_BUF_SIZE_V10,
> + .other_dec_ctx  = MFC_OTHER_DEC_CTX_BUF_SIZE_V10,
> + .h264_enc_ctx   = MFC_H264_ENC_CTX_BUF_SIZE_V10,
> + .other_enc_ctx  = MFC_OTHER_ENC_CTX_BUF_SIZE_V10,
> +};
> +
> +static struct s5p_mfc_buf_size buf_size_v10 = {
> + .fw = MAX_FW_SIZE_V10,
> + .cpb= MAX_CPB_SIZE_V10,
> + .priv   = _buf_size_v10,
> +};
> +
> +static struct s5p_mfc_buf_align mfc_buf_align_v10 = {
> + .base = 0,
> +};
> +
> +static struct s5p_mfc_variant mfc_drvdata_v10 = {
> + .version= MFC_VERSION_V10,
> + .version_bit= MFC_V10_BIT,
> + .port_num   = MFC_NUM_PORTS_V10,
> + .buf_size   = _size_v10,
> + .buf_align  = _buf_align_v10,
> + .fw_name[0] = "s5p-mfc-v10.fw",

Is firmware file publicly available? Sent to firmware repository?

> +};
> +
>  static const struct of_device_id exynos_mfc_match[] = {
>   {
>   .compatible = "samsung,mfc-v5",
> @@ -1558,6 +1585,9 @@ static int s5p_mfc_resume(struct device 

Re: [PATCH 01/11] [media] s5p-mfc: Rename IS_MFCV8 macro

2017-01-18 Thread Andrzej Hajda
On 18.01.2017 11:01, Smitha T Murthy wrote:
> This patch renames macro IS_MFCV8 to IS_MFCV8_PLUS so that the MFCv8
> code can be resued for MFCv10.10 support. Since the MFCv8 specific code
> holds good for MFC v10.10 also.
>
> Signed-off-by: Smitha T Murthy 

Acked-by: Andrzej Hajda 
--
Regards
Andrzej

> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 +-
>  drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |2 +-
>  drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|2 +-
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   18 +-
>  4 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> index ab23236..b45d18c 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
> @@ -722,7 +722,7 @@ struct mfc_control {
>  #define IS_TWOPORT(dev)  (dev->variant->port_num == 2 ? 1 : 0)
>  #define IS_MFCV6_PLUS(dev)   (dev->variant->version >= 0x60 ? 1 : 0)
>  #define IS_MFCV7_PLUS(dev)   (dev->variant->version >= 0x70 ? 1 : 0)
> -#define IS_MFCV8(dev)(dev->variant->version >= 0x80 ? 1 : 0)
> +#define IS_MFCV8_PLUS(dev)   (dev->variant->version >= 0x80 ? 1 : 0)
>  
>  #define MFC_V5_BIT   BIT(0)
>  #define MFC_V6_BIT   BIT(1)
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
> index cc88871..484af6b 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
> @@ -427,7 +427,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev)
>   s5p_mfc_clear_cmds(dev);
>   s5p_mfc_clean_dev_int_flags(dev);
>   /* 3. Send MFC wakeup command and wait for completion*/
> - if (IS_MFCV8(dev))
> + if (IS_MFCV8_PLUS(dev))
>   ret = s5p_mfc_v8_wait_wakeup(dev);
>   else
>   ret = s5p_mfc_wait_wakeup(dev);
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> index 367ef8e..0ec2928 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
> @@ -1177,7 +1177,7 @@ void s5p_mfc_dec_init(struct s5p_mfc_ctx *ctx)
>   struct v4l2_format f;
>   f.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
>   ctx->src_fmt = find_format(, MFC_FMT_DEC);
> - if (IS_MFCV8(ctx->dev))
> + if (IS_MFCV8_PLUS(ctx->dev))
>   f.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M;
>   else if (IS_MFCV6_PLUS(ctx->dev))
>   f.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16;
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> index 57da798..0572521 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> @@ -74,7 +74,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
> s5p_mfc_ctx *ctx)
> ctx->luma_size, ctx->chroma_size, ctx->mv_size);
>   mfc_debug(2, "Totals bufs: %d\n", ctx->total_dpb_count);
>   } else if (ctx->type == MFCINST_ENCODER) {
> - if (IS_MFCV8(dev))
> + if (IS_MFCV8_PLUS(dev))
>   ctx->tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 *
>   ALIGN(S5P_FIMV_TMV_BUFFER_SIZE_V8(mb_width, mb_height),
>   S5P_FIMV_TMV_BUFFER_ALIGN_V6);
> @@ -89,7 +89,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
> s5p_mfc_ctx *ctx)
>   ctx->chroma_dpb_size = ALIGN((mb_width * mb_height) *
>   S5P_FIMV_CHROMA_MB_TO_PIXEL_V6,
>   S5P_FIMV_CHROMA_DPB_BUFFER_ALIGN_V6);
> - if (IS_MFCV8(dev))
> + if (IS_MFCV8_PLUS(dev))
>   ctx->me_buffer_size = ALIGN(S5P_FIMV_ME_BUFFER_SIZE_V8(
>   ctx->img_width, ctx->img_height,
>   mb_width, mb_height),
> @@ -110,7 +110,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
> s5p_mfc_ctx *ctx)
>   switch (ctx->codec_mode) {
>   case S5P_MFC_CODEC_H264_DEC:
>   case S5P_MFC_CODEC_H264_MVC_DEC:
> - if (IS_MFCV8(dev))
> + if (IS_MFCV8_PLUS(dev))
>   ctx->scratch_buf_size =
>   S5P_FIMV_SCRATCH_BUF_SIZE_H264_DEC_V8(
>   mb_width,
> @@ -167,7 +167,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
> s5p_mfc_ctx *ctx)
>   ctx->bank1.size = ctx->scratch_buf_size;
>   break;
>   case S5P_MFC_CODEC_VP8_DEC:
> - if (IS_MFCV8(dev))
> + if (IS_MFCV8_PLUS(dev))
>   ctx->scratch_buf_size =
>   

Re: [PATCH] [media] s5p-mfc: Align stream buffer and CPB buffer to 512

2017-01-18 Thread Andrzej Hajda
Hi Smitha,

On 18.01.2017 10:37, Smitha T Murthy wrote:
> >From MFCv6 onwards encoder stream buffer and decoder CPB buffer

Unexpected char at the beginning.

> need to be aligned with 512.

Patch below adds checks only if buffer size is multiple of 512, am I right?
If yes, please precise the subject, for example "...CPB buffer size need
to be...".


>
> Signed-off-by: Smitha T Murthy 
> ---
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |9 +
>  drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h |3 +++
>  2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> index d6f207e..57da798 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
> @@ -408,8 +408,15 @@ static int s5p_mfc_set_dec_stream_buffer_v6(struct 
> s5p_mfc_ctx *ctx,
>   struct s5p_mfc_dev *dev = ctx->dev;
>   const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;
>   struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
> + size_t cpb_buf_size;
>  
>   mfc_debug_enter();
> + cpb_buf_size = ALIGN(buf_size->cpb, CPB_ALIGN);

Since buf_size->cpb is constant of know size there is no need to align
it here.

> + if (strm_size >= set_strm_size_max(cpb_buf_size)) {
> + mfc_debug(2, "Decrease strm_size : %u -> %zu, gap : %d\n",
> + strm_size, set_strm_size_max(cpb_buf_size), CPB_ALIGN);
> + strm_size = set_strm_size_max(cpb_buf_size);
> + }

As I understand strm_size here is a size of buffer to be decoded, why it
cannot be equal to buf_size->cpb? Commit message says nothing about it.

>   mfc_debug(2, "inst_no: %d, buf_addr: 0x%08x,\n"
>   "buf_size: 0x%08x (%d)\n",
>   ctx->inst_no, buf_addr, strm_size, strm_size);
> @@ -519,6 +526,8 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct 
> s5p_mfc_ctx *ctx,
>   struct s5p_mfc_dev *dev = ctx->dev;
>   const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;
>  
> + size = ALIGN(size, 512);
> +

Shouldn't be CPB_ALIGN instead of 512? And more importantly size is a
length of buffer for encoded stream,
by up-aligning you tell MFC that it can write beyond the buffer, it
could potentially overwrite random memory? Am I right?


>   writel(addr, mfc_regs->e_stream_buffer_addr); /* 16B align */
>   writel(size, mfc_regs->e_stream_buffer_size);
>  
> diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h 
> b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
> index 8055848..16a7b1d 100644
> --- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
> +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
> @@ -40,6 +40,9 @@
>  #define FRAME_DELTA_H264_H2631
>  #define TIGHT_CBR_MAX10
>  
> +#define CPB_ALIGN512
> +#define set_strm_size_max(cpb_max)   ((cpb_max) - CPB_ALIGN)

Name of the macro is misleading.

Regards
Andrzej

> +
>  struct s5p_mfc_hw_ops *s5p_mfc_init_hw_ops_v6(void);
>  const struct s5p_mfc_regs *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev 
> *dev);
>  #endif /* S5P_MFC_OPR_V6_H_ */


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


Re: [PATCH v3] [media] coda: add Freescale firmware compatibility location

2017-01-18 Thread Philipp Zabel
Hi Baruch,

On Sun, 2017-01-15 at 12:33 +0200, Baruch Siach wrote:
> The Freescale provided imx-vpu looks for firmware files under 
> /lib/firmware/vpu
> by default. Make coda look there for firmware files to ease the update path.
> 
> Cc: Fabio Estevam 
> Signed-off-by: Baruch Siach 
> ---
> v3: adjust the number of firmware locations in coda_devtype (kbuild test 
> robot)
> 
> v2: add compatibility path; don't change existing path (Fabio)
> ---
>  drivers/media/platform/coda/coda-common.c | 4 
>  drivers/media/platform/coda/coda.h| 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c 
> b/drivers/media/platform/coda/coda-common.c
> index 9e6bdafa16f5..ce0d00f3f3ba 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -2079,6 +2079,7 @@ static const struct coda_devtype coda_devdata[] = {
>   [CODA_IMX27] = {
>   .firmware = {
>   "vpu_fw_imx27_TO2.bin",
> + "vpu/vpu_fw_imx27_TO2.bin",
>   "v4l-codadx6-imx27.bin"
>   },
>   .product  = CODA_DX6,
> @@ -2092,6 +2093,7 @@ static const struct coda_devtype coda_devdata[] = {
>   [CODA_IMX53] = {
>   .firmware = {
>   "vpu_fw_imx53.bin",
> + "vpu/vpu_fw_imx53.bin",
>   "v4l-coda7541-imx53.bin"
>   },
>   .product  = CODA_7541,
> @@ -2106,6 +2108,7 @@ static const struct coda_devtype coda_devdata[] = {
>   [CODA_IMX6Q] = {
>   .firmware = {
>   "vpu_fw_imx6q.bin",
> + "vpu/vpu_fw_imx6q.bin",
>   "v4l-coda960-imx6q.bin"
>   },
>   .product  = CODA_960,
> @@ -2120,6 +2123,7 @@ static const struct coda_devtype coda_devdata[] = {
>   [CODA_IMX6DL] = {
>   .firmware = {
>   "vpu_fw_imx6d.bin",
> + "vpu/vpu_fw_imx6d.bin",
>   "v4l-coda960-imx6dl.bin"
>   },
>   .product  = CODA_960,
> diff --git a/drivers/media/platform/coda/coda.h 
> b/drivers/media/platform/coda/coda.h
> index 53f96661683c..8490bcb1fde2 100644
> --- a/drivers/media/platform/coda/coda.h
> +++ b/drivers/media/platform/coda/coda.h
> @@ -50,7 +50,7 @@ enum coda_product {
>  struct coda_video_device;
>  
>  struct coda_devtype {
> - char*firmware[2];
> + char*firmware[3];
>   enum coda_product   product;
>   const struct coda_codec *codecs;
>   unsigned intnum_codecs;

To increase the number of firmware paths, coda_fw_callback has to be
modified, too. Otherwise it will just ignore firmware[2]:

 static void coda_fw_callback(const struct firmware *fw, void *context)
 {
struct coda_dev *dev = context;
struct platform_device *pdev = dev->plat_dev;
int i, ret;

-   if (!fw && dev->firmware == 1) {
+   if (!fw && dev->firmware == 2) {
v4l2_err(>v4l2_dev, "firmware request failed\n");
goto put_pm;
}
if (!fw) {
-   dev->firmware = 1;
+   dev->firmware++;
coda_firmware_request(dev);
return;
}
-   if (dev->firmware == 1) {
+   if (dev->firmware > 0) {
/*  
  
 * Since we can't suppress warnings for failed asynchronous
 * firmware requests, report that the fallback firmware was
 * found.
 */
dev_info(>dev, "Using fallback firmware %s\n",
 dev->devtype->firmware[dev->firmware]);
}

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


[PATCH 05/11] [media] s5p-mfc: Add support for HEVC decoder

2017-01-18 Thread Smitha T Murthy
Add support for codec definition and corresponding buffer
requirements for HEVC decoder.

Signed-off-by: Smitha T Murthy 
---
 drivers/media/platform/s5p-mfc/regs-mfc-v10.h   |3 +++
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c |3 +++
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|8 
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   18 --
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h |5 +
 6 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
index 153ee68..a57009a 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
@@ -32,6 +32,9 @@
 #define MFC_VERSION_V100xA0
 #define MFC_NUM_PORTS_V10  1
 
+/* MFCv10 codec defines*/
+#define S5P_FIMV_CODEC_HEVC_DEC17
+
 /* Encoder buffer size for MFC v10.0 */
 #define ENC_V100_H264_ME_SIZE(x, y)\
(((x + 3) * (y + 3) * 8)\
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index b1b1491..76eca67 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -101,6 +101,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
case S5P_MFC_CODEC_VP8_DEC:
codec_type = S5P_FIMV_CODEC_VP8_DEC_V6;
break;
+   case S5P_MFC_CODEC_HEVC_DEC:
+   codec_type = S5P_FIMV_CODEC_HEVC_DEC;
+   break;
case S5P_MFC_CODEC_H264_ENC:
codec_type = S5P_FIMV_CODEC_H264_ENC_V6;
break;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 998e24b..5c46060 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -79,6 +79,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
 #define S5P_MFC_CODEC_H263_DEC 5
 #define S5P_MFC_CODEC_VC1RCV_DEC   6
 #define S5P_MFC_CODEC_VP8_DEC  7
+#define S5P_MFC_CODEC_HEVC_DEC 17
 
 #define S5P_MFC_CODEC_H264_ENC 20
 #define S5P_MFC_CODEC_H264_MVC_ENC 21
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 784b28e..9f459b3 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -156,6 +156,14 @@
.versions   = MFC_V6_BIT | MFC_V7_BIT | MFC_V8_BIT |
MFC_V10_BIT,
},
+   {
+   .name   = "HEVC Encoded Stream",
+   .fourcc = V4L2_PIX_FMT_HEVC,
+   .codec_mode = S5P_FIMV_CODEC_HEVC_DEC,
+   .type   = MFC_FMT_DEC,
+   .num_planes = 1,
+   .versions   = MFC_V10_BIT,
+   },
 };
 
 #define NUM_FORMATS ARRAY_SIZE(formats)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 369210a..b6cb280 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -220,6 +220,13 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6);
ctx->bank1.size = ctx->scratch_buf_size;
break;
+   case S5P_MFC_CODEC_HEVC_DEC:
+   mfc_debug(2, "Use min scratch buffer size\n");
+   ctx->scratch_buf_size = ALIGN(ctx->scratch_buf_size, 256);
+   ctx->bank1.size =
+   ctx->scratch_buf_size +
+   (ctx->mv_count * ctx->mv_size);
+   break;
case S5P_MFC_CODEC_H264_ENC:
if (IS_MFCV10(dev)) {
mfc_debug(2, "Use min scratch buffer size\n");
@@ -322,6 +329,7 @@ static int s5p_mfc_alloc_instance_buffer_v6(struct 
s5p_mfc_ctx *ctx)
switch (ctx->codec_mode) {
case S5P_MFC_CODEC_H264_DEC:
case S5P_MFC_CODEC_H264_MVC_DEC:
+   case S5P_MFC_CODEC_HEVC_DEC:
ctx->ctx.size = buf_size->h264_dec_ctx;
break;
case S5P_MFC_CODEC_MPEG4_DEC:
@@ -438,6 +446,10 @@ static void s5p_mfc_dec_calc_dpb_size_v6(struct 
s5p_mfc_ctx *ctx)
ctx->img_height);
ctx->mv_size = ALIGN(ctx->mv_size, 16);
}
+   } else if (ctx->codec_mode == S5P_MFC_CODEC_HEVC_DEC) {
+   ctx->mv_size = s5p_mfc_dec_hevc_mv_size(ctx->img_width,
+   ctx->img_height);
+   ctx->mv_size = ALIGN(ctx->mv_size, 32);
} else {
 

[PATCH 02/11] [media] s5p-mfc: Adding initial support for MFC v10.10

2017-01-18 Thread Smitha T Murthy
Adding the support for MFC v10.10, with new register file and
necessary hw control, decoder, encoder and structural changes.

CC: Rob Herring 
CC: devicet...@vger.kernel.org 
Signed-off-by: Smitha T Murthy 
---
 .../devicetree/bindings/media/s5p-mfc.txt  |1 +
 drivers/media/platform/s5p-mfc/regs-mfc-v10.h  |   36 
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |   30 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|4 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c  |4 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |   44 +++-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   |   21 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c|9 +++-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h|2 +
 9 files changed, 118 insertions(+), 33 deletions(-)
 create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v10.h

diff --git a/Documentation/devicetree/bindings/media/s5p-mfc.txt 
b/Documentation/devicetree/bindings/media/s5p-mfc.txt
index 2c90128..b70c613 100644
--- a/Documentation/devicetree/bindings/media/s5p-mfc.txt
+++ b/Documentation/devicetree/bindings/media/s5p-mfc.txt
@@ -13,6 +13,7 @@ Required properties:
(c) "samsung,mfc-v7" for MFC v7 present in Exynos5420 SoC
(d) "samsung,mfc-v8" for MFC v8 present in Exynos5800 SoC
(e) "samsung,exynos5433-mfc" for MFC v8 present in Exynos5433 SoC
+   (f) "samsung,mfc-v10" for MFC v10 present in a variant of Exynos7 SoC
 
   - reg : Physical base address of the IP registers and length of memory
  mapped region.
diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
new file mode 100644
index 000..bd671a5
--- /dev/null
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
@@ -0,0 +1,36 @@
+/*
+ * Register definition file for Samsung MFC V10.x Interface (FIMV) driver
+ *
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _REGS_MFC_V10_H
+#define _REGS_MFC_V10_H
+
+#include 
+#include "regs-mfc-v8.h"
+
+/* MFCv10 register definitions*/
+#define S5P_FIMV_MFC_CLOCK_OFF_V10 0x7120
+#define S5P_FIMV_MFC_STATE_V10 0x7124
+
+/* MFCv10 Context buffer sizes */
+#define MFC_CTX_BUF_SIZE_V10   (30 * SZ_1K)/* 30KB */
+#define MFC_H264_DEC_CTX_BUF_SIZE_V10  (2 * SZ_1M) /* 2MB */
+#define MFC_OTHER_DEC_CTX_BUF_SIZE_V10 (20 * SZ_1K)/* 20KB */
+#define MFC_H264_ENC_CTX_BUF_SIZE_V10  (100 * SZ_1K)   /* 100KB */
+#define MFC_OTHER_ENC_CTX_BUF_SIZE_V10 (15 * SZ_1K)/* 15KB */
+
+/* MFCv10 variant defines */
+#define MAX_FW_SIZE_V10(SZ_1M) /* 1MB */
+#define MAX_CPB_SIZE_V10   (3 * SZ_1M) /* 3MB */
+#define MFC_VERSION_V100xA0
+#define MFC_NUM_PORTS_V10  1
+
+#endif /*_REGS_MFC_V10_H*/
+
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index bb0a588..a043cce 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1542,6 +1542,33 @@ static int s5p_mfc_resume(struct device *dev)
.num_clocks = 3,
 };
 
+static struct s5p_mfc_buf_size_v6 mfc_buf_size_v10 = {
+   .dev_ctx= MFC_CTX_BUF_SIZE_V10,
+   .h264_dec_ctx   = MFC_H264_DEC_CTX_BUF_SIZE_V10,
+   .other_dec_ctx  = MFC_OTHER_DEC_CTX_BUF_SIZE_V10,
+   .h264_enc_ctx   = MFC_H264_ENC_CTX_BUF_SIZE_V10,
+   .other_enc_ctx  = MFC_OTHER_ENC_CTX_BUF_SIZE_V10,
+};
+
+static struct s5p_mfc_buf_size buf_size_v10 = {
+   .fw = MAX_FW_SIZE_V10,
+   .cpb= MAX_CPB_SIZE_V10,
+   .priv   = _buf_size_v10,
+};
+
+static struct s5p_mfc_buf_align mfc_buf_align_v10 = {
+   .base = 0,
+};
+
+static struct s5p_mfc_variant mfc_drvdata_v10 = {
+   .version= MFC_VERSION_V10,
+   .version_bit= MFC_V10_BIT,
+   .port_num   = MFC_NUM_PORTS_V10,
+   .buf_size   = _size_v10,
+   .buf_align  = _buf_align_v10,
+   .fw_name[0] = "s5p-mfc-v10.fw",
+};
+
 static const struct of_device_id exynos_mfc_match[] = {
{
.compatible = "samsung,mfc-v5",
@@ -1558,6 +1585,9 @@ static int s5p_mfc_resume(struct device *dev)
}, {
.compatible = "samsung,exynos5433-mfc",
.data = _drvdata_v8_5433,
+   }, {
+   .compatible = "samsung,mfc-v10",
+   .data = _drvdata_v10,
},
{},
 };
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index b45d18c..1941c63 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ 

[PATCH 09/11] [media] s5p-mfc: Add support for HEVC encoder

2017-01-18 Thread Smitha T Murthy
Add HEVC encoder support and necessary registers, V4L2 CIDs,
and hevc encoder parameters

Signed-off-by: Smitha T Murthy 
---
 drivers/media/platform/s5p-mfc/regs-mfc-v10.h   |   28 +-
 drivers/media/platform/s5p-mfc/s5p_mfc.c|1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c |3 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |   55 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|  595 +++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.h|8 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |  200 
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h |7 +
 8 files changed, 895 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
index 81a0a96..914ffec 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
@@ -20,13 +20,35 @@
 #define S5P_FIMV_MFC_STATE_V10 0x7124
 #define S5P_FIMV_D_STATIC_BUFFER_ADDR_V10  0xF570
 #define S5P_FIMV_D_STATIC_BUFFER_SIZE_V10  0xF574
+#define S5P_FIMV_E_NUM_T_LAYER_V10 0xFBAC
+#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER0_V10  0xFBB0
+#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER1_V10  0xFBB4
+#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER2_V10  0xFBB8
+#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER3_V10  0xFBBC
+#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER4_V10  0xFBC0
+#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER5_V10  0xFBC4
+#define S5P_FIMV_E_HIERARCHICAL_QP_LAYER6_V10  0xFBC8
+#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER0_V100xFD18
+#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER1_V100xFD1C
+#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER2_V100xFD20
+#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER3_V100xFD24
+#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER4_V100xFD28
+#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER5_V100xFD2C
+#define S5P_FIMV_E_HIERARCHICAL_BIT_RATE_LAYER6_V100xFD30
+#define S5P_FIMV_E_HEVC_OPTIONS_V100xFDD4
+#define S5P_FIMV_E_HEVC_REFRESH_PERIOD_V10 0xFDD8
+#define S5P_FIMV_E_HEVC_CHROMA_QP_OFFSET_V10   0xFDDC
+#define S5P_FIMV_E_HEVC_LF_BETA_OFFSET_DIV2_V100xFDE0
+#define S5P_FIMV_E_HEVC_LF_TC_OFFSET_DIV2_V10  0xFDE4
+#define S5P_FIMV_E_HEVC_NAL_CONTROL_V100xFDE8
 
 /* MFCv10 Context buffer sizes */
 #define MFC_CTX_BUF_SIZE_V10   (30 * SZ_1K)/* 30KB */
 #define MFC_H264_DEC_CTX_BUF_SIZE_V10  (2 * SZ_1M) /* 2MB */
 #define MFC_OTHER_DEC_CTX_BUF_SIZE_V10 (20 * SZ_1K)/* 20KB */
 #define MFC_H264_ENC_CTX_BUF_SIZE_V10  (100 * SZ_1K)   /* 100KB */
-#define MFC_OTHER_ENC_CTX_BUF_SIZE_V10 (15 * SZ_1K)/* 15KB */
+#define MFC_HEVC_ENC_CTX_BUF_SIZE_V10  (30 * SZ_1K)/* 30KB */
+#define MFC_OTHER_ENC_CTX_BUF_SIZE_V10  (15 * SZ_1K)   /* 15KB */
 
 /* MFCv10 variant defines */
 #define MAX_FW_SIZE_V10(SZ_1M) /* 1MB */
@@ -37,6 +59,7 @@
 /* MFCv10 codec defines*/
 #define S5P_FIMV_CODEC_HEVC_DEC17
 #define S5P_FIMV_CODEC_VP9_DEC 18
+#define S5P_FIMV_CODEC_HEVC_ENC 26
 
 /* Decoder buffer size for MFC v10 */
 #define DEC_VP9_STATIC_BUFFER_SIZE 20480
@@ -53,6 +76,9 @@
 #define ENC_V100_VP8_ME_SIZE(x, y) \
(((x + 3) * (y + 3) * 8)\
 + (((y * 64) + 1280) * (x + 7) / 8))
+#define ENC_V100_HEVC_ME_SIZE(x, y)\
+   (((x + 3) * (y + 3) * 32)   \
++ (((y * 128) + 1280) * (x + 3) / 4))
 
 #endif /*_REGS_MFC_V10_H*/
 
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index b014038..b01c556 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1549,6 +1549,7 @@ static int s5p_mfc_resume(struct device *dev)
.h264_dec_ctx   = MFC_H264_DEC_CTX_BUF_SIZE_V10,
.other_dec_ctx  = MFC_OTHER_DEC_CTX_BUF_SIZE_V10,
.h264_enc_ctx   = MFC_H264_ENC_CTX_BUF_SIZE_V10,
+   .hevc_enc_ctx   = MFC_HEVC_ENC_CTX_BUF_SIZE_V10,
.other_enc_ctx  = MFC_OTHER_ENC_CTX_BUF_SIZE_V10,
 };
 
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index 102b47e..7521fce 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -122,6 +122,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
case S5P_MFC_CODEC_VP8_ENC:
codec_type = S5P_FIMV_CODEC_VP8_ENC_V7;
break;
+   case S5P_MFC_CODEC_HEVC_ENC:
+   codec_type = S5P_FIMV_CODEC_HEVC_ENC;
+   break;
default:
codec_type = S5P_FIMV_CODEC_NONE_V6;
}
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 

[PATCH 01/11] [media] s5p-mfc: Rename IS_MFCV8 macro

2017-01-18 Thread Smitha T Murthy
This patch renames macro IS_MFCV8 to IS_MFCV8_PLUS so that the MFCv8
code can be resued for MFCv10.10 support. Since the MFCv8 specific code
holds good for MFC v10.10 also.

Signed-off-by: Smitha T Murthy 
---
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c   |2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|2 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   18 +-
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index ab23236..b45d18c 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -722,7 +722,7 @@ struct mfc_control {
 #define IS_TWOPORT(dev)(dev->variant->port_num == 2 ? 1 : 0)
 #define IS_MFCV6_PLUS(dev) (dev->variant->version >= 0x60 ? 1 : 0)
 #define IS_MFCV7_PLUS(dev) (dev->variant->version >= 0x70 ? 1 : 0)
-#define IS_MFCV8(dev)  (dev->variant->version >= 0x80 ? 1 : 0)
+#define IS_MFCV8_PLUS(dev) (dev->variant->version >= 0x80 ? 1 : 0)
 
 #define MFC_V5_BIT BIT(0)
 #define MFC_V6_BIT BIT(1)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
index cc88871..484af6b 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c
@@ -427,7 +427,7 @@ int s5p_mfc_wakeup(struct s5p_mfc_dev *dev)
s5p_mfc_clear_cmds(dev);
s5p_mfc_clean_dev_int_flags(dev);
/* 3. Send MFC wakeup command and wait for completion*/
-   if (IS_MFCV8(dev))
+   if (IS_MFCV8_PLUS(dev))
ret = s5p_mfc_v8_wait_wakeup(dev);
else
ret = s5p_mfc_wait_wakeup(dev);
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 367ef8e..0ec2928 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -1177,7 +1177,7 @@ void s5p_mfc_dec_init(struct s5p_mfc_ctx *ctx)
struct v4l2_format f;
f.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_H264;
ctx->src_fmt = find_format(, MFC_FMT_DEC);
-   if (IS_MFCV8(ctx->dev))
+   if (IS_MFCV8_PLUS(ctx->dev))
f.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12M;
else if (IS_MFCV6_PLUS(ctx->dev))
f.fmt.pix_mp.pixelformat = V4L2_PIX_FMT_NV12MT_16X16;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index 57da798..0572521 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -74,7 +74,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx 
*ctx)
  ctx->luma_size, ctx->chroma_size, ctx->mv_size);
mfc_debug(2, "Totals bufs: %d\n", ctx->total_dpb_count);
} else if (ctx->type == MFCINST_ENCODER) {
-   if (IS_MFCV8(dev))
+   if (IS_MFCV8_PLUS(dev))
ctx->tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 *
ALIGN(S5P_FIMV_TMV_BUFFER_SIZE_V8(mb_width, mb_height),
S5P_FIMV_TMV_BUFFER_ALIGN_V6);
@@ -89,7 +89,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx 
*ctx)
ctx->chroma_dpb_size = ALIGN((mb_width * mb_height) *
S5P_FIMV_CHROMA_MB_TO_PIXEL_V6,
S5P_FIMV_CHROMA_DPB_BUFFER_ALIGN_V6);
-   if (IS_MFCV8(dev))
+   if (IS_MFCV8_PLUS(dev))
ctx->me_buffer_size = ALIGN(S5P_FIMV_ME_BUFFER_SIZE_V8(
ctx->img_width, ctx->img_height,
mb_width, mb_height),
@@ -110,7 +110,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
switch (ctx->codec_mode) {
case S5P_MFC_CODEC_H264_DEC:
case S5P_MFC_CODEC_H264_MVC_DEC:
-   if (IS_MFCV8(dev))
+   if (IS_MFCV8_PLUS(dev))
ctx->scratch_buf_size =
S5P_FIMV_SCRATCH_BUF_SIZE_H264_DEC_V8(
mb_width,
@@ -167,7 +167,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
ctx->bank1.size = ctx->scratch_buf_size;
break;
case S5P_MFC_CODEC_VP8_DEC:
-   if (IS_MFCV8(dev))
+   if (IS_MFCV8_PLUS(dev))
ctx->scratch_buf_size =
S5P_FIMV_SCRATCH_BUF_SIZE_VP8_DEC_V8(
mb_width,
@@ -182,7 +182,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
ctx->bank1.size 

[PATCH 08/11] [media] s5p-mfc: Add VP9 decoder support

2017-01-18 Thread Smitha T Murthy
Add support for codec definition and corresponding buffer
requirements for VP9 decoder.

Signed-off-by: Smitha T Murthy 
---
 drivers/media/platform/s5p-mfc/regs-mfc-v10.h   |6 +
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c |3 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c|8 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.h|2 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   28 +++
 6 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
index a57009a..81a0a96 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
@@ -18,6 +18,8 @@
 /* MFCv10 register definitions*/
 #define S5P_FIMV_MFC_CLOCK_OFF_V10 0x7120
 #define S5P_FIMV_MFC_STATE_V10 0x7124
+#define S5P_FIMV_D_STATIC_BUFFER_ADDR_V10  0xF570
+#define S5P_FIMV_D_STATIC_BUFFER_SIZE_V10  0xF574
 
 /* MFCv10 Context buffer sizes */
 #define MFC_CTX_BUF_SIZE_V10   (30 * SZ_1K)/* 30KB */
@@ -34,6 +36,10 @@
 
 /* MFCv10 codec defines*/
 #define S5P_FIMV_CODEC_HEVC_DEC17
+#define S5P_FIMV_CODEC_VP9_DEC 18
+
+/* Decoder buffer size for MFC v10 */
+#define DEC_VP9_STATIC_BUFFER_SIZE 20480
 
 /* Encoder buffer size for MFC v10.0 */
 #define ENC_V100_H264_ME_SIZE(x, y)\
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
index 76eca67..102b47e 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c
@@ -104,6 +104,9 @@ static int s5p_mfc_open_inst_cmd_v6(struct s5p_mfc_ctx *ctx)
case S5P_MFC_CODEC_HEVC_DEC:
codec_type = S5P_FIMV_CODEC_HEVC_DEC;
break;
+   case S5P_MFC_CODEC_VP9_DEC:
+   codec_type = S5P_FIMV_CODEC_VP9_DEC;
+   break;
case S5P_MFC_CODEC_H264_ENC:
codec_type = S5P_FIMV_CODEC_H264_ENC_V6;
break;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 5c46060..e720ce6 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -80,6 +80,7 @@ static inline dma_addr_t s5p_mfc_mem_cookie(void *a, void *b)
 #define S5P_MFC_CODEC_VC1RCV_DEC   6
 #define S5P_MFC_CODEC_VP8_DEC  7
 #define S5P_MFC_CODEC_HEVC_DEC 17
+#define S5P_MFC_CODEC_VP9_DEC  18
 
 #define S5P_MFC_CODEC_H264_ENC 20
 #define S5P_MFC_CODEC_H264_MVC_ENC 21
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
index 9f459b3..93626ed 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_dec.c
@@ -164,6 +164,14 @@
.num_planes = 1,
.versions   = MFC_V10_BIT,
},
+   {
+   .name   = "VP9 Encoded Stream",
+   .fourcc = V4L2_PIX_FMT_VP9,
+   .codec_mode = S5P_FIMV_CODEC_VP9_DEC,
+   .type   = MFC_FMT_DEC,
+   .num_planes = 1,
+   .versions   = MFC_V10_BIT,
+   },
 };
 
 #define NUM_FORMATS ARRAY_SIZE(formats)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
index 6478f70..565decf 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
@@ -170,6 +170,8 @@ struct s5p_mfc_regs {
void __iomem *d_used_dpb_flag_upper;/* v7 and v8 */
void __iomem *d_used_dpb_flag_lower;/* v7 and v8 */
void __iomem *d_min_scratch_buffer_size; /* v10 */
+   void __iomem *d_static_buffer_addr; /* v10 */
+   void __iomem *d_static_buffer_size; /* v10 */
 
/* encoder registers */
void __iomem *e_frame_width;
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index b6cb280..da4202f 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -227,6 +227,13 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
ctx->scratch_buf_size +
(ctx->mv_count * ctx->mv_size);
break;
+   case S5P_MFC_CODEC_VP9_DEC:
+   mfc_debug(2, "Use min scratch buffer size\n");
+   ctx->scratch_buf_size = ALIGN(ctx->scratch_buf_size, 256);
+   ctx->bank1.size =
+   ctx->scratch_buf_size +
+   DEC_VP9_STATIC_BUFFER_SIZE;
+   break;
case S5P_MFC_CODEC_H264_ENC:
   

[PATCH 06/11] [media] videodev2.h: Add v4l2 definition for HEVC

2017-01-18 Thread Smitha T Murthy
Add V4L2 definition for HEVC compressed format

Signed-off-by: Smitha T Murthy 
---
 include/uapi/linux/videodev2.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 46e8a2e3..620e941 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -630,6 +630,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M 
Annex L compliant stream */
 #define V4L2_PIX_FMT_VP8  v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
 #define V4L2_PIX_FMT_VP9  v4l2_fourcc('V', 'P', '9', '0') /* VP9 */
+#define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC */
 
 /*  Vendor-specific formats   */
 #define V4L2_PIX_FMT_CPIA1v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
-- 
1.7.2.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


Geschäftsvorschlag

2017-01-18 Thread tester
Lieber Freund.

Erlauben Sie mir, auf diese Weise auf Sie zuzugehen. Ich bin Dr. Arnold 
Kristofferson, ein US-Auftragnehmer, der mit Nichtkämpfer US Marine in 
Ba'qubah, Irak arbeitet. Ich habe die Summe von 10,6 Millionen Dollar, die ich 
aus einem Rohöl-Deal gemacht habe, und ich möchte, dass Sie mir helfen, es zu 
erhalten. Da ich hier auf offizieller Kapazität arbeite, kann ich diesen Fonds 
nicht bei mir behalten und dies ist mein einziger Grund für die Kontaktaufnahme 
mit Ihnen. Wenn Sie interessiert sind und Sie diesen Fonds in Ihrer Kapazität 
erhalten können, melden Sie sich bitte bei mir, damit ich Ihnen weitere Details 
geben kann, wie Sie dieses Geld für mich erhalten können. Bitte erreichen Sie 
mich per E-Mail: arnoldkristoferson...@gmail.com
Mit freundlichen Grüßen.

--
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 11/11] Documention: v4l: Documentation for HEVC CIDs

2017-01-18 Thread Smitha T Murthy
Added V4l2 controls for HEVC encoder

CC: Laurent Pinchart 
Signed-off-by: Smitha T Murthy 
---
 Documentation/media/uapi/v4l/extended-controls.rst |  190 
 1 files changed, 190 insertions(+), 0 deletions(-)

diff --git a/Documentation/media/uapi/v4l/extended-controls.rst 
b/Documentation/media/uapi/v4l/extended-controls.rst
index abb1057..fe23919 100644
--- a/Documentation/media/uapi/v4l/extended-controls.rst
+++ b/Documentation/media/uapi/v4l/extended-controls.rst
@@ -1960,6 +1960,196 @@ enum v4l2_vp8_golden_frame_sel -
 1, 2 and 3 corresponding to encoder profiles 0, 1, 2 and 3.
 
 
+HEVC Control Reference
+-
+
+The HEVC controls include controls for encoding parameters of HEVC video
+codec.
+
+
+.. _hevc-control-id:
+
+HEVC Control IDs
+^^^
+
+``V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP``
+Minimum quantization parameter for HEVC.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP``
+Maximum quantization parameter for HEVC.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP``
+Quantization parameter for an I frame for HEVC.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP``
+Quantization parameter for a P frame for HEVC.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP``
+Quantization parameter for a B frame for HEVC.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_QP_ENABLE``
+Enable the QP values for temporal layer.
+
+.. _v4l2-mpeg-video-hevc-hier-coding-type:
+
+``V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_TYPE``
+(enum)
+
+enum v4l2_mpeg_video_hevc_hier_coding_type -
+Selects the hierarchical coding type for encoding. Possible values are:
+
+.. raw:: latex
+
+\begin{adjustbox}{width=\columnwidth}
+
+.. tabularcolumns:: |p{11.0cm}|p{10.0cm}|
+
+.. flat-table::
+:header-rows:  0
+:stub-columns: 0
+
+* - ``V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_B``
+  - Use the B frame for hierarchical coding.
+* - ``V4L2_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_P``
+  - Use the P frame for hierarchical coding.
+
+.. raw:: latex
+
+\end{adjustbox}
+
+``V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER``
+Indicates the hierarchical coding layer.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_QP``
+Indicates the hierarchical coding layer quantization parameter.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_PROFILE``
+Select the desired profile for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_LEVEL``
+Selects the desired level for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_RC_FRAME_RATE``
+Selects the RC filter frame rate for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG``
+By default selects HEVC tier_flag as Main.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH``
+Selects HEVC Maximum coding unit depth.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_REF_NUMBER_FOR_PFRAMES``
+Selects number of P reference picture required for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_LF_DISABLE``
+Disables HEVC filter.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY``
+Selects across or not slice boundary for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_LF_BETA_OFFSET_DIV2``
+Selects HEVC loop filter beta offset.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_LF_TC_OFFSET_DIV2``
+Selects HEVC loop filter tc offset.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE``
+Selects refresh type for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_PERIOD``
+Selects the refresh period for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU_ENABLE``
+Selects HEVC lossless encoding.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED_ENABLE``
+Enables constant intra prediction for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT_ENABLE``
+Enables wavefront for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_LTR_ENABLE``
+Enables long term reference for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_USER_REF``
+Selects user long term reference frame.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_STORE_REF``
+Stores long term reference frame.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_SIGN_DATA_HIDING``
+Enable sign data hiding for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB_ENABLE``
+Enable general picture buffers for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID_ENABLE``
+Enable temporal ID for HEVC encoder.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOTHING_FLAG``
+Enable HEVC Strong intra smoothing.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_MAX_NUM_MERGE_MV_MINUS1``
+Indicates max number of candidate motion vectors.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_DARK``
+Indicates HEVC dark region adaptive.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_SMOOTH``
+Indicates HEVC smooth region adaptive.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_STATIC``
+Indicates HEVC static region adaptive.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_ACTIVITY``
+Indicates HEVC activity adaptive.
+
+``V4L2_CID_MPEG_VIDEO_HEVC_DISABLE_INTRA_PU_SPLIT``
+Disables intra pu split for HEVC 

[PATCH 04/11] [media] s5p-mfc: Support MFCv10.10 buffer requirements

2017-01-18 Thread Smitha T Murthy
Aligning the luma_dpb_size, chroma_dpb_size, mv_size and me_buffer_size
for MFCv10.10.

Signed-off-by: Smitha T Murthy 
---
 drivers/media/platform/s5p-mfc/regs-mfc-v10.h   |   13 +++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   97 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h |2 +
 3 files changed, 91 insertions(+), 21 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
index bd671a5..153ee68 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v10.h
@@ -32,5 +32,18 @@
 #define MFC_VERSION_V100xA0
 #define MFC_NUM_PORTS_V10  1
 
+/* Encoder buffer size for MFC v10.0 */
+#define ENC_V100_H264_ME_SIZE(x, y)\
+   (((x + 3) * (y + 3) * 8)\
++ x * y) + 63) / 64) * 32) \
++ (((y * 64) + 1280) * (x + 7) / 8))
+#define ENC_V100_MPEG4_ME_SIZE(x, y)   \
+   (((x + 3) * (y + 3) * 8)\
++ x * y) + 127) / 128) * 16)   \
++ (((y * 64) + 1280) * (x + 7) / 8))
+#define ENC_V100_VP8_ME_SIZE(x, y) \
+   (((x + 3) * (y + 3) * 8)\
++ (((y * 64) + 1280) * (x + 7) / 8))
+
 #endif /*_REGS_MFC_V10_H*/
 
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index faceee6..369210a 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -64,6 +64,7 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx 
*ctx)
 {
struct s5p_mfc_dev *dev = ctx->dev;
unsigned int mb_width, mb_height;
+   unsigned int lcu_width = 0, lcu_height = 0;
int ret;
 
mb_width = MB_WIDTH(ctx->img_width);
@@ -74,7 +75,9 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct s5p_mfc_ctx 
*ctx)
  ctx->luma_size, ctx->chroma_size, ctx->mv_size);
mfc_debug(2, "Totals bufs: %d\n", ctx->total_dpb_count);
} else if (ctx->type == MFCINST_ENCODER) {
-   if (IS_MFCV8_PLUS(dev))
+   if (IS_MFCV10(dev)) {
+   ctx->tmv_buffer_size = 0;
+   } else if (IS_MFCV8_PLUS(dev))
ctx->tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 *
ALIGN(S5P_FIMV_TMV_BUFFER_SIZE_V8(mb_width, mb_height),
S5P_FIMV_TMV_BUFFER_ALIGN_V6);
@@ -82,13 +85,36 @@ static int s5p_mfc_alloc_codec_buffers_v6(struct 
s5p_mfc_ctx *ctx)
ctx->tmv_buffer_size = S5P_FIMV_NUM_TMV_BUFFERS_V6 *
ALIGN(S5P_FIMV_TMV_BUFFER_SIZE_V6(mb_width, mb_height),
S5P_FIMV_TMV_BUFFER_ALIGN_V6);
-
-   ctx->luma_dpb_size = ALIGN((mb_width * mb_height) *
-   S5P_FIMV_LUMA_MB_TO_PIXEL_V6,
-   S5P_FIMV_LUMA_DPB_BUFFER_ALIGN_V6);
-   ctx->chroma_dpb_size = ALIGN((mb_width * mb_height) *
-   S5P_FIMV_CHROMA_MB_TO_PIXEL_V6,
-   S5P_FIMV_CHROMA_DPB_BUFFER_ALIGN_V6);
+   if (IS_MFCV10(dev)) {
+   lcu_width = enc_lcu_width(ctx->img_width);
+   lcu_height = enc_lcu_height(ctx->img_height);
+   if (ctx->codec_mode != S5P_FIMV_CODEC_HEVC_ENC) {
+   ctx->luma_dpb_size =
+   ALIGNmb_width * 16) + 63) / 64)
+   * 64 * (((mb_height * 16) + 31)
+   / 32) * 32 + 64, 64);
+   ctx->chroma_dpb_size =
+   ALIGNmb_width * 16) + 63) / 64)
+   * 64 * (mb_height * 8)
+   + 64, 64);
+   } else {
+   ctx->luma_dpb_size =
+   ALIGNlcu_width * 32) + 63) / 64)
+   * 64 * (((lcu_height * 32) + 31)
+   / 32) * 32 + 64, 64);
+   ctx->chroma_dpb_size =
+   ALIGNlcu_width * 32) + 63) / 64)
+   * 64 * (lcu_height * 16)
+   + 64, 64);
+   }
+   } else {
+   ctx->luma_dpb_size = ALIGN((mb_width * mb_height) *
+   S5P_FIMV_LUMA_MB_TO_PIXEL_V6,
+   S5P_FIMV_LUMA_DPB_BUFFER_ALIGN_V6);
+   ctx->chroma_dpb_size = ALIGN((mb_width * mb_height) *
+ 

[PATCH 10/11] [media] v4l2: Add v4l2 control IDs for HEVC encoder

2017-01-18 Thread Smitha T Murthy
Add v4l2 controls for HEVC encoder

CC: Hans Verkuil 
CC: Wu-Cheng Li 
CC: Kieran Bingham 
CC: Vladimir Zapolskiy 
CC: Laurent Pinchart 
Signed-off-by: Smitha T Murthy 
---
 drivers/media/v4l2-core/v4l2-ctrls.c |   51 
 include/uapi/linux/v4l2-controls.h   |  109 ++
 2 files changed, 160 insertions(+), 0 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c 
b/drivers/media/v4l2-core/v4l2-ctrls.c
index 47001e2..387439d 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -775,6 +775,57 @@ static bool is_new_manual(const struct v4l2_ctrl *master)
case V4L2_CID_MPEG_VIDEO_VPX_P_FRAME_QP:return "VPX 
P-Frame QP Value";
case V4L2_CID_MPEG_VIDEO_VPX_PROFILE:   return "VPX 
Profile";
 
+   /* HEVC controls */
+   case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP:   return "HEVC 
Frame QP value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP:   return "HEVC P 
frame QP value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP:   return "HEVC B 
frame QP value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP:   return "HEVC 
Minimum QP value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP:   return "HEVC 
Maximum QP value";
+   case V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_DARK: return "HEVC 
dark region adaptive";
+   case V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_SMOOTH:   return "HEVC 
smooth region adaptive";
+   case V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_STATIC:   return "HEVC 
static region adaptive";
+   case V4L2_CID_MPEG_VIDEO_HEVC_ADAPTIVE_RC_ACTIVITY: return "HEVC 
activity adaptive";
+   case V4L2_CID_MPEG_VIDEO_HEVC_PROFILE:  return "HEVC 
Profile";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LEVEL:return "HEVC 
level";
+   case V4L2_CID_MPEG_VIDEO_HEVC_TIER_FLAG:return "HEVC 
tier_flag default is Main";
+   case V4L2_CID_MPEG_VIDEO_HEVC_RC_FRAME_RATE:return "HEVC 
Frame rate";
+   case V4L2_CID_MPEG_VIDEO_HEVC_MAX_PARTITION_DEPTH:  return "HEVC 
Maximum coding unit depth";
+   case V4L2_CID_MPEG_VIDEO_HEVC_REF_NUMBER_FOR_PFRAMES:   return "HEVC 
Number of reference picture";
+   case V4L2_CID_MPEG_VIDEO_HEVC_REFRESH_TYPE: return "HEVC 
refresh type";
+   case V4L2_CID_MPEG_VIDEO_HEVC_CONST_INTRA_PRED_ENABLE:  return "HEVC 
constant intra prediction enabled";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LOSSLESS_CU_ENABLE:   return "HEVC 
lossless encoding select";
+   case V4L2_CID_MPEG_VIDEO_HEVC_WAVEFRONT_ENABLE: return "HEVC 
Wavefront enable";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LF_DISABLE:   return "HEVC 
Filter disable";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LF_SLICE_BOUNDARY:return "across 
or not slice boundary";
+   case V4L2_CID_MPEG_VIDEO_HEVC_LTR_ENABLE:   return "long 
term reference enable";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_QP_ENABLE:   return "QP 
values for temporal layer";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_TYPE: return 
"Hierarchical Coding Type";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER:return 
"Hierarchical Coding Layer";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_QP:return 
"Hierarchical Coding Layer QP";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT0:return 
"Hierarchical Coding Layer BIT0";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT1:return 
"Hierarchical Coding Layer BIT1";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT2:return 
"Hierarchical Coding Layer BIT2";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT3:return 
"Hierarchical Coding Layer BIT3";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT4:return 
"Hierarchical Coding Layer BIT4";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT5:return 
"Hierarchical Coding Layer BIT5";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_BIT6:return 
"Hierarchical Coding Layer BIT6";
+   case V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_CH:return 
"Hierarchical Coding Layer Change";
+   case V4L2_CID_MPEG_VIDEO_HEVC_SIGN_DATA_HIDING: return "HEVC 
Sign data hiding";
+   case V4L2_CID_MPEG_VIDEO_HEVC_GENERAL_PB_ENABLE:return "HEVC 
General pb enable";
+   case V4L2_CID_MPEG_VIDEO_HEVC_TEMPORAL_ID_ENABLE:   return "HEVC 
Temporal id enable";
+   case V4L2_CID_MPEG_VIDEO_HEVC_STRONG_SMOTHING_FLAG: return "HEVC 
Strong intra smoothing flag";
+   case V4L2_CID_MPEG_VIDEO_HEVC_DISABLE_INTRA_PU_SPLIT:   return "HEVC 
disable intra pu 

[PATCH 00/11] Add MFC v10.10 support

2017-01-18 Thread Smitha T Murthy
This patch series adds MFC v10.10 support. MFC v10.10 is used in some
of Exynos7 variants.

This adds support for following:

* Add support for HEVC encoder and decoder
* Add support for VP9 decoder
* Update Documentation for control id definitions
* Update computation of min scratch buffer size requirement for V8 onwards

This patch series is created on top of krzk/for-next and following patch [1]
[1]: https://lkml.org/lkml/2017/1/18/136


Smitha T Murthy (11):
  [media] s5p-mfc: Rename IS_MFCV8 macro
  [media] s5p-mfc: Adding initial support for MFC v10.10
  [media] s5p-mfc: Use min scratch buffer size
  [media] s5p-mfc: Support MFCv10.10 buffer requirements
  [media] s5p-mfc: Add support for HEVC decoder
  [media] videodev2.h: Add v4l2 definition for HEVC
  Documentation: v4l: Documentation for HEVC v4l2 definition
  [media] s5p-mfc: Add VP9 decoder support
  [media] s5p-mfc: Add support for HEVC encoder
  [media] v4l2: Add v4l2 control IDs for HEVC encoder
  Documention: v4l: Documentation for HEVC CIDs

 .../devicetree/bindings/media/s5p-mfc.txt  |1 +
 Documentation/media/uapi/v4l/extended-controls.rst |  190 ++
 Documentation/media/uapi/v4l/pixfmt-013.rst|5 +
 drivers/media/platform/s5p-mfc/regs-mfc-v10.h  |   84 +++
 drivers/media/platform/s5p-mfc/regs-mfc-v8.h   |2 +
 drivers/media/platform/s5p-mfc/s5p_mfc.c   |   33 +
 drivers/media/platform/s5p-mfc/s5p_mfc_cmd_v6.c|9 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h|   64 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_ctrl.c  |6 +-
 drivers/media/platform/s5p-mfc/s5p_mfc_dec.c   |   62 ++-
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c   |  623 +++-
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.h   |   14 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c|  420 --
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h|   16 +
 drivers/media/v4l2-core/v4l2-ctrls.c   |   51 ++
 include/uapi/linux/v4l2-controls.h |  109 
 include/uapi/linux/videodev2.h |1 +
 17 files changed, 1613 insertions(+), 77 deletions(-)
 create mode 100644 drivers/media/platform/s5p-mfc/regs-mfc-v10.h

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


[PATCH 03/11] [media] s5p-mfc: Use min scratch buffer size

2017-01-18 Thread Smitha T Murthy
After MFC v8.0, mfc f/w lets the driver know how much scratch buffer
size is required for decoder. If mfc f/w has the functionality,
E_MIN_SCRATCH_BUFFER_SIZE, driver can know how much scratch buffer size
is required for encoder too.

Signed-off-by: Smitha T Murthy 
---
 drivers/media/platform/s5p-mfc/regs-mfc-v8.h|2 +
 drivers/media/platform/s5p-mfc/s5p_mfc.c|2 +
 drivers/media/platform/s5p-mfc/s5p_mfc_common.h |1 +
 drivers/media/platform/s5p-mfc/s5p_mfc_enc.c|7 ++
 drivers/media/platform/s5p-mfc/s5p_mfc_opr.h|4 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |   68 +--
 6 files changed, 67 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/regs-mfc-v8.h 
b/drivers/media/platform/s5p-mfc/regs-mfc-v8.h
index 4d1c375..2cd396b 100644
--- a/drivers/media/platform/s5p-mfc/regs-mfc-v8.h
+++ b/drivers/media/platform/s5p-mfc/regs-mfc-v8.h
@@ -17,6 +17,7 @@
 
 /* Additional registers for v8 */
 #define S5P_FIMV_D_MVC_NUM_VIEWS_V80xf104
+#define S5P_FIMV_D_MIN_SCRATCH_BUFFER_SIZE_V8  0xf108
 #define S5P_FIMV_D_FIRST_PLANE_DPB_SIZE_V8 0xf144
 #define S5P_FIMV_D_SECOND_PLANE_DPB_SIZE_V80xf148
 #define S5P_FIMV_D_MV_BUFFER_SIZE_V8   0xf150
@@ -84,6 +85,7 @@
 
 #define S5P_FIMV_E_VBV_BUFFER_SIZE_V8  0xf78c
 #define S5P_FIMV_E_VBV_INIT_DELAY_V8   0xf790
+#define S5P_FIMV_E_MIN_SCRATCH_BUFFER_SIZE_V8   0xf894
 
 #define S5P_FIMV_E_ASPECT_RATIO_V8 0xfb4c
 #define S5P_FIMV_E_EXTENDED_SAR_V8 0xfb50
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index a043cce..b014038 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -520,6 +520,8 @@ static void s5p_mfc_handle_seq_done(struct s5p_mfc_ctx *ctx,
dev);
ctx->mv_count = s5p_mfc_hw_call(dev->mfc_ops, get_mv_count,
dev);
+   ctx->scratch_buf_size = s5p_mfc_hw_call(dev->mfc_ops,
+   get_min_scratch_buf_size, dev);
if (ctx->img_width == 0 || ctx->img_height == 0)
ctx->state = MFCINST_ERROR;
else
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
index 1941c63..998e24b 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_common.h
@@ -724,6 +724,7 @@ struct mfc_control {
 #define IS_MFCV7_PLUS(dev) (dev->variant->version >= 0x70 ? 1 : 0)
 #define IS_MFCV8_PLUS(dev) (dev->variant->version >= 0x80 ? 1 : 0)
 #define IS_MFCV10(dev) (dev->variant->version >= 0xA0 ? 1 : 0)
+#define FW_HAS_E_MIN_SCRATCH_BUF(dev) (IS_MFCV10(dev))
 
 #define MFC_V5_BIT BIT(0)
 #define MFC_V6_BIT BIT(1)
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
index 9042378..ef15831 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_enc.c
@@ -818,6 +818,13 @@ static int enc_post_seq_start(struct s5p_mfc_ctx *ctx)
get_enc_dpb_count, dev);
if (ctx->pb_count < enc_pb_count)
ctx->pb_count = enc_pb_count;
+   if (FW_HAS_E_MIN_SCRATCH_BUF(dev)) {
+   ctx->scratch_buf_size = s5p_mfc_hw_call(dev->mfc_ops,
+   get_e_min_scratch_buf_size, dev);
+   ctx->scratch_buf_size = ALIGN(ctx->scratch_buf_size,
+   S5P_FIMV_SCRATCH_BUFFER_ALIGN_V6);
+   ctx->bank1.size += ctx->scratch_buf_size;
+   }
ctx->state = MFCINST_HEAD_PRODUCED;
}
 
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
index b6ac417..6478f70 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr.h
@@ -169,6 +169,7 @@ struct s5p_mfc_regs {
void __iomem *d_decoded_third_addr;/* only v7 */
void __iomem *d_used_dpb_flag_upper;/* v7 and v8 */
void __iomem *d_used_dpb_flag_lower;/* v7 and v8 */
+   void __iomem *d_min_scratch_buffer_size; /* v10 */
 
/* encoder registers */
void __iomem *e_frame_width;
@@ -268,6 +269,7 @@ struct s5p_mfc_regs {
void __iomem *e_vp8_hierarchical_qp_layer0;/* v7 and v8 */
void __iomem *e_vp8_hierarchical_qp_layer1;/* v7 and v8 */
void __iomem *e_vp8_hierarchical_qp_layer2;/* v7 and v8 */
+   void __iomem *e_min_scratch_buffer_size; /* v10 */
 };
 
 struct s5p_mfc_hw_ops {
@@ -311,6 +313,8 @@ struct s5p_mfc_hw_ops {
unsigned int (*get_pic_type_bot)(struct s5p_mfc_ctx *ctx);
unsigned int 

[PATCH] [media] s5p-mfc: Align stream buffer and CPB buffer to 512

2017-01-18 Thread Smitha T Murthy
>From MFCv6 onwards encoder stream buffer and decoder CPB buffer
need to be aligned with 512.

Signed-off-by: Smitha T Murthy 
---
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c |9 +
 drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h |3 +++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
index d6f207e..57da798 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.c
@@ -408,8 +408,15 @@ static int s5p_mfc_set_dec_stream_buffer_v6(struct 
s5p_mfc_ctx *ctx,
struct s5p_mfc_dev *dev = ctx->dev;
const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;
struct s5p_mfc_buf_size *buf_size = dev->variant->buf_size;
+   size_t cpb_buf_size;
 
mfc_debug_enter();
+   cpb_buf_size = ALIGN(buf_size->cpb, CPB_ALIGN);
+   if (strm_size >= set_strm_size_max(cpb_buf_size)) {
+   mfc_debug(2, "Decrease strm_size : %u -> %zu, gap : %d\n",
+   strm_size, set_strm_size_max(cpb_buf_size), CPB_ALIGN);
+   strm_size = set_strm_size_max(cpb_buf_size);
+   }
mfc_debug(2, "inst_no: %d, buf_addr: 0x%08x,\n"
"buf_size: 0x%08x (%d)\n",
ctx->inst_no, buf_addr, strm_size, strm_size);
@@ -519,6 +526,8 @@ static int s5p_mfc_set_enc_stream_buffer_v6(struct 
s5p_mfc_ctx *ctx,
struct s5p_mfc_dev *dev = ctx->dev;
const struct s5p_mfc_regs *mfc_regs = dev->mfc_regs;
 
+   size = ALIGN(size, 512);
+
writel(addr, mfc_regs->e_stream_buffer_addr); /* 16B align */
writel(size, mfc_regs->e_stream_buffer_size);
 
diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h 
b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
index 8055848..16a7b1d 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc_opr_v6.h
@@ -40,6 +40,9 @@
 #define FRAME_DELTA_H264_H263  1
 #define TIGHT_CBR_MAX  10
 
+#define CPB_ALIGN  512
+#define set_strm_size_max(cpb_max) ((cpb_max) - CPB_ALIGN)
+
 struct s5p_mfc_hw_ops *s5p_mfc_init_hw_ops_v6(void);
 const struct s5p_mfc_regs *s5p_mfc_init_regs_v6_plus(struct s5p_mfc_dev *dev);
 #endif /* S5P_MFC_OPR_V6_H_ */
-- 
1.7.2.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