Re: [GIT PULL for v4.6-rc1] media updates

2016-05-03 Thread Stefan Lippers-Hollmann
Hi

On 2016-05-03, Linus Torvalds wrote:
> On Tue, May 3, 2016 at 2:38 PM, Stefan Lippers-Hollmann  wrote:
> > Hi
> > [...]  
> >> Mauro Carvalho Chehab (95):  
> > [...]  
> >>   [media] use v4l2_mc_usb_media_device_init() on most USB devices  
> > [...]
> >
> > This change, as part of v4.6-rc6-85-g1248ded, breaks two systems, each
> > equipped with a TeVii s480 (dvb_usb_dw2102) DVB-S2 card, for me (kernel
> > v4.5.3-rc1 is fine):  
> 
> From the oops it looks like the "->prev" pointer in one of the list
> heads in 'mdev' is NULL.
> 
> > [5.041915] BUG: unable to handle kernel NULL pointer dereference at 
> >   (null)
> > [5.041921] IP: [] media_gobj_create+0xb8/0x100 
> > [media]  
> 
> I can't tell *which* list head it is, but it looks like there's a
> missing call to media_device_init() which is what should have
> initialized those list heads.
> 
> Of course, maybe that list pointer got initialized but then
> overwritten by NULL for some other reason.

Just as a cross-check, this (incomplete, but au0828, cx231xx and em28xx
aren't needed/ loaded on my system) crude revert avoids the problem for 
me on v4.6-rc6-113-g83858a7.

--- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c
@@ -107,7 +107,15 @@ static int dvb_usb_media_device_init(str
if (!mdev)
return -ENOMEM;
 
-   media_device_usb_init(mdev, udev, d->desc->name);
+   mdev->dev = >dev;
+   strlcpy(mdev->model, d->desc->name, sizeof(mdev->model));
+   if (udev->serial)
+   strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial));
+   strcpy(mdev->bus_info, udev->devpath);
+   mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
+   mdev->driver_version = LINUX_VERSION_CODE;
+
+   media_device_init(mdev);
 
dvb_register_media_controller(>dvb_adap, mdev);
 
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -412,7 +412,15 @@ static int dvb_usbv2_media_device_init(s
if (!mdev)
return -ENOMEM;
 
-   media_device_usb_init(mdev, udev, d->name);
+   mdev->dev = >dev;
+   strlcpy(mdev->model, d->name, sizeof(mdev->model));
+   if (udev->serial)
+   strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial));
+   strcpy(mdev->bus_info, udev->devpath);
+   mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
+   mdev->driver_version = LINUX_VERSION_CODE;
+
+   media_device_init(mdev);
 
dvb_register_media_controller(>dvb_adap, mdev);
 
While testing this, I also noticed that not just the dvb_usb based
dvb_usb_dw2102 is affected, but that also the dvb_usb_v2 based rtl2832
triggers this Oops on its own (given that just reverting 
drivers/media/usb/dvb-usb/dvb-usb-dvb.c wasn't enough).

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


cron job: media_tree daily build: OK

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

Results of the daily build of media_tree:

date:   Wed May  4 04:00:18 CEST 2016
git branch: test
git hash:   68af062b5f38510dc96635314461c6bbe1dbf2fe
gcc version:i686-linux-gcc (GCC) 5.3.0
sparse version: v0.5.0-56-g7647c77
smatch version: v0.5.0-3413-g618cd5c
host hardware:  x86_64
host os:4.5.0-164

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-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: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-i686: OK
linux-4.3-i686: OK
linux-4.4-i686: OK
linux-4.5-i686: OK
linux-4.6-rc1-i686: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-x86_64: OK
linux-4.4-x86_64: OK
linux-4.5-x86_64: OK
linux-4.6-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: WARNINGS

Detailed results are available here:

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

Full logs are available here:

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

The Media Infrastructure API from this daily build is here:

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


Re: [GIT PULL for v4.6-rc1] media updates

2016-05-03 Thread Linus Torvalds
On Tue, May 3, 2016 at 2:38 PM, Stefan Lippers-Hollmann  wrote:
> Hi
> [...]
>> Mauro Carvalho Chehab (95):
> [...]
>>   [media] use v4l2_mc_usb_media_device_init() on most USB devices
> [...]
>
> This change, as part of v4.6-rc6-85-g1248ded, breaks two systems, each
> equipped with a TeVii s480 (dvb_usb_dw2102) DVB-S2 card, for me (kernel
> v4.5.3-rc1 is fine):

>From the oops it looks like the "->prev" pointer in one of the list
heads in 'mdev' is NULL.

> [5.041915] BUG: unable to handle kernel NULL pointer dereference at   
> (null)
> [5.041921] IP: [] media_gobj_create+0xb8/0x100 [media]

I can't tell *which* list head it is, but it looks like there's a
missing call to media_device_init() which is what should have
initialized those list heads.

Of course, maybe that list pointer got initialized but then
overwritten by NULL for some other reason.

 Linus
--
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 v7 18/24] i2c-mux: relax locking of the top i2c adapter during mux-locked muxing

2016-05-03 Thread Wolfram Sang
> +static int i2c_mux_trylock_bus(struct i2c_adapter *adapter, int flags)
> +{
> + struct i2c_mux_priv *priv = adapter->algo_data;
> + struct i2c_adapter *parent = priv->muxc->parent;
> +
> + if (!rt_mutex_trylock(>mux_lock))
> + return 0;
> + if (!(flags & I2C_LOCK_ADAPTER))
> + return 1;
> + if (parent->trylock_bus(parent, flags))
> + return 1;
> + rt_mutex_unlock(>mux_lock);
> + return 0;
> +}

This function needs a few short comments why we can leave in this or
that state. Not everyone knows the exit values of trylock by heart and
then it can look a little confusing.

>  static int i2c_parent_trylock_bus(struct i2c_adapter *adapter, int flags)
> @@ -111,7 +189,12 @@ static int i2c_parent_trylock_bus(struct i2c_adapter 
> *adapter, int flags)
>   struct i2c_mux_priv *priv = adapter->algo_data;
>   struct i2c_adapter *parent = priv->muxc->parent;
>  
> - return parent->trylock_bus(parent, flags);
> + if (!rt_mutex_trylock(>mux_lock))
> + return 0;
> + if (parent->trylock_bus(parent, flags))
> + return 1;
> + rt_mutex_unlock(>mux_lock);
> + return 0;
>  }

Same comment as i2c_mux_trylock_bus.

>  struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,
>  struct device *dev, int max_adapters,
> @@ -140,6 +250,8 @@ struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter 
> *parent,
>  
>   muxc->parent = parent;
>   muxc->dev = dev;
> + if (flags & I2C_MUX_LOCKED)
> + muxc->mux_locked = 1;

s/1/true/;

--
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: [GIT PULL for v4.6-rc1] media updates

2016-05-03 Thread Stefan Lippers-Hollmann
Hi

On 2016-03-15, Mauro Carvalho Chehab wrote:
[...]
> The following changes since commit b562e44f507e863c6792946e4e1b1449fbbac85d:
> 
>   Linux 4.5 (2016-03-13 21:28:54 -0700)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
> tags/media/v4.6-1
> 
> for you to fetch changes up to 8331c055b23c4155b896a2c3791704ae68992d2b:
> 
>   Merge commit '840f5b0572ea' into v4l_for_linus (2016-03-15 07:48:28 -0300)
> 
> 
> media updates for v4.6-rc1
[...]
> Mauro Carvalho Chehab (95):
[...]
>   [media] use v4l2_mc_usb_media_device_init() on most USB devices
[...]

This change, as part of v4.6-rc6-85-g1248ded, breaks two systems, each 
equipped with a TeVii s480 (dvb_usb_dw2102) DVB-S2 card, for me (kernel
v4.5.3-rc1 is fine):

sandy-bridge:
- TeVii s480 (dvb_usb_dw2102)
- Trekstor Terres 2.0 (dvb_usb_rtl28xxu)
- x10/ 433 MHz radio remote (ati_remote)

[2.058727] usb 5-1: config 1 interface 0 altsetting 0 bulk endpoint 0x81 
has invalid maxpacket 2
[2.059839] usb 5-1: New USB device found, idVendor=9022, idProduct=d660
[2.059843] usb 5-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[2.059845] usb 5-1: Product: DVBS2BOX
[2.059847] usb 5-1: Manufacturer: TBS-Tech
[2.062754] usb 6-1: config 1 interface 0 altsetting 0 bulk endpoint 0x81 
has invalid maxpacket 2
[2.064002] usb 6-1: New USB device found, idVendor=9022, idProduct=d660
[2.064004] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[2.064006] usb 6-1: Product: DVBS2BOX
[2.064008] usb 6-1: Manufacturer: TBS-Tech
[...]
[2.315642] usb 3-1.1: new low-speed USB device number 3 using ehci-pci
[2.396709] usb 3-1.1: New USB device found, idVendor=0bc7, idProduct=0006
[2.396714] usb 3-1.1: New USB device strings: Mfr=1, Product=2, 
SerialNumber=0
[2.396717] usb 3-1.1: Product: USB Receiver
[2.396719] usb 3-1.1: Manufacturer: X10 Wireless Technology Inc
[...]
[2.473623] usb 3-1.4: new high-speed USB device number 4 using ehci-pci
[2.563465] usb 3-1.4: New USB device found, idVendor=1f4d, idProduct=c803
[2.563470] usb 3-1.4: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[2.563472] usb 3-1.4: Product: RTL2838UHIDIR
[2.563474] usb 3-1.4: Manufacturer: Realtek
[2.563476] usb 3-1.4: SerialNumber: 0001
[...]
[4.984409] media: Linux media interface: v0.10
[4.987674] dvb-usb: found a 'TeVii S660 USB' in cold state, will try to 
load a firmware
[4.988892] dvb-usb: downloading firmware from file 'dvb-usb-s660.fw'
[4.988894] dw2102: start downloading DW210X firmware
[5.010246] usb 3-1.4: dvb_usb_v2: found a 'Trekstor DVB-T Stick Terres 2.0' 
in warm state
[5.025627] iTCO_vendor_support: vendor-support=0
[5.026049] iTCO_wdt: Intel TCO WatchDog Timer Driver v1.11
[5.026076] iTCO_wdt: Found a Cougar Point TCO device (Version=2, 
TCOBASE=0x0460)
[5.026181] iTCO_wdt: initialized. heartbeat=30 sec (nowayout=0)
[5.027427] gpio_ich: GPIO from 436 to 511 on gpio_ich
[5.041801] usb 3-1.4: dvb_usb_v2: will pass the complete MPEG2 transport 
stream to the software demuxer
[5.041811] DVB: registering new adapter (Trekstor DVB-T Stick Terres 2.0)
[5.041814] usb 3-1.4: media controller created
[5.041915] BUG: unable to handle kernel NULL pointer dereference at 
  (null)
