This patch fixes the issue that "bFrameindex" attribute was
always set to "1". And add V4L2_PIX_FMT_H264 in uvc_formats[]
to support H264 format.
Fixes: 66cb0608ac ("FROMLIST: usb: gadget: uvc: configfs: add framebased format support")
Change-Id: Icd7ce96b9667c378de421fd714a42f243b543764
Signed-off-by: William Wu <william.wu@rock-chips.com>
As we know, The framebased format can be used to support a lot of
formats other than YUV and MJPEG, for example: H264 or H265.
And Nowadays, the H264 and H265 is used more and more compared to the
MJPEG, so there is a need to support such usecase, although the new UVC
1.5 and the UVC1.1 extensions already support H264, but they are much
more expensive and most of the time, what we need is just a channel to
stream the video frames.
In this patch, we implement the framebased format and set it to H264 by
default, and the users could change the video format as they need through
the guid configfs attribute node.
Change-Id: Ie1c62f5fb4fa57c24a2878f9992c982e9deb302e
Signed-off-by: Zeng Tao <prime.zeng@hisilicon.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from https://patchwork.kernel.org/patch/10722957/)
Several macros used to define attributes and their access functions take
multiple arguments to specify endianness and string conversion
functions, based on the size of the attribute. This can be simplified by
passing the number of bits explicitly, and constructing the name of the
functions internally.
The UVCG_OPTS_ATTR macro can be simplified further as all fields it
deals with are unsigned int.
Change-Id: I967a1af76104635feab93ce902e291370feeb0db
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 4f2a6552c2)
USB descriptors are stored in little endian, requiring the use of
conversion macros. Those macros are incorrectly used for values stored
in native endian structures within the driver. Operation on big endian
platforms is thus broken. Fix it by removing the conversion macros where
they're not needed.
Change-Id: I65e7107abe4ddd5fdecdaf0970ba5d6b610e4a80
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 78c9e7ce00)
- Add bFrameIndex as a UVCG_FRAME_ATTR_RO for each frame size.
- Automatically assign ascending bFrameIndex to each frame in a format.
Before all "bFrameindex" attributes were set to "1" with no way to
configure the gadget otherwise. This resulted in the host always
negotiating for bFrameIndex 1 (i.e. the first frame size of the gadget).
After the negotiation the host driver will set the user or application
selected frame size, while the gadget is actually set to the first frame
size.
Now, when the containing format is linked into the streaming header,
iterate over all child frame descriptors and assign ascending indices.
The automatically assigned indices can be read from the new read only
bFrameIndex configfs attribute in each frame descriptor item.
Change-Id: I3da430c7be39460bd62e310a5b4930f623c12938
Signed-off-by: Joel Pepper <joel.pepper@rwth-aachen.de>
[Simplified documentation, renamed function, blank space update]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit b206548be6)
The UVC format description are numbered using the descriptor's
bFormatIndex field. The index is used in UVC requests, and is thus
needed to handle requests in userspace. Make it dynamically discoverable
by exposing it in a bFormatIndex configfs attribute of the uncompressed
and mjpeg format config items.
The bFormatIndex value exposed through the attribute is stored in the
config item private data. However, that value is never set: the driver
instead computes the bFormatIndex value when linking the stream class
header in the configfs hierarchy and stores it directly in the class
descriptors in a separate structure. In order to expose the value
through the configfs attribute, store it in the config item private data
as well. This results in a small code simplification.
Change-Id: I537f24242d4cf63efab72b96437193b665f44a60
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit 61ff10e0ea)
The video control and video streaming interface numbers are needed in
the UVC gadget userspace stack to reply to UVC requests. They are
hardcoded to fixed values at the moment, preventing configurations with
multiple functions.
To fix this, make them dynamically discoverable by userspace through
read-only configfs attributes in <function>/control/bInterfaceNumber and
<function>/streaming/bInterfaceNumber respectively.
Change-Id: I093a4e403ef0bd2188a799d9e6cbde986c58a2d4
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit bf71544883)
The UVC configfs implementation creates all groups as global static
variables. This prevents creation of multiple UVC function instances,
as they would all require their own configfs group instances.
Fix this by allocating all groups dynamically. To avoid duplicating code
around, extend the config_item_type structure with group name and
children, and implement helper functions to create children
automatically for most groups.
Change-Id: I2de58cbb0adc5586dbe864b35f6d8af0cffec3bf
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit efbf0af70b)
The UVC configfs implementation is large and difficult to navigate. Add
a bit more air to the code to make it easier to read.
Change-Id: I0f3d52ef7831ee0f77ca936445ce67c6fc82a1dc
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit f7d8109e31)
Various configfs groups (represented by config_group) are wrapped in
structures that they're the only member of. This allows adding other
data fields to groups, but it unnecessarily makes the code more complex.
Remove the outer structures and use config_group directly to simplify
the code. Groups can still be wrapped individually in the future if
other data fields need to be added.
Change-Id: I031176a1b2a0eac6cc283422fc2bb1e011ad4da5
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(cherry picked from commit b0aa30f33b)
support yuv format for cif and let dvp camera link to cif on rk1808
Change-Id: Idb078a909522f0e98fdc5319411a923e818fc128
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
These two callbacks are required for applications to obtain
framerates and enumrate framesizes.
Change-Id: I02cbea5e5c5bd7453c141726d1c3d37f8ccf31aa
Signed-off-by: Shunqian Zheng <zhengsq@rock-chips.com>
rk3288 cif can work with mipi channel and switch work mode
Change-Id: Ie8a49cf787617ff5d98ef84cdac761c3ece761c9
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
support yuyv output by setting the input mode to raw8
Change-Id: Ie33fa1e5d5cee532ebcfb23d57cac3700ee25042
Signed-off-by: Xu Hongfei <xuhf@rock-chips.com>
Compatible with cif only have single dma mode in driver
Change-Id: I5f2296549e20e3db1d8883474936e2892afc3ff0
Signed-off-by: Xu Hongfei <xuhf@rock-chips.com>
support the mipi vc multi-channel input in cif driver
for rk1808
Change-Id: I432c628b30e6f6f23e8515158dcf516e499bf79a
Signed-off-by: Xu Hongfei <xuhf@rock-chips.com>
dvp input raw/y, will output 16bit per pixel,
so output format shuold be raw16/y16.
Change-Id: I13e05ebe62b8802fa3a4c51f603c420e8127b929
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
Allow CFG80211 and MAC80211 being built as modules.
Change-Id: I414cb6e082a4c8fb044d74feaac2785395272078
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Delete nodes in case of:
* node is null, without any property and children node
* node with 'status' property but not "okay" or "ok"
Change-Id: Ic7d2ba1cb60350c21fa6a46222c20870c74359d4
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Old panel combination: st7703 + gt5688 use GTP_CFG_GROUP1
New panel combination: ili9881d + gt917s use GTP_CFG_GROUP0
Tested on rk3326 rv1108 platform.
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Change-Id: I6af571f5625316f3418cb51673fc3e43317dff74
Implement the UDP Segmentation Offload feature in stmmac. This is only
available in GMAC4+ cores.
Change-Id: I36bbc42ddadc3957ec0134b38e1c04d5d0ce87a7
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: David Wu <david.wu@rock-chips.com>
(cherry picked from commit b776620651)
Before the netdev is registered, calling netdev_info() will emit
something as "(unnamed net device) (uninitialized)", looks confusing.
Before this patch:
[ 3.155028] stmmaceth f7b60000.ethernet (unnamed net_device) (uninitialized): device MAC address 52:1a:55:18:9e:9d
After this patch:
[ 3.155028] stmmaceth f7b60000.ethernet: device MAC address 52:1a:55:18:9e:9d
Change-Id: I1fb100b417210de343ae54d323428d784520bb96
Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: David Wu <david.wu@rock-chips.com>
(cherry picked from commit af64935213)
The case for PTPV2_EVENT requires event packets to be captured so add
this setting to the list of enabled captures.
Fixes: 891434b18e ("stmmac: add IEEE PTPv1 and PTPv2 support.")
Change-Id: I8d9072d6feac5d0524da4eb367acc9cc92006025
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: David Wu <david.wu@rock-chips.com>
(cherry picked from commit 14f347334b)
The current driver only enables Pdelay_Req and Pdelay_Resp when
HWTSTAMP_FILTER_PTP_V2_EVENT, HWTSTAMP_FILTER_PTP_V1_L4_EVENT or
HWTSTAMP_FILTER_PTP_V2_L4_EVENT is requested. This results in ptp sync on
slave mode to report 'received SYNC without timestamp' when using ptp4l.
Although the hardware can support Sync, Pdelay_Req and Pdelay_resp by
setting bit14 annd bits 17/16 to 01 this leaves Delay_Req timestamps out.
Fix this by enabling all event and general messages timestamps.
This includes SYNC, Follow_Up, Delay_Req, Delay_Resp, Pdelay_Req,
Pdelay_Resp and Pdelay_Resp_Follow_Up messages.
Change-Id: Id5e4c22bff9742d21a1ef8011e3bde77e689b830
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Jose Abreu <joabreu@synopsys.com>
Tested-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: David Wu <david.wu@rock-chips.com>
(cherry picked from commit 7d8e249f39)
This patch adds support for the SIOCGHWTSTAMP ioctl which enables user
processes to read the current hwtstamp_config settings
non-destructively.
Change-Id: I26dec7bdd16332f6427ac6ec3096e3283d9ed8d1
Signed-off-by: Artem Panfilov <panfilov.artyom@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: David Wu <david.wu@rock-chips.com>
(cherry picked from commit d6228b7cdd)
When the property "rockchip,grf" of i2c DTS node exists and
the GRF offset is also valid, special bit needs to be configured.
Change-Id: If7ea4185b940ad026ed822b44cfb0c8acda83500
Signed-off-by: David Wu <david.wu@rock-chips.com>
If fscrypt_setup_filename() successful, fscrypt_free_filename()
must be called later to clean up.
Change-Id: I761472d605a1a3c64307fc997210ca2007bd8932
Signed-off-by: Wu Liangqing <wlq@rock-chips.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
If user process killed:
1. kernel should not to alloc task, and wait all task done in session,
then release session.
2. fd in user space is closed, then kernel space can not use dma_buf_get
to get dma handle, so kernel will crash.
crash:
[ 35.677648 ] [<b022b098>] (__fget) from [<b0467134>]
(dma_buf_get+0x8/0x40)
[ 35.678261 ] [<b0467134>] (dma_buf_get) from [<b0397848>]
(mpp_dma_find_buffer_fd+0x14/0x94)
[ 35.679004 ] [<b0397848>] (mpp_dma_find_buffer_fd) from [<b03978fc>]
(mpp_dma_release_fd+0x34/0xa0)
[ 35.679799 ] [<b03978fc>] (mpp_dma_release_fd) from [<b0395b2c>]
(mpp_task_finalize+0x68/0xbc)
[ 35.680561 ] [<b0395b2c>] (mpp_task_finalize) from [<b0398614>]
(rkvdec_free_task+0xc/0x1c)
[ 35.681290 ] [<b0398614>] (rkvdec_free_task) from [<b03963e4>]
(mpp_wait_result+0xd4/0x400)
[ 35.682020 ] [<b03963e4>] (mpp_wait_result) from [<b0396940>]
(mpp_dev_release+0x230/0x244)
[ 35.682750 ] [<b0396940>] (mpp_dev_release) from [<b020f30c>]
(__fput+0x88/0x1c4)
[ 35.683415 ] [<b020f30c>] (__fput) from [<b0140cac>]
(task_work_run+0x90/0xb0)
[ 35.684059 ] [<b0140cac>] (task_work_run) from [<b0128b38>]
(do_exit+0x3c4/0xac4)
[ 35.684722 ] [<b0128b38>] (do_exit) from [<b0129f54>]
(do_group_exit+0x3c/0xbc)
[ 35.685366 ] [<b0129f54>] (do_group_exit) from [<b0133b50>]
(get_signal+0xe4/0x6ac)
[ 35.686040 ] [<b0133b50>] (get_signal) from [<b010b09c>]
(do_signal+0x2a0/0x494)
[ 35.686690 ] [<b010b09c>] (do_signal) from [<b010b454>]
(do_work_pending+0xb4/0xd0)
[ 35.687364 ] [<b010b454>] (do_work_pending) from [<b0101064>]
(slow_work_pending+0xc/0x20)
Change-Id: I8decec8ff4c356b315fe511128c5b67c5b349932
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>