If the usb otg work as host mode or work as peripheral mode
with vbus always on, the otg_sm_work won't be initialized,
so flush the otg_sm_work in rockchip_usb2phy_exit() will
casuse the following lock warning:
[<ffffff800808b1e0>] dump_backtrace+0x0/0x1ec
[<ffffff800808b3e0>] show_stack+0x14/0x1c
[<ffffff8008403f3c>] dump_stack+0xb8/0xf4
[<ffffff8008107f40>] __lock_acquire+0x670/0x1984
[<ffffff8008109a60>] lock_acquire+0x1a4/0x264
[<ffffff8008129d2c>] del_timer_sync+0x48/0xb8
[<ffffff80080c3c94>] flush_delayed_work+0x20/0x50
[<ffffff80084344ac>] rockchip_usb2phy_exit+0x48/0x58
[<ffffff8008432bc4>] phy_exit+0x64/0xb4
[<ffffff80086733b8>] dwc3_core_exit+0x44/0x98
[<ffffff80086736c4>] dwc3_remove+0x90/0xe4
[<ffffff80085a5a5c>] platform_drv_remove+0x28/0x48
[<ffffff80085a3d14>] __device_release_driver+0xac/0x114
[<ffffff80085a3da4>] device_release_driver+0x28/0x3c
[<ffffff80085a2f38>] bus_remove_device+0x110/0x128
[<ffffff80085a0404>] device_del+0x160/0x1f8
[<ffffff80085a5954>] platform_device_del+0x20/0x88
[<ffffff80085a59d0>] platform_device_unregister+0x14/0x28
[<ffffff80088820f4>] of_platform_device_destroy+0x54/0xa8
[<ffffff800859f790>] device_for_each_child+0x68/0x98
[<ffffff8008882084>] of_platform_depopulate+0x30/0x4c
[<ffffff8008680030>] dwc3_rockchip_probe+0x4d4/0x574
[<ffffff80085a5ad4>] platform_drv_probe+0x58/0xa4
[<ffffff80085a396c>] driver_probe_device+0x118/0x2b0
[<ffffff80085a3b70>] __driver_attach+0x6c/0x98
[<ffffff80085a29d0>] bus_for_each_dev+0x80/0xb0
[<ffffff80085a34a0>] driver_attach+0x20/0x28
[<ffffff80085a3038>] bus_add_driver+0xe8/0x1e4
[<ffffff80085a4ad4>] driver_register+0x94/0xe0
[<ffffff80085a5a2c>] __platform_driver_register+0x48/0x50
[<ffffff8009222224>] dwc3_rockchip_driver_init+0x18/0x20
[<ffffff80080839f4>] do_one_initcall+0x17c/0x198
[<ffffff80091f0e48>] kernel_init_freeable+0x1f8/0x2b0
[<ffffff8008c61810>] kernel_init+0x10/0xf8
[<ffffff80080832c0>] ret_from_fork+0x10/0x50
This patch only allows to flush the otg_sm_work when the usb
bvalid irq is valid.
Fixes: f6fac8b68a ("phy: rockchip: rockchip-inno-usb2: flush otg work when exit")
Change-Id: I4dbe34fa9a330f22abb24ccd625da33425a9f753
Signed-off-by: William Wu <william.wu@rock-chips.com>
Add a basic wide-temperature control model for device to adjust opp
table and max frequency.
Change-Id: I23f29ac1892093c527e730164eba086f02667de3
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Sometimes pvtm thermal zone is different from wide-temperature control
thermal zone, so let pvtm parse 'rockchip,pvtm-thermal-zone' first.
Change-Id: Ia6bdfbabb99b053864cbc3cbf14aac675e26483c
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
the mcu init cmd should be sent from crtc mcu interface,
so we add the rockchip_drm_crtc_send_mcu_cmd to do this.
Change-Id: I7fedfb90c6074e8837a825d10e0dcd9c16bfc1d0
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
Fix the negative data before enabling loopback.
Change-Id: I8f4ef1e83b38f17c80f9b4109984c6560e570d20
Signed-off-by: Xing Zheng <zhengxing@rock-chips.com>
This patch use the master chan as the sync pointer. and in some case,
one or more sub dai may not start at the same time, or one sub dai
works always which leading the pointer of each sub dai is different,
it depends on the fifo available count and waterlevel. the maximum is
the whole fifo size. report the pointer(dma_pos - max_fifo_size) to
make sure each sub buffer have been filled out.
Change-Id: I5a6d8b3f3c63f8ed7b55b0402429904368adf557
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Newer high definition cameras, and cameras with multiple lenses such as
the range of stereo-vision cameras now available have ever increasing
data rates.
The inclusion of a variable length packet header in URB packets mean
that we must memcpy the frame data out to our destination 'manually'.
This can result in data rates of up to 2 gigabits per second being
processed.
To improve efficiency, and maximise throughput, handle the URB decode
processing through a work queue to move it from interrupt context, and
allow multiple processors to work on URBs in parallel.
Change-Id: I825a107e706a964525dcabba4faa9434f499fd96
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10311055/)
The buffer queue interface currently operates sequentially, processing
buffers after they have fully completed.
In preparation for supporting parallel tasks operating on the buffers,
we will need to support buffers being processed on multiple CPUs.
Adapt the uvc_queue_next_buffer() such that a reference count tracks the
active use of the buffer, returning the buffer to the VB2 stack at
completion.
Change-Id: Ia42cca9bed7852175202017b042590d844e8c6b0
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10311051/)
Both uvc_start_streaming(), and uvc_stop_streaming() are called from
userspace context, with interrupts enabled. As such, they do not need to
save the IRQ state, and can use spin_lock_irq() and spin_unlock_irq()
respectively.
Change-Id: I1cde5a8d9a8890cc2b671d1e32d3b6b4b0eac635
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10311047/)
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>