Commit Graph

853492 Commits

Author SHA1 Message Date
Jon Lin
257152724d drivers: rkflash: Treat ECC fail block as good one
Change-Id: I8c29638230c24fe0f0308bec9318482ad2371124
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-17 09:23:28 +08:00
Cliff Chen
4c935a2fd7 f2fs: Fix recovery is too slow when power fail on much fsync
By default fsync option, if fsync is called frequently, and suddenly
lost power, the POR will consume too much memory at mounting, this
process may be very slow due to a large number of swapping.

Change-Id: I8235098cca062d7ab58af4ebed414aed9aba6c75
Signed-off-by: Cliff Chen <cliff.chen@rock-chips.com>
Signed-off-by: Alex Wang <alex.wang@rock-chips.com>
2020-04-16 20:14:35 +08:00
Meiyou Chen
8d720ae62d media: i2c: tc35874x: Provides interface for obtaining audio sample rate
Change-Id: I8eb33c48e4a3322d250cf20174e0067cad6b19ec
Signed-off-by: Meiyou Chen <cmy@rock-chips.com>
2020-04-16 15:18:01 +08:00
William Wu
5775fe3ffe usb: dwc2: use buffer dma for device mode
The DWC2 driver auto detects the hardware and enable
the gadget descriptor DMA if the DWC2 IP supports it.
However, the gadget descriptor DMA has some unexpected
compatibility issues, so we use buffer DMA instead of
desc DMA.

Change-Id: I1fed77f7d9bec1e0916b44d80813fb6248d461f0
Signed-off-by: William Wu <william.wu@rock-chips.com>
2020-04-16 15:16:40 +08:00
Shawn Lin
4ff037c13c mmc: dw_mmc-rockchip: add v2 tuning support
v2 tuning will inherit pre-stage loader's phase
settings for the first time, and do re-tune if
necessary. Re-tune will still try the rough degrees,
for instance, 90, 180, 270, 360 but continue to do the
fine tuning if sample window isn't good enough.

Change-Id: I593384ee381d09df5b9adfc29a18eb22517b2764
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-04-16 15:15:10 +08:00
Shawn Lin
536c61daa4 mmc: dw_mmc-rockchip: Enable xfer timer for all Rockchip SoCs
xfer timer was introduced to solve native defects for RK3308
platform but it seems some others also suffer from it. Enable
it would not put any burden on the normal driver process but
just ensure it has a dead-line weapon to fight for any issues
preventing the IP to work normally.

Change-Id: I0b6914d46788f4df99a7d49c608c3336976f78c6
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2020-04-16 11:36:22 +08:00
Liang Chen
a548e40e5e ARM: dts: rk3288: adjust pvtm-voltage-sel table
Current pvtm-voltage-sel table is not stable for some chips, reported by
some clients.

Change-Id: If2f7d8cd6a077922334c8e6ba4b01f82e27048d7
Signed-off-by: Liang Chen <cl@rock-chips.com>
2020-04-16 09:29:19 +08:00
Tao Huang
6bec2128bb rk: arm: support build Image.gz and Image.lz4
Same as arm64.

Change-Id: If129d04388414ba4acd252a274431710ed8d985b
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2020-04-16 09:27:40 +08:00
Jianhui Wang
bdf8520b83 ARM: rockchip_defconfig: add CONFIG_PSI
Ref: https://android.googlesource.com/kernel/configs

commit aaf4b964e66f ("Add CONFIG_PSI to recommended")
This feature is not (yet?) required for Go, so we need to put it in
'recommended'.

commit 5f92c3d69791 ("android R: replace CONFIG_MEMCG requirement with CONFIG_PSI")
With adoption of PSI events as low memory notification mechanism MEMCG
becomes optional and PSI becomes mandatory. Note that MEMCG can still be
used for instance in Android Go devices but it's not mandatory anymore.

Change-Id: Id955b47aebc0411594906bc615464d894b1f8d51
Signed-off-by: Jianhui Wang <wjh@rock-chips.com>
2020-04-15 19:30:32 +08:00
Ding Wei
a7f0c7f7e1 video: rockchip: mpp: add session extra info for debug
current->pid may be the same for different sessions in one thread.

