]> rtime.felk.cvut.cz Git - zynq/linux.git/log
zynq/linux.git
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>
5 years agomedia: ov5640: Use dev_fwnode() to obtain device's fwnode
Sakari Ailus [Tue, 24 Apr 2018 10:25:47 +0000 (06:25 -0400)]
media: ov5640: Use dev_fwnode() to obtain device's fwnode

Use dev_fwnode() on the device instead of getting an fwnode handle of the
device's OF node. The result is the same on OF-based systems and looks
better, too.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Maxime Ripard <maxime.ripard@bootlin.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 missing output pixel format setting
Akinobu Mita [Sun, 11 Mar 2018 15:34:41 +0000 (11:34 -0400)]
media: ov5640: add missing output pixel format setting

The output pixel format changed by set_fmt() pad operation is not
correctly applied.  It is intended to be restored by calling
ov5640_set_framefmt() when the video stream is started.

However, when the device is powered on by s_power subdev operation before
the video stream is started, the current output mode setting is restored
by ov5640_restore_mode() that also clears pending_mode_change flag in
ov5640_set_mode().  So ov5640_set_framefmt() isn't called as intended and
the output pixel format is not restored.

This change adds the missing output pixel format setting in the
ov5640_restore_mode() that is called when the device is powered on.

Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Hugues Fruchet <hugues.fruchet@st.com>
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix get_/set_fmt colorspace related fields
Hugues Fruchet [Tue, 6 Mar 2018 17:04:39 +0000 (12:04 -0500)]
media: ov5640: fix get_/set_fmt colorspace related fields

Fix set of missing colorspace related fields in get_/set_fmt.
Detected by v4l2-compliance tool.

[Sakari Ailus: Rearrange fmt declaration in ov5640_probe()]

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix framerate update
Hugues Fruchet [Thu, 8 Feb 2018 12:22:14 +0000 (07:22 -0500)]
media: ov5640: fix framerate update

After a framerate update through s_frame_interval(), the new
framerate was not taken into account when streaming,
but was taken into account on next session.
This was due to sensor->current_mode not updated accordingly to new
framerate setting in ov5640_s_frame_interval().

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix virtual_channel parameter permissions
Hugues Fruchet [Tue, 6 Feb 2018 13:24:09 +0000 (08:24 -0500)]
media: ov5640: fix virtual_channel parameter permissions

Fix module_param(virtual_channel) permissions.
This problem was detected by checkpatch:
$ scripts/checkpatch.pl -f drivers/media/i2c/ov5640.c
ERROR: Use 4 digit octal (0777) not decimal permissions
+module_param(virtual_channel, int, 0);

Also add an error trace in case of virtual_channel not in
the valid range of values.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: various typo & style fixes
Hugues Fruchet [Thu, 1 Feb 2018 08:44:06 +0000 (03:44 -0500)]
media: ov5640: various typo & style fixes

Various typo & style fixes either detected by code
review or checkpatch.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: add error trace in case of i2c read failure
Hugues Fruchet [Wed, 31 Jan 2018 12:46:17 +0000 (07:46 -0500)]
media: ov5640: add error trace in case of i2c read failure

Add an error trace in ov5640_read_reg() in case of i2c_transfer()
failure.
Uniformize error traces using dev_err instead v4l2_err.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: add JPEG support
Hugues Fruchet [Wed, 31 Jan 2018 09:08:10 +0000 (04:08 -0500)]
media: ov5640: add JPEG support

Add YUV422 encoded JPEG support.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: fix spurious streamon failures
Hugues Fruchet [Mon, 22 Jan 2018 10:06:40 +0000 (05:06 -0500)]
media: ov5640: fix spurious streamon failures

Time to time, stream on is failing with a strange positive error.
Error code is returned erroneously by ov5640_set_ctrl_exposure()
due to ov5640_get_vts() return value wrongly treated as error.
Fix this by forcing ret to 0 after ov5640_get_vts() success call,
in order that ret is set to success for rest of code sequence.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: add support of RGB565 and YUYV formats
Hugues Fruchet [Wed, 3 Jan 2018 09:57:32 +0000 (04:57 -0500)]
media: ov5640: add support of RGB565 and YUYV formats

