]> rtime.felk.cvut.cz Git - zynq/linux.git/log
zynq/linux.git
5 years agocan: xilinx: Fix the documentation
Shubhrajyoti Datta [Sat, 6 Oct 2018 12:06:54 +0000 (17:36 +0530)]
can: xilinx: Fix the documentation

Fix a typo in the can description of the can 1.0 controllers

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Remove the SERIAL_UARTLITE_NR_UARTS macro
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:43 +0000 (20:07 +0530)]
arm64: zynqmp: Remove the SERIAL_UARTLITE_NR_UARTS macro

Remove the SERIAL_UARTLITE_NR_UARTS macro as it is unused.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Remove SERIAL_UARTLITE_NR_UARTS
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:42 +0000 (20:07 +0530)]
serial-uartlite: Remove SERIAL_UARTLITE_NR_UARTS

Remove SERIAL_UARTLITE_NR_UARTS from Kconfig as it is unused.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Remove ULITE_NR_PORTS macro
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:39 +0000 (20:07 +0530)]
serial-uartlite: Remove ULITE_NR_PORTS macro

This patch is removing ULITE_NR_PORTS macro which limits number of
ports which can be used. Every instance is registering own struct
uart_driver with minor number which corresponds to alias ID (or 0 now).
and with 1 uart port. The same alias ID is saved to
tty_driver->name_base which is key field for creating ttyULX name.

Because name_base and minor number are setup already there is no need to
setup any port->line number because 0 is the right value.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Use allocated structure instead of static ones
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:40 +0000 (20:07 +0530)]
serial-uartlite: Use allocated structure instead of static ones

Remove the use of the static uartlite structure.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Change logic how console_port is setup
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:38 +0000 (20:07 +0530)]
serial-uartlite: Change logic how console_port is setup

Change logic how console_port is setup by using CON_ENABLED flag
instead of index. There will be unique uart_console
structure that's why code can't use id for console_port
assignment.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Fix the unbind path
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:37 +0000 (20:07 +0530)]
serial-uartlite: Fix the unbind path

Currently the clocks are not enabled at probe but when the port is used.
Remove the unconditional disable at remove.

Fixes the below
[   77.660196] ------------[ cut here ]------------
[   77.664749] WARNING: CPU: 0 PID: 1992 at drivers/clk/clk.c:622
clk_core_disable+0x78/0x80
[   77.672892] Modules linked in:
[   77.675930] CPU: 0 PID: 1992 Comm: sh Not tainted 4.14.0 #23
[   77.681570] Hardware name: xlnx,zynqmp (DT)
[   77.685736] task: ffffffc879e2e580 task.stack: ffffff800be30000
[   77.691641] PC is at clk_core_disable+0x78/0x80

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: define console when CONFIG_SERIAL_UARTLITE_CONSOLE is defined
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:36 +0000 (20:07 +0530)]
serial-uartlite: define console when CONFIG_SERIAL_UARTLITE_CONSOLE is defined

Define console when CONFIG_SERIAL_UARTLITE_CONSOLE is defined.

The patch removes this warning:
drivers/tty/serial/uartlite.c:64:26: warning: ‘console_port’ defined but
not used [-Wunused-variable]
 static struct uart_port *console_port;
                          ^~~~~~~~~~~~

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Add runtime support
Michal Simek [Fri, 5 Oct 2018 08:48:22 +0000 (10:48 +0200)]
serial-uartlite: Add runtime support

Add runtime support

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Do not use static struct uart_driver out of probe()
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:34 +0000 (20:07 +0530)]
serial-uartlite: Do not use static struct uart_driver out of probe()

ulite_uart_suspend()/resume() and remove() are using static reference
to struct uart_driver. Assign this referece to private data structure
as preparation step for dynamic struct uart_driver allocation.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial-uartlite: Add get serial id if not provided
Shubhrajyoti Datta [Thu, 4 Oct 2018 14:37:33 +0000 (20:07 +0530)]
serial-uartlite: Add get serial id if not provided

Add get serial id if not provided

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial: uartps: Fix error path when alloc failed
Michal Simek [Fri, 5 Oct 2018 09:20:14 +0000 (11:20 +0200)]
serial: uartps: Fix error path when alloc failed

When cdns_uart_console allocation failed there is a need to also clear
ID from ID list.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: vpss-scaler: Correct default values when max width, height dt property...
Vishal Sagar [Fri, 5 Oct 2018 03:46:28 +0000 (09:16 +0530)]
v4l: xilinx: vpss-scaler: Correct default values when max width, height dt property absent

Revert to 3840x2160 as default value of max width and height to
maintain compatibility instead of 8192x4320.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx-gamma: Correct default values when max width, height dt property absent
Vishal Sagar [Fri, 5 Oct 2018 03:46:27 +0000 (09:16 +0530)]
v4l: xilinx-gamma: Correct default values when max width, height dt property absent

Revert to 3840x2160 as default value of max width and height to
maintain compatibility instead of 8192x4320.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx-demosaic: Correct default values when width, height dt property absent
Vishal Sagar [Fri, 5 Oct 2018 03:46:26 +0000 (09:16 +0530)]
v4l: xilinx-demosaic: Correct default values when width, height dt property absent

Revert to 3840x2160 as default value of max width and height to maintain
compatibility instead of 8192x4320.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoxilinx: v4l: dma: Remove unused function definition
Satish Kumar Nagireddy [Thu, 4 Oct 2018 18:23:43 +0000 (11:23 -0700)]
xilinx: v4l: dma: Remove unused function definition