Change-Id: Iac6ee4c641d63cbd3e883861d339eb2d540d3118
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2020-04-14 17:56:40 +08:00
Tao Huang
6a4ff82227 usb: dwc3: host: Export symbols used by dwc3-rockchip-inno driver
Export dwc3_host_init() and dwc3_host_exit().

Fixes: cdff9a65d9 ("usb: dwc3: rockchip-inno: rework the disconnect workflow")
Change-Id: Ib2f3b5b2793bf3926f5ad0546a9009128fcc905d
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2020-04-14 16:36:00 +08:00
Wu Jingchen
ffc4ff2444 arm64: dts: rockchip: add gpio key and adc key config for rk3368-xikp board
Change-Id: I300ad4e7b5d6e942813d6375bb85e6578f44d657
Signed-off-by: Wu Jingchen <oven.wu@rock-chips.com>
2020-04-13 20:28:38 +08:00
Sugar Zhang
5f8cfa6806 ARM: Make TEXT_OFFSET more flexible
arch/arm/boot/compressed/head.S:209: Error: invalid constant (608000) after fixup

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Change-Id: I1efb510817d02732e76976058e5af97586ea0147
2020-04-13 19:16:11 +08:00
Jon Lin
56d234ee97 drivers: rkflash: fix error in snor_write_status2
Cross function stack border

Change-Id: I7c61cdbf46431dffc36a05312e88dfc6f4674612
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-13 17:30:24 +08:00
Jon Lin
43b20a6bf5 drivers: rkflash: support new SPI flash
FS35ND01G, 25Q256JWEQ, EN25QH64A, EN25QH32B, 25Q256JVEM, 25Q256JVEM,
EN25QH32B, BH25Q128AS, BH25Q64BS

Change-Id: Ide4c23123e7c5c246b2f2c6d819a42e3b590ab29
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-13 14:29:32 +08:00
Jon Lin
e10d2cae40 drivers: rkflash: support transfer large size data
Change-Id: I07cb3cc2699cfdb43dcad9db58078796ed2f59c4
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-13 14:29:32 +08:00
Jon Lin
cd76ab1868 drivers: rkflash: change to use rk_sfc_op for request
Change-Id: I5c82c8178c7641eb1f32b207a2afb0c30a5ef871
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-13 14:29:32 +08:00
Jon Lin
7c976c6b64 drivers: rkflash: add nand_mega_area discription
Change-Id: Iab621571536922e4a886c07680bdba4a81d95b43
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-13 14:29:32 +08:00
Liang Chen
468a0911c2 cpufreq: interactive: no need warning when delta_time==0
delta_time==0 may happen by chance when irq_work and idle_end come together,
but it is ok, cpufreq_interactive will correct it next period.

[ 6559.355576] WARNING: CPU: 5 PID: 0 at drivers/cpufreq/cpufreq_interactive.c:395 eval_target_freq+0x640/0x670
[ 6559.355604] Modules linked in:
[ 6559.355618] CPU: 5 PID: 0 Comm: swapper/5 Not tainted 4.19.111 #252
[ 6559.355624] Hardware name: Rockchip RK3399 Evaluation Board v3 (Android) (DT)
[ 6559.355631] pstate: 20400005 (nzCv daif +PAN -UAO)
[ 6559.355636] pc : eval_target_freq+0x640/0x670
[ 6559.355642] lr : eval_target_freq+0xc4/0x670
[ 6559.360919] Call trace:
[ 6559.360951]  eval_target_freq+0x640/0x670
[ 6559.360972]  cpufreq_interactive_update+0x1c/0xbc
[ 6559.361000]  cpufreq_interactive_idle_notifier+0x98/0xb4
[ 6559.361026]  atomic_notifier_call_chain+0x4c/0x84
[ 6559.361065]  idle_notifier_call_chain+0x1c/0x24
[ 6559.361089]  arch_cpu_idle_exit+0x10/0x18
[ 6559.361119]  do_idle+0x8c/0x288
[ 6559.361138]  cpu_startup_entry+0x20/0x24
[ 6559.361169]  secondary_start_kernel+0x138/0x144
[ 6559.361203] ---[ end trace c8c6e336a23d6818 ]---