Add RGB565 (LE & BE) and YUV422 YUYV format in addition
to existing YUV422 UYVY format.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: add support of DVP parallel interface
Hugues Fruchet [Wed, 3 Jan 2018 09:57:31 +0000 (04:57 -0500)]
media: ov5640: add support of DVP parallel interface

Add support of DVP parallel mode in addition of
existing MIPI CSI mode. The choice between two modes
and configuration is made through device tree.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: check chip id
Hugues Fruchet [Wed, 3 Jan 2018 09:57:29 +0000 (04:57 -0500)]
media: ov5640: check chip id

Verify that chip identifier is correct when probing.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: switch to gpiod_set_value_cansleep()
Hugues Fruchet [Wed, 3 Jan 2018 09:57:28 +0000 (04:57 -0500)]
media: ov5640: switch to gpiod_set_value_cansleep()

Switch gpiod_set_value to gpiod_set_value_cansleep to avoid
warnings when powering sensor.

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@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agomedia: ov5640: don't clear V4L2_SUBDEV_FL_IS_I2C
Akinobu Mita [Thu, 19 Oct 2017 16:31:23 +0000 (12:31 -0400)]
media: ov5640: don't clear V4L2_SUBDEV_FL_IS_I2C

The v4l2_i2c_subdev_init() sets V4L2_SUBDEV_FL_IS_I2C flag in the
subdev->flags.  But this driver overwrites subdev->flags immediately after
calling v4l2_i2c_subdev_init().  So V4L2_SUBDEV_FL_IS_I2C is not set after
all.

This stops breaking subdev->flags and preserves V4L2_SUBDEV_FL_IS_I2C.

Side note: According to the comment in v4l2_device_unregister(), this is
problematic only if the device is platform bus device.  Device tree or
ACPI based devices are not affected.

Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sam Bobrowicz <sam@elite-embedded.com>
5 years agoASoC: xlnx: add new supported formats
Maruthi Srinivas Bayyavarapu [Wed, 26 Sep 2018 13:29:59 +0000 (18:59 +0530)]
ASoC: xlnx: add new supported formats

Update audio formatter driver to new supported audio formats

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 agoarm64: dts: Use mmc@ instead sdhci@
Michal Simek [Wed, 26 Sep 2018 11:24:20 +0000 (13:24 +0200)]
arm64: dts: Use mmc@ instead sdhci@

mmc name is recommended based on devicetree specification.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM: dts: Use mmc@ instead sdhci@
Michal Simek [Wed, 26 Sep 2018 11:36:16 +0000 (13:36 +0200)]
ARM: dts: Use mmc@ instead sdhci@

mmc name is recommended based on devicetree specification.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agosoc: zynqmp: Ack suspend callback request
Ravi Patel [Wed, 12 Sep 2018 10:16:56 +0000 (03:16 -0700)]
soc: zynqmp: Ack suspend callback request

The PM driver receives the INIT_SUSPEND_CB request from
PMU through mailbox driver. However mailbox driver expects
some response from PM driver to ack the incoming request
and enable the IRQ.

Existing PM driver doesn't send any response to mailbox driver
and hence all further messages from PMU will not be received as
interrupt status will not be cleared without ack.

This patch fixes same by sending NULL message to mailbox driver.

Signed-off-by: Ravi Patel <ravi.patel@xilinx.com>
Acked-by: Wendy Liang <wendy.liang@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agodma: xilinx: Move XILINX_FRMBUF out of XILINX_DMA_ENGINES
Vishal Sagar [Sat, 22 Sep 2018 05:45:39 +0000 (11:15 +0530)]
dma: xilinx: Move XILINX_FRMBUF out of XILINX_DMA_ENGINES

This patch removes the warning of unmet direct dependencies of
XILINX_FRMBUF generated when selecting VIDEO_XILINX. This is done by
moving XILINX_FRMBUF out of XILINX_DMA_ENGINES.

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: mixer: Fix linking failure for ARCH arm
Vishal Sagar [Fri, 21 Sep 2018 05:02:00 +0000 (10:32 +0530)]
drm: xlnx: mixer: Fix linking failure for ARCH arm