This patch removes unused function definition xvip_get_entity_sink().

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agousb: xilinx: Add suspend resume support
Shubhrajyoti Datta [Mon, 1 Oct 2018 12:45:57 +0000 (18:15 +0530)]
usb: xilinx: Add suspend resume support

Add suspend resume support.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Reviewed-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: IRQ allocation change in probe()
Vasileios Bimpikas [Wed, 3 Oct 2018 14:00:25 +0000 (15:00 +0100)]
staging: xroeframer: IRQ allocation change in probe()

As the IRQ is not yet fully implemented in the hardware, the probe will
return 0 instead of propagating the error returned by attempting to
allocate the IRQ. A TODO to fix that once it's finalised in the hardware
design has been added along with the change.

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: IPv4 sysfs address entries change
Vasileios Bimpikas [Wed, 3 Oct 2018 13:46:26 +0000 (14:46 +0100)]
staging: xroeframer: IPv4 sysfs address entries change

Changing the variable that stores the IPv4 destination and source
addresses in IPv4 "show" sysfs entries (sysfs_xroe_framer_ipv4.c) from
variable to fixed length (as it will always be exactly 4 numbers,
barring errors which are already handled and returned to the user).

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: enable axi clock in audio formatter
Maruthi Srinivas Bayyavarapu [Wed, 3 Oct 2018 12:48:45 +0000 (18:18 +0530)]
ASoC: xlnx: enable axi clock in audio formatter

A phandle to axi clock is obtained and clock is enabled/disabled
appropriately.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: support multiple sampling rates for I2S
Maruthi Srinivas Bayyavarapu [Wed, 3 Oct 2018 12:48:44 +0000 (18:18 +0530)]
ASoC: xlnx: support multiple sampling rates for I2S

This adds support for I2S playback and capture at various
sampling rates. Various rates can result in different period bytes,
but should be divisible by 64(considering 2 channels).
Added that constraint.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: ASoC: xlnx,audio-formatter.txt: add clocks
Maruthi Srinivas Bayyavarapu [Wed, 3 Oct 2018 12:48:43 +0000 (18:18 +0530)]
dt-bindings: ASoC: xlnx,audio-formatter.txt: add clocks

Added clocks. s_axi_lite_aclk will be used and enabled/disabled in
audio formatter driver. aud_mclk will be used in PL sound card driver
to dynamically change the mclk connected to various audio interfaces.
This change adds audio use case at different sampling rates.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agocrypto: zynqmp-rsa: Fix alignment in the driver
Michal Simek [Thu, 4 Oct 2018 13:24:45 +0000 (15:24 +0200)]
crypto: zynqmp-rsa: Fix alignment in the driver

Fix coding style issues.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agocrypto: zynqmp-rsa: Fix for crash seen when the data less than 512 bytes
Kalyani Akula [Thu, 4 Oct 2018 06:07:45 +0000 (11:37 +0530)]
crypto: zynqmp-rsa: Fix for crash seen when the data less than 512 bytes

This patch fixed the crash seen when data sent is less
than 512 bytes by adjusting the cra_blocksize for RSA driver.

ZYNQMP_BLOCK_SIZE is chosen as 64 because the minimum key size
supported by RSA crypto engine is 512 bit (64 bytes).

Signed-off-by: Kalyani Akula <kalyani.akula@xilinx.com>
Reviewed-by: Appana Durga Kedareswara rao <appana.durga.rao@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodrm: xlnx: mixer: Fix switching to 4K after 1080p
Vishal Sagar [Mon, 1 Oct 2018 18:39:57 +0000 (00:09 +0530)]
drm: xlnx: mixer: Fix switching to 4K after 1080p

This patch fixes the issue of switching to higher resolution like 4K
once the primary layer has been set to a lower resolution like 1080p.
This is done by disabling the need to check frame parameters like width,
height if the plane to be set is the primary plane.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Saurabh Sengar <saurabhs@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: framer's register map update
Vasileios Bimpikas [Tue, 2 Oct 2018 12:55:40 +0000 (13:55 +0100)]
staging: xroeframer: framer's register map update

Updating the register map of the framer (roe_framer_ctrl.h) to match the latest
changes in the hardware

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: adding correct offset to framer_enable sysfs store entry
Vasileios Bimpikas [Tue, 2 Oct 2018 13:14:16 +0000 (14:14 +0100)]
staging: xroeframer: adding correct offset to framer_enable sysfs store entry

Fixed using CFG_MASTER_INT_ENABLE_ADDR instead of CFG_MASTER_INT_ENABLE_OFFSET
STATS_BASE from the passed offset in enable_show() in sysfs_xroe.c.

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: fixing stats device size in ioctl address range check
Vasileios Bimpikas [Tue, 2 Oct 2018 13:03:56 +0000 (14:03 +0100)]
staging: xroeframer: fixing stats device size in ioctl address range check

Fixing using RADIO_CTRL_SIZE instead of STATS_SIZE, as well as not subtracting
STATS_BASE from the passed offset in stats_ioctl() in xroe_framer.c.
As it is now, it can (and will) result in R/W request in unmapped memory.

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agosoc: xilinx: vcu: Update vcu init/reset sequence
Dhaval Shah [Mon, 1 Oct 2018 16:27:49 +0000 (09:27 -0700)]
soc: xilinx: vcu: Update vcu init/reset sequence

Updated vcu init/reset sequence as per design changes.
If VCU reset GPIO is available then do assert and de-assert it before
enabling/disabling gasket isolation.
This GPIO is added because gasket isolation will be removed during startup
that requires access to SLCR register space. Post startup, the ownership of
the register interface lies with logiCORE IP

