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.
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.
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.
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.
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.
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>
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>
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.
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.
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>
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.
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.
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.
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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>
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.
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.
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.
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>
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>
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>
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>
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) ]
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>
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>
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.
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.
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.
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>
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>
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>
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.
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.
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.
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.
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.
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>
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.