Change-Id: I413b84b964e557935a353dab1e67cebed00c6754
Signed-off-by: Liang Chen <cl@rock-chips.com>
2020-04-12 16:46:26 +08:00
Liang Chen
70335261b7 soc: rockchip: system_monitor: make sure thermal work is done before reboot
Thermal work is bound to a cpu which may offline while reboot, and it will
cause warning as below:

[   37.344392] WARNING: CPU: 0 PID: 1 at kernel/workqueue.c:858 wq_worker_waking_up+0x50/0x9c
[   37.345118] Modules linked in:
[   37.345407] CPU: 0 PID: 1 Comm: init Not tainted 4.19.111 #187
[   37.345927] Hardware name: Rockchip RK3399 EVB IND LPDDR4 Board edp (Android) (DT)
[   37.346599] pstate: 20400085 (nzCv daIf +PAN -UAO)
[   37.347030] pc : wq_worker_waking_up+0x50/0x9c
[   37.347427] lr : wq_worker_waking_up+0x18/0x9c
[   37.444388] Call trace:
[   37.444615]  wq_worker_waking_up+0x50/0x9c
[   37.444990]  try_to_wake_up+0x42c/0x600
[   37.445342]  default_wake_function+0x14/0x1c
[   37.445730]  autoremove_wake_function+0x18/0x58
[   37.446139]  __wake_up_common+0xb0/0x138
[   37.446491]  __wake_up_common_lock+0x7c/0xc4
[   37.446876]  __wake_up+0x14/0x1c
[   37.447174]  rk3x_i2c_irq+0x564/0x7bc
[   37.447503]  rk3x_i2c_restart_notify+0x44/0xf0
[   37.447902]  atomic_notifier_call_chain+0x4c/0x84
[   37.448323]  do_kernel_i2c_restart+0x20/0x28
[   37.448710]  machine_restart+0x20/0x58
[   37.449050]  kernel_restart+0x100/0x110
[   37.449402]  __arm64_sys_reboot+0x140/0x20c
[   37.449778]  el0_svc_common+0x98/0x150
[   37.450119]  el0_svc_handler+0x60/0x78
[   37.450459]  el0_svc+0x8/0xc

Change-Id: I21b30e95ce99cb186d443c66049d279e0805c5d7
Signed-off-by: Liang Chen <cl@rock-chips.com>
2020-04-12 16:15:12 +08:00
Jon Lin
87d2c3dbf1 drivers: rkflash: update sftl to version SFTL version: 5.0.53 20200303
1.Add more varification for ftl read/write input param
2.dump stack in FtlMemInit

