The URB completion operation obtains the current buffer by reading
directly into the queue internal interface.
Protect this queue abstraction by providing a helper
uvc_queue_get_current_buffer() which can be used by both the decode
task, and the uvc_queue_next_buffer() functions.
Change-Id: Ic5401fe9afec00b87bb075f99addae8591de6890
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10311059/)
We currently store three separate arrays for each URB reference we hold.
Objectify the data needed to track URBs into a single uvc_urb structure,
allowing better object management and tracking of the URB.
All accesses to the data pointers through stream, are converted to use a
uvc_urb pointer for consistency.
Change-Id: I03320cff8ec5cb268b62610b9852b32505f136aa
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10311045/)
Some UVC video cameras contain metadata in their payload headers. This
patch extracts that data, adding more clock synchronisation information,
on both bulk and isochronous endpoints and makes it available to the user
space on a separate video node, using the V4L2_CAP_META_CAPTURE capability
and the V4L2_BUF_TYPE_META_CAPTURE buffer queue type. By default, only the
V4L2_META_FMT_UVC pixel format is available from those nodes. However,
cameras can be added to the device ID table to additionally specify their
own metadata format, in which case that format will also become available
from the metadata node.
[Use put_unaligned instead of __put_unaligned_cpu64]
[Use put_unaligned for the sof field as well]
Conflicts:
drivers/media/usb/uvc/uvc_queue.c
drivers/media/usb/uvc/uvc_video.c
Change-Id: I2696d2c781376e363e0a77d8d895f416aaff09cb
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 088ead2552)
The statistics function subtracts two timespecs manually. A helper is
provided by the kernel to do this.
Replace the implementation, using the helper.
Change-Id: I1fc2cdfad723456045515364846958814b30f666
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 52276df0b1)
Add a pixel format, used by the UVC driver to stream metadata.
Conflicts:
Documentation/media/uapi/v4l/meta-formats.rst
drivers/media/v4l2-core/v4l2-ioctl.c
include/uapi/linux/videodev2.h
Change-Id: I979fd6b4d5d24510e47a1cfe525e8ae0a1a573ee
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 563a01e101)
Currently the UVC driver assigns a quirk bitmask to the .driver_info
field of struct usb_device_id. This patch instroduces a struct to store
quirks and possibly other per-device parameters in the future.
Conflicts:
drivers/media/usb/uvc/uvc_driver.c
Change-Id: I0c823a17cc15f73eb7806804b9b8d42c109c86b9
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 3bc85817d7)
According to the UVC specification, stream error events carry no data.
Fix a buffer overflow (that should be harmless given data alignment)
when reporting the stream error event by removing the data byte from the
message.
Change-Id: I0603ed4a092bc02ae2a339c96d1433ec8463336a
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 0393e73564)
Some cameras post inaccurate frame where next frame data overlap
it. this results in screen flicker, and it need to be prevented.
So this patch marks the buffer error to discard the frame where
buffer overflow.
Change-Id: Ibd41b93cf8376b126b6d107a59ab22907fb839e6
Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit dfc1648c57)
Microsoft HoloLense UVC sensor uses D3DFMT instead of FOURCC when
exposing formats. This adds support for D3DFMT_L8 as exposed from
the Acer Windows Mixed Reality Headset.
Change-Id: I5689e85bd600029f3fcef37860483c19d639d6ed
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit e96cdc9a0a)
uvc_subdev_ops is only passed as the second argument of
v4l2_subdev_init, which is const, so uvc_subdev_ops can be
const as well.
Done with the help of Coccinelle.
Change-Id: Ic146384e5570ad6d249e661a73138ad396c6e3a6
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 5422079014)
When adding support for metadata nodes, we'll have to keep video
devices registered until all metadata nodes are closed too. Since
this has nothing to do with stream counting, replace the nstreams
atomic variable with a reference counter.
Change-Id: Ied4c660b0cc618f010e4fffc3c3e06a2f71f4aa7
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 9d15cd958c)
There isn't headphone on all of rk3308 voice modules,
so we don't need to enable headphone detection.
Change-Id: I526dc02dfb3c0b92503c8a7821baa82b87c8c996
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
Fix the incorrect switching LINEOUT to HPOUT if there
isn't no headphone and hp-det pin is hanging.
Change-Id: I902ce3e112049981300f786cefa247bd166e1c33
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
It may take different time for different PAs(AMPs) to
open, so the delay we need in loopback needs to be
flexible.
Change-Id: I76c98b769e382cef08a6e897bb1d527783660f3b
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
LSC data table size is 17x17, but when configuring data to ISP,
should be aligned to 18x17. That means every last data of last
line should be filled with 0, and not filled with the data of
next line.
BUG=b:36227021
TEST=scarlet can preview.
Change-Id: I5e923529429a1c60efff3827e594f32db7112c1f
Signed-off-by: ZhongYiChong <zyc@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/942600
Commit-Ready: Jeffy Chen <jeffy.chen@rock-chips.com>
Tested-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Some ISP parameter config functions may override the old enable
bit value, because the enable bits of these modules are in the
same registers with parameters. So we should save the old enable
bits firstly.
BUG=b:36227021
TEST=scarlet can preview
Change-Id: I509e2b9160118f8a7f522857e013e3014e41ef9f
Signed-off-by: ZhongYiChong <zyc@rock-chips.com>
For those sub modules that have shadow registers in core isp, the
new programing parameters would not be active if both
CIF_ISP_CTRL_ISP_CFG_UPD_PERMANENT and CFG_UPD are not set. Now
we configure CFG_UPD to force update the shadow registers when new
ISP parameters are configured.
BUG=b:36227021
TEST=scarlet can preview, LSC data table can be switched.
Change-Id: I804ddfc45b3c2fca9a6f51627af4264a25075070
Signed-off-by: ZhongYiChong <zyc@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/942721
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Rather than adding unnecessary indirection, just use stream index to
handle MI interrupt enable/disable/clear, since the stream index matches
the order of bits now, thanks to previous patch. While at it, remove
some dead code.
BUG=b:78779539
TEST=Make sure camera works on scarlet.
Change-Id: Ie817471972e60917250d7240d7543b516db0db03
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1065404
Reviewed-by: yichong zhong <zyc@rock-chips.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
The current order (SP=0, MP=1) is the opposite of what is there in
hardware registers (MP=0, SP=1), which unnecessarily complicates the
code that deals with hardware programming. Fix this by reversing the
order of streams in the driver.
BUG=b:78779539
TEST=Make sure camera works on scarlet.
Change-Id: I43671748073d9dc4cb906e5f6f992f870920ce91
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1065403
Tested-by: yichong zhong <zyc@rock-chips.com>
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: yichong zhong <zyc@rock-chips.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
The rkisp1_state enum consists only of 3 entries, where 1 is completely
unused and the other two respectively mean not streaming or streaming.
Replace it with a boolean called "streaming".
While at it, remove "saved_state" member from rkisp1_stream struct, as
it is not used anywhere.
BUG=b:78779539
TEST=Make sure camera works on scarlet.
Change-Id: I329b62951e214a25ac35a5c189814cebba26dbf1
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1059006
Tested-by: yichong zhong <zyc@rock-chips.com>
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Reviewed-by: yichong zhong <zyc@rock-chips.com>
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
This patch adds superspeed descriptors in device
applications to support USB 3.0 ffs gadget.
Change-Id: I5a364c935b1d30e2e929791ff16a34cf0d1c87e1
Signed-off-by: William Wu <william.wu@rock-chips.com>
According to P45 of <<Rockchip RK3308 Datasheet V1.0-20180313>>,
the max voltage for Logic is 1.1V, so for many boards which
Core_VDD and Logic_VDD share the same power supply, the ARM
core voltage will be limited to 1.1V, that can only guarantee
the cpu to run at the max freq of 1008MHZ.
As for board which Core_VDD and Logic_VDD use independent
power supply, the cpu can run a higher freq up to 1296MHZ
with higher Core_VDD power supply, you can eanble it in
your board dts.
Change-Id: I69777aa5bee797e609d9ea122f3502347930b631
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
The userspace might check tty information in proc fs.
Change-Id: If3e81aacbc7948dd3000606702296bc2b76bec09
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Some boards don't need to control power supply.
Let's make it optional.
Change-Id: Ifd72a7c3704cdc0df4f2d2096278a6b58f925e8d
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
The msleep < 20ms can sleep for up to 20ms, see:
Documentation/timers/timers-howto.txt.
Change msleep to usleep_range for this case.
Change-Id: Ibb680b766b6c7317fc1f13dfda7457ef771b4272
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
According to the hardware design, wifi and rmii cannot be powered off in
deepsleep
Change-Id: Id44ef9b31c34b6f12695dbf3fbb843950602ca71
Signed-off-by: Wu Liangqing <wlq@rock-chips.com>
This patch fix snd_pcm_vad_attached crash when using non-soc audio,
such as usb audio, pci audio. it is because substream private_data
in these types of audio framework means different values.
Change-Id: I5dcd3ea7de363bc3afc8d9879a2a37c6d6110a4a
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
We need to operate loopback ADCs during LINEOUT enable
or disable that it make ensure enable ADCs more smoothly.
Therefore, we don't need to reset loopback ADCs in
rk3308_codec_loopback_work(), and separete reinit-mics
from adc_ana_enable().
Change-Id: Id26dd5ad00c527be47a706df58c435f12d46c281
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
This patch using BIST mode switching to fix the glitches
during loopback and reset ADCs.
Change-Id: Icb9dbd6557736fe555d9f8296369571e78bc6844
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>