[5.041921] IP: [] media_gobj_create+0xb8/0x100 [media]
[5.041928] PGD 0 
[5.041930] Oops: 0002 [#1] PREEMPT SMP 
[5.041934] Modules linked in: vfat irqbypass fat crct10dif_pclmul 
crc32_pclmul ghash_clmulni_intel gpio_ich iTCO_wdt iTCO_vendor_support evdev 
dvb_usb_rtl28xxu(+) dvb_usb_v2 sha256_ssse3 dvb_usb_dw2102(+) dvb_usb 
sha256_generic dvb_core media drbg ansi_cprng i915 aesni_intel aes_x86_64 
ath9k(+) lrw snd_hda_codec_realtek(+) gf128mul ath9k_common glue_helper 
ath9k_hw snd_hda_codec_generic ablk_helper cryptd video ath i2c_algo_bit pcspkr 
serio_raw snd_hda_intel drm_kms_helper mac80211 snd_hda_codec sg drm i2c_i801 
lpc_ich cfg80211 snd_hda_core snd_hwdep rfkill i2c_core snd_pcm intel_gtt 
snd_timer syscopyarea sysfillrect snd mei_me sysimgblt soundcore fb_sys_fops 
mei 8250_fintek floppy(+) nuvoton_cir rc_core processor button w83627ehf 
hwmon_vid parport_pc ppdev lp parport autofs4 ext4 crc16 jbd2 mbcache
[5.041996]  dm_mod hid_generic usbhid hid sr_mod cdrom sd_mod ohci_pci 
crc32c_intel ahci libahci psmouse libata scsi_mod xhci_pci xhci_hcd r8169 
ohci_hcd ehci_pci ehci_hcd e100 mii e1000e usbcore usb_common ptp pps_core fjes
[5.042018] CPU: 4 PID: 309 Comm: systemd-udevd Not tainted 
4.6.0-rc6-aptosid-amd64 #1 aptosid 4.6~rc6-1~git72.slh.1
[5.042022] Hardware name:  /DH67CL, BIOS 
BLH6710H.86A.0160.2012.1204.1156 12/04/2012
[5.042027] task: 88000c2d0d80 ti: 880409b2 task.ti: 
880409b2
[5.042032] RIP: 0010:[]  [] 

Re: [PATCH v7 16/24] i2c: allow adapter drivers to override the adapter locking

2016-05-03 Thread Wolfram Sang
> Yes, they look like reasonable complaints.

Thanks for fixing them. I just sent out my latest comments and when you
fix those and send V8, I'll apply that right away. I think we are safe
to fix the rest incrementally if needed. Note that I didn't review the
IIO and media patches, I trust the reviewers on those.

Thanks for your work on this! I need a break now, this is
mind-boggling...

--
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 v7 16/24] i2c: allow adapter drivers to override the adapter locking

2016-05-03 Thread Wolfram Sang
On Wed, Apr 20, 2016 at 05:17:56PM +0200, Peter Rosin wrote:
> Add i2c_lock_bus() and i2c_unlock_bus(), which call the new lock_bus and
> unlock_bus ops in the adapter. These funcs/ops take an additional flags
> argument that indicates for what purpose the adapter is locked.
> 
> There are two flags, I2C_LOCK_ADAPTER and I2C_LOCK_SEGMENT, but they are
> both implemented the same. For now. Locking the adapter means that the
> whole bus is locked, locking the segment means that only the current bus
> segment is locked (i.e. i2c traffic on the parent side of mux is still
> allowed even if the child side of the mux is locked.
> 
> Also support a trylock_bus op (but no function to call it, as it is not
> expected to be needed outside of the i2c core).
> 
> Implement i2c_lock_adapter/i2c_unlock_adapter in terms of the new locking
> scheme (i.e. lock with the I2C_LOCK_ADAPTER flag).
> 
> Annotate some of the locking with explicit I2C_LOCK_SEGMENT flags.

Can you explain a little why it is SEGMENT and not ADAPTER here? That
probably makes it easier to get into this patch.

And to double check my understanding: I was surprised to not see any
i2c_lock_adapter() or I2C_LOCK_ADAPTER in action. This is because muxes
call I2C_LOCK_SEGMENT on their parent which in case of the parent being
the root adapter is essentially the same as I2C_LOCK_ADAPTER. Correct?

> 
> Signed-off-by: Peter Rosin 
> ---
>  drivers/i2c/i2c-core.c | 46 --
>  include/linux/i2c.h| 28 ++--
>  2 files changed, 54 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 0f2f8484e8ec..21f46d011c33 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -960,10 +960,12 @@ static int i2c_check_addr_busy(struct i2c_adapter 
> *adapter, int addr)
>  }
>  
>  /**
> - * i2c_lock_adapter - Get exclusive access to an I2C bus segment
> + * i2c_adapter_lock_bus - Get exclusive access to an I2C bus segment
>   * @adapter: Target I2C bus segment
> + * @flags: I2C_LOCK_ADAPTER locks the root i2c adapter, I2C_LOCK_SEGMENT
> + *   locks only this branch in the adapter tree
>   */

I think this kerneldoc should be moved to i2c_lock_adapter and/or
i2c_lock_bus() which are now in i2c.h. This is what users will use, not
this static, adapter-specific implementation. I think it is enough to
have a comment here explaining what is special in handling adapters.

Thanks,

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


[PATCH 1/3] [media] s5p-mfc: Set device name for reserved memory region devs

2016-05-03 Thread Javier Martinez Canillas
The devices don't have a name set, so makes dev_name() returns NULL which
makes harder to identify the devices that are causing issues, for example:

WARNING: CPU: 2 PID: 616 at drivers/base/core.c:251 device_release+0x8c/0x90
Device '(null)' does not have a release() function, it is broken and must be 
fixed.

And after setting the device name:

WARNING: CPU: 0 PID: 591 at drivers/base/core.c:251 device_release+0x8c/0x90
Device 's5p-mfc-l' does not have a release() function, it is broken and must be 
fixed.

Cc: 
Fixes: 6e83e6e25eb4 ("[media] s5p-mfc: Fix kernel warning on memory init")
Signed-off-by: Javier Martinez Canillas 

---

 drivers/media/platform/s5p-mfc/s5p_mfc.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index b16466fe35ee..8fc1fd4ee2ed 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1062,6 +1062,8 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev)
mfc_err("Not enough memory\n");
return -ENOMEM;
}
+
+   dev_set_name(dev->mem_dev_l, "%s", "s5p-mfc-l");
device_initialize(dev->mem_dev_l);
of_property_read_u32_array(dev->plat_dev->dev.of_node,
"samsung,mfc-l", mem_info, 2);
@@ -1079,6 +1081,8 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev)
mfc_err("Not enough memory\n");
return -ENOMEM;
}
+
+   dev_set_name(dev->mem_dev_r, "%s", "s5p-mfc-r");
device_initialize(dev->mem_dev_r);
of_property_read_u32_array(dev->plat_dev->dev.of_node,
"samsung,mfc-r", mem_info, 2);
-- 
2.5.5

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


[PATCH 2/3] [media] s5p-mfc: Add release callback for memory region devs

2016-05-03 Thread Javier Martinez Canillas
When s5p_mfc_remove() calls put_device() for the reserved memory region
devs, the driver core warns that the dev doesn't have a release callback:

WARNING: CPU: 0 PID: 591 at drivers/base/core.c:251 device_release+0x8c/0x90
Device 's5p-mfc-l' does not have a release() function, it is broken and must be 
fixed.

Also, the declared DMA memory using dma_declare_coherent_memory() isn't
relased so add a dev .release that calls dma_release_declared_memory().

Cc: 
Fixes: 6e83e6e25eb4 ("[media] s5p-mfc: Fix kernel warning on memory init")
Signed-off-by: Javier Martinez Canillas 

---

 drivers/media/platform/s5p-mfc/s5p_mfc.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index 8fc1fd4ee2ed..beb4fd5bd326 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1050,6 +1050,11 @@ static int match_child(struct device *dev, void *data)
return !strcmp(dev_name(dev), (char *)data);
 }
 
+static void s5p_mfc_memdev_release(struct device *dev)
+{
+   dma_release_declared_memory(dev);
+}
+
 static void *mfc_get_drv_data(struct platform_device *pdev);
 
 static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev)
@@ -1064,6 +1069,7 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev)
}
 
dev_set_name(dev->mem_dev_l, "%s", "s5p-mfc-l");
+   dev->mem_dev_l->release = s5p_mfc_memdev_release;
device_initialize(dev->mem_dev_l);
of_property_read_u32_array(dev->plat_dev->dev.of_node,
"samsung,mfc-l", mem_info, 2);
@@ -1083,6 +1089,7 @@ static int s5p_mfc_alloc_memdevs(struct s5p_mfc_dev *dev)
}
 
dev_set_name(dev->mem_dev_r, "%s", "s5p-mfc-r");
+   dev->mem_dev_r->release = s5p_mfc_memdev_release;
device_initialize(dev->mem_dev_r);
of_property_read_u32_array(dev->plat_dev->dev.of_node,
"samsung,mfc-r", mem_info, 2);
-- 
2.5.5

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


[PATCH 0/3] [media] s5p-mfc: Fixes for issues when module is removed

2016-05-03 Thread Javier Martinez Canillas
Hello,

This patch series fixes some issues that I noticed when trying to remove
the s5p-mfc driver when built as a module.

Some of these issues will be fixed once Marek's patches to convert the
custom memory region reservation code is replaced by a generic one that
supports named memory region reservation [0]. But the fixes are trivial
so we can fix the current code until his rework patch lands.

[0]: https://patchwork.linuxtv.org/patch/32287/

Best regards,
Javier


Javier Martinez Canillas (3):
  [media] s5p-mfc: Set device name for reserved memory region devs
  [media] s5p-mfc: Add release callback for memory region devs
  [media] s5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open()

 drivers/media/platform/s5p-mfc/s5p_mfc.c | 50 
 1 file changed, 32 insertions(+), 18 deletions(-)

-- 
2.5.5

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


[PATCH 3/3] [media] s5p-mfc: Fix race between s5p_mfc_probe() and s5p_mfc_open()

2016-05-03 Thread Javier Martinez Canillas
The s5p_mfc_probe() function registers the video devices before all the
resources needed by s5p_mfc_open() are correctly initalized.

So if s5p_mfc_open() function is called before s5p_mfc_probe() finishes
(since the video dev is already registered), a NULL pointer dereference
will happen due s5p_mfc_open() accessing uninitialized vars such as the
struct s5p_mfc_dev .watchdog_timer and .mfc_ops fields.

An example is following BUG caused by add_timer() getting a NULL pointer:

[   45.765374] kernel BUG at kernel/time/timer.c:790!
[   45.765381] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
...
[   45.766149] [] (mod_timer) from [] 
(s5p_mfc_open+0x274/0x4d4 [s5p_mfc])
[   45.766416] [] (s5p_mfc_open [s5p_mfc]) from [] 
(v4l2_open+0x9c/0x100 [videodev])
[   45.766547] [] (v4l2_open [videodev]) from [] 
(chrdev_open+0x9c/0x178)
[   45.766575] [] (chrdev_open) from [] 
(do_dentry_open+0x1e0/0x300)
[   45.766595] [] (do_dentry_open) from [] 
(path_openat+0x800/0x10d4)
[   45.766610] [] (path_openat) from [] 
(do_filp_open+0x5c/0xc0)
[   45.766624] [] (do_filp_open) from [] 
(do_sys_open+0x10c/0x1bc)
[   45.766642] [] (do_sys_open) from [] 
(ret_fast_syscall+0x0/0x3c)
[   45.766655] Code: eae3 e3a1 e28dd008 e8bd81f0 (e7f001f2)