Change-Id: I7a09f54c217d9da8e656cb91fe18ca83a882cff6
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-10 20:02:42 +08:00
Jon Lin
846019f5fa spi: rockchip: transfer SPI slave by CPU loop
Change-Id: Ifa2b7f92ff5aacaf30c4a3fa362ddabaff1a50c7
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
2020-04-10 17:33:38 +08:00
Wang Panzhenzhuan
79893b21b7 media: rockchip: cif: add mutex in rkcif start/stop streaming
Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: I6f741b0cc4f1753836712bf3b6378c20b99b2ab1
2020-04-10 16:14:30 +08:00
Wang Panzhenzhuan
01da297611 media: rockchip: cif: delete mipi dphy subdev s_stream in csi2_start/stop
mipi dphy subdev s_stream has been called in rkcif_pipeline_set_stream,
no need be called here

Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: Iba9074da59d6516b169660ebae8039b70ee428c4
2020-04-10 16:13:54 +08:00
Wang Panzhenzhuan
6cc8f4cd8d phy: rockchip: mipi-rx: fix n4 green issue
add mutex for mipidphy_s_stream to fix n4 green issue

Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: I7fe7a5b0369569757e3f3c179e37bb4f5e8967ce
2020-04-10 16:13:24 +08:00
Allon Huang
a5c502cb44 drivers: media: platform: rockchip: cif: fix green image when taking photo on rk3126c
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: Iba3a69b85883893df1d696017de9ff0ae75c8e5e
2020-04-10 14:48:34 +08:00
Allon Huang
b8a24e8c5d media: platform: rockchip: cif: fix pipeline power management
Fixes: 99b3695fef ("media: rockchip: cif: add pipeline power management")
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: I30308d3ffd91992addbc8466a9d36bd0c7719cc8
2020-04-10 14:15:07 +08:00
Allon Huang
aec5601a93 drivers: media: platform: rockchip: cif: fix panic when stream on
log:
[   79.156494] Unable to handle kernel NULL pointer dereference at virtual address 00000200
[   79.168633] pgd = df940b55
[   79.171344] [00000200] *pgd=00000000
[   79.174933] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
[   79.180249] Modules linked in:
[   79.183321] CPU: 1 PID: 1574 Comm: ImguThread Not tainted 4.19.111 #155
[   79.189933] Hardware name: Generic DT based system
[   79.194734] PC is at __list_add_valid+0x24/0x84
[   79.199272] LR is at rkcif_buf_queue+0x78/0x164
[   79.203805] pc : [<c04ae6b0>]    lr : [<c07896b0>]    psr: 60000093
[   79.210073] sp : c6127d80  ip : ca0bc7e4  fp : c13e5ee4
[   79.215295] r10: 60000013  r9 : ca0bc800  r8 : cb5e5b58
[   79.220525] r7 : 00000200  r6 : cb5e5a00  r5 : ca0bc7e4  r4 : ca0bc320
[   79.227048] r3 : ca0bc800  r2 : 00000200  r1 : 00000200  r0 : cb5e5b58
[   79.233573] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   79.240797] Control: 10c5387d  Table: 66f4c06a  DAC: 00000051

Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: Ifb3f307971faa9d80dc5a996a41327d11fac4d1b
2020-04-10 11:35:09 +08:00
Mark Yao
6b6e9cabe9 drm/sysfs: add current display mode to sysfs
Change-Id: I2a1a699bac74d9fe71151ba1eb8e33e0683a48a5
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2020-04-10 10:34:17 +08:00
Ding Wei
2f86e91a4f video: rockchip: mpp: fix issue for rkvenc request check
It is not necessary to check offset for MPP_CMD_SET_REG_ADDR_OFFSET,
and user space can not ensure it.

Change-Id: Iac3a2fa3ce8be8d9afd7294e7c3ec4bc6df4a2e3
Signed-off-by: Ding Wei <leo.ding@rock-chips.com>
2020-04-10 09:57:12 +08:00
Allon Huang
63fecdcba1 drivers: media: rockchip: cif: fix register media node failed
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: Ie3ce875b65554227ba9a74ec39629f68a4c82227
2020-04-10 09:34:00 +08:00
Allon Huang
f0e9bf380c drivers: media: rockchip: cif: fix queue buf failed
Signed-off-by: Allon Huang <allon.huang@rock-chips.com>
Change-Id: I4a5a3686be30847a24497ef13510d2d1d876a4dc
2020-04-10 09:33:02 +08:00
Tao Huang
4b0678b212 dt-bindings: soc: rockchip: pvtm: Add more clock-names and reset-names
Change-Id: Ia87df874907743ae3f8d14c1c82006cc97c399e9
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2020-04-09 21:29:21 +08:00
Tao Huang
9a9a74da16 rk: kbuild: Introduce CONFIG_DTC_SYMBOLS
dtc generation of symbols by CONFIG_DTC_SYMBOLS other than
CONFIG_ANDROID directly.

Fixes: 761bc94299 ("ANDROID: rk: kbuild: dtc generation of symbols")
Change-Id: Ia10496031bc02fd3a4ff98ab0acfc6fc9a54951b
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2020-04-09 21:29:21 +08:00
Cong Wang
2b7afb2d4a UPSTREAM: dma-buf: free dmabuf->name in dma_buf_release()
dma-buf name can be set via DMA_BUF_SET_NAME ioctl, but once set
it never gets freed.