Signed-off-by: Dhaval Shah <dhaval.shah@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: soc: xilinx: Update VCU bindings for vcu reset pin
Dhaval Shah [Mon, 1 Oct 2018 16:27:48 +0000 (09:27 -0700)]
dt-bindings: soc: xilinx: Update VCU bindings for vcu reset pin

Updated VCU binding for reset GPIO pin as optional property

Signed-off-by: Dhaval Shah <dhaval.shah@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: xcsi2rxss: Add VCX support
Vishal Sagar [Mon, 1 Oct 2018 07:34:11 +0000 (13:04 +0530)]
v4l: xilinx: xcsi2rxss: Add VCX support

Add support for VCX in driver. When VCX is enabled in IP, xlnx,en-vcx
optional dt property must be present in dt node. When VCX is enabled
then maximum number of Virtual channels is 16 otherwise it is 4 as
earlier. This adds a new VCX Frame error bit in the Interrupt Status
Register and Interrupt Enable Register at offset 30. When a frame sync
or level interrupt occurs on virtual channels 4 through 15, this bit is
set and the corresponding error bit is set in a new status register at
offset 0x34. New Image Information registers have been added for these
new virtual channels. The error counts for these are also maintained in
a separate structure vcx_events.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: csi2rxss: Enable VCX support
Vishal Sagar [Mon, 1 Oct 2018 07:34:10 +0000 (13:04 +0530)]
dt-bindings: csi2rxss: Enable VCX support

A new optional dt bool property xlnx,en-vcx is now added to the dt node
of the MIPI CSI2 Rx Subsystem. When this is enabled, the maximum number
of virtual channels is 16 else 4.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomisc: xilinx-sdfec: Update config from hardware
Derek Kiernan [Mon, 1 Oct 2018 14:48:23 +0000 (15:48 +0100)]
misc: xilinx-sdfec: Update config from hardware

Updates the config from sdfec hardware registers for order, bypass,
interrupt configuration and if the device has been started. These
values can be set in the hardware design when the PL initializes the
device and after a sdfec has been reset.
The updated configuration includes a Code Write Protect value which
replaces wr_protect usage.

Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomisc: xilinx-sdfec: Increase number of LDPC codes
Derek Kiernan [Mon, 1 Oct 2018 14:34:18 +0000 (15:34 +0100)]
misc: xilinx-sdfec: Increase number of LDPC codes

Increase the offset ranges for REG0, REG1, REG2 and REG3 increases the
number of LDPC codes that can be stored to 128.

Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomedia: imx274: fix stack-out-of-bounds issue
Subhransu S. Prusty [Fri, 28 Sep 2018 18:56:20 +0000 (00:26 +0530)]
media: imx274: fix stack-out-of-bounds issue

There is random kernel paging request failure with imx274 driver.
Enabling KASAN shows stack-out-of-bounds around the register read code.
Analyzing the code further it is found that the memory allocated is
of type u8 whereas the regmap_read expects unsigned int.
This could possibly be trying to write beyond the memory allocated.
Changed the u8 arrays to unsigned int and don't see the paging request
failure anymore.

Signed-off-by: Subhransu S. Prusty <subhransu.sekhar.prusty@xilinx.com>
Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: UDP sysfs source file commit
Vasileios Bimpikas [Fri, 28 Sep 2018 15:00:21 +0000 (16:00 +0100)]
staging: xroeframer: UDP sysfs source file commit

Committing sysfs_xroe_framer_udp.c, which creates the "udp" sysfs
directory under "xroe" and contains the UDP related entries for
controlling the framer, such as the source and destination ports.

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Fix binding of hclk clock (gem nodes)
Mirela Simonovic [Mon, 17 Sep 2018 12:24:18 +0000 (14:24 +0200)]
arm64: zynqmp: Fix binding of hclk clock (gem nodes)

This patch is required to fix binding of gem interface clocks to
system-level clock IDs that have changed. The gem0 clock IDs are now:
1) Clock ID 45 represents GEM0_TX clock
2) Clock ID 49 represents GEM0_RX clock
3) Clock ID 104 represents GEM0_REF clock

Clock IDs for other gems changed similarly, e.g. for i in {1, 2, 3}
GEMi_TX = GEM0_TX + i, etc. Other clock IDs have not changed.

Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodt-bindings: clock: Fix documentation for Xilinx ZynqMP clock driver
Mirela Simonovic [Mon, 17 Sep 2018 12:24:19 +0000 (14:24 +0200)]
dt-bindings: clock: Fix documentation for Xilinx ZynqMP clock driver

Documentation is fixed to reflect recent changes in clock tree:
- Clock ID definitions have changed for gem-related clock IDs
- New clock IDs are defined to distinguish external (E)MIO sources
  for gem Tx and Rx clocks
- New clock ID is defined for acpu full clock

Signed-off-by: Mirela Simonovic <mirela.simonovic@aggios.com>
Acked-by: Will Wong <willw@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomisc: xilinx-sdfec: Add ADD_LDPC_CODE protection
Derek Kiernan [Fri, 28 Sep 2018 11:06:18 +0000 (12:06 +0100)]
misc: xilinx-sdfec: Add ADD_LDPC_CODE protection

For the ioctl ADD_LDPC_CODE_PARAMS increase the protection to ensure
codes cannot be added when the device has started.

Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomisc: xilinx-sdfec: Remove GET_LDPC_PARAMS ioctl
Derek Kiernan [Fri, 28 Sep 2018 11:06:16 +0000 (12:06 +0100)]
misc: xilinx-sdfec: Remove GET_LDPC_PARAMS ioctl