Fix it by registering the video devs as the last step in s5p_mfc_probe().

Signed-off-by: Javier Martinez Canillas 

---

 drivers/media/platform/s5p-mfc/s5p_mfc.c | 39 +---
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc.c 
b/drivers/media/platform/s5p-mfc/s5p_mfc.c
index beb4fd5bd326..501d822cad6b 100644
--- a/drivers/media/platform/s5p-mfc/s5p_mfc.c
+++ b/drivers/media/platform/s5p-mfc/s5p_mfc.c
@@ -1212,14 +1212,6 @@ static int s5p_mfc_probe(struct platform_device *pdev)
vfd->vfl_dir= VFL_DIR_M2M;
snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_DEC_NAME);
dev->vfd_dec= vfd;
-   ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
-   if (ret) {
-   v4l2_err(>v4l2_dev, "Failed to register video device\n");
-   video_device_release(vfd);
-   goto err_dec_reg;
-   }
-   v4l2_info(>v4l2_dev,
- "decoder registered as /dev/video%d\n", vfd->num);
video_set_drvdata(vfd, dev);
 
/* encoder */
@@ -1237,14 +1229,6 @@ static int s5p_mfc_probe(struct platform_device *pdev)
vfd->vfl_dir= VFL_DIR_M2M;
snprintf(vfd->name, sizeof(vfd->name), "%s", S5P_MFC_ENC_NAME);
dev->vfd_enc= vfd;
-   ret = video_register_device(vfd, VFL_TYPE_GRABBER, 0);
-   if (ret) {
-   v4l2_err(>v4l2_dev, "Failed to register video device\n");
-   video_device_release(vfd);
-   goto err_enc_reg;
-   }
-   v4l2_info(>v4l2_dev,
- "encoder registered as /dev/video%d\n", vfd->num);
video_set_drvdata(vfd, dev);
platform_set_drvdata(pdev, dev);
 
@@ -1261,15 +1245,34 @@ static int s5p_mfc_probe(struct platform_device *pdev)
s5p_mfc_init_hw_cmds(dev);
s5p_mfc_init_regs(dev);
 
+   /* Register decoder and encoder */
+   ret = video_register_device(dev->vfd_dec, VFL_TYPE_GRABBER, 0);
+   if (ret) {
+   v4l2_err(>v4l2_dev, "Failed to register video device\n");
+   video_device_release(dev->vfd_dec);
+   goto err_dec_reg;
+   }
+   v4l2_info(>v4l2_dev,
+ "decoder registered as /dev/video%d\n", dev->vfd_dec->num);
+
+   ret = video_register_device(dev->vfd_enc, VFL_TYPE_GRABBER, 0);
+   if (ret) {
+   v4l2_err(>v4l2_dev, "Failed to register video device\n");
+   video_device_release(dev->vfd_enc);
+   goto err_enc_reg;
+   }
+   v4l2_info(>v4l2_dev,
+ "encoder registered as /dev/video%d\n", dev->vfd_enc->num);
+
pr_debug("%s--\n", __func__);
return 0;
 
 /* Deinit MFC if probe had failed */
 err_enc_reg:
-   video_device_release(dev->vfd_enc);
-err_enc_alloc:
video_unregister_device(dev->vfd_dec);
 err_dec_reg:
+   video_device_release(dev->vfd_enc);
+err_enc_alloc:
video_device_release(dev->vfd_dec);
 err_dec_alloc:
v4l2_device_unregister(>v4l2_dev);
-- 
2.5.5

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


Re: [RFC PATCH 06/24] smiapp: Add quirk control support

2016-05-03 Thread Ivaylo Dimitrov

Hi,

On  1.05.2016 13:46, Sakari Ailus wrote:

On Mon, Apr 25, 2016 at 12:08:06AM +0300, Ivaylo Dimitrov wrote:

From: Sakari Ailus 

Quirk controls can be set up in the init quirk.

Signed-off-by: Sakari Ailus 


Do you need quirk controls for something at the moment? I guess not at least
with the secondary sensor?



Yes, vs6555 doesn't seem to need quirks ATM, I guess that patch comes 
from N9/50 adaptation kernel.


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


Re: [RFC PATCH 04/24] smiapp-pll: Take existing divisor into account in minimum divisor check

2016-05-03 Thread Ivaylo Dimitrov

Hi,

On  1.05.2016 13:45, Sakari Ailus wrote:

Hi Ivaylo,

On Mon, Apr 25, 2016 at 12:08:04AM +0300, Ivaylo Dimitrov wrote:

From: Sakari Ailus 

Required added multiplier (and divisor) calculation did not take into
account the existing divisor when checking the values against the minimum
divisor. Do just that.

Signed-off-by: Sakari Ailus 
---
  drivers/media/i2c/smiapp-pll.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/smiapp-pll.c b/drivers/media/i2c/smiapp-pll.c