The kernel fails to build on 32-bit arm architecture when Video Mixer
driver is enabled due to unsupported modulo operations in 32 bit mode.
The error shown is "undefined reference to `__aeabi_uldivmod'".
This is fixed by changing the data type of luma and chroma address to
dma_addr_t instead of u64.

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 agomisc: xilinx-sdfec: Add table size function
Derek Kiernan [Tue, 25 Sep 2018 13:19:43 +0000 (14:19 +0100)]
misc: xilinx-sdfec: Add table size function

Added macro xsdfec_calculate_shared_ldpc_table_entry_size to allow users
manage LDPC shared tables, where the macro calculates the size of the
tables used for the specified LDPC code.

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 agoserial: uartps: Fix missing unlock on error in cdns_get_id()
Wei Yongjun [Tue, 25 Sep 2018 14:23:21 +0000 (14:23 +0000)]
serial: uartps: Fix missing unlock on error in cdns_get_id()

Add the missing unlock before return from function cdns_get_id()
in the error handling case.

Fixes: ae1cca3fa347 ("serial: uartps: Change uart ID port allocation")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoserial: uartps: Change uart ID port allocation
Michal Simek [Thu, 20 Sep 2018 11:41:53 +0000 (13:41 +0200)]
serial: uartps: Change uart ID port allocation

For IPs which have alias algorightm all the time using that alias and
minor number. It means serial20 alias ends up as ttyPS20.

If alias is not setup for probed IP instance the first unused position is
used but that needs to be checked if it is really empty because another
instance doesn't need to be probed at that time. of_alias_get_alias_list()
fills alias bitmap which exactly shows which ID is free.
If alias pointing to different not compatible IP, it is free to use.

cdns_get_id() call is placed below structure allocation to simplify
error path.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoof: base: Introduce of_alias_get_alias_list() to check alias IDs
Michal Simek [Thu, 20 Sep 2018 11:41:52 +0000 (13:41 +0200)]
of: base: Introduce of_alias_get_alias_list() to check alias IDs

The function travels the lookup table to record alias ids for the given
device match structures and alias stem.
This function will be used by serial drivers to check if requested alias
is allocated or free to use.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Move Port ID to device data structure
Michal Simek [Mon, 3 Sep 2018 13:10:58 +0000 (15:10 +0200)]
serial: uartps: Move Port ID to device data structure

Record port ID in device data structure to be have it connected to
certain instance.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Register own uart console and driver structures
Michal Simek [Mon, 3 Sep 2018 13:10:57 +0000 (15:10 +0200)]
serial: uartps: Register own uart console and driver structures

Every instance is registering own struct console and 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 ttyPSX 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.

Unfortunately this driver is setting up major number to 0 for using
dynamic assignment and kernel is allocating different major numbers for
every instance instead of using the same major and different minor
number.

~# ls -la /dev/ttyPS*
crw-------    1 root     root      252,   0 Jan  1 03:36 /dev/ttyPS0
crw--w----    1 root     root      253,   1 Jan  1 00:00 /dev/ttyPS1

When major number is not 0. For example 252 then major/minor
combinations are in expected form

~# ls -la /dev/ttyPS*
crw-------    1 root     root      252,   0 Jan  1 04:04 /dev/ttyPS0
crw--w----    1 root     root      252,   1 Jan  1 00:00 /dev/ttyPS1

Driver is not freeing struct cdns_uart_console in case that instance is
not used as console. The reason is that console is incorrectly unregistred
and "console [0] disabled" message will be shown.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Change logic how console_port is setup
Michal Simek [Mon, 3 Sep 2018 13:10:56 +0000 (15:10 +0200)]
serial: uartps: 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 cdns_uart_console() structures
that's why code can't use id for console_port assignment.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Fill struct uart_driver in probe()
Michal Simek [Mon, 3 Sep 2018 13:10:55 +0000 (15:10 +0200)]
serial: uartps: Fill struct uart_driver in probe()

This is preparation step for dynamic port allocation without
CDNS_UART_NR_PORTS macro. Fill the structure only once at probe.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Move register to probe based on run time detection
Michal Simek [Mon, 3 Sep 2018 13:10:54 +0000 (15:10 +0200)]
serial: uartps: Move register to probe based on run time detection