Unable to fully reconstruct from register values.

Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoof: configfs: Fix memory leak in create overlay
Jesper Larsen [Tue, 25 Sep 2018 11:33:31 +0000 (13:33 +0200)]
of: configfs: Fix memory leak in create overlay

of_fdt_unflatten_tree will allocate memory for the device tree, and
returns the pointer for the memory.

Keep a reference for that memory, and free it during release.

Signed-off-by: Jesper Larsen <jela@gomspace.com>
Tested-by: Nava kishore Manne <nava.manne@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoof: configfs: lock while resolving and applying
Jesper Larsen [Tue, 25 Sep 2018 11:24:23 +0000 (13:24 +0200)]
of: configfs: lock while resolving and applying

Protect resolving phandles and applying the overlay by a mutex.

This ensures that overlays being loaded in parallel are not assigned the
same range of phandles, leading to phandle collisions.

Signed-off-by: Jesper Larsen <jela@gomspace.com>
Tested-by: Nava kishore Manne <nava.manne@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodrm: xlnx: scaler: Fix array out of bound access
Vishal Sagar [Fri, 28 Sep 2018 05:35:07 +0000 (11:05 +0530)]
drm: xlnx: scaler: Fix array out of bound access

This patch fixes random kernel crashes observed due to accessing and
modifying the out of bound address of the vertical scaler coefficients
array.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: vpss-scaler: Fix array out of bound access
Vishal Sagar [Fri, 28 Sep 2018 05:35:06 +0000 (11:05 +0530)]
v4l: xilinx: vpss-scaler: Fix array out of bound access

This patch fixes random kernel crashes caused while accessing and
modifying the vertical scaler coefficients.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodrm: xlnx: pl_disp: Pass interlaced field info to frmbuf DMA
Satish Kumar Nagireddy [Thu, 27 Sep 2018 17:23:33 +0000 (10:23 -0700)]
drm: xlnx: pl_disp: Pass interlaced field info to frmbuf DMA

This patch passes interlaced field information to frmbuf DMA
based on framebuffer flag.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoxilinx: v4l: m2m: Terminate the dma engine before releasing buffers
Devarsh Thakkar [Fri, 28 Sep 2018 02:52:04 +0000 (19:52 -0700)]
xilinx: v4l: m2m: Terminate the dma engine before releasing buffers

- When the process involving mem2mem driver was stopped abruptly,
  buffers were being returned to videobuf while dmaengines were still
  active causing a kernel panic.

- So now we terminate the dmaengines before returning buffers to videobuf.

- This fixes a hang on control-c for below transcode pipeline involving
  mem2mem driver where FBread->FBwrite block is managed by mem2mem driver.

- Use more specific mplane macro V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE for checking
  the source vb2 buffer queue type as it's type is set as mplane during
  queue initialization.

Pipeline:
H264 Decode->FBread (from PL)->FBwrite (to PS)->HEVC Encode->File

Signed-off-by: Devarsh Thakkar <devarsh.thakkar@xilinx.com>
Reviewed-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: clocking-wizard: Update the dt binding documentation
Shubhrajyoti Datta [Mon, 1 Oct 2018 10:58:49 +0000 (16:28 +0530)]
staging: clocking-wizard: Update the dt binding documentation

Add the clock-cells description to the dt bindings.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: apf: Correct Kconfig dependencies for apf driver
Michael Gill [Fri, 28 Sep 2018 17:41:55 +0000 (10:41 -0700)]
staging: apf: Correct Kconfig dependencies for apf driver

The APF driver requires UIO and DMA_SHARED_BUFFER, but did not
have them listed in Kconfig.  This corrects that oversight.

Signed-off-by: Michael Gill <michael.gill@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomisc: xilinx-sdfec: Change OUT i/fs always enabled
Derek Kiernan [Thu, 27 Sep 2018 11:57:05 +0000 (12:57 +0100)]
misc: xilinx-sdfec: Change OUT i/fs always enabled

Change leaves the DOUT AXI always enabled so any data blocks present in
the SD-FEC core will be streamed after a calling STOP_DEV ioctl.

Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomtd: nand: pl35x: Fix gcc warning
Naga Sureshkumar Relli [Thu, 27 Sep 2018 10:41:33 +0000 (16:11 +0530)]
mtd: nand: pl35x: Fix gcc warning

This patch fixes the below gcc warning
drivers/mtd/nand/pl35x_nand.c: In function ‘pl35x_nand_read_page_swecc’:
drivers/mtd/nand/pl35x_nand.c:816:6: warning: variable ‘ret’ set but not
used [-Wunused-but-set-variable]
u32 ret;
^~~

Signed-off-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomisc: xilinx-sdfec: Fix ECC ISR err classification
Mauro DeLuca [Thu, 27 Sep 2018 09:13:08 +0000 (10:13 +0100)]
misc: xilinx-sdfec: Fix ECC ISR err classification

When an ECC multi-bit error occurs a corresponding ECC event is also
raised. This correction ensures that the multi-bit error and
corresponding event are clear together. This ensures that the event is
not interpreted as a single-bit error.

Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoi2c: xiic: Fix the clocking across bind unbind
Shubhrajyoti Datta [Thu, 27 Sep 2018 07:37:58 +0000 (13:07 +0530)]
i2c: xiic: Fix the clocking across bind unbind

The recommendation is that the the set_active should be done
withruntine disabled.
Also fix the remove path for clocking.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: IPv6 sysfs source file commit
Vasileios Bimpikas [Mon, 24 Sep 2018 14:48:58 +0000 (15:48 +0100)]
staging: xroeframer: IPv6 sysfs source file commit