index e3348db..5ad1edb 100644
--- a/drivers/media/i2c/smiapp-pll.c
+++ b/drivers/media/i2c/smiapp-pll.c
@@ -227,7 +227,8 @@ static int __smiapp_pll_calculate(

more_mul_factor = lcm(div, pll->pre_pll_clk_div) / div;
dev_dbg(dev, "more_mul_factor: %u\n", more_mul_factor);
-   more_mul_factor = lcm(more_mul_factor, op_limits->min_sys_clk_div);
+   more_mul_factor = lcm(more_mul_factor,
+ DIV_ROUND_UP(op_limits->min_sys_clk_div, div));
dev_dbg(dev, "more_mul_factor: min_op_sys_clk_div: %d\n",
more_mul_factor);
i = roundup(more_mul_min, more_mul_factor);


I remember writing the patch, but I don't remember what for, or whether it
was really needed. Does the secondary sensor work without this one?



[  107.285919] smiapp 2-0010: lanes 1
[  107.286010] smiapp 2-0010: reset -2, nvm 0, clk 960, mode 0
[  107.286041] smiapp 2-0010: freq 0: 6000
[  107.289306] twl4030reg_is_enabled VAUX4 0
[  107.303680] twl4030reg_enable VAUX4 0
[  107.352233] smiapp 2-0010: module 0x01-0x022b
[  107.352325] smiapp 2-0010: module revision 0x04-0x00 date 00-00-00
[  107.352355] smiapp 2-0010: sensor 0x00-0x
[  107.352386] smiapp 2-0010: sensor revision 0x00 firmware version 0x00
[  107.352416] smiapp 2-0010: smia version 10 smiapp version 00
[  107.352447] smiapp 2-0010: the sensor is called vs6555, ident 01022b04

.
.
.

[  107.595672] smiapp 2-0010: unable to compute pre_pll divisor
[  107.611816] smiapp 2-0010: link freq 6000 Hz, bpp 10 not ok
[  107.611816] smiapp 2-0010: no valid link frequencies for 10 bpp
[  107.618072] smiapp 2-0010: no supported mbus code found

Or, in short, it does not work without this patch.

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


[PATCH v2] media: fix use-after-free in cdev_put() when app exits after driver unbind

2016-05-03 Thread Shuah Khan
When driver unbinds while media_ioctl is in progress, cdev_put() fails with
when app exits after driver unbinds.

Add devnode struct device kobj as the cdev parent kobject. cdev_add() holds
a reference to it and releases the reference in cdev_del() ensuring that the
media_devnode is not deallocated as long as the application has the device
file open. media_devnode_register() now initializes the struct device kobj
before calling cdev_add(). media_devnode_unregister() does cdev_del() and
then deletes the device. devnode is released when the last reference to the
struct device is gone.

This problem is found on uvcvideo, em28xx, and au0828 drivers and fix has
been tested on all three.

kernel: [  193.599736] BUG: KASAN: use-after-free in cdev_put+0x4e/0x50
kernel: [  193.599745] Read of size 8 by task media_device_te/1851
kernel: [  193.599792] INFO: Allocated in __media_device_register+0x54
kernel: [  193.599951] INFO: Freed in media_devnode_release+0xa4/0xc0

kernel: [  193.601083] Call Trace:
kernel: [  193.601093]  [] dump_stack+0x67/0x94
kernel: [  193.601102]  [] print_trailer+0x112/0x1a0
kernel: [  193.60]  [] object_err+0x34/0x40
kernel: [  193.601119]  [] kasan_report_error+0x224/0x530
kernel: [  193.601128]  [] ? kzfree+0x2d/0x40
kernel: [  193.601137]  [] ? kfree+0x1d2/0x1f0
kernel: [  193.601154]  [] ? cdev_put+0x4e/0x50
kernel: [  193.601162]  [] cdev_put+0x4e/0x50
kernel: [  193.601170]  [] __fput+0x52b/0x6c0
kernel: [  193.601179]  [] ? switch_task_namespaces+0x2a
kernel: [  193.601188]  [] fput+0xe/0x10
kernel: [  193.601196]  [] task_work_run+0x133/0x1f0
kernel: [  193.601204]  [] ? switch_task_namespaces+0x5e
kernel: [  193.601213]  [] do_exit+0x72c/0x2c20
kernel: [  193.601224]  [] ? release_task+0x1250/0x1250
-
-
-
kernel: [  193.601360]  [] ? exit_to_usermode_loop+0xe7
kernel: [  193.601368]  [] exit_to_usermode_loop+0x120
kernel: [  193.601376]  [] syscall_return_slowpath+0x16a
kernel: [  193.601386]  [] entry_SYSCALL_64_fastpath+0xa6

Signed-off-by: Shuah Khan 
---

Changes since v1:
- Addressed review comments from Lars-Peter Clausen

 drivers/media/media-device.c  |  6 --
 drivers/media/media-devnode.c | 45 ++-
 2 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 84e6a0b..a853384 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -742,16 +742,16 @@ int __must_check __media_device_register(struct 
media_device *mdev,
 
ret = media_devnode_register(mdev, devnode, owner);
if (ret < 0) {
+   /* devnode free is handled in media_devnode_*() */
mdev->devnode = NULL;
-   kfree(devnode);
return ret;
}
 
ret = device_create_file(>dev, _attr_model);
if (ret < 0) {
+   /* devnode free is handled in media_devnode_*() */
mdev->devnode = NULL;
media_devnode_unregister(devnode);
-   kfree(devnode);
return ret;
}
 
@@ -829,6 +829,8 @@ void media_device_unregister(struct media_device *mdev)
if (media_devnode_is_registered(mdev->devnode)) {
device_remove_file(>devnode->dev, _attr_model);
media_devnode_unregister(mdev->devnode);
+   /* devnode free is handled in media_devnode_*() */
+   mdev->devnode = NULL;
}
 
dev_dbg(mdev->dev, "Media device unregistered\n");
diff --git a/drivers/media/media-devnode.c b/drivers/media/media-devnode.c
index ca7c4b9..9b5bd2e 100644
--- a/drivers/media/media-devnode.c
+++ b/drivers/media/media-devnode.c
@@ -63,13 +63,8 @@ static void media_devnode_release(struct device *cd)
struct media_devnode *devnode = to_media_devnode(cd);
 
mutex_lock(_devnode_lock);
-
-   /* Delete the cdev on this minor as well */
-   cdev_del(>cdev);
-
/* Mark device node number as free */
clear_bit(devnode->minor, media_devnode_nums);
-
mutex_unlock(_devnode_lock);
 
/* Release media_devnode and perform other cleanups as needed. */
@@ -77,6 +72,7 @@ static void media_devnode_release(struct device *cd)
devnode->release(devnode);
 
kfree(devnode);
+   pr_info("%s: Media Devnode Deallocated\n", __func__);
 }
 
 static struct bus_type media_bus_type = {
@@ -204,6 +200,7 @@ static int media_release(struct inode *inode, struct file 
*filp)
   return value is ignored. */
put_device(>dev);
filp->private_data = NULL;
+   pr_info("%s: Media Release\n", __func__);
return 0;
 }
 
@@ -234,6 +231,7 @@ int __must_check media_devnode_register(struct media_device 
*mdev,
if (minor == MEDIA_NUM_DEVICES) {
mutex_unlock(_devnode_lock);
pr_err("could not get a free minor\n");
+   kfree(devnode);

Re: [PATCH] media: fix use-after-free in cdev_put() when app exits after driver unbind

2016-05-03 Thread Lars-Peter Clausen
On 05/03/2016 05:06 PM, Shuah Khan wrote:
> On 05/02/2016 04:16 AM, Lars-Peter Clausen wrote:
>> On 04/30/2016 12:37 AM, Shuah Khan wrote:
>> [...]
>>> diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
>>> index 5bb3b0e..ce9b051 100644
>>> --- a/include/media/media-devnode.h
>>> +++ b/include/media/media-devnode.h
>>> @@ -72,6 +72,7 @@ struct media_file_operations {
>>>   * @fops:  pointer to struct _file_operations with media device ops
>>>   * @dev:   struct device pointer for the media controller device
>>>   * @cdev:  struct cdev pointer character device
>>> + * @kobj:  struct kobject
>>>   * @parent:parent device
>>>   * @minor: device node minor number
>>>   * @flags: flags, combination of the MEDIA_FLAG_* constants
>>> @@ -91,6 +92,7 @@ struct media_devnode {
>>> /* sysfs */
>>> struct device dev;  /* media device */
>>> struct cdev cdev;   /* character device */
>>> +   struct kobject kobj;/* set as cdev parent kobj */
>>
>> As said during the previous review, the struct device should be used for
>> reference counting. Otherwise a use-after-free can still occur since you now
>> have two reference counted data structures with independent counters in the
>> same structure. For one of them the counter goes to zero before the other
>> and then you have the use-after-free.
>>
> 
> struct device is embedded in the media_devnode and media_devnode
> will not be released until cdev releases the kobject since it is
> set as cdeev kobj.parent. I am not seeing any use-fater-free with
> this scheme.

There might still be a reference to the struct device at that point, so if
you free the media_devnode there is a use-after-free.

--
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: Kernel docs: muddying the waters a bit

2016-05-03 Thread Keith Packard
Daniel Vetter  writes:

> So sphinx/rst y/n? Jon, is that ok with you from the doc maintainer
> pov?

I think the right answer for today is to use sphinx to generate docs
From inline comments, to encourage outline docs to give it a try but to
allow doc writers to use whatever works for them.

That will leave the media docs using the existing system so that their
tables don't get wrecked, while providing guidance to new doc writers
and allowing inline docs to include markup.

-- 
-keith


signature.asc
Description: PGP signature


g_webcam driver not working properly on newer kernel

2016-05-03 Thread Marco Madrigal

Hi all,

I am working with the g_webcam driver on Linux 3.14 and 4.3 with an 
embedded system. It works pretty well for most of Linux hosts but when 
trying to register the webcam driver on Windows 7/8 I got "This device 
cannot start (Code 10)" message.


I decided to try out the old version of the driver before the videobuf2 
modifications and some other stuff (mostly the pretty initial driver) 
and it worked correctly on Windows 7/8.


Has someone else experimented a similar issue? Is this a regression 
problem? I noticed that newer version of the patch need several tries to 
get the streaming working correctly on Linux hosts but I have been 
unable to get it working at all with Windows.


Regards,
-Marco
--
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: fix use-after-free in cdev_put() when app exits after driver unbind

2016-05-03 Thread Shuah Khan
On 05/02/2016 04:16 AM, Lars-Peter Clausen wrote:
> On 04/30/2016 12:37 AM, Shuah Khan wrote:
> [...]
>> diff --git a/include/media/media-devnode.h b/include/media/media-devnode.h
>> index 5bb3b0e..ce9b051 100644
>> --- a/include/media/media-devnode.h
>> +++ b/include/media/media-devnode.h
>> @@ -72,6 +72,7 @@ struct media_file_operations {
>>   * @fops:   pointer to struct _file_operations with media device ops
>>   * @dev:struct device pointer for the media controller device
>>   * @cdev:   struct cdev pointer character device
>> + * @kobj:   struct kobject
>>   * @parent: parent device
>>   * @minor:  device node minor number
>>   * @flags:  flags, combination of the MEDIA_FLAG_* constants
>> @@ -91,6 +92,7 @@ struct media_devnode {
>>  /* sysfs */
>>  struct device dev;  /* media device */
>>  struct cdev cdev;   /* character device */
>> +struct kobject kobj;/* set as cdev parent kobj */
> 
> As said during the previous review, the struct device should be used for
> reference counting. Otherwise a use-after-free can still occur since you now
> have two reference counted data structures with independent counters in the
> same structure. For one of them the counter goes to zero before the other
> and then you have the use-after-free.
> 

struct device is embedded in the media_devnode and media_devnode
will not be released until cdev releases the kobject since it is
set as cdeev kobj.parent. I am not seeing any use-fater-free with
this scheme. That said, I understand your concern about two ref
counted objects in the same structure. Using struct device for ref
counting will require a few changes to media_devnode_register()
to do device_initialize() before cdev_add(). I am testing that now
and will send the updated patch soon.

thanks,
-- Shuah
--
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] Delete Eurobird1-28.5E tuning file (satellite moved)

2016-05-03 Thread Nick Morrott
Remove tuning file for Eurobird1 at 28.5E.

The satellite was moved to 33.0E (July 2015) and is now known as
Eutelsat 33C using different transponders.

Signed-off-by: Nick Morrott 

---
 dvb-s/Eurobird1-28.5E | 26 --
 1 file changed, 26 deletions(-)
 delete mode 100644 dvb-s/Eurobird1-28.5E

diff --git a/dvb-s/Eurobird1-28.5E b/dvb-s/Eurobird1-28.5E
deleted file mode 100644
index 95f6eb9..000
--- a/dvb-s/Eurobird1-28.5E
+++ /dev/null
@@ -1,26 +0,0 @@
-# Eurobird 28.5E SDT info service transponder
-# freq pol sr fec
-[CHANNEL]
-   DELIVERY_SYSTEM = DVBS
-   FREQUENCY = 11623000
-   POLARIZATION = HORIZONTAL
-   SYMBOL_RATE = 2750
-   INNER_FEC = 2/3
-   INVERSION = AUTO
-
-[CHANNEL]
-   DELIVERY_SYSTEM = DVBS
-   FREQUENCY = 11224000
-   POLARIZATION = VERTICAL
-   SYMBOL_RATE = 2750
-   INNER_FEC = 2/3
-   INVERSION = AUTO
-
-[CHANNEL]
-   DELIVERY_SYSTEM = DVBS
-   FREQUENCY = 11527000
-   POLARIZATION = VERTICAL
-   SYMBOL_RATE = 2750
-   INNER_FEC = 2/3
-   INVERSION = AUTO
-
-- 
2.8.0.rc3
--
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]: Driver for Toshiba et8ek8 5MP sensor

2016-05-03 Thread Ivaylo Dimitrov
The sensor is found in Nokia N900 main camera

Signed-off-by: Ivaylo Dimitrov 
---
 .../bindings/media/i2c/toshiba,et8ek8.txt  |   53 +
 drivers/media/i2c/Kconfig  |1 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/et8ek8/Kconfig   |6 +
 drivers/media/i2c/et8ek8/Makefile  |2 +
 drivers/media/i2c/et8ek8/et8ek8_driver.c   | 1711 
 drivers/media/i2c/et8ek8/et8ek8_mode.c |  591 +++
 drivers/media/i2c/et8ek8/et8ek8_reg.h  |  100 ++
 include/uapi/linux/v4l2-controls.h |5 +
 9 files changed, 2470 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt
 create mode 100644 drivers/media/i2c/et8ek8/Kconfig
 create mode 100644 drivers/media/i2c/et8ek8/Makefile
 create mode 100644 drivers/media/i2c/et8ek8/et8ek8_driver.c
 create mode 100644 drivers/media/i2c/et8ek8/et8ek8_mode.c
 create mode 100644 drivers/media/i2c/et8ek8/et8ek8_reg.h

diff --git a/Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt 
b/Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt
new file mode 100644
index 000..55f712c
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/toshiba,et8ek8.txt
@@ -0,0 +1,53 @@
+Toshiba et8ek8 5MP sensor
+
+Toshiba et8ek8 5MP sensor is an image sensor found in Nokia N900 device
+
+More detailed documentation can be found in
+Documentation/devicetree/bindings/media/video-interfaces.txt .
+
+
+Mandatory properties
+
+
+- compatible: "toshiba,et8ek8"
+- reg: I2C address (0x3e, or an alternative address)
+- vana-supply: Analogue voltage supply (VANA), typically 2,8 volts (sensor
+  dependent).
+- clocks: External clock to the sensor
+- clock-frequency: Frequency of the external clock to the sensor
+
+
+Optional properties
+---
+
+- reset-gpios: XSHUTDOWN GPIO
+
+
+Endpoint node mandatory properties
+--
+
+- clock-lanes: <0>
+- data-lanes: <1..n>
+- remote-endpoint: A phandle to the bus receiver's endpoint node.
+
+
+Example
+---
+
+ {
+   clock-frequency = <40>;
+
+   cam1: camera@3e {
+   compatible = "toshiba,et8ek8";
+   reg = <0x3e>;
+   vana-supply = <>;
+   clocks = < 0>;
+   clock-frequency = <960>;
+   reset-gpio = < 6 GPIO_ACTIVE_HIGH>; /* 102 */
+   port {
+   csi_cam1: endpoint {
+   remote-endpoint = <_out1>;
+   };
+   };
+   };
+};
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 993dc50..e964787 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -629,6 +629,7 @@ config VIDEO_S5K5BAF
  camera sensor with an embedded SoC image signal processor.
 
 source "drivers/media/i2c/smiapp/Kconfig"
+source "drivers/media/i2c/et8ek8/Kconfig"
 
 config VIDEO_S5C73M3
tristate "Samsung S5C73M3 sensor support"
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 94f2c99..907b180 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -2,6 +2,7 @@ msp3400-objs:=  msp3400-driver.o msp3400-kthreads.o
 obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
 
 obj-$(CONFIG_VIDEO_SMIAPP) += smiapp/
+obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8/
 obj-$(CONFIG_VIDEO_CX25840) += cx25840/
 obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/
 obj-y  += soc_camera/
diff --git a/drivers/media/i2c/et8ek8/Kconfig b/drivers/media/i2c/et8ek8/Kconfig
new file mode 100644
index 000..1439936
--- /dev/null
+++ b/drivers/media/i2c/et8ek8/Kconfig
@@ -0,0 +1,6 @@
+config VIDEO_ET8EK8
+   tristate "ET8EK8 camera sensor support"
+   depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+   ---help---
+ This is a driver for the Toshiba ET8EK8 5 MP camera sensor.
+ It is used for example in Nokia N900 (RX-51).
diff --git a/drivers/media/i2c/et8ek8/Makefile 
b/drivers/media/i2c/et8ek8/Makefile
new file mode 100644
index 000..66d1b7d
--- /dev/null
+++ b/drivers/media/i2c/et8ek8/Makefile
@@ -0,0 +1,2 @@
+et8ek8-objs+= et8ek8_mode.o et8ek8_driver.o
+obj-$(CONFIG_VIDEO_ET8EK8) += et8ek8.o
diff --git a/drivers/media/i2c/et8ek8/et8ek8_driver.c 
b/drivers/media/i2c/et8ek8/et8ek8_driver.c
new file mode 100644
index 000..1eaef78
--- /dev/null
+++ b/drivers/media/i2c/et8ek8/et8ek8_driver.c
@@ -0,0 +1,1711 @@
+/*
+ * et8ek8_driver.c
+ *
+ * Copyright (C) 2008 Nokia Corporation
+ *
+ * Contact: Sakari Ailus 
+ *  Tuukka Toivonen 
+ *
+ * Based on code from Toni Leinonen .
+ *
+ * This driver is based on the Micron MT9T012 camera imager driver
+ * (C) Texas 

Re: Kernel docs: muddying the waters a bit

2016-05-03 Thread Daniel Vetter
Hi all,

So sounds like moving ahead with rst/sphinx is the option that should
allow us to address everyone's concerns eventually? Of course the
first one won't have it all (media seems really tricky), but I'd like
to get something awesome in this area closer to mainline. I'm stalling
on typing more fancyful gpu docs right now (with tables, pictures and
stuff) since that would require a pile of needless work to redo when
we switch a few times more ;-)

And Jani also wants to get this in, but he doesn't really want to
spend more effort on a system that can't be merged.

So sphinx/rst y/n? Jon, is that ok with you from the doc maintainer pov?

Cheers, Daniel

On Wed, Apr 27, 2016 at 4:28 PM, Grant Likely  wrote:
> On Tue, Apr 12, 2016 at 4:46 PM, Jonathan Corbet  wrote:
>> On Fri, 8 Apr 2016 17:12:27 +0200
>> Markus Heiser  wrote:
>>
>>> motivated by this MT, I implemented a toolchain to migrate the kernel’s
>>> DocBook XML documentation to reST markup.
>>>
>>> It converts 99% of the docs well ... to gain an impression how
>>> kernel-docs could benefit from, visit my sphkerneldoc project page
>>> on github:
>>>
>>>   http://return42.github.io/sphkerneldoc/
>>
>> So I've obviously been pretty quiet on this recently.  Apologies...I've
>> been dealing with an extended death-in-the-family experience, and there is
>> still a fair amount of cleanup to be done.
>>
>> Looking quickly at this work, it seems similar to the results I got.  But
>> there's a lot of code there that came from somewhere?  I'd put together a
>> fairly simple conversion using pandoc and a couple of short sed scripts;
>> is there a reason for a more complex solution?
>>
>> Thanks for looking into this, anyway; I hope to be able to focus more on
>> it shortly.
>
> Hi Jon,
>
> Thanks for digging into this. FWIW, here is my $0.02. I've been
> working on restarting the devicetree specification, and after looking
> at both reStructuredText and Asciidoc(tor) I thought I liked the
> Asciidoc markup better, so chose that. I then proceeded to spend weeks
> trying to get reasonable output from the toolchain. When I got fed up
> and gave Sphinx a try, I was up and running with reasonable PDF and
> HTML output in a day and a half.
>
> Honestly, in the end I think we could make either tool do what is
> needed of it. However, my impression after trying to do a document
> that needs to have nice publishable output with both tools is that
> Sphinx is easier to work with, simpler to extend, better supported. My
> vote is firmly behind Sphinx/reStructuredText.
>
> g.



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] s5p-mfc: Don't try to put pm->clock if lookup failed

2016-05-03 Thread Javier Martinez Canillas
Hello Krzysztof,

On 05/03/2016 06:15 AM, Krzysztof Kozlowski wrote:
> On Mon, May 02, 2016 at 03:14:22PM -0400, Javier Martinez Canillas wrote:
>> Failing to get the struct s5p_mfc_pm .clock is a non-fatal error so the
>> clock field can have a errno pointer value. But s5p_mfc_final_pm() only
>> checks if .clock is not NULL before attempting to unprepare and put it.
>>
>> This leads to the following warning in clk_put() due s5p_mfc_final_pm():
>>
>> WARNING: CPU: 3 PID: 1023 at drivers/clk/clk.c:2814 
>> s5p_mfc_final_pm+0x48/0x74 [s5p_mfc]
>> CPU: 3 PID: 1023 Comm: rmmod Tainted: GW   
>> 4.6.0-rc6-next-20160502-5-g5a15a49106bc #9
>> Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
>> [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
>> [] (show_stack) from [] (dump_stack+0x88/0x9c)
>> [] (dump_stack) from [] (__warn+0xe8/0x100)
>> [] (__warn) from [] (warn_slowpath_null+0x20/0x28)
>> [] (warn_slowpath_null) from [] 
>> (s5p_mfc_final_pm+0x48/0x74 [s5p_mfc])
>> [] (s5p_mfc_final_pm [s5p_mfc]) from [] 
>> (s5p_mfc_remove+0x8c/0x94 [s5p_mfc])
>> [] (s5p_mfc_remove [s5p_mfc]) from [] 
>> (platform_drv_remove+0x24/0x3c)
>> [] (platform_drv_remove) from [] 
>> (__device_release_driver+0x84/0x110)
>> [] (__device_release_driver) from [] 
>> (driver_detach+0xac/0xb0)
>> [] (driver_detach) from [] (bus_remove_driver+0x4c/0xa0)
>> [] (bus_remove_driver) from [] 
>> (SyS_delete_module+0x174/0x1b8)
>> [] (SyS_delete_module) from [] 
>> (ret_fast_syscall+0x0/0x3c)
>>
>> Assign the pointer to NULL in case of a lookup failure to fix the issue.
>>
>> Signed-off-by: Javier Martinez Canillas 
>>
>> ---
>>
>> Changes in v2:
>> - Set the clock pointer to NULL instead of checking for !IS_ERR_OR_NULL().
>>   Suggested by Arnd Bergmann.
>>
>>  drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 1 +
>>  1 file changed, 1 insertion(+)
> 
> This is a fix for bug, so for statistics:
> Fixes: d19f405a5a8d ("[media] s5p-mfc: Fix selective sclk_mfc init")
> 
> ... and although not fatal, but annoying so I think this deserves:
> Cc: 
>

Indeed, sorry for missing those.
 
> Anyway:
> Reviewed-by: Krzysztof Kozlowski 
>

Thanks a lot for your feedback.
 
> Best regards,
> Krzysztof
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
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 v10 4/8] dt-bindings: Add a binding for Mediatek Video Encoder

2016-05-03 Thread Tiffany Lin
Add a DT binding documentation of Video Encoder for the
MT8173 SoC from Mediatek.

Signed-off-by: Tiffany Lin 
Acked-by: Rob Herring 

---
 .../devicetree/bindings/media/mediatek-vcodec.txt  |   59 
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/mediatek-vcodec.txt

diff --git a/Documentation/devicetree/bindings/media/mediatek-vcodec.txt 
b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
new file mode 100644
index 000..59a47a5
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/mediatek-vcodec.txt
@@ -0,0 +1,59 @@
+Mediatek Video Codec
+
+Mediatek Video Codec is the video codec hw present in Mediatek SoCs which
+supports high resolution encoding functionalities.
+
+Required properties:
+- compatible : "mediatek,mt8173-vcodec-enc" for encoder
+- reg : Physical base address of the video codec registers and length of
+  memory mapped region.
+- interrupts : interrupt number to the cpu.
+- mediatek,larb : must contain the local arbiters in the current Socs.
+- clocks : list of clock specifiers, corresponding to entries in
+  the clock-names property.
+- clock-names: encoder must contain "venc_sel_src", "venc_sel",
+- "venc_lt_sel_src", "venc_lt_sel".
+- iommus : should point to the respective IOMMU block with master port as
+  argument, see Documentation/devicetree/bindings/iommu/mediatek,iommu.txt
+  for details.
+- mediatek,vpu : the node of video processor unit
+
+Example:
+vcodec_enc: vcodec@0x18002000 {
+compatible = "mediatek,mt8173-vcodec-enc";
+reg = <0 0x18002000 0 0x1000>,/*VENC_SYS*/
+  <0 0x19002000 0 0x1000>;/*VENC_LT_SYS*/
+interrupts = ,
+;
+mediatek,larb = <>,
+   <>;
+iommus = < M4U_PORT_VENC_RCPU>,
+ < M4U_PORT_VENC_REC>,
+ < M4U_PORT_VENC_BSDMA>,
+ < M4U_PORT_VENC_SV_COMV>,
+ < M4U_PORT_VENC_RD_COMV>,
+ < M4U_PORT_VENC_CUR_LUMA>,
+ < M4U_PORT_VENC_CUR_CHROMA>,
+ < M4U_PORT_VENC_REF_LUMA>,
+ < M4U_PORT_VENC_REF_CHROMA>,
+ < M4U_PORT_VENC_NBM_RDMA>,
+ < M4U_PORT_VENC_NBM_WDMA>,
+ < M4U_PORT_VENC_RCPU_SET2>,
+ < M4U_PORT_VENC_REC_FRM_SET2>,
+ < M4U_PORT_VENC_BSDMA_SET2>,
+ < M4U_PORT_VENC_SV_COMA_SET2>,
+ < M4U_PORT_VENC_RD_COMA_SET2>,
+ < M4U_PORT_VENC_CUR_LUMA_SET2>,
+ < M4U_PORT_VENC_CUR_CHROMA_SET2>,
+ < M4U_PORT_VENC_REF_LUMA_SET2>,
+ < M4U_PORT_VENC_REC_CHROMA_SET2>;
+mediatek,vpu = <>;
+clocks = < CLK_TOP_VENCPLL_D2>,
+ < CLK_TOP_VENC_SEL>,
+ < CLK_TOP_UNIVPLL1_D2>,
+ < CLK_TOP_VENC_LT_SEL>;
+clock-names = "venc_sel_src",
+  "venc_sel",
+  "venc_lt_sel_src",
+  "venc_lt_sel";
+  };
-- 
1.7.9.5

--
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 v10 7/8] [media] vcodec: mediatek: Add Mediatek H264 Video Encoder Driver

2016-05-03 Thread Tiffany Lin
Add h264 encoder driver for MT8173

Signed-off-by: PoChun Lin 
Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/mtk-vcodec/Makefile |1 +
 .../media/platform/mtk-vcodec/venc/venc_h264_if.c  |  679 
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|4 +-
 3 files changed, 683 insertions(+), 1 deletion(-)
 create mode 100644 drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c

diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
index bf73a45..dc5cb00 100644
--- a/drivers/media/platform/mtk-vcodec/Makefile
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -12,6 +12,7 @@ mtk-vcodec-enc-y := venc/venc_vp8_if.o \
venc_drv_if.o \
venc_vpu_if.o \
 
+
 mtk-vcodec-common-y := mtk_vcodec_intr.o \
mtk_vcodec_util.o\
 
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c 
b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
new file mode 100644
index 000..f4e18bb
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c
@@ -0,0 +1,679 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: Jungchang Tsao 
+ * Daniel Hsiao 
+ * PoChun Lin 
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+
+#include "../mtk_vcodec_drv.h"
+#include "../mtk_vcodec_util.h"
+#include "../mtk_vcodec_intr.h"
+#include "../mtk_vcodec_enc.h"
+#include "../mtk_vcodec_enc_pm.h"
+#include "../venc_drv_base.h"
+#include "../venc_ipi_msg.h"
+#include "../venc_vpu_if.h"
+#include "mtk_vpu.h"
+
+static const char h264_filler_marker[] = {0x0, 0x0, 0x0, 0x1, 0xc};
+
+#define H264_FILLER_MARKER_SIZE ARRAY_SIZE(h264_filler_marker)
+#define VENC_PIC_BITSTREAM_BYTE_CNT 0x0098
+
+/**
+ * enum venc_h264_vpu_work_buf - h264 encoder buffer index
+ */
+enum venc_h264_vpu_work_buf {
+   VENC_H264_VPU_WORK_BUF_RC_INFO,
+   VENC_H264_VPU_WORK_BUF_RC_CODE,
+   VENC_H264_VPU_WORK_BUF_REC_LUMA,
+   VENC_H264_VPU_WORK_BUF_REC_CHROMA,
+   VENC_H264_VPU_WORK_BUF_REF_LUMA,
+   VENC_H264_VPU_WORK_BUF_REF_CHROMA,
+   VENC_H264_VPU_WORK_BUF_MV_INFO_1,
+   VENC_H264_VPU_WORK_BUF_MV_INFO_2,
+   VENC_H264_VPU_WORK_BUF_SKIP_FRAME,
+   VENC_H264_VPU_WORK_BUF_MAX,
+};
+
+/**
+ * enum venc_h264_bs_mode - for bs_mode argument in h264_enc_vpu_encode
+ */
+enum venc_h264_bs_mode {
+   H264_BS_MODE_SPS,
+   H264_BS_MODE_PPS,
+   H264_BS_MODE_FRAME,
+};
+
+/*
+ * struct venc_h264_vpu_config - Structure for h264 encoder configuration
+ * @input_fourcc: input fourcc
+ * @bitrate: target bitrate (in bps)
+ * @pic_w: picture width. Picture size is visible stream resolution, in pixels,
+ * to be used for display purposes; must be smaller or equal to buffer
+ * size.
+ * @pic_h: picture height
+ * @buf_w: buffer width. Buffer size is stream resolution in pixels aligned to
+ * hardware requirements.
+ * @buf_h: buffer height
+ * @gop_size: group of picture size (idr frame)
+ * @intra_period: intra frame period
+ * @framerate: frame rate in fps
+ * @profile: as specified in standard
+ * @level: as specified in standard
+ * @wfd: WFD mode 1:on, 0:off
+ */
+struct venc_h264_vpu_config {
+   u32 input_fourcc;
+   u32 bitrate;
+   u32 pic_w;
+   u32 pic_h;
+   u32 buf_w;
+   u32 buf_h;
+   u32 gop_size;
+   u32 intra_period;
+   u32 framerate;
+   u32 profile;
+   u32 level;
+   u32 wfd;
+};
+
+/*
+ * struct venc_h264_vpu_buf - Structure for buffer information
+ * @align: buffer alignment (in bytes)
+ * @iova: IO virtual address
+ * @vpua: VPU side memory addr which is used by RC_CODE
+ * @size: buffer size (in bytes)
+ */
+struct venc_h264_vpu_buf {
+   u32 align;
+   u32 iova;
+   u32 vpua;
+   u32 size;
+};
+
+/*
+ * struct venc_h264_vsi - Structure for VPU driver control and info share
+ * This structure is allocated in VPU side and shared to AP side.
+ * @config: h264 encoder configuration
+ * @work_bufs: working buffer information in VPU side
+ * The work_bufs here is for storing the 'size' info shared to AP side.
+ * The similar item in struct venc_h264_inst is for memory allocation
+ * in AP side. The AP driver will copy the 'size' from here to the one in
+ * struct mtk_vcodec_mem, then invoke mtk_vcodec_mem_alloc to allocate
+ * the buffer. After that, bypass the 'dma_addr' to the 'iova' 

[PATCH v10 2/8] [media] VPU: mediatek: support Mediatek VPU

2016-05-03 Thread Tiffany Lin
From: Andrew-CT Chen 

The VPU driver for hw video codec embedded in Mediatek's MT8173 SOCs.
It is able to handle video decoding/encoding of in a range of formats.
The driver provides with VPU firmware download, memory management and
the communication interface between CPU and VPU.
For VPU initialization, it will create virtual memory for CPU access and
IOMMU address for vcodec hw device access. When a decode/encode instance
opens a device node, vpu driver will download vpu firmware to the device.
A decode/encode instant will decode/encode a frame using VPU
interface to interrupt vpu to handle decoding/encoding jobs.

Signed-off-by: Andrew-CT Chen 
Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/Kconfig   |   14 +
 drivers/media/platform/Makefile  |2 +
 drivers/media/platform/mtk-vpu/Makefile  |3 +
 drivers/media/platform/mtk-vpu/mtk_vpu.c |  950 ++
 drivers/media/platform/mtk-vpu/mtk_vpu.h |  162 +
 5 files changed, 1131 insertions(+)
 create mode 100644 drivers/media/platform/mtk-vpu/Makefile
 create mode 100644 drivers/media/platform/mtk-vpu/mtk_vpu.c
 create mode 100644 drivers/media/platform/mtk-vpu/mtk_vpu.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 84e041c..d87ae31 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -152,6 +152,20 @@ config VIDEO_CODA
   Coda is a range of video codec IPs that supports
   H.264, MPEG-4, and other video formats.
 
+config VIDEO_MEDIATEK_VPU
+   tristate "Mediatek Video Processor Unit"
+   depends on ARM || ARM64
+   depends on VIDEO_DEV && VIDEO_V4L2
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   ---help---
+   This driver provides downloading VPU firmware and
+   communicating with VPU. This driver for hw video
+   codec embedded in Mediatek's MT8173 SOCs. It is able
+   to handle video decoding/encoding in a range of formats.
+
+   To compile this driver as a module, choose M here: the
+   module will be called mtk-vpu.
+
 config VIDEO_MEM2MEM_DEINTERLACE
tristate "Deinterlace support"
depends on VIDEO_DEV && VIDEO_V4L2 && DMA_ENGINE
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index bbb7bd1..2efb7b1 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -56,3 +56,5 @@ obj-$(CONFIG_VIDEO_AM437X_VPFE)   += am437x/
 obj-$(CONFIG_VIDEO_XILINX) += xilinx/
 
 ccflags-y += -I$(srctree)/drivers/media/i2c
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VPU)   += mtk-vpu/
diff --git a/drivers/media/platform/mtk-vpu/Makefile 
b/drivers/media/platform/mtk-vpu/Makefile
new file mode 100644
index 000..58cc1b4
--- /dev/null
+++ b/drivers/media/platform/mtk-vpu/Makefile
@@ -0,0 +1,3 @@
+mtk-vpu-y += mtk_vpu.o
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VPU) += mtk-vpu.o
diff --git a/drivers/media/platform/mtk-vpu/mtk_vpu.c 
b/drivers/media/platform/mtk-vpu/mtk_vpu.c
new file mode 100644
index 000..b60d02c
--- /dev/null
+++ b/drivers/media/platform/mtk-vpu/mtk_vpu.c
@@ -0,0 +1,950 @@
+/*
+* Copyright (c) 2016 MediaTek Inc.
+* Author: Andrew-CT Chen 
+*
+* 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.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*/
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "mtk_vpu.h"
+
+/**
+ * VPU (video processor unit) is a tiny processor controlling video hardware
+ * related to video codec, scaling and color format converting.
+ * VPU interfaces with other blocks by share memory and interrupt.
+ **/
+
+#define INIT_TIMEOUT_MS2000U
+#define IPI_TIMEOUT_MS 2000U
+#define VPU_FW_VER_LEN 16
+
+/* maximum program/data TCM (Tightly-Coupled Memory) size */
+#define VPU_PTCM_SIZE  (96 * SZ_1K)
+#define VPU_DTCM_SIZE  (32 * SZ_1K)
+/* the offset to get data tcm address */
+#define VPU_DTCM_OFFSET0x18000UL
+/* daynamic allocated maximum extended memory size */
+#define VPU_EXT_P_SIZE SZ_1M
+#define VPU_EXT_D_SIZE SZ_4M
+/* maximum binary firmware size */
+#define VPU_P_FW_SIZE  (VPU_PTCM_SIZE + VPU_EXT_P_SIZE)
+#define VPU_D_FW_SIZE  (VPU_DTCM_SIZE + VPU_EXT_D_SIZE)
+/* the size of share buffer between Host and  VPU */
+#define SHARE_BUF_SIZE 48
+
+/* binary firmware name */
+#define VPU_P_FW   

[PATCH v10 1/8] dt-bindings: Add a binding for Mediatek Video Processor

2016-05-03 Thread Tiffany Lin
From: Andrew-CT Chen 

Add a DT binding documentation of Video Processor Unit for the
MT8173 SoC from Mediatek.

Signed-off-by: Andrew-CT Chen 
Signed-off-by: Tiffany Lin 
Acked-by: Rob Herring 

---
 .../devicetree/bindings/media/mediatek-vpu.txt |   31 
 1 file changed, 31 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/mediatek-vpu.txt

diff --git a/Documentation/devicetree/bindings/media/mediatek-vpu.txt 
b/Documentation/devicetree/bindings/media/mediatek-vpu.txt
new file mode 100644
index 000..2a5bac3
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/mediatek-vpu.txt
@@ -0,0 +1,31 @@
+* Mediatek Video Processor Unit
+
+Video Processor Unit is a HW video controller. It controls HW Codec including
+H.264/VP8/VP9 Decode, H.264/VP8 Encode and Image Processor (scale/rotate/color 
convert).
+
+Required properties:
+  - compatible: "mediatek,mt8173-vpu"
+  - reg: Must contain an entry for each entry in reg-names.
+  - reg-names: Must include the following entries:
+"tcm": tcm base
+"cfg_reg": Main configuration registers base
+  - interrupts: interrupt number to the cpu.
+  - clocks : clock name from clock manager
+  - clock-names: must be main. It is the main clock of VPU
+
+Optional properties:
+  - memory-region: phandle to a node describing memory (see
+Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt)
+to be used for VPU extended memory; if not present, VPU may be located
+anywhere in the memory
+
+Example:
+   vpu: vpu@1002 {
+   compatible = "mediatek,mt8173-vpu";
+   reg = <0 0x1002 0 0x3>,
+ <0 0x1005 0 0x100>;
+   reg-names = "tcm", "cfg_reg";
+   interrupts = ;
+   clocks = < TOP_SCP_SEL>;
+   clock-names = "main";
+   };
-- 
1.7.9.5

--
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 v10 6/8] [media] vcodec: mediatek: Add Mediatek VP8 Video Encoder Driver

2016-05-03 Thread Tiffany Lin
Add vp8 encoder driver for MT8173

Signed-off-by: PoChun Lin 
Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/mtk-vcodec/Makefile |6 +-
 .../media/platform/mtk-vcodec/venc/venc_vp8_if.c   |  481 
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|7 +-
 drivers/media/platform/mtk-vcodec/venc_vpu_if.c|  237 ++
 drivers/media/platform/mtk-vcodec/venc_vpu_if.h|   61 +++
 5 files changed, 790 insertions(+), 2 deletions(-)
 create mode 100644 drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_vpu_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_vpu_if.h

diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
index d04433be..bf73a45 100644
--- a/drivers/media/platform/mtk-vcodec/Makefile
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -1,12 +1,16 @@
 
+
 obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o mtk-vcodec-common.o
 
 
 
-mtk-vcodec-enc-y := mtk_vcodec_enc.o \
+mtk-vcodec-enc-y := venc/venc_vp8_if.o \
+   venc/venc_h264_if.o \
+   mtk_vcodec_enc.o \
mtk_vcodec_enc_drv.o \
mtk_vcodec_enc_pm.o \
venc_drv_if.o \
+   venc_vpu_if.o \
 
 mtk-vcodec-common-y := mtk_vcodec_intr.o \
mtk_vcodec_util.o\
diff --git a/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c 
b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
new file mode 100644
index 000..431ae70
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c
@@ -0,0 +1,481 @@
+/*
+ * Copyright (c) 2016 MediaTek Inc.
+ * Author: Daniel Hsiao 
+ * PoChun Lin 
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+
+#include "../mtk_vcodec_drv.h"
+#include "../mtk_vcodec_util.h"
+#include "../mtk_vcodec_intr.h"
+#include "../mtk_vcodec_enc.h"
+#include "../mtk_vcodec_enc_pm.h"
+#include "../venc_drv_base.h"
+#include "../venc_ipi_msg.h"
+#include "../venc_vpu_if.h"
+#include "mtk_vpu.h"
+
+#define VENC_BITSTREAM_FRAME_SIZE 0x0098
+#define VENC_BITSTREAM_HEADER_LEN 0x00e8
+
+/* This ac_tag is vp8 frame tag. */
+#define MAX_AC_TAG_SIZE 10
+
+/**
+ * enum venc_vp8_vpu_work_buf - vp8 encoder buffer index
+ */
+enum venc_vp8_vpu_work_buf {
+   VENC_VP8_VPU_WORK_BUF_LUMA,
+   VENC_VP8_VPU_WORK_BUF_LUMA2,
+   VENC_VP8_VPU_WORK_BUF_LUMA3,
+   VENC_VP8_VPU_WORK_BUF_CHROMA,
+   VENC_VP8_VPU_WORK_BUF_CHROMA2,
+   VENC_VP8_VPU_WORK_BUF_CHROMA3,
+   VENC_VP8_VPU_WORK_BUF_MV_INFO,
+   VENC_VP8_VPU_WORK_BUF_BS_HEADER,
+   VENC_VP8_VPU_WORK_BUF_PROB_BUF,
+   VENC_VP8_VPU_WORK_BUF_RC_INFO,
+   VENC_VP8_VPU_WORK_BUF_RC_CODE,
+   VENC_VP8_VPU_WORK_BUF_RC_CODE2,
+   VENC_VP8_VPU_WORK_BUF_RC_CODE3,
+   VENC_VP8_VPU_WORK_BUF_MAX,
+};
+
+/*
+ * struct venc_vp8_vpu_config - Structure for vp8 encoder configuration
+ * @input_fourcc: input fourcc
+ * @bitrate: target bitrate (in bps)
+ * @pic_w: picture width. Picture size is visible stream resolution, in pixels,
+ * to be used for display purposes; must be smaller or equal to buffer
+ * size.
+ * @pic_h: picture height
+ * @buf_w: buffer width (with 16 alignment). Buffer size is stream resolution
+ * in pixels aligned to hardware requirements.
+ * @buf_h: buffer height (with 16 alignment)
+ * @gop_size: group of picture size (key frame)
+ * @framerate: frame rate in fps
+ * @ts_mode: temporal scalability mode (0: disable, 1: enable)
+ *  support three temporal layers - 0: 7.5fps 1: 7.5fps 2: 15fps.
+ */
+struct venc_vp8_vpu_config {
+   u32 input_fourcc;
+   u32 bitrate;
+   u32 pic_w;
+   u32 pic_h;
+   u32 buf_w;
+   u32 buf_h;
+   u32 gop_size;
+   u32 framerate;
+   u32 ts_mode;
+};
+
+/*
+ * struct venc_vp8_vpu_buf -Structure for buffer information
+ * @align: buffer alignment (in bytes)
+ * @iova: IO virtual address
+ * @vpua: VPU side memory addr which is used by RC_CODE
+ * @size: buffer size (in bytes)
+ */
+struct venc_vp8_vpu_buf {
+   u32 align;
+   u32 iova;
+   u32 vpua;
+   u32 size;
+};
+
+/*
+ * struct venc_vp8_vsi - Structure for VPU driver control and info share
+ * This structure is allocated in VPU side and shared to AP side.
+ * @config: vp8 encoder configuration
+ * @work_bufs: working buffer information in VPU side
+ * The 

[PATCH v10 0/8] Add MT8173 Video Encoder Driver and VPU Driver

2016-05-03 Thread Tiffany Lin
==
 Introduction
==

The purpose of this series is to add the driver for video codec hw embedded in 
the Mediatek's MT8173 SoCs.
Mediatek Video Codec is able to handle video encoding of in a range of formats.

This patch series also include VPU driver. Mediatek Video Codec driver rely on 
VPU driver to load,
communicate with VPU.

Internally the driver uses videobuf2 framework and MTK IOMMU and MTK SMI both 
have been merged in v4.6-rc1.
This patch series need [PATCH v15 8/8] memory: mtk-smi: export 
mtk_smi_larb_get/put[1] to build as module

[1]http://lists.infradead.org/pipermail/linux-mediatek/2016-April/005173.html

==
 Device interface
==

In principle the driver bases on v4l2 memory-to-memory framework:
it provides a single video node and each opened file handle gets its own 
private context with separate
buffer queues. Each context consist of 2 buffer queues: OUTPUT (for source 
buffers, i.e. raw video
frames) and CAPTURE (for destination buffers, i.e. encoded video frames).

==
 VPU (Video Processor Unit)
==
The VPU driver for hw video codec embedded in Mediatek's MT8173 SOCs.
It is able to handle video decoding/encoding in a range of formats.
The driver provides with VPU firmware download, memory management and the 
communication interface between CPU and VPU.
For VPU initialization, it will create virtual memory for CPU access and 
physical address for VPU hw device access. 
When a decode/encode instance opens a device node, vpu driver will download vpu 
firmware to the device.
A decode/encode instant will decode/encode a frame using VPU interface to 
interrupt vpu to handle decoding/encoding jobs.

Please have a look at the code and comments will be very much appreciated.

Change in v10:
1. Fix smatch/sparse error message
2. Add depends on ARM || ARM64 and MTK_IOMMU in Kconfig

VPU part
1. Fix smatch/sparse error message
2. Use totalram_pages instead of max_pfn to decide VPU 4GB mode
3. Protect variable "fw_load"
4. Add depends on ARM || ARM64 in Kconfig

Change in v9:
1. Rename idx in mtk_vcodec_ctx to id and curr_max_idx in mtk_vcodec_dev to 
id_counter.
2. Refine fops_vcodec_open

VPU part
Merge Julia Lawall's fixes to "[PATCH v9 2/8] [media] VPU: mediatek: support 
Mediatek VPU"
1.[PATCH] VPU: mediatek: fix simple_open.cocci warnings 
2.[PATCH] VPU: mediatek: fix platform_no_drv_owner.cocci warnings

Change in v8:
1. Refine indentation
2. Refine colorspace information process vidioc_try_fmt_vid_out_mplane
3. Remove instance_mask in mtk_vcodec_dev, use curr_max_idx for instance index
4. Use kzalloc to allocate ctx
5. Refine fops_vcodec_open

VPU Part
1. Refine vpu_load_firmware

Change in v7:
1. Rebase against the master branch of git://linuxtv.org/media_tree.git
2. Add ycbcr_enc, quantization and xfer_func in try_fmt, g_fmt, s_fmt
3. Merge h264_enc and vp8_enc to venc directory

Change in v6:
1. Add synchronization access protect between irq handler and work thread
2. Add DMA_ATTR_ALLOC_SINGLE_PAGES support
3. S_FMT will return coded_width, coded_height, so user space could allocate 
correct size memory that HW required
4. merge h264/vp8 enc ap and md32 ipi msg
5. separate h264/vp8 enc gop_size and intra_period handle
6. remove sizeimage relative code in work buffer function
7. Refine makefile to build as an module
8. Code clean up

VPU Part
1. export symbols for building VPU as an module
2. change function from "wait_event_interruptible_timeout" to 
"wait_event_timeout" since
   CPU needs to wait for ACK from VPU even if it was interrupted by a signal

v4l2-compliance test output:
localhost Encode # ./v4l2-compliance -d /dev/video1
Driver Info:
Driver name   : mtk-vcodec-enc
Card type : platform:mt8173
Bus info  : platform:mt8173
Driver version: 4.4.0
Capabilities  : 0x84204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps   : 0x04204000
Video Memory-to-Memory Multiplanar
Streaming
Extended Pix Format

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

Required ioctls:
test VIDIOC_QUERYCAP: OK

Allow for multiple opens:
test second video open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK

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

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

Output ioctls:
   

[PATCH v10 3/8] arm64: dts: mediatek: Add node for Mediatek Video Processor Unit

2016-05-03 Thread Tiffany Lin
From: Andrew-CT Chen 

Add VPU drivers for MT8173

Signed-off-by: Andrew-CT Chen 
Signed-off-by: Tiffany Lin 

---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |   23 +++
 1 file changed, 23 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index eab7efc..ae147bb 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -125,6 +125,18 @@
clock-output-names = "cpum_ck";
};
 
+   reserved-memory {
+   #address-cells = <2>;
+   #size-cells = <2>;
+   ranges;
+   vpu_dma_reserved: vpu_dma_mem_region {
+   compatible = "shared-dma-pool";
+   reg = <0 0xb700 0 0x50>;
+   alignment = <0x1000>;
+   no-map;
+   };
+   };
+
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <>;
@@ -269,6 +281,17 @@
clock-names = "spi", "wrap";
};
 
+   vpu: vpu@1002 {
+   compatible = "mediatek,mt8173-vpu";
+   reg = <0 0x1002 0 0x3>,
+ <0 0x1005 0 0x100>;
+   reg-names = "tcm", "cfg_reg";
+   interrupts = ;
+   clocks = < CLK_TOP_SCP_SEL>;
+   clock-names = "main";
+   memory-region = <_dma_reserved>;
+   };
+
sysirq: intpol-controller@10200620 {
compatible = "mediatek,mt8173-sysirq",
 "mediatek,mt6577-sysirq";
-- 
1.7.9.5

--
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 v10 8/8] arm64: dts: mediatek: Add Video Encoder for MT8173

2016-05-03 Thread Tiffany Lin
Add video encoder node for MT8173

Signed-off-by: Tiffany Lin 

---
 arch/arm64/boot/dts/mediatek/mt8173.dtsi |   39 ++
 1 file changed, 39 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi 
b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index ae147bb..348ce0e 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -717,6 +717,45 @@
clock-names = "apb", "smi";
};
 
+   vcodec_enc: vcodec@18002000 {
+   compatible = "mediatek,mt8173-vcodec-enc";
+   reg = <0 0x18002000 0 0x1000>,  /* VENC_SYS */
+ <0 0x19002000 0 0x1000>;  /* VENC_LT_SYS */
+   interrupts = ,
+;
+   mediatek,larb = <>,
+   <>;
+   iommus = < M4U_PORT_VENC_RCPU>,
+< M4U_PORT_VENC_REC>,
+< M4U_PORT_VENC_BSDMA>,
+< M4U_PORT_VENC_SV_COMV>,
+< M4U_PORT_VENC_RD_COMV>,
+< M4U_PORT_VENC_CUR_LUMA>,
+< M4U_PORT_VENC_CUR_CHROMA>,
+< M4U_PORT_VENC_REF_LUMA>,
+< M4U_PORT_VENC_REF_CHROMA>,
+< M4U_PORT_VENC_NBM_RDMA>,
+< M4U_PORT_VENC_NBM_WDMA>,
+< M4U_PORT_VENC_RCPU_SET2>,
+< M4U_PORT_VENC_REC_FRM_SET2>,
+< M4U_PORT_VENC_BSDMA_SET2>,
+< M4U_PORT_VENC_SV_COMA_SET2>,
+< M4U_PORT_VENC_RD_COMA_SET2>,
+< M4U_PORT_VENC_CUR_LUMA_SET2>,
+< M4U_PORT_VENC_CUR_CHROMA_SET2>,
+< M4U_PORT_VENC_REF_LUMA_SET2>,
+< M4U_PORT_VENC_REC_CHROMA_SET2>;
+   mediatek,vpu = <>;
+   clocks = < CLK_TOP_VENCPLL_D2>,
+< CLK_TOP_VENC_SEL>,
+< CLK_TOP_UNIVPLL1_D2>,
+< CLK_TOP_VENC_LT_SEL>;
+   clock-names = "venc_sel_src",
+ "venc_sel",
+ "venc_lt_sel_src",
+ "venc_lt_sel";
+   };
+
vencltsys: clock-controller@1900 {
compatible = "mediatek,mt8173-vencltsys", "syscon";
reg = <0 0x1900 0 0x1000>;
-- 
1.7.9.5

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


Re: [PATCH v2] s5p-mfc: Don't try to put pm->clock if lookup failed

2016-05-03 Thread Krzysztof Kozlowski
On Mon, May 02, 2016 at 03:14:22PM -0400, Javier Martinez Canillas wrote:
> Failing to get the struct s5p_mfc_pm .clock is a non-fatal error so the
> clock field can have a errno pointer value. But s5p_mfc_final_pm() only
> checks if .clock is not NULL before attempting to unprepare and put it.
> 
> This leads to the following warning in clk_put() due s5p_mfc_final_pm():
> 
> WARNING: CPU: 3 PID: 1023 at drivers/clk/clk.c:2814 
> s5p_mfc_final_pm+0x48/0x74 [s5p_mfc]
> CPU: 3 PID: 1023 Comm: rmmod Tainted: GW   
> 4.6.0-rc6-next-20160502-5-g5a15a49106bc #9
> Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
> [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
> [] (show_stack) from [] (dump_stack+0x88/0x9c)
> [] (dump_stack) from [] (__warn+0xe8/0x100)
> [] (__warn) from [] (warn_slowpath_null+0x20/0x28)
> [] (warn_slowpath_null) from [] 
> (s5p_mfc_final_pm+0x48/0x74 [s5p_mfc])
> [] (s5p_mfc_final_pm [s5p_mfc]) from [] 
> (s5p_mfc_remove+0x8c/0x94 [s5p_mfc])
> [] (s5p_mfc_remove [s5p_mfc]) from [] 
> (platform_drv_remove+0x24/0x3c)
> [] (platform_drv_remove) from [] 
> (__device_release_driver+0x84/0x110)
> [] (__device_release_driver) from [] 
> (driver_detach+0xac/0xb0)
> [] (driver_detach) from [] (bus_remove_driver+0x4c/0xa0)
> [] (bus_remove_driver) from [] 
> (SyS_delete_module+0x174/0x1b8)
> [] (SyS_delete_module) from [] (ret_fast_syscall+0x0/0x3c)
> 
> Assign the pointer to NULL in case of a lookup failure to fix the issue.
> 
> Signed-off-by: Javier Martinez Canillas 
> 
> ---
> 
> Changes in v2:
> - Set the clock pointer to NULL instead of checking for !IS_ERR_OR_NULL().
>   Suggested by Arnd Bergmann.
> 
>  drivers/media/platform/s5p-mfc/s5p_mfc_pm.c | 1 +
>  1 file changed, 1 insertion(+)

This is a fix for bug, so for statistics:
Fixes: d19f405a5a8d ("[media] s5p-mfc: Fix selective sclk_mfc init")

... and although not fatal, but annoying so I think this deserves:
Cc: 

Anyway:
Reviewed-by: Krzysztof Kozlowski 

Best regards,
Krzysztof
--
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 v10 5/8] [media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver

2016-05-03 Thread Tiffany Lin
Add v4l2 layer encoder driver for MT8173

Signed-off-by: Tiffany Lin 

---
 drivers/media/platform/Kconfig |   18 +
 drivers/media/platform/Makefile|2 +
 drivers/media/platform/mtk-vcodec/Makefile |   14 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h |  338 +
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c | 1288 
 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h |   58 +
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c |  454 +++
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c  |  137 +++
 .../media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h  |   26 +
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.c|   55 +
 .../media/platform/mtk-vcodec/mtk_vcodec_intr.h|   27 +
 .../media/platform/mtk-vcodec/mtk_vcodec_util.c|   94 ++
 .../media/platform/mtk-vcodec/mtk_vcodec_util.h|   87 ++
 drivers/media/platform/mtk-vcodec/venc_drv_base.h  |   62 +
 drivers/media/platform/mtk-vcodec/venc_drv_if.c|  106 ++
 drivers/media/platform/mtk-vcodec/venc_drv_if.h|  163 +++
 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h   |  210 
 17 files changed, 3139 insertions(+)
 create mode 100644 drivers/media/platform/mtk-vcodec/Makefile
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
 create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_base.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.c
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_drv_if.h
 create mode 100644 drivers/media/platform/mtk-vcodec/venc_ipi_msg.h

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index d87ae31..c425461 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -166,6 +166,24 @@ config VIDEO_MEDIATEK_VPU
To compile this driver as a module, choose M here: the
module will be called mtk-vpu.
 
+config VIDEO_MEDIATEK_VCODEC
+   tristate "Mediatek Video Codec driver"
+depends on ARM || ARM64
+depends on MTK_IOMMU
+   depends on VIDEO_DEV && VIDEO_V4L2
+   depends on ARCH_MEDIATEK || COMPILE_TEST
+   select VIDEOBUF2_DMA_CONTIG
+   select V4L2_MEM2MEM_DEV
+   select VIDEO_MEDIATEK_VPU
+   default n
+   ---help---
+   Mediatek video codec driver provides HW capability to
+   encode and decode in a range of video formats
+   This driver rely on VPU driver to communicate with VPU.
+
+   To compile this driver as a module, choose M here: the
+   module will be called mtk-vcodec
+
 config VIDEO_MEM2MEM_DEINTERLACE
tristate "Deinterlace support"
depends on VIDEO_DEV && VIDEO_V4L2 && DMA_ENGINE
diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
index 2efb7b1..6e735fe 100644
--- a/drivers/media/platform/Makefile
+++ b/drivers/media/platform/Makefile
@@ -58,3 +58,5 @@ obj-$(CONFIG_VIDEO_XILINX)+= xilinx/
 ccflags-y += -I$(srctree)/drivers/media/i2c
 
 obj-$(CONFIG_VIDEO_MEDIATEK_VPU)   += mtk-vpu/
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC)+= mtk-vcodec/
diff --git a/drivers/media/platform/mtk-vcodec/Makefile 
b/drivers/media/platform/mtk-vcodec/Makefile
new file mode 100644
index 000..d04433be
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/Makefile
@@ -0,0 +1,14 @@
+
+obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o mtk-vcodec-common.o
+
+
+
+mtk-vcodec-enc-y := mtk_vcodec_enc.o \
+   mtk_vcodec_enc_drv.o \
+   mtk_vcodec_enc_pm.o \
+   venc_drv_if.o \
+
+mtk-vcodec-common-y := mtk_vcodec_intr.o \
+   mtk_vcodec_util.o\
+
+ccflags-y += -I$(srctree)/drivers/media/platform/mtk-vpu
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h 
b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
new file mode 100644
index 000..78eee50
--- /dev/null
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h
@@ -0,0 +1,338 @@
+/*
+* Copyright (c) 2016 MediaTek Inc.
+* Author: PC Chen 
+* Tiffany Lin 
+*
+* 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 

Re: cron job: media_tree daily build: ERRORS

2016-05-03 Thread Hans Verkuil
On 05/03/2016 05:05 AM, Hans Verkuil wrote:
> 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: Tue May  3 04:00:18 CEST 2016
> git branch:   test
> git hash: 68af062b5f38510dc96635314461c6bbe1dbf2fe
> gcc version:  i686-linux-gcc (GCC) 5.3.0
> sparse version:   v0.5.0-56-g7647c77
> smatch version:   v0.5.0-3413-g618cd5c
> host hardware:x86_64
> host os:  4.5.0-164
> 
> linux-git-arm-at91: ERRORS
> linux-git-arm-davinci: ERRORS
> linux-git-arm-exynos: ERRORS
> linux-git-arm-mx: ERRORS
> linux-git-arm-omap: ERRORS
> linux-git-arm-omap1: ERRORS
> linux-git-arm-pxa: ERRORS
> linux-git-blackfin-bf561: OK
> linux-git-i686: OK
> linux-git-m32r: OK
> linux-git-mips: OK
> linux-git-powerpc64: OK
> linux-git-sh: ERRORS
> linux-git-x86_64: OK

These errors are because 'make oldconfig' fails. I corrected this, but also
did some tests to see whether there isn't a better alternative and I discovered
'make olddefconfig' which will do the same things that 'make menuconfig' does:
it picks the default value for new config options.

This should prevent this from happening again in the future.

Regards,

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