Register uart driver in probe to be able to register one device with
unique major/minor separately. Also calculate number of instances of
this driver to be able to call uart_unregister_driver() when there is no
instance.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Fixed conflict with "tty: xilinx_uartps: Correct return value in probe"
(sha1: ea9d9d49bdda5e15f6e34bb53be8311f75ab9ca3) ]

5 years agoserial: uartps: Move alias reading higher in probe()
Michal Simek [Mon, 3 Sep 2018 13:10:53 +0000 (15:10 +0200)]
serial: uartps: Move alias reading higher in probe()

This cosmetic change is done only for having next patch much easier to
read. Moving id setup higher in probe is not affecting any usage of this
driver and it also simplify error path.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Do not use static struct uart_driver out of probe()
Michal Simek [Mon, 3 Sep 2018 13:10:52 +0000 (15:10 +0200)]
serial: uartps: Do not use static struct uart_driver out of probe()

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

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Do not initialize field to zero again
Michal Simek [Mon, 3 Sep 2018 13:10:50 +0000 (15:10 +0200)]
serial: uartps: Do not initialize field to zero again

Writing zero and NULLs to already initialized fields is not needed.
Remove this additional writes.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: xuartps: remove unnecessary register write
Helmut Grohne [Mon, 4 Jun 2018 10:22:19 +0000 (12:22 +0200)]
serial: xuartps: remove unnecessary register write

This writel writes the exact same value as the previous writel and is
thus unnecessary. It accidentally became unnecessary in e3538c37ee38
("tty: xuartps: Beautify read-modify writes"), but the new behaviour is
now expected.

Link: https://www.spinics.net/lists/linux-serial/msg23168.html
Signed-off-by: Helmut Grohne <h.grohne@intenta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: xuartps: reduce hardware TX race condition
Helmut Grohne [Mon, 4 Jun 2018 10:22:11 +0000 (12:22 +0200)]
serial: xuartps: reduce hardware TX race condition

After sending data to the uart, the driver was waiting until the TX
FIFO was empty (for every single char written). After that, TX was
disabled by writing the original TX state to the status register. At
that time however, the state machine could still be shifting
characters. Not waiting can result in strange hardware states,
especially when coupled with calls to cdns_uart_set_termios, whose
symptom generally is garbage characters being received from uart or a
hang.

According to UG585, the TACTIVE bit of the channel status register
indicates the shifter operation and we should be waiting for that bit
to clear.

Sending characters does not require the TX FIFO to be empty, but merely
to not be full. So cdns_uart_console_putchar is updated accordingly.

During tests with an instrumented kernel and an oscilloscope, we could
determine that the chance of a race is reduced by this patch. It is not
removed entirely. On the oscilloscope, one can see that disabling the
transmitter early can result in the transmission hanging in the middle
of a character for a tiny duration. This hiccup is enough to
desynchronize with a remote device for a sequence of characters until a
data bit doesn't match the start or stop bits anymore.

Link: https://www.spinics.net/lists/linux-serial/msg23156.html
Link: https://www.spinics.net/lists/linux-serial/msg26139.html
Signed-off-by: Helmut Grohne <h.grohne@intenta.de>
Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: xuartps: fix typo in cdns_uart_startup
Helmut Grohne [Mon, 4 Jun 2018 10:22:05 +0000 (12:22 +0200)]
serial: xuartps: fix typo in cdns_uart_startup