Committing sysfs_xroe_framer_ipv6.c, which creates the "ipv6" sysfs
directory under "xroe" and contains the IPv6 related entries for
controlling the framer, such as source and destination addresses,
traffic class, hop limit etc.

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: Reset S2MM for next channel status update
Maruthi Srinivas Bayyavarapu [Tue, 25 Sep 2018 17:53:34 +0000 (23:23 +0530)]
ASoC: xlnx: Reset S2MM for next channel status update

For the same input stream, after the end of audio capture usecase,
unless S2MM path is reset, next audio capture usecase will not get channel
status update. Added S2MM reset during close callback.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: Add AES channel status parsing
Maruthi Srinivas Bayyavarapu [Tue, 25 Sep 2018 17:53:33 +0000 (23:23 +0530)]
ASoC: xlnx: Add AES channel status parsing

This add AES channel status parsing logic, which provides audio
stream parameter information like channel count, bit depth, sampling
rate. User provided capture parameters will be compared against parsed
parameters to have proper audio capture.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: Move audio interface node names to driver data
Maruthi Srinivas Bayyavarapu [Tue, 25 Sep 2018 17:53:32 +0000 (23:23 +0530)]
ASoC: xlnx: Move audio interface node names to driver data

Audio interface node names are now required in hw_params() callback,
as AES channel status parsing will be done based on node names (hdmi/sdi).
So, moved them accordingly.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: correct the audio formatter masks
Maruthi Srinivas Bayyavarapu [Tue, 25 Sep 2018 17:53:31 +0000 (23:23 +0530)]
ASoC: xlnx: correct the audio formatter masks

Corrected few mask and shift values of audio formatter.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: remove SDI Rx AES parsing
Maruthi Srinivas Bayyavarapu [Tue, 25 Sep 2018 17:53:30 +0000 (23:23 +0530)]
ASoC: xlnx: remove SDI Rx AES parsing

AES parsing logic will be moved to audio formatter driver.
Removed the same from sdi audio driver. Now, instead of waiting
for channel status update (which gives AES bytes for parsing), Rx
startup callback waits for sample rate update status which conveys
valid stream received on SDI extract block.

Signed-off-by: Maruthi Srinivas Bayyavarapu <maruthi.srinivas.bayyavarapu@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomisc: xilinx-sdfec: Include PL init in irq flow
Mauro DeLuca [Wed, 26 Sep 2018 12:56:34 +0000 (13:56 +0100)]
misc: xilinx-sdfec: Include PL init in irq flow

Extend the interrupts monitored by the driver to include ECC PL
initialization interrupts. Update state to PL_RECONFIGURE if a
multi-bit error is detected in this range.
These interrupts are used only when the SD-FEC block is configured and
have coefficients initialized by the Programmable Logic. If an ECC PL
initialization multi-bit error is detected, the PL must be
re-configured to reload the coefficients.

Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx-vpss-scaler: Add check for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:54 +0000 (15:53 +0530)]
v4l: xilinx-vpss-scaler: Add check for max width and height

Patch adds support to get maximum width and height from dt property.
If the parameters are not present then the IP sets the max size of
8192x4320. It then uses this value to clamp width and height instead of
fixed default value while setting format.

It also corrects the minimum width and height parameters.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodocumentation: dt: vpss-scaler: Add support for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:53 +0000 (15:53 +0530)]
documentation: dt: vpss-scaler: Add support for max width and height

Adds two optional parameters xlnx,max-width and xlnx,max-height which
determine the max size of frame the IP can process.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx-vpss-csc: Add check for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:52 +0000 (15:53 +0530)]
v4l: xilinx-vpss-csc: Add check for max width and height

Patch adds support to get maximum width and height from dt property.
If the parameters are not present then the IP sets the max size of
8192x4320. It then uses this value to clamp width and height instead
of fixed default value while setting format.

It also corrects the minimum width and height parameters.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodocumentation: dt: vpss-csc: Add support for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:51 +0000 (15:53 +0530)]
documentation: dt: vpss-csc: Add support for max width and height

Adds two optional parameters xlnx,max-width and xlnx,max-height which
determine the max size of frame the IP can process.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx-gamma: Add check for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:50 +0000 (15:53 +0530)]
v4l: xilinx-gamma: Add check for max width and height

Patch adds support to get maximum width and height from device tree
property. If the parameters are not present then the IP sets the
maximum size of 8192x4320. It then uses this value to clamp width
and height instead of fixed max value while setting format.

It also corrects the minimum width and height parameters.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodocumentation: dt: gamma: Add support for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:49 +0000 (15:53 +0530)]
documentation: dt: gamma: Add support for max width and height

Adds two optional parameters xlnx,max-width and xlnx,max-height which
determine the max size of frame the IP can process.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx-demosaic: Add check for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:48 +0000 (15:53 +0530)]
v4l: xilinx-demosaic: Add check for max width and height

Patch adds support to get maximum width and height from device tree
property. If the parameters are not present then the IP sets the
maximum size of 8192x4320. It then uses this value to clamp width
and height instead of fixed default value while setting format.

It also corrects the minimum width and height parameters.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodocumentation: dt: demosaic: add support for max width and height
Vishal Sagar [Fri, 21 Sep 2018 10:23:47 +0000 (15:53 +0530)]
documentation: dt: demosaic: add support for max width and height