Free it in dma_buf_release().

Change-Id: I64d3e894c252ab64505b246093bb82b85de7ac7d
Fixes: bb2bb90304 ("dma-buf: add DMA_BUF_SET_NAME ioctls")
Reported-by: syzbot+b2098bc44728a4efb3e9@syzkaller.appspotmail.com
Cc: Greg Hackmann <ghackmann@google.com>
Cc: Chenbo Feng <fengc@google.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Chenbo Feng <fengc@google.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191227063204.5813-1-xiyou.wangcong@gmail.com
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit d1f3722643)
2020-04-09 18:26:34 +08:00
William Wu
c57970c078 usb: gadget: uvc: configfs: fix frame index and H264 format
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>
2020-04-09 14:44:58 +08:00
Finley Xiao
bc8e039e37 dt-bindings: soc: rockchip: pvtm: Make resets as optional property
Change-Id: I2e7bd9b6777783cfca180a3b972aff01be336be6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2020-04-09 10:01:28 +08:00
Huibin Hong
475d3d26ba soc: rockchip: debug: adjust log print
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
Change-Id: I7cc461fde40bc38b23d4a55b090b7a7a45e6f8df
2020-04-08 17:05:41 +08:00
Huibin Hong
872272c921 fiq_debugger: add pcsr command
Change-Id: I5af3ef7d00dc2a8e14ef719f0fc4cc683fb84463
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2020-04-08 14:50:51 +08:00
Huibin Hong
f901b81c85 soc: rockchip: debug: print dbgpcsr of cpus when panic
Change-Id: I4a3d60986b0bd23d43fa7fd5479b43cb65662996
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2020-04-08 14:38:21 +08:00
Zhou Jing
9d75ca700c arm64: dts: rockchip: rk3368 support automatic frequency
Signed-off-by: Zhou Jing <tracy.zhou@rock-chips.com>
Change-Id: Ibb5432e81718bb6e6df116bd21c891c653ab0e58
2020-04-08 14:24:42 +08:00
Zhou Jing
5625ebbdc5 video: rockchip: mpp: automatic frequency on large resolution
Signed-off-by: Zhou Jing <tracy.zhou@rock-chips.com>
Change-Id: I70150a22a535cd13a6618a66a7c0f5c20790d58f
2020-04-08 14:24:42 +08:00
Zhou Jing
1d19144785 dt-bindings: video: add rk3368 codec properties
Signed-off-by: Zhou Jing <tracy.zhou@rock-chips.com>
Change-Id: I568b9f86b2b6149b1c645846d0250c7170abf1df
2020-04-08 14:24:42 +08:00
Zeng Tao
66cb0608ac FROMLIST: usb: gadget: uvc: configfs: add framebased format support
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/)
2020-04-08 11:45:11 +08:00
Laurent Pinchart
f8fdb7ba34 UPSTREAM: usb: gadget: uvc: configfs: Use %u to print unsigned int values
The driver uses the %d format to print unsigned int values. The correct
format is %u. Fix it.

Change-Id: Ic379aca372b268e360411cca0361975be31c6aef
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 3fb2fd76ed)
2020-04-08 11:45:05 +08:00
Laurent Pinchart
fc57e95751 UPSTREAM: usb: gadget: uvc: configfs: Simplify attributes macros
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)
2020-04-08 11:44:59 +08:00
Laurent Pinchart
0b28cca6d4 UPSTREAM: usb: gadget: uvc: configfs: Fix operation on big endian platforms
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)
2020-04-08 11:44:52 +08:00
Joel Pepper
8c8d0ba003 UPSTREAM: usb: gadget: uvc: configfs: Add bFrameIndex attributes
- 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)
2020-04-08 11:43:51 +08:00
Laurent Pinchart
068cd84209 UPSTREAM: usb: gadget: uvc: configfs: Add bFormatIndex attributes
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)
2020-04-08 11:43:51 +08:00
Laurent Pinchart
91f0677d2c UPSTREAM: usb: gadget: uvc: configfs: Add interface number attributes
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)
2020-04-08 11:43:51 +08:00