The bit mask changes in commit 6e14f7c1f2c2 ("tty: xuartps: Improve
startup function") doesn't do what the commit message advertises. The
original behaviour was clearing the RX_DIS bit, but due to missing ~,
that bit is now the only bit kept.

Currently, the regression is harmless, because the previous write to the
control register sets it to TXRST | RXRST. Thus the RX_DIS bit is
previously cleared. The *RST bits are cleared by the hardware, so this
commit does not currently change behaviour, but makes future changes
less risky.

Link: https://www.spinics.net/lists/linux-serial/msg23157.html
Signed-off-by: Helmut Grohne <h.grohne@intenta.de>
Fixes: 6e14f7c1f2c2 ("tty: xuartps: Improve startup function")
Reviewed-by: Sören Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Remove static port array
Michal Simek [Mon, 23 Apr 2018 09:51:03 +0000 (11:51 +0200)]
serial: uartps: Remove static port array

Allocate uart port structure dynamically.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Move cnds_uart_get_port to probe
Michal Simek [Mon, 23 Apr 2018 09:51:02 +0000 (11:51 +0200)]
serial: uartps: Move cnds_uart_get_port to probe

c&p this function to probe as preparation for removing
cdns_uart_port[] static array.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Use dynamic array for console port
Michal Simek [Mon, 23 Apr 2018 09:51:01 +0000 (11:51 +0200)]
serial: uartps: Use dynamic array for console port

Driver console functions are using pointer to static array with fixed
size. There can be only one serial console at the time which is found
by register_console(). register_console() is filling cons->index to
port->line value.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: Remove console_initcall from the driver
Michal Simek [Mon, 23 Apr 2018 09:51:00 +0000 (11:51 +0200)]
serial: uartps: Remove console_initcall from the driver

register_console() is called from
uart_add_one_port()->uart_configure_port()
that's why register_console() is called twice.

This patch remove console_initcall to call register_console() only from
one location.

Also based on my tests cdns_uart_console_setup() is not called
from the first register_console() call.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agoserial: uartps: console_setup() can't be placed to init section
Michal Simek [Mon, 3 Sep 2018 13:10:49 +0000 (15:10 +0200)]
serial: uartps: console_setup() can't be placed to init section

When console device is rebinded, console_setup() is called again.
But marking it as __init means that function will be clear after boot is
complete. If console device is binded again console_setup() is not found
and error "Unable to handle kernel paging request at virtual address"
is reported.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5 years agostaging: xroeframer: IPv4 sysfs source file commit
Vasileios Bimpikas [Wed, 19 Sep 2018 13:45:02 +0000 (14:45 +0100)]
staging: xroeframer: IPv4 sysfs source file commit

Committing sysfs_xroe_framer_ipv4.c, which creates the "ipv4" sysfs
directory under "xroe" and contains the IPv4 related entries for
controlling the framer, such as source and destination addresses, DSCP,
IHL etc.

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoASoC: xlnx: Use graph API instead of phandle
Maruthi Srinivas Bayyavarapu [Thu, 20 Sep 2018 08:31:09 +0000 (14:01 +0530)]
ASoC: xlnx: Use graph API instead of phandle

SDI embed node now uses graph endpoint binding instead of phandle to
SDI Tx video node. Changed corresponding API to get the video node.

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 agodt-bindings: ASoC: xlnx,v-uhdsdi-audio.txt: Replace phandle with endpoint
Maruthi Srinivas Bayyavarapu [Thu, 20 Sep 2018 08:31:08 +0000 (14:01 +0530)]
dt-bindings: ASoC: xlnx,v-uhdsdi-audio.txt: Replace phandle with endpoint

SDI embed node contained a phandle to SDI video Tx node. This is now
replaced with remote endpoint graph bindings.

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 agodrm: xlnx: sdi: Add support for DS2 payload in 3GA mode
Vishal Sagar [Thu, 20 Sep 2018 05:44:49 +0000 (11:14 +0530)]
drm: xlnx: sdi: Add support for DS2 payload in 3GA mode

In 3GA mode, the data stream 3 (DS3) payload was being sent on the DS2
(chroma) stream. This is recitified in the IP by adding a bit which
allows DS2 payload to be sent instead of DS3 payload.
To enable this a new dt property "use_ds2_3ga" is added. This property
is created only when xlxn,tx-insert-c-str-st352 is present in dt. The
bit is set only when the dt property is present, "en_st352_c" drm
property is set and new "use_ds2_3ga" drm property is set.

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: Add ST352 payload insertion in Chroma stream
Vishal Sagar [Wed, 19 Sep 2018 04:49:27 +0000 (10:19 +0530)]
drm: xlnx: sdi: Add ST352 payload insertion in Chroma stream

Adds support for inserting the ST352 payload in the Chroma stream. A new
dt optional parameter xlnx,tx-insert-c-str-st352 is parsed. A new
boolean property "en_st352_c" is added when the dt property is present.
When "en_st352_c" property is true and dt parameter is present, the
ST352 payloads are added to the Chroma stream payload registers and
insertion enable bit is set in the Module Control register.

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 agodt-bindings: display: xlnx: Add ST352 payload insertion in Chroma stream
Vishal Sagar [Wed, 19 Sep 2018 04:49:26 +0000 (10:19 +0530)]
dt-bindings: display: xlnx: Add ST352 payload insertion in Chroma stream

Added optional property which when present says that the IP supports
ST352 payload insertion in the chroma stream.

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: Enable support for ancillary data
Vishal Sagar [Tue, 18 Sep 2018 17:45:45 +0000 (23:15 +0530)]
drm: xlnx: sdi: Enable support for ancillary data

The SDI Tx has 2 ports one for video stream and another for adding
ancillary data like audio to the SDI stream. This patch adds support for
adding ancillary data to SDI stream by enabling the ancillary bit when 2
ports are present for SDI Tx.

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 agodt-bindings: display: xlnx: Add support for ancillary port
Vishal Sagar [Tue, 18 Sep 2018 17:45:44 +0000 (23:15 +0530)]
dt-bindings: display: xlnx: Add support for ancillary port

Add support for ancillary port to be connected. This port is currently
used for adding audio to SDI Tx. Based on this extra port, the SDI Tx IP
may set the "Use Ancillary Data" bit.

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 agonet: ethernet: TSN: Change PTP timer interrupt name
Ravali Potineni [Mon, 17 Sep 2018 12:55:22 +0000 (18:25 +0530)]
net: ethernet: TSN: Change PTP timer interrupt name

Corrected PTP timer interrupt name as in device-tree.

Signed-off-by: Priyadarshini Babu <priyadarshini.babu@xilinx.com>
Signed-off-by: Ravali Potineni <ravali.potineni@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: net: TSN: Bind TSN IP with new compatible property
Ravali Potineni [Mon, 17 Sep 2018 12:55:21 +0000 (18:25 +0530)]
dt-bindings: net: TSN: Bind TSN IP with new compatible property

Binded TSN IP with new compatible xlnx,tsn-endpoint-ethernet-mac-1.0 string
as per system design. Added TSN node for tsn-emac instance.

Signed-off-by: Priyadarshini Babu <priyadarshini.babu@xilinx.com>
Signed-off-by: Ravali Potineni <ravali.potineni@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: net: TSN: Add TSN device-tree properties in ep and switch
Ravali Potineni [Mon, 17 Sep 2018 12:55:20 +0000 (18:25 +0530)]
dt-bindings: net: TSN: Add TSN device-tree properties in ep and switch

Added new properties in endpoint and switch instances.

Signed-off-by: Priyadarshini Babu <priyadarshini.babu@xilinx.com>
Signed-off-by: Ravali Potineni <ravali.potineni@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agonet: ethernet: TSN: Remove XILINX_AXI_EMAC_HWTSTAMP config dependency from XILINX_TSN_PTP
Ravali Potineni [Mon, 17 Sep 2018 12:55:19 +0000 (18:25 +0530)]
net: ethernet: TSN: Remove XILINX_AXI_EMAC_HWTSTAMP config dependency from XILINX_TSN_PTP

Removed XILINX_AXI_EMAC_HWTSTAMP config dependency from XILINX_TSN_PTP,
XILINX_AXI_EMAC_HWTSTAMP config is not required for TSN PTP.

Signed-off-by: Priyadarshini Babu <priyadarshini.babu@xilinx.com>
Signed-off-by: Ravali Potineni <ravali.potineni@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agonet: ethernet: TSN: Add PTP onestep mode support
Ravali Potineni [Mon, 17 Sep 2018 12:55:18 +0000 (18:25 +0530)]
net: ethernet: TSN: Add PTP onestep mode support

Added 802.1AS PTP onestep mode support in TSN

Signed-off-by: Priyadarshini Babu <priyadarshini.babu@xilinx.com>
Signed-off-by: Ravali Potineni <ravali.potineni@xilinx.com>
Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Enable Xilinx V4L2 mem2mem driver driver in defconfig
Satish Kumar Nagireddy [Tue, 18 Sep 2018 02:01:47 +0000 (19:01 -0700)]
arm64: zynqmp: Enable Xilinx V4L2 mem2mem driver driver in defconfig

This patch enables Xilinx V4L2 mem2mem driver.

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: mem2mem: Initial version of driver
Satish Kumar Nagireddy [Tue, 18 Sep 2018 02:01:46 +0000 (19:01 -0700)]
xilinx: v4l: mem2mem: Initial version of driver

This patch adds the initial version of Xilinx V4L2 mem2mem driver. The Data
copy from one memory to the other is achieved by using two DMA transfers,
MEM2DEV and DEV2MEM in order.

Memory -> DMA_1-----DMA_2 -> Memory

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 agodt: bindings: media: xilinx: Documentation for mem2mem driver
Satish Kumar Nagireddy [Tue, 18 Sep 2018 02:01:45 +0000 (19:01 -0700)]
dt: bindings: media: xilinx: Documentation for mem2mem driver

Add devicetree bindings documentation for the Xilinx Video IP mem2mem
pipeline driver.

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 agonet: xilinx: Sync kconfig description
Radhey Shyam Pandey [Mon, 17 Sep 2018 16:43:14 +0000 (22:13 +0530)]
net: xilinx: Sync kconfig description

This patch sync tristate and help description with the current implementation.
It also fixes a few typos.

Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoARM64: zynqmp: config: Enable si5324 clock driver
Venkateshwar Rao Gannavarapu [Mon, 17 Sep 2018 16:54:21 +0000 (22:24 +0530)]
ARM64: zynqmp: config: Enable si5324 clock driver

This patch enables the silicon labs si5324/si5319/si5328
clock driver.

Signed-off-by: Venkateshwar Rao Gannavarapu <venkateshwar.rao.gannavarapu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agostaging: xroeframer: main sysfs source file commit
Vasileios Bimpikas [Mon, 17 Sep 2018 12:46:19 +0000 (13:46 +0100)]
staging: xroeframer: main sysfs source file commit

Committing sysfs_xroe.c, which creates the xroe sysfs directory and entries
for the main controls of the framer, such as enable, restart, the Framer's
version etc. In this version, the static declarations have been removed from
xroe_framer.h and unused (as well as some unnecessary) variables have been
removed from sysfs_xroe.c as indicated.

Signed-off-by: Vasileios Bimpikas <vasileios.bimpikas@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoarm64: zynqmp: Enable Xilinx M2M Multi-Scaler driver (XM2MSC)
Suresh Gupta [Mon, 17 Sep 2018 12:20:35 +0000 (17:50 +0530)]
arm64: zynqmp: Enable Xilinx M2M Multi-Scaler driver (XM2MSC)

This patch enables Xilinx V4L2 mem2mem Multi-Scaler driver

Signed-off-by: Suresh Gupta <suresh.gupta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
5 years agoplatform: xilinx: Add mem to mem Multi-Scaler driver (XM2MSC)
Suresh Gupta [Mon, 17 Sep 2018 12:20:03 +0000 (17:50 +0530)]
platform: xilinx: Add mem to mem Multi-Scaler driver (XM2MSC)

XM2MSC is a Scaler which consists of maximum 8 memory to memory
path/Channel, which can perform scaling and color space conversion of
supported formats in Hardware. Each channel can be programmed to
different scaling ratio and color space conversion.

We create a different video device for each Channel supported in HW,
which internally creates mem2mem driver context for each open video
device.

Mem2mem driver based primarily on the example vim2m test driver.
Each mem2mem context allocates a buffer for Input and output values
which it will use to configure the HW channel when all opened channels
start stream. Driver supports only V4L2_MEMORY_DMABUF buffers for now.

Different video devices are required to create different mem2mem context
to configure HW, based on the different information received via v4l2
ioctls for the source and destination queues. In this way all supported
channel can be configure with different scaling ratio and csc values.

The driver's device_run() mem2mem op will start the IP only when each
opened video device start stream on.

When all channels parsed completely by HW (and the DMAs on all the
output ports done), an interrupt is generated which we use to notify
that the source and destination buffers for all channels are done.

The opening of the same video device is not allowed, and the device run
starts the IP only when all opened devices start stream on. To reprogram
parameter of any one of the channels, all channel need to stream off,
and stream on after adding new values.

The rest of the driver is quite similar to other mem2mem drivers, we use
the multiplane v4l2 ioctls as the HW support multiplanar formats.

Signed-off-by: Suresh Gupta <suresh.gupta@xilinx.com>
Reviewed-by: Vishal Sagar <vishal.sagar@xlinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>