Adds two optional parameters xlnx,max-width and xlnx,max-height which
determine the max size of frame the IP can process.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: xilinx: tpg: Add check for max width and height
Vishal Sagar [Wed, 26 Sep 2018 05:32:17 +0000 (11:02 +0530)]
v4l: xilinx: tpg: Add check for max width and height

Patch adds support to get maximum width and height from dt property. If
parameters are not present then the driver sets the max size to
10328x7760. These values are used to clamp width and height while setting
format.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodocumentation: dt: vtpg: Add support for max width and height
Vishal Sagar [Wed, 26 Sep 2018 05:32:16 +0000 (11:02 +0530)]
documentation: dt: vtpg: Add support for max width and height

Adds two optional parameters xlnx,max-width and xlnx,max-height which
determine the max size of frame the IP can process.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodma: xilinx: Add check for max width and height in Framebuffer Read/Write
Vishal Sagar [Wed, 26 Sep 2018 05:32:15 +0000 (11:02 +0530)]
dma: xilinx: Add check for max width and height in Framebuffer Read/Write

Patch adds support to get maximum width and height from device tree
property. If the parameters are not present then the IP sets the
maximum size of 8192x4320. The driver checks the requested width and
height parameters while allocating a dma descriptor with max supported
values.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodocumentation: dt: frmbuf: Add support for max width and height
Vishal Sagar [Wed, 26 Sep 2018 05:32:14 +0000 (11:02 +0530)]
documentation: dt: frmbuf: Add support for max width and height

Adds two optional parameters xlnx,max-width and xlnx,max-height which
determine the max size of frame the IP can process.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodrm: xlnx: sdi: Fix clearing en_st352_c and use_ds2_3ga drm properties
Vishal Sagar [Wed, 26 Sep 2018 04:58:38 +0000 (10:28 +0530)]
drm: xlnx: sdi: Fix clearing en_st352_c and use_ds2_3ga drm properties

This patch fixes the clearing of the drm properties en_st352_c and
use_ds2_3ga. The bits were not cleared when the properties were set to
false.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agosoc: zynqmp: Add remove method for PM driver
Ravi Patel [Wed, 26 Sep 2018 11:58:20 +0000 (04:58 -0700)]
soc: zynqmp: Add remove method for PM driver

Add remove method for PM platform driver which releases
mailbox channel requested in probe method.

Signed-off-by: Ravi Patel <ravi.patel@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomtd: nand: pl35x: Add ECC checking for ondie nand flash
Andrew Worsley [Thu, 27 Sep 2018 07:06:02 +0000 (12:36 +0530)]
mtd: nand: pl35x: Add ECC checking for ondie nand flash

Check status of the operation and increment the correctable or
uncorrectable error counters which is critical for UBI layer to greatly
improve handling of the errors.  In particular it used to trigger migrating
the data to safely off before scrubbing the failing Erase Blocks. Even
uncorrectable errors may often be handled by UBI if it is in a
non-critical page such as Erase Counter header.

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
Reviewed-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomtd: nand: pl35x: Implement De-select in Chip Select which saves power
Andrew Worsley [Thu, 27 Sep 2018 07:06:01 +0000 (12:36 +0530)]
mtd: nand: pl35x: Implement De-select in Chip Select which saves power

nand_select_chip when called with negative chip no.
means we have finished operations on the chip
so we can deselect it. This allows the chip to
enter a lower power state.

Signed-off-by: Andrew Worsley <amworsley@gmail.com>
Reviewed-by: Naga Sureshkumar Relli <naga.sureshkumar.relli@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodrm: fb: Modify check to ensure correctness of flags
Satish Kumar Nagireddy [Tue, 25 Sep 2018 19:31:29 +0000 (12:31 -0700)]
drm: fb: Modify check to ensure correctness of flags

This patch also modifies the validation of framebuffer flags in DRM
core framework. This is to ensure that application is setting the
right framebuffer flags.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodrm: Add new flags for interlaced alternate fields
Satish Kumar Nagireddy [Tue, 25 Sep 2018 19:31:28 +0000 (12:31 -0700)]
drm: Add new flags for interlaced alternate fields

This patch adds two new framebuffer flags, so that application can
communicate alternate interlaced field information to DRM.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agogpio: xilinx: Add clock handling in remove code
Shubhrajyoti Datta [Thu, 27 Sep 2018 06:28:37 +0000 (11:58 +0530)]
gpio: xilinx: Add clock handling in remove code

Add clock handling in the remove code.
Fixes the below error

xilinx-gpio a0001000.gpio: Unbalanced pm_runtime_enable!
XGpio: /amba_pl@0/gpio@a0001000: registered, base is 480

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agov4l: dma: Use media graph traversal to stream on/off subdevs
Satish Kumar Nagireddy [Thu, 27 Sep 2018 05:32:41 +0000 (22:32 -0700)]
v4l: dma: Use media graph traversal to stream on/off subdevs

This patch uses media framework specific implementation to parse
all the subdevs in the graph in order to stream on/off.

Depth first search algorithm is employed to traverse the nodes
and leaf node of the graph will stream on/off first and so on.

Case 1:
cam -> mipi -> scaler -> dma
The order of stream on is cam, mipi and scaler.
The order of stream off is cam, mipi and scaler.

Case 2:
cam  |      | dma
       mipi
cam2 |      | dma2
The order of stream on is cam, mipi and cam2.

Case 3 (mem2mem):
dma -> scaler -> colconv -> dma2
The order of stream on is colconv, scaler. In mem2mem graph will
traverse same subdevs twice but won't stream-on if it is already
streaming.

Signed-off-by: Satish Kumar Nagireddy <satish.nagireddy.nagireddy@xilinx.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agomedia: v4l: common: Add a function to obtain best size from a list
Sakari Ailus [Fri, 23 Feb 2018 09:50:14 +0000 (04:50 -0500)]
media: v4l: common: Add a function to obtain best size from a list

Add a function (as well as a helper macro) to obtain the best size in a
list of device specific sizes. This helps writing drivers as well as
aligns interface behaviour across drivers.

The struct in which this information is contained in is typically specific
to the driver, therefore the existing function v4l2_find_nearest_format()
does not address the need.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: v4l2-ctrls.c: fix broken auto cluster handling
Hans Verkuil [Fri, 29 Jun 2018 10:12:43 +0000 (06:12 -0400)]
media: v4l2-ctrls.c: fix broken auto cluster handling

When you switch from auto to manual mode for an auto-cluster (e.g.
autogain+gain controls), then the current HW value has to be copied
to the current control value. However, has_changed was never set to
true, so new_to_cur didn't actually copy this value.

Reported-by: Hugues FRUCHET <hugues.fruchet@st.com>
Tested-by: Hugues FRUCHET <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix restore of last mode set
Hugues Fruchet [Tue, 11 Sep 2018 13:48:21 +0000 (09:48 -0400)]
media: ov5640: fix restore of last mode set

Mode setting depends on last mode set, in particular
because of exposure calculation when downscale mode
change between subsampling and scaling.
At stream on the last mode was wrongly set to current mode,
so no change was detected and exposure calculation
was not made, fix this.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix auto controls values when switching to manual mode
Hugues Fruchet [Tue, 11 Sep 2018 13:48:20 +0000 (09:48 -0400)]
media: ov5640: fix auto controls values when switching to manual mode

When switching from auto to manual mode, V4L2 core is calling
g_volatile_ctrl() in manual mode in order to get the manual initial value.
Remove the manual mode check/return to not break this behaviour.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix wrong binning value in exposure calculation
Hugues Fruchet [Tue, 11 Sep 2018 13:48:19 +0000 (09:48 -0400)]
media: ov5640: fix wrong binning value in exposure calculation

ov5640_set_mode_exposure_calc() is checking binning value but
binning value read is buggy, fix this.
Rename ov5640_binning_on() to ov5640_get_binning() as per other
similar functions.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix auto gain & exposure when changing mode
Hugues Fruchet [Tue, 11 Sep 2018 13:48:18 +0000 (09:48 -0400)]
media: ov5640: fix auto gain & exposure when changing mode

Ensure that auto gain and auto exposure are well restored
when changing mode.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix exposure regression
Hugues Fruchet [Tue, 11 Sep 2018 13:48:17 +0000 (09:48 -0400)]
media: ov5640: fix exposure regression

Symptom was black image when capturing HD or 5Mp picture
due to manual exposure set to 1 while it was intended to
set autoexposure to "manual", fix this.

Fixes: bf4a4b518c20 ("media: ov5640: Don't force the auto exposure state at start time").
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Fix timings setup code
Jacopo Mondi [Wed, 18 Jul 2018 10:06:23 +0000 (06:06 -0400)]
media: ov5640: Fix timings setup code

As of: commit 476dec012f4c ("media: ov5640: Add horizontal and vertical
totals") the timings parameters gets programmed separately from the
static register values array.

When changing capture mode, the vertical and horizontal totals gets
inspected by the set_mode_exposure_calc() functions, and only later
programmed with the new values. This means exposure, light banding
filter and shutter gain are calculated using the previous timings, and
are thus not correct.

Fix this by programming timings right after the static register value
table has been sent to the sensor in the ov5640_load_regs() function.

Fixes: 476dec012f4c ("media: ov5640: Add horizontal and vertical totals")
Tested-by: Steve Longerbeam <slongerbeam@gmail.com> # i.MX6q SabreSD, CSI-2
Tested-by: Loic Poulain <loic.poulain@linaro.org> # Dragonboard-410c, CSI-2
Signed-off-by: Samuel Bobrowicz <sam@elite-embedded.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Re-work MIPI startup sequence
Jacopo Mondi [Fri, 6 Jul 2018 09:51:52 +0000 (05:51 -0400)]
media: ov5640: Re-work MIPI startup sequence

Rework the MIPI interface startup sequence with the following changes:

- Remove MIPI bus initialization from the initial settings blob
- At set_power(1) time power up MIPI Tx/Rx and set data and clock lanes in
  LP11 during 'sleep' and 'idle' with MIPI clock in non-continuous mode.
- At s_stream time enable/disable the MIPI interface output.
- Restore default settings at set_power(0) time.

Before this commit the sensor MIPI interface was initialized with settings
that require a start/stop sequence at power-up time in order to force lanes
into LP11 state, as they were initialized in LP00 when in 'sleep mode',
which is assumed to be the sensor manual definition for the D-PHY defined
stop mode.

The stream start/stop was performed by enabling disabling clock gating,
and had the side effect to change the lanes sleep mode configuration when
stream was stopped.

Clock gating/ungating:
-       ret = ov5640_mod_reg(sensor, OV5640_REG_MIPI_CTRL00, BIT(5),
-                            on ? 0 : BIT(5));
-       if (ret)

Set lanes in LP11 when in 'sleep mode':
-       ret = ov5640_write_reg(sensor, OV5640_REG_PAD_OUTPUT00,
-                              on ? 0x00 : 0x70);

This commit fixes an issue reported by Jagan Teki on i.MX6 platforms that
prevents the host interface from powering up correctly:
https://lkml.org/lkml/2018/6/1/38

It also improves MIPI capture operations stability on my testing platform
where MIPI capture often failed and returned all-purple frames.

Fixes: f22996db44e2 ("media: ov5640: add support of DVP parallel interface")
Tested-by: Steve Longerbeam <slongerbeam@gmail.com> (i.MX6q SabreSD, CSI-2)
Tested-by: Loic Poulain <loic.poulain@linaro.org> (Dragonboard-410c, CSI-2)
Reported-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix mode change regression
Hugues Fruchet [Thu, 16 Aug 2018 09:46:53 +0000 (05:46 -0400)]
media: ov5640: fix mode change regression

fixes: 6949d864776e ("media: ov5640: do not change mode if format or frame interval is unchanged").

Symptom was fuzzy image because of JPEG default format
not being changed according to new format selected, fix this.
Init sequence initialises format to YUV422 UYVY but
sensor->fmt initial value was set to JPEG, fix this.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: do not change mode if format or frame interval is unchanged
Hugues Fruchet [Wed, 4 Jul 2018 13:04:38 +0000 (09:04 -0400)]
media: ov5640: do not change mode if format or frame interval is unchanged

Save load of mode registers array when V4L2 client sets a format or a
frame interval which selects the same mode than the current one.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix frame interval enumeration
Hugues Fruchet [Wed, 20 Jun 2018 08:40:57 +0000 (04:40 -0400)]
media: ov5640: fix frame interval enumeration

Driver must reject frame interval enumeration of unsupported resolution.
This was detected by v4l2-compliance format ioctl test:
v4l2-compliance Format ioctls:
    info: found 2 frameintervals for pixel format 4745504a and size 176x144
  fail: v4l2-test-formats.cpp(123):
                           found frame intervals for invalid size 177x144
    test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: adjust xclk_max
Philipp Puschmann [Wed, 6 Jun 2018 09:11:38 +0000 (05:11 -0400)]
media: ov5640: adjust xclk_max

According to ov5640 datasheet xvclk is allowed to be between 6 and 54 MHz.
I run a successful test with 27 MHz.

Signed-off-by: Philipp Puschmann <pp@emlix.com>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: add support of module orientation
Hugues Fruchet [Mon, 18 Jun 2018 10:29:19 +0000 (06:29 -0400)]
media: ov5640: add support of module orientation

Add support of module being physically mounted upside down.
In this case, mirror and flip are enabled to fix captured images
orientation.

[Sakari Ailus: Use dev_fwnode() instead of accessing device's of_node]

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: add HFLIP/VFLIP controls support
Hugues Fruchet [Mon, 18 Jun 2018 10:29:17 +0000 (06:29 -0400)]
media: ov5640: add HFLIP/VFLIP controls support

Add HFLIP/VFLIP controls support by setting registers REG21/REG20.
Useless values in hardcoded mode sequences are removed and
remaining binning values are now set after mode sequence being set.
Note that due to BSI (Back Side Illuminated) technology, image capture
is physically mirrored, mirror logic is so inversed in REG21 register
to cancel this effect.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Program the visible resolution
Maxime Ripard [Mon, 16 Apr 2018 12:36:56 +0000 (08:36 -0400)]
media: ov5640: Program the visible resolution

The active frame size is set in the initialization arrays, but the value
itself is also available in the struct ov5640_mode_info.

Let's move these values out of the big bytes arrays, and program it with
the value of the mode that we are given.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Add horizontal and vertical totals
Maxime Ripard [Mon, 16 Apr 2018 12:36:55 +0000 (08:36 -0400)]
media: ov5640: Add horizontal and vertical totals

All the initialization arrays are changing the horizontal and vertical
totals for some value.

In order to clean up the driver, and since we're going to need that value
later on, let's introduce in the ov5640_mode_info structure the horizontal
and vertical total sizes, and move these out of the bytes array.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Change horizontal and vertical resolutions name
Maxime Ripard [Mon, 16 Apr 2018 12:36:54 +0000 (08:36 -0400)]
media: ov5640: Change horizontal and vertical resolutions name

The current width and height parameters in the struct ov5640_mode_info are
actually the active horizontal and vertical resolutions.

Since we're going to add a few other parameters, let's pick a better, more
precise name for these values.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Init properly the SCLK dividers
Maxime Ripard [Mon, 16 Apr 2018 12:36:53 +0000 (08:36 -0400)]
media: ov5640: Init properly the SCLK dividers

The SCLK and SCLK2X dividers are fixed in stone in the initialization
array. Let's make explicit what we're doing and move that away from the
huge array to the initialization code.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Don't force the auto exposure state at start time
Maxime Ripard [Mon, 16 Apr 2018 12:36:52 +0000 (08:36 -0400)]
media: ov5640: Don't force the auto exposure state at start time

The sensor needs to have the auto exposure stopped while changing mode.
However, when the new mode is set, the driver will force the auto exposure
on, disregarding whether the control has been changed or not.

Bypass the controls code entirely to do that, and only use the control
value cached when restoring the auto exposure mode.

Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: Add light frequency control
Mylène Josserand [Mon, 16 Apr 2018 12:36:51 +0000 (08:36 -0400)]
media: ov5640: Add light frequency control

Add the light frequency control to be able to set the frequency
to manual (50Hz or 60Hz) or auto.

[Sakari Ailus: Rename "ctl" as "ctrl" as agreed.]
[mchehab+samsung@kernel.org: fixed two coding style warnings]

Signed-off-by: Mylène Josserand <mylene.josserand@bootlin.com>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>