History

Merge tag 'media/v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media updates from Mauro Carvalho Chehab: - remove of atomisp driver from staging, as nobody would have time to dedicate huge efforts to fix all the problems there. Also, we have a feeling that the driver may not even run the way it is. - move Zoran driver to staging, in order to be either fixed to use VB2 and the proper media kAPIs or to be removed - remove videobuf-dvb driver, with is unused for a while - some V4L2 documentation fixes/improvements - new sensor drivers: imx258 and ov7251 - a new driver was added to allow using I2C transparent drivers - several improvements at the ddbridge driver - several improvements at the ISDB pt1 driver, making it more coherent with the DVB framework - added a new platform driver for MIPI CSI-2 RX: cadence - now, all media drivers can be compiled on x86 with COMPILE_TEST - almost all media drivers now build on non-x86 architectures with COMPILE_TEST - lots of other random stuff: cleanups, support for new board models, bug fixes, etc * tag 'media/v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (464 commits) media: omap2: fix compile-testing with FB_OMAP2=m media: media/radio/Kconfig: add back RADIO_ISA media: v4l2-ioctl.c: fix missing unlock in __video_do_ioctl() media: pxa_camera: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power media: arch: sh: migor: Fix TW9910 PDN gpio media: staging: tegra-vde: Reset VDE regardless of memory client resetting failure media: marvel-ccic: mmp: select VIDEOBUF2_VMALLOC/DMA_CONTIG media: marvel-ccic: allow ccic and mmp drivers to coexist media: uvcvideo: Prevent setting unavailable flags media: ddbridge: conditionally enable fast TS for stv0910-equipped bridges media: dvb-frontends/stv0910: make TS speed configurable media: ddbridge/mci: add identifiers to function definition arguments media: ddbridge/mci: protect against out-of-bounds array access in stop() media: rc: ensure input/lirc device can be opened after register media: rc: nuvoton: Keep device enabled during reg init media: rc: nuvoton: Keep track of users on CIR enable/disable media: rc: nuvoton: Tweak the interrupt enabling dance media: uvcvideo: Support realtek's UVC 1.5 device media: uvcvideo: Fix driver reference counting media: gspca_zc3xx: Enable short exposure times for OV7648 ...

Linus Torvalds committed 8 years ago

Commit 3036bc42 parents c90fca9 48a8bbc1168 files · +16815 −176700Browse files

Unified · Split

1168 files
  1. Documentation/ABI/testing/sysfs-class-rc +8 −8
  2. Documentation/ABI/testing/sysfs-class-rc-nuvoton +1 −1
  3. Documentation/ABI/testing/sysfs-devices-edac +7 −7
  4. Documentation/devicetree/bindings/media/cdns,csi2rx.txt +100 −0
  5. Documentation/devicetree/bindings/media/cdns,csi2tx.txt +98 −0
  6. Documentation/devicetree/bindings/media/i2c/ov7251.txt +52 −0
  7. Documentation/devicetree/bindings/media/i2c/ov772x.txt +40 −0
  8. Documentation/devicetree/bindings/media/i2c/panasonic,amg88xx.txt +19 −0
  9. Documentation/devicetree/bindings/media/rcar_vin.txt +117 −21
  10. Documentation/devicetree/bindings/media/renesas,ceu.txt +4 −3
  11. Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt +101 −0
  12. Documentation/media/kapi/cec-core.rst +4 −1
  13. Documentation/media/uapi/cec/cec-ioc-receive.rst +15 −9
  14. Documentation/media/uapi/dvb/dvbapi.rst +1 −1
  15. Documentation/media/uapi/rc/lirc-dev-intro.rst +1 −1
  16. Documentation/media/uapi/rc/lirc-set-rec-timeout.rst +9 −5
  17. Documentation/media/uapi/v4l/common.rst +1 −1
  18. Documentation/media/uapi/v4l/crop.rst +15 −7
  19. Documentation/media/uapi/v4l/selection-api-005.rst +0 −34
  20. Documentation/media/uapi/v4l/selection-api-configuration.rst +1 −1
  21. Documentation/media/uapi/v4l/selection-api-examples.rst +0 −0
  22. Documentation/media/uapi/v4l/selection-api-intro.rst +0 −0
  23. Documentation/media/uapi/v4l/selection-api-targets.rst +0 −0
  24. Documentation/media/uapi/v4l/selection-api-vs-crop-api.rst +39 −0
  25. Documentation/media/uapi/v4l/selection-api.rst +7 −7
  26. Documentation/media/uapi/v4l/selection.svg +2 −2
  27. Documentation/media/uapi/v4l/v4l2.rst +1 −1
  28. Documentation/media/v4l-drivers/cx23885-cardlist.rst +17 −1
  29. Documentation/media/v4l-drivers/em28xx-cardlist.rst +7 −3
  30. MAINTAINERS +23 −8
  31. arch/sh/boards/mach-migor/setup.c +1 −1
  32. drivers/gpu/drm/rcar-du/rcar_du_crtc.c +150 −6
  33. drivers/gpu/drm/rcar-du/rcar_du_crtc.h +15 −0
  34. drivers/gpu/drm/rcar-du/rcar_du_vsp.c +10 −2
  35. drivers/media/Kconfig +6 −6
  36. drivers/media/cec/cec-adap.c +13 −6
  37. drivers/media/cec/cec-core.c +1 −1
  38. drivers/media/cec/cec-pin-error-inj.c +18 −15
  39. drivers/media/cec/cec-pin.c +1 −1
  40. drivers/media/common/b2c2/flexcop-fe-tuner.c +2 −2
  41. drivers/media/common/b2c2/flexcop-i2c.c +19 −28
  42. drivers/media/common/b2c2/flexcop.c +1 −1
  43. drivers/media/common/b2c2/flexcop.h +1 −0
  44. drivers/media/common/saa7146/saa7146_i2c.c +2 −2
  45. drivers/media/common/siano/smscoreapi.c +17 −15
  46. drivers/media/common/siano/smscoreapi.h +3 −0
  47. drivers/media/common/siano/smsendian.c +7 −7
  48. drivers/media/common/videobuf2/Kconfig +0 −2
  49. drivers/media/common/videobuf2/videobuf2-core.c +6 −3
  50. drivers/media/dvb-core/dmxdev.c +1 −1
  51. drivers/media/dvb-core/dvb_ca_en50221.c +2 −0
  52. drivers/media/dvb-core/dvb_frontend.c +123 −107
  53. drivers/media/dvb-core/dvb_net.c +1 −1
  54. drivers/media/dvb-core/dvbdev.c +4 −0
  55. drivers/media/dvb-frontends/Kconfig +1 −1
  56. drivers/media/dvb-frontends/as102_fe.h +1 −1
  57. drivers/media/dvb-frontends/au8522_decoder.c +6 −8
  58. drivers/media/dvb-frontends/cx24116.c +1 −1
  59. drivers/media/dvb-frontends/cx24117.c +1 −1
  60. drivers/media/dvb-frontends/cx24120.c +1 −1
  61. drivers/media/dvb-frontends/cx24123.c +1 −1
  62. drivers/media/dvb-frontends/cxd2099.c +2 −2
  63. drivers/media/dvb-frontends/cxd2099.h +1 −1
  64. drivers/media/dvb-frontends/cxd2820r_core.c +1 −1
  65. drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_driver_version.h +2 −2
  66. drivers/media/dvb-frontends/cxd2880/cxd2880_top.c +12 −2
  67. drivers/media/dvb-frontends/dvb-pll.c +110 −0
  68. drivers/media/dvb-frontends/dvb-pll.h +6 −0
  69. drivers/media/dvb-frontends/l64781.c +2 −2
  70. drivers/media/dvb-frontends/lgdt3306a.c +1 −1
  71. drivers/media/dvb-frontends/lgdt330x.c +535 −339
  72. drivers/media/dvb-frontends/lgdt330x.h +24 −17
  73. drivers/media/dvb-frontends/mb86a20s.c +1 −1
  74. drivers/media/dvb-frontends/mxl5xx.c +1 −1
  75. drivers/media/dvb-frontends/s921.c +1 −1
  76. drivers/media/dvb-frontends/stv0910.c +10 −5
  77. drivers/media/dvb-frontends/stv0910.h +1 −0
  78. drivers/media/dvb-frontends/tc90522.c +3 −12
  79. drivers/media/dvb-frontends/tc90522.h +1 −10
  80. drivers/media/i2c/Kconfig +36 −0
  81. drivers/media/i2c/Makefile +3 −0
  82. drivers/media/i2c/adv748x/adv748x-afe.c +6 −6
  83. drivers/media/i2c/adv748x/adv748x-hdmi.c +1 −7
  84. drivers/media/i2c/adv7511.c +11 −11
  85. drivers/media/i2c/imx258.c +1318 −0
  86. drivers/media/i2c/imx274.c +27 −47
  87. drivers/media/i2c/ir-kbd-i2c.c +3 −1
  88. drivers/media/i2c/ov13858.c +0 −1
  89. drivers/media/i2c/ov2640.c +92 −20
  90. drivers/media/i2c/ov5640.c +152 −105
  91. drivers/media/i2c/ov5645.c +4 −2
  92. drivers/media/i2c/ov5695.c +0 −1
  93. drivers/media/i2c/ov7251.c +1503 −0
  94. drivers/media/i2c/ov772x.c +1 −1
  95. drivers/media/i2c/ov7740.c +17 −5
  96. drivers/media/i2c/smiapp/smiapp-core.c +5 −6
  97. drivers/media/i2c/tda1997x.c +2 −2
  98. drivers/media/i2c/tvp5150.c +82 −77
  99. drivers/media/i2c/video-i2c.c +564 −0
  100. drivers/media/media-device.c +11 −10
  101. drivers/media/mmc/siano/smssdio.c +1 −1
  102. drivers/media/pci/Kconfig +0 −1
  103. drivers/media/pci/Makefile +0 −1
  104. drivers/media/pci/bt8xx/bttv-risc.c +9 −8
  105. drivers/media/pci/bt8xx/dst.c +1 −1
  106. drivers/media/pci/bt8xx/dvb-bt8xx.c +2 −2
  107. drivers/media/pci/cx23885/cx23885-core.c +114 −18
  108. drivers/media/pci/cx23885/cx23885-dvb.c +3 −3
  109. drivers/media/pci/cx23885/cx23885-reg.h +14 −0
  110. drivers/media/pci/cx88/cx88-dvb.c +4 −3
  111. drivers/media/pci/cx88/cx88-input.c +7 −4
  112. drivers/media/pci/cx88/cx88-vbi.c +0 −1
  113. drivers/media/pci/ddbridge/Kconfig +1 −0
  114. drivers/media/pci/ddbridge/Makefile +1 −1
  115. drivers/media/pci/ddbridge/ddbridge-ci.c +1 −1
  116. drivers/media/pci/ddbridge/ddbridge-core.c +275 −144
  117. drivers/media/pci/ddbridge/ddbridge-hw.c +11 −0
  118. drivers/media/pci/ddbridge/ddbridge-i2c.c +2 −3
  119. drivers/media/pci/ddbridge/ddbridge-main.c +33 −58
  120. drivers/media/pci/ddbridge/ddbridge-max.c +42 −0
  121. drivers/media/pci/ddbridge/ddbridge-max.h +1 −0
  122. drivers/media/pci/ddbridge/ddbridge-mci.c +551 −0
  123. drivers/media/pci/ddbridge/ddbridge-mci.h +156 −0
  124. drivers/media/pci/ddbridge/ddbridge-regs.h +4 −0
  125. drivers/media/pci/ddbridge/ddbridge.h +19 −31
  126. drivers/media/pci/dt3155/Kconfig +0 −1
  127. drivers/media/pci/intel/ipu3/Kconfig +7 −9
  128. drivers/media/pci/intel/ipu3/ipu3-cio2.c +22 −10
  129. drivers/media/pci/mantis/mantis_uart.c +7 −0
  130. drivers/media/pci/meye/Kconfig +2 −1
  131. drivers/media/pci/ngene/ngene-cards.c +3 −15
  132. drivers/media/pci/ngene/ngene-dvb.c +1 −1
  133. drivers/media/pci/pt1/Kconfig +3 −0
  134. drivers/media/pci/pt1/Makefile +2 −1
  135. drivers/media/pci/pt1/pt1.c +351 −120
  136. drivers/media/pci/pt1/va1j5jf8007s.c +0 −732
  137. drivers/media/pci/pt1/va1j5jf8007s.h +0 −42
  138. drivers/media/pci/pt1/va1j5jf8007t.c +0 −532
  139. drivers/media/pci/pt1/va1j5jf8007t.h +0 −42
  140. drivers/media/pci/pt3/pt3.c +22 −48
  141. drivers/media/pci/pt3/pt3.h +1 −10
  142. drivers/media/pci/pt3/pt3_dma.c +1 −10
  143. drivers/media/pci/pt3/pt3_i2c.c +1 −10
  144. drivers/media/pci/saa7164/saa7164-fw.c +2 −1
  145. drivers/media/pci/solo6x10/Kconfig +0 −1
  146. drivers/media/pci/sta2x11/Kconfig +1 −2
  147. drivers/media/pci/sta2x11/sta2x11_vip.c +15 −16
  148. drivers/media/pci/tw5864/Kconfig +0 −1
  149. drivers/media/pci/tw686x/Kconfig +0 −1
  150. drivers/media/pci/tw686x/tw686x-video.c +2 −1
  151. drivers/media/platform/Kconfig +22 −35
  152. drivers/media/platform/Makefile +1 −0
  153. drivers/media/platform/am437x/Kconfig +1 −1
  154. drivers/media/platform/am437x/am437x-vpfe.c +2 −4
  155. drivers/media/platform/atmel/Kconfig +2 −2
  156. drivers/media/platform/cadence/Kconfig +34 −0
  157. drivers/media/platform/cadence/Makefile +4 −0
  158. drivers/media/platform/cadence/cdns-csi2rx.c +498 −0
  159. drivers/media/platform/cadence/cdns-csi2tx.c +563 −0
  160. drivers/media/platform/cec-gpio/cec-gpio.c +1 −1
  161. drivers/media/platform/coda/coda-common.c +31 −14
  162. drivers/media/platform/davinci/Kconfig +4 −8
  163. drivers/media/platform/davinci/isif.c +1 −3
  164. drivers/media/platform/davinci/vpbe.c +20 −18
  165. drivers/media/platform/davinci/vpbe_display.c +18 −15
  166. drivers/media/platform/davinci/vpbe_osd.c +12 −9
  167. drivers/media/platform/davinci/vpbe_venc.c +6 −5
  168. drivers/media/platform/davinci/vpfe_capture.c +1 −1
  169. drivers/media/platform/exynos4-is/Kconfig +1 −3
  170. drivers/media/platform/exynos4-is/fimc-lite-reg.c +1 −1
  171. drivers/media/platform/fsl-viu.c +30 −33
  172. drivers/media/platform/marvell-ccic/Kconfig +4 −3
  173. drivers/media/platform/marvell-ccic/Makefile +4 −5
  174. drivers/media/platform/marvell-ccic/mcam-core.c +8 −1
  175. drivers/media/platform/marvell-ccic/mmp-driver.c +3 −3
  176. drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +1 −4
  177. drivers/media/platform/omap/Kconfig +4 −3
  178. drivers/media/platform/omap/omap_vout.c +8 −9
  179. drivers/media/platform/omap/omap_vout_vrfb.c +2 −2
  180. drivers/media/platform/omap3isp/isp.c +12 −10
  181. drivers/media/platform/omap3isp/ispccdc.c +1 −1
  182. drivers/media/platform/omap3isp/isph3a_aewb.c +2 −0
  183. drivers/media/platform/omap3isp/isph3a_af.c +2 −0
  184. drivers/media/platform/omap3isp/isphist.c +2 −0
  185. drivers/media/platform/omap3isp/isppreview.c +3 −3
  186. drivers/media/platform/omap3isp/ispstat.c +24 −13
  187. drivers/media/platform/omap3isp/ispstat.h +3 −1
  188. drivers/media/platform/omap3isp/ispvideo.c +1 −1
  189. drivers/media/platform/pxa_camera.c +34 −16
  190. drivers/media/platform/rcar-vin/Kconfig +14 −2
  191. drivers/media/platform/rcar-vin/Makefile +1 −0
  192. drivers/media/platform/rcar-vin/rcar-core.c +904 −55
  193. drivers/media/platform/rcar-vin/rcar-csi2.c +1084 −0
  194. drivers/media/platform/rcar-vin/rcar-dma.c +542 −370
  195. drivers/media/platform/rcar-vin/rcar-v4l2.c +296 −194
  196. drivers/media/platform/rcar-vin/rcar-vin.h +120 −26
  197. drivers/media/platform/rcar_jpu.c +3 −1
  198. drivers/media/platform/renesas-ceu.c +17 −6
  199. drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c +2 −2
  200. drivers/media/platform/s5p-mfc/s5p_mfc_dec.c +2 −2
  201. drivers/media/platform/s5p-mfc/s5p_mfc_enc.c +2 −2
  202. drivers/media/platform/soc_camera/Kconfig +1 −2
  203. drivers/media/platform/soc_camera/soc_camera_platform.c +2 −1
  204. drivers/media/platform/sti/bdisp/bdisp-hw.c +1 −1
  205. drivers/media/platform/sti/bdisp/bdisp-v4l2.c +4 −0
  206. drivers/media/platform/sti/c8sectpfe/Kconfig +1 −1
  207. drivers/media/platform/sti/hva/hva-mem.c +1 −1
  208. drivers/media/platform/sti/hva/hva-v4l2.c +4 −0
  209. drivers/media/platform/via-camera.c +1 −1
  210. drivers/media/platform/video-mux.c +15 −1
  211. drivers/media/platform/vivid/vivid-vid-common.c +1 −1
  212. drivers/media/platform/vsp1/Makefile +2 −2
  213. drivers/media/platform/vsp1/vsp1.h +8 −8
  214. drivers/media/platform/vsp1/vsp1_bru.h +0 −48
  215. drivers/media/platform/vsp1/vsp1_brx.c +105 −113
  216. drivers/media/platform/vsp1/vsp1_brx.h +44 −0
  217. drivers/media/platform/vsp1/vsp1_clu.c +80 −104
  218. drivers/media/platform/vsp1/vsp1_clu.h +2 −5
  219. drivers/media/platform/vsp1/vsp1_dl.c +264 −177
  220. drivers/media/platform/vsp1/vsp1_dl.h +20 −16
  221. drivers/media/platform/vsp1/vsp1_drm.c +605 −346
  222. drivers/media/platform/vsp1/vsp1_drm.h +23 −8
  223. drivers/media/platform/vsp1/vsp1_drv.c +27 −11
  224. drivers/media/platform/vsp1/vsp1_entity.c +128 −9
  225. drivers/media/platform/vsp1/vsp1_entity.h +38 −22
  226. drivers/media/platform/vsp1/vsp1_hgo.c +12 −20
  227. drivers/media/platform/vsp1/vsp1_hgo.h +1 −5
  228. drivers/media/platform/vsp1/vsp1_hgt.c +13 −21
  229. drivers/media/platform/vsp1/vsp1_hgt.h +1 −5
  230. drivers/media/platform/vsp1/vsp1_histo.c +6 −61
  231. drivers/media/platform/vsp1/vsp1_histo.h +1 −8
  232. drivers/media/platform/vsp1/vsp1_hsit.c +9 −17
  233. drivers/media/platform/vsp1/vsp1_hsit.h +1 −5
  234. drivers/media/platform/vsp1/vsp1_lif.c +23 −73
  235. drivers/media/platform/vsp1/vsp1_lif.h +1 −5
  236. drivers/media/platform/vsp1/vsp1_lut.c +64 −87
  237. drivers/media/platform/vsp1/vsp1_lut.h +2 −5
  238. drivers/media/platform/vsp1/vsp1_pipe.c +19 −108
  239. drivers/media/platform/vsp1/vsp1_pipe.h +10 −14
  240. drivers/media/platform/vsp1/vsp1_regs.h +42 −4
  241. drivers/media/platform/vsp1/vsp1_rpf.c +108 −99
  242. drivers/media/platform/vsp1/vsp1_rwpf.c +1 −5
  243. drivers/media/platform/vsp1/vsp1_rwpf.h +2 −8
  244. drivers/media/platform/vsp1/vsp1_sru.c +11 −19
  245. drivers/media/platform/vsp1/vsp1_sru.h +1 −5
  246. drivers/media/platform/vsp1/vsp1_uds.c +40 −39
  247. drivers/media/platform/vsp1/vsp1_uds.h +2 −6
  248. drivers/media/platform/vsp1/vsp1_uif.c +264 −0
  249. drivers/media/platform/vsp1/vsp1_uif.h +32 −0
  250. drivers/media/platform/vsp1/vsp1_video.c +152 −68
  251. drivers/media/platform/vsp1/vsp1_video.h +4 −5
  252. drivers/media/platform/vsp1/vsp1_wpf.c +178 −162
  253. drivers/media/platform/xilinx/xilinx-dma.c +6 −4
  254. drivers/media/radio/Kconfig +26 −18
  255. drivers/media/radio/si470x/Kconfig +15 −1
  256. drivers/media/radio/si470x/Makefile +3 −5
  257. drivers/media/radio/si470x/radio-si470x-common.c +51 −19
  258. drivers/media/radio/si470x/radio-si470x-i2c.c +15 −9
  259. drivers/media/radio/si470x/radio-si470x-usb.c +12 −6
  260. drivers/media/radio/si470x/radio-si470x.h +9 −6
  261. drivers/media/rc/Kconfig +5 −5
  262. drivers/media/rc/ir-imon-decoder.c +133 −3
  263. drivers/media/rc/ir-jvc-decoder.c +1 −0
  264. drivers/media/rc/ir-mce_kbd-decoder.c +37 −27
  265. drivers/media/rc/ir-nec-decoder.c +1 −0
  266. drivers/media/rc/ir-rc5-decoder.c +1 −3
  267. drivers/media/rc/ir-rc6-decoder.c +1 −10
  268. drivers/media/rc/ir-sanyo-decoder.c +1 −0
  269. drivers/media/rc/ir-sharp-decoder.c +1 −0
  270. drivers/media/rc/ir-sony-decoder.c +1 −0
  271. drivers/media/rc/ir-spi.c +2 −2
  272. drivers/media/rc/ir-xmp-decoder.c +1 −0
  273. drivers/media/rc/ite-cir.c +5 −3
  274. drivers/media/rc/ite-cir.h +0 −7
  275. drivers/media/rc/lirc_dev.c +28 −3
  276. drivers/media/rc/mceusb.c +51 −2
  277. drivers/media/rc/mtk-cir.c +1 −3
  278. drivers/media/rc/nuvoton-cir.c +41 −48
  279. drivers/media/rc/rc-core-priv.h +6 −0
  280. drivers/media/rc/rc-ir-raw.c +64 −17
  281. drivers/media/rc/rc-main.c +37 −35
  282. drivers/media/rc/st_rc.c +10 −6
  283. drivers/media/rc/winbond-cir.c +2 −2
  284. drivers/media/spi/cxd2880-spi.c +10 −22
  285. drivers/media/tuners/Kconfig +7 −0
  286. drivers/media/tuners/Makefile +1 −0
  287. drivers/media/tuners/mxl301rf.c +1 −10
  288. drivers/media/tuners/mxl301rf.h +1 −10
  289. drivers/media/tuners/qm1d1b0004.c +266 −0
  290. drivers/media/tuners/qm1d1b0004.h +24 −0
  291. drivers/media/tuners/qm1d1c0042.c +1 −10
  292. drivers/media/tuners/qm1d1c0042.h +1 −10
  293. drivers/media/usb/cx231xx/Kconfig +1 −4
  294. drivers/media/usb/cx231xx/cx231xx-417.c +1 −0
  295. drivers/media/usb/cx231xx/cx231xx-cards.c +6 −3
  296. drivers/media/usb/cx231xx/cx231xx-dvb.c +103 −279
  297. drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c +1 −1
  298. drivers/media/usb/cx231xx/cx231xx.h +0 −3
  299. drivers/media/usb/dvb-usb-v2/dvbsky.c +136 −289
  300. drivers/media/usb/dvb-usb-v2/gl861.c +18 −4
  301. drivers/media/usb/dvb-usb-v2/usb_urb.c +4 −13
  302. drivers/media/usb/dvb-usb/cxusb.c +5 −4
  303. drivers/media/usb/dvb-usb/dvb-usb-dvb.c +4 −0
  304. drivers/media/usb/dvb-usb/gp8psk.c +1 −1
  305. drivers/media/usb/dvb-usb/usb-urb.c +3 −3
  306. drivers/media/usb/em28xx/em28xx-cards.c +39 −11
  307. drivers/media/usb/em28xx/em28xx-core.c +3 −2
  308. drivers/media/usb/em28xx/em28xx-dvb.c +6 −2
  309. drivers/media/usb/em28xx/em28xx-v4l.h +1 −1
  310. drivers/media/usb/em28xx/em28xx.h +1 −0
  311. drivers/media/usb/go7007/go7007-fw.c +3 −0
  312. drivers/media/usb/go7007/go7007-v4l2.c +1 −1
  313. drivers/media/usb/gspca/Kconfig +1 −0
  314. drivers/media/usb/gspca/gspca.c +184 −762
  315. drivers/media/usb/gspca/gspca.h +19 −19
  316. drivers/media/usb/gspca/jl2005bcd.c +1 −1
  317. drivers/media/usb/gspca/m5602/m5602_core.c +2 −2
  318. drivers/media/usb/gspca/ov534.c +0 −1
  319. drivers/media/usb/gspca/sq905.c +1 −1
  320. drivers/media/usb/gspca/sq905c.c +1 −1
  321. drivers/media/usb/gspca/topro.c +0 −1
  322. drivers/media/usb/gspca/vc032x.c +1 −1
  323. drivers/media/usb/gspca/vicam.c +1 −1
  324. drivers/media/usb/gspca/zc3xx.c +40 −18
  325. drivers/media/usb/hackrf/hackrf.c +4 −7
  326. drivers/media/usb/hdpvr/hdpvr-i2c.c +1 −1
  327. drivers/media/usb/hdpvr/hdpvr-video.c +1 −1
  328. drivers/media/usb/pvrusb2/pvrusb2-cx2584x-v4l.c +0 −1
  329. drivers/media/usb/pvrusb2/pvrusb2-devattr.c +2 −2
  330. drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +31 −52
  331. drivers/media/usb/siano/smsusb.c +1 −1
  332. drivers/media/usb/stk1160/stk1160-core.c +3 −1
  333. drivers/media/usb/usbtv/usbtv-video.c +101 −16
  334. drivers/media/usb/usbtv/usbtv.h +1 −1
  335. drivers/media/usb/usbvision/usbvision-core.c +1 −1
  336. drivers/media/usb/uvc/uvc_ctrl.c +9 −8
  337. drivers/media/usb/uvc/uvc_driver.c +2 −9
  338. drivers/media/usb/uvc/uvc_video.c +18 −6
  339. drivers/media/v4l2-core/Kconfig +0 −6
  340. drivers/media/v4l2-core/Makefile +0 −1
  341. drivers/media/v4l2-core/v4l2-compat-ioctl32.c +497 −310
  342. drivers/media/v4l2-core/v4l2-dev.c +37 −36
  343. drivers/media/v4l2-core/v4l2-fwnode.c +18 −10
  344. drivers/media/v4l2-core/v4l2-ioctl.c +164 −122
  345. drivers/media/v4l2-core/v4l2-subdev.c +16 −1
  346. drivers/media/v4l2-core/videobuf-dma-sg.c +3 −3
  347. drivers/media/v4l2-core/videobuf-dvb.c +0 −398
  348. drivers/pnp/isapnp/Kconfig +1 −1
  349. drivers/staging/media/Kconfig +2 −2
  350. drivers/staging/media/Makefile +1 −1
  351. drivers/staging/media/atomisp/Kconfig +0 −12
  352. drivers/staging/media/atomisp/Makefile +0 −6
  353. drivers/staging/media/atomisp/TODO +0 −74
  354. drivers/staging/media/atomisp/i2c/Kconfig +0 −86
  355. drivers/staging/media/atomisp/i2c/Makefile +0 −25
  356. drivers/staging/media/atomisp/i2c/atomisp-gc0310.c +0 −1392
  357. drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +0 −1122
  358. drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c +0 −205
  359. drivers/staging/media/atomisp/i2c/atomisp-lm3554.c +0 −968
  360. drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +0 −1917
  361. drivers/staging/media/atomisp/i2c/atomisp-ov2680.c +0 −1470
  362. drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +0 −1271
  363. drivers/staging/media/atomisp/i2c/gc0310.h +0 −404
  364. drivers/staging/media/atomisp/i2c/gc2235.h +0 −670
  365. drivers/staging/media/atomisp/i2c/mt9m114.h +0 −1777
  366. drivers/staging/media/atomisp/i2c/ov2680.h +0 −856
  367. drivers/staging/media/atomisp/i2c/ov2722.h +0 −1262
  368. drivers/staging/media/atomisp/i2c/ov5693/Kconfig +0 −11
  369. drivers/staging/media/atomisp/i2c/ov5693/Makefile +0 −9
  370. drivers/staging/media/atomisp/i2c/ov5693/ad5823.h +0 −63
  371. drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c +0 −1993
  372. drivers/staging/media/atomisp/i2c/ov5693/ov5693.h +0 −1376
  373. drivers/staging/media/atomisp/include/linux/atomisp.h +0 −1359
  374. drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h +0 −36
  375. drivers/staging/media/atomisp/include/linux/atomisp_platform.h +0 −249
  376. drivers/staging/media/atomisp/include/linux/libmsrlisthelper.h +0 −28
  377. drivers/staging/media/atomisp/include/media/lm3554.h +0 −131
  378. drivers/staging/media/atomisp/pci/Kconfig +0 −14
  379. drivers/staging/media/atomisp/pci/Makefile +0 −5
  380. drivers/staging/media/atomisp/pci/atomisp2/Makefile +0 −349
  381. drivers/staging/media/atomisp/pci/atomisp2/atomisp-regs.h +0 −205
  382. drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c +0 −604
  383. drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.h +0 −120
  384. drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c +0 −6696
  385. drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h +0 −446
  386. drivers/staging/media/atomisp/pci/atomisp2/atomisp_common.h +0 −75
  387. drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h +0 −662
  388. drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c +0 −4704
  389. drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h +0 −277
  390. drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c +0 −1259
  391. drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.h +0 −365
  392. drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.c +0 −442
  393. drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.h +0 −57
  394. drivers/staging/media/atomisp/pci/atomisp2/atomisp_dfs_tables.h +0 −408
  395. drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c +0 −205
  396. drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h +0 −24
  397. drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c +0 −225
  398. drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.h +0 −43
  399. drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c +0 −1304
  400. drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.h +0 −50
  401. drivers/staging/media/atomisp/pci/atomisp2/atomisp_helper.h +0 −29
  402. drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h +0 −310
  403. drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c +0 −3124
  404. drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.h +0 −69
  405. drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c +0 −1422
  406. drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h +0 −467
  407. drivers/staging/media/atomisp/pci/atomisp2/atomisp_tables.h +0 −187
  408. drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c +0 −164
  409. drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.h +0 −38
  410. drivers/staging/media/atomisp/pci/atomisp2/atomisp_trace_event.h +0 −129
  411. drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +0 −1573
  412. drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.h +0 −40
  413. drivers/staging/media/atomisp/pci/atomisp2/css2400/Makefile +0 −2
  414. drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf.h +0 −376
  415. drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_comm.h +0 −56
  416. drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_desc.h +0 −169
  417. drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/src/circbuf.c +0 −321
  418. drivers/staging/media/atomisp/pci/atomisp2/css2400/base/refcount/interface/ia_css_refcount.h +0 −83
  419. drivers/staging/media/atomisp/pci/atomisp2/css2400/base/refcount/src/refcount.c +0 −281
  420. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/interface/ia_css_pipe_binarydesc.h +0 −297
  421. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/interface/ia_css_pipe_stagedesc.h +0 −52
  422. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/interface/ia_css_pipe_util.h +0 −39
  423. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_binarydesc.c +0 −880
  424. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_stagedesc.c +0 −115
  425. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_util.c +0 −51
  426. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/interface/ia_css_util.h +0 −141
  427. drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c +0 −227
  428. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_configs.c +0 −360
  429. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_configs.h +0 −189
  430. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_params.c +0 −3221
  431. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_params.h +0 −399
  432. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_states.c +0 −214
  433. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_states.h +0 −72
  434. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/bits.h +0 −104
  435. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/cell_params.h +0 −42
  436. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/css_receiver_2400_common_defs.h +0 −200
  437. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/css_receiver_2400_defs.h +0 −258
  438. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/defs.h +0 −36
  439. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/dma_v2_defs.h +0 −199
  440. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gdc_v2_defs.h +0 −170
  441. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gp_timer_defs.h +0 −36
  442. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gpio_block_defs.h +0 −42
  443. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_defs.h +0 −416
  444. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_host_ids_hrt.h +0 −84
  445. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_irq_types_hrt.h +0 −72
  446. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_streaming_to_mipi_types_hrt.h +0 −26
  447. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_types.h +0 −128
  448. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/if_defs.h +0 −22
  449. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h +0 −53
  450. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_selector_defs.h +0 −89
  451. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_switch_2400_defs.h +0 −30
  452. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_system_ctrl_defs.h +0 −254
  453. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_system_defs.h +0 −126
  454. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/irq_controller_defs.h +0 −28
  455. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp2400_mamoiada_params.h +0 −254
  456. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp2400_support.h +0 −38
  457. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp_acquisition_defs.h +0 −234
  458. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp_capture_defs.h +0 −310
  459. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/mmu_defs.h +0 −23
  460. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/scalar_processor_2400_params.h +0 −20
  461. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/str2mem_defs.h +0 −39
  462. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/streaming_to_mipi_defs.h +0 −28
  463. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/timed_controller_defs.h +0 −22
  464. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/var.h +0 −74
  465. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/version.h +0 −20
  466. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/spmem_dump.c +0 −3634
  467. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/csi_rx_global.h +0 −63
  468. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_configs.c +0 −360
  469. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_configs.h +0 −189
  470. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_params.c +0 −3220
  471. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_params.h +0 −399
  472. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_states.c +0 −214
  473. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_states.h +0 −72
  474. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx.c +0 −41
  475. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_local.h +0 −61
  476. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h +0 −282
  477. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/ibuf_ctrl.c +0 −22
  478. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/ibuf_ctrl_local.h +0 −58
  479. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/ibuf_ctrl_private.h +0 −233
  480. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/input_system_local.h +0 −106
  481. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/input_system_private.h +0 −128
  482. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_dma.c +0 −40
  483. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_dma_local.h +0 −20
  484. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_dma_private.h +0 −60
  485. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_irq.c +0 −39
  486. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_irq_local.h +0 −35
  487. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_irq_private.h +0 −108
  488. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_stream2mmio.c +0 −21
  489. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_stream2mmio_local.h +0 −36
  490. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_stream2mmio_private.h +0 −168
  491. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/pixelgen_local.h +0 −50
  492. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/pixelgen_private.h +0 −164
  493. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/system_local.h +0 −381
  494. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/PixelGen_SysBlock_defs.h +0 −126
  495. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/bits.h +0 −104
  496. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/cell_params.h +0 −42
  497. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/css_receiver_2400_common_defs.h +0 −200
  498. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/css_receiver_2400_defs.h +0 −258
  499. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/defs.h +0 −36
  500. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/dma_v2_defs.h +0 −199
  501. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gdc_v2_defs.h +0 −170
  502. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gp_timer_defs.h +0 −36
  503. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gpio_block_defs.h +0 −42
  504. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_2401_irq_types_hrt.h +0 −68
  505. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_defs.h +0 −435
  506. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_host_ids_hrt.h +0 −119
  507. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_streaming_to_mipi_types_hrt.h +0 −26
  508. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_types.h +0 −128
  509. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/ibuf_cntrl_defs.h +0 −138
  510. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/if_defs.h +0 −22
  511. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h +0 −53
  512. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_selector_defs.h +0 −89
  513. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_switch_2400_defs.h +0 −30
  514. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_system_ctrl_defs.h +0 −254
  515. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_system_defs.h +0 −126
  516. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/irq_controller_defs.h +0 −28
  517. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp2400_support.h +0 −38
  518. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp2401_mamoiada_params.h +0 −258
  519. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp_acquisition_defs.h +0 −234
  520. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp_capture_defs.h +0 −310
  521. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/mipi_backend_common_defs.h +0 −210
  522. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/mipi_backend_defs.h +0 −215
  523. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/mmu_defs.h +0 −23
  524. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/rx_csi_defs.h +0 −175
  525. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/scalar_processor_2400_params.h +0 −20
  526. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/str2mem_defs.h +0 −39
  527. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/stream2mmio_defs.h +0 −71
  528. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/streaming_to_mipi_defs.h +0 −28
  529. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/timed_controller_defs.h +0 −22
  530. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/var.h +0 −99
  531. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/version.h +0 −20
  532. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/ibuf_ctrl_global.h +0 −80
  533. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/input_system_global.h +0 −206
  534. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/isys_dma_global.h +0 −87
  535. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/isys_irq_global.h +0 −35
  536. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/isys_stream2mmio_global.h +0 −39
  537. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/pixelgen_global.h +0 −91
  538. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/spmem_dump.c +0 −3686
  539. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/system_global.h +0 −458
  540. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_configs.c +0 −360
  541. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_configs.h +0 −189
  542. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_params.c +0 −3220
  543. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_params.h +0 −399
  544. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_states.c +0 −214
  545. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_states.h +0 −72
  546. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/bits.h +0 −104
  547. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/cell_params.h +0 −42
  548. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/css_receiver_2400_common_defs.h +0 −200
  549. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/css_receiver_2400_defs.h +0 −258
  550. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/defs.h +0 −36
  551. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/dma_v2_defs.h +0 −199
  552. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gdc_v2_defs.h +0 −170
  553. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gp_timer_defs.h +0 −36
  554. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gpio_block_defs.h +0 −42
  555. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_2401_irq_types_hrt.h +0 −69
  556. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_defs.h +0 −435
  557. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_host_ids_hrt.h +0 −119
  558. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_streaming_to_mipi_types_hrt.h +0 −26
  559. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_types.h +0 −128
  560. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/if_defs.h +0 −22
  561. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h +0 −53
  562. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_selector_defs.h +0 −89
  563. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_switch_2400_defs.h +0 −30
  564. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_system_ctrl_defs.h +0 −254
  565. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_system_defs.h +0 −126
  566. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/irq_controller_defs.h +0 −28
  567. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp2400_support.h +0 −38
  568. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp2401_mamoiada_params.h +0 −258
  569. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp_acquisition_defs.h +0 −234
  570. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp_capture_defs.h +0 −310
  571. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/mmu_defs.h +0 −23
  572. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/scalar_processor_2400_params.h +0 −20
  573. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/str2mem_defs.h +0 −39
  574. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/streaming_to_mipi_defs.h +0 −28
  575. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/timed_controller_defs.h +0 −22
  576. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/var.h +0 −99
  577. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/version.h +0 −20
  578. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/spmem_dump.c +0 −3634
  579. drivers/staging/media/atomisp/pci/atomisp2/css2400/css_trace.h +0 −388
  580. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/debug_global.h +0 −83
  581. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/dma_global.h +0 −255
  582. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/event_fifo_global.h +0 −20
  583. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/fifo_monitor_global.h +0 −32
  584. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gdc_global.h +0 −90
  585. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gp_device_global.h +0 −85
  586. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gp_timer_global.h +0 −33
  587. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gpio_global.h +0 −45
  588. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/hmem_global.h +0 −45
  589. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug.c +0 −72
  590. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug_local.h +0 −21
  591. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug_private.h +0 −99
  592. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma.c +0 −299
  593. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma_local.h +0 −207
  594. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma_private.h +0 −41
  595. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo.c +0 −19
  596. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_local.h +0 −57
  597. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_private.h +0 −75
  598. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor.c +0 −567
  599. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_local.h +0 −99
  600. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_private.h +0 −79
  601. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc.c +0 −127
  602. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc_local.h +0 −20
  603. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc_private.h +0 −20
  604. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device.c +0 −108
  605. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_local.h +0 −143
  606. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_private.h +0 −46
  607. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer.c +0 −70
  608. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer_local.h +0 −45
  609. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer_private.h +0 −22
  610. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_local.h +0 −20
  611. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_private.h +0 −44
  612. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem.c +0 −19
  613. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_local.h +0 −20
  614. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_private.h +0 −30
  615. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c +0 −228
  616. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_local.h +0 −120
  617. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_private.h +0 −46
  618. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c +0 −1823
  619. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_local.h +0 −533
  620. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h +0 −116
  621. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq.c +0 −448
  622. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_local.h +0 −136
  623. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_private.h +0 −44
  624. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp.c +0 −129
  625. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp_local.h +0 −57
  626. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp_private.h +0 −157
  627. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c +0 −50
  628. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_local.h +0 −20
  629. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h +0 −44
  630. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp.c +0 −81
  631. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_local.h +0 −101
  632. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_private.h +0 −163
  633. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/system_local.h +0 −306
  634. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/timed_ctrl.c +0 −74
  635. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/timed_ctrl_local.h +0 −20
  636. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/timed_ctrl_private.h +0 −34
  637. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vamem_local.h +0 −20
  638. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vamem_private.h +0 −37
  639. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vmem.c +0 −258
  640. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vmem_local.h +0 −55
  641. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vmem_private.h +0 −20
  642. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_formatter_global.h +0 −114
  643. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_system_global.h +0 −155
  644. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/irq_global.h +0 −45
  645. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/isp_global.h +0 −115
  646. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/mmu_global.h +0 −22
  647. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/sp_global.h +0 −93
  648. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/system_global.h +0 −348
  649. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/timed_ctrl_global.h +0 −56
  650. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/vamem_global.h +0 −34
  651. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/vmem_global.h +0 −28
  652. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/assert_support.h +0 −102
  653. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bitop_support.h +0 −25
  654. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/csi_rx.h +0 −43
  655. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/debug.h +0 −47
  656. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/device_access/device_access.h +0 −194
  657. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/dma.h +0 −47
  658. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/error_support.h +0 −70
  659. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/event_fifo.h +0 −46
  660. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/fifo_monitor.h +0 −46
  661. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gdc_device.h +0 −48
  662. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_device.h +0 −46
  663. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_timer.h +0 −46
  664. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gpio.h +0 −46
  665. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/hmem.h +0 −46
  666. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/csi_rx_public.h +0 −135
  667. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/debug_public.h +0 −99
  668. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/dma_public.h +0 −73
  669. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/event_fifo_public.h +0 −79
  670. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/fifo_monitor_public.h +0 −110
  671. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gdc_public.h +0 −59
  672. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gp_device_public.h +0 −58
  673. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gp_timer_public.h +0 −34
  674. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gpio_public.h +0 −45
  675. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/hmem_public.h +0 −32
  676. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ibuf_ctrl_public.h +0 −93
  677. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_formatter_public.h +0 −115
  678. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_system_public.h +0 −376
  679. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/irq_public.h +0 −184
  680. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_public.h +0 −186
  681. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_dma_public.h +0 −38
  682. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_irq_public.h +0 −45
  683. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_public.h +0 −37
  684. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_stream2mmio_public.h +0 −101
  685. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h +0 −82
  686. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/pixelgen_public.h +0 −79
  687. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/sp_public.h +0 −223
  688. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/tag_public.h +0 −41
  689. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/timed_ctrl_public.h +0 −59
  690. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/vamem_public.h +0 −20
  691. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/vmem_public.h +0 −20
  692. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/ibuf_ctrl.h +0 −48
  693. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_formatter.h +0 −46
  694. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_system.h +0 −46
  695. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/irq.h +0 −46
  696. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isp.h +0 −46
  697. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_dma.h +0 −48
  698. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_irq.h +0 −39
  699. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_stream2mmio.h +0 −48
  700. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h +0 −223
  701. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/memory_access/memory_access.h +0 −174
  702. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/memory_realloc.h +0 −38
  703. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/misc_support.h +0 −26
  704. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h +0 −48
  705. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/pixelgen.h +0 −48
  706. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/platform_support.h +0 −41
  707. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/print_support.h +0 −44
  708. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/queue.h +0 −46
  709. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/resource.h +0 −47
  710. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/socket.h +0 −47
  711. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/sp.h +0 −46
  712. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h +0 −165
  713. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/system_types.h +0 −25
  714. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/tag.h +0 −45
  715. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/timed_ctrl.h +0 −46
  716. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/type_support.h +0 −40
  717. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vamem.h +0 −46
  718. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vmem.h +0 −46
  719. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/queue_local.h +0 −20
  720. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/queue_private.h +0 −18
  721. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/tag.c +0 −95
  722. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/tag_local.h +0 −22
  723. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/tag_private.h +0 −18
  724. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/queue_global.h +0 −19
  725. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/sw_event_global.h +0 −36
  726. drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/tag_global.h +0 −56
  727. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css.h +0 −57
  728. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_3a.h +0 −188
  729. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_acc_types.h +0 −468
  730. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_buffer.h +0 −84
  731. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_control.h +0 −157
  732. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_device_access.c +0 −95
  733. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_device_access.h +0 −59
  734. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_dvs.h +0 −299
  735. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_env.h +0 −94
  736. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_err.h +0 −63
  737. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_event_public.h +0 −196
  738. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_firmware.h +0 −74
  739. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frac.h +0 −37
  740. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_format.h +0 −101
  741. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_public.h +0 −352
  742. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_host_data.h +0 −46
  743. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_input_port.h +0 −60
  744. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_irq.h +0 −235
  745. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_memory_access.c +0 −83
  746. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_metadata.h +0 −71
  747. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h +0 −82
  748. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu.h +0 −32
  749. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu_private.h +0 −29
  750. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_morph.h +0 −39
  751. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe.h +0 −195
  752. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h +0 −579
  753. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_prbs.h +0 −53
  754. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_properties.h +0 −41
  755. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_shading.h +0 −40
  756. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream.h +0 −110
  757. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_format.h +0 −29
  758. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_public.h +0 −582
  759. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_timer.h +0 −84
  760. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_tpg.h +0 −78
  761. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_types.h +0 −616
  762. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_version.h +0 −40
  763. drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_version_data.h +0 −33
  764. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2.host.c +0 −32
  765. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2.host.h +0 −27
  766. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2_param.h +0 −24
  767. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2_types.h +0 −48
  768. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr.host.c +0 −60
  769. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr.host.h +0 −39
  770. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr_param.h +0 −25
  771. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr_types.h +0 −36
  772. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2.host.c +0 −46
  773. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2.host.h +0 −35
  774. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2_table.host.c +0 −52
  775. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2_table.host.h +0 −22
  776. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2_types.h +0 −32
  777. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr_param.h +0 −27
  778. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh.host.c +0 −66
  779. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh.host.h +0 −32
  780. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh_param.h +0 −40
  781. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh_types.h +0 −37
  782. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.c +0 −183
  783. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.h +0 −40
  784. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_param.h +0 −63
  785. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_types.h +0 −106
  786. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2.host.c +0 −122
  787. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2.host.h +0 −35
  788. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2_param.h +0 −47
  789. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2_types.h +0 −71
  790. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.c +0 −64
  791. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.h +0 −34
  792. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr_1.0/ia_css_bnr_param.h +0 −30
  793. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr.host.c +0 −28
  794. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr.host.h +0 −25
  795. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr_param.h +0 −24
  796. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2.host.c +0 −76
  797. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2.host.h +0 −43
  798. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2_param.h +0 −32
  799. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2_types.h +0 −55
  800. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr_param.h +0 −20
  801. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion.host.c +0 −36
  802. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion.host.h +0 −33
  803. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion_param.h +0 −28
  804. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion_types.h +0 −32
  805. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/copy_output/copy_output_1.0/ia_css_copy_output.host.c +0 −47
  806. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/copy_output/copy_output_1.0/ia_css_copy_output.host.h +0 −34
  807. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/copy_output/copy_output_1.0/ia_css_copy_output_param.h +0 −26
  808. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop.host.c +0 −64
  809. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop.host.h +0 −41
  810. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop_param.h +0 −32
  811. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop_types.h +0 −35
  812. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc.host.c +0 −132
  813. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc.host.h +0 −54
  814. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc_param.h +0 −34
  815. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc_types.h +0 −78
  816. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5.host.c +0 −120
  817. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5.host.h +0 −33
  818. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5_param.h +0 −46
  819. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc_param.h +0 −20
  820. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2.host.c +0 −156
  821. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2.host.h +0 −33
  822. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2_param.h +0 −49
  823. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2_types.h +0 −55
  824. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc.host.c +0 −63
  825. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc.host.h +0 −36
  826. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h +0 −44
  827. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c +0 −215
  828. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.h +0 −24
  829. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_types.h +0 −110
  830. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de.host.c +0 −79
  831. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de.host.h +0 −44
  832. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de_param.h +0 −27
  833. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de_state.h +0 −26
  834. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de_types.h +0 −43
  835. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2.host.c +0 −54
  836. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2.host.h +0 −38
  837. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2_param.h +0 −30
  838. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2_types.h +0 −42
  839. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de_param.h +0 −20
  840. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de_state.h +0 −21
  841. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp.host.c +0 −132
  842. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp.host.h +0 −47
  843. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp_param.h +0 −36
  844. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp_types.h +0 −50
  845. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.c +0 −65
  846. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.h +0 −39
  847. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_param.h +0 −53
  848. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_types.h +0 −59
  849. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c +0 −306
  850. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.h +0 −60
  851. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs_param.h +0 −39
  852. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs_types.h +0 −30
  853. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c +0 −321
  854. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.h +0 −45
  855. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_param.h +0 −154
  856. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_types.h +0 −86
  857. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats.host.c +0 −62
  858. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats.host.h +0 −45
  859. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats_param.h +0 −25
  860. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats_types.h +0 −38
  861. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h +0 −33
  862. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_types.h +0 −26
  863. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c +0 −89
  864. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.h +0 −44
  865. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn_param.h +0 −35
  866. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn_types.h +0 −52
  867. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc.host.c +0 −118
  868. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc.host.h +0 −65
  869. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_param.h +0 −61
  870. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c +0 −214
  871. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.h +0 −24
  872. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_types.h +0 −97
  873. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2.host.c +0 −110
  874. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2.host.h +0 −79
  875. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_param.h +0 −43
  876. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c +0 −132
  877. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_table.host.h +0 −26
  878. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_types.h +0 −54
  879. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr.host.c +0 −41
  880. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr.host.h +0 −31
  881. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr_param.h +0 −53
  882. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr_types.h +0 −64
  883. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io.host.c +0 −86
  884. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io.host.h +0 −31
  885. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io_param.h +0 −22
  886. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io_types.h +0 −22
  887. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/common/ia_css_common_io_param.h +0 −22
  888. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/common/ia_css_common_io_types.h +0 −31
  889. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv444_io_ls/ia_css_yuv444_io_param.h +0 −22
  890. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv444_io_ls/ia_css_yuv444_io_types.h +0 −22
  891. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c +0 −86
  892. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.h +0 −31
  893. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io_param.h +0 −22
  894. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io_types.h +0 −22
  895. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/common/ia_css_common_io_param.h +0 −22
  896. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/common/ia_css_common_io_types.h +0 −31
  897. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c +0 −86
  898. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.h +0 −31
  899. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io_param.h +0 −22
  900. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io_types.h +0 −22
  901. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c +0 −80
  902. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.h +0 −34
  903. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/iterator/iterator_1.0/ia_css_iterator_param.h +0 −38
  904. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5.host.c +0 −74
  905. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5.host.h +0 −41
  906. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_param.h +0 −31
  907. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_table.host.c +0 −32
  908. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_table.host.h +0 −22
  909. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_types.h +0 −74
  910. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc.host.c +0 −49
  911. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc.host.h +0 −42
  912. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_param.h +0 −25
  913. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_table.host.c +0 −47
  914. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_table.host.h +0 −23
  915. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_types.h +0 −63
  916. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm.host.c +0 −16
  917. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm.host.h +0 −20
  918. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm_param.h +0 −19
  919. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2.host.c +0 −79
  920. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2.host.h +0 −40
  921. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2_param.h +0 −29
  922. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2_types.h +0 −45
  923. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob.host.c +0 −159
  924. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob.host.h +0 −53
  925. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob_param.h +0 −48
  926. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob_types.h +0 −69
  927. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.c +0 −162
  928. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.h +0 −75
  929. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output_param.h +0 −36
  930. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output_types.h +0 −48
  931. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane.host.c +0 −61
  932. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane.host.h +0 −43
  933. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane_param.h +0 −30
  934. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane_types.h +0 −33
  935. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.c +0 −136
  936. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.h +0 −38
  937. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_param.h +0 −38
  938. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_types.h +0 −37
  939. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.c +0 −35
  940. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.h +0 −27
  941. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref.host.c +0 −74
  942. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref.host.h +0 −41
  943. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref_param.h +0 −36
  944. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref_state.h +0 −26
  945. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref_types.h +0 −28
  946. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c +0 −386
  947. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.h +0 −77
  948. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_param.h +0 −54
  949. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_types.h +0 −220
  950. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc.host.c +0 −130
  951. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc.host.h +0 −77
  952. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc_param.h +0 −71
  953. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc_types.h +0 −136
  954. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common.host.h +0 −99
  955. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h +0 −219
  956. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c +0 −423
  957. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.h +0 −101
  958. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis_types.h +0 −53
  959. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c +0 −338
  960. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.h +0 −95
  961. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2_types.h +0 −69
  962. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c +0 −76
  963. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.h +0 −38
  964. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_param.h +0 −43
  965. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_types.h +0 −53
  966. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr3/ia_css_tnr3_types.h +0 −61
  967. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c +0 −130
  968. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.h +0 −56
  969. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr_param.h +0 −48
  970. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr_state.h +0 −26
  971. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr_types.h +0 −60
  972. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/uds/uds_1.0/ia_css_uds_param.h +0 −31
  973. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c +0 −140
  974. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.h +0 −47
  975. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf_param.h +0 −37
  976. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf_types.h +0 −32
  977. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb.host.c +0 −89
  978. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb.host.h +0 −39
  979. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb_param.h +0 −29
  980. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb_types.h +0 −47
  981. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr.host.c +0 −66
  982. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr.host.h +0 −47
  983. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h +0 −51
  984. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c +0 −81
  985. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.h +0 −22
  986. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_types.h +0 −71
  987. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c +0 −265
  988. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.h +0 −42
  989. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3_param.h +0 −96
  990. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3_types.h +0 −98
  991. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr.host.c +0 −219
  992. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr.host.h +0 −60
  993. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr_param.h +0 −49
  994. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr_state.h +0 −26
  995. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr_types.h +0 −81
  996. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2.host.c +0 −125
  997. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2.host.h +0 −56
  998. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2_param.h +0 −45
  999. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2_types.h +0 −94
  1000. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr_param.h +0 −20
  1001. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr_state.h +0 −21
  1002. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/input_buf.isp.h +0 −73
  1003. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_const.h +0 −482
  1004. drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_types.h +0 −128
  1005. drivers/staging/media/atomisp/pci/atomisp2/css2400/memory_realloc.c +0 −81
  1006. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h +0 −257
  1007. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c +0 −1838
  1008. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/interface/ia_css_bufq.h +0 −197
  1009. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/interface/ia_css_bufq_comm.h +0 −66
  1010. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c +0 −589
  1011. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h +0 −509
  1012. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug_internal.h +0 −31
  1013. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug_pipe.h +0 −84
  1014. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c +0 −3596
  1015. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/event/interface/ia_css_event.h +0 −46
  1016. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/event/src/event.c +0 −126
  1017. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/eventq/interface/ia_css_eventq.h +0 −69
  1018. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/eventq/src/eventq.c +0 −77
  1019. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/interface/ia_css_frame.h +0 −180
  1020. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/interface/ia_css_frame_comm.h +0 −132
  1021. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c +0 −1026
  1022. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/interface/ia_css_ifmtr.h +0 −49
  1023. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c +0 −569
  1024. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/interface/ia_css_inputfifo.h +0 −69
  1025. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c +0 −613
  1026. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param.h +0 −118
  1027. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param_types.h +0 −98
  1028. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/src/isp_param.c +0 −227
  1029. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h +0 −201
  1030. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys_comm.h +0 −69
  1031. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.c +0 −179
  1032. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.h +0 −43
  1033. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c +0 −140
  1034. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.h +0 −55
  1035. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.c +0 −103
  1036. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.h +0 −41
  1037. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_init.c +0 −139
  1038. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_stream2mmio_rmgr.c +0 −105
  1039. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_stream2mmio_rmgr.h +0 −41
  1040. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c +0 −607
  1041. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.c +0 −898
  1042. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.h +0 −41
  1043. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline.h +0 −302
  1044. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline_common.h +0 −42
  1045. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c +0 −805
  1046. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/interface/ia_css_queue.h +0 −192
  1047. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/interface/ia_css_queue_comm.h +0 −69
  1048. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/src/queue.c +0 −412
  1049. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/src/queue_access.c +0 −192
  1050. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/src/queue_access.h +0 −101
  1051. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr.h +0 −88
  1052. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr_vbuf.h +0 −115
  1053. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr.c +0 −55
  1054. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c +0 −330
  1055. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/interface/ia_css_spctrl.h +0 −87
  1056. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/interface/ia_css_spctrl_comm.h +0 −61
  1057. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c +0 −193
  1058. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/tagger/interface/ia_css_tagger_common.h +0 −59
  1059. drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/timer/src/timer.c +0 −48
  1060. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c +0 −11094
  1061. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_defs.h +0 −410
  1062. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_dvs_info.h +0 −36
  1063. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c +0 −315
  1064. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.h +0 −54
  1065. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_frac.h +0 −40
  1066. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_host_data.c +0 −42
  1067. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c +0 −84
  1068. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.h +0 −34
  1069. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h +0 −1089
  1070. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_legacy.h +0 −77
  1071. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metadata.c +0 −16
  1072. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.c +0 −176
  1073. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.h +0 −55
  1074. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c +0 −749
  1075. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.h +0 −49
  1076. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mmu.c +0 −56
  1077. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_morph.c +0 −16
  1078. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_dvs.c +0 −267
  1079. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_dvs.h +0 −86
  1080. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.c +0 −417
  1081. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.h +0 −39
  1082. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c +0 −5253
  1083. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.h +0 −188
  1084. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params_internal.h +0 −21
  1085. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_pipe.c +0 −16
  1086. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_properties.c +0 −43
  1087. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_shading.c +0 −16
  1088. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c +0 −1803
  1089. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.h +0 −248
  1090. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream.c +0 −16
  1091. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.c +0 −76
  1092. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.h +0 −23
  1093. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_struct.h +0 −80
  1094. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_uds.h +0 −37
  1095. drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_version.c +0 −30
  1096. drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c +0 −727
  1097. drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c +0 −1528
  1098. drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c +0 −233
  1099. drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c +0 −252
  1100. drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_vm.c +0 −212
  1101. drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_custom_host_hrt.h +0 −103
  1102. drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c +0 −125
  1103. drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h +0 −56
  1104. drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm.h +0 −102
  1105. drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo.h +0 −319
  1106. drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_common.h +0 −96
  1107. drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_pool.h +0 −115
  1108. drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_vm.h +0 −64
  1109. drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h +0 −169
  1110. drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu_mrfld.h +0 −24
  1111. drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c +0 −584
  1112. drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c +0 −75
  1113. drivers/staging/media/atomisp/platform/Makefile +0 −5
  1114. drivers/staging/media/atomisp/platform/intel-mid/Makefile +0 −4
  1115. drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c +0 −785
  1116. drivers/staging/media/davinci_vpfe/Kconfig +2 −2
  1117. drivers/staging/media/davinci_vpfe/Makefile +5 −0
  1118. drivers/staging/media/davinci_vpfe/TODO +1 −0
  1119. drivers/staging/media/davinci_vpfe/dm365_ipipe.c +65 −78
  1120. drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c +3 −16
  1121. drivers/staging/media/davinci_vpfe/dm365_ipipeif.c +7 −7
  1122. drivers/staging/media/davinci_vpfe/dm365_isif.c +2 −7
  1123. drivers/staging/media/davinci_vpfe/dm365_resizer.c +8 −7
  1124. drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c +1 −1
  1125. drivers/staging/media/davinci_vpfe/vpfe_video.c +1 −3
  1126. drivers/staging/media/imx/imx-media-capture.c +2 −2
  1127. drivers/staging/media/imx/imx-media-csi.c +2 −1
  1128. drivers/staging/media/imx/imx-media-utils.c +9 −0
  1129. drivers/staging/media/omap4iss/Kconfig +2 −2
  1130. drivers/staging/media/tegra-vde/tegra-vde.c +67 −31
  1131. drivers/staging/media/zoran/Kconfig +1 −1
  1132. drivers/staging/media/zoran/Makefile +0 −0
  1133. drivers/staging/media/zoran/TODO +4 −0
  1134. drivers/staging/media/zoran/videocodec.c +0 −0
  1135. drivers/staging/media/zoran/videocodec.h +0 −0
  1136. drivers/staging/media/zoran/zoran.h +0 −0
  1137. drivers/staging/media/zoran/zoran_card.c +0 −0
  1138. drivers/staging/media/zoran/zoran_card.h +0 −0
  1139. drivers/staging/media/zoran/zoran_device.c +0 −0
  1140. drivers/staging/media/zoran/zoran_device.h +0 −0
  1141. drivers/staging/media/zoran/zoran_driver.c +2 −2
  1142. drivers/staging/media/zoran/zoran_procfs.c +0 −0
  1143. drivers/staging/media/zoran/zoran_procfs.h +0 −0
  1144. drivers/staging/media/zoran/zr36016.c +0 −0
  1145. drivers/staging/media/zoran/zr36016.h +0 −0
  1146. drivers/staging/media/zoran/zr36050.c +0 −0
  1147. drivers/staging/media/zoran/zr36050.h +0 −0
  1148. drivers/staging/media/zoran/zr36057.h +0 −0
  1149. drivers/staging/media/zoran/zr36060.c +0 −0
  1150. drivers/staging/media/zoran/zr36060.h +0 −0
  1151. drivers/video/fbdev/omap2/Kconfig +1 −1
  1152. include/linux/omap-iommu.h +5 −0
  1153. include/linux/platform_data/media/mmp-camera.h +19 −0
  1154. include/linux/sony-laptop.h +4 −0
  1155. include/media/dvb-usb-ids.h +1 −0
  1156. include/media/dvbdev.h +2 −0
  1157. include/media/media-entity.h +1 −1
  1158. include/media/rc-core.h +1 −0
  1159. include/media/v4l2-dev.h +1 −24
  1160. include/media/v4l2-device.h +1 −3
  1161. include/media/v4l2-fwnode.h +1 −1
  1162. include/media/v4l2-ioctl.h +0 −12
  1163. include/media/videobuf-dvb.h +0 −59
  1164. include/media/vsp1.h +43 −2
  1165. include/uapi/linux/lirc.h +6 −0
  1166. include/uapi/linux/omap3isp.h +22 −0
  1167. include/video/omapfb_dss.h +52 −2
  1168. sound/isa/Kconfig +2 −1
Documentation/ABI/testing/sysfs-class-rc+8−8
@@ -1,7 +1,7 @@
11 What: /sys/class/rc/
22 Date: Apr 2010
33 KernelVersion: 2.6.35
4−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
4+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
55 Description:
66 The rc/ class sub-directory belongs to the Remote Controller
77 core and provides a sysfs interface for configuring infrared
@@ -10,7 +10,7 @@ Description: · 2 unmodified lines
1010 What: /sys/class/rc/rcN/
1111 Date: Apr 2010
1212 KernelVersion: 2.6.35
13−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
13+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
1414 Description:
1515 A /sys/class/rc/rcN directory is created for each remote
1616 control receiver device where N is the number of the receiver.
@@ -18,7 +18,7 @@ Description: · 1 unmodified line
1818 What: /sys/class/rc/rcN/protocols
1919 Date: Jun 2010
2020 KernelVersion: 2.6.36
21−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
21+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2222 Description:
2323 Reading this file returns a list of available protocols,
2424 something like:
@@ -36,7 +36,7 @@ Description: · 11 unmodified lines
3636 What: /sys/class/rc/rcN/filter
3737 Date: Jan 2014
3838 KernelVersion: 3.15
39−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
39+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
4040 Description:
4141 Sets the scancode filter expected value.
4242 Use in combination with /sys/class/rc/rcN/filter_mask to set the
@@ -49,7 +49,7 @@ Description: · 6 unmodified lines
4949 What: /sys/class/rc/rcN/filter_mask
5050 Date: Jan 2014
5151 KernelVersion: 3.15
52−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
52+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
5353 Description:
5454 Sets the scancode filter mask of bits to compare.
5555 Use in combination with /sys/class/rc/rcN/filter to set the bits
@@ -64,7 +64,7 @@ Description: · 8 unmodified lines
6464 What: /sys/class/rc/rcN/wakeup_protocols
6565 Date: Feb 2017
6666 KernelVersion: 4.11
67−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
67+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
6868 Description:
6969 Reading this file returns a list of available protocols to use
7070 for the wakeup filter, something like:
@@ -83,7 +83,7 @@ Description: · 12 unmodified lines
8383 What: /sys/class/rc/rcN/wakeup_filter
8484 Date: Jan 2014
8585 KernelVersion: 3.15
86−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
86+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
8787 Description:
8888 Sets the scancode wakeup filter expected value.
8989 Use in combination with /sys/class/rc/rcN/wakeup_filter_mask to
@@ -98,7 +98,7 @@ Description: · 8 unmodified lines
9898 What: /sys/class/rc/rcN/wakeup_filter_mask
9999 Date: Jan 2014
100100 KernelVersion: 3.15
101−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
101+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
102102 Description:
103103 Sets the scancode wakeup filter mask of bits to compare.
104104 Use in combination with /sys/class/rc/rcN/wakeup_filter to set
Documentation/ABI/testing/sysfs-class-rc-nuvoton+1−1
@@ -1,7 +1,7 @@
11 What: /sys/class/rc/rcN/wakeup_data
22 Date: Mar 2016
33 KernelVersion: 4.6
4−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
4+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
55 Description:
66 Reading this file returns the stored CIR wakeup sequence.
77 It starts with a pulse, followed by a space, pulse etc.
Documentation/ABI/testing/sysfs-devices-edac+7−7
@@ -77,7 +77,7 @@ Description: Read/Write attribute file that controls memory scrubbing. · 76 unmodified lines
7777
7878 What: /sys/devices/system/edac/mc/mc*/max_location
7979 Date: April 2012
80−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
80+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
8181 linux-edac@vger.kernel.org
8282 Description: This attribute file displays the information about the last
8383 available memory slot in this memory controller. It is used by
@@ -85,7 +85,7 @@ Description: This attribute file displays the information about the last · 1 unmodified line
8585
8686 What: /sys/devices/system/edac/mc/mc*/(dimm|rank)*/size
8787 Date: April 2012
88−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
88+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
8989 linux-edac@vger.kernel.org
9090 Description: This attribute file will display the size of dimm or rank.
9191 For dimm*/size, this is the size, in MB of the DIMM memory
@@ -96,14 +96,14 @@ Description: This attribute file will display the size of dimm or rank. · 4 unmodified lines
9696
9797 What: /sys/devices/system/edac/mc/mc*/(dimm|rank)*/dimm_dev_type
9898 Date: April 2012
99−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
99+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
100100 linux-edac@vger.kernel.org
101101 Description: This attribute file will display what type of DRAM device is
102102 being utilized on this DIMM (x1, x2, x4, x8, ...).
103103
104104 What: /sys/devices/system/edac/mc/mc*/(dimm|rank)*/dimm_edac_mode
105105 Date: April 2012
106−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
106+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
107107 linux-edac@vger.kernel.org
108108 Description: This attribute file will display what type of Error detection
109109 and correction is being utilized. For example: S4ECD4ED would
@@ -111,7 +111,7 @@ Description: This attribute file will display what type of Error detection · 1 unmodified line
111111
112112 What: /sys/devices/system/edac/mc/mc*/(dimm|rank)*/dimm_label
113113 Date: April 2012
114−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
114+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
115115 linux-edac@vger.kernel.org
116116 Description: This control file allows this DIMM to have a label assigned
117117 to it. With this label in the module, when errors occur
@@ -126,14 +126,14 @@ Description: This control file allows this DIMM to have a label assigned · 8 unmodified lines
126126
127127 What: /sys/devices/system/edac/mc/mc*/(dimm|rank)*/dimm_location
128128 Date: April 2012
129−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
129+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
130130 linux-edac@vger.kernel.org
131131 Description: This attribute file will display the location (csrow/channel,
132132 branch/channel/slot or channel/slot) of the dimm or rank.
133133
134134 What: /sys/devices/system/edac/mc/mc*/(dimm|rank)*/dimm_mem_type
135135 Date: April 2012
136−Contact: Mauro Carvalho Chehab <m.chehab@samsung.com>
136+Contact: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
137137 linux-edac@vger.kernel.org
138138 Description: This attribute file will display what type of memory is
139139 currently on this csrow. Normally, either buffered or
Documentation/devicetree/bindings/media/cdns,csi2rx.txt+100−0
@@ -0,0 +1,100 @@
1+Cadence MIPI-CSI2 RX controller
2+===============================
3+
4+The Cadence MIPI-CSI2 RX controller is a CSI-2 bridge supporting up to 4 CSI
5+lanes in input, and 4 different pixel streams in output.
6+
7+Required properties:
8+ - compatible: must be set to "cdns,csi2rx" and an SoC-specific compatible
9+ - reg: base address and size of the memory mapped region
10+ - clocks: phandles to the clocks driving the controller
11+ - clock-names: must contain:
12+ * sys_clk: main clock
13+ * p_clk: register bank clock
14+ * pixel_if[0-3]_clk: pixel stream output clock, one for each stream
15+ implemented in hardware, between 0 and 3
16+
17+Optional properties:
18+ - phys: phandle to the external D-PHY, phy-names must be provided
19+ - phy-names: must contain "dphy", if the implementation uses an
20+ external D-PHY
21+
22+Required subnodes:
23+ - ports: A ports node with one port child node per device input and output
24+ port, in accordance with the video interface bindings defined in
25+ Documentation/devicetree/bindings/media/video-interfaces.txt. The
26+ port nodes are numbered as follows:
27+
28+ Port Description
29+ -----------------------------
30+ 0 CSI-2 input
31+ 1 Stream 0 output
32+ 2 Stream 1 output
33+ 3 Stream 2 output
34+ 4 Stream 3 output
35+
36+ The stream output port nodes are optional if they are not
37+ connected to anything at the hardware level or implemented
38+ in the design.Since there is only one endpoint per port,
39+ the endpoints are not numbered.
40+
41+
42+Example:
43+
44+csi2rx: csi-bridge@0d060000 {
45+ compatible = "cdns,csi2rx";
46+ reg = <0x0d060000 0x1000>;
47+ clocks = <&byteclock>, <&byteclock>
48+ <&coreclock>, <&coreclock>,
49+ <&coreclock>, <&coreclock>;
50+ clock-names = "sys_clk", "p_clk",
51+ "pixel_if0_clk", "pixel_if1_clk",
52+ "pixel_if2_clk", "pixel_if3_clk";
53+
54+ ports {
55+ #address-cells = <1>;
56+ #size-cells = <0>;
57+
58+ port@0 {
59+ reg = <0>;
60+
61+ csi2rx_in_sensor: endpoint {
62+ remote-endpoint = <&sensor_out_csi2rx>;
63+ clock-lanes = <0>;
64+ data-lanes = <1 2>;
65+ };
66+ };
67+
68+ port@1 {
69+ reg = <1>;
70+
71+ csi2rx_out_grabber0: endpoint {
72+ remote-endpoint = <&grabber0_in_csi2rx>;
73+ };
74+ };
75+
76+ port@2 {
77+ reg = <2>;
78+
79+ csi2rx_out_grabber1: endpoint {
80+ remote-endpoint = <&grabber1_in_csi2rx>;
81+ };
82+ };
83+
84+ port@3 {
85+ reg = <3>;
86+
87+ csi2rx_out_grabber2: endpoint {
88+ remote-endpoint = <&grabber2_in_csi2rx>;
89+ };
90+ };
91+
92+ port@4 {
93+ reg = <4>;
94+
95+ csi2rx_out_grabber3: endpoint {
96+ remote-endpoint = <&grabber3_in_csi2rx>;
97+ };
98+ };
99+ };
100+};
Documentation/devicetree/bindings/media/cdns,csi2tx.txt+98−0
@@ -0,0 +1,98 @@
1+Cadence MIPI-CSI2 TX controller
2+===============================
3+
4+The Cadence MIPI-CSI2 TX controller is a CSI-2 bridge supporting up to
5+4 CSI lanes in output, and up to 4 different pixel streams in input.
6+
7+Required properties:
8+ - compatible: must be set to "cdns,csi2tx"
9+ - reg: base address and size of the memory mapped region
10+ - clocks: phandles to the clocks driving the controller
11+ - clock-names: must contain:
12+ * esc_clk: escape mode clock
13+ * p_clk: register bank clock
14+ * pixel_if[0-3]_clk: pixel stream output clock, one for each stream
15+ implemented in hardware, between 0 and 3
16+
17+Optional properties
18+ - phys: phandle to the D-PHY. If it is set, phy-names need to be set
19+ - phy-names: must contain "dphy"
20+
21+Required subnodes:
22+ - ports: A ports node with one port child node per device input and output
23+ port, in accordance with the video interface bindings defined in
24+ Documentation/devicetree/bindings/media/video-interfaces.txt. The
25+ port nodes are numbered as follows.
26+
27+ Port Description
28+ -----------------------------
29+ 0 CSI-2 output
30+ 1 Stream 0 input
31+ 2 Stream 1 input
32+ 3 Stream 2 input
33+ 4 Stream 3 input
34+
35+ The stream input port nodes are optional if they are not
36+ connected to anything at the hardware level or implemented
37+ in the design. Since there is only one endpoint per port,
38+ the endpoints are not numbered.
39+
40+Example:
41+
42+csi2tx: csi-bridge@0d0e1000 {
43+ compatible = "cdns,csi2tx";
44+ reg = <0x0d0e1000 0x1000>;
45+ clocks = <&byteclock>, <&byteclock>,
46+ <&coreclock>, <&coreclock>,
47+ <&coreclock>, <&coreclock>;
48+ clock-names = "p_clk", "esc_clk",
49+ "pixel_if0_clk", "pixel_if1_clk",
50+ "pixel_if2_clk", "pixel_if3_clk";
51+
52+ ports {
53+ #address-cells = <1>;
54+ #size-cells = <0>;
55+
56+ port@0 {
57+ reg = <0>;
58+
59+ csi2tx_out: endpoint {
60+ remote-endpoint = <&remote_in>;
61+ clock-lanes = <0>;
62+ data-lanes = <1 2>;
63+ };
64+ };
65+
66+ port@1 {
67+ reg = <1>;
68+
69+ csi2tx_in_stream0: endpoint {
70+ remote-endpoint = <&stream0_out>;
71+ };
72+ };
73+
74+ port@2 {
75+ reg = <2>;
76+
77+ csi2tx_in_stream1: endpoint {
78+ remote-endpoint = <&stream1_out>;
79+ };
80+ };
81+
82+ port@3 {
83+ reg = <3>;
84+
85+ csi2tx_in_stream2: endpoint {
86+ remote-endpoint = <&stream2_out>;
87+ };
88+ };
89+
90+ port@4 {
91+ reg = <4>;
92+
93+ csi2tx_in_stream3: endpoint {
94+ remote-endpoint = <&stream3_out>;
95+ };
96+ };
97+ };
98+};
Documentation/devicetree/bindings/media/i2c/ov7251.txt+52−0
@@ -0,0 +1,52 @@
1+* Omnivision 1/7.5-Inch B&W VGA CMOS Digital Image Sensor
2+
3+The Omnivision OV7251 is a 1/7.5-Inch CMOS active pixel digital image sensor
4+with an active array size of 640H x 480V. It is programmable through a serial
5+I2C interface.
6+
7+Required Properties:
8+- compatible: Value should be "ovti,ov7251".
9+- clocks: Reference to the xclk clock.
10+- clock-names: Should be "xclk".
11+- clock-frequency: Frequency of the xclk clock.
12+- enable-gpios: Chip enable GPIO. Polarity is GPIO_ACTIVE_HIGH. This corresponds
13+ to the hardware pin XSHUTDOWN which is physically active low.
14+- vdddo-supply: Chip digital IO regulator.
15+- vdda-supply: Chip analog regulator.
16+- vddd-supply: Chip digital core regulator.
17+
18+The device node shall contain one 'port' child node with a single 'endpoint'
19+subnode for its digital output video port, in accordance with the video
20+interface bindings defined in
21+Documentation/devicetree/bindings/media/video-interfaces.txt.
22+
23+Example:
24+
25+ &i2c1 {
26+ ...
27+
28+ ov7251: camera-sensor@60 {
29+ compatible = "ovti,ov7251";
30+ reg = <0x60>;
31+
32+ enable-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
33+ pinctrl-names = "default";
34+ pinctrl-0 = <&camera_bw_default>;
35+
36+ clocks = <&clks 200>;
37+ clock-names = "xclk";
38+ clock-frequency = <24000000>;
39+
40+ vdddo-supply = <&camera_dovdd_1v8>;
41+ vdda-supply = <&camera_avdd_2v8>;
42+ vddd-supply = <&camera_dvdd_1v2>;
43+
44+ port {
45+ ov7251_ep: endpoint {
46+ clock-lanes = <1>;
47+ data-lanes = <0>;
48+ remote-endpoint = <&csi0_ep>;
49+ };
50+ };
51+ };
52+ };
Documentation/devicetree/bindings/media/i2c/ov772x.txt+40−0
@@ -0,0 +1,40 @@
1+* Omnivision OV7720/OV7725 CMOS sensor
2+
3+The Omnivision OV7720/OV7725 sensor supports multiple resolutions output,
4+such as VGA, QVGA, and any size scaling down from CIF to 40x30. It also can
5+support the YUV422, RGB565/555/444, GRB422 or raw RGB output formats.
6+
7+Required Properties:
8+- compatible: shall be one of
9+ "ovti,ov7720"
10+ "ovti,ov7725"
11+- clocks: reference to the xclk input clock.
12+
13+Optional Properties:
14+- reset-gpios: reference to the GPIO connected to the RSTB pin which is
15+ active low, if any.
16+- powerdown-gpios: reference to the GPIO connected to the PWDN pin which is
17+ active high, if any.
18+
19+The device node shall contain one 'port' child node with one child 'endpoint'
20+subnode for its digital output video port, in accordance with the video
21+interface bindings defined in Documentation/devicetree/bindings/media/
22+video-interfaces.txt.
23+
24+Example:
25+
26+&i2c0 {
27+ ov772x: camera@21 {
28+ compatible = "ovti,ov7725";
29+ reg = <0x21>;
30+ reset-gpios = <&axi_gpio_0 0 GPIO_ACTIVE_LOW>;
31+ powerdown-gpios = <&axi_gpio_0 1 GPIO_ACTIVE_LOW>;
32+ clocks = <&xclk>;
33+
34+ port {
35+ ov772x_0: endpoint {
36+ remote-endpoint = <&vcap1_in0>;
37+ };
38+ };
39+ };
40+};
Documentation/devicetree/bindings/media/i2c/panasonic,amg88xx.txt+19−0
@@ -0,0 +1,19 @@
1+* Panasonic AMG88xx
2+
3+The Panasonic family of AMG88xx Grid-Eye sensors allow recording
4+8x8 10Hz video which consists of thermal datapoints
5+
6+Required Properties:
7+ - compatible : Must be "panasonic,amg88xx"
8+ - reg : i2c address of the device
9+
10+Example:
11+
12+ i2c0@1c22000 {
13+ ...
14+ amg88xx@69 {
15+ compatible = "panasonic,amg88xx";
16+ reg = <0x69>;
17+ };
18+ ...
19+ };
Documentation/devicetree/bindings/media/rcar_vin.txt+117−21
@@ -2,20 +2,28 @@ Renesas R-Car Video Input driver (rcar_vin) · 1 unmodified line
22 -------------------------------------------
33
44 The rcar_vin device provides video input capabilities for the Renesas R-Car
5−family of devices. The current blocks are always slaves and suppot one input
6−channel which can be either RGB, YUYV or BT656.
5+family of devices.
6+
7+Each VIN instance has a single parallel input that supports RGB and YUV video,
8+with both external synchronization and BT.656 synchronization for the latter.
9+Depending on the instance the VIN input is connected to external SoC pins, or
10+on Gen3 platforms to a CSI-2 receiver.
711
812 - compatible: Must be one or more of the following
9− - "renesas,vin-r8a7795" for the R8A7795 device
10− - "renesas,vin-r8a7794" for the R8A7794 device
11− - "renesas,vin-r8a7793" for the R8A7793 device
12− - "renesas,vin-r8a7792" for the R8A7792 device
13− - "renesas,vin-r8a7791" for the R8A7791 device
14− - "renesas,vin-r8a7790" for the R8A7790 device
15− - "renesas,vin-r8a7779" for the R8A7779 device
13+ - "renesas,vin-r8a7743" for the R8A7743 device
14+ - "renesas,vin-r8a7745" for the R8A7745 device
1615 - "renesas,vin-r8a7778" for the R8A7778 device
17− - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 compatible device.
18− - "renesas,rcar-gen3-vin" for a generic R-Car Gen3 compatible device.
16+ - "renesas,vin-r8a7779" for the R8A7779 device
17+ - "renesas,vin-r8a7790" for the R8A7790 device
18+ - "renesas,vin-r8a7791" for the R8A7791 device
19+ - "renesas,vin-r8a7792" for the R8A7792 device
20+ - "renesas,vin-r8a7793" for the R8A7793 device
21+ - "renesas,vin-r8a7794" for the R8A7794 device
22+ - "renesas,vin-r8a7795" for the R8A7795 device
23+ - "renesas,vin-r8a7796" for the R8A7796 device
24+ - "renesas,vin-r8a77970" for the R8A77970 device
25+ - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 or RZ/G1 compatible
26+ device.
1927
2028 When compatible with the generic version nodes must list the
2129 SoC-specific version corresponding to the platform first
@@ -28,21 +36,38 @@ channel which can be either RGB, YUYV or BT656. · 6 unmodified lines
2836 Additionally, an alias named vinX will need to be created to specify
2937 which video input device this is.
3038
31−The per-board settings:
39+The per-board settings Gen2 platforms:
3240 - port sub-node describing a single endpoint connected to the vin
3341 as described in video-interfaces.txt[1]. Only the first one will
3442 be considered as each vin interface has one input port.
3543
36− These settings are used to work out video input format and widths
37− into the system.
44+The per-board settings Gen3 platforms:
3845
46+Gen3 platforms can support both a single connected parallel input source
47+from external SoC pins (port0) and/or multiple parallel input sources
48+from local SoC CSI-2 receivers (port1) depending on SoC.
3949
40−Device node example
41−-------------------
50+- renesas,id - ID number of the VIN, VINx in the documentation.
51+- ports
52+ - port 0 - sub-node describing a single endpoint connected to the VIN
53+ from external SoC pins described in video-interfaces.txt[1].
54+ Describing more then one endpoint in port 0 is invalid. Only VIN
55+ instances that are connected to external pins should have port 0.
56+ - port 1 - sub-nodes describing one or more endpoints connected to
57+ the VIN from local SoC CSI-2 receivers. The endpoint numbers must
58+ use the following schema.
4259
43− aliases {
44− vin0 = &vin0;
45− };
60+ - Endpoint 0 - sub-node describing the endpoint connected to CSI20
61+ - Endpoint 1 - sub-node describing the endpoint connected to CSI21
62+ - Endpoint 2 - sub-node describing the endpoint connected to CSI40
63+ - Endpoint 3 - sub-node describing the endpoint connected to CSI41
64+
65+Device node example for Gen2 platforms
66+--------------------------------------
67+
68+ aliases {
69+ vin0 = &vin0;
70+ };
4671
4772 vin0: vin@e6ef0000 {
4873 compatible = "renesas,vin-r8a7790", "renesas,rcar-gen2-vin";
@@ -52,8 +77,8 @@ Device node example · 3 unmodified lines
5277 status = "disabled";
5378 };
5479
55−Board setup example (vin1 composite video input)
56−------------------------------------------------
80+Board setup example for Gen2 platforms (vin1 composite video input)
81+-------------------------------------------------------------------
5782
5883 &i2c2 {
5984 status = "okay";
@@ -92,6 +117,77 @@ Board setup example (vin1 composite video input) · 32 unmodified lines
92117 };
93118 };
94119
120+Device node example for Gen3 platforms
121+--------------------------------------
122+
123+ vin0: video@e6ef0000 {
124+ compatible = "renesas,vin-r8a7795";
125+ reg = <0 0xe6ef0000 0 0x1000>;
126+ interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>;
127+ clocks = <&cpg CPG_MOD 811>;
128+ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
129+ resets = <&cpg 811>;
130+ renesas,id = <0>;
131+
132+ ports {
133+ #address-cells = <1>;
134+ #size-cells = <0>;
135+
136+ port@1 {
137+ #address-cells = <1>;
138+ #size-cells = <0>;
139+
140+ reg = <1>;
141+
142+ vin0csi20: endpoint@0 {
143+ reg = <0>;
144+ remote-endpoint= <&csi20vin0>;
145+ };
146+ vin0csi21: endpoint@1 {
147+ reg = <1>;
148+ remote-endpoint= <&csi21vin0>;
149+ };
150+ vin0csi40: endpoint@2 {
151+ reg = <2>;
152+ remote-endpoint= <&csi40vin0>;
153+ };
154+ };
155+ };
156+ };
95157
158+ csi20: csi2@fea80000 {
159+ compatible = "renesas,r8a7795-csi2";
160+ reg = <0 0xfea80000 0 0x10000>;
161+ interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
162+ clocks = <&cpg CPG_MOD 714>;
163+ power-domains = <&sysc R8A7795_PD_ALWAYS_ON>;
164+ resets = <&cpg 714>;
165+
166+ ports {
167+ #address-cells = <1>;
168+ #size-cells = <0>;
169+
170+ port@0 {
171+ reg = <0>;
172+ csi20_in: endpoint {
173+ clock-lanes = <0>;
174+ data-lanes = <1>;
175+ remote-endpoint = <&adv7482_txb>;
176+ };
177+ };
178+
179+ port@1 {
180+ #address-cells = <1>;
181+ #size-cells = <0>;
182+
183+ reg = <1>;
184+
185+ csi20vin0: endpoint@0 {
186+ reg = <0>;
187+ remote-endpoint = <&vin0csi20>;
188+ };
189+ };
190+ };
191+ };
96192
97193 [1] video-interfaces.txt common video media interface
Documentation/devicetree/bindings/media/renesas,ceu.txt+4−3
@@ -2,14 +2,15 @@ Renesas Capture Engine Unit (CEU) · 1 unmodified line
22 ----------------------------------------------
33
44 The Capture Engine Unit is the image capture interface found in the Renesas
5−SH Mobile and RZ SoCs.
5+SH Mobile, R-Mobile and RZ SoCs.
66
77 The interface supports a single parallel input with data bus width of 8 or 16
88 bits.
99
1010 Required properties:
11−- compatible: Shall be "renesas,r7s72100-ceu" for CEU units found in RZ/A1H
12− and RZ/A1M SoCs.
11+- compatible: Shall be one of the following values:
12+ "renesas,r7s72100-ceu" for CEU units found in RZ/A1H and RZ/A1M SoCs
13+ "renesas,r8a7740-ceu" for CEU units found in R-Mobile A1 R8A7740 SoCs
1314 - reg: Registers address base and size.
1415 - interrupts: The interrupt specifier.
1516
Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt+101−0
@@ -0,0 +1,101 @@
1+Renesas R-Car MIPI CSI-2
2+------------------------
3+
4+The R-Car CSI-2 receiver device provides MIPI CSI-2 capabilities for the
5+Renesas R-Car family of devices. It is used in conjunction with the
6+R-Car VIN module, which provides the video capture capabilities.
7+
8+Mandatory properties
9+--------------------
10+ - compatible: Must be one or more of the following
11+ - "renesas,r8a7795-csi2" for the R8A7795 device.
12+ - "renesas,r8a7796-csi2" for the R8A7796 device.
13+ - "renesas,r8a77965-csi2" for the R8A77965 device.
14+ - "renesas,r8a77970-csi2" for the R8A77970 device.
15+
16+ - reg: the register base and size for the device registers
17+ - interrupts: the interrupt for the device
18+ - clocks: reference to the parent clock
19+
20+The device node shall contain two 'port' child nodes according to the
21+bindings defined in Documentation/devicetree/bindings/media/
22+video-interfaces.txt. port@0 shall connect to the CSI-2 source. port@1
23+shall connect to all the R-Car VIN modules that have a hardware
24+connection to the CSI-2 receiver.
25+
26+- port@0- Video source (mandatory)
27+ - endpoint@0 - sub-node describing the endpoint that is the video source
28+
29+- port@1 - VIN instances (optional)
30+ - One endpoint sub-node for every R-Car VIN instance which is connected
31+ to the R-Car CSI-2 receiver.
32+
33+Example:
34+
35+ csi20: csi2@fea80000 {
36+ compatible = "renesas,r8a7796-csi2";
37+ reg = <0 0xfea80000 0 0x10000>;
38+ interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;
39+ clocks = <&cpg CPG_MOD 714>;
40+ power-domains = <&sysc R8A7796_PD_ALWAYS_ON>;
41+ resets = <&cpg 714>;
42+
43+ ports {
44+ #address-cells = <1>;
45+ #size-cells = <0>;
46+
47+ port@0 {
48+ #address-cells = <1>;
49+ #size-cells = <0>;
50+
51+ reg = <0>;
52+
53+ csi20_in: endpoint@0 {
54+ reg = <0>;
55+ clock-lanes = <0>;
56+ data-lanes = <1>;
57+ remote-endpoint = <&adv7482_txb>;
58+ };
59+ };
60+
61+ port@1 {
62+ #address-cells = <1>;
63+ #size-cells = <0>;
64+
65+ reg = <1>;
66+
67+ csi20vin0: endpoint@0 {
68+ reg = <0>;
69+ remote-endpoint = <&vin0csi20>;
70+ };
71+ csi20vin1: endpoint@1 {
72+ reg = <1>;
73+ remote-endpoint = <&vin1csi20>;
74+ };
75+ csi20vin2: endpoint@2 {
76+ reg = <2>;
77+ remote-endpoint = <&vin2csi20>;
78+ };
79+ csi20vin3: endpoint@3 {
80+ reg = <3>;
81+ remote-endpoint = <&vin3csi20>;
82+ };
83+ csi20vin4: endpoint@4 {
84+ reg = <4>;
85+ remote-endpoint = <&vin4csi20>;
86+ };
87+ csi20vin5: endpoint@5 {
88+ reg = <5>;
89+ remote-endpoint = <&vin5csi20>;
90+ };
91+ csi20vin6: endpoint@6 {
92+ reg = <6>;
93+ remote-endpoint = <&vin6csi20>;
94+ };
95+ csi20vin7: endpoint@7 {
96+ reg = <7>;
97+ remote-endpoint = <&vin7csi20>;
98+ };
99+ };
100+ };
101+ };
Documentation/media/kapi/cec-core.rst+4−1
@@ -246,7 +246,10 @@ CEC_TX_STATUS_LOW_DRIVE: · 245 unmodified lines
246246 CEC_TX_STATUS_ERROR:
247247 some unspecified error occurred: this can be one of ARB_LOST
248248 or LOW_DRIVE if the hardware cannot differentiate or something
249− else entirely.
249+ else entirely. Some hardware only supports OK and FAIL as the
250+ result of a transmit, i.e. there is no way to differentiate
251+ between the different possible errors. In that case map FAIL
252+ to CEC_TX_STATUS_NACK and not to CEC_TX_STATUS_ERROR.
250253
251254 CEC_TX_STATUS_MAX_RETRIES:
252255 could not transmit the message after trying multiple times.
Documentation/media/uapi/cec/cec-ioc-receive.rst+15−9
@@ -231,26 +231,32 @@ View On' messages from initiator 0xf ('Unregistered') to destination 0 ('TV'). · 230 unmodified lines
231231 - ``CEC_TX_STATUS_OK``
232232 - 0x01
233233 - The message was transmitted successfully. This is mutually
234− exclusive with :ref:`CEC_TX_STATUS_MAX_RETRIES <CEC-TX-STATUS-MAX-RETRIES>`. Other bits can still
235− be set if earlier attempts met with failure before the transmit
236− was eventually successful.
234+ exclusive with :ref:`CEC_TX_STATUS_MAX_RETRIES <CEC-TX-STATUS-MAX-RETRIES>`.
235+ Other bits can still be set if earlier attempts met with failure before
236+ the transmit was eventually successful.
237237 * .. _`CEC-TX-STATUS-ARB-LOST`:
238238
239239 - ``CEC_TX_STATUS_ARB_LOST``
240240 - 0x02
241− - CEC line arbitration was lost.
241+ - CEC line arbitration was lost, i.e. another transmit started at the
242+ same time with a higher priority. Optional status, not all hardware
243+ can detect this error condition.
242244 * .. _`CEC-TX-STATUS-NACK`:
243245
244246 - ``CEC_TX_STATUS_NACK``
245247 - 0x04
246− - Message was not acknowledged.
248+ - Message was not acknowledged. Note that some hardware cannot tell apart
249+ a 'Not Acknowledged' status from other error conditions, i.e. the result
250+ of a transmit is just OK or FAIL. In that case this status will be
251+ returned when the transmit failed.
247252 * .. _`CEC-TX-STATUS-LOW-DRIVE`:
248253
249254 - ``CEC_TX_STATUS_LOW_DRIVE``
250255 - 0x08
251256 - Low drive was detected on the CEC bus. This indicates that a
252257 follower detected an error on the bus and requests a
253− retransmission.
258+ retransmission. Optional status, not all hardware can detect this
259+ error condition.
254260 * .. _`CEC-TX-STATUS-ERROR`:
255261
256262 - ``CEC_TX_STATUS_ERROR``
@@ -258,14 +264,14 @@ View On' messages from initiator 0xf ('Unregistered') to destination 0 ('TV'). · 1 unmodified line
258264 - Some error occurred. This is used for any errors that do not fit
259265 ``CEC_TX_STATUS_ARB_LOST`` or ``CEC_TX_STATUS_LOW_DRIVE``, either because
260266 the hardware could not tell which error occurred, or because the hardware
261− tested for other conditions besides those two.
267+ tested for other conditions besides those two. Optional status.
262268 * .. _`CEC-TX-STATUS-MAX-RETRIES`:
263269
264270 - ``CEC_TX_STATUS_MAX_RETRIES``
265271 - 0x20
266272 - The transmit failed after one or more retries. This status bit is
267− mutually exclusive with :ref:`CEC_TX_STATUS_OK <CEC-TX-STATUS-OK>`. Other bits can still
268− be set to explain which failures were seen.
273+ mutually exclusive with :ref:`CEC_TX_STATUS_OK <CEC-TX-STATUS-OK>`.
274+ Other bits can still be set to explain which failures were seen.
269275
270276
271277 .. tabularcolumns:: |p{5.6cm}|p{0.9cm}|p{11.0cm}|
Documentation/media/uapi/dvb/dvbapi.rst+1−1
@@ -62,7 +62,7 @@ Authors: · 61 unmodified lines
6262
6363 - Original author of the Digital TV API documentation.
6464
65−- Carvalho Chehab, Mauro <m.chehab@kernel.org>
65+- Carvalho Chehab, Mauro <mchehab+samsung@kernel.org>
6666
6767 - Ported document to Docbook XML, addition of DVBv5 API, documentation gaps fix.
6868
Documentation/media/uapi/rc/lirc-dev-intro.rst+1−1
@@ -18,7 +18,7 @@ Example dmesg output upon a driver registering w/LIRC: · 17 unmodified lines
1818 .. code-block:: none
1919
2020 $ dmesg |grep lirc_dev
21− rc rc0: lirc_dev: driver mceusb registered at minor = 0
21+ rc rc0: lirc_dev: driver mceusb registered at minor = 0, raw IR receiver, raw IR transmitter
2222
2323 What you should see for a chardev:
2424
Documentation/media/uapi/rc/lirc-set-rec-timeout.rst+9−5
@@ -1,19 +1,23 @@
11 .. -*- coding: utf-8; mode: rst -*-
22
33 .. _lirc_set_rec_timeout:
4+.. _lirc_get_rec_timeout:
45
5−**************************
6−ioctl LIRC_SET_REC_TIMEOUT
7−**************************
6+***************************************************
7+ioctl LIRC_GET_REC_TIMEOUT and LIRC_SET_REC_TIMEOUT
8+***************************************************
89
910 Name
1011 ====
1112
12−LIRC_SET_REC_TIMEOUT - sets the integer value for IR inactivity timeout.
13+LIRC_GET_REC_TIMEOUT/LIRC_SET_REC_TIMEOUT - Get/set the integer value for IR inactivity timeout.
1314
1415 Synopsis
1516 ========
1617
18+.. c:function:: int ioctl( int fd, LIRC_GET_REC_TIMEOUT, __u32 *timeout )
19+ :name: LIRC_GET_REC_TIMEOUT
20+
1721 .. c:function:: int ioctl( int fd, LIRC_SET_REC_TIMEOUT, __u32 *timeout )
1822 :name: LIRC_SET_REC_TIMEOUT
1923
@@ -30,7 +34,7 @@ Arguments · 10 unmodified lines
3034 Description
3135 ===========
3236
33−Sets the integer value for IR inactivity timeout.
37+Get and set the integer value for IR inactivity timeout.
3438
3539 If supported by the hardware, setting it to 0 disables all hardware timeouts
3640 and data should be reported as soon as possible. If the exact value
Documentation/media/uapi/v4l/common.rst+1−1
@@ -41,6 +41,6 @@ applicable to all devices. · 40 unmodified lines
4141 extended-controls
4242 format
4343 planar-apis
44− crop
4544 selection-api
45+ crop
4646 streaming-par
Documentation/media/uapi/v4l/crop.rst+15−7
@@ -2,9 +2,18 @@ · 1 unmodified line
22
33 .. _crop:
44
5−*************************************
6−Image Cropping, Insertion and Scaling
7−*************************************
5+*****************************************************
6+Image Cropping, Insertion and Scaling -- the CROP API
7+*****************************************************
8+
9+.. note::
10+
11+ The CROP API is mostly superseded by the newer :ref:`SELECTION API
12+ <selection-api>`. The new API should be preferred in most cases,
13+ with the exception of pixel aspect ratio detection, which is
14+ implemented by :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>` and has no
15+ equivalent in the SELECTION API. See :ref:`selection-vs-crop` for a
16+ comparison of the two APIs.
817
918 Some video capture devices can sample a subsection of the picture and
1019 shrink or enlarge it to an image of arbitrary size. We call these
@@ -42,10 +51,9 @@ where applicable) will be fixed in this case. · 31 unmodified lines
4251
4352 .. note::
4453
45− All capture and output devices must support the
46− :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>` ioctl such that applications
47− can determine if scaling takes place.
48−
54+ All capture and output devices that support the CROP or SELECTION
55+ API will also support the :ref:`VIDIOC_CROPCAP <VIDIOC_CROPCAP>`
56+ ioctl.
4957
5058 Cropping Structures
5159 ===================
Documentation/media/uapi/v4l/selection-api-005.rst+0−34
@@ -1,34 +0,0 @@
1−.. -*- coding: utf-8; mode: rst -*-
2−
3−********************************
4−Comparison with old cropping API
5−********************************
6−
7−The selection API was introduced to cope with deficiencies of previous
8−:ref:`API <crop>`, that was designed to control simple capture
9−devices. Later the cropping API was adopted by video output drivers. The
10−ioctls are used to select a part of the display were the video signal is
11−inserted. It should be considered as an API abuse because the described
12−operation is actually the composing. The selection API makes a clear
13−distinction between composing and cropping operations by setting the
14−appropriate targets. The V4L2 API lacks any support for composing to and
15−cropping from an image inside a memory buffer. The application could
16−configure a capture device to fill only a part of an image by abusing
17−V4L2 API. Cropping a smaller image from a larger one is achieved by
18−setting the field ``bytesperline`` at struct
19−:c:type:`v4l2_pix_format`.
20−Introducing an image offsets could be done by modifying field ``m_userptr``
21−at struct
22−:c:type:`v4l2_buffer` before calling
23−:ref:`VIDIOC_QBUF`. Those operations should be avoided because they are not
24−portable (endianness), and do not work for macroblock and Bayer formats
25−and mmap buffers. The selection API deals with configuration of buffer
26−cropping/composing in a clear, intuitive and portable way. Next, with
27−the selection API the concepts of the padded target and constraints
28−flags are introduced. Finally, struct :c:type:`v4l2_crop`
29−and struct :c:type:`v4l2_cropcap` have no reserved
30−fields. Therefore there is no way to extend their functionality. The new
31−struct :c:type:`v4l2_selection` provides a lot of place
32−for future extensions. Driver developers are encouraged to implement
33−only selection API. The former cropping API would be simulated using the
34−new one.
Documentation/media/uapi/v4l/selection-api-configuration.rstrenamed from Documentation/media/uapi/v4l/selection-api-004.rst+1−1
@@ -41,7 +41,7 @@ The driver may further adjust the requested size and/or position · 40 unmodified lines
4141 according to hardware limitations.
4242
4343 Each capture device has a default source rectangle, given by the
44−``V4L2_SEL_TGT_CROP_DEFAULT`` target. This rectangle shall over what the
44+``V4L2_SEL_TGT_CROP_DEFAULT`` target. This rectangle shall cover what the
4545 driver writer considers the complete picture. Drivers shall set the
4646 active crop rectangle to the default when the driver is first loaded,
4747 but not later.
Documentation/media/uapi/v4l/selection-api-examples.rstrenamed from Documentation/media/uapi/v4l/selection-api-006.rst+0−0

File renamed without changes.

Documentation/media/uapi/v4l/selection-api-intro.rstrenamed from Documentation/media/uapi/v4l/selection-api-002.rst+0−0

File renamed without changes.

Documentation/media/uapi/v4l/selection-api-targets.rstrenamed from Documentation/media/uapi/v4l/selection-api-003.rst+0−0

File renamed without changes.

Documentation/media/uapi/v4l/selection-api-vs-crop-api.rst+39−0
@@ -0,0 +1,39 @@
1+.. -*- coding: utf-8; mode: rst -*-
2+
3+.. _selection-vs-crop:
4+
5+********************************
6+Comparison with old cropping API
7+********************************
8+
9+The selection API was introduced to cope with deficiencies of the
10+older :ref:`CROP API <crop>`, that was designed to control simple
11+capture devices. Later the cropping API was adopted by video output
12+drivers. The ioctls are used to select a part of the display were the
13+video signal is inserted. It should be considered as an API abuse
14+because the described operation is actually the composing. The
15+selection API makes a clear distinction between composing and cropping
16+operations by setting the appropriate targets.
17+
18+The CROP API lacks any support for composing to and cropping from an
19+image inside a memory buffer. The application could configure a
20+capture device to fill only a part of an image by abusing V4L2
21+API. Cropping a smaller image from a larger one is achieved by setting
22+the field ``bytesperline`` at struct :c:type:`v4l2_pix_format`.
23+Introducing an image offsets could be done by modifying field
24+``m_userptr`` at struct :c:type:`v4l2_buffer` before calling
25+:ref:`VIDIOC_QBUF <VIDIOC_QBUF>`. Those operations should be avoided
26+because they are not portable (endianness), and do not work for
27+macroblock and Bayer formats and mmap buffers.
28+
29+The selection API deals with configuration of buffer
30+cropping/composing in a clear, intuitive and portable way. Next, with
31+the selection API the concepts of the padded target and constraints
32+flags are introduced. Finally, struct :c:type:`v4l2_crop` and struct
33+:c:type:`v4l2_cropcap` have no reserved fields. Therefore there is no
34+way to extend their functionality. The new struct
35+:c:type:`v4l2_selection` provides a lot of place for future
36+extensions.
37+
38+Driver developers are encouraged to implement only selection API. The
39+former cropping API would be simulated using the new one.
Documentation/media/uapi/v4l/selection-api.rst+7−7
@@ -2,15 +2,15 @@ · 1 unmodified line
22
33 .. _selection-api:
44
5−API for cropping, composing and scaling
6−=======================================
5+Cropping, composing and scaling -- the SELECTION API
6+====================================================
77
88
99 .. toctree::
1010 :maxdepth: 1
1111
12− selection-api-002
13− selection-api-003
14− selection-api-004
15− selection-api-005
16− selection-api-006
12+ selection-api-intro.rst
13+ selection-api-targets.rst
14+ selection-api-configuration.rst
15+ selection-api-vs-crop-api.rst
16+ selection-api-examples.rst
Documentation/media/uapi/v4l/selection.svg+2−2
@@ -1128,11 +1128,11 @@ · 1127 unmodified lines
11281128 </text>
11291129 </g>
11301130 <text transform="matrix(.96106 0 0 1.0405 48.571 195.53)" x="2438.062" y="1368.429" enable-background="new" font-size="50" style="line-height:125%">
1131− <tspan x="2438.062" y="1368.429">COMPOSE_BONDS</tspan>
1131+ <tspan x="2438.062" y="1368.429">COMPOSE_BOUNDS</tspan>
11321132 </text>
11331133 <g font-size="40">
11341134 <text transform="translate(48.571 195.53)" x="8.082" y="1438.896" enable-background="new" style="line-height:125%">
1135− <tspan x="8.082" y="1438.896" font-size="50">CROP_BONDS</tspan>
1135+ <tspan x="8.082" y="1438.896" font-size="50">CROP_BOUNDS</tspan>
11361136 </text>
11371137 <text transform="translate(48.571 195.53)" x="1455.443" y="-26.808" enable-background="new" style="line-height:125%">
11381138 <tspan x="1455.443" y="-26.808" font-size="50">overscan area</tspan>
Documentation/media/uapi/v4l/v4l2.rst+1−1
@@ -45,7 +45,7 @@ Authors, in alphabetical order: · 44 unmodified lines
4545
4646 - Subdev selections API.
4747
48−- Carvalho Chehab, Mauro <m.chehab@kernel.org>
48+- Carvalho Chehab, Mauro <mchehab+samsung@kernel.org>
4949
5050 - Documented libv4l, designed and added v4l2grab example, Remote Controller chapter.
5151
Documentation/media/v4l-drivers/cx23885-cardlist.rst+17−1
@@ -186,7 +186,7 @@ cx23885 cards list · 185 unmodified lines
186186
187187 * - 43
188188 - Hauppauge ImpactVCB-e
189− - 0070:7133
189+ - 0070:7133, 0070:7137
190190
191191 * - 44
192192 - DViCO FusionHDTV DVB-T Dual Express2
@@ -243,3 +243,19 @@ cx23885 cards list · 50 unmodified lines
243243 * - 57
244244 - Hauppauge WinTV-QuadHD-ATSC
245245 - 0070:6a18, 0070:6b18
246+
247+ * - 58
248+ - Hauppauge WinTV-HVR-1265(161111)
249+ - 0070:2a18
250+
251+ * - 59
252+ - Hauppauge WinTV-Starburst2
253+ - 0070:f02a
254+
255+ * - 60
256+ - Hauppauge WinTV-QuadHD-DVB(885)
257+ -
258+
259+ * - 61
260+ - Hauppauge WinTV-QuadHD-ATSC(885)
261+ -
Documentation/media/v4l-drivers/em28xx-cardlist.rst+7−3
@@ -391,7 +391,7 @@ EM28xx cards list · 390 unmodified lines
391391 * - 94
392392 - PCTV tripleStick (292e)
393393 - em28178
394− - 2013:025f, 2040:0264
394+ - 2013:025f, 2013:0264, 2040:0264, 2040:8264, 2040:8268, 2040:8268
395395 * - 95
396396 - Leadtek VC100
397397 - em2861
@@ -411,12 +411,16 @@ EM28xx cards list · 13 unmodified lines
411411 * - 99
412412 - Hauppauge WinTV-dualHD DVB
413413 - em28174
414− - 2040:0265
414+ - 2040:0265, 2040:8265
415415 * - 100
416416 - Hauppauge WinTV-dualHD 01595 ATSC/QAM
417417 - em28174
418− - 2040:026d
418+ - 2040:026d, 2040:826d
419419 * - 101
420420 - Terratec Cinergy H6 rev. 2
421421 - em2884
422422 - 0ccd:10b2
423+ * - 102
424+ - :ZOLID HYBRID TV STICK
425+ - em2882
426+ -
MAINTAINERS+23−8
@@ -3147,6 +3147,13 @@ S: Supported · 3146 unmodified lines
31473147 F: Documentation/filesystems/caching/cachefiles.txt
31483148 F: fs/cachefiles/
31493149
3150+CADENCE MIPI-CSI2 BRIDGES
3151+M: Maxime Ripard <maxime.ripard@bootlin.com>
3152+L: linux-media@vger.kernel.org
3153+S: Maintained
3154+F: Documentation/devicetree/bindings/media/cdns,*.txt
3155+F: drivers/media/platform/cadence/cdns-csi2*
3156+
31503157 CADET FM/AM RADIO RECEIVER DRIVER
31513158 M: Hans Verkuil <hverkuil@xs4all.nl>
31523159 L: linux-media@vger.kernel.org
@@ -8894,6 +8901,7 @@ L: linux-media@vger.kernel.org · 5741 unmodified lines
88948901 L: linux-renesas-soc@vger.kernel.org
88958902 T: git git://linuxtv.org/media_tree.git
88968903 S: Supported
8904+F: Documentation/devicetree/bindings/media/renesas,rcar-csi2.txt
88978905 F: Documentation/devicetree/bindings/media/rcar_vin.txt
88988906 F: drivers/media/platform/rcar-vin/
88998907
@@ -10450,6 +10458,7 @@ T: git git://linuxtv.org/media_tree.git · 1550 unmodified lines
1045010458 S: Odd fixes
1045110459 F: drivers/media/i2c/ov772x.c
1045210460 F: include/media/i2c/ov772x.h
10461+F: Documentation/devicetree/bindings/media/i2c/ov772x.txt
1045310462
1045410463 OMNIVISION OV7740 SENSOR DRIVER
1045510464 M: Wenyou Yang <wenyou.yang@microchip.com>
@@ -13163,6 +13172,13 @@ S: Maintained · 2707 unmodified lines
1316313172 F: drivers/ssb/
1316413173 F: include/linux/ssb/
1316513174
13175+SONY IMX258 SENSOR DRIVER
13176+M: Sakari Ailus <sakari.ailus@linux.intel.com>
13177+L: linux-media@vger.kernel.org
13178+T: git git://linuxtv.org/media_tree.git
13179+S: Maintained
13180+F: drivers/media/i2c/imx258.c
13181+
1316613182 SONY IMX274 SENSOR DRIVER
1316713183 M: Leon Luo <leonl@leopardimaging.com>
1316813184 L: linux-media@vger.kernel.org
@@ -13379,13 +13395,6 @@ L: stable@vger.kernel.org · 210 unmodified lines
1337913395 S: Supported
1338013396 F: Documentation/process/stable-kernel-rules.rst
1338113397
13382−STAGING - ATOMISP DRIVER
13383−M: Alan Cox <alan@linux.intel.com>
13384−M: Sakari Ailus <sakari.ailus@linux.intel.com>
13385−L: linux-media@vger.kernel.org
13386−S: Maintained
13387−F: drivers/staging/media/atomisp/
13388−
1338913398 STAGING - COMEDI
1339013399 M: Ian Abbott <abbotti@mev.co.uk>
1339113400 M: H Hartley Sweeten <hsweeten@visionengravers.com>
@@ -15048,6 +15057,12 @@ L: linux-media@vger.kernel.org · 1656 unmodified lines
1504815057 S: Maintained
1504915058 F: drivers/media/platform/video-mux.c
1505015059
15060+VIDEO I2C POLLING DRIVER
15061+M: Matt Ranostay <matt.ranostay@konsulko.com>
15062+L: linux-media@vger.kernel.org
15063+S: Maintained
15064+F: drivers/media/i2c/video-i2c.c
15065+
1505115066 VIDEOBUF2 FRAMEWORK
1505215067 M: Pawel Osciak <pawel@osciak.com>
1505315068 M: Marek Szyprowski <m.szyprowski@samsung.com>
@@ -15745,7 +15760,7 @@ L: linux-media@vger.kernel.org · 691 unmodified lines
1574515760 W: http://mjpeg.sourceforge.net/driver-zoran/
1574615761 T: hg https://linuxtv.org/hg/v4l-dvb
1574715762 S: Odd Fixes
15748−F: drivers/media/pci/zoran/
15763+F: drivers/staging/media/zoran/
1574915764
1575015765 ZRAM COMPRESSED RAM BLOCK DEVICE DRVIER
1575115766 M: Minchan Kim <minchan@kernel.org>
arch/sh/boards/mach-migor/setup.c+1−1
@@ -359,7 +359,7 @@ static struct gpiod_lookup_table ov7725_gpios = { · 358 unmodified lines
359359 static struct gpiod_lookup_table tw9910_gpios = {
360360 .dev_id = "0-0045",
361361 .table = {
362− GPIO_LOOKUP("sh7722_pfc", GPIO_PTT2, "pdn", GPIO_ACTIVE_HIGH),
362+ GPIO_LOOKUP("sh7722_pfc", GPIO_PTT2, "pdn", GPIO_ACTIVE_LOW),
363363 GPIO_LOOKUP("sh7722_pfc", GPIO_PTT3, "rstb", GPIO_ACTIVE_LOW),
364364 },
365365 };
drivers/gpu/drm/rcar-du/rcar_du_crtc.c+150−6
@@ -691,6 +691,52 @@ static const struct drm_crtc_helper_funcs crtc_helper_funcs = { · 690 unmodified lines
691691 .atomic_disable = rcar_du_crtc_atomic_disable,
692692 };
693693
694+static struct drm_crtc_state *
695+rcar_du_crtc_atomic_duplicate_state(struct drm_crtc *crtc)
696+{
697+ struct rcar_du_crtc_state *state;
698+ struct rcar_du_crtc_state *copy;
699+
700+ if (WARN_ON(!crtc->state))
701+ return NULL;
702+
703+ state = to_rcar_crtc_state(crtc->state);
704+ copy = kmemdup(state, sizeof(*state), GFP_KERNEL);
705+ if (copy == NULL)
706+ return NULL;
707+
708+ __drm_atomic_helper_crtc_duplicate_state(crtc, &copy->state);
709+
710+ return &copy->state;
711+}
712+
713+static void rcar_du_crtc_atomic_destroy_state(struct drm_crtc *crtc,
714+ struct drm_crtc_state *state)
715+{
716+ __drm_atomic_helper_crtc_destroy_state(state);
717+ kfree(to_rcar_crtc_state(state));
718+}
719+
720+static void rcar_du_crtc_reset(struct drm_crtc *crtc)
721+{
722+ struct rcar_du_crtc_state *state;
723+
724+ if (crtc->state) {
725+ rcar_du_crtc_atomic_destroy_state(crtc, crtc->state);
726+ crtc->state = NULL;
727+ }
728+
729+ state = kzalloc(sizeof(*state), GFP_KERNEL);
730+ if (state == NULL)
731+ return;
732+
733+ state->crc.source = VSP1_DU_CRC_NONE;
734+ state->crc.index = 0;
735+
736+ crtc->state = &state->state;
737+ crtc->state->crtc = crtc;
738+}
739+
694740 static int rcar_du_crtc_enable_vblank(struct drm_crtc *crtc)
695741 {
696742 struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
@@ -710,15 +756,111 @@ static void rcar_du_crtc_disable_vblank(struct drm_crtc *crtc) · 13 unmodified lines
710756 rcrtc->vblank_enable = false;
711757 }
712758
713−static const struct drm_crtc_funcs crtc_funcs = {
714− .reset = drm_atomic_helper_crtc_reset,
759+static int rcar_du_crtc_set_crc_source(struct drm_crtc *crtc,
760+ const char *source_name,
761+ size_t *values_cnt)
762+{
763+ struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
764+ struct drm_modeset_acquire_ctx ctx;
765+ struct drm_crtc_state *crtc_state;
766+ struct drm_atomic_state *state;
767+ enum vsp1_du_crc_source source;
768+ unsigned int index = 0;
769+ unsigned int i;
770+ int ret;
771+
772+ /*
773+ * Parse the source name. Supported values are "plane%u" to compute the
774+ * CRC on an input plane (%u is the plane ID), and "auto" to compute the
775+ * CRC on the composer (VSP) output.
776+ */
777+ if (!source_name) {
778+ source = VSP1_DU_CRC_NONE;
779+ } else if (!strcmp(source_name, "auto")) {
780+ source = VSP1_DU_CRC_OUTPUT;
781+ } else if (strstarts(source_name, "plane")) {
782+ source = VSP1_DU_CRC_PLANE;
783+
784+ ret = kstrtouint(source_name + strlen("plane"), 10, &index);
785+ if (ret < 0)
786+ return ret;
787+
788+ for (i = 0; i < rcrtc->vsp->num_planes; ++i) {
789+ if (index == rcrtc->vsp->planes[i].plane.base.id) {
790+ index = i;
791+ break;
792+ }
793+ }
794+
795+ if (i >= rcrtc->vsp->num_planes)
796+ return -EINVAL;
797+ } else {
798+ return -EINVAL;
799+ }
800+
801+ *values_cnt = 1;
802+
803+ /* Perform an atomic commit to set the CRC source. */
804+ drm_modeset_acquire_init(&ctx, 0);
805+
806+ state = drm_atomic_state_alloc(crtc->dev);
807+ if (!state) {
808+ ret = -ENOMEM;
809+ goto unlock;
810+ }
811+
812+ state->acquire_ctx = &ctx;
813+
814+retry:
815+ crtc_state = drm_atomic_get_crtc_state(state, crtc);
816+ if (!IS_ERR(crtc_state)) {
817+ struct rcar_du_crtc_state *rcrtc_state;
818+
819+ rcrtc_state = to_rcar_crtc_state(crtc_state);
820+ rcrtc_state->crc.source = source;
821+ rcrtc_state->crc.index = index;
822+
823+ ret = drm_atomic_commit(state);
824+ } else {
825+ ret = PTR_ERR(crtc_state);
826+ }
827+
828+ if (ret == -EDEADLK) {
829+ drm_atomic_state_clear(state);
830+ drm_modeset_backoff(&ctx);
831+ goto retry;
832+ }
833+
834+ drm_atomic_state_put(state);
835+
836+unlock:
837+ drm_modeset_drop_locks(&ctx);
838+ drm_modeset_acquire_fini(&ctx);
839+
840+ return 0;
841+}
842+
843+static const struct drm_crtc_funcs crtc_funcs_gen2 = {
844+ .reset = rcar_du_crtc_reset,
845+ .destroy = drm_crtc_cleanup,
846+ .set_config = drm_atomic_helper_set_config,
847+ .page_flip = drm_atomic_helper_page_flip,
848+ .atomic_duplicate_state = rcar_du_crtc_atomic_duplicate_state,
849+ .atomic_destroy_state = rcar_du_crtc_atomic_destroy_state,
850+ .enable_vblank = rcar_du_crtc_enable_vblank,
851+ .disable_vblank = rcar_du_crtc_disable_vblank,
852+};
853+
854+static const struct drm_crtc_funcs crtc_funcs_gen3 = {
855+ .reset = rcar_du_crtc_reset,
715856 .destroy = drm_crtc_cleanup,
716857 .set_config = drm_atomic_helper_set_config,
717858 .page_flip = drm_atomic_helper_page_flip,
718− .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
719− .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
859+ .atomic_duplicate_state = rcar_du_crtc_atomic_duplicate_state,
860+ .atomic_destroy_state = rcar_du_crtc_atomic_destroy_state,
720861 .enable_vblank = rcar_du_crtc_enable_vblank,
721862 .disable_vblank = rcar_du_crtc_disable_vblank,
863+ .set_crc_source = rcar_du_crtc_set_crc_source,
722864 };
723865
724866 /* -----------------------------------------------------------------------------
@@ -822,8 +964,10 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex, · 97 unmodified lines
822964 else
823965 primary = &rgrp->planes[swindex % 2].plane;
824966
825− ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, primary,
826− NULL, &crtc_funcs, NULL);
967+ ret = drm_crtc_init_with_planes(rcdu->ddev, crtc, primary, NULL,
968+ rcdu->info->gen <= 2 ?
969+ &crtc_funcs_gen2 : &crtc_funcs_gen3,
970+ NULL);
827971 if (ret < 0)
828972 return ret;
829973
drivers/gpu/drm/rcar-du/rcar_du_crtc.h+15−0
@@ -21,6 +21,8 @@ · 20 unmodified lines
2121 #include <drm/drmP.h>
2222 #include <drm/drm_crtc.h>
2323
24+#include <media/vsp1.h>
25+
2426 struct rcar_du_group;
2527 struct rcar_du_vsp;
2628
@@ -69,6 +71,19 @@ struct rcar_du_crtc { · 42 unmodified lines
6971
7072 #define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc)
7173
74+/**
75+ * struct rcar_du_crtc_state - Driver-specific CRTC state
76+ * @state: base DRM CRTC state
77+ * @crc: CRC computation configuration
78+ */
79+struct rcar_du_crtc_state {
80+ struct drm_crtc_state state;
81+
82+ struct vsp1_du_crc_config crc;
83+};
84+
85+#define to_rcar_crtc_state(s) container_of(s, struct rcar_du_crtc_state, state)
86+
7287 enum rcar_du_output {
7388 RCAR_DU_OUTPUT_DPAD0,
7489 RCAR_DU_OUTPUT_DPAD1,
drivers/gpu/drm/rcar-du/rcar_du_vsp.c+10−2
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 #include "rcar_du_kms.h"
3333 #include "rcar_du_vsp.h"
3434
35−static void rcar_du_vsp_complete(void *private, bool completed)
35+static void rcar_du_vsp_complete(void *private, bool completed, u32 crc)
3636 {
3737 struct rcar_du_crtc *crtc = private;
3838
@@ -41,6 +41,8 @@ static void rcar_du_vsp_complete(void *private, bool completed) · 2 unmodified lines
4141
4242 if (completed)
4343 rcar_du_crtc_finish_page_flip(crtc);
44+
45+ drm_crtc_add_crc_entry(&crtc->crtc, false, 0, &crc);
4446 }
4547
4648 void rcar_du_vsp_enable(struct rcar_du_crtc *crtc)
@@ -103,7 +105,13 @@ void rcar_du_vsp_atomic_begin(struct rcar_du_crtc *crtc) · 56 unmodified lines
103105
104106 void rcar_du_vsp_atomic_flush(struct rcar_du_crtc *crtc)
105107 {
106− vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe);
108+ struct vsp1_du_atomic_pipe_config cfg = { { 0, } };
109+ struct rcar_du_crtc_state *state;
110+
111+ state = to_rcar_crtc_state(crtc->crtc.state);
112+ cfg.crc = state->crc;
113+
114+ vsp1_du_atomic_flush(crtc->vsp->vsp, crtc->vsp_pipe, &cfg);
107115 }
108116
109117 /* Keep the two tables in sync. */
drivers/media/Kconfig+6−6
@@ -78,13 +78,13 @@ config MEDIA_SDR_SUPPORT · 77 unmodified lines
7878 Say Y when you have a software defined radio device.
7979
8080 config MEDIA_CEC_SUPPORT
81− bool "HDMI CEC support"
82− ---help---
83− Enable support for HDMI CEC (Consumer Electronics Control),
84− which is an optional HDMI feature.
81+ bool "HDMI CEC support"
82+ ---help---
83+ Enable support for HDMI CEC (Consumer Electronics Control),
84+ which is an optional HDMI feature.
8585
86− Say Y when you have an HDMI receiver, transmitter or a USB CEC
87− adapter that supports HDMI CEC.
86+ Say Y when you have an HDMI receiver, transmitter or a USB CEC
87+ adapter that supports HDMI CEC.
8888
8989 source "drivers/media/cec/Kconfig"
9090
drivers/media/cec/cec-adap.c+13−6
@@ -339,12 +339,19 @@ static void cec_data_cancel(struct cec_data *data) · 338 unmodified lines
339339 data->adap->transmit_queue_sz--;
340340 }
341341
342− /* Mark it as an error */
343− data->msg.tx_ts = ktime_get_ns();
344− data->msg.tx_status |= CEC_TX_STATUS_ERROR |
345− CEC_TX_STATUS_MAX_RETRIES;
346− data->msg.tx_error_cnt++;
347− data->attempts = 0;
342+ if (data->msg.tx_status & CEC_TX_STATUS_OK) {
343+ /* Mark the canceled RX as a timeout */
344+ data->msg.rx_ts = ktime_get_ns();
345+ data->msg.rx_status = CEC_RX_STATUS_TIMEOUT;
346+ } else {
347+ /* Mark the canceled TX as an error */
348+ data->msg.tx_ts = ktime_get_ns();
349+ data->msg.tx_status |= CEC_TX_STATUS_ERROR |
350+ CEC_TX_STATUS_MAX_RETRIES;
351+ data->msg.tx_error_cnt++;
352+ data->attempts = 0;
353+ }
354+
348355 /* Queue transmitted message for monitoring purposes */
349356 cec_queue_msg_monitor(data->adap, &data->msg, 1);
350357
drivers/media/cec/cec-core.c+1−1
@@ -322,7 +322,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, · 321 unmodified lines
322322 adap->rc->allowed_protocols = RC_PROTO_BIT_CEC;
323323 adap->rc->priv = adap;
324324 adap->rc->map_name = RC_MAP_CEC;
325− adap->rc->timeout = MS_TO_NS(100);
325+ adap->rc->timeout = MS_TO_NS(550);
326326 #endif
327327 return adap;
328328 }
drivers/media/cec/cec-pin-error-inj.c+18−15
@@ -81,10 +81,9 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) · 80 unmodified lines
8181 u64 *error;
8282 u8 *args;
8383 bool has_op;
84− u32 op;
84+ u8 op;
8585 u8 mode;
8686 u8 pos;
87− u8 v;
8887
8988 p = skip_spaces(p);
9089 token = strsep(&p, delims);
@@ -146,12 +145,18 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) · 55 unmodified lines
146145 comma = strchr(token, ',');
147146 if (comma)
148147 *comma++ = '\0';
149− if (!strcmp(token, "any"))
150− op = CEC_ERROR_INJ_OP_ANY;
151− else if (!kstrtou8(token, 0, &v))
152− op = v;
153− else
148+ if (!strcmp(token, "any")) {
149+ has_op = false;
150+ error = pin->error_inj + CEC_ERROR_INJ_OP_ANY;
151+ args = pin->error_inj_args[CEC_ERROR_INJ_OP_ANY];
152+ } else if (!kstrtou8(token, 0, &op)) {
153+ has_op = true;
154+ error = pin->error_inj + op;
155+ args = pin->error_inj_args[op];
156+ } else {
154157 return false;
158+ }
159+
155160 mode = CEC_ERROR_INJ_MODE_ONCE;
156161 if (comma) {
157162 if (!strcmp(comma, "off"))
@@ -166,10 +171,6 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) · 8 unmodified lines
166171 return false;
167172 }
168173
169− error = pin->error_inj + op;
170− args = pin->error_inj_args[op];
171− has_op = op <= 0xff;
172−
173174 token = strsep(&p, delims);
174175 if (p) {
175176 p = skip_spaces(p);
@@ -203,16 +204,18 @@ bool cec_pin_error_inj_parse_line(struct cec_adapter *adap, char *line) · 27 unmodified lines
203204 mode_mask = CEC_ERROR_INJ_MODE_MASK << mode_offset;
204205 arg_idx = cec_error_inj_cmds[i].arg_idx;
205206
206− if (mode_offset == CEC_ERROR_INJ_RX_ARB_LOST_OFFSET ||
207− mode_offset == CEC_ERROR_INJ_TX_ADD_BYTES_OFFSET)
208− is_bit_pos = false;
209−
210207 if (mode_offset == CEC_ERROR_INJ_RX_ARB_LOST_OFFSET) {
211208 if (has_op)
212209 return false;
213210 if (!has_pos)
214211 pos = 0x0f;
212+ is_bit_pos = false;
213+ } else if (mode_offset == CEC_ERROR_INJ_TX_ADD_BYTES_OFFSET) {
214+ if (!has_pos || !pos)
215+ return false;
216+ is_bit_pos = false;
215217 }
218+
216219 if (arg_idx >= 0 && is_bit_pos) {
217220 if (!has_pos || pos >= 160)
218221 return false;
drivers/media/cec/cec-pin.c+1−1
@@ -119,7 +119,7 @@ static void cec_pin_update(struct cec_pin *pin, bool v, bool force) · 118 unmodified lines
119119
120120 if (pin->work_pin_events_dropped) {
121121 pin->work_pin_events_dropped = false;
122− v |= CEC_PIN_EVENT_FL_DROPPED;
122+ ev |= CEC_PIN_EVENT_FL_DROPPED;
123123 }
124124 pin->work_pin_events[pin->work_pin_events_wr] = ev;
125125 pin->work_pin_ts[pin->work_pin_events_wr] = ktime_get();
drivers/media/common/b2c2/flexcop-fe-tuner.c+2−2
@@ -495,7 +495,6 @@ static int airstar_atsc2_attach(struct flexcop_device *fc, · 494 unmodified lines
495495 /* AirStar ATSC 3rd generation */
496496 #if FE_SUPPORTED(LGDT330X)
497497 static struct lgdt330x_config air2pc_atsc_hd5000_config = {
498− .demod_address = 0x59,
499498 .demod_chip = LGDT3303,
500499 .serial_mpeg = 0x04,
501500 .clock_polarity_flip = 1,
@@ -504,7 +503,8 @@ static struct lgdt330x_config air2pc_atsc_hd5000_config = { · 2 unmodified lines
504503 static int airstar_atsc3_attach(struct flexcop_device *fc,
505504 struct i2c_adapter *i2c)
506505 {
507− fc->fe = dvb_attach(lgdt330x_attach, &air2pc_atsc_hd5000_config, i2c);
506+ fc->fe = dvb_attach(lgdt330x_attach, &air2pc_atsc_hd5000_config,
507+ 0x59, i2c);
508508 if (!fc->fe)
509509 return 0;
510510
drivers/media/common/b2c2/flexcop-i2c.c+19−28
@@ -105,40 +105,36 @@ static int flexcop_i2c_write4(struct flexcop_device *fc, · 104 unmodified lines
105105 }
106106
107107 int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c,
108− flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len)
108+ flexcop_access_op_t op, u8 chipaddr,
109+ u8 start_addr, u8 *buf, u16 size)
109110 {
110111 int ret;
111−
112−#ifdef DUMP_I2C_MESSAGES
113− int i;
114−#endif
112+ int len = size;
113+ u8 *p;
114+ u8 addr = start_addr;
115115
116116 u16 bytes_to_transfer;
117117 flexcop_ibi_value r100;
118118
119− deb_i2c("op = %d\n",op);
119+ deb_i2c("port %d %s(%02x): register %02x, size: %d\n",
120+ i2c->port,
121+ op == FC_READ ? "rd" : "wr",
122+ chipaddr, start_addr, size);
120123 r100.raw = 0;
121124 r100.tw_sm_c_100.chipaddr = chipaddr;
122125 r100.tw_sm_c_100.twoWS_rw = op;
123126 r100.tw_sm_c_100.twoWS_port_reg = i2c->port;
124127
125−#ifdef DUMP_I2C_MESSAGES
126− printk(KERN_DEBUG "%d ", i2c->port);
127− if (op == FC_READ)
128− printk(KERN_CONT "rd(");
129− else
130− printk(KERN_CONT "wr(");
131− printk(KERN_CONT "%02x): %02x ", chipaddr, addr);
132−#endif
133−
134128 /* in that case addr is the only value ->
135129 * we write it twice as baseaddr and val0
136130 * BBTI is doing it like that for ISL6421 at least */
137131 if (i2c->no_base_addr && len == 0 && op == FC_WRITE) {
138− buf = &addr;
132+ buf = &start_addr;
139133 len = 1;
140134 }
141135
136+ p = buf;
137+
142138 while (len != 0) {
143139 bytes_to_transfer = len > 4 ? 4 : len;
144140
@@ -146,26 +142,21 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c, · 1 unmodified line
146142 r100.tw_sm_c_100.baseaddr = addr;
147143
148144 if (op == FC_READ)
149− ret = flexcop_i2c_read4(i2c, r100, buf);
145+ ret = flexcop_i2c_read4(i2c, r100, p);
150146 else
151− ret = flexcop_i2c_write4(i2c->fc, r100, buf);
152−
153−#ifdef DUMP_I2C_MESSAGES
154− for (i = 0; i < bytes_to_transfer; i++)
155− printk(KERN_CONT "%02x ", buf[i]);
156−#endif
147+ ret = flexcop_i2c_write4(i2c->fc, r100, p);
157148
158149 if (ret < 0)
159150 return ret;
160151
161− buf += bytes_to_transfer;
152+ p += bytes_to_transfer;
162153 addr += bytes_to_transfer;
163154 len -= bytes_to_transfer;
164155 }
165−
166−#ifdef DUMP_I2C_MESSAGES
167− printk(KERN_CONT "\n");
168−#endif
156+ deb_i2c_dump("port %d %s(%02x): register %02x: %*ph\n",
157+ i2c->port,
158+ op == FC_READ ? "rd" : "wr",
159+ chipaddr, start_addr, size, buf);
169160
170161 return 0;
171162 }
drivers/media/common/b2c2/flexcop.c+1−1
@@ -42,7 +42,7 @@ int b2c2_flexcop_debug; · 41 unmodified lines
4242 EXPORT_SYMBOL_GPL(b2c2_flexcop_debug);
4343 module_param_named(debug, b2c2_flexcop_debug, int, 0644);
4444 MODULE_PARM_DESC(debug,
45− "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))."
45+ "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg,64=i2cdump (|-able))."
4646 DEBSTATUS);
4747 #undef DEBSTATUS
4848
drivers/media/common/b2c2/flexcop.h+1−0
@@ -26,5 +26,6 @@ extern int b2c2_flexcop_debug; · 25 unmodified lines
2626 #define deb_ts(args...) dprintk(0x08, args)
2727 #define deb_sram(args...) dprintk(0x10, args)
2828 #define deb_rdump(args...) dprintk(0x20, args)
29+#define deb_i2c_dump(args...) dprintk(0x40, args)
2930
3031 #endif
drivers/media/common/saa7146/saa7146_i2c.c+2−2
@@ -308,7 +308,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m · 307 unmodified lines
308308 /* prepare the message(s), get number of u32s to transfer */
309309 count = saa7146_i2c_msg_prepare(msgs, num, buffer);
310310 if ( 0 > count ) {
311− err = -1;
311+ err = -EIO;
312312 goto out;
313313 }
314314
@@ -360,7 +360,7 @@ static int saa7146_i2c_transfer(struct saa7146_dev *dev, const struct i2c_msg *m · 45 unmodified lines
360360 /* if any things had to be read, get the results */
361361 if ( 0 != saa7146_i2c_msg_cleanup(msgs, num, buffer)) {
362362 DEB_I2C("could not cleanup i2c-message\n");
363− err = -1;
363+ err = -EIO;
364364 goto out;
365365 }
366366
drivers/media/common/siano/smscoreapi.c+17−15
@@ -415,8 +415,8 @@ EXPORT_SYMBOL_GPL(smscore_get_board_id); · 414 unmodified lines
415415
416416 struct smscore_registry_entry_t {
417417 struct list_head entry;
418− char devpath[32];
419− int mode;
418+ char devpath[32];
419+ int mode;
420420 enum sms_device_type_st type;
421421 };
422422
@@ -442,7 +442,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) · 19 unmodified lines
442442 next != &g_smscore_registry;
443443 next = next->next) {
444444 entry = (struct smscore_registry_entry_t *) next;
445− if (!strcmp(entry->devpath, devpath)) {
445+ if (!strncmp(entry->devpath, devpath, sizeof(entry->devpath))) {
446446 kmutex_unlock(&g_smscore_registrylock);
447447 return entry;
448448 }
@@ -450,7 +450,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) · 1 unmodified line
450450 entry = kmalloc(sizeof(*entry), GFP_KERNEL);
451451 if (entry) {
452452 entry->mode = default_mode;
453− strcpy(entry->devpath, devpath);
453+ strlcpy(entry->devpath, devpath, sizeof(entry->devpath));
454454 list_add(&entry->entry, &g_smscore_registry);
455455 } else
456456 pr_err("failed to create smscore_registry.\n");
@@ -649,6 +649,7 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, · 192 unmodified lines
649649 */
650650 int smscore_register_device(struct smsdevice_params_t *params,
651651 struct smscore_device_t **coredev,
652+ gfp_t gfp_buf_flags,
652653 void *mdev)
653654 {
654655 struct smscore_device_t *dev;
@@ -661,6 +662,7 @@ int smscore_register_device(struct smsdevice_params_t *params, · 6 unmodified lines
661662 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
662663 dev->media_dev = mdev;
663664 #endif
665+ dev->gfp_buf_flags = gfp_buf_flags;
664666
665667 /* init list entry so it could be safe in smscore_unregister_device */
666668 INIT_LIST_HEAD(&dev->entry);
@@ -697,7 +699,7 @@ int smscore_register_device(struct smsdevice_params_t *params, · 30 unmodified lines
697699 buffer = dma_alloc_coherent(params->device,
698700 dev->common_buffer_size,
699701 &dev->common_buffer_phys,
700− GFP_KERNEL | GFP_DMA);
702+ GFP_KERNEL | dev->gfp_buf_flags);
701703 if (!buffer) {
702704 smscore_unregister_device(dev);
703705 return -ENOMEM;
@@ -733,7 +735,7 @@ int smscore_register_device(struct smsdevice_params_t *params, · 29 unmodified lines
733735 dev->postload_handler = params->postload_handler;
734736
735737 dev->device_flags = params->flags;
736− strcpy(dev->devpath, params->devpath);
738+ strlcpy(dev->devpath, params->devpath, sizeof(dev->devpath));
737739
738740 smscore_registry_settype(dev->devpath, params->device_type);
739741
@@ -792,7 +794,7 @@ static int smscore_init_ir(struct smscore_device_t *coredev) · 52 unmodified lines
792794 else {
793795 buffer = kmalloc(sizeof(struct sms_msg_data2) +
794796 SMS_DMA_ALIGNMENT,
795− GFP_KERNEL | GFP_DMA);
797+ GFP_KERNEL | coredev->gfp_buf_flags);
796798 if (buffer) {
797799 struct sms_msg_data2 *msg =
798800 (struct sms_msg_data2 *)
@@ -933,7 +935,7 @@ static int smscore_load_firmware_family2(struct smscore_device_t *coredev, · 134 unmodified lines
933935 }
934936
935937 /* PAGE_SIZE buffer shall be enough and dma aligned */
936− msg = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
938+ msg = kmalloc(PAGE_SIZE, GFP_KERNEL | coredev->gfp_buf_flags);
937939 if (!msg)
938940 return -ENOMEM;
939941
@@ -1168,7 +1170,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, · 228 unmodified lines
11681170 }
11691171 pr_debug("read fw %s, buffer size=0x%zx\n", fw_filename, fw->size);
11701172 fw_buf = kmalloc(ALIGN(fw->size + sizeof(struct sms_firmware),
1171− SMS_ALLOC_ALIGNMENT), GFP_KERNEL | GFP_DMA);
1173+ SMS_ALLOC_ALIGNMENT), GFP_KERNEL | coredev->gfp_buf_flags);
11721174 if (!fw_buf) {
11731175 pr_err("failed to allocate firmware buffer\n");
11741176 rc = -ENOMEM;
@@ -1260,7 +1262,7 @@ EXPORT_SYMBOL_GPL(smscore_unregister_device); · 85 unmodified lines
12601262 static int smscore_detect_mode(struct smscore_device_t *coredev)
12611263 {
12621264 void *buffer = kmalloc(sizeof(struct sms_msg_hdr) + SMS_DMA_ALIGNMENT,
1263− GFP_KERNEL | GFP_DMA);
1265+ GFP_KERNEL | coredev->gfp_buf_flags);
12641266 struct sms_msg_hdr *msg =
12651267 (struct sms_msg_hdr *) SMS_ALIGN_ADDRESS(buffer);
12661268 int rc;
@@ -1309,7 +1311,7 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode) · 42 unmodified lines
13091311 int rc = 0;
13101312
13111313 buffer = kmalloc(sizeof(struct sms_msg_data) +
1312− SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA);
1314+ SMS_DMA_ALIGNMENT, GFP_KERNEL | coredev->gfp_buf_flags);
13131315 if (!buffer)
13141316 return -ENOMEM;
13151317
@@ -1398,7 +1400,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode) · 82 unmodified lines
13981400 coredev->device_flags &= ~SMS_DEVICE_NOT_READY;
13991401
14001402 buffer = kmalloc(sizeof(struct sms_msg_data) +
1401− SMS_DMA_ALIGNMENT, GFP_KERNEL | GFP_DMA);
1403+ SMS_DMA_ALIGNMENT, GFP_KERNEL | coredev->gfp_buf_flags);
14021404 if (buffer) {
14031405 struct sms_msg_data *msg = (struct sms_msg_data *) SMS_ALIGN_ADDRESS(buffer);
14041406
@@ -1971,7 +1973,7 @@ int smscore_gpio_configure(struct smscore_device_t *coredev, u8 pin_num, · 566 unmodified lines
19711973 total_len = sizeof(struct sms_msg_hdr) + (sizeof(u32) * 6);
19721974
19731975 buffer = kmalloc(total_len + SMS_DMA_ALIGNMENT,
1974− GFP_KERNEL | GFP_DMA);
1976+ GFP_KERNEL | coredev->gfp_buf_flags);
19751977 if (!buffer)
19761978 return -ENOMEM;
19771979
@@ -2043,7 +2045,7 @@ int smscore_gpio_set_level(struct smscore_device_t *coredev, u8 pin_num, · 65 unmodified lines
20432045 (3 * sizeof(u32)); /* keep it 3 ! */
20442046
20452047 buffer = kmalloc(total_len + SMS_DMA_ALIGNMENT,
2046− GFP_KERNEL | GFP_DMA);
2048+ GFP_KERNEL | coredev->gfp_buf_flags);
20472049 if (!buffer)
20482050 return -ENOMEM;
20492051
@@ -2091,7 +2093,7 @@ int smscore_gpio_get_level(struct smscore_device_t *coredev, u8 pin_num, · 41 unmodified lines
20912093 total_len = sizeof(struct sms_msg_hdr) + (2 * sizeof(u32));
20922094
20932095 buffer = kmalloc(total_len + SMS_DMA_ALIGNMENT,
2094− GFP_KERNEL | GFP_DMA);
2096+ GFP_KERNEL | coredev->gfp_buf_flags);
20952097 if (!buffer)
20962098 return -ENOMEM;
20972099
drivers/media/common/siano/smscoreapi.h+3−0
@@ -190,6 +190,8 @@ struct smscore_device_t { · 189 unmodified lines
190190
191191 int mode, modes_supported;
192192
193+ gfp_t gfp_buf_flags;
194+
193195 /* host <--> device messages */
194196 struct completion version_ex_done, data_download_done, trigger_done;
195197 struct completion data_validity_done, device_ready_done;
@@ -1125,6 +1127,7 @@ extern void smscore_unregister_hotplug(hotplug_t hotplug); · 929 unmodified lines
11251127
11261128 extern int smscore_register_device(struct smsdevice_params_t *params,
11271129 struct smscore_device_t **coredev,
1130+ gfp_t gfp_buf_flags,
11281131 void *mdev);
11291132 extern void smscore_unregister_device(struct smscore_device_t *coredev);
11301133
drivers/media/common/siano/smsendian.c+7−7
@@ -35,7 +35,7 @@ void smsendian_handle_tx_message(void *buffer) · 34 unmodified lines
3535 switch (msg->x_msg_header.msg_type) {
3636 case MSG_SMS_DATA_DOWNLOAD_REQ:
3737 {
38− msg->msg_data[0] = le32_to_cpu(msg->msg_data[0]);
38+ msg->msg_data[0] = le32_to_cpu((__force __le32)(msg->msg_data[0]));
3939 break;
4040 }
4141
@@ -44,7 +44,7 @@ void smsendian_handle_tx_message(void *buffer) · 2 unmodified lines
4444 sizeof(struct sms_msg_hdr))/4;
4545
4646 for (i = 0; i < msg_words; i++)
47− msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]);
47+ msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
4848
4949 break;
5050 }
@@ -64,7 +64,7 @@ void smsendian_handle_rx_message(void *buffer) · 13 unmodified lines
6464 {
6565 struct sms_version_res *ver =
6666 (struct sms_version_res *) msg;
67− ver->chip_model = le16_to_cpu(ver->chip_model);
67+ ver->chip_model = le16_to_cpu((__force __le16)ver->chip_model);
6868 break;
6969 }
7070
@@ -81,7 +81,7 @@ void smsendian_handle_rx_message(void *buffer) · 10 unmodified lines
8181 sizeof(struct sms_msg_hdr))/4;
8282
8383 for (i = 0; i < msg_words; i++)
84− msg->msg_data[i] = le32_to_cpu(msg->msg_data[i]);
84+ msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
8585
8686 break;
8787 }
@@ -95,9 +95,9 @@ void smsendian_handle_message_header(void *msg) · 7 unmodified lines
9595 #ifdef __BIG_ENDIAN
9696 struct sms_msg_hdr *phdr = (struct sms_msg_hdr *)msg;
9797
98− phdr->msg_type = le16_to_cpu(phdr->msg_type);
99− phdr->msg_length = le16_to_cpu(phdr->msg_length);
100− phdr->msg_flags = le16_to_cpu(phdr->msg_flags);
98+ phdr->msg_type = le16_to_cpu((__force __le16)phdr->msg_type);
99+ phdr->msg_length = le16_to_cpu((__force __le16)phdr->msg_length);
100+ phdr->msg_flags = le16_to_cpu((__force __le16)phdr->msg_flags);
101101 #endif /* __BIG_ENDIAN */
102102 }
103103 EXPORT_SYMBOL_GPL(smsendian_handle_message_header);
drivers/media/common/videobuf2/Kconfig+0−2
@@ -12,7 +12,6 @@ config VIDEOBUF2_MEMOPS · 11 unmodified lines
1212
1313 config VIDEOBUF2_DMA_CONTIG
1414 tristate
15− depends on HAS_DMA
1615 select VIDEOBUF2_CORE
1716 select VIDEOBUF2_MEMOPS
1817 select DMA_SHARED_BUFFER
@@ -25,7 +24,6 @@ config VIDEOBUF2_VMALLOC · 6 unmodified lines
2524
2625 config VIDEOBUF2_DMA_SG
2726 tristate
28− depends on HAS_DMA
2927 select VIDEOBUF2_CORE
3028 select VIDEOBUF2_MEMOPS
3129
drivers/media/common/videobuf2/videobuf2-core.c+6−3
@@ -916,9 +916,12 @@ void vb2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state) · 915 unmodified lines
916916 dprintk(4, "done processing on buffer %d, state: %d\n",
917917 vb->index, state);
918918
919− /* sync buffers */
920− for (plane = 0; plane < vb->num_planes; ++plane)
921− call_void_memop(vb, finish, vb->planes[plane].mem_priv);
919+ if (state != VB2_BUF_STATE_QUEUED &&
920+ state != VB2_BUF_STATE_REQUEUEING) {
921+ /* sync buffers */
922+ for (plane = 0; plane < vb->num_planes; ++plane)
923+ call_void_memop(vb, finish, vb->planes[plane].mem_priv);
924+ }
922925
923926 spin_lock_irqsave(&q->done_lock, flags);
924927 if (state == VB2_BUF_STATE_QUEUED ||
drivers/media/dvb-core/dmxdev.c+1−1
@@ -622,7 +622,7 @@ static int dvb_dmxdev_start_feed(struct dmxdev *dmxdev, · 621 unmodified lines
622622 struct dmxdev_filter *filter,
623623 struct dmxdev_feed *feed)
624624 {
625− ktime_t timeout = 0;
625+ ktime_t timeout = ktime_set(0, 0);
626626 struct dmx_pes_filter_params *para = &filter->params.pes;
627627 enum dmx_output otype;
628628 int ret;
drivers/media/dvb-core/dvb_ca_en50221.c+2−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #include <linux/slab.h>
3232 #include <linux/list.h>
3333 #include <linux/module.h>
34+#include <linux/nospec.h>
3435 #include <linux/vmalloc.h>
3536 #include <linux/delay.h>
3637 #include <linux/spinlock.h>
@@ -1476,6 +1477,7 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, · 1439 unmodified lines
14761477
14771478 if (slot >= ca->slot_count)
14781479 return -EINVAL;
1480+ slot = array_index_nospec(slot, ca->slot_count);
14791481 sl = &ca->slot_info[slot];
14801482
14811483 /* check if the slot is actually running */
drivers/media/dvb-core/dvb_frontend.c+123−107
@@ -190,7 +190,7 @@ dtv_property_legacy_params_sync(struct dvb_frontend *fe, · 189 unmodified lines
190190
191191 static bool has_get_frontend(struct dvb_frontend *fe)
192192 {
193− return fe->ops.get_frontend != NULL;
193+ return fe->ops.get_frontend;
194194 }
195195
196196 /*
@@ -272,11 +272,23 @@ static void dvb_frontend_add_event(struct dvb_frontend *fe, · 75 unmodified lines
272272
273273 mutex_unlock(&events->mtx);
274274
275− wake_up_interruptible (&events->wait_queue);
275+ wake_up_interruptible(&events->wait_queue);
276+}
277+
278+static int dvb_frontend_test_event(struct dvb_frontend_private *fepriv,
279+ struct dvb_fe_events *events)
280+{
281+ int ret;
282+
283+ up(&fepriv->sem);
284+ ret = events->eventw != events->eventr;
285+ down(&fepriv->sem);
286+
287+ return ret;
276288 }
277289
278290 static int dvb_frontend_get_event(struct dvb_frontend *fe,
279− struct dvb_frontend_event *event, int flags)
291+ struct dvb_frontend_event *event, int flags)
280292 {
281293 struct dvb_frontend_private *fepriv = fe->frontend_priv;
282294 struct dvb_fe_events *events = &fepriv->events;
@@ -294,13 +306,8 @@ static int dvb_frontend_get_event(struct dvb_frontend *fe, · 11 unmodified lines
294306 if (flags & O_NONBLOCK)
295307 return -EWOULDBLOCK;
296308
297− up(&fepriv->sem);
298−
299− ret = wait_event_interruptible (events->wait_queue,
300− events->eventw != events->eventr);
301−
302− if (down_interruptible (&fepriv->sem))
303− return -ERESTARTSYS;
309+ ret = wait_event_interruptible(events->wait_queue,
310+ dvb_frontend_test_event(fepriv, events));
304311
305312 if (ret < 0)
306313 return ret;
@@ -327,8 +334,8 @@ static void dvb_frontend_clear_events(struct dvb_frontend *fe) · 20 unmodified lines
327334 static void dvb_frontend_init(struct dvb_frontend *fe)
328335 {
329336 dev_dbg(fe->dvb->device,
330− "%s: initialising adapter %i frontend %i (%s)...\n",
331− __func__, fe->dvb->num, fe->id, fe->ops.info.name);
337+ "%s: initialising adapter %i frontend %i (%s)...\n",
338+ __func__, fe->dvb->num, fe->id, fe->ops.info.name);
332339
333340 if (fe->ops.init)
334341 fe->ops.init(fe);
@@ -358,14 +365,14 @@ static void dvb_frontend_swzigzag_update_delay(struct dvb_frontend_private *fepr · 23 unmodified lines
358365 dev_dbg(fe->dvb->device, "%s:\n", __func__);
359366
360367 if (locked)
361− (fepriv->quality) = (fepriv->quality * 220 + 36*256) / 256;
368+ (fepriv->quality) = (fepriv->quality * 220 + 36 * 256) / 256;
362369 else
363370 (fepriv->quality) = (fepriv->quality * 220 + 0) / 256;
364371
365372 q2 = fepriv->quality - 128;
366373 q2 *= q2;
367374
368− fepriv->delay = fepriv->min_delay + q2 * HZ / (128*128);
375+ fepriv->delay = fepriv->min_delay + q2 * HZ / (128 * 128);
369376 }
370377
371378 /**
@@ -393,7 +400,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra · 21 unmodified lines
393400 (c->inversion == INVERSION_AUTO));
394401
395402 /* setup parameters correctly */
396− while(!ready) {
403+ while (!ready) {
397404 /* calculate the lnb_drift */
398405 fepriv->lnb_drift = fepriv->auto_step * fepriv->step_size;
399406
@@ -405,7 +412,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra · 5 unmodified lines
405412 }
406413
407414 /* perform inversion and +/- zigzag */
408− switch(fepriv->auto_sub_step) {
415+ switch (fepriv->auto_sub_step) {
409416 case 0:
410417 /* try with the current inversion and current drift setting */
411418 ready = 1;
@@ -450,11 +457,11 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra · 38 unmodified lines
450457 return 1;
451458 }
452459
453− dev_dbg(fe->dvb->device, "%s: drift:%i inversion:%i auto_step:%i " \
454− "auto_sub_step:%i started_auto_step:%i\n",
455− __func__, fepriv->lnb_drift, fepriv->inversion,
456− fepriv->auto_step, fepriv->auto_sub_step,
457− fepriv->started_auto_step);
460+ dev_dbg(fe->dvb->device,
461+ "%s: drift:%i inversion:%i auto_step:%i auto_sub_step:%i started_auto_step:%i\n",
462+ __func__, fepriv->lnb_drift, fepriv->inversion,
463+ fepriv->auto_step, fepriv->auto_sub_step,
464+ fepriv->started_auto_step);
458465
459466 /* set the frontend itself */
460467 c->frequency += fepriv->lnb_drift;
@@ -485,7 +492,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) · 24 unmodified lines
485492
486493 /* if we've got no parameters, just keep idling */
487494 if (fepriv->state & FESTATE_IDLE) {
488− fepriv->delay = 3*HZ;
495+ fepriv->delay = 3 * HZ;
489496 fepriv->quality = 0;
490497 return;
491498 }
@@ -502,7 +509,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) · 10 unmodified lines
502509 else
503510 fepriv->state = FESTATE_TUNED;
504511 }
505− fepriv->delay = 3*HZ;
512+ fepriv->delay = 3 * HZ;
506513 fepriv->quality = 0;
507514 return;
508515 }
@@ -591,7 +598,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) · 82 unmodified lines
591598 }
592599 fepriv->check_wrapped = 1;
593600
594− /* if we've just retuned, enter the ZIGZAG_FAST state.
601+ /* if we've just re-tuned, enter the ZIGZAG_FAST state.
595602 * This ensures we cannot return from an
596603 * FE_SET_FRONTEND ioctl before the first frontend tune
597604 * occurs */
@@ -658,7 +665,7 @@ static int dvb_frontend_thread(void *data) · 60 unmodified lines
658665
659666 fepriv->check_wrapped = 0;
660667 fepriv->quality = 0;
661− fepriv->delay = 3*HZ;
668+ fepriv->delay = 3 * HZ;
662669 fepriv->status = 0;
663670 fepriv->wakeup = 0;
664671 fepriv->reinitialise = 0;
@@ -670,8 +677,9 @@ static int dvb_frontend_thread(void *data) · 5 unmodified lines
670677 up(&fepriv->sem); /* is locked when we enter the thread... */
671678 restart:
672679 wait_event_interruptible_timeout(fepriv->wait_queue,
673− dvb_frontend_should_wakeup(fe) || kthread_should_stop()
674− || freezing(current),
680+ dvb_frontend_should_wakeup(fe) ||
681+ kthread_should_stop() ||
682+ freezing(current),
675683 fepriv->delay);
676684
677685 if (kthread_should_stop() || dvb_frontend_is_exiting(fe)) {
@@ -820,8 +828,8 @@ static void dvb_frontend_stop(struct dvb_frontend *fe) · 142 unmodified lines
820828 /* paranoia check in case a signal arrived */
821829 if (fepriv->thread)
822830 dev_warn(fe->dvb->device,
823− "dvb_frontend_stop: warning: thread %p won't exit\n",
824− fepriv->thread);
831+ "dvb_frontend_stop: warning: thread %p won't exit\n",
832+ fepriv->thread);
825833 }
826834
827835 /*
@@ -858,12 +866,12 @@ static int dvb_frontend_start(struct dvb_frontend *fe) · 30 unmodified lines
858866 if (fe->exit == DVB_FE_NO_EXIT)
859867 return 0;
860868 else
861− dvb_frontend_stop (fe);
869+ dvb_frontend_stop(fe);
862870 }
863871
864872 if (signal_pending(current))
865873 return -EINTR;
866− if (down_interruptible (&fepriv->sem))
874+ if (down_interruptible(&fepriv->sem))
867875 return -EINTR;
868876
869877 fepriv->state = FESTATE_IDLE;
@@ -872,12 +880,12 @@ static int dvb_frontend_start(struct dvb_frontend *fe) · 2 unmodified lines
872880 mb();
873881
874882 fe_thread = kthread_run(dvb_frontend_thread, fe,
875− "kdvb-ad-%i-fe-%i", fe->dvb->num,fe->id);
883+ "kdvb-ad-%i-fe-%i", fe->dvb->num, fe->id);
876884 if (IS_ERR(fe_thread)) {
877885 ret = PTR_ERR(fe_thread);
878886 dev_warn(fe->dvb->device,
879− "dvb_frontend_start: failed to start kthread (%d)\n",
880− ret);
887+ "dvb_frontend_start: failed to start kthread (%d)\n",
888+ ret);
881889 up(&fepriv->sem);
882890 return ret;
883891 }
@@ -886,7 +894,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe) · 2 unmodified lines
886894 }
887895
888896 static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe,
889− u32 *freq_min, u32 *freq_max)
897+ u32 *freq_min, u32 *freq_max)
890898 {
891899 *freq_min = max(fe->ops.info.frequency_min, fe->ops.tuner_ops.info.frequency_min);
892900
@@ -898,8 +906,9 @@ static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe, · 5 unmodified lines
898906 *freq_max = min(fe->ops.info.frequency_max, fe->ops.tuner_ops.info.frequency_max);
899907
900908 if (*freq_min == 0 || *freq_max == 0)
901− dev_warn(fe->dvb->device, "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n",
902− fe->dvb->num, fe->id);
909+ dev_warn(fe->dvb->device,
910+ "DVB: adapter %i frontend %u frequency limits undefined - fix the driver\n",
911+ fe->dvb->num, fe->id);
903912 }
904913
905914 static int dvb_frontend_check_parameters(struct dvb_frontend *fe)
@@ -913,8 +922,8 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe) · 7 unmodified lines
913922 if ((freq_min && c->frequency < freq_min) ||
914923 (freq_max && c->frequency > freq_max)) {
915924 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n",
916− fe->dvb->num, fe->id, c->frequency,
917− freq_min, freq_max);
925+ fe->dvb->num, fe->id, c->frequency,
926+ freq_min, freq_max);
918927 return -EINVAL;
919928 }
920929
@@ -930,9 +939,9 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe) · 9 unmodified lines
930939 (fe->ops.info.symbol_rate_max &&
931940 c->symbol_rate > fe->ops.info.symbol_rate_max)) {
932941 dev_warn(fe->dvb->device, "DVB: adapter %i frontend %i symbol rate %u out of range (%u..%u)\n",
933− fe->dvb->num, fe->id, c->symbol_rate,
934− fe->ops.info.symbol_rate_min,
935− fe->ops.info.symbol_rate_max);
942+ fe->dvb->num, fe->id, c->symbol_rate,
943+ fe->ops.info.symbol_rate_min,
944+ fe->ops.info.symbol_rate_max);
936945 return -EINVAL;
937946 }
938947 default:
@@ -953,7 +962,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) · 14 unmodified lines
953962 c->delivery_system = delsys;
954963
955964 dev_dbg(fe->dvb->device, "%s: Clearing cache for delivery system %d\n",
956− __func__, c->delivery_system);
965+ __func__, c->delivery_system);
957966
958967 c->transmission_mode = TRANSMISSION_MODE_AUTO;
959968 c->bandwidth_hz = 0; /* AUTO */
@@ -973,7 +982,7 @@ static int dvb_frontend_clear_cache(struct dvb_frontend *fe) · 13 unmodified lines
973982 c->isdbt_sb_subchannel = 0;
974983 c->isdbt_sb_segment_idx = 0;
975984 c->isdbt_sb_segment_count = 0;
976− c->isdbt_layer_enabled = 0;
985+ c->isdbt_layer_enabled = 7; /* All layers (A,B,C) */
977986 for (i = 0; i < 3; i++) {
978987 c->layer[i].fec = FEC_AUTO;
979988 c->layer[i].modulation = QAM_AUTO;
@@ -1178,8 +1187,8 @@ static int dtv_property_cache_sync(struct dvb_frontend *fe, · 198 unmodified lines
11781187 break;
11791188 case DVBV3_UNKNOWN:
11801189 dev_err(fe->dvb->device,
1181− "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
1182− __func__, c->delivery_system);
1190+ "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
1191+ __func__, c->delivery_system);
11831192 return -EINVAL;
11841193 }
11851194
@@ -1200,8 +1209,8 @@ dtv_property_legacy_params_sync(struct dvb_frontend *fe, · 14 unmodified lines
12001209 switch (dvbv3_type(c->delivery_system)) {
12011210 case DVBV3_UNKNOWN:
12021211 dev_err(fe->dvb->device,
1203− "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
1204− __func__, c->delivery_system);
1212+ "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
1213+ __func__, c->delivery_system);
12051214 return -EINVAL;
12061215 case DVBV3_QPSK:
12071216 dev_dbg(fe->dvb->device, "%s: Preparing QPSK req\n", __func__);
@@ -1293,7 +1302,7 @@ static int dtv_property_process_get(struct dvb_frontend *fe, · 85 unmodified lines
12931302 {
12941303 int ncaps;
12951304
1296− switch(tvp->cmd) {
1305+ switch (tvp->cmd) {
12971306 case DTV_ENUM_DELSYS:
12981307 ncaps = 0;
12991308 while (ncaps < MAX_DELSYS && fe->ops.delsys[ncaps]) {
@@ -1622,8 +1631,8 @@ static int dvbv5_set_delivery_system(struct dvb_frontend *fe, · 322 unmodified lines
16221631 if (fe->ops.delsys[ncaps] == desired_system) {
16231632 c->delivery_system = desired_system;
16241633 dev_dbg(fe->dvb->device,
1625− "%s: Changing delivery system to %d\n",
1626− __func__, desired_system);
1634+ "%s: Changing delivery system to %d\n",
1635+ __func__, desired_system);
16271636 return 0;
16281637 }
16291638 ncaps++;
@@ -1715,8 +1724,8 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe) · 85 unmodified lines
17151724 */
17161725 if (is_dvbv3_delsys(c->delivery_system)) {
17171726 dev_dbg(fe->dvb->device,
1718− "%s: Using delivery system to %d\n",
1719− __func__, c->delivery_system);
1727+ "%s: Using delivery system to %d\n",
1728+ __func__, c->delivery_system);
17201729 return 0;
17211730 }
17221731
@@ -1756,8 +1765,8 @@ static int dvbv3_set_delivery_system(struct dvb_frontend *fe) · 33 unmodified lines
17561765 * Zero on success, negative errno on failure.
17571766 */
17581767 static int dtv_property_process_set(struct dvb_frontend *fe,
1759− struct file *file,
1760− u32 cmd, u32 data)
1768+ struct file *file,
1769+ u32 cmd, u32 data)
17611770 {
17621771 int r = 0;
17631772 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
@@ -1765,11 +1774,11 @@ static int dtv_property_process_set(struct dvb_frontend *fe, · 1 unmodified line
17651774 /** Dump DTV command name and value*/
17661775 if (!cmd || cmd > DTV_MAX_COMMAND)
17671776 dev_warn(fe->dvb->device, "%s: SET cmd 0x%08x undefined\n",
1768− __func__, cmd);
1777+ __func__, cmd);
17691778 else
17701779 dev_dbg(fe->dvb->device,
1771− "%s: SET cmd 0x%08x (%s) to 0x%08x\n",
1772− __func__, cmd, dtv_cmds[cmd].name, data);
1780+ "%s: SET cmd 0x%08x (%s) to 0x%08x\n",
1781+ __func__, cmd, dtv_cmds[cmd].name, data);
17731782 switch (cmd) {
17741783 case DTV_CLEAR:
17751784 /*
@@ -1819,12 +1828,12 @@ static int dtv_property_process_set(struct dvb_frontend *fe, · 43 unmodified lines
18191828 case DTV_VOLTAGE:
18201829 c->voltage = data;
18211830 r = dvb_frontend_handle_ioctl(file, FE_SET_VOLTAGE,
1822− (void *)c->voltage);
1831+ (void *)c->voltage);
18231832 break;
18241833 case DTV_TONE:
18251834 c->sectone = data;
18261835 r = dvb_frontend_handle_ioctl(file, FE_SET_TONE,
1827− (void *)c->sectone);
1836+ (void *)c->sectone);
18281837 break;
18291838 case DTV_CODE_RATE_HP:
18301839 c->code_rate_HP = data;
@@ -2045,8 +2054,8 @@ static int dvb_frontend_handle_compat_ioctl(struct file *file, unsigned int cmd, · 214 unmodified lines
20452054
20462055 for (i = 0; i < tvps->num; i++) {
20472056 err = dtv_property_process_set(fe, file,
2048− (tvp + i)->cmd,
2049− (tvp + i)->u.data);
2057+ (tvp + i)->cmd,
2058+ (tvp + i)->u.data);
20502059 if (err < 0) {
20512060 kfree(tvp);
20522061 return err;
@@ -2265,7 +2274,6 @@ static int dtv_set_frontend(struct dvb_frontend *fe) · 212 unmodified lines
22652274 return 0;
22662275 }
22672276
2268−
22692277 static int dvb_frontend_handle_ioctl(struct file *file,
22702278 unsigned int cmd, void *parg)
22712279 {
@@ -2300,8 +2308,8 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 28 unmodified lines
23002308
23012309 for (i = 0; i < tvps->num; i++) {
23022310 err = dtv_property_process_set(fe, file,
2303− (tvp + i)->cmd,
2304− (tvp + i)->u.data);
2311+ (tvp + i)->cmd,
2312+ (tvp + i)->u.data);
23052313 if (err < 0) {
23062314 kfree(tvp);
23072315 return err;
@@ -2365,7 +2373,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 57 unmodified lines
23652373 }
23662374
23672375 case FE_GET_INFO: {
2368− struct dvb_frontend_info* info = parg;
2376+ struct dvb_frontend_info *info = parg;
23692377
23702378 memcpy(info, &fe->ops.info, sizeof(struct dvb_frontend_info));
23712379 dvb_frontend_get_frequency_limits(fe, &info->frequency_min, &info->frequency_max);
@@ -2396,12 +2404,12 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 24 unmodified lines
23962404 break;
23972405 default:
23982406 dev_err(fe->dvb->device,
2399− "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
2400− __func__, c->delivery_system);
2407+ "%s: doesn't know how to handle a DVBv3 call to delivery system %i\n",
2408+ __func__, c->delivery_system);
24012409 fe->ops.info.type = FE_OFDM;
24022410 }
24032411 dev_dbg(fe->dvb->device, "%s: current delivery system on cache: %d, V3 type: %d\n",
2404− __func__, c->delivery_system, fe->ops.info.type);
2412+ __func__, c->delivery_system, fe->ops.info.type);
24052413
24062414 /* Set CAN_INVERSION_AUTO bit on in other than oneshot mode */
24072415 if (!(fepriv->tune_mode_flags & FE_TUNE_MODE_ONESHOT))
@@ -2417,7 +2425,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 9 unmodified lines
24172425 * that user get signal state from previous tuning */
24182426 if (fepriv->state == FESTATE_RETUNE ||
24192427 fepriv->state == FESTATE_ERROR) {
2420− err=0;
2428+ err = 0;
24212429 *status = 0;
24222430 break;
24232431 }
@@ -2485,11 +2493,11 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 61 unmodified lines
24852493
24862494 case FE_ENABLE_HIGH_LNB_VOLTAGE:
24872495 if (fe->ops.enable_high_lnb_voltage)
2488− err = fe->ops.enable_high_lnb_voltage(fe, (long) parg);
2496+ err = fe->ops.enable_high_lnb_voltage(fe, (long)parg);
24892497 break;
24902498
24912499 case FE_SET_FRONTEND_TUNE_MODE:
2492− fepriv->tune_mode_flags = (unsigned long) parg;
2500+ fepriv->tune_mode_flags = (unsigned long)parg;
24932501 err = 0;
24942502 break;
24952503
@@ -2518,11 +2526,12 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 22 unmodified lines
25182526 * initialization, so parg is 8 bits and does not
25192527 * include the initialization or start bit
25202528 */
2521− unsigned long swcmd = ((unsigned long) parg) << 1;
2529+ unsigned long swcmd = ((unsigned long)parg) << 1;
25222530 ktime_t nexttime;
25232531 ktime_t tv[10];
25242532 int i;
25252533 u8 last = 1;
2534+
25262535 if (dvb_frontend_debug)
25272536 dprintk("%s switch command: 0x%04lx\n",
25282537 __func__, swcmd);
@@ -2537,7 +2546,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 8 unmodified lines
25372546
25382547 for (i = 0; i < 9; i++) {
25392548 if (dvb_frontend_debug)
2540− tv[i+1] = ktime_get_boottime();
2549+ tv[i + 1] = ktime_get_boottime();
25412550 if ((swcmd & 0x01) != last) {
25422551 /* set voltage to (last ? 13V : 18V) */
25432552 fe->ops.set_voltage(fe, (last) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18);
@@ -2552,7 +2561,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 8 unmodified lines
25522561 __func__, fe->dvb->num);
25532562 for (i = 1; i < 10; i++)
25542563 pr_info("%d: %d\n", i,
2555− (int) ktime_us_delta(tv[i], tv[i-1]));
2564+ (int)ktime_us_delta(tv[i], tv[i - 1]));
25562565 }
25572566 err = 0;
25582567 fepriv->state = FESTATE_DISEQC;
@@ -2611,7 +2620,7 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 52 unmodified lines
26112620 err = dtv_set_frontend(fe);
26122621 break;
26132622 case FE_GET_EVENT:
2614− err = dvb_frontend_get_event (fe, parg, file->f_flags);
2623+ err = dvb_frontend_get_event(fe, parg, file->f_flags);
26152624 break;
26162625
26172626 case FE_GET_FRONTEND: {
@@ -2634,7 +2643,6 @@ static int dvb_frontend_handle_ioctl(struct file *file, · 16 unmodified lines
26342643 return err;
26352644 }
26362645
2637−
26382646 static __poll_t dvb_frontend_poll(struct file *file, struct poll_table_struct *wait)
26392647 {
26402648 struct dvb_device *dvbdev = file->private_data;
@@ -2643,7 +2651,7 @@ static __poll_t dvb_frontend_poll(struct file *file, struct poll_table_struct *w · 2 unmodified lines
26432651
26442652 dev_dbg_ratelimited(fe->dvb->device, "%s:\n", __func__);
26452653
2646− poll_wait (file, &fepriv->events.wait_queue, wait);
2654+ poll_wait(file, &fepriv->events.wait_queue, wait);
26472655
26482656 if (fepriv->events.eventw != fepriv->events.eventr)
26492657 return (EPOLLIN | EPOLLRDNORM | EPOLLPRI);
@@ -2664,9 +2672,9 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) · 14 unmodified lines
26642672 return -ENODEV;
26652673
26662674 if (adapter->mfe_shared) {
2667− mutex_lock (&adapter->mfe_lock);
2675+ mutex_lock(&adapter->mfe_lock);
26682676
2669− if (adapter->mfe_dvbdev == NULL)
2677+ if (!adapter->mfe_dvbdev)
26702678 adapter->mfe_dvbdev = dvbdev;
26712679
26722680 else if (adapter->mfe_dvbdev != dvbdev) {
@@ -2678,23 +2686,23 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) · 5 unmodified lines
26782686 *mfepriv = mfe->frontend_priv;
26792687 int mferetry = (dvb_mfe_wait_time << 1);
26802688
2681− mutex_unlock (&adapter->mfe_lock);
2689+ mutex_unlock(&adapter->mfe_lock);
26822690 while (mferetry-- && (mfedev->users != -1 ||
2683− mfepriv->thread != NULL)) {
2684− if(msleep_interruptible(500)) {
2685− if(signal_pending(current))
2691+ mfepriv->thread)) {
2692+ if (msleep_interruptible(500)) {
2693+ if (signal_pending(current))
26862694 return -EINTR;
26872695 }
26882696 }
26892697
2690− mutex_lock (&adapter->mfe_lock);
2691− if(adapter->mfe_dvbdev != dvbdev) {
2698+ mutex_lock(&adapter->mfe_lock);
2699+ if (adapter->mfe_dvbdev != dvbdev) {
26922700 mfedev = adapter->mfe_dvbdev;
26932701 mfe = mfedev->priv;
26942702 mfepriv = mfe->frontend_priv;
26952703 if (mfedev->users != -1 ||
2696− mfepriv->thread != NULL) {
2697− mutex_unlock (&adapter->mfe_lock);
2704+ mfepriv->thread) {
2705+ mutex_unlock(&adapter->mfe_lock);
26982706 return -EBUSY;
26992707 }
27002708 adapter->mfe_dvbdev = dvbdev;
@@ -2715,7 +2723,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) · 14 unmodified lines
27152723 fepriv->reinitialise = 1;
27162724 }
27172725
2718− if ((ret = dvb_generic_open (inode, file)) < 0)
2726+ if ((ret = dvb_generic_open(inode, file)) < 0)
27192727 goto err1;
27202728
27212729 if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
@@ -2725,6 +2733,7 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) · 3 unmodified lines
27252733 fepriv->voltage = -1;
27262734
27272735 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
2736+ mutex_lock(&fe->dvb->mdev_lock);
27282737 if (fe->dvb->mdev) {
27292738 mutex_lock(&fe->dvb->mdev->graph_mutex);
27302739 if (fe->dvb->mdev->enable_source)
@@ -2733,13 +2742,15 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) · 2 unmodified lines
27332742 &fepriv->pipe);
27342743 mutex_unlock(&fe->dvb->mdev->graph_mutex);
27352744 if (ret) {
2745+ mutex_unlock(&fe->dvb->mdev_lock);
27362746 dev_err(fe->dvb->device,
27372747 "Tuner is busy. Error %d\n", ret);
27382748 goto err2;
27392749 }
27402750 }
2751+ mutex_unlock(&fe->dvb->mdev_lock);
27412752 #endif
2742− ret = dvb_frontend_start (fe);
2753+ ret = dvb_frontend_start(fe);
27432754 if (ret)
27442755 goto err3;
27452756
@@ -2750,17 +2761,19 @@ static int dvb_frontend_open(struct inode *inode, struct file *file) · 4 unmodified lines
27502761 dvb_frontend_get(fe);
27512762
27522763 if (adapter->mfe_shared)
2753− mutex_unlock (&adapter->mfe_lock);
2764+ mutex_unlock(&adapter->mfe_lock);
27542765 return ret;
27552766
27562767 err3:
27572768 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
2769+ mutex_lock(&fe->dvb->mdev_lock);
27582770 if (fe->dvb->mdev) {
27592771 mutex_lock(&fe->dvb->mdev->graph_mutex);
27602772 if (fe->dvb->mdev->disable_source)
27612773 fe->dvb->mdev->disable_source(dvbdev->entity);
27622774 mutex_unlock(&fe->dvb->mdev->graph_mutex);
27632775 }
2776+ mutex_unlock(&fe->dvb->mdev_lock);
27642777 err2:
27652778 #endif
27662779 dvb_generic_release(inode, file);
@@ -2769,7 +2782,7 @@ err1: · 2 unmodified lines
27692782 fe->ops.ts_bus_ctrl(fe, 0);
27702783 err0:
27712784 if (adapter->mfe_shared)
2772− mutex_unlock (&adapter->mfe_lock);
2785+ mutex_unlock(&adapter->mfe_lock);
27732786 return ret;
27742787 }
27752788
@@ -2787,17 +2800,19 @@ static int dvb_frontend_release(struct inode *inode, struct file *file) · 11 unmodified lines
27872800 mb();
27882801 }
27892802
2790− ret = dvb_generic_release (inode, file);
2803+ ret = dvb_generic_release(inode, file);
27912804
27922805 if (dvbdev->users == -1) {
27932806 wake_up(&fepriv->wait_queue);
27942807 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
2808+ mutex_lock(&fe->dvb->mdev_lock);
27952809 if (fe->dvb->mdev) {
27962810 mutex_lock(&fe->dvb->mdev->graph_mutex);
27972811 if (fe->dvb->mdev->disable_source)
27982812 fe->dvb->mdev->disable_source(dvbdev->entity);
27992813 mutex_unlock(&fe->dvb->mdev->graph_mutex);
28002814 }
2815+ mutex_unlock(&fe->dvb->mdev_lock);
28012816 #endif
28022817 if (fe->exit != DVB_FE_NO_EXIT)
28032818 wake_up(&dvbdev->wait_queue);
@@ -2827,7 +2842,7 @@ int dvb_frontend_suspend(struct dvb_frontend *fe) · 23 unmodified lines
28272842 int ret = 0;
28282843
28292844 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
2830− fe->id);
2845+ fe->id);
28312846
28322847 if (fe->ops.tuner_ops.suspend)
28332848 ret = fe->ops.tuner_ops.suspend(fe);
@@ -2847,7 +2862,7 @@ int dvb_frontend_resume(struct dvb_frontend *fe) · 13 unmodified lines
28472862 int ret = 0;
28482863
28492864 dev_dbg(fe->dvb->device, "%s: adap=%d fe=%d\n", __func__, fe->dvb->num,
2850− fe->id);
2865+ fe->id);
28512866
28522867 fe->exit = DVB_FE_DEVICE_RESUME;
28532868 if (fe->ops.init)
@@ -2871,14 +2886,14 @@ int dvb_frontend_resume(struct dvb_frontend *fe) · 17 unmodified lines
28712886 }
28722887 EXPORT_SYMBOL(dvb_frontend_resume);
28732888
2874−int dvb_register_frontend(struct dvb_adapter* dvb,
2875− struct dvb_frontend* fe)
2889+int dvb_register_frontend(struct dvb_adapter *dvb,
2890+ struct dvb_frontend *fe)
28762891 {
28772892 struct dvb_frontend_private *fepriv;
28782893 const struct dvb_device dvbdev_template = {
28792894 .users = ~0,
28802895 .writers = 1,
2881− .readers = (~0)-1,
2896+ .readers = (~0) - 1,
28822897 .fops = &dvb_frontend_fops,
28832898 #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
28842899 .name = fe->ops.info.name,
@@ -2891,7 +2906,7 @@ int dvb_register_frontend(struct dvb_adapter* dvb, · 6 unmodified lines
28912906 return -ERESTARTSYS;
28922907
28932908 fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL);
2894− if (fe->frontend_priv == NULL) {
2909+ if (!fe->frontend_priv) {
28952910 mutex_unlock(&frontend_mutex);
28962911 return -ENOMEM;
28972912 }
@@ -2907,18 +2922,18 @@ int dvb_register_frontend(struct dvb_adapter* dvb, · 9 unmodified lines
29072922 dvb_frontend_get(fe);
29082923
29092924 sema_init(&fepriv->sem, 1);
2910− init_waitqueue_head (&fepriv->wait_queue);
2911− init_waitqueue_head (&fepriv->events.wait_queue);
2925+ init_waitqueue_head(&fepriv->wait_queue);
2926+ init_waitqueue_head(&fepriv->events.wait_queue);
29122927 mutex_init(&fepriv->events.mtx);
29132928 fe->dvb = dvb;
29142929 fepriv->inversion = INVERSION_OFF;
29152930
29162931 dev_info(fe->dvb->device,
2917− "DVB: registering adapter %i frontend %i (%s)...\n",
2918− fe->dvb->num, fe->id, fe->ops.info.name);
2932+ "DVB: registering adapter %i frontend %i (%s)...\n",
2933+ fe->dvb->num, fe->id, fe->ops.info.name);
29192934
2920− dvb_register_device (fe->dvb, &fepriv->dvbdev, &dvbdev_template,
2921− fe, DVB_DEVICE_FRONTEND, 0);
2935+ dvb_register_device(fe->dvb, &fepriv->dvbdev, &dvbdev_template,
2936+ fe, DVB_DEVICE_FRONTEND, 0);
29222937
29232938 /*
29242939 * Initialize the cache to the proper values according with the
@@ -2933,9 +2948,10 @@ int dvb_register_frontend(struct dvb_adapter* dvb, · 8 unmodified lines
29332948 }
29342949 EXPORT_SYMBOL(dvb_register_frontend);
29352950
2936−int dvb_unregister_frontend(struct dvb_frontend* fe)
2951+int dvb_unregister_frontend(struct dvb_frontend *fe)
29372952 {
29382953 struct dvb_frontend_private *fepriv = fe->frontend_priv;
2954+
29392955 dev_dbg(fe->dvb->device, "%s:\n", __func__);
29402956
29412957 mutex_lock(&frontend_mutex);
@@ -2960,7 +2976,7 @@ static void dvb_frontend_invoke_release(struct dvb_frontend *fe, · 18 unmodified lines
29602976 }
29612977 }
29622978
2963−void dvb_frontend_detach(struct dvb_frontend* fe)
2979+void dvb_frontend_detach(struct dvb_frontend *fe)
29642980 {
29652981 dvb_frontend_invoke_release(fe, fe->ops.release_sec);
29662982 dvb_frontend_invoke_release(fe, fe->ops.tuner_ops.release);
drivers/media/dvb-core/dvb_net.c+1−1
@@ -1005,7 +1005,7 @@ static int dvb_net_sec_callback(const u8 *buffer1, size_t buffer1_len, · 1004 unmodified lines
10051005 return 0;
10061006 }
10071007
1008−static int dvb_net_tx(struct sk_buff *skb, struct net_device *dev)
1008+static netdev_tx_t dvb_net_tx(struct sk_buff *skb, struct net_device *dev)
10091009 {
10101010 dev_kfree_skb(skb);
10111011 return NETDEV_TX_OK;
drivers/media/dvb-core/dvbdev.c+4−0
@@ -859,6 +859,10 @@ int dvb_register_adapter(struct dvb_adapter *adap, const char *name, · 858 unmodified lines
859859 adap->mfe_dvbdev = NULL;
860860 mutex_init (&adap->mfe_lock);
861861
862+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
863+ mutex_init(&adap->mdev_lock);
864+#endif
865+
862866 list_add_tail (&adap->list_head, &dvb_adapter_list);
863867
864868 mutex_unlock(&dvbdev_register_lock);
drivers/media/dvb-frontends/Kconfig+1−1
@@ -903,7 +903,7 @@ comment "Common Interface (EN50221) controller drivers" · 902 unmodified lines
903903 depends on DVB_CORE
904904
905905 config DVB_CXD2099
906− tristate "CXD2099AR Common Interface driver"
906+ tristate "Sony CXD2099AR Common Interface driver"
907907 depends on DVB_CORE && I2C
908908 select REGMAP_I2C
909909 default m if !MEDIA_SUBDRV_AUTOSELECT
drivers/media/dvb-frontends/as102_fe.h+1−1
@@ -1,6 +1,6 @@
11 /*
22 * Abilis Systems Single DVB-T Receiver
3− * Copyright (C) 2014 Mauro Carvalho Chehab <m.chehab@samsung.com>
3+ * Copyright (C) 2014 Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License as published by
drivers/media/dvb-frontends/au8522_decoder.c+6−8
@@ -280,14 +280,12 @@ static void setup_decoder_defaults(struct au8522_state *state, bool is_svideo) · 279 unmodified lines
280280 AU8522_TOREGAAGC_REG0E5H_CVBS);
281281 au8522_writereg(state, AU8522_REG016H, AU8522_REG016H_CVBS);
282282
283− if (is_svideo) {
284− /* Despite what the table says, for the HVR-950q we still need
285− to be in CVBS mode for the S-Video input (reason unknown). */
286− /* filter_coef_type = 3; */
287− filter_coef_type = 5;
288− } else {
289− filter_coef_type = 5;
290− }
283+ /*
284+ * Despite what the table says, for the HVR-950q we still need
285+ * to be in CVBS mode for the S-Video input (reason unknown).
286+ */
287+ /* filter_coef_type = 3; */
288+ filter_coef_type = 5;
291289
292290 /* Load the Video Decoder Filter Coefficients */
293291 for (i = 0; i < NUM_FILTER_COEF; i++) {
drivers/media/dvb-frontends/cx24116.c+1−1
@@ -1456,7 +1456,7 @@ static int cx24116_tune(struct dvb_frontend *fe, bool re_tune, · 1455 unmodified lines
14561456 return cx24116_read_status(fe, status);
14571457 }
14581458
1459−static int cx24116_get_algo(struct dvb_frontend *fe)
1459+static enum dvbfe_algo cx24116_get_algo(struct dvb_frontend *fe)
14601460 {
14611461 return DVBFE_ALGO_HW;
14621462 }
drivers/media/dvb-frontends/cx24117.c+1−1
@@ -1555,7 +1555,7 @@ static int cx24117_tune(struct dvb_frontend *fe, bool re_tune, · 1554 unmodified lines
15551555 return cx24117_read_status(fe, status);
15561556 }
15571557
1558−static int cx24117_get_algo(struct dvb_frontend *fe)
1558+static enum dvbfe_algo cx24117_get_algo(struct dvb_frontend *fe)
15591559 {
15601560 return DVBFE_ALGO_HW;
15611561 }
drivers/media/dvb-frontends/cx24120.c+1−1
@@ -1491,7 +1491,7 @@ static int cx24120_tune(struct dvb_frontend *fe, bool re_tune, · 1490 unmodified lines
14911491 return cx24120_read_status(fe, status);
14921492 }
14931493
1494−static int cx24120_get_algo(struct dvb_frontend *fe)
1494+static enum dvbfe_algo cx24120_get_algo(struct dvb_frontend *fe)
14951495 {
14961496 return DVBFE_ALGO_HW;
14971497 }
drivers/media/dvb-frontends/cx24123.c+1−1
@@ -1005,7 +1005,7 @@ static int cx24123_tune(struct dvb_frontend *fe, · 1004 unmodified lines
10051005 return retval;
10061006 }
10071007
1008−static int cx24123_get_algo(struct dvb_frontend *fe)
1008+static enum dvbfe_algo cx24123_get_algo(struct dvb_frontend *fe)
10091009 {
10101010 return DVBFE_ALGO_HW;
10111011 }
drivers/media/dvb-frontends/cxd2099.c+2−2
@@ -1,5 +1,5 @@
11 /*
2− * cxd2099.c: Driver for the CXD2099AR Common Interface Controller
2+ * cxd2099.c: Driver for the Sony CXD2099AR Common Interface Controller
33 *
44 * Copyright (C) 2010-2013 Digital Devices GmbH
55 *
@@ -699,6 +699,6 @@ static struct i2c_driver cxd2099_driver = { · 693 unmodified lines
699699
700700 module_i2c_driver(cxd2099_driver);
701701
702−MODULE_DESCRIPTION("CXD2099AR Common Interface controller driver");
702+MODULE_DESCRIPTION("Sony CXD2099AR Common Interface controller driver");
703703 MODULE_AUTHOR("Ralph Metzler");
704704 MODULE_LICENSE("GPL");
drivers/media/dvb-frontends/cxd2099.h+1−1
@@ -1,5 +1,5 @@
11 /*
2− * cxd2099.h: Driver for the CXD2099AR Common Interface Controller
2+ * cxd2099.h: Driver for the Sony CXD2099AR Common Interface Controller
33 *
44 * Copyright (C) 2010-2011 Digital Devices GmbH
55 *
drivers/media/dvb-frontends/cxd2820r_core.c+1−1
@@ -403,7 +403,7 @@ error: · 402 unmodified lines
403403 return DVBFE_ALGO_SEARCH_ERROR;
404404 }
405405
406−static int cxd2820r_get_frontend_algo(struct dvb_frontend *fe)
406+static enum dvbfe_algo cxd2820r_get_frontend_algo(struct dvb_frontend *fe)
407407 {
408408 return DVBFE_ALGO_CUSTOM;
409409 }
drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_driver_version.h+2−2
@@ -7,6 +7,6 @@ · 6 unmodified lines
77 * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation
88 */
99
10−#define CXD2880_TNRDMD_DRIVER_VERSION "1.4.1 - 1.0.4"
10+#define CXD2880_TNRDMD_DRIVER_VERSION "1.4.1 - 1.0.5"
1111
12−#define CXD2880_TNRDMD_DRIVER_RELEASE_DATE "2018-01-17"
12+#define CXD2880_TNRDMD_DRIVER_RELEASE_DATE "2018-04-25"
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c+12−2
@@ -520,6 +520,15 @@ static int cxd2880_init(struct dvb_frontend *fe) · 519 unmodified lines
520520 pr_err("cxd2880 integ init failed %d\n", ret);
521521 return ret;
522522 }
523+
524+ ret = cxd2880_tnrdmd_set_cfg(&priv->tnrdmd,
525+ CXD2880_TNRDMD_CFG_TSPIN_CURRENT,
526+ 0x00);
527+ if (ret) {
528+ mutex_unlock(priv->spi_mutex);
529+ pr_err("cxd2880 set config failed %d\n", ret);
530+ return ret;
531+ }
523532 mutex_unlock(priv->spi_mutex);
524533
525534 pr_debug("OK.\n");
@@ -1126,7 +1135,7 @@ static int cxd2880_get_stats(struct dvb_frontend *fe, · 600 unmodified lines
11261135 priv = fe->demodulator_priv;
11271136 c = &fe->dtv_property_cache;
11281137
1129− if (!(status & FE_HAS_LOCK)) {
1138+ if (!(status & FE_HAS_LOCK) || !(status & FE_HAS_CARRIER)) {
11301139 c->pre_bit_error.len = 1;
11311140 c->pre_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
11321141 c->pre_bit_count.len = 1;
@@ -1345,7 +1354,8 @@ static int cxd2880_read_status(struct dvb_frontend *fe, · 212 unmodified lines
13451354
13461355 pr_debug("status %d\n", *status);
13471356
1348− if (priv->s == 0 && (*status & FE_HAS_LOCK)) {
1357+ if (priv->s == 0 && (*status & FE_HAS_LOCK) &&
1358+ (*status & FE_HAS_CARRIER)) {
13491359 mutex_lock(priv->spi_mutex);
13501360 if (c->delivery_system == SYS_DVBT) {
13511361 ret = cxd2880_set_ber_per_period_t(fe);
drivers/media/dvb-frontends/dvb-pll.c+110−0
@@ -533,6 +533,45 @@ static const struct dvb_pll_desc dvb_pll_alps_tdee4 = { · 532 unmodified lines
533533 }
534534 };
535535
536+/* Infineon TUA6034 ISDB-T, used in Friio */
537+/* CP cur. 50uA, AGC takeover: 103dBuV, PORT3 on */
538+static const struct dvb_pll_desc dvb_pll_tua6034_friio = {
539+ .name = "Infineon TUA6034 ISDB-T (Friio)",
540+ .min = 90000000,
541+ .max = 770000000,
542+ .iffreq = 57000000,
543+ .initdata = (u8[]){ 4, 0x9a, 0x50, 0xb2, 0x08 },
544+ .sleepdata = (u8[]){ 4, 0x9a, 0x70, 0xb3, 0x0b },
545+ .count = 3,
546+ .entries = {
547+ { 170000000, 142857, 0xba, 0x09 },
548+ { 470000000, 142857, 0xba, 0x0a },
549+ { 770000000, 142857, 0xb2, 0x08 },
550+ }
551+};
552+
553+/* Philips TDA6651 ISDB-T, used in Earthsoft PT1 */
554+static const struct dvb_pll_desc dvb_pll_tda665x_earth_pt1 = {
555+ .name = "Philips TDA6651 ISDB-T (EarthSoft PT1)",
556+ .min = 90000000,
557+ .max = 770000000,
558+ .iffreq = 57000000,
559+ .initdata = (u8[]){ 5, 0x0e, 0x7f, 0xc1, 0x80, 0x80 },
560+ .count = 10,
561+ .entries = {
562+ { 140000000, 142857, 0xc1, 0x81 },
563+ { 170000000, 142857, 0xc1, 0xa1 },
564+ { 220000000, 142857, 0xc1, 0x62 },
565+ { 330000000, 142857, 0xc1, 0xa2 },
566+ { 402000000, 142857, 0xc1, 0xe2 },
567+ { 450000000, 142857, 0xc1, 0x64 },
568+ { 550000000, 142857, 0xc1, 0x84 },
569+ { 600000000, 142857, 0xc1, 0xa4 },
570+ { 700000000, 142857, 0xc1, 0xc4 },
571+ { 770000000, 142857, 0xc1, 0xe4 },
572+ }
573+};
574+
536575 /* ----------------------------------------------------------- */
537576
538577 static const struct dvb_pll_desc *pll_list[] = {
@@ -556,6 +595,8 @@ static const struct dvb_pll_desc *pll_list[] = { · 17 unmodified lines
556595 [DVB_PLL_SAMSUNG_TDTC9251DH0] = &dvb_pll_samsung_tdtc9251dh0,
557596 [DVB_PLL_SAMSUNG_TBDU18132] = &dvb_pll_samsung_tbdu18132,
558597 [DVB_PLL_SAMSUNG_TBMU24112] = &dvb_pll_samsung_tbmu24112,
598+ [DVB_PLL_TUA6034_FRIIO] = &dvb_pll_tua6034_friio,
599+ [DVB_PLL_TDA665X_EARTH_PT1] = &dvb_pll_tda665x_earth_pt1,
559600 };
560601
561602 /* ----------------------------------------------------------- */
@@ -827,6 +868,75 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, · 265 unmodified lines
827868 }
828869 EXPORT_SYMBOL(dvb_pll_attach);
829870
871+
872+static int
873+dvb_pll_probe(struct i2c_client *client, const struct i2c_device_id *id)
874+{
875+ struct dvb_pll_config *cfg;
876+ struct dvb_frontend *fe;
877+ unsigned int desc_id;
878+
879+ cfg = client->dev.platform_data;
880+ fe = cfg->fe;
881+ i2c_set_clientdata(client, fe);
882+ desc_id = (unsigned int) id->driver_data;
883+
884+ if (!dvb_pll_attach(fe, client->addr, client->adapter, desc_id))
885+ return -ENOMEM;
886+
887+ dev_info(&client->dev, "DVB Simple Tuner attached.\n");
888+ return 0;
889+}
890+
891+static int dvb_pll_remove(struct i2c_client *client)
892+{
893+ struct dvb_frontend *fe;
894+
895+ fe = i2c_get_clientdata(client);
896+ dvb_pll_release(fe);
897+ return 0;
898+}
899+
900+
901+static const struct i2c_device_id dvb_pll_id[] = {
902+ {"dtt7579", DVB_PLL_THOMSON_DTT7579},
903+ {"dtt759x", DVB_PLL_THOMSON_DTT759X},
904+ {"z201", DVB_PLL_LG_Z201},
905+ {"unknown_1", DVB_PLL_UNKNOWN_1},
906+ {"tua6010xs", DVB_PLL_TUA6010XS},
907+ {"env57h1xd5", DVB_PLL_ENV57H1XD5},
908+ {"tua6034", DVB_PLL_TUA6034},
909+ {"tda665x", DVB_PLL_TDA665X},
910+ {"tded4", DVB_PLL_TDED4},
911+ {"tdhu2", DVB_PLL_TDHU2},
912+ {"tbmv", DVB_PLL_SAMSUNG_TBMV},
913+ {"sd1878_tda8261", DVB_PLL_PHILIPS_SD1878_TDA8261},
914+ {"opera1", DVB_PLL_OPERA1},
915+ {"dtos403ih102a", DVB_PLL_SAMSUNG_DTOS403IH102A},
916+ {"tdtc9251dh0", DVB_PLL_SAMSUNG_TDTC9251DH0},
917+ {"tbdu18132", DVB_PLL_SAMSUNG_TBDU18132},
918+ {"tbmu24112", DVB_PLL_SAMSUNG_TBMU24112},
919+ {"tdee4", DVB_PLL_TDEE4},
920+ {"dtt7520x", DVB_PLL_THOMSON_DTT7520X},
921+ {"tua6034_friio", DVB_PLL_TUA6034_FRIIO},
922+ {"tda665x_earthpt1", DVB_PLL_TDA665X_EARTH_PT1},
923+ {}
924+};
925+
926+
927+MODULE_DEVICE_TABLE(i2c, dvb_pll_id);
928+
929+static struct i2c_driver dvb_pll_driver = {
930+ .driver = {
931+ .name = "dvb_pll",
932+ },
933+ .probe = dvb_pll_probe,
934+ .remove = dvb_pll_remove,
935+ .id_table = dvb_pll_id,
936+};
937+
938+module_i2c_driver(dvb_pll_driver);
939+
830940 MODULE_DESCRIPTION("dvb pll library");
831941 MODULE_AUTHOR("Gerd Knorr");
832942 MODULE_LICENSE("GPL");
drivers/media/dvb-frontends/dvb-pll.h+6−0
@@ -29,6 +29,12 @@ · 28 unmodified lines
2929 #define DVB_PLL_SAMSUNG_TBMU24112 17
3030 #define DVB_PLL_TDEE4 18
3131 #define DVB_PLL_THOMSON_DTT7520X 19
32+#define DVB_PLL_TUA6034_FRIIO 20
33+#define DVB_PLL_TDA665X_EARTH_PT1 21
34+
35+struct dvb_pll_config {
36+ struct dvb_frontend *fe;
37+};
3238
3339 #if IS_REACHABLE(CONFIG_DVB_PLL)
3440 /**
drivers/media/dvb-frontends/l64781.c+2−2
@@ -546,7 +546,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, · 545 unmodified lines
546546
547547 /* Responds to all reads with 0 */
548548 if (l64781_readreg(state, 0x1a) != 0) {
549− dprintk("Read 1 returned unexpcted value\n");
549+ dprintk("Read 1 returned unexpected value\n");
550550 goto error;
551551 }
552552
@@ -555,7 +555,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, · 2 unmodified lines
555555
556556 /* Responds with register default value */
557557 if (l64781_readreg(state, 0x1a) != 0xa1) {
558− dprintk("Read 2 returned unexpcted value\n");
558+ dprintk("Read 2 returned unexpected value\n");
559559 goto error;
560560 }
561561
drivers/media/dvb-frontends/lgdt3306a.c+1−1
@@ -1784,7 +1784,7 @@ static int lgdt3306a_get_tune_settings(struct dvb_frontend *fe, · 1783 unmodified lines
17841784 return 0;
17851785 }
17861786
1787−static int lgdt3306a_search(struct dvb_frontend *fe)
1787+static enum dvbfe_search lgdt3306a_search(struct dvb_frontend *fe)
17881788 {
17891789 enum fe_status status = 0;
17901790 int ret;
drivers/media/dvb-frontends/lgdt330x.c+535−339
@@ -47,50 +47,50 @@ · 46 unmodified lines
4747
4848 static int debug;
4949 module_param(debug, int, 0644);
50−MODULE_PARM_DESC(debug,"Turn on/off lgdt330x frontend debugging (default:off).");
51−#define dprintk(args...) \
52−do { \
53−if (debug) printk(KERN_DEBUG "lgdt330x: " args); \
50+MODULE_PARM_DESC(debug, "Turn on/off lgdt330x frontend debugging (default:off).");
51+
52+#define dprintk(state, fmt, arg...) do { \
53+ if (debug) \
54+ dev_printk(KERN_DEBUG, &state->client->dev, fmt, ##arg);\
5455 } while (0)
5556
56−struct lgdt330x_state
57−{
58− struct i2c_adapter* i2c;
57+struct lgdt330x_state {
58+ struct i2c_client *client;
5959
6060 /* Configuration settings */
61− const struct lgdt330x_config* config;
61+ struct lgdt330x_config config;
6262
6363 struct dvb_frontend frontend;
6464
6565 /* Demodulator private data */
6666 enum fe_modulation current_modulation;
67− u32 snr; /* Result of last SNR calculation */
67+ u32 snr; /* Result of last SNR calculation */
68+ u16 ucblocks;
69+ unsigned long last_stats_time;
6870
6971 /* Tuner private data */
7072 u32 current_frequency;
7173 };
7274
73−static int i2c_write_demod_bytes (struct lgdt330x_state* state,
74− u8 *buf, /* data bytes to send */
75− int len /* number of bytes to send */ )
75+static int i2c_write_demod_bytes(struct lgdt330x_state *state,
76+ const u8 *buf, /* data bytes to send */
77+ int len /* number of bytes to send */)
7678 {
77− struct i2c_msg msg =
78− { .addr = state->config->demod_address,
79− .flags = 0,
80− .buf = buf,
81− .len = 2 };
8279 int i;
8380 int err;
8481
85− for (i=0; i<len-1; i+=2){
86− if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
87− printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __func__, msg.buf[0], msg.buf[1], err);
82+ for (i = 0; i < len - 1; i += 2) {
83+ err = i2c_master_send(state->client, buf, 2);
84+ if (err != 2) {
85+ dev_warn(&state->client->dev,
86+ "%s: error (addr %02x <- %02x, err = %i)\n",
87+ __func__, buf[0], buf[1], err);
8888 if (err < 0)
8989 return err;
9090 else
9191 return -EREMOTEIO;
9292 }
93− msg.buf += 2;
93+ buf += 2;
9494 }
9595 return 0;
9696 }
@@ -99,21 +99,30 @@ static int i2c_write_demod_bytes (struct lgdt330x_state* state, · 2 unmodified lines
9999 * This routine writes the register (reg) to the demod bus
100100 * then reads the data returned for (len) bytes.
101101 */
102−
103102 static int i2c_read_demod_bytes(struct lgdt330x_state *state,
104103 enum I2C_REG reg, u8 *buf, int len)
105104 {
106− u8 wr [] = { reg };
107− struct i2c_msg msg [] = {
108− { .addr = state->config->demod_address,
109− .flags = 0, .buf = wr, .len = 1 },
110− { .addr = state->config->demod_address,
111− .flags = I2C_M_RD, .buf = buf, .len = len },
105+ u8 wr[] = { reg };
106+ struct i2c_msg msg[] = {
107+ {
108+ .addr = state->client->addr,
109+ .flags = 0,
110+ .buf = wr,
111+ .len = 1
112+ }, {
113+ .addr = state->client->addr,
114+ .flags = I2C_M_RD,
115+ .buf = buf,
116+ .len = len
117+ },
112118 };
113119 int ret;
114− ret = i2c_transfer(state->i2c, msg, 2);
120+
121+ ret = i2c_transfer(state->client->adapter, msg, 2);
115122 if (ret != 2) {
116− printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __func__, state->config->demod_address, reg, ret);
123+ dev_warn(&state->client->dev,
124+ "%s: addr 0x%02x select 0x%02x error (ret == %i)\n",
125+ __func__, state->client->addr, reg, ret);
117126 if (ret >= 0)
118127 ret = -EIO;
119128 } else {
@@ -123,19 +132,21 @@ static int i2c_read_demod_bytes(struct lgdt330x_state *state, · 3 unmodified lines
123132 }
124133
125134 /* Software reset */
126−static int lgdt3302_SwReset(struct lgdt330x_state* state)
135+static int lgdt3302_sw_reset(struct lgdt330x_state *state)
127136 {
128137 u8 ret;
129138 u8 reset[] = {
130139 IRQ_MASK,
131− 0x00 /* bit 6 is active low software reset
132− * bits 5-0 are 1 to mask interrupts */
140+ /*
141+ * bit 6 is active low software reset
142+ * bits 5-0 are 1 to mask interrupts
143+ */
144+ 0x00
133145 };
134146
135147 ret = i2c_write_demod_bytes(state,
136148 reset, sizeof(reset));
137149 if (ret == 0) {
138−
139150 /* force reset high (inactive) and unmask interrupts */
140151 reset[1] = 0x7f;
141152 ret = i2c_write_demod_bytes(state,
@@ -144,7 +155,7 @@ static int lgdt3302_SwReset(struct lgdt330x_state* state) · 2 unmodified lines
144155 return ret;
145156 }
146157
147−static int lgdt3303_SwReset(struct lgdt330x_state* state)
158+static int lgdt3303_sw_reset(struct lgdt330x_state *state)
148159 {
149160 u8 ret;
150161 u8 reset[] = {
@@ -155,7 +166,6 @@ static int lgdt3303_SwReset(struct lgdt330x_state* state) · 4 unmodified lines
155166 ret = i2c_write_demod_bytes(state,
156167 reset, sizeof(reset));
157168 if (ret == 0) {
158−
159169 /* force reset high (inactive) */
160170 reset[1] = 0x01;
161171 ret = i2c_write_demod_bytes(state,
@@ -164,81 +174,94 @@ static int lgdt3303_SwReset(struct lgdt330x_state* state) · 2 unmodified lines
164174 return ret;
165175 }
166176
167−static int lgdt330x_SwReset(struct lgdt330x_state* state)
177+static int lgdt330x_sw_reset(struct lgdt330x_state *state)
168178 {
169− switch (state->config->demod_chip) {
179+ switch (state->config.demod_chip) {
170180 case LGDT3302:
171− return lgdt3302_SwReset(state);
181+ return lgdt3302_sw_reset(state);
172182 case LGDT3303:
173− return lgdt3303_SwReset(state);
183+ return lgdt3303_sw_reset(state);
174184 default:
175185 return -ENODEV;
176186 }
177187 }
178188
179−static int lgdt330x_init(struct dvb_frontend* fe)
189+static int lgdt330x_init(struct dvb_frontend *fe)
180190 {
181− /* Hardware reset is done using gpio[0] of cx23880x chip.
182− * I'd like to do it here, but don't know how to find chip address.
183− * cx88-cards.c arranges for the reset bit to be inactive (high).
184− * Maybe there needs to be a callable function in cx88-core or
185− * the caller of this function needs to do it. */
186−
191+ struct lgdt330x_state *state = fe->demodulator_priv;
192+ struct dtv_frontend_properties *p = &fe->dtv_property_cache;
193+ char *chip_name;
194+ int err;
187195 /*
188196 * Array of byte pairs <address, value>
189197 * to initialize each different chip
190198 */
191− static u8 lgdt3302_init_data[] = {
192− /* Use 50MHz parameter values from spec sheet since xtal is 50 */
193− /* Change the value of NCOCTFV[25:0] of carrier
194− recovery center frequency register */
199+ static const u8 lgdt3302_init_data[] = {
200+ /* Use 50MHz param values from spec sheet since xtal is 50 */
201+ /*
202+ * Change the value of NCOCTFV[25:0] of carrier
203+ * recovery center frequency register
204+ */
195205 VSB_CARRIER_FREQ0, 0x00,
196206 VSB_CARRIER_FREQ1, 0x87,
197207 VSB_CARRIER_FREQ2, 0x8e,
198208 VSB_CARRIER_FREQ3, 0x01,
199− /* Change the TPCLK pin polarity
200− data is valid on falling clock */
209+ /*
210+ * Change the TPCLK pin polarity
211+ * data is valid on falling clock
212+ */
201213 DEMUX_CONTROL, 0xfb,
202− /* Change the value of IFBW[11:0] of
203− AGC IF/RF loop filter bandwidth register */
214+ /*
215+ * Change the value of IFBW[11:0] of
216+ * AGC IF/RF loop filter bandwidth register
217+ */
204218 AGC_RF_BANDWIDTH0, 0x40,
205219 AGC_RF_BANDWIDTH1, 0x93,
206220 AGC_RF_BANDWIDTH2, 0x00,
207− /* Change the value of bit 6, 'nINAGCBY' and
208− 'NSSEL[1:0] of ACG function control register 2 */
221+ /*
222+ * Change the value of bit 6, 'nINAGCBY' and
223+ * 'NSSEL[1:0] of ACG function control register 2
224+ */
209225 AGC_FUNC_CTRL2, 0xc6,
210− /* Change the value of bit 6 'RFFIX'
211− of AGC function control register 3 */
226+ /*
227+ * Change the value of bit 6 'RFFIX'
228+ * of AGC function control register 3
229+ */
212230 AGC_FUNC_CTRL3, 0x40,
213− /* Set the value of 'INLVTHD' register 0x2a/0x2c
214− to 0x7fe */
231+ /*
232+ * Set the value of 'INLVTHD' register 0x2a/0x2c
233+ * to 0x7fe
234+ */
215235 AGC_DELAY0, 0x07,
216236 AGC_DELAY2, 0xfe,
217− /* Change the value of IAGCBW[15:8]
218− of inner AGC loop filter bandwidth */
237+ /*
238+ * Change the value of IAGCBW[15:8]
239+ * of inner AGC loop filter bandwidth
240+ */
219241 AGC_LOOP_BANDWIDTH0, 0x08,
220242 AGC_LOOP_BANDWIDTH1, 0x9a
221243 };
222−
223− static u8 lgdt3303_init_data[] = {
244+ static const u8 lgdt3303_init_data[] = {
224245 0x4c, 0x14
225246 };
226−
227− static u8 flip_1_lgdt3303_init_data[] = {
247+ static const u8 flip_1_lgdt3303_init_data[] = {
228248 0x4c, 0x14,
229249 0x87, 0xf3
230250 };
231−
232− static u8 flip_2_lgdt3303_init_data[] = {
251+ static const u8 flip_2_lgdt3303_init_data[] = {
233252 0x4c, 0x14,
234253 0x87, 0xda
235254 };
236255
237− struct lgdt330x_state* state = fe->demodulator_priv;
238− char *chip_name;
239− int err;
256+ /*
257+ * Hardware reset is done using gpio[0] of cx23880x chip.
258+ * I'd like to do it here, but don't know how to find chip address.
259+ * cx88-cards.c arranges for the reset bit to be inactive (high).
260+ * Maybe there needs to be a callable function in cx88-core or
261+ * the caller of this function needs to do it.
262+ */
240263
241− switch (state->config->demod_chip) {
264+ switch (state->config.demod_chip) {
242265 case LGDT3302:
243266 chip_name = "LGDT3302";
244267 err = i2c_write_demod_bytes(state, lgdt3302_init_data,
@@ -246,16 +269,16 @@ static int lgdt330x_init(struct dvb_frontend* fe) · 1 unmodified line
246269 break;
247270 case LGDT3303:
248271 chip_name = "LGDT3303";
249− switch (state->config->clock_polarity_flip) {
272+ switch (state->config.clock_polarity_flip) {
250273 case 2:
251274 err = i2c_write_demod_bytes(state,
252− flip_2_lgdt3303_init_data,
253− sizeof(flip_2_lgdt3303_init_data));
275+ flip_2_lgdt3303_init_data,
276+ sizeof(flip_2_lgdt3303_init_data));
254277 break;
255278 case 1:
256279 err = i2c_write_demod_bytes(state,
257− flip_1_lgdt3303_init_data,
258− sizeof(flip_1_lgdt3303_init_data));
280+ flip_1_lgdt3303_init_data,
281+ sizeof(flip_1_lgdt3303_init_data));
259282 break;
260283 case 0:
261284 default:
@@ -265,70 +288,55 @@ static int lgdt330x_init(struct dvb_frontend* fe) · 3 unmodified lines
265288 break;
266289 default:
267290 chip_name = "undefined";
268− printk (KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n");
291+ dev_warn(&state->client->dev,
292+ "Only LGDT3302 and LGDT3303 are supported chips.\n");
269293 err = -ENODEV;
270294 }
271− dprintk("%s entered as %s\n", __func__, chip_name);
295+ dprintk(state, "Initialized the %s chip\n", chip_name);
272296 if (err < 0)
273297 return err;
274− return lgdt330x_SwReset(state);
275−}
276298
277−static int lgdt330x_read_ber(struct dvb_frontend* fe, u32* ber)
278−{
279− *ber = 0; /* Not supplied by the demod chips */
280− return 0;
299+ p->cnr.len = 1;
300+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
301+ p->block_error.len = 1;
302+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
303+ p->block_count.len = 1;
304+ p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
305+ state->last_stats_time = 0;
306+
307+ return lgdt330x_sw_reset(state);
281308 }
282309
283−static int lgdt330x_read_ucblocks(struct dvb_frontend* fe, u32* ucblocks)
310+static int lgdt330x_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
284311 {
285− struct lgdt330x_state* state = fe->demodulator_priv;
286− int err;
287− u8 buf[2];
312+ struct lgdt330x_state *state = fe->demodulator_priv;
288313
289− *ucblocks = 0;
314+ *ucblocks = state->ucblocks;
290315
291− switch (state->config->demod_chip) {
292− case LGDT3302:
293− err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1,
294− buf, sizeof(buf));
295− break;
296− case LGDT3303:
297− err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1,
298− buf, sizeof(buf));
299− break;
300− default:
301− printk(KERN_WARNING
302− "Only LGDT3302 and LGDT3303 are supported chips.\n");
303− err = -ENODEV;
304− }
305− if (err < 0)
306− return err;
307−
308− *ucblocks = (buf[0] << 8) | buf[1];
309316 return 0;
310317 }
311318
312319 static int lgdt330x_set_parameters(struct dvb_frontend *fe)
313320 {
314321 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
322+ struct lgdt330x_state *state = fe->demodulator_priv;
315323 /*
316324 * Array of byte pairs <address, value>
317325 * to initialize 8VSB for lgdt3303 chip 50 MHz IF
318326 */
319− static u8 lgdt3303_8vsb_44_data[] = {
327+ static const u8 lgdt3303_8vsb_44_data[] = {
320328 0x04, 0x00,
321329 0x0d, 0x40,
322330 0x0e, 0x87,
323331 0x0f, 0x8e,
324332 0x10, 0x01,
325− 0x47, 0x8b };
326−
333+ 0x47, 0x8b
334+ };
327335 /*
328336 * Array of byte pairs <address, value>
329337 * to initialize QAM for lgdt3303 chip
330338 */
331− static u8 lgdt3303_qam_data[] = {
339+ static const u8 lgdt3303_qam_data[] = {
332340 0x04, 0x00,
333341 0x0d, 0x00,
334342 0x0e, 0x00,
@@ -339,98 +347,105 @@ static int lgdt330x_set_parameters(struct dvb_frontend *fe) · 4 unmodified lines
339347 0x48, 0x66,
340348 0x4d, 0x1a,
341349 0x49, 0x08,
342− 0x4a, 0x9b };
343−
344− struct lgdt330x_state* state = fe->demodulator_priv;
345−
346− static u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 };
350+ 0x4a, 0x9b
351+ };
352+ u8 top_ctrl_cfg[] = { TOP_CONTROL, 0x03 };
347353
348354 int err = 0;
349355 /* Change only if we are actually changing the modulation */
350356 if (state->current_modulation != p->modulation) {
351357 switch (p->modulation) {
352358 case VSB_8:
353− dprintk("%s: VSB_8 MODE\n", __func__);
359+ dprintk(state, "VSB_8 MODE\n");
354360
355361 /* Select VSB mode */
356362 top_ctrl_cfg[1] = 0x03;
357363
358364 /* Select ANT connector if supported by card */
359− if (state->config->pll_rf_set)
360− state->config->pll_rf_set(fe, 1);
365+ if (state->config.pll_rf_set)
366+ state->config.pll_rf_set(fe, 1);
361367
362− if (state->config->demod_chip == LGDT3303) {
363− err = i2c_write_demod_bytes(state, lgdt3303_8vsb_44_data,
368+ if (state->config.demod_chip == LGDT3303) {
369+ err = i2c_write_demod_bytes(state,
370+ lgdt3303_8vsb_44_data,
364371 sizeof(lgdt3303_8vsb_44_data));
365372 }
366373 break;
367374
368375 case QAM_64:
369− dprintk("%s: QAM_64 MODE\n", __func__);
376+ dprintk(state, "QAM_64 MODE\n");
370377
371378 /* Select QAM_64 mode */
372379 top_ctrl_cfg[1] = 0x00;
373380
374381 /* Select CABLE connector if supported by card */
375− if (state->config->pll_rf_set)
376− state->config->pll_rf_set(fe, 0);
382+ if (state->config.pll_rf_set)
383+ state->config.pll_rf_set(fe, 0);
377384
378− if (state->config->demod_chip == LGDT3303) {
379− err = i2c_write_demod_bytes(state, lgdt3303_qam_data,
380− sizeof(lgdt3303_qam_data));
385+ if (state->config.demod_chip == LGDT3303) {
386+ err = i2c_write_demod_bytes(state,
387+ lgdt3303_qam_data,
388+ sizeof(lgdt3303_qam_data));
381389 }
382390 break;
383391
384392 case QAM_256:
385− dprintk("%s: QAM_256 MODE\n", __func__);
393+ dprintk(state, "QAM_256 MODE\n");
386394
387395 /* Select QAM_256 mode */
388396 top_ctrl_cfg[1] = 0x01;
389397
390398 /* Select CABLE connector if supported by card */
391− if (state->config->pll_rf_set)
392− state->config->pll_rf_set(fe, 0);
399+ if (state->config.pll_rf_set)
400+ state->config.pll_rf_set(fe, 0);
393401
394− if (state->config->demod_chip == LGDT3303) {
395− err = i2c_write_demod_bytes(state, lgdt3303_qam_data,
396− sizeof(lgdt3303_qam_data));
402+ if (state->config.demod_chip == LGDT3303) {
403+ err = i2c_write_demod_bytes(state,
404+ lgdt3303_qam_data,
405+ sizeof(lgdt3303_qam_data));
397406 }
398407 break;
399408 default:
400− printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __func__, p->modulation);
409+ dev_warn(&state->client->dev,
410+ "%s: Modulation type(%d) UNSUPPORTED\n",
411+ __func__, p->modulation);
401412 return -1;
402413 }
403414 if (err < 0)
404− printk(KERN_WARNING "lgdt330x: %s: error blasting bytes to lgdt3303 for modulation type(%d)\n",
405− __func__, p->modulation);
415+ dev_warn(&state->client->dev,
416+ "%s: error blasting bytes to lgdt3303 for modulation type(%d)\n",
417+ __func__, p->modulation);
406418
407419 /*
408− * select serial or parallel MPEG harware interface
420+ * select serial or parallel MPEG hardware interface
409421 * Serial: 0x04 for LGDT3302 or 0x40 for LGDT3303
410422 * Parallel: 0x00
411423 */
412− top_ctrl_cfg[1] |= state->config->serial_mpeg;
424+ top_ctrl_cfg[1] |= state->config.serial_mpeg;
413425
414426 /* Select the requested mode */
415427 i2c_write_demod_bytes(state, top_ctrl_cfg,
416428 sizeof(top_ctrl_cfg));
417− if (state->config->set_ts_params)
418− state->config->set_ts_params(fe, 0);
429+ if (state->config.set_ts_params)
430+ state->config.set_ts_params(fe, 0);
419431 state->current_modulation = p->modulation;
420432 }
421433
422434 /* Tune to the specified frequency */
423435 if (fe->ops.tuner_ops.set_params) {
424436 fe->ops.tuner_ops.set_params(fe);
425− if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
437+ if (fe->ops.i2c_gate_ctrl)
438+ fe->ops.i2c_gate_ctrl(fe, 0);
426439 }
427440
428441 /* Keep track of the new frequency */
429− /* FIXME this is the wrong way to do this... */
430− /* The tuner is shared with the video4linux analog API */
442+ /*
443+ * FIXME this is the wrong way to do this...
444+ * The tuner is shared with the video4linux analog API
445+ */
431446 state->current_frequency = p->frequency;
432447
433− lgdt330x_SwReset(state);
448+ lgdt330x_sw_reset(state);
434449 return 0;
435450 }
436451
@@ -443,20 +458,191 @@ static int lgdt330x_get_frontend(struct dvb_frontend *fe, · 6 unmodified lines
443458 return 0;
444459 }
445460
461+/*
462+ * Calculate SNR estimation (scaled by 2^24)
463+ *
464+ * 8-VSB SNR equations from LGDT3302 and LGDT3303 datasheets, QAM
465+ * equations from LGDT3303 datasheet. VSB is the same between the '02
466+ * and '03, so maybe QAM is too? Perhaps someone with a newer datasheet
467+ * that has QAM information could verify?
468+ *
469+ * For 8-VSB: (two ways, take your pick)
470+ * LGDT3302:
471+ * SNR_EQ = 10 * log10(25 * 24^2 / EQ_MSE)
472+ * LGDT3303:
473+ * SNR_EQ = 10 * log10(25 * 32^2 / EQ_MSE)
474+ * LGDT3302 & LGDT3303:
475+ * SNR_PT = 10 * log10(25 * 32^2 / PT_MSE) (we use this one)
476+ * For 64-QAM:
477+ * SNR = 10 * log10( 688128 / MSEQAM)
478+ * For 256-QAM:
479+ * SNR = 10 * log10( 696320 / MSEQAM)
480+ *
481+ * We re-write the snr equation as:
482+ * SNR * 2^24 = 10*(c - intlog10(MSE))
483+ * Where for 256-QAM, c = log10(696320) * 2^24, and so on.
484+ */
485+static u32 calculate_snr(u32 mse, u32 c)
486+{
487+ if (mse == 0) /* No signal */
488+ return 0;
489+
490+ mse = intlog10(mse);
491+ if (mse > c) {
492+ /*
493+ * Negative SNR, which is possible, but realisticly the
494+ * demod will lose lock before the signal gets this bad.
495+ * The API only allows for unsigned values, so just return 0
496+ */
497+ return 0;
498+ }
499+ return 10 * (c - mse);
500+}
501+
502+static int lgdt3302_read_snr(struct dvb_frontend *fe)
503+{
504+ struct lgdt330x_state *state = fe->demodulator_priv;
505+ u8 buf[5]; /* read data buffer */
506+ u32 noise; /* noise value */
507+ u32 c; /* per-modulation SNR calculation constant */
508+
509+ switch (state->current_modulation) {
510+ case VSB_8:
511+ i2c_read_demod_bytes(state, LGDT3302_EQPH_ERR0, buf, 5);
512+#ifdef USE_EQMSE
513+ /* Use Equalizer Mean-Square Error Register */
514+ /* SNR for ranges from -15.61 to +41.58 */
515+ noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
516+ c = 69765745; /* log10(25*24^2)*2^24 */
517+#else
518+ /* Use Phase Tracker Mean-Square Error Register */
519+ /* SNR for ranges from -13.11 to +44.08 */
520+ noise = ((buf[0] & 7 << 3) << 13) | (buf[3] << 8) | buf[4];
521+ c = 73957994; /* log10(25*32^2)*2^24 */
522+#endif
523+ break;
524+ case QAM_64:
525+ case QAM_256:
526+ i2c_read_demod_bytes(state, CARRIER_MSEQAM1, buf, 2);
527+ noise = ((buf[0] & 3) << 8) | buf[1];
528+ c = state->current_modulation == QAM_64 ? 97939837 : 98026066;
529+ /* log10(688128)*2^24 and log10(696320)*2^24 */
530+ break;
531+ default:
532+ dev_err(&state->client->dev,
533+ "%s: Modulation set to unsupported value\n",
534+ __func__);
535+
536+ state->snr = 0;
537+
538+ return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */
539+ }
540+
541+ state->snr = calculate_snr(noise, c);
542+
543+ dprintk(state, "noise = 0x%08x, snr = %d.%02d dB\n", noise,
544+ state->snr >> 24, (((state->snr >> 8) & 0xffff) * 100) >> 16);
545+
546+ return 0;
547+}
548+
549+static int lgdt3303_read_snr(struct dvb_frontend *fe)
550+{
551+ struct lgdt330x_state *state = fe->demodulator_priv;
552+ u8 buf[5]; /* read data buffer */
553+ u32 noise; /* noise value */
554+ u32 c; /* per-modulation SNR calculation constant */
555+
556+ switch (state->current_modulation) {
557+ case VSB_8:
558+ i2c_read_demod_bytes(state, LGDT3303_EQPH_ERR0, buf, 5);
559+#ifdef USE_EQMSE
560+ /* Use Equalizer Mean-Square Error Register */
561+ /* SNR for ranges from -16.12 to +44.08 */
562+ noise = ((buf[0] & 0x78) << 13) | (buf[1] << 8) | buf[2];
563+ c = 73957994; /* log10(25*32^2)*2^24 */
564+#else
565+ /* Use Phase Tracker Mean-Square Error Register */
566+ /* SNR for ranges from -13.11 to +44.08 */
567+ noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4];
568+ c = 73957994; /* log10(25*32^2)*2^24 */
569+#endif
570+ break;
571+ case QAM_64:
572+ case QAM_256:
573+ i2c_read_demod_bytes(state, CARRIER_MSEQAM1, buf, 2);
574+ noise = (buf[0] << 8) | buf[1];
575+ c = state->current_modulation == QAM_64 ? 97939837 : 98026066;
576+ /* log10(688128)*2^24 and log10(696320)*2^24 */
577+ break;
578+ default:
579+ dev_err(&state->client->dev,
580+ "%s: Modulation set to unsupported value\n",
581+ __func__);
582+ state->snr = 0;
583+ return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */
584+ }
585+
586+ state->snr = calculate_snr(noise, c);
587+
588+ dprintk(state, "noise = 0x%08x, snr = %d.%02d dB\n", noise,
589+ state->snr >> 24, (((state->snr >> 8) & 0xffff) * 100) >> 16);
590+
591+ return 0;
592+}
593+
594+static int lgdt330x_read_snr(struct dvb_frontend *fe, u16 *snr)
595+{
596+ struct lgdt330x_state *state = fe->demodulator_priv;
597+
598+ *snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */
599+
600+ return 0;
601+}
602+
603+static int lgdt330x_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
604+{
605+ /* Calculate Strength from SNR up to 35dB */
606+ /*
607+ * Even though the SNR can go higher than 35dB, there is some comfort
608+ * factor in having a range of strong signals that can show at 100%
609+ */
610+ struct lgdt330x_state *state = fe->demodulator_priv;
611+ u16 snr;
612+ int ret;
613+
614+ ret = fe->ops.read_snr(fe, &snr);
615+ if (ret != 0)
616+ return ret;
617+ /* Rather than use the 8.8 value snr, use state->snr which is 8.24 */
618+ /* scale the range 0 - 35*2^24 into 0 - 65535 */
619+ if (state->snr >= 8960 * 0x10000)
620+ *strength = 0xffff;
621+ else
622+ *strength = state->snr / 8960;
623+
624+ return 0;
625+}
626+
627+
446628 static int lgdt3302_read_status(struct dvb_frontend *fe,
447629 enum fe_status *status)
448630 {
449− struct lgdt330x_state* state = fe->demodulator_priv;
631+ struct lgdt330x_state *state = fe->demodulator_priv;
632+ struct dtv_frontend_properties *p = &fe->dtv_property_cache;
450633 u8 buf[3];
634+ int err;
451635
452636 *status = 0; /* Reset status result */
453637
454638 /* AGC status register */
455639 i2c_read_demod_bytes(state, AGC_STATUS, buf, 1);
456− dprintk("%s: AGC_STATUS = 0x%02x\n", __func__, buf[0]);
457− if ((buf[0] & 0x0c) == 0x8){
458− /* Test signal does not exist flag */
459− /* as well as the AGC lock flag. */
640+ dprintk(state, "AGC_STATUS = 0x%02x\n", buf[0]);
641+ if ((buf[0] & 0x0c) == 0x8) {
642+ /*
643+ * Test signal does not exist flag
644+ * as well as the AGC lock flag.
645+ */
460646 *status |= FE_HAS_SIGNAL;
461647 }
462648
@@ -465,25 +651,24 @@ static int lgdt3302_read_status(struct dvb_frontend *fe, · 2 unmodified lines
465651 * to see that status bit in the IRQ_STATUS register.
466652 * This is done in SwReset();
467653 */
654+
468655 /* signal status */
469656 i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf));
470− dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __func__, buf[0], buf[1], buf[2]);
471−
657+ dprintk(state,
658+ "TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n",
659+ buf[0], buf[1], buf[2]);
472660
473661 /* sync status */
474− if ((buf[2] & 0x03) == 0x01) {
662+ if ((buf[2] & 0x03) == 0x01)
475663 *status |= FE_HAS_SYNC;
476− }
477664
478665 /* FEC error status */
479− if ((buf[2] & 0x0c) == 0x08) {
480− *status |= FE_HAS_LOCK;
481− *status |= FE_HAS_VITERBI;
482− }
666+ if ((buf[2] & 0x0c) == 0x08)
667+ *status |= FE_HAS_LOCK | FE_HAS_VITERBI;
483668
484669 /* Carrier Recovery Lock Status Register */
485670 i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
486− dprintk("%s: CARRIER_LOCK = 0x%02x\n", __func__, buf[0]);
671+ dprintk(state, "CARRIER_LOCK = 0x%02x\n", buf[0]);
487672 switch (state->current_modulation) {
488673 case QAM_256:
489674 case QAM_64:
@@ -496,7 +681,48 @@ static int lgdt3302_read_status(struct dvb_frontend *fe, · 6 unmodified lines
496681 *status |= FE_HAS_CARRIER;
497682 break;
498683 default:
499− printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n", __func__);
684+ dev_warn(&state->client->dev,
685+ "%s: Modulation set to unsupported value\n",
686+ __func__);
687+ }
688+
689+ if (!(*status & FE_HAS_LOCK)) {
690+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
691+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
692+ p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
693+ return 0;
694+ }
695+
696+ if (state->last_stats_time &&
697+ time_is_after_jiffies(state->last_stats_time))
698+ return 0;
699+
700+ state->last_stats_time = jiffies + msecs_to_jiffies(1000);
701+
702+ err = lgdt3302_read_snr(fe);
703+ if (!err) {
704+ p->cnr.stat[0].scale = FE_SCALE_DECIBEL;
705+ p->cnr.stat[0].svalue = (((u64)state->snr) * 1000) >> 24;
706+ } else {
707+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
708+ }
709+
710+ err = i2c_read_demod_bytes(state, LGDT3302_PACKET_ERR_COUNTER1,
711+ buf, sizeof(buf));
712+ if (!err) {
713+ state->ucblocks = (buf[0] << 8) | buf[1];
714+
715+ dprintk(state, "UCB = 0x%02x\n", state->ucblocks);
716+
717+ p->block_error.stat[0].uvalue += state->ucblocks;
718+ /* FIXME: what's the basis for block count */
719+ p->block_count.stat[0].uvalue += 10000;
720+
721+ p->block_error.stat[0].scale = FE_SCALE_COUNTER;
722+ p->block_count.stat[0].scale = FE_SCALE_COUNTER;
723+ } else {
724+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
725+ p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
500726 }
501727
502728 return 0;
@@ -505,9 +731,10 @@ static int lgdt3302_read_status(struct dvb_frontend *fe, · 2 unmodified lines
505731 static int lgdt3303_read_status(struct dvb_frontend *fe,
506732 enum fe_status *status)
507733 {
508− struct lgdt330x_state* state = fe->demodulator_priv;
509− int err;
734+ struct lgdt330x_state *state = fe->demodulator_priv;
735+ struct dtv_frontend_properties *p = &fe->dtv_property_cache;
510736 u8 buf[3];
737+ int err;
511738
512739 *status = 0; /* Reset status result */
513740
@@ -516,16 +743,18 @@ static int lgdt3303_read_status(struct dvb_frontend *fe, · 2 unmodified lines
516743 if (err < 0)
517744 return err;
518745
519− dprintk("%s: AGC_STATUS = 0x%02x\n", __func__, buf[0]);
520− if ((buf[0] & 0x21) == 0x01){
521− /* Test input signal does not exist flag */
522− /* as well as the AGC lock flag. */
746+ dprintk(state, "AGC_STATUS = 0x%02x\n", buf[0]);
747+ if ((buf[0] & 0x21) == 0x01) {
748+ /*
749+ * Test input signal does not exist flag
750+ * as well as the AGC lock flag.
751+ */
523752 *status |= FE_HAS_SIGNAL;
524753 }
525754
526755 /* Carrier Recovery Lock Status Register */
527756 i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
528− dprintk("%s: CARRIER_LOCK = 0x%02x\n", __func__, buf[0]);
757+ dprintk(state, "CARRIER_LOCK = 0x%02x\n", buf[0]);
529758 switch (state->current_modulation) {
530759 case QAM_256:
531760 case QAM_64:
@@ -535,6 +764,8 @@ static int lgdt3303_read_status(struct dvb_frontend *fe, · 3 unmodified lines
535764 else
536765 break;
537766 i2c_read_demod_bytes(state, 0x8a, buf, 1);
767+ dprintk(state, "QAM LOCK = 0x%02x\n", buf[0]);
768+
538769 if ((buf[0] & 0x04) == 0x04)
539770 *status |= FE_HAS_SYNC;
540771 if ((buf[0] & 0x01) == 0x01)
@@ -548,168 +779,64 @@ static int lgdt3303_read_status(struct dvb_frontend *fe, · 7 unmodified lines
548779 else
549780 break;
550781 i2c_read_demod_bytes(state, 0x38, buf, 1);
782+ dprintk(state, "8-VSB LOCK = 0x%02x\n", buf[0]);
783+
551784 if ((buf[0] & 0x02) == 0x00)
552785 *status |= FE_HAS_SYNC;
553− if ((buf[0] & 0x01) == 0x01) {
554− *status |= FE_HAS_LOCK;
555− *status |= FE_HAS_VITERBI;
556− }
786+ if ((buf[0] & 0xfd) == 0x01)
787+ *status |= FE_HAS_VITERBI | FE_HAS_LOCK;
557788 break;
558789 default:
559− printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n", __func__);
790+ dev_warn(&state->client->dev,
791+ "%s: Modulation set to unsupported value\n",
792+ __func__);
560793 }
561− return 0;
562−}
563−
564−/* Calculate SNR estimation (scaled by 2^24)
565−
566− 8-VSB SNR equations from LGDT3302 and LGDT3303 datasheets, QAM
567− equations from LGDT3303 datasheet. VSB is the same between the '02
568− and '03, so maybe QAM is too? Perhaps someone with a newer datasheet
569− that has QAM information could verify?
570−
571− For 8-VSB: (two ways, take your pick)
572− LGDT3302:
573− SNR_EQ = 10 * log10(25 * 24^2 / EQ_MSE)
574− LGDT3303:
575− SNR_EQ = 10 * log10(25 * 32^2 / EQ_MSE)
576− LGDT3302 & LGDT3303:
577− SNR_PT = 10 * log10(25 * 32^2 / PT_MSE) (we use this one)
578− For 64-QAM:
579− SNR = 10 * log10( 688128 / MSEQAM)
580− For 256-QAM:
581− SNR = 10 * log10( 696320 / MSEQAM)
582−
583− We re-write the snr equation as:
584− SNR * 2^24 = 10*(c - intlog10(MSE))
585− Where for 256-QAM, c = log10(696320) * 2^24, and so on. */
586794
587−static u32 calculate_snr(u32 mse, u32 c)
588−{
589− if (mse == 0) /* No signal */
795+ if (!(*status & FE_HAS_LOCK)) {
796+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
797+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
798+ p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
590799 return 0;
800+ }
591801
592− mse = intlog10(mse);
593− if (mse > c) {
594− /* Negative SNR, which is possible, but realisticly the
595− demod will lose lock before the signal gets this bad. The
596− API only allows for unsigned values, so just return 0 */
802+ if (state->last_stats_time &&
803+ time_is_after_jiffies(state->last_stats_time))
597804 return 0;
598− }
599− return 10*(c - mse);
600−}
601805
602−static int lgdt3302_read_snr(struct dvb_frontend* fe, u16* snr)
603−{
604− struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
605− u8 buf[5]; /* read data buffer */
606− u32 noise; /* noise value */
607− u32 c; /* per-modulation SNR calculation constant */
806+ state->last_stats_time = jiffies + msecs_to_jiffies(1000);
608807
609− switch(state->current_modulation) {
610− case VSB_8:
611− i2c_read_demod_bytes(state, LGDT3302_EQPH_ERR0, buf, 5);
612−#ifdef USE_EQMSE
613− /* Use Equalizer Mean-Square Error Register */
614− /* SNR for ranges from -15.61 to +41.58 */
615− noise = ((buf[0] & 7) << 16) | (buf[1] << 8) | buf[2];
616− c = 69765745; /* log10(25*24^2)*2^24 */
617−#else
618− /* Use Phase Tracker Mean-Square Error Register */
619− /* SNR for ranges from -13.11 to +44.08 */
620− noise = ((buf[0] & 7<<3) << 13) | (buf[3] << 8) | buf[4];
621− c = 73957994; /* log10(25*32^2)*2^24 */
622−#endif
623− break;
624− case QAM_64:
625− case QAM_256:
626− i2c_read_demod_bytes(state, CARRIER_MSEQAM1, buf, 2);
627− noise = ((buf[0] & 3) << 8) | buf[1];
628− c = state->current_modulation == QAM_64 ? 97939837 : 98026066;
629− /* log10(688128)*2^24 and log10(696320)*2^24 */
630− break;
631− default:
632− printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n",
633− __func__);
634− return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */
808+ err = lgdt3303_read_snr(fe);
809+ if (!err) {
810+ p->cnr.stat[0].scale = FE_SCALE_DECIBEL;
811+ p->cnr.stat[0].svalue = (((u64)state->snr) * 1000) >> 24;
812+ } else {
813+ p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
635814 }
636815
637− state->snr = calculate_snr(noise, c);
638− *snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */
639−
640− dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __func__, noise,
641− state->snr >> 24, (((state->snr>>8) & 0xffff) * 100) >> 16);
816+ err = i2c_read_demod_bytes(state, LGDT3303_PACKET_ERR_COUNTER1,
817+ buf, sizeof(buf));
818+ if (!err) {
819+ state->ucblocks = (buf[0] << 8) | buf[1];
642820
643− return 0;
644−}
821+ dprintk(state, "UCB = 0x%02x\n", state->ucblocks);
645822
646−static int lgdt3303_read_snr(struct dvb_frontend* fe, u16* snr)
647−{
648− struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
649− u8 buf[5]; /* read data buffer */
650− u32 noise; /* noise value */
651− u32 c; /* per-modulation SNR calculation constant */
823+ p->block_error.stat[0].uvalue += state->ucblocks;
824+ /* FIXME: what's the basis for block count */
825+ p->block_count.stat[0].uvalue += 10000;
652826
653− switch(state->current_modulation) {
654− case VSB_8:
655− i2c_read_demod_bytes(state, LGDT3303_EQPH_ERR0, buf, 5);
656−#ifdef USE_EQMSE
657− /* Use Equalizer Mean-Square Error Register */
658− /* SNR for ranges from -16.12 to +44.08 */
659− noise = ((buf[0] & 0x78) << 13) | (buf[1] << 8) | buf[2];
660− c = 73957994; /* log10(25*32^2)*2^24 */
661−#else
662− /* Use Phase Tracker Mean-Square Error Register */
663− /* SNR for ranges from -13.11 to +44.08 */
664− noise = ((buf[0] & 7) << 16) | (buf[3] << 8) | buf[4];
665− c = 73957994; /* log10(25*32^2)*2^24 */
666−#endif
667− break;
668− case QAM_64:
669− case QAM_256:
670− i2c_read_demod_bytes(state, CARRIER_MSEQAM1, buf, 2);
671− noise = (buf[0] << 8) | buf[1];
672− c = state->current_modulation == QAM_64 ? 97939837 : 98026066;
673− /* log10(688128)*2^24 and log10(696320)*2^24 */
674− break;
675− default:
676− printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n",
677− __func__);
678− return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */
827+ p->block_error.stat[0].scale = FE_SCALE_COUNTER;
828+ p->block_count.stat[0].scale = FE_SCALE_COUNTER;
829+ } else {
830+ p->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
831+ p->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
679832 }
680833
681− state->snr = calculate_snr(noise, c);
682− *snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */
683−
684− dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __func__, noise,
685− state->snr >> 24, (((state->snr >> 8) & 0xffff) * 100) >> 16);
686−
687834 return 0;
688835 }
689836
690−static int lgdt330x_read_signal_strength(struct dvb_frontend* fe, u16* strength)
691−{
692− /* Calculate Strength from SNR up to 35dB */
693− /* Even though the SNR can go higher than 35dB, there is some comfort */
694− /* factor in having a range of strong signals that can show at 100% */
695− struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
696− u16 snr;
697− int ret;
698−
699− ret = fe->ops.read_snr(fe, &snr);
700− if (ret != 0)
701− return ret;
702− /* Rather than use the 8.8 value snr, use state->snr which is 8.24 */
703− /* scale the range 0 - 35*2^24 into 0 - 65535 */
704− if (state->snr >= 8960 * 0x10000)
705− *strength = 0xffff;
706− else
707− *strength = state->snr / 8960;
708−
709− return 0;
710−}
711−
712−static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fe_tune_settings)
837+static int
838+lgdt330x_get_tune_settings(struct dvb_frontend *fe,
839+ struct dvb_frontend_tune_settings *fe_tune_settings)
713840 {
714841 /* I have no idea about this - it may not be needed */
715842 fe_tune_settings->min_delay_ms = 500;
@@ -718,43 +845,63 @@ static int lgdt330x_get_tune_settings(struct dvb_frontend* fe, struct dvb_fronte · 2 unmodified lines
718845 return 0;
719846 }
720847
721−static void lgdt330x_release(struct dvb_frontend* fe)
848+static void lgdt330x_release(struct dvb_frontend *fe)
722849 {
723− struct lgdt330x_state* state = (struct lgdt330x_state*) fe->demodulator_priv;
724− kfree(state);
850+ struct lgdt330x_state *state = fe->demodulator_priv;
851+ struct i2c_client *client = state->client;
852+
853+ dev_dbg(&client->dev, "\n");
854+
855+ i2c_unregister_device(client);
856+}
857+
858+static struct dvb_frontend *lgdt330x_get_dvb_frontend(struct i2c_client *client)
859+{
860+ struct lgdt330x_state *state = i2c_get_clientdata(client);
861+
862+ dev_dbg(&client->dev, "\n");
863+
864+ return &state->frontend;
725865 }
726866
727867 static const struct dvb_frontend_ops lgdt3302_ops;
728868 static const struct dvb_frontend_ops lgdt3303_ops;
729869
730−struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
731− struct i2c_adapter* i2c)
870+static int lgdt330x_probe(struct i2c_client *client,
871+ const struct i2c_device_id *id)
732872 {
733− struct lgdt330x_state* state = NULL;
873+ struct lgdt330x_state *state = NULL;
734874 u8 buf[1];
735875
736876 /* Allocate memory for the internal state */
737− state = kzalloc(sizeof(struct lgdt330x_state), GFP_KERNEL);
738− if (state == NULL)
877+ state = kzalloc(sizeof(*state), GFP_KERNEL);
878+ if (!state)
739879 goto error;
740880
741881 /* Setup the state */
742− state->config = config;
743− state->i2c = i2c;
882+ memcpy(&state->config, client->dev.platform_data,
883+ sizeof(state->config));
884+ i2c_set_clientdata(client, state);
885+ state->client = client;
744886
745887 /* Create dvb_frontend */
746− switch (config->demod_chip) {
888+ switch (state->config.demod_chip) {
747889 case LGDT3302:
748− memcpy(&state->frontend.ops, &lgdt3302_ops, sizeof(struct dvb_frontend_ops));
890+ memcpy(&state->frontend.ops, &lgdt3302_ops,
891+ sizeof(struct dvb_frontend_ops));
749892 break;
750893 case LGDT3303:
751− memcpy(&state->frontend.ops, &lgdt3303_ops, sizeof(struct dvb_frontend_ops));
894+ memcpy(&state->frontend.ops, &lgdt3303_ops,
895+ sizeof(struct dvb_frontend_ops));
752896 break;
753897 default:
754898 goto error;
755899 }
756900 state->frontend.demodulator_priv = state;
757901
902+ /* Setup get frontend callback */
903+ state->config.get_dvb_frontend = lgdt330x_get_dvb_frontend;
904+
758905 /* Verify communication with demod chip */
759906 if (i2c_read_demod_bytes(state, 2, buf, 1))
760907 goto error;
@@ -762,21 +909,44 @@ struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, · 1 unmodified line
762909 state->current_frequency = -1;
763910 state->current_modulation = -1;
764911
765− return &state->frontend;
912+ dev_info(&state->client->dev,
913+ "Demod loaded for LGDT330%s chip\n",
914+ state->config.demod_chip == LGDT3302 ? "2" : "3");
915+
916+ return 0;
766917
767918 error:
768919 kfree(state);
769− dprintk("%s: ERROR\n",__func__);
770− return NULL;
920+ if (debug)
921+ dev_printk(KERN_DEBUG, &client->dev, "Error loading lgdt330x driver\n");
922+ return -ENODEV;
923+}
924+struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *_config,
925+ u8 demod_address,
926+ struct i2c_adapter *i2c)
927+{
928+ struct i2c_client *client;
929+ struct i2c_board_info board_info = {};
930+ struct lgdt330x_config config = *_config;
931+
932+ strlcpy(board_info.type, "lgdt330x", sizeof(board_info.type));
933+ board_info.addr = demod_address;
934+ board_info.platform_data = &config;
935+ client = i2c_new_device(i2c, &board_info);
936+ if (!client || !client->dev.driver)
937+ return NULL;
938+
939+ return lgdt330x_get_dvb_frontend(client);
771940 }
941+EXPORT_SYMBOL(lgdt330x_attach);
772942
773943 static const struct dvb_frontend_ops lgdt3302_ops = {
774944 .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
775945 .info = {
776− .name= "LG Electronics LGDT3302 VSB/QAM Frontend",
777− .frequency_min= 54000000,
778− .frequency_max= 858000000,
779− .frequency_stepsize= 62500,
946+ .name = "LG Electronics LGDT3302 VSB/QAM Frontend",
947+ .frequency_min = 54000000,
948+ .frequency_max = 858000000,
949+ .frequency_stepsize = 62500,
780950 .symbol_rate_min = 5056941, /* QAM 64 */
781951 .symbol_rate_max = 10762000, /* VSB 8 */
782952 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
@@ -786,9 +956,8 @@ static const struct dvb_frontend_ops lgdt3302_ops = { · 3 unmodified lines
786956 .get_frontend = lgdt330x_get_frontend,
787957 .get_tune_settings = lgdt330x_get_tune_settings,
788958 .read_status = lgdt3302_read_status,
789− .read_ber = lgdt330x_read_ber,
790959 .read_signal_strength = lgdt330x_read_signal_strength,
791− .read_snr = lgdt3302_read_snr,
960+ .read_snr = lgdt330x_read_snr,
792961 .read_ucblocks = lgdt330x_read_ucblocks,
793962 .release = lgdt330x_release,
794963 };
@@ -796,10 +965,10 @@ static const struct dvb_frontend_ops lgdt3302_ops = { · 1 unmodified line
796965 static const struct dvb_frontend_ops lgdt3303_ops = {
797966 .delsys = { SYS_ATSC, SYS_DVBC_ANNEX_B },
798967 .info = {
799− .name= "LG Electronics LGDT3303 VSB/QAM Frontend",
800− .frequency_min= 54000000,
801− .frequency_max= 858000000,
802− .frequency_stepsize= 62500,
968+ .name = "LG Electronics LGDT3303 VSB/QAM Frontend",
969+ .frequency_min = 54000000,
970+ .frequency_max = 858000000,
971+ .frequency_stepsize = 62500,
803972 .symbol_rate_min = 5056941, /* QAM 64 */
804973 .symbol_rate_max = 10762000, /* VSB 8 */
805974 .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB
@@ -809,15 +978,42 @@ static const struct dvb_frontend_ops lgdt3303_ops = { · 3 unmodified lines
809978 .get_frontend = lgdt330x_get_frontend,
810979 .get_tune_settings = lgdt330x_get_tune_settings,
811980 .read_status = lgdt3303_read_status,
812− .read_ber = lgdt330x_read_ber,
813981 .read_signal_strength = lgdt330x_read_signal_strength,
814− .read_snr = lgdt3303_read_snr,
982+ .read_snr = lgdt330x_read_snr,
815983 .read_ucblocks = lgdt330x_read_ucblocks,
816984 .release = lgdt330x_release,
817985 };
818986
987+static int lgdt330x_remove(struct i2c_client *client)
988+{
989+ struct lgdt330x_state *state = i2c_get_clientdata(client);
990+
991+ dev_dbg(&client->dev, "\n");
992+
993+ kfree(state);
994+
995+ return 0;
996+}
997+
998+static const struct i2c_device_id lgdt330x_id_table[] = {
999+ {"lgdt330x", 0},
1000+ {}
1001+};
1002+MODULE_DEVICE_TABLE(i2c, lgdt330x_id_table);
1003+
1004+static struct i2c_driver lgdt330x_driver = {
1005+ .driver = {
1006+ .name = "lgdt330x",
1007+ .suppress_bind_attrs = true,
1008+ },
1009+ .probe = lgdt330x_probe,
1010+ .remove = lgdt330x_remove,
1011+ .id_table = lgdt330x_id_table,
1012+};
1013+
1014+module_i2c_driver(lgdt330x_driver);
1015+
1016+
8191017 MODULE_DESCRIPTION("LGDT330X (ATSC 8VSB & ITU-T J.83 AnnexB 64/256 QAM) Demodulator Driver");
8201018 MODULE_AUTHOR("Wilson Michaels");
8211019 MODULE_LICENSE("GPL");
822−
823−EXPORT_SYMBOL(lgdt330x_attach);
drivers/media/dvb-frontends/lgdt330x.h+24−17
@@ -26,34 +26,41 @@ typedef enum lg_chip_t { · 25 unmodified lines
2626 LGDT3303
2727 }lg_chip_type;
2828
29+/**
30+ * struct lgdt330x_config - contains lgdt330x configuration
31+ *
32+ * @demod_chip: LG demodulator chip LGDT3302 or LGDT3303
33+ * @serial_mpeg: MPEG hardware interface - 0:parallel 1:serial
34+ * @pll_rf_set: Callback function to set PLL interface
35+ * @set_ts_params: Callback function to set device param for start_dma
36+ * @clock_polarity_flip:
37+ * Flip the polarity of the mpeg data transfer clock using alternate
38+ * init data.
39+ * This option applies ONLY to LGDT3303 - 0:disabled (default) 1:enabled
40+ * @get_dvb_frontend:
41+ * returns the frontend associated with this I2C client.
42+ * Filled by the driver.
43+ */
2944 struct lgdt330x_config
3045 {
31− /* The demodulator's i2c address */
32− u8 demod_address;
33−
34− /* LG demodulator chip LGDT3302 or LGDT3303 */
3546 lg_chip_type demod_chip;
36−
37− /* MPEG hardware interface - 0:parallel 1:serial */
3847 int serial_mpeg;
39−
40− /* PLL interface */
4148 int (*pll_rf_set) (struct dvb_frontend* fe, int index);
42−
43− /* Need to set device param for start_dma */
4449 int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured);
45−
46− /* Flip the polarity of the mpeg data transfer clock using alternate init data
47− * This option applies ONLY to LGDT3303 - 0:disabled (default) 1:enabled */
4850 int clock_polarity_flip;
51+
52+ struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
4953 };
5054
5155 #if IS_REACHABLE(CONFIG_DVB_LGDT330X)
52−extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
53− struct i2c_adapter* i2c);
56+struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
57+ u8 demod_address,
58+ struct i2c_adapter *i2c);
5459 #else
55−static inline struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config,
56− struct i2c_adapter* i2c)
60+static inline
61+struct dvb_frontend *lgdt330x_attach(const struct lgdt330x_config *config,
62+ u8 demod_address,
63+ struct i2c_adapter *i2c)
5764 {
5865 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__);
5966 return NULL;
drivers/media/dvb-frontends/mb86a20s.c+1−1
@@ -2055,7 +2055,7 @@ static void mb86a20s_release(struct dvb_frontend *fe) · 2054 unmodified lines
20552055 kfree(state);
20562056 }
20572057
2058−static int mb86a20s_get_frontend_algo(struct dvb_frontend *fe)
2058+static enum dvbfe_algo mb86a20s_get_frontend_algo(struct dvb_frontend *fe)
20592059 {
20602060 return DVBFE_ALGO_HW;
20612061 }
drivers/media/dvb-frontends/mxl5xx.c+1−1
@@ -375,7 +375,7 @@ static void release(struct dvb_frontend *fe) · 374 unmodified lines
375375 kfree(state);
376376 }
377377
378−static int get_algo(struct dvb_frontend *fe)
378+static enum dvbfe_algo get_algo(struct dvb_frontend *fe)
379379 {
380380 return DVBFE_ALGO_HW;
381381 }
drivers/media/dvb-frontends/s921.c+1−1
@@ -464,7 +464,7 @@ static int s921_tune(struct dvb_frontend *fe, · 463 unmodified lines
464464 return rc;
465465 }
466466
467−static int s921_get_algo(struct dvb_frontend *fe)
467+static enum dvbfe_algo s921_get_algo(struct dvb_frontend *fe)
468468 {
469469 return DVBFE_ALGO_HW;
470470 }
drivers/media/dvb-frontends/stv0910.c+10−5
@@ -1200,7 +1200,6 @@ static int probe(struct stv *state) · 1199 unmodified lines
12001200 write_reg(state, RSTV0910_P1_TSCFGM, 0xC0); /* Manual speed */
12011201 write_reg(state, RSTV0910_P1_TSCFGL, 0x20);
12021202
1203− /* Speed = 67.5 MHz */
12041203 write_reg(state, RSTV0910_P1_TSSPEED, state->tsspeed);
12051204
12061205 write_reg(state, RSTV0910_P2_TSCFGH, state->tscfgh | 0x01);
@@ -1208,7 +1207,6 @@ static int probe(struct stv *state) · 1 unmodified line
12081207 write_reg(state, RSTV0910_P2_TSCFGM, 0xC0); /* Manual speed */
12091208 write_reg(state, RSTV0910_P2_TSCFGL, 0x20);
12101209
1211− /* Speed = 67.5 MHz */
12121210 write_reg(state, RSTV0910_P2_TSSPEED, state->tsspeed);
12131211
12141212 /* Reset stream merger */
@@ -1220,6 +1218,12 @@ static int probe(struct stv *state) · 5 unmodified lines
12201218 write_reg(state, RSTV0910_P1_I2CRPT, state->i2crpt);
12211219 write_reg(state, RSTV0910_P2_I2CRPT, state->i2crpt);
12221220
1221+ write_reg(state, RSTV0910_P1_TSINSDELM, 0x17);
1222+ write_reg(state, RSTV0910_P1_TSINSDELL, 0xff);
1223+
1224+ write_reg(state, RSTV0910_P2_TSINSDELM, 0x17);
1225+ write_reg(state, RSTV0910_P2_TSINSDELL, 0xff);
1226+
12231227 init_diseqc(state);
12241228 return 0;
12251229 }
@@ -1320,7 +1324,7 @@ static int read_snr(struct dvb_frontend *fe) · 94 unmodified lines
13201324
13211325 if (!get_signal_to_noise(state, &snrval)) {
13221326 p->cnr.stat[0].scale = FE_SCALE_DECIBEL;
1323− p->cnr.stat[0].uvalue = 100 * snrval; /* fix scale */
1327+ p->cnr.stat[0].svalue = 100 * snrval; /* fix scale */
13241328 } else {
13251329 p->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
13261330 }
@@ -1633,7 +1637,7 @@ static int tune(struct dvb_frontend *fe, bool re_tune, · 306 unmodified lines
16331637 return 0;
16341638 }
16351639
1636−static int get_algo(struct dvb_frontend *fe)
1640+static enum dvbfe_algo get_algo(struct dvb_frontend *fe)
16371641 {
16381642 return DVBFE_ALGO_HW;
16391643 }
@@ -1784,7 +1788,8 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, · 144 unmodified lines
17841788 state->tscfgh = 0x20 | (cfg->parallel ? 0 : 0x40);
17851789 state->tsgeneral = (cfg->parallel == 2) ? 0x02 : 0x00;
17861790 state->i2crpt = 0x0A | ((cfg->rptlvl & 0x07) << 4);
1787− state->tsspeed = 0x28;
1791+ /* use safe tsspeed value if unspecified through stv0910_cfg */
1792+ state->tsspeed = (cfg->tsspeed ? cfg->tsspeed : 0x28);
17881793 state->nr = nr;
17891794 state->regoff = state->nr ? 0 : 0x200;
17901795 state->search_range = 16000000;
drivers/media/dvb-frontends/stv0910.h+1−0
@@ -10,6 +10,7 @@ struct stv0910_cfg { · 9 unmodified lines
1010 u8 parallel;
1111 u8 rptlvl;
1212 u8 single;
13+ u8 tsspeed;
1314 };
1415
1516 #if IS_REACHABLE(CONFIG_DVB_STV0910)
drivers/media/dvb-frontends/tc90522.c+3−12
@@ -1,17 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Toshiba TC90522 Demodulator
34 *
45 * Copyright (C) 2014 Akihiro Tsukada <tskd08@gmail.com>
5− *
6− * This program is free software; you can redistribute it and/or
7− * modify it under the terms of the GNU General Public License as
8− * published by the Free Software Foundation version 2.
9− *
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
156 */
167
178 /*
@@ -352,7 +343,7 @@ static int tc90522t_get_frontend(struct dvb_frontend *fe, · 334 unmodified lines
352343 mode = 1;
353344 ret = reg_read(state, 0xb0, val, 1);
354345 if (ret == 0) {
355− mode = (val[0] & 0xc0) >> 2;
346+ mode = (val[0] & 0xc0) >> 6;
356347 c->transmission_mode = tm_conv[mode];
357348 c->guard_interval = (val[0] & 0x30) >> 4;
358349 }
@@ -379,7 +370,7 @@ static int tc90522t_get_frontend(struct dvb_frontend *fe, · 20 unmodified lines
379370 }
380371
381372 /* layer B */
382− v = (val[3] & 0x03) << 1 | (val[4] & 0xc0) >> 6;
373+ v = (val[3] & 0x03) << 2 | (val[4] & 0xc0) >> 6;
383374 if (v == 0x0f)
384375 c->layer[1].segment_count = 0;
385376 else {
drivers/media/dvb-frontends/tc90522.h+1−10
@@ -1,17 +1,8 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 /*
23 * Toshiba TC90522 Demodulator
34 *
45 * Copyright (C) 2014 Akihiro Tsukada <tskd08@gmail.com>
5− *
6− * This program is free software; you can redistribute it and/or
7− * modify it under the terms of the GNU General Public License as
8− * published by the Free Software Foundation version 2.
9− *
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
156 */
167
178 /*
drivers/media/i2c/Kconfig+36−0
@@ -575,6 +575,17 @@ config VIDEO_APTINA_PLL · 574 unmodified lines
575575 config VIDEO_SMIAPP_PLL
576576 tristate
577577
578+config VIDEO_IMX258
579+ tristate "Sony IMX258 sensor support"
580+ depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
581+ depends on MEDIA_CAMERA_SUPPORT
582+ ---help---
583+ This is a Video4Linux2 sensor-level driver for the Sony
584+ IMX258 camera.
585+
586+ To compile this driver as a module, choose M here: the
587+ module will be called imx258.
588+
578589 config VIDEO_IMX274
579590 tristate "Sony IMX274 sensor support"
580591 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
@@ -688,6 +699,18 @@ config VIDEO_OV5695 · 107 unmodified lines
688699 To compile this driver as a module, choose M here: the
689700 module will be called ov5695.
690701
702+config VIDEO_OV7251
703+ tristate "OmniVision OV7251 sensor support"
704+ depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
705+ depends on MEDIA_CAMERA_SUPPORT
706+ select V4L2_FWNODE
707+ help
708+ This is a Video4Linux2 sensor-level driver for the OmniVision
709+ OV7251 camera.
710+
711+ To compile this driver as a module, choose M here: the
712+ module will be called ov7251.
713+
691714 config VIDEO_OV772X
692715 tristate "OmniVision OV772x sensor support"
693716 depends on I2C && VIDEO_V4L2
@@ -974,6 +997,19 @@ config VIDEO_M52790 · 280 unmodified lines
974997
975998 To compile this driver as a module, choose M here: the
976999 module will be called m52790.
1000+
1001+config VIDEO_I2C
1002+ tristate "I2C transport video support"
1003+ depends on VIDEO_V4L2 && I2C
1004+ select VIDEOBUF2_VMALLOC
1005+ ---help---
1006+ Enable the I2C transport video support which supports the
1007+ following:
1008+ * Panasonic AMG88xx Grid-Eye Sensors
1009+
1010+ To compile this driver as a module, choose M here: the
1011+ module will be called video-i2c
1012+
9771013 endmenu
9781014
9791015 menu "Sensors used on soc_camera driver"
drivers/media/i2c/Makefile+3−0
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_OV5647) += ov5647.o · 69 unmodified lines
7070 obj-$(CONFIG_VIDEO_OV5670) += ov5670.o
7171 obj-$(CONFIG_VIDEO_OV5695) += ov5695.o
7272 obj-$(CONFIG_VIDEO_OV6650) += ov6650.o
73+obj-$(CONFIG_VIDEO_OV7251) += ov7251.o
7374 obj-$(CONFIG_VIDEO_OV7640) += ov7640.o
7475 obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
7576 obj-$(CONFIG_VIDEO_OV772X) += ov772x.o
@@ -96,9 +97,11 @@ obj-$(CONFIG_VIDEO_LM3646) += lm3646.o · 20 unmodified lines
9697 obj-$(CONFIG_VIDEO_SMIAPP_PLL) += smiapp-pll.o
9798 obj-$(CONFIG_VIDEO_AK881X) += ak881x.o
9899 obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
100+obj-$(CONFIG_VIDEO_I2C) += video-i2c.o
99101 obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o
100102 obj-$(CONFIG_VIDEO_OV2659) += ov2659.o
101103 obj-$(CONFIG_VIDEO_TC358743) += tc358743.o
104+obj-$(CONFIG_VIDEO_IMX258) += imx258.o
102105 obj-$(CONFIG_VIDEO_IMX274) += imx274.o
103106
104107 obj-$(CONFIG_SDR_MAX2175) += max2175.o
drivers/media/i2c/adv748x/adv748x-afe.c+6−6
@@ -321,17 +321,17 @@ static const struct v4l2_subdev_video_ops adv748x_afe_video_ops = { · 320 unmodified lines
321321 static int adv748x_afe_propagate_pixelrate(struct adv748x_afe *afe)
322322 {
323323 struct v4l2_subdev *tx;
324− unsigned int width, height, fps;
325324
326325 tx = adv748x_get_remote_sd(&afe->pads[ADV748X_AFE_SOURCE]);
327326 if (!tx)
328327 return -ENOLINK;
329328
330− width = 720;
331− height = afe->curr_norm & V4L2_STD_525_60 ? 480 : 576;
332− fps = afe->curr_norm & V4L2_STD_525_60 ? 30 : 25;
333−
334− return adv748x_csi2_set_pixelrate(tx, width * height * fps);
329+ /*
330+ * The ADV748x ADC sampling frequency is twice the externally supplied
331+ * clock whose frequency is required to be 28.63636 MHz. It oversamples
332+ * with a factor of 4 resulting in a pixel rate of 14.3180180 MHz.
333+ */
334+ return adv748x_csi2_set_pixelrate(tx, 14318180);
335335 }
336336
337337 static int adv748x_afe_enum_mbus_code(struct v4l2_subdev *sd,
drivers/media/i2c/adv748x/adv748x-hdmi.c+1−7
@@ -402,8 +402,6 @@ static int adv748x_hdmi_propagate_pixelrate(struct adv748x_hdmi *hdmi) · 401 unmodified lines
402402 {
403403 struct v4l2_subdev *tx;
404404 struct v4l2_dv_timings timings;
405− struct v4l2_bt_timings *bt = &timings.bt;
406− unsigned int fps;
407405
408406 tx = adv748x_get_remote_sd(&hdmi->pads[ADV748X_HDMI_SOURCE]);
409407 if (!tx)
@@ -411,11 +409,7 @@ static int adv748x_hdmi_propagate_pixelrate(struct adv748x_hdmi *hdmi) · 1 unmodified line
411409
412410 adv748x_hdmi_query_dv_timings(&hdmi->sd, &timings);
413411
414− fps = DIV_ROUND_CLOSEST_ULL(bt->pixelclock,
415− V4L2_DV_BT_FRAME_WIDTH(bt) *
416− V4L2_DV_BT_FRAME_HEIGHT(bt));
417−
418− return adv748x_csi2_set_pixelrate(tx, bt->width * bt->height * fps);
412+ return adv748x_csi2_set_pixelrate(tx, timings.bt.pixelclock);
419413 }
420414
421415 static int adv748x_hdmi_enum_mbus_code(struct v4l2_subdev *sd,
drivers/media/i2c/adv7511.c+11−11
@@ -732,8 +732,8 @@ static int adv7511_cec_adap_enable(struct cec_adapter *adap, bool enable) · 731 unmodified lines
732732 /* power up cec section */
733733 adv7511_cec_write_and_or(sd, 0x4e, 0xfc, 0x01);
734734 /* legacy mode and clear all rx buffers */
735+ adv7511_cec_write(sd, 0x4a, 0x00);
735736 adv7511_cec_write(sd, 0x4a, 0x07);
736− adv7511_cec_write(sd, 0x4a, 0);
737737 adv7511_cec_write_and_or(sd, 0x11, 0xfe, 0); /* initially disable tx */
738738 /* enabled irqs: */
739739 /* tx: ready */
@@ -831,8 +831,8 @@ static int adv7511_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, · 91 unmodified lines
831831 */
832832 adv7511_cec_write_and_or(sd, 0x12, ~0x70, max(1, attempts - 1) << 4);
833833
834− /* blocking, clear cec tx irq status */
835− adv7511_wr_and_or(sd, 0x97, 0xc7, 0x38);
834+ /* clear cec tx irq status */
835+ adv7511_wr(sd, 0x97, 0x38);
836836
837837 /* write data */
838838 for (i = 0; i < len; i++)
@@ -917,9 +917,6 @@ static void adv7511_set_isr(struct v4l2_subdev *sd, bool enable) · 78 unmodified lines
917917 else if (adv7511_have_hotplug(sd))
918918 irqs |= MASK_ADV7511_EDID_RDY_INT;
919919
920− adv7511_wr_and_or(sd, 0x95, 0xc0,
921− (state->cec_enabled_adap && enable) ? 0x39 : 0x00);
922−
923920 /*
924921 * This i2c write can fail (approx. 1 in 1000 writes). But it
925922 * is essential that this register is correct, so retry it
@@ -933,9 +930,11 @@ static void adv7511_set_isr(struct v4l2_subdev *sd, bool enable) · 7 unmodified lines
933930 irqs_rd = adv7511_rd(sd, 0x94);
934931 } while (retries-- && irqs_rd != irqs);
935932
936− if (irqs_rd == irqs)
937− return;
938− v4l2_err(sd, "Could not set interrupts: hw failure?\n");
933+ if (irqs_rd != irqs)
934+ v4l2_err(sd, "Could not set interrupts: hw failure?\n");
935+
936+ adv7511_wr_and_or(sd, 0x95, 0xc0,
937+ (state->cec_enabled_adap && enable) ? 0x39 : 0x00);
939938 }
940939
941940 /* Interrupt handler */
@@ -982,8 +981,8 @@ static int adv7511_isr(struct v4l2_subdev *sd, u32 status, bool *handled) · 40 unmodified lines
982981 for (i = 0; i < msg.len; i++)
983982 msg.msg[i] = adv7511_cec_read(sd, i + 0x15);
984983
985− adv7511_cec_write(sd, 0x4a, 1); /* toggle to re-enable rx 1 */
986− adv7511_cec_write(sd, 0x4a, 0);
984+ adv7511_cec_write(sd, 0x4a, 0); /* toggle to re-enable rx 1 */
985+ adv7511_cec_write(sd, 0x4a, 1);
987986 cec_received_msg(state->cec_adap, &msg);
988987 }
989988 }
@@ -1778,6 +1777,7 @@ static void adv7511_init_setup(struct v4l2_subdev *sd) · 788 unmodified lines
17781777
17791778 /* legacy mode */
17801779 adv7511_cec_write(sd, 0x4a, 0x00);
1780+ adv7511_cec_write(sd, 0x4a, 0x07);
17811781
17821782 if (cec_clk % 750000 != 0)
17831783 v4l2_err(sd, "%s: cec_clk %d, not multiple of 750 Khz\n",
drivers/media/i2c/imx258.c+1318−0
@@ -0,0 +1,1318 @@
1+// SPDX-License-Identifier: GPL-2.0
2+// Copyright (C) 2018 Intel Corporation
3+
4+#include <linux/acpi.h>
5+#include <linux/delay.h>
6+#include <linux/i2c.h>
7+#include <linux/module.h>
8+#include <linux/pm_runtime.h>
9+#include <media/v4l2-ctrls.h>
10+#include <media/v4l2-device.h>
11+#include <asm/unaligned.h>
12+
13+#define IMX258_REG_VALUE_08BIT 1
14+#define IMX258_REG_VALUE_16BIT 2
15+
16+#define IMX258_REG_MODE_SELECT 0x0100
17+#define IMX258_MODE_STANDBY 0x00
18+#define IMX258_MODE_STREAMING 0x01
19+
20+/* Chip ID */
21+#define IMX258_REG_CHIP_ID 0x0016
22+#define IMX258_CHIP_ID 0x0258
23+
24+/* V_TIMING internal */
25+#define IMX258_VTS_30FPS 0x0c98
26+#define IMX258_VTS_30FPS_2K 0x0638
27+#define IMX258_VTS_30FPS_VGA 0x034c
28+#define IMX258_VTS_MAX 0xffff
29+
30+/*Frame Length Line*/
31+#define IMX258_FLL_MIN 0x08a6
32+#define IMX258_FLL_MAX 0xffff
33+#define IMX258_FLL_STEP 1
34+#define IMX258_FLL_DEFAULT 0x0c98
35+
36+/* HBLANK control - read only */
37+#define IMX258_PPL_DEFAULT 5352
38+
39+/* Exposure control */
40+#define IMX258_REG_EXPOSURE 0x0202
41+#define IMX258_EXPOSURE_MIN 4
42+#define IMX258_EXPOSURE_STEP 1
43+#define IMX258_EXPOSURE_DEFAULT 0x640
44+#define IMX258_EXPOSURE_MAX 65535
45+
46+/* Analog gain control */
47+#define IMX258_REG_ANALOG_GAIN 0x0204
48+#define IMX258_ANA_GAIN_MIN 0
49+#define IMX258_ANA_GAIN_MAX 0x1fff
50+#define IMX258_ANA_GAIN_STEP 1
51+#define IMX258_ANA_GAIN_DEFAULT 0x0
52+
53+/* Digital gain control */
54+#define IMX258_REG_GR_DIGITAL_GAIN 0x020e
55+#define IMX258_REG_R_DIGITAL_GAIN 0x0210
56+#define IMX258_REG_B_DIGITAL_GAIN 0x0212
57+#define IMX258_REG_GB_DIGITAL_GAIN 0x0214
58+#define IMX258_DGTL_GAIN_MIN 0
59+#define IMX258_DGTL_GAIN_MAX 4096 /* Max = 0xFFF */
60+#define IMX258_DGTL_GAIN_DEFAULT 1024
61+#define IMX258_DGTL_GAIN_STEP 1
62+
63+/* Test Pattern Control */
64+#define IMX258_REG_TEST_PATTERN 0x0600
65+#define IMX258_TEST_PATTERN_DISABLE 0
66+#define IMX258_TEST_PATTERN_SOLID_COLOR 1
67+#define IMX258_TEST_PATTERN_COLOR_BARS 2
68+#define IMX258_TEST_PATTERN_GREY_COLOR 3
69+#define IMX258_TEST_PATTERN_PN9 4
70+
71+/* Orientation */
72+#define REG_MIRROR_FLIP_CONTROL 0x0101
73+#define REG_CONFIG_MIRROR_FLIP 0x03
74+#define REG_CONFIG_FLIP_TEST_PATTERN 0x02
75+
76+struct imx258_reg {
77+ u16 address;
78+ u8 val;
79+};
80+
81+struct imx258_reg_list {
82+ u32 num_of_regs;
83+ const struct imx258_reg *regs;
84+};
85+
86+/* Link frequency config */
87+struct imx258_link_freq_config {
88+ u32 pixels_per_line;
89+
90+ /* PLL registers for this link frequency */
91+ struct imx258_reg_list reg_list;
92+};
93+
94+/* Mode : resolution and related config&values */
95+struct imx258_mode {
96+ /* Frame width */
97+ u32 width;
98+ /* Frame height */
99+ u32 height;
100+
101+ /* V-timing */
102+ u32 vts_def;
103+ u32 vts_min;
104+
105+ /* Index of Link frequency config to be used */
106+ u32 link_freq_index;
107+ /* Default register values */
108+ struct imx258_reg_list reg_list;
109+};
110+
111+/* 4208x3118 needs 1267Mbps/lane, 4 lanes */
112+static const struct imx258_reg mipi_data_rate_1267mbps[] = {
113+ { 0x0301, 0x05 },
114+ { 0x0303, 0x02 },
115+ { 0x0305, 0x03 },
116+ { 0x0306, 0x00 },
117+ { 0x0307, 0xC6 },
118+ { 0x0309, 0x0A },
119+ { 0x030B, 0x01 },
120+ { 0x030D, 0x02 },
121+ { 0x030E, 0x00 },
122+ { 0x030F, 0xD8 },
123+ { 0x0310, 0x00 },
124+ { 0x0820, 0x13 },
125+ { 0x0821, 0x4C },
126+ { 0x0822, 0xCC },
127+ { 0x0823, 0xCC },
128+};
129+
130+static const struct imx258_reg mipi_data_rate_640mbps[] = {
131+ { 0x0301, 0x05 },
132+ { 0x0303, 0x02 },
133+ { 0x0305, 0x03 },
134+ { 0x0306, 0x00 },
135+ { 0x0307, 0x64 },
136+ { 0x0309, 0x0A },
137+ { 0x030B, 0x01 },
138+ { 0x030D, 0x02 },
139+ { 0x030E, 0x00 },
140+ { 0x030F, 0xD8 },
141+ { 0x0310, 0x00 },
142+ { 0x0820, 0x0A },
143+ { 0x0821, 0x00 },
144+ { 0x0822, 0x00 },
145+ { 0x0823, 0x00 },
146+};
147+
148+static const struct imx258_reg mode_4208x3118_regs[] = {
149+ { 0x0136, 0x13 },
150+ { 0x0137, 0x33 },
151+ { 0x3051, 0x00 },
152+ { 0x3052, 0x00 },
153+ { 0x4E21, 0x14 },
154+ { 0x6B11, 0xCF },
155+ { 0x7FF0, 0x08 },
156+ { 0x7FF1, 0x0F },
157+ { 0x7FF2, 0x08 },
158+ { 0x7FF3, 0x1B },
159+ { 0x7FF4, 0x23 },
160+ { 0x7FF5, 0x60 },
161+ { 0x7FF6, 0x00 },
162+ { 0x7FF7, 0x01 },
163+ { 0x7FF8, 0x00 },
164+ { 0x7FF9, 0x78 },
165+ { 0x7FFA, 0x00 },
166+ { 0x7FFB, 0x00 },
167+ { 0x7FFC, 0x00 },
168+ { 0x7FFD, 0x00 },
169+ { 0x7FFE, 0x00 },
170+ { 0x7FFF, 0x03 },
171+ { 0x7F76, 0x03 },
172+ { 0x7F77, 0xFE },
173+ { 0x7FA8, 0x03 },
174+ { 0x7FA9, 0xFE },
175+ { 0x7B24, 0x81 },
176+ { 0x7B25, 0x00 },
177+ { 0x6564, 0x07 },
178+ { 0x6B0D, 0x41 },
179+ { 0x653D, 0x04 },
180+ { 0x6B05, 0x8C },
181+ { 0x6B06, 0xF9 },
182+ { 0x6B08, 0x65 },
183+ { 0x6B09, 0xFC },
184+ { 0x6B0A, 0xCF },
185+ { 0x6B0B, 0xD2 },
186+ { 0x6700, 0x0E },
187+ { 0x6707, 0x0E },
188+ { 0x9104, 0x00 },
189+ { 0x4648, 0x7F },
190+ { 0x7420, 0x00 },
191+ { 0x7421, 0x1C },
192+ { 0x7422, 0x00 },
193+ { 0x7423, 0xD7 },
194+ { 0x5F04, 0x00 },
195+ { 0x5F05, 0xED },
196+ { 0x0112, 0x0A },
197+ { 0x0113, 0x0A },
198+ { 0x0114, 0x03 },
199+ { 0x0342, 0x14 },
200+ { 0x0343, 0xE8 },
201+ { 0x0340, 0x0C },
202+ { 0x0341, 0x50 },
203+ { 0x0344, 0x00 },
204+ { 0x0345, 0x00 },
205+ { 0x0346, 0x00 },
206+ { 0x0347, 0x00 },
207+ { 0x0348, 0x10 },
208+ { 0x0349, 0x6F },
209+ { 0x034A, 0x0C },
210+ { 0x034B, 0x2E },
211+ { 0x0381, 0x01 },
212+ { 0x0383, 0x01 },
213+ { 0x0385, 0x01 },
214+ { 0x0387, 0x01 },
215+ { 0x0900, 0x00 },
216+ { 0x0901, 0x11 },
217+ { 0x0401, 0x00 },
218+ { 0x0404, 0x00 },
219+ { 0x0405, 0x10 },
220+ { 0x0408, 0x00 },
221+ { 0x0409, 0x00 },
222+ { 0x040A, 0x00 },
223+ { 0x040B, 0x00 },
224+ { 0x040C, 0x10 },
225+ { 0x040D, 0x70 },
226+ { 0x040E, 0x0C },
227+ { 0x040F, 0x30 },
228+ { 0x3038, 0x00 },
229+ { 0x303A, 0x00 },
230+ { 0x303B, 0x10 },
231+ { 0x300D, 0x00 },
232+ { 0x034C, 0x10 },
233+ { 0x034D, 0x70 },
234+ { 0x034E, 0x0C },
235+ { 0x034F, 0x30 },
236+ { 0x0350, 0x01 },
237+ { 0x0202, 0x0C },
238+ { 0x0203, 0x46 },
239+ { 0x0204, 0x00 },
240+ { 0x0205, 0x00 },
241+ { 0x020E, 0x01 },
242+ { 0x020F, 0x00 },
243+ { 0x0210, 0x01 },
244+ { 0x0211, 0x00 },
245+ { 0x0212, 0x01 },
246+ { 0x0213, 0x00 },
247+ { 0x0214, 0x01 },
248+ { 0x0215, 0x00 },
249+ { 0x7BCD, 0x00 },
250+ { 0x94DC, 0x20 },
251+ { 0x94DD, 0x20 },
252+ { 0x94DE, 0x20 },
253+ { 0x95DC, 0x20 },
254+ { 0x95DD, 0x20 },
255+ { 0x95DE, 0x20 },
256+ { 0x7FB0, 0x00 },
257+ { 0x9010, 0x3E },
258+ { 0x9419, 0x50 },
259+ { 0x941B, 0x50 },
260+ { 0x9519, 0x50 },
261+ { 0x951B, 0x50 },
262+ { 0x3030, 0x00 },
263+ { 0x3032, 0x00 },
264+ { 0x0220, 0x00 },
265+};
266+
267+static const struct imx258_reg mode_2104_1560_regs[] = {
268+ { 0x0136, 0x13 },
269+ { 0x0137, 0x33 },
270+ { 0x3051, 0x00 },
271+ { 0x3052, 0x00 },
272+ { 0x4E21, 0x14 },
273+ { 0x6B11, 0xCF },
274+ { 0x7FF0, 0x08 },
275+ { 0x7FF1, 0x0F },
276+ { 0x7FF2, 0x08 },
277+ { 0x7FF3, 0x1B },
278+ { 0x7FF4, 0x23 },
279+ { 0x7FF5, 0x60 },
280+ { 0x7FF6, 0x00 },
281+ { 0x7FF7, 0x01 },
282+ { 0x7FF8, 0x00 },
283+ { 0x7FF9, 0x78 },
284+ { 0x7FFA, 0x00 },
285+ { 0x7FFB, 0x00 },
286+ { 0x7FFC, 0x00 },
287+ { 0x7FFD, 0x00 },
288+ { 0x7FFE, 0x00 },
289+ { 0x7FFF, 0x03 },
290+ { 0x7F76, 0x03 },
291+ { 0x7F77, 0xFE },
292+ { 0x7FA8, 0x03 },
293+ { 0x7FA9, 0xFE },
294+ { 0x7B24, 0x81 },
295+ { 0x7B25, 0x00 },
296+ { 0x6564, 0x07 },
297+ { 0x6B0D, 0x41 },
298+ { 0x653D, 0x04 },
299+ { 0x6B05, 0x8C },
300+ { 0x6B06, 0xF9 },
301+ { 0x6B08, 0x65 },
302+ { 0x6B09, 0xFC },
303+ { 0x6B0A, 0xCF },
304+ { 0x6B0B, 0xD2 },
305+ { 0x6700, 0x0E },
306+ { 0x6707, 0x0E },
307+ { 0x9104, 0x00 },
308+ { 0x4648, 0x7F },
309+ { 0x7420, 0x00 },
310+ { 0x7421, 0x1C },
311+ { 0x7422, 0x00 },
312+ { 0x7423, 0xD7 },
313+ { 0x5F04, 0x00 },
314+ { 0x5F05, 0xED },
315+ { 0x0112, 0x0A },
316+ { 0x0113, 0x0A },
317+ { 0x0114, 0x03 },
318+ { 0x0342, 0x14 },
319+ { 0x0343, 0xE8 },
320+ { 0x0340, 0x06 },
321+ { 0x0341, 0x38 },
322+ { 0x0344, 0x00 },
323+ { 0x0345, 0x00 },
324+ { 0x0346, 0x00 },
325+ { 0x0347, 0x00 },
326+ { 0x0348, 0x10 },
327+ { 0x0349, 0x6F },
328+ { 0x034A, 0x0C },
329+ { 0x034B, 0x2E },
330+ { 0x0381, 0x01 },
331+ { 0x0383, 0x01 },
332+ { 0x0385, 0x01 },
333+ { 0x0387, 0x01 },
334+ { 0x0900, 0x01 },
335+ { 0x0901, 0x12 },
336+ { 0x0401, 0x01 },
337+ { 0x0404, 0x00 },
338+ { 0x0405, 0x20 },
339+ { 0x0408, 0x00 },
340+ { 0x0409, 0x02 },
341+ { 0x040A, 0x00 },
342+ { 0x040B, 0x00 },
343+ { 0x040C, 0x10 },
344+ { 0x040D, 0x6A },
345+ { 0x040E, 0x06 },
346+ { 0x040F, 0x18 },
347+ { 0x3038, 0x00 },
348+ { 0x303A, 0x00 },
349+ { 0x303B, 0x10 },
350+ { 0x300D, 0x00 },
351+ { 0x034C, 0x08 },
352+ { 0x034D, 0x38 },
353+ { 0x034E, 0x06 },
354+ { 0x034F, 0x18 },
355+ { 0x0350, 0x01 },
356+ { 0x0202, 0x06 },
357+ { 0x0203, 0x2E },
358+ { 0x0204, 0x00 },
359+ { 0x0205, 0x00 },
360+ { 0x020E, 0x01 },
361+ { 0x020F, 0x00 },
362+ { 0x0210, 0x01 },
363+ { 0x0211, 0x00 },
364+ { 0x0212, 0x01 },
365+ { 0x0213, 0x00 },
366+ { 0x0214, 0x01 },
367+ { 0x0215, 0x00 },
368+ { 0x7BCD, 0x01 },
369+ { 0x94DC, 0x20 },
370+ { 0x94DD, 0x20 },
371+ { 0x94DE, 0x20 },
372+ { 0x95DC, 0x20 },
373+ { 0x95DD, 0x20 },
374+ { 0x95DE, 0x20 },
375+ { 0x7FB0, 0x00 },
376+ { 0x9010, 0x3E },
377+ { 0x9419, 0x50 },
378+ { 0x941B, 0x50 },
379+ { 0x9519, 0x50 },
380+ { 0x951B, 0x50 },
381+ { 0x3030, 0x00 },
382+ { 0x3032, 0x00 },
383+ { 0x0220, 0x00 },
384+};
385+
386+static const struct imx258_reg mode_1048_780_regs[] = {
387+ { 0x0136, 0x13 },
388+ { 0x0137, 0x33 },
389+ { 0x3051, 0x00 },
390+ { 0x3052, 0x00 },
391+ { 0x4E21, 0x14 },
392+ { 0x6B11, 0xCF },
393+ { 0x7FF0, 0x08 },
394+ { 0x7FF1, 0x0F },
395+ { 0x7FF2, 0x08 },
396+ { 0x7FF3, 0x1B },
397+ { 0x7FF4, 0x23 },
398+ { 0x7FF5, 0x60 },
399+ { 0x7FF6, 0x00 },
400+ { 0x7FF7, 0x01 },
401+ { 0x7FF8, 0x00 },
402+ { 0x7FF9, 0x78 },
403+ { 0x7FFA, 0x00 },
404+ { 0x7FFB, 0x00 },
405+ { 0x7FFC, 0x00 },
406+ { 0x7FFD, 0x00 },
407+ { 0x7FFE, 0x00 },
408+ { 0x7FFF, 0x03 },
409+ { 0x7F76, 0x03 },
410+ { 0x7F77, 0xFE },
411+ { 0x7FA8, 0x03 },
412+ { 0x7FA9, 0xFE },
413+ { 0x7B24, 0x81 },
414+ { 0x7B25, 0x00 },
415+ { 0x6564, 0x07 },
416+ { 0x6B0D, 0x41 },
417+ { 0x653D, 0x04 },
418+ { 0x6B05, 0x8C },
419+ { 0x6B06, 0xF9 },
420+ { 0x6B08, 0x65 },
421+ { 0x6B09, 0xFC },
422+ { 0x6B0A, 0xCF },
423+ { 0x6B0B, 0xD2 },
424+ { 0x6700, 0x0E },
425+ { 0x6707, 0x0E },
426+ { 0x9104, 0x00 },
427+ { 0x4648, 0x7F },
428+ { 0x7420, 0x00 },
429+ { 0x7421, 0x1C },
430+ { 0x7422, 0x00 },
431+ { 0x7423, 0xD7 },
432+ { 0x5F04, 0x00 },
433+ { 0x5F05, 0xED },
434+ { 0x0112, 0x0A },
435+ { 0x0113, 0x0A },
436+ { 0x0114, 0x03 },
437+ { 0x0342, 0x14 },
438+ { 0x0343, 0xE8 },
439+ { 0x0340, 0x03 },
440+ { 0x0341, 0x4C },
441+ { 0x0344, 0x00 },
442+ { 0x0345, 0x00 },
443+ { 0x0346, 0x00 },
444+ { 0x0347, 0x00 },
445+ { 0x0348, 0x10 },
446+ { 0x0349, 0x6F },
447+ { 0x034A, 0x0C },
448+ { 0x034B, 0x2E },
449+ { 0x0381, 0x01 },
450+ { 0x0383, 0x01 },
451+ { 0x0385, 0x01 },
452+ { 0x0387, 0x01 },
453+ { 0x0900, 0x01 },
454+ { 0x0901, 0x14 },
455+ { 0x0401, 0x01 },
456+ { 0x0404, 0x00 },
457+ { 0x0405, 0x40 },
458+ { 0x0408, 0x00 },
459+ { 0x0409, 0x06 },
460+ { 0x040A, 0x00 },
461+ { 0x040B, 0x00 },
462+ { 0x040C, 0x10 },
463+ { 0x040D, 0x64 },
464+ { 0x040E, 0x03 },
465+ { 0x040F, 0x0C },
466+ { 0x3038, 0x00 },
467+ { 0x303A, 0x00 },
468+ { 0x303B, 0x10 },
469+ { 0x300D, 0x00 },
470+ { 0x034C, 0x04 },
471+ { 0x034D, 0x18 },
472+ { 0x034E, 0x03 },
473+ { 0x034F, 0x0C },
474+ { 0x0350, 0x01 },
475+ { 0x0202, 0x03 },
476+ { 0x0203, 0x42 },
477+ { 0x0204, 0x00 },
478+ { 0x0205, 0x00 },
479+ { 0x020E, 0x01 },
480+ { 0x020F, 0x00 },
481+ { 0x0210, 0x01 },
482+ { 0x0211, 0x00 },
483+ { 0x0212, 0x01 },
484+ { 0x0213, 0x00 },
485+ { 0x0214, 0x01 },
486+ { 0x0215, 0x00 },
487+ { 0x7BCD, 0x00 },
488+ { 0x94DC, 0x20 },
489+ { 0x94DD, 0x20 },
490+ { 0x94DE, 0x20 },
491+ { 0x95DC, 0x20 },
492+ { 0x95DD, 0x20 },
493+ { 0x95DE, 0x20 },
494+ { 0x7FB0, 0x00 },
495+ { 0x9010, 0x3E },
496+ { 0x9419, 0x50 },
497+ { 0x941B, 0x50 },
498+ { 0x9519, 0x50 },
499+ { 0x951B, 0x50 },
500+ { 0x3030, 0x00 },
501+ { 0x3032, 0x00 },
502+ { 0x0220, 0x00 },
503+};
504+
505+static const char * const imx258_test_pattern_menu[] = {
506+ "Disabled",
507+ "Color Bars",
508+ "Solid Color",
509+ "Grey Color Bars",
510+ "PN9"
511+};
512+
513+static const int imx258_test_pattern_val[] = {
514+ IMX258_TEST_PATTERN_DISABLE,
515+ IMX258_TEST_PATTERN_COLOR_BARS,
516+ IMX258_TEST_PATTERN_SOLID_COLOR,
517+ IMX258_TEST_PATTERN_GREY_COLOR,
518+ IMX258_TEST_PATTERN_PN9,
519+};
520+
521+/* Configurations for supported link frequencies */
522+#define IMX258_LINK_FREQ_634MHZ 633600000ULL
523+#define IMX258_LINK_FREQ_320MHZ 320000000ULL
524+
525+enum {
526+ IMX258_LINK_FREQ_1267MBPS,
527+ IMX258_LINK_FREQ_640MBPS,
528+};
529+
530+/*
531+ * pixel_rate = link_freq * data-rate * nr_of_lanes / bits_per_sample
532+ * data rate => double data rate; number of lanes => 4; bits per pixel => 10
533+ */
534+static u64 link_freq_to_pixel_rate(u64 f)
535+{
536+ f *= 2 * 4;
537+ do_div(f, 10);
538+
539+ return f;
540+}
541+
542+/* Menu items for LINK_FREQ V4L2 control */
543+static const s64 link_freq_menu_items[] = {
544+ IMX258_LINK_FREQ_634MHZ,
545+ IMX258_LINK_FREQ_320MHZ,
546+};
547+
548+/* Link frequency configs */
549+static const struct imx258_link_freq_config link_freq_configs[] = {
550+ [IMX258_LINK_FREQ_1267MBPS] = {
551+ .pixels_per_line = IMX258_PPL_DEFAULT,
552+ .reg_list = {
553+ .num_of_regs = ARRAY_SIZE(mipi_data_rate_1267mbps),
554+ .regs = mipi_data_rate_1267mbps,
555+ }
556+ },
557+ [IMX258_LINK_FREQ_640MBPS] = {
558+ .pixels_per_line = IMX258_PPL_DEFAULT,
559+ .reg_list = {
560+ .num_of_regs = ARRAY_SIZE(mipi_data_rate_640mbps),
561+ .regs = mipi_data_rate_640mbps,
562+ }
563+ },
564+};
565+
566+/* Mode configs */
567+static const struct imx258_mode supported_modes[] = {
568+ {
569+ .width = 4208,
570+ .height = 3118,
571+ .vts_def = IMX258_VTS_30FPS,
572+ .vts_min = IMX258_VTS_30FPS,
573+ .reg_list = {
574+ .num_of_regs = ARRAY_SIZE(mode_4208x3118_regs),
575+ .regs = mode_4208x3118_regs,
576+ },
577+ .link_freq_index = IMX258_LINK_FREQ_1267MBPS,
578+ },
579+ {
580+ .width = 2104,
581+ .height = 1560,
582+ .vts_def = IMX258_VTS_30FPS_2K,
583+ .vts_min = IMX258_VTS_30FPS_2K,
584+ .reg_list = {
585+ .num_of_regs = ARRAY_SIZE(mode_2104_1560_regs),
586+ .regs = mode_2104_1560_regs,
587+ },
588+ .link_freq_index = IMX258_LINK_FREQ_640MBPS,
589+ },
590+ {
591+ .width = 1048,
592+ .height = 780,
593+ .vts_def = IMX258_VTS_30FPS_VGA,
594+ .vts_min = IMX258_VTS_30FPS_VGA,
595+ .reg_list = {
596+ .num_of_regs = ARRAY_SIZE(mode_1048_780_regs),
597+ .regs = mode_1048_780_regs,
598+ },
599+ .link_freq_index = IMX258_LINK_FREQ_640MBPS,
600+ },
601+};
602+
603+struct imx258 {
604+ struct v4l2_subdev sd;
605+ struct media_pad pad;
606+
607+ struct v4l2_ctrl_handler ctrl_handler;
608+ /* V4L2 Controls */
609+ struct v4l2_ctrl *link_freq;
610+ struct v4l2_ctrl *pixel_rate;
611+ struct v4l2_ctrl *vblank;
612+ struct v4l2_ctrl *hblank;
613+ struct v4l2_ctrl *exposure;
614+
615+ /* Current mode */
616+ const struct imx258_mode *cur_mode;
617+
618+ /*
619+ * Mutex for serialized access:
620+ * Protect sensor module set pad format and start/stop streaming safely.
621+ */
622+ struct mutex mutex;
623+
624+ /* Streaming on/off */
625+ bool streaming;
626+};
627+
628+static inline struct imx258 *to_imx258(struct v4l2_subdev *_sd)
629+{
630+ return container_of(_sd, struct imx258, sd);
631+}
632+
633+/* Read registers up to 2 at a time */
634+static int imx258_read_reg(struct imx258 *imx258, u16 reg, u32 len, u32 *val)
635+{
636+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
637+ struct i2c_msg msgs[2];
638+ u8 addr_buf[2] = { reg >> 8, reg & 0xff };
639+ u8 data_buf[4] = { 0, };
640+ int ret;
641+
642+ if (len > 4)
643+ return -EINVAL;
644+
645+ /* Write register address */
646+ msgs[0].addr = client->addr;
647+ msgs[0].flags = 0;
648+ msgs[0].len = ARRAY_SIZE(addr_buf);
649+ msgs[0].buf = addr_buf;
650+
651+ /* Read data from register */
652+ msgs[1].addr = client->addr;
653+ msgs[1].flags = I2C_M_RD;
654+ msgs[1].len = len;
655+ msgs[1].buf = &data_buf[4 - len];
656+
657+ ret = i2c_transfer(client->adapter, msgs, ARRAY_SIZE(msgs));
658+ if (ret != ARRAY_SIZE(msgs))
659+ return -EIO;
660+
661+ *val = get_unaligned_be32(data_buf);
662+
663+ return 0;
664+}
665+
666+/* Write registers up to 2 at a time */
667+static int imx258_write_reg(struct imx258 *imx258, u16 reg, u32 len, u32 val)
668+{
669+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
670+ u8 buf[6];
671+
672+ if (len > 4)
673+ return -EINVAL;
674+
675+ put_unaligned_be16(reg, buf);
676+ put_unaligned_be32(val << (8 * (4 - len)), buf + 2);
677+ if (i2c_master_send(client, buf, len + 2) != len + 2)
678+ return -EIO;
679+
680+ return 0;
681+}
682+
683+/* Write a list of registers */
684+static int imx258_write_regs(struct imx258 *imx258,
685+ const struct imx258_reg *regs, u32 len)
686+{
687+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
688+ unsigned int i;
689+ int ret;
690+
691+ for (i = 0; i < len; i++) {
692+ ret = imx258_write_reg(imx258, regs[i].address, 1,
693+ regs[i].val);
694+ if (ret) {
695+ dev_err_ratelimited(
696+ &client->dev,
697+ "Failed to write reg 0x%4.4x. error = %d\n",
698+ regs[i].address, ret);
699+
700+ return ret;
701+ }
702+ }
703+
704+ return 0;
705+}
706+
707+/* Open sub-device */
708+static int imx258_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
709+{
710+ struct v4l2_mbus_framefmt *try_fmt =
711+ v4l2_subdev_get_try_format(sd, fh->pad, 0);
712+
713+ /* Initialize try_fmt */
714+ try_fmt->width = supported_modes[0].width;
715+ try_fmt->height = supported_modes[0].height;
716+ try_fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
717+ try_fmt->field = V4L2_FIELD_NONE;
718+
719+ return 0;
720+}
721+
722+static int imx258_update_digital_gain(struct imx258 *imx258, u32 len, u32 val)
723+{
724+ int ret;
725+
726+ ret = imx258_write_reg(imx258, IMX258_REG_GR_DIGITAL_GAIN,
727+ IMX258_REG_VALUE_16BIT,
728+ val);
729+ if (ret)
730+ return ret;
731+ ret = imx258_write_reg(imx258, IMX258_REG_GB_DIGITAL_GAIN,
732+ IMX258_REG_VALUE_16BIT,
733+ val);
734+ if (ret)
735+ return ret;
736+ ret = imx258_write_reg(imx258, IMX258_REG_R_DIGITAL_GAIN,
737+ IMX258_REG_VALUE_16BIT,
738+ val);
739+ if (ret)
740+ return ret;
741+ ret = imx258_write_reg(imx258, IMX258_REG_B_DIGITAL_GAIN,
742+ IMX258_REG_VALUE_16BIT,
743+ val);
744+ if (ret)
745+ return ret;
746+ return 0;
747+}
748+
749+static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
750+{
751+ struct imx258 *imx258 =
752+ container_of(ctrl->handler, struct imx258, ctrl_handler);
753+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
754+ int ret = 0;
755+
756+ /*
757+ * Applying V4L2 control value only happens
758+ * when power is up for streaming
759+ */
760+ if (pm_runtime_get_if_in_use(&client->dev) == 0)
761+ return 0;
762+
763+ switch (ctrl->id) {
764+ case V4L2_CID_ANALOGUE_GAIN:
765+ ret = imx258_write_reg(imx258, IMX258_REG_ANALOG_GAIN,
766+ IMX258_REG_VALUE_16BIT,
767+ ctrl->val);
768+ break;
769+ case V4L2_CID_EXPOSURE:
770+ ret = imx258_write_reg(imx258, IMX258_REG_EXPOSURE,
771+ IMX258_REG_VALUE_16BIT,
772+ ctrl->val);
773+ break;
774+ case V4L2_CID_DIGITAL_GAIN:
775+ ret = imx258_update_digital_gain(imx258, IMX258_REG_VALUE_16BIT,
776+ ctrl->val);
777+ break;
778+ case V4L2_CID_TEST_PATTERN:
779+ ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
780+ IMX258_REG_VALUE_16BIT,
781+ imx258_test_pattern_val[ctrl->val]);
782+
783+ ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
784+ IMX258_REG_VALUE_08BIT,
785+ ctrl->val == imx258_test_pattern_val
786+ [IMX258_TEST_PATTERN_DISABLE] ?
787+ REG_CONFIG_MIRROR_FLIP :
788+ REG_CONFIG_FLIP_TEST_PATTERN);
789+ break;
790+ default:
791+ dev_info(&client->dev,
792+ "ctrl(id:0x%x,val:0x%x) is not handled\n",
793+ ctrl->id, ctrl->val);
794+ ret = -EINVAL;
795+ break;
796+ }
797+
798+ pm_runtime_put(&client->dev);
799+
800+ return ret;
801+}
802+
803+static const struct v4l2_ctrl_ops imx258_ctrl_ops = {
804+ .s_ctrl = imx258_set_ctrl,
805+};
806+
807+static int imx258_enum_mbus_code(struct v4l2_subdev *sd,
808+ struct v4l2_subdev_pad_config *cfg,
809+ struct v4l2_subdev_mbus_code_enum *code)
810+{
811+ /* Only one bayer order(GRBG) is supported */
812+ if (code->index > 0)
813+ return -EINVAL;
814+
815+ code->code = MEDIA_BUS_FMT_SGRBG10_1X10;
816+
817+ return 0;
818+}
819+
820+static int imx258_enum_frame_size(struct v4l2_subdev *sd,
821+ struct v4l2_subdev_pad_config *cfg,
822+ struct v4l2_subdev_frame_size_enum *fse)
823+{
824+ if (fse->index >= ARRAY_SIZE(supported_modes))
825+ return -EINVAL;
826+
827+ if (fse->code != MEDIA_BUS_FMT_SGRBG10_1X10)
828+ return -EINVAL;
829+
830+ fse->min_width = supported_modes[fse->index].width;
831+ fse->max_width = fse->min_width;
832+ fse->min_height = supported_modes[fse->index].height;
833+ fse->max_height = fse->min_height;
834+
835+ return 0;
836+}
837+
838+static void imx258_update_pad_format(const struct imx258_mode *mode,
839+ struct v4l2_subdev_format *fmt)
840+{
841+ fmt->format.width = mode->width;
842+ fmt->format.height = mode->height;
843+ fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
844+ fmt->format.field = V4L2_FIELD_NONE;
845+}
846+
847+static int __imx258_get_pad_format(struct imx258 *imx258,
848+ struct v4l2_subdev_pad_config *cfg,
849+ struct v4l2_subdev_format *fmt)
850+{
851+ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
852+ fmt->format = *v4l2_subdev_get_try_format(&imx258->sd, cfg,
853+ fmt->pad);
854+ else
855+ imx258_update_pad_format(imx258->cur_mode, fmt);
856+
857+ return 0;
858+}
859+
860+static int imx258_get_pad_format(struct v4l2_subdev *sd,
861+ struct v4l2_subdev_pad_config *cfg,
862+ struct v4l2_subdev_format *fmt)
863+{
864+ struct imx258 *imx258 = to_imx258(sd);
865+ int ret;
866+
867+ mutex_lock(&imx258->mutex);
868+ ret = __imx258_get_pad_format(imx258, cfg, fmt);
869+ mutex_unlock(&imx258->mutex);
870+
871+ return ret;
872+}
873+
874+static int imx258_set_pad_format(struct v4l2_subdev *sd,
875+ struct v4l2_subdev_pad_config *cfg,
876+ struct v4l2_subdev_format *fmt)
877+{
878+ struct imx258 *imx258 = to_imx258(sd);
879+ const struct imx258_mode *mode;
880+ struct v4l2_mbus_framefmt *framefmt;
881+ s32 vblank_def;
882+ s32 vblank_min;
883+ s64 h_blank;
884+ s64 pixel_rate;
885+ s64 link_freq;
886+
887+ mutex_lock(&imx258->mutex);
888+
889+ /* Only one raw bayer(GBRG) order is supported */
890+ fmt->format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
891+
892+ mode = v4l2_find_nearest_size(supported_modes,
893+ ARRAY_SIZE(supported_modes), width, height,
894+ fmt->format.width, fmt->format.height);
895+ imx258_update_pad_format(mode, fmt);
896+ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
897+ framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
898+ *framefmt = fmt->format;
899+ } else {
900+ imx258->cur_mode = mode;
901+ __v4l2_ctrl_s_ctrl(imx258->link_freq, mode->link_freq_index);
902+
903+ link_freq = link_freq_menu_items[mode->link_freq_index];
904+ pixel_rate = link_freq_to_pixel_rate(link_freq);
905+ __v4l2_ctrl_s_ctrl_int64(imx258->pixel_rate, pixel_rate);
906+ /* Update limits and set FPS to default */
907+ vblank_def = imx258->cur_mode->vts_def -
908+ imx258->cur_mode->height;
909+ vblank_min = imx258->cur_mode->vts_min -
910+ imx258->cur_mode->height;
911+ __v4l2_ctrl_modify_range(
912+ imx258->vblank, vblank_min,
913+ IMX258_VTS_MAX - imx258->cur_mode->height, 1,
914+ vblank_def);
915+ __v4l2_ctrl_s_ctrl(imx258->vblank, vblank_def);
916+ h_blank =
917+ link_freq_configs[mode->link_freq_index].pixels_per_line
918+ - imx258->cur_mode->width;
919+ __v4l2_ctrl_modify_range(imx258->hblank, h_blank,
920+ h_blank, 1, h_blank);
921+ }
922+
923+ mutex_unlock(&imx258->mutex);
924+
925+ return 0;
926+}
927+
928+/* Start streaming */
929+static int imx258_start_streaming(struct imx258 *imx258)
930+{
931+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
932+ const struct imx258_reg_list *reg_list;
933+ int ret, link_freq_index;
934+
935+ /* Setup PLL */
936+ link_freq_index = imx258->cur_mode->link_freq_index;
937+ reg_list = &link_freq_configs[link_freq_index].reg_list;
938+ ret = imx258_write_regs(imx258, reg_list->regs, reg_list->num_of_regs);
939+ if (ret) {
940+ dev_err(&client->dev, "%s failed to set plls\n", __func__);
941+ return ret;
942+ }
943+
944+ /* Apply default values of current mode */
945+ reg_list = &imx258->cur_mode->reg_list;
946+ ret = imx258_write_regs(imx258, reg_list->regs, reg_list->num_of_regs);
947+ if (ret) {
948+ dev_err(&client->dev, "%s failed to set mode\n", __func__);
949+ return ret;
950+ }
951+
952+ /* Set Orientation be 180 degree */
953+ ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
954+ IMX258_REG_VALUE_08BIT, REG_CONFIG_MIRROR_FLIP);
955+ if (ret) {
956+ dev_err(&client->dev, "%s failed to set orientation\n",
957+ __func__);
958+ return ret;
959+ }
960+
961+ /* Apply customized values from user */
962+ ret = __v4l2_ctrl_handler_setup(imx258->sd.ctrl_handler);
963+ if (ret)
964+ return ret;
965+
966+ /* set stream on register */
967+ return imx258_write_reg(imx258, IMX258_REG_MODE_SELECT,
968+ IMX258_REG_VALUE_08BIT,
969+ IMX258_MODE_STREAMING);
970+}
971+
972+/* Stop streaming */
973+static int imx258_stop_streaming(struct imx258 *imx258)
974+{
975+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
976+ int ret;
977+
978+ /* set stream off register */
979+ ret = imx258_write_reg(imx258, IMX258_REG_MODE_SELECT,
980+ IMX258_REG_VALUE_08BIT, IMX258_MODE_STANDBY);
981+ if (ret)
982+ dev_err(&client->dev, "%s failed to set stream\n", __func__);
983+
984+ /*
985+ * Return success even if it was an error, as there is nothing the
986+ * caller can do about it.
987+ */
988+ return 0;
989+}
990+
991+static int imx258_set_stream(struct v4l2_subdev *sd, int enable)
992+{
993+ struct imx258 *imx258 = to_imx258(sd);
994+ struct i2c_client *client = v4l2_get_subdevdata(sd);
995+ int ret = 0;
996+
997+ mutex_lock(&imx258->mutex);
998+ if (imx258->streaming == enable) {
999+ mutex_unlock(&imx258->mutex);
1000+ return 0;
1001+ }
1002+
1003+ if (enable) {
1004+ ret = pm_runtime_get_sync(&client->dev);
1005+ if (ret < 0) {
1006+ pm_runtime_put_noidle(&client->dev);
1007+ goto err_unlock;
1008+ }
1009+
1010+ /*
1011+ * Apply default & customized values
1012+ * and then start streaming.
1013+ */
1014+ ret = imx258_start_streaming(imx258);
1015+ if (ret)
1016+ goto err_rpm_put;
1017+ } else {
1018+ imx258_stop_streaming(imx258);
1019+ pm_runtime_put(&client->dev);
1020+ }
1021+
1022+ imx258->streaming = enable;
1023+ mutex_unlock(&imx258->mutex);
1024+
1025+ return ret;
1026+
1027+err_rpm_put:
1028+ pm_runtime_put(&client->dev);
1029+err_unlock:
1030+ mutex_unlock(&imx258->mutex);
1031+
1032+ return ret;
1033+}
1034+
1035+static int __maybe_unused imx258_suspend(struct device *dev)
1036+{
1037+ struct i2c_client *client = to_i2c_client(dev);
1038+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
1039+ struct imx258 *imx258 = to_imx258(sd);
1040+
1041+ if (imx258->streaming)
1042+ imx258_stop_streaming(imx258);
1043+
1044+ return 0;
1045+}
1046+
1047+static int __maybe_unused imx258_resume(struct device *dev)
1048+{
1049+ struct i2c_client *client = to_i2c_client(dev);
1050+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
1051+ struct imx258 *imx258 = to_imx258(sd);
1052+ int ret;
1053+
1054+ if (imx258->streaming) {
1055+ ret = imx258_start_streaming(imx258);
1056+ if (ret)
1057+ goto error;
1058+ }
1059+
1060+ return 0;
1061+
1062+error:
1063+ imx258_stop_streaming(imx258);
1064+ imx258->streaming = 0;
1065+ return ret;
1066+}
1067+
1068+/* Verify chip ID */
1069+static int imx258_identify_module(struct imx258 *imx258)
1070+{
1071+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
1072+ int ret;
1073+ u32 val;
1074+
1075+ ret = imx258_read_reg(imx258, IMX258_REG_CHIP_ID,
1076+ IMX258_REG_VALUE_16BIT, &val);
1077+ if (ret) {
1078+ dev_err(&client->dev, "failed to read chip id %x\n",
1079+ IMX258_CHIP_ID);
1080+ return ret;
1081+ }
1082+
1083+ if (val != IMX258_CHIP_ID) {
1084+ dev_err(&client->dev, "chip id mismatch: %x!=%x\n",
1085+ IMX258_CHIP_ID, val);
1086+ return -EIO;
1087+ }
1088+
1089+ return 0;
1090+}
1091+
1092+static const struct v4l2_subdev_video_ops imx258_video_ops = {
1093+ .s_stream = imx258_set_stream,
1094+};
1095+
1096+static const struct v4l2_subdev_pad_ops imx258_pad_ops = {
1097+ .enum_mbus_code = imx258_enum_mbus_code,
1098+ .get_fmt = imx258_get_pad_format,
1099+ .set_fmt = imx258_set_pad_format,
1100+ .enum_frame_size = imx258_enum_frame_size,
1101+};
1102+
1103+static const struct v4l2_subdev_ops imx258_subdev_ops = {
1104+ .video = &imx258_video_ops,
1105+ .pad = &imx258_pad_ops,
1106+};
1107+
1108+static const struct v4l2_subdev_internal_ops imx258_internal_ops = {
1109+ .open = imx258_open,
1110+};
1111+
1112+/* Initialize control handlers */
1113+static int imx258_init_controls(struct imx258 *imx258)
1114+{
1115+ struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
1116+ struct v4l2_ctrl_handler *ctrl_hdlr;
1117+ s64 vblank_def;
1118+ s64 vblank_min;
1119+ s64 pixel_rate_min;
1120+ s64 pixel_rate_max;
1121+ int ret;
1122+
1123+ ctrl_hdlr = &imx258->ctrl_handler;
1124+ ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
1125+ if (ret)
1126+ return ret;
1127+
1128+ mutex_init(&imx258->mutex);
1129+ ctrl_hdlr->lock = &imx258->mutex;
1130+ imx258->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr,
1131+ &imx258_ctrl_ops,
1132+ V4L2_CID_LINK_FREQ,
1133+ ARRAY_SIZE(link_freq_menu_items) - 1,
1134+ 0,
1135+ link_freq_menu_items);
1136+
1137+ if (imx258->link_freq)
1138+ imx258->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1139+
1140+ pixel_rate_max = link_freq_to_pixel_rate(link_freq_menu_items[0]);
1141+ pixel_rate_min = link_freq_to_pixel_rate(link_freq_menu_items[1]);
1142+ /* By default, PIXEL_RATE is read only */
1143+ imx258->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx258_ctrl_ops,
1144+ V4L2_CID_PIXEL_RATE,
1145+ pixel_rate_min, pixel_rate_max,
1146+ 1, pixel_rate_max);
1147+
1148+
1149+ vblank_def = imx258->cur_mode->vts_def - imx258->cur_mode->height;
1150+ vblank_min = imx258->cur_mode->vts_min - imx258->cur_mode->height;
1151+ imx258->vblank = v4l2_ctrl_new_std(
1152+ ctrl_hdlr, &imx258_ctrl_ops, V4L2_CID_VBLANK,
1153+ vblank_min,
1154+ IMX258_VTS_MAX - imx258->cur_mode->height, 1,
1155+ vblank_def);
1156+
1157+ if (imx258->vblank)
1158+ imx258->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1159+
1160+ imx258->hblank = v4l2_ctrl_new_std(
1161+ ctrl_hdlr, &imx258_ctrl_ops, V4L2_CID_HBLANK,
1162+ IMX258_PPL_DEFAULT - imx258->cur_mode->width,
1163+ IMX258_PPL_DEFAULT - imx258->cur_mode->width,
1164+ 1,
1165+ IMX258_PPL_DEFAULT - imx258->cur_mode->width);
1166+
1167+ if (imx258->hblank)
1168+ imx258->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1169+
1170+ imx258->exposure = v4l2_ctrl_new_std(
1171+ ctrl_hdlr, &imx258_ctrl_ops,
1172+ V4L2_CID_EXPOSURE, IMX258_EXPOSURE_MIN,
1173+ IMX258_EXPOSURE_MAX, IMX258_EXPOSURE_STEP,
1174+ IMX258_EXPOSURE_DEFAULT);
1175+
1176+ v4l2_ctrl_new_std(ctrl_hdlr, &imx258_ctrl_ops, V4L2_CID_ANALOGUE_GAIN,
1177+ IMX258_ANA_GAIN_MIN, IMX258_ANA_GAIN_MAX,
1178+ IMX258_ANA_GAIN_STEP, IMX258_ANA_GAIN_DEFAULT);
1179+
1180+ v4l2_ctrl_new_std(ctrl_hdlr, &imx258_ctrl_ops, V4L2_CID_DIGITAL_GAIN,
1181+ IMX258_DGTL_GAIN_MIN, IMX258_DGTL_GAIN_MAX,
1182+ IMX258_DGTL_GAIN_STEP,
1183+ IMX258_DGTL_GAIN_DEFAULT);
1184+
1185+ v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &imx258_ctrl_ops,
1186+ V4L2_CID_TEST_PATTERN,
1187+ ARRAY_SIZE(imx258_test_pattern_menu) - 1,
1188+ 0, 0, imx258_test_pattern_menu);
1189+
1190+ if (ctrl_hdlr->error) {
1191+ ret = ctrl_hdlr->error;
1192+ dev_err(&client->dev, "%s control init failed (%d)\n",
1193+ __func__, ret);
1194+ goto error;
1195+ }
1196+
1197+ imx258->sd.ctrl_handler = ctrl_hdlr;
1198+
1199+ return 0;
1200+
1201+error:
1202+ v4l2_ctrl_handler_free(ctrl_hdlr);
1203+ mutex_destroy(&imx258->mutex);
1204+
1205+ return ret;
1206+}
1207+
1208+static void imx258_free_controls(struct imx258 *imx258)
1209+{
1210+ v4l2_ctrl_handler_free(imx258->sd.ctrl_handler);
1211+ mutex_destroy(&imx258->mutex);
1212+}
1213+
1214+static int imx258_probe(struct i2c_client *client)
1215+{
1216+ struct imx258 *imx258;
1217+ int ret;
1218+ u32 val = 0;
1219+
1220+ device_property_read_u32(&client->dev, "clock-frequency", &val);
1221+ if (val != 19200000)
1222+ return -EINVAL;
1223+
1224+ imx258 = devm_kzalloc(&client->dev, sizeof(*imx258), GFP_KERNEL);
1225+ if (!imx258)
1226+ return -ENOMEM;
1227+
1228+ /* Initialize subdev */
1229+ v4l2_i2c_subdev_init(&imx258->sd, client, &imx258_subdev_ops);
1230+
1231+ /* Check module identity */
1232+ ret = imx258_identify_module(imx258);
1233+ if (ret)
1234+ return ret;
1235+
1236+ /* Set default mode to max resolution */
1237+ imx258->cur_mode = &supported_modes[0];
1238+
1239+ ret = imx258_init_controls(imx258);
1240+ if (ret)
1241+ return ret;
1242+
1243+ /* Initialize subdev */
1244+ imx258->sd.internal_ops = &imx258_internal_ops;
1245+ imx258->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1246+ imx258->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
1247+
1248+ /* Initialize source pad */
1249+ imx258->pad.flags = MEDIA_PAD_FL_SOURCE;
1250+
1251+ ret = media_entity_pads_init(&imx258->sd.entity, 1, &imx258->pad);
1252+ if (ret)
1253+ goto error_handler_free;
1254+
1255+ ret = v4l2_async_register_subdev_sensor_common(&imx258->sd);
1256+ if (ret < 0)
1257+ goto error_media_entity;
1258+
1259+ pm_runtime_set_active(&client->dev);
1260+ pm_runtime_enable(&client->dev);
1261+ pm_runtime_idle(&client->dev);
1262+
1263+ return 0;
1264+
1265+error_media_entity:
1266+ media_entity_cleanup(&imx258->sd.entity);
1267+
1268+error_handler_free:
1269+ imx258_free_controls(imx258);
1270+
1271+ return ret;
1272+}
1273+
1274+static int imx258_remove(struct i2c_client *client)
1275+{
1276+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
1277+ struct imx258 *imx258 = to_imx258(sd);
1278+
1279+ v4l2_async_unregister_subdev(sd);
1280+ media_entity_cleanup(&sd->entity);
1281+ imx258_free_controls(imx258);
1282+
1283+ pm_runtime_disable(&client->dev);
1284+ pm_runtime_set_suspended(&client->dev);
1285+
1286+ return 0;
1287+}
1288+
1289+static const struct dev_pm_ops imx258_pm_ops = {
1290+ SET_SYSTEM_SLEEP_PM_OPS(imx258_suspend, imx258_resume)
1291+};
1292+
1293+#ifdef CONFIG_ACPI
1294+static const struct acpi_device_id imx258_acpi_ids[] = {
1295+ { "SONY258A" },
1296+ { /* sentinel */ }
1297+};
1298+
1299+MODULE_DEVICE_TABLE(acpi, imx258_acpi_ids);
1300+#endif
1301+
1302+static struct i2c_driver imx258_i2c_driver = {
1303+ .driver = {
1304+ .name = "imx258",
1305+ .pm = &imx258_pm_ops,
1306+ .acpi_match_table = ACPI_PTR(imx258_acpi_ids),
1307+ },
1308+ .probe_new = imx258_probe,
1309+ .remove = imx258_remove,
1310+};
1311+
1312+module_i2c_driver(imx258_i2c_driver);
1313+
1314+MODULE_AUTHOR("Yeh, Andy <andy.yeh@intel.com>");
1315+MODULE_AUTHOR("Chiang, Alan <alanx.chiang@intel.com>");
1316+MODULE_AUTHOR("Chen, Jason <jasonx.z.chen@intel.com>");
1317+MODULE_DESCRIPTION("Sony IMX258 sensor driver");
1318+MODULE_LICENSE("GPL v2");
drivers/media/i2c/imx274.c+27−47
@@ -87,7 +87,7 @@ · 86 unmodified lines
8787 #define IMX274_SHR_LIMIT_CONST (4)
8888
8989 /*
90− * Constants for sensor reset delay
90+ * Min and max sensor reset delay (microseconds)
9191 */
9292 #define IMX274_RESET_DELAY1 (2000)
9393 #define IMX274_RESET_DELAY2 (2200)
@@ -107,15 +107,15 @@ · 13 unmodified lines
107107 /*
108108 * IMX274 register definitions
109109 */
110−#define IMX274_FRAME_LENGTH_ADDR_1 0x30FA /* VMAX, MSB */
111−#define IMX274_FRAME_LENGTH_ADDR_2 0x30F9 /* VMAX */
112−#define IMX274_FRAME_LENGTH_ADDR_3 0x30F8 /* VMAX, LSB */
110+#define IMX274_SHR_REG_MSB 0x300D /* SHR */
111+#define IMX274_SHR_REG_LSB 0x300C /* SHR */
113112 #define IMX274_SVR_REG_MSB 0x300F /* SVR */
114113 #define IMX274_SVR_REG_LSB 0x300E /* SVR */
114+#define IMX274_VMAX_REG_1 0x30FA /* VMAX, MSB */
115+#define IMX274_VMAX_REG_2 0x30F9 /* VMAX */
116+#define IMX274_VMAX_REG_3 0x30F8 /* VMAX, LSB */
115117 #define IMX274_HMAX_REG_MSB 0x30F7 /* HMAX */
116118 #define IMX274_HMAX_REG_LSB 0x30F6 /* HMAX */
117−#define IMX274_COARSE_TIME_ADDR_MSB 0x300D /* SHR */
118−#define IMX274_COARSE_TIME_ADDR_LSB 0x300C /* SHR */
119119 #define IMX274_ANALOG_GAIN_ADDR_LSB 0x300A /* ANALOG GAIN LSB */
120120 #define IMX274_ANALOG_GAIN_ADDR_MSB 0x300B /* ANALOG GAIN MSB */
121121 #define IMX274_DIGITAL_GAIN_REG 0x3012 /* Digital Gain */
@@ -144,22 +144,13 @@ enum imx274_mode { · 22 unmodified lines
144144 IMX274_MODE_3840X2160,
145145 IMX274_MODE_1920X1080,
146146 IMX274_MODE_1280X720,
147−
148− IMX274_MODE_START_STREAM_1,
149− IMX274_MODE_START_STREAM_2,
150− IMX274_MODE_START_STREAM_3,
151− IMX274_MODE_START_STREAM_4,
152− IMX274_MODE_STOP_STREAM
153147 };
154148
155149 /*
156150 * imx274 format related structure
157151 */
158152 struct imx274_frmfmt {
159− u32 mbus_code;
160− enum v4l2_colorspace colorspace;
161153 struct v4l2_frmsize_discrete size;
162− enum imx274_mode mode;
163154 };
164155
165156 /*
@@ -489,24 +480,15 @@ static const struct reg_8 *mode_table[] = { · 323 unmodified lines
489480 [IMX274_MODE_3840X2160] = imx274_mode1_3840x2160_raw10,
490481 [IMX274_MODE_1920X1080] = imx274_mode3_1920x1080_raw10,
491482 [IMX274_MODE_1280X720] = imx274_mode5_1280x720_raw10,
492−
493− [IMX274_MODE_START_STREAM_1] = imx274_start_1,
494− [IMX274_MODE_START_STREAM_2] = imx274_start_2,
495− [IMX274_MODE_START_STREAM_3] = imx274_start_3,
496− [IMX274_MODE_START_STREAM_4] = imx274_start_4,
497− [IMX274_MODE_STOP_STREAM] = imx274_stop,
498483 };
499484
500485 /*
501486 * imx274 format related structure
502487 */
503488 static const struct imx274_frmfmt imx274_formats[] = {
504− {MEDIA_BUS_FMT_SRGGB10_1X10, V4L2_COLORSPACE_SRGB, {3840, 2160},
505− IMX274_MODE_3840X2160},
506− {MEDIA_BUS_FMT_SRGGB10_1X10, V4L2_COLORSPACE_SRGB, {1920, 1080},
507− IMX274_MODE_1920X1080},
508− {MEDIA_BUS_FMT_SRGGB10_1X10, V4L2_COLORSPACE_SRGB, {1280, 720},
509− IMX274_MODE_1280X720},
489+ { {3840, 2160} },
490+ { {1920, 1080} },
491+ { {1280, 720} },
510492 };
511493
512494 /*
@@ -737,11 +719,11 @@ static int imx274_mode_regs(struct stimx274 *priv, int mode) · 224 unmodified lines
737719 {
738720 int err = 0;
739721
740− err = imx274_write_table(priv, mode_table[IMX274_MODE_START_STREAM_1]);
722+ err = imx274_write_table(priv, imx274_start_1);
741723 if (err)
742724 return err;
743725
744− err = imx274_write_table(priv, mode_table[IMX274_MODE_START_STREAM_2]);
726+ err = imx274_write_table(priv, imx274_start_2);
745727 if (err)
746728 return err;
747729
@@ -766,7 +748,7 @@ static int imx274_start_stream(struct stimx274 *priv) · 18 unmodified lines
766748 * give it 1 extra ms for margin
767749 */
768750 msleep_range(11);
769− err = imx274_write_table(priv, mode_table[IMX274_MODE_START_STREAM_3]);
751+ err = imx274_write_table(priv, imx274_start_3);
770752 if (err)
771753 return err;
772754
@@ -776,7 +758,7 @@ static int imx274_start_stream(struct stimx274 *priv) · 3 unmodified lines
776758 * give it 1 extra ms for margin
777759 */
778760 msleep_range(8);
779− err = imx274_write_table(priv, mode_table[IMX274_MODE_START_STREAM_4]);
761+ err = imx274_write_table(priv, imx274_start_4);
780762 if (err)
781763 return err;
782764
@@ -890,9 +872,8 @@ static int imx274_set_fmt(struct v4l2_subdev *sd, · 107 unmodified lines
890872 int index;
891873
892874 dev_dbg(&client->dev,
893− "%s: width = %d height = %d code = %d mbus_code = %d\n",
894− __func__, fmt->width, fmt->height, fmt->code,
895− imx274_formats[imx274->mode_index].mbus_code);
875+ "%s: width = %d height = %d code = %d\n",
876+ __func__, fmt->width, fmt->height, fmt->code);
896877
897878 mutex_lock(&imx274->lock);
898879
@@ -971,7 +952,7 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd, · 72 unmodified lines
971952 if (!ret) {
972953 /*
973954 * exposure time range is decided by frame interval
974− * need to update it after frame interal changes
955+ * need to update it after frame interval changes
975956 */
976957 min = IMX274_MIN_EXPOSURE_TIME;
977958 max = fi->interval.numerator * 1000000
@@ -984,7 +965,7 @@ static int imx274_s_frame_interval(struct v4l2_subdev *sd, · 6 unmodified lines
984965 }
985966
986967 /* update exposure time accordingly */
987− imx274_set_exposure(imx274, imx274->ctrls.exposure->val);
968+ imx274_set_exposure(imx274, ctrl->val);
988969
989970 dev_dbg(&imx274->client->dev, "set frame interval to %uus\n",
990971 fi->interval.numerator * 1000000
@@ -1088,8 +1069,7 @@ static int imx274_s_stream(struct v4l2_subdev *sd, int on) · 97 unmodified lines
10881069 goto fail;
10891070 } else {
10901071 /* stop stream */
1091− ret = imx274_write_table(imx274,
1092− mode_table[IMX274_MODE_STOP_STREAM]);
1072+ ret = imx274_write_table(imx274, imx274_stop);
10931073 if (ret)
10941074 goto fail;
10951075 }
@@ -1133,15 +1113,15 @@ static int imx274_get_frame_length(struct stimx274 *priv, u32 *val) · 37 unmodified lines
11331113 svr = (reg_val[1] << IMX274_SHIFT_8_BITS) + reg_val[0];
11341114
11351115 /* vmax */
1136− err = imx274_read_reg(priv, IMX274_FRAME_LENGTH_ADDR_3, &reg_val[0]);
1116+ err = imx274_read_reg(priv, IMX274_VMAX_REG_3, &reg_val[0]);
11371117 if (err)
11381118 goto fail;
11391119
1140− err = imx274_read_reg(priv, IMX274_FRAME_LENGTH_ADDR_2, &reg_val[1]);
1120+ err = imx274_read_reg(priv, IMX274_VMAX_REG_2, &reg_val[1]);
11411121 if (err)
11421122 goto fail;
11431123
1144− err = imx274_read_reg(priv, IMX274_FRAME_LENGTH_ADDR_1, &reg_val[2]);
1124+ err = imx274_read_reg(priv, IMX274_VMAX_REG_1, &reg_val[2]);
11451125 if (err)
11461126 goto fail;
11471127
@@ -1300,10 +1280,10 @@ fail: · 152 unmodified lines
13001280 static inline void imx274_calculate_coarse_time_regs(struct reg_8 regs[2],
13011281 u32 coarse_time)
13021282 {
1303− regs->addr = IMX274_COARSE_TIME_ADDR_MSB;
1283+ regs->addr = IMX274_SHR_REG_MSB;
13041284 regs->val = (coarse_time >> IMX274_SHIFT_8_BITS)
13051285 & IMX274_MASK_LSB_8_BITS;
1306− (regs + 1)->addr = IMX274_COARSE_TIME_ADDR_LSB;
1286+ (regs + 1)->addr = IMX274_SHR_REG_LSB;
13071287 (regs + 1)->val = (coarse_time) & IMX274_MASK_LSB_8_BITS;
13081288 }
13091289
@@ -1471,13 +1451,13 @@ static int imx274_set_test_pattern(struct stimx274 *priv, int val) · 161 unmodified lines
14711451 static inline void imx274_calculate_frame_length_regs(struct reg_8 regs[3],
14721452 u32 frame_length)
14731453 {
1474− regs->addr = IMX274_FRAME_LENGTH_ADDR_1;
1454+ regs->addr = IMX274_VMAX_REG_1;
14751455 regs->val = (frame_length >> IMX274_SHIFT_16_BITS)
14761456 & IMX274_MASK_LSB_4_BITS;
1477− (regs + 1)->addr = IMX274_FRAME_LENGTH_ADDR_2;
1457+ (regs + 1)->addr = IMX274_VMAX_REG_2;
14781458 (regs + 1)->val = (frame_length >> IMX274_SHIFT_8_BITS)
14791459 & IMX274_MASK_LSB_8_BITS;
1480− (regs + 2)->addr = IMX274_FRAME_LENGTH_ADDR_3;
1460+ (regs + 2)->addr = IMX274_VMAX_REG_3;
14811461 (regs + 2)->val = (frame_length) & IMX274_MASK_LSB_8_BITS;
14821462 }
14831463
@@ -1786,7 +1766,7 @@ static int imx274_remove(struct i2c_client *client) · 302 unmodified lines
17861766 struct stimx274 *imx274 = to_imx274(sd);
17871767
17881768 /* stop stream */
1789− imx274_write_table(imx274, mode_table[IMX274_MODE_STOP_STREAM]);
1769+ imx274_write_table(imx274, imx274_stop);
17901770
17911771 v4l2_async_unregister_subdev(sd);
17921772 v4l2_ctrl_handler_free(&imx274->ctrls.handler);
drivers/media/i2c/ir-kbd-i2c.c+3−1
@@ -739,6 +739,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) · 738 unmodified lines
739739 struct rc_dev *rc = NULL;
740740 struct i2c_adapter *adap = client->adapter;
741741 unsigned short addr = client->addr;
742+ bool probe_tx = (id->driver_data & FLAG_TX) != 0;
742743 int err;
743744
744745 if ((id->driver_data & FLAG_HDPVR) && !enable_hdpvr) {
@@ -800,6 +801,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) · 55 unmodified lines
800801 rc_proto = RC_PROTO_BIT_RC5 | RC_PROTO_BIT_RC6_MCE |
801802 RC_PROTO_BIT_RC6_6A_32;
802803 ir_codes = RC_MAP_HAUPPAUGE;
804+ probe_tx = true;
803805 break;
804806 }
805807
@@ -892,7 +894,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id) · 86 unmodified lines
892894
893895 INIT_DELAYED_WORK(&ir->work, ir_work);
894896
895− if (id->driver_data & FLAG_TX) {
897+ if (probe_tx) {
896898 ir->tx_c = i2c_new_dummy(client->adapter, 0x70);
897899 if (!ir->tx_c) {
898900 dev_err(&client->dev, "failed to setup tx i2c address");
drivers/media/i2c/ov13858.c+0−1
@@ -1796,7 +1796,6 @@ MODULE_DEVICE_TABLE(acpi, ov13858_acpi_ids); · 1795 unmodified lines
17961796 static struct i2c_driver ov13858_i2c_driver = {
17971797 .driver = {
17981798 .name = "ov13858",
1799− .owner = THIS_MODULE,
18001799 .pm = &ov13858_pm_ops,
18011800 .acpi_match_table = ACPI_PTR(ov13858_acpi_ids),
18021801 },
drivers/media/i2c/ov2640.c+92−20
@@ -307,6 +307,10 @@ struct ov2640_priv { · 306 unmodified lines
307307
308308 struct gpio_desc *resetb_gpio;
309309 struct gpio_desc *pwdn_gpio;
310+
311+ struct mutex lock; /* lock to protect streaming and power_count */
312+ bool streaming;
313+ int power_count;
310314 };
311315
312316 /*
@@ -709,9 +713,20 @@ static int ov2640_s_ctrl(struct v4l2_ctrl *ctrl) · 396 unmodified lines
709713 struct v4l2_subdev *sd =
710714 &container_of(ctrl->handler, struct ov2640_priv, hdl)->subdev;
711715 struct i2c_client *client = v4l2_get_subdevdata(sd);
716+ struct ov2640_priv *priv = to_ov2640(client);
712717 u8 val;
713718 int ret;
714719
720+ /* v4l2_ctrl_lock() locks our own mutex */
721+
722+ /*
723+ * If the device is not powered up by the host driver, do not apply any
724+ * controls to H/W at this time. Instead the controls will be restored
725+ * when the streaming is started.
726+ */
727+ if (!priv->power_count)
728+ return 0;
729+
715730 ret = i2c_smbus_write_byte_data(client, BANK_SEL, BANK_SEL_SENS);
716731 if (ret < 0)
717732 return ret;
@@ -763,12 +778,9 @@ static int ov2640_s_register(struct v4l2_subdev *sd, · 45 unmodified lines
763778 }
764779 #endif
765780
766−static int ov2640_s_power(struct v4l2_subdev *sd, int on)
781+static void ov2640_set_power(struct ov2640_priv *priv, int on)
767782 {
768783 #ifdef CONFIG_GPIOLIB
769− struct i2c_client *client = v4l2_get_subdevdata(sd);
770− struct ov2640_priv *priv = to_ov2640(client);
771−
772784 if (priv->pwdn_gpio)
773785 gpiod_direction_output(priv->pwdn_gpio, !on);
774786 if (on && priv->resetb_gpio) {
@@ -778,6 +790,25 @@ static int ov2640_s_power(struct v4l2_subdev *sd, int on) · 3 unmodified lines
778790 gpiod_set_value(priv->resetb_gpio, 0);
779791 }
780792 #endif
793+}
794+
795+static int ov2640_s_power(struct v4l2_subdev *sd, int on)
796+{
797+ struct i2c_client *client = v4l2_get_subdevdata(sd);
798+ struct ov2640_priv *priv = to_ov2640(client);
799+
800+ mutex_lock(&priv->lock);
801+
802+ /*
803+ * If the power count is modified from 0 to != 0 or from != 0 to 0,
804+ * update the power state.
805+ */
806+ if (priv->power_count == !on)
807+ ov2640_set_power(priv, on);
808+ priv->power_count += on ? 1 : -1;
809+ WARN_ON(priv->power_count < 0);
810+ mutex_unlock(&priv->lock);
811+
781812 return 0;
782813 }
783814
@@ -798,16 +829,13 @@ static const struct ov2640_win_size *ov2640_select_win(u32 width, u32 height) · 14 unmodified lines
798829 static int ov2640_set_params(struct i2c_client *client,
799830 const struct ov2640_win_size *win, u32 code)
800831 {
801− struct ov2640_priv *priv = to_ov2640(client);
802832 const struct regval_list *selected_cfmt_regs;
803833 u8 val;
804834 int ret;
805835
806− /* select win */
807− priv->win = win;
836+ if (!win)
837+ return -EINVAL;
808838
809− /* select format */
810− priv->cfmt_code = 0;
811839 switch (code) {
812840 case MEDIA_BUS_FMT_RGB565_2X8_BE:
813841 dev_dbg(&client->dev, "%s: Selected cfmt RGB565 BE", __func__);
@@ -846,13 +874,13 @@ static int ov2640_set_params(struct i2c_client *client, · 32 unmodified lines
846874 goto err;
847875
848876 /* select preamble */
849− dev_dbg(&client->dev, "%s: Set size to %s", __func__, priv->win->name);
877+ dev_dbg(&client->dev, "%s: Set size to %s", __func__, win->name);
850878 ret = ov2640_write_array(client, ov2640_size_change_preamble_regs);
851879 if (ret < 0)
852880 goto err;
853881
854882 /* set size win */
855− ret = ov2640_write_array(client, priv->win->regs);
883+ ret = ov2640_write_array(client, win->regs);
856884 if (ret < 0)
857885 goto err;
858886
@@ -872,14 +900,11 @@ static int ov2640_set_params(struct i2c_client *client, · 13 unmodified lines
872900 if (ret < 0)
873901 goto err;
874902
875− priv->cfmt_code = code;
876−
877903 return 0;
878904
879905 err:
880906 dev_err(&client->dev, "%s: Error %d", __func__, ret);
881907 ov2640_reset(client);
882− priv->win = NULL;
883908
884909 return ret;
885910 }
@@ -915,11 +940,15 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, · 29 unmodified lines
915940 {
916941 struct v4l2_mbus_framefmt *mf = &format->format;
917942 struct i2c_client *client = v4l2_get_subdevdata(sd);
943+ struct ov2640_priv *priv = to_ov2640(client);
918944 const struct ov2640_win_size *win;
945+ int ret = 0;
919946
920947 if (format->pad)
921948 return -EINVAL;
922949
950+ mutex_lock(&priv->lock);
951+
923952 /* select suitable win */
924953 win = ov2640_select_win(mf->width, mf->height);
925954 mf->width = win->width;
@@ -941,10 +970,24 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd, · 15 unmodified lines
941970 break;
942971 }
943972
944− if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
945− return ov2640_set_params(client, win, mf->code);
946− cfg->try_fmt = *mf;
947− return 0;
973+ if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
974+ struct ov2640_priv *priv = to_ov2640(client);
975+
976+ if (priv->streaming) {
977+ ret = -EBUSY;
978+ goto out;
979+ }
980+ /* select win */
981+ priv->win = win;
982+ /* select format */
983+ priv->cfmt_code = mf->code;
984+ } else {
985+ cfg->try_fmt = *mf;
986+ }
987+out:
988+ mutex_unlock(&priv->lock);
989+
990+ return ret;
948991 }
949992
950993 static int ov2640_enum_mbus_code(struct v4l2_subdev *sd,
@@ -979,6 +1022,28 @@ static int ov2640_get_selection(struct v4l2_subdev *sd, · 28 unmodified lines
9791022 }
9801023 }
9811024
1025+static int ov2640_s_stream(struct v4l2_subdev *sd, int on)
1026+{
1027+ struct i2c_client *client = v4l2_get_subdevdata(sd);
1028+ struct ov2640_priv *priv = to_ov2640(client);
1029+ int ret = 0;
1030+
1031+ mutex_lock(&priv->lock);
1032+ if (priv->streaming == !on) {
1033+ if (on) {
1034+ ret = ov2640_set_params(client, priv->win,
1035+ priv->cfmt_code);
1036+ if (!ret)
1037+ ret = __v4l2_ctrl_handler_setup(&priv->hdl);
1038+ }
1039+ }
1040+ if (!ret)
1041+ priv->streaming = on;
1042+ mutex_unlock(&priv->lock);
1043+
1044+ return ret;
1045+}
1046+
9821047 static int ov2640_video_probe(struct i2c_client *client)
9831048 {
9841049 struct ov2640_priv *priv = to_ov2640(client);
@@ -1014,8 +1079,6 @@ static int ov2640_video_probe(struct i2c_client *client) · 29 unmodified lines
10141079 "%s Product ID %0x:%0x Manufacturer ID %x:%x\n",
10151080 devname, pid, ver, midh, midl);
10161081
1017− ret = v4l2_ctrl_handler_setup(&priv->hdl);
1018−
10191082 done:
10201083 ov2640_s_power(&priv->subdev, 0);
10211084 return ret;
@@ -1040,9 +1103,14 @@ static const struct v4l2_subdev_pad_ops ov2640_subdev_pad_ops = { · 18 unmodified lines
10401103 .set_fmt = ov2640_set_fmt,
10411104 };
10421105
1106+static const struct v4l2_subdev_video_ops ov2640_subdev_video_ops = {
1107+ .s_stream = ov2640_s_stream,
1108+};
1109+
10431110 static const struct v4l2_subdev_ops ov2640_subdev_ops = {
10441111 .core = &ov2640_subdev_core_ops,
10451112 .pad = &ov2640_subdev_pad_ops,
1113+ .video = &ov2640_subdev_video_ops,
10461114 };
10471115
10481116 static int ov2640_probe_dt(struct i2c_client *client,
@@ -1116,7 +1184,9 @@ static int ov2640_probe(struct i2c_client *client, · 67 unmodified lines
11161184
11171185 v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
11181186 priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1187+ mutex_init(&priv->lock);
11191188 v4l2_ctrl_handler_init(&priv->hdl, 2);
1189+ priv->hdl.lock = &priv->lock;
11201190 v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
11211191 V4L2_CID_VFLIP, 0, 1, 1, 0);
11221192 v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
@@ -1150,6 +1220,7 @@ err_videoprobe: · 27 unmodified lines
11501220 media_entity_cleanup(&priv->subdev.entity);
11511221 err_hdl:
11521222 v4l2_ctrl_handler_free(&priv->hdl);
1223+ mutex_destroy(&priv->lock);
11531224 err_clk:
11541225 clk_disable_unprepare(priv->clk);
11551226 return ret;
@@ -1161,6 +1232,7 @@ static int ov2640_remove(struct i2c_client *client) · 5 unmodified lines
11611232
11621233 v4l2_async_unregister_subdev(&priv->subdev);
11631234 v4l2_ctrl_handler_free(&priv->hdl);
1235+ mutex_destroy(&priv->lock);
11641236 media_entity_cleanup(&priv->subdev.entity);
11651237 v4l2_device_unregister_subdev(&priv->subdev);
11661238 clk_disable_unprepare(priv->clk);
drivers/media/i2c/ov5640.c+152−105
@@ -60,6 +60,8 @@ · 59 unmodified lines
6060 #define OV5640_REG_AEC_PK_MANUAL 0x3503
6161 #define OV5640_REG_AEC_PK_REAL_GAIN 0x350a
6262 #define OV5640_REG_AEC_PK_VTS 0x350c
63+#define OV5640_REG_TIMING_DVPHO 0x3808
64+#define OV5640_REG_TIMING_DVPVO 0x380a
6365 #define OV5640_REG_TIMING_HTS 0x380c
6466 #define OV5640_REG_TIMING_VTS 0x380e
6567 #define OV5640_REG_TIMING_TC_REG21 0x3821
@@ -91,6 +93,9 @@ · 25 unmodified lines
9193 #define OV5640_REG_SDE_CTRL5 0x5585
9294 #define OV5640_REG_AVG_READOUT 0x56a1
9395
96+#define OV5640_SCLK2X_ROOT_DIVIDER_DEFAULT 1
97+#define OV5640_SCLK_ROOT_DIVIDER_DEFAULT 2
98+
9499 enum ov5640_mode_id {
95100 OV5640_MODE_QCIF_176_144 = 0,
96101 OV5640_MODE_QVGA_320_240,
@@ -165,8 +170,10 @@ struct reg_value { · 68 unmodified lines
165170 struct ov5640_mode_info {
166171 enum ov5640_mode_id id;
167172 enum ov5640_downsize_mode dn_mode;
168− u32 width;
169− u32 height;
173+ u32 hact;
174+ u32 htot;
175+ u32 vact;
176+ u32 vtot;
170177 const struct reg_value *reg_data;
171178 u32 reg_data_size;
172179 };
@@ -187,6 +194,7 @@ struct ov5640_ctrls { · 14 unmodified lines
187194 struct v4l2_ctrl *gain;
188195 };
189196 struct v4l2_ctrl *brightness;
197+ struct v4l2_ctrl *light_freq;
190198 struct v4l2_ctrl *saturation;
191199 struct v4l2_ctrl *contrast;
192200 struct v4l2_ctrl *hue;
@@ -248,7 +256,7 @@ static const struct reg_value ov5640_init_setting_30fps_VGA[] = { · 55 unmodified lines
248256 {0x3103, 0x11, 0, 0}, {0x3008, 0x82, 0, 5}, {0x3008, 0x42, 0, 0},
249257 {0x3103, 0x03, 0, 0}, {0x3017, 0x00, 0, 0}, {0x3018, 0x00, 0, 0},
250258 {0x3034, 0x18, 0, 0}, {0x3035, 0x14, 0, 0}, {0x3036, 0x38, 0, 0},
251− {0x3037, 0x13, 0, 0}, {0x3108, 0x01, 0, 0}, {0x3630, 0x36, 0, 0},
259+ {0x3037, 0x13, 0, 0}, {0x3630, 0x36, 0, 0},
252260 {0x3631, 0x0e, 0, 0}, {0x3632, 0xe2, 0, 0}, {0x3633, 0x12, 0, 0},
253261 {0x3621, 0xe0, 0, 0}, {0x3704, 0xa0, 0, 0}, {0x3703, 0x5a, 0, 0},
254262 {0x3715, 0x78, 0, 0}, {0x3717, 0x01, 0, 0}, {0x370b, 0x60, 0, 0},
@@ -265,9 +273,7 @@ static const struct reg_value ov5640_init_setting_30fps_VGA[] = { · 10 unmodified lines
265273 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
266274 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
267275 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
268− {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0},
269− {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
270− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
276+ {0x3810, 0x00, 0, 0},
271277 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
272278 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
273279 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -339,9 +345,7 @@ static const struct reg_value ov5640_setting_30fps_VGA_640_480[] = { · 65 unmodified lines
339345 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
340346 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
341347 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
342− {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0},
343− {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
344− {0x380e, 0x04, 0, 0}, {0x380f, 0x38, 0, 0}, {0x3810, 0x00, 0, 0},
348+ {0x3810, 0x00, 0, 0},
345349 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
346350 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
347351 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -360,9 +364,7 @@ static const struct reg_value ov5640_setting_15fps_VGA_640_480[] = { · 12 unmodified lines
360364 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
361365 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
362366 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
363− {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0},
364− {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
365− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
367+ {0x3810, 0x00, 0, 0},
366368 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
367369 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
368370 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -381,9 +383,7 @@ static const struct reg_value ov5640_setting_30fps_XGA_1024_768[] = { · 12 unmodified lines
381383 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
382384 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
383385 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
384− {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0},
385− {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
386− {0x380e, 0x04, 0, 0}, {0x380f, 0x38, 0, 0}, {0x3810, 0x00, 0, 0},
386+ {0x3810, 0x00, 0, 0},
387387 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
388388 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
389389 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -393,8 +393,7 @@ static const struct reg_value ov5640_setting_30fps_XGA_1024_768[] = { · 3 unmodified lines
393393 {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0},
394394 {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0},
395395 {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x3503, 0x00, 0, 0},
396− {0x3808, 0x04, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x03, 0, 0},
397− {0x380b, 0x00, 0, 0}, {0x3035, 0x12, 0, 0},
396+ {0x3035, 0x12, 0, 0},
398397 };
399398
400399 static const struct reg_value ov5640_setting_15fps_XGA_1024_768[] = {
@@ -404,9 +403,7 @@ static const struct reg_value ov5640_setting_15fps_XGA_1024_768[] = { · 3 unmodified lines
404403 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
405404 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
406405 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
407− {0x3808, 0x02, 0, 0}, {0x3809, 0x80, 0, 0}, {0x380a, 0x01, 0, 0},
408− {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
409− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
406+ {0x3810, 0x00, 0, 0},
410407 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
411408 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
412409 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -415,8 +412,7 @@ static const struct reg_value ov5640_setting_15fps_XGA_1024_768[] = { · 2 unmodified lines
415412 {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x03, 0, 0}, {0x3a15, 0xd8, 0, 0},
416413 {0x4001, 0x02, 0, 0}, {0x4004, 0x02, 0, 0}, {0x4713, 0x03, 0, 0},
417414 {0x4407, 0x04, 0, 0}, {0x460b, 0x35, 0, 0}, {0x460c, 0x22, 0, 0},
418− {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0}, {0x3808, 0x04, 0, 0},
419− {0x3809, 0x00, 0, 0}, {0x380a, 0x03, 0, 0}, {0x380b, 0x00, 0, 0},
415+ {0x3824, 0x02, 0, 0}, {0x5001, 0xa3, 0, 0},
420416 };
421417
422418 static const struct reg_value ov5640_setting_30fps_QVGA_320_240[] = {
@@ -426,9 +422,7 @@ static const struct reg_value ov5640_setting_30fps_QVGA_320_240[] = { · 3 unmodified lines
426422 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
427423 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
428424 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
429− {0x3808, 0x01, 0, 0}, {0x3809, 0x40, 0, 0}, {0x380a, 0x00, 0, 0},
430− {0x380b, 0xf0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
431− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
425+ {0x3810, 0x00, 0, 0},
432426 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
433427 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
434428 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -447,9 +441,7 @@ static const struct reg_value ov5640_setting_15fps_QVGA_320_240[] = { · 12 unmodified lines
447441 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
448442 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
449443 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
450− {0x3808, 0x01, 0, 0}, {0x3809, 0x40, 0, 0}, {0x380a, 0x00, 0, 0},
451− {0x380b, 0xf0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
452− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
444+ {0x3810, 0x00, 0, 0},
453445 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
454446 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
455447 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -468,9 +460,7 @@ static const struct reg_value ov5640_setting_30fps_QCIF_176_144[] = { · 12 unmodified lines
468460 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
469461 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
470462 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
471− {0x3808, 0x00, 0, 0}, {0x3809, 0xb0, 0, 0}, {0x380a, 0x00, 0, 0},
472− {0x380b, 0x90, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
473− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
463+ {0x3810, 0x00, 0, 0},
474464 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
475465 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
476466 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -489,9 +479,7 @@ static const struct reg_value ov5640_setting_15fps_QCIF_176_144[] = { · 12 unmodified lines
489479 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
490480 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
491481 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
492− {0x3808, 0x00, 0, 0}, {0x3809, 0xb0, 0, 0}, {0x380a, 0x00, 0, 0},
493− {0x380b, 0x90, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
494− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
482+ {0x3810, 0x00, 0, 0},
495483 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
496484 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
497485 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -510,9 +498,7 @@ static const struct reg_value ov5640_setting_30fps_NTSC_720_480[] = { · 12 unmodified lines
510498 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
511499 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
512500 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
513− {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x01, 0, 0},
514− {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
515− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
501+ {0x3810, 0x00, 0, 0},
516502 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x3c, 0, 0},
517503 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
518504 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -531,9 +517,7 @@ static const struct reg_value ov5640_setting_15fps_NTSC_720_480[] = { · 12 unmodified lines
531517 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
532518 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
533519 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
534− {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x01, 0, 0},
535− {0x380b, 0xe0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
536− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
520+ {0x3810, 0x00, 0, 0},
537521 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x3c, 0, 0},
538522 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
539523 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -552,9 +536,7 @@ static const struct reg_value ov5640_setting_30fps_PAL_720_576[] = { · 12 unmodified lines
552536 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
553537 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
554538 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
555− {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x02, 0, 0},
556− {0x380b, 0x40, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
557− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
539+ {0x3810, 0x00, 0, 0},
558540 {0x3811, 0x38, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
559541 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
560542 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -573,9 +555,7 @@ static const struct reg_value ov5640_setting_15fps_PAL_720_576[] = { · 12 unmodified lines
573555 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
574556 {0x3802, 0x00, 0, 0}, {0x3803, 0x04, 0, 0}, {0x3804, 0x0a, 0, 0},
575557 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9b, 0, 0},
576− {0x3808, 0x02, 0, 0}, {0x3809, 0xd0, 0, 0}, {0x380a, 0x02, 0, 0},
577− {0x380b, 0x40, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x68, 0, 0},
578− {0x380e, 0x03, 0, 0}, {0x380f, 0xd8, 0, 0}, {0x3810, 0x00, 0, 0},
558+ {0x3810, 0x00, 0, 0},
579559 {0x3811, 0x38, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x06, 0, 0},
580560 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
581561 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -595,9 +575,7 @@ static const struct reg_value ov5640_setting_30fps_720P_1280_720[] = { · 13 unmodified lines
595575 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
596576 {0x3802, 0x00, 0, 0}, {0x3803, 0xfa, 0, 0}, {0x3804, 0x0a, 0, 0},
597577 {0x3805, 0x3f, 0, 0}, {0x3806, 0x06, 0, 0}, {0x3807, 0xa9, 0, 0},
598− {0x3808, 0x05, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x02, 0, 0},
599− {0x380b, 0xd0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x64, 0, 0},
600− {0x380e, 0x02, 0, 0}, {0x380f, 0xe4, 0, 0}, {0x3810, 0x00, 0, 0},
578+ {0x3810, 0x00, 0, 0},
601579 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0},
602580 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
603581 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x02, 0, 0},
@@ -617,9 +595,7 @@ static const struct reg_value ov5640_setting_15fps_720P_1280_720[] = { · 13 unmodified lines
617595 {0x3815, 0x31, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
618596 {0x3802, 0x00, 0, 0}, {0x3803, 0xfa, 0, 0}, {0x3804, 0x0a, 0, 0},
619597 {0x3805, 0x3f, 0, 0}, {0x3806, 0x06, 0, 0}, {0x3807, 0xa9, 0, 0},
620− {0x3808, 0x05, 0, 0}, {0x3809, 0x00, 0, 0}, {0x380a, 0x02, 0, 0},
621− {0x380b, 0xd0, 0, 0}, {0x380c, 0x07, 0, 0}, {0x380d, 0x64, 0, 0},
622− {0x380e, 0x02, 0, 0}, {0x380f, 0xe4, 0, 0}, {0x3810, 0x00, 0, 0},
598+ {0x3810, 0x00, 0, 0},
623599 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0},
624600 {0x3618, 0x00, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x64, 0, 0},
625601 {0x3709, 0x52, 0, 0}, {0x370c, 0x03, 0, 0}, {0x3a02, 0x02, 0, 0},
@@ -639,9 +615,7 @@ static const struct reg_value ov5640_setting_30fps_1080P_1920_1080[] = { · 13 unmodified lines
639615 {0x3815, 0x11, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
640616 {0x3802, 0x00, 0, 0}, {0x3803, 0x00, 0, 0}, {0x3804, 0x0a, 0, 0},
641617 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9f, 0, 0},
642− {0x3808, 0x0a, 0, 0}, {0x3809, 0x20, 0, 0}, {0x380a, 0x07, 0, 0},
643− {0x380b, 0x98, 0, 0}, {0x380c, 0x0b, 0, 0}, {0x380d, 0x1c, 0, 0},
644− {0x380e, 0x07, 0, 0}, {0x380f, 0xb0, 0, 0}, {0x3810, 0x00, 0, 0},
618+ {0x3810, 0x00, 0, 0},
645619 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0},
646620 {0x3618, 0x04, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x21, 0, 0},
647621 {0x3709, 0x12, 0, 0}, {0x370c, 0x00, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -655,10 +629,8 @@ static const struct reg_value ov5640_setting_30fps_1080P_1920_1080[] = { · 7 unmodified lines
655629 {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0},
656630 {0x3800, 0x01, 0, 0}, {0x3801, 0x50, 0, 0}, {0x3802, 0x01, 0, 0},
657631 {0x3803, 0xb2, 0, 0}, {0x3804, 0x08, 0, 0}, {0x3805, 0xef, 0, 0},
658− {0x3806, 0x05, 0, 0}, {0x3807, 0xf1, 0, 0}, {0x3808, 0x07, 0, 0},
659− {0x3809, 0x80, 0, 0}, {0x380a, 0x04, 0, 0}, {0x380b, 0x38, 0, 0},
660− {0x380c, 0x09, 0, 0}, {0x380d, 0xc4, 0, 0}, {0x380e, 0x04, 0, 0},
661− {0x380f, 0x60, 0, 0}, {0x3612, 0x2b, 0, 0}, {0x3708, 0x64, 0, 0},
632+ {0x3806, 0x05, 0, 0}, {0x3807, 0xf1, 0, 0},
633+ {0x3612, 0x2b, 0, 0}, {0x3708, 0x64, 0, 0},
662634 {0x3a02, 0x04, 0, 0}, {0x3a03, 0x60, 0, 0}, {0x3a08, 0x01, 0, 0},
663635 {0x3a09, 0x50, 0, 0}, {0x3a0a, 0x01, 0, 0}, {0x3a0b, 0x18, 0, 0},
664636 {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x04, 0, 0},
@@ -676,9 +648,7 @@ static const struct reg_value ov5640_setting_15fps_1080P_1920_1080[] = { · 11 unmodified lines
676648 {0x3815, 0x11, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
677649 {0x3802, 0x00, 0, 0}, {0x3803, 0x00, 0, 0}, {0x3804, 0x0a, 0, 0},
678650 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9f, 0, 0},
679− {0x3808, 0x0a, 0, 0}, {0x3809, 0x20, 0, 0}, {0x380a, 0x07, 0, 0},
680− {0x380b, 0x98, 0, 0}, {0x380c, 0x0b, 0, 0}, {0x380d, 0x1c, 0, 0},
681− {0x380e, 0x07, 0, 0}, {0x380f, 0xb0, 0, 0}, {0x3810, 0x00, 0, 0},
651+ {0x3810, 0x00, 0, 0},
682652 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0},
683653 {0x3618, 0x04, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x21, 0, 0},
684654 {0x3709, 0x12, 0, 0}, {0x370c, 0x00, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -692,10 +662,8 @@ static const struct reg_value ov5640_setting_15fps_1080P_1920_1080[] = { · 7 unmodified lines
692662 {0x3c09, 0x1c, 0, 0}, {0x3c0a, 0x9c, 0, 0}, {0x3c0b, 0x40, 0, 0},
693663 {0x3800, 0x01, 0, 0}, {0x3801, 0x50, 0, 0}, {0x3802, 0x01, 0, 0},
694664 {0x3803, 0xb2, 0, 0}, {0x3804, 0x08, 0, 0}, {0x3805, 0xef, 0, 0},
695− {0x3806, 0x05, 0, 0}, {0x3807, 0xf1, 0, 0}, {0x3808, 0x07, 0, 0},
696− {0x3809, 0x80, 0, 0}, {0x380a, 0x04, 0, 0}, {0x380b, 0x38, 0, 0},
697− {0x380c, 0x09, 0, 0}, {0x380d, 0xc4, 0, 0}, {0x380e, 0x04, 0, 0},
698− {0x380f, 0x60, 0, 0}, {0x3612, 0x2b, 0, 0}, {0x3708, 0x64, 0, 0},
665+ {0x3806, 0x05, 0, 0}, {0x3807, 0xf1, 0, 0},
666+ {0x3612, 0x2b, 0, 0}, {0x3708, 0x64, 0, 0},
699667 {0x3a02, 0x04, 0, 0}, {0x3a03, 0x60, 0, 0}, {0x3a08, 0x01, 0, 0},
700668 {0x3a09, 0x50, 0, 0}, {0x3a0a, 0x01, 0, 0}, {0x3a0b, 0x18, 0, 0},
701669 {0x3a0e, 0x03, 0, 0}, {0x3a0d, 0x04, 0, 0}, {0x3a14, 0x04, 0, 0},
@@ -712,9 +680,7 @@ static const struct reg_value ov5640_setting_15fps_QSXGA_2592_1944[] = { · 10 unmodified lines
712680 {0x3815, 0x11, 0, 0}, {0x3800, 0x00, 0, 0}, {0x3801, 0x00, 0, 0},
713681 {0x3802, 0x00, 0, 0}, {0x3803, 0x00, 0, 0}, {0x3804, 0x0a, 0, 0},
714682 {0x3805, 0x3f, 0, 0}, {0x3806, 0x07, 0, 0}, {0x3807, 0x9f, 0, 0},
715− {0x3808, 0x0a, 0, 0}, {0x3809, 0x20, 0, 0}, {0x380a, 0x07, 0, 0},
716− {0x380b, 0x98, 0, 0}, {0x380c, 0x0b, 0, 0}, {0x380d, 0x1c, 0, 0},
717− {0x380e, 0x07, 0, 0}, {0x380f, 0xb0, 0, 0}, {0x3810, 0x00, 0, 0},
683+ {0x3810, 0x00, 0, 0},
718684 {0x3811, 0x10, 0, 0}, {0x3812, 0x00, 0, 0}, {0x3813, 0x04, 0, 0},
719685 {0x3618, 0x04, 0, 0}, {0x3612, 0x29, 0, 0}, {0x3708, 0x21, 0, 0},
720686 {0x3709, 0x12, 0, 0}, {0x370c, 0x00, 0, 0}, {0x3a02, 0x03, 0, 0},
@@ -728,66 +694,84 @@ static const struct reg_value ov5640_setting_15fps_QSXGA_2592_1944[] = { · 7 unmodified lines
728694
729695 /* power-on sensor init reg table */
730696 static const struct ov5640_mode_info ov5640_mode_init_data = {
731− 0, SUBSAMPLING, 640, 480, ov5640_init_setting_30fps_VGA,
697+ 0, SUBSAMPLING, 640, 1896, 480, 984,
698+ ov5640_init_setting_30fps_VGA,
732699 ARRAY_SIZE(ov5640_init_setting_30fps_VGA),
733700 };
734701
735702 static const struct ov5640_mode_info
736703 ov5640_mode_data[OV5640_NUM_FRAMERATES][OV5640_NUM_MODES] = {
737704 {
738− {OV5640_MODE_QCIF_176_144, SUBSAMPLING, 176, 144,
705+ {OV5640_MODE_QCIF_176_144, SUBSAMPLING,
706+ 176, 1896, 144, 984,
739707 ov5640_setting_15fps_QCIF_176_144,
740708 ARRAY_SIZE(ov5640_setting_15fps_QCIF_176_144)},
741− {OV5640_MODE_QVGA_320_240, SUBSAMPLING, 320, 240,
709+ {OV5640_MODE_QVGA_320_240, SUBSAMPLING,
710+ 320, 1896, 240, 984,
742711 ov5640_setting_15fps_QVGA_320_240,
743712 ARRAY_SIZE(ov5640_setting_15fps_QVGA_320_240)},
744− {OV5640_MODE_VGA_640_480, SUBSAMPLING, 640, 480,
713+ {OV5640_MODE_VGA_640_480, SUBSAMPLING,
714+ 640, 1896, 480, 1080,
745715 ov5640_setting_15fps_VGA_640_480,
746716 ARRAY_SIZE(ov5640_setting_15fps_VGA_640_480)},
747− {OV5640_MODE_NTSC_720_480, SUBSAMPLING, 720, 480,
717+ {OV5640_MODE_NTSC_720_480, SUBSAMPLING,
718+ 720, 1896, 480, 984,
748719 ov5640_setting_15fps_NTSC_720_480,
749720 ARRAY_SIZE(ov5640_setting_15fps_NTSC_720_480)},
750− {OV5640_MODE_PAL_720_576, SUBSAMPLING, 720, 576,
721+ {OV5640_MODE_PAL_720_576, SUBSAMPLING,
722+ 720, 1896, 576, 984,
751723 ov5640_setting_15fps_PAL_720_576,
752724 ARRAY_SIZE(ov5640_setting_15fps_PAL_720_576)},
753− {OV5640_MODE_XGA_1024_768, SUBSAMPLING, 1024, 768,
725+ {OV5640_MODE_XGA_1024_768, SUBSAMPLING,
726+ 1024, 1896, 768, 1080,
754727 ov5640_setting_15fps_XGA_1024_768,
755728 ARRAY_SIZE(ov5640_setting_15fps_XGA_1024_768)},
756− {OV5640_MODE_720P_1280_720, SUBSAMPLING, 1280, 720,
729+ {OV5640_MODE_720P_1280_720, SUBSAMPLING,
730+ 1280, 1892, 720, 740,
757731 ov5640_setting_15fps_720P_1280_720,
758732 ARRAY_SIZE(ov5640_setting_15fps_720P_1280_720)},
759− {OV5640_MODE_1080P_1920_1080, SCALING, 1920, 1080,
733+ {OV5640_MODE_1080P_1920_1080, SCALING,
734+ 1920, 2500, 1080, 1120,
760735 ov5640_setting_15fps_1080P_1920_1080,
761736 ARRAY_SIZE(ov5640_setting_15fps_1080P_1920_1080)},
762− {OV5640_MODE_QSXGA_2592_1944, SCALING, 2592, 1944,
737+ {OV5640_MODE_QSXGA_2592_1944, SCALING,
738+ 2592, 2844, 1944, 1968,
763739 ov5640_setting_15fps_QSXGA_2592_1944,
764740 ARRAY_SIZE(ov5640_setting_15fps_QSXGA_2592_1944)},
765741 }, {
766− {OV5640_MODE_QCIF_176_144, SUBSAMPLING, 176, 144,
742+ {OV5640_MODE_QCIF_176_144, SUBSAMPLING,
743+ 176, 1896, 144, 984,
767744 ov5640_setting_30fps_QCIF_176_144,
768745 ARRAY_SIZE(ov5640_setting_30fps_QCIF_176_144)},
769− {OV5640_MODE_QVGA_320_240, SUBSAMPLING, 320, 240,
746+ {OV5640_MODE_QVGA_320_240, SUBSAMPLING,
747+ 320, 1896, 240, 984,
770748 ov5640_setting_30fps_QVGA_320_240,
771749 ARRAY_SIZE(ov5640_setting_30fps_QVGA_320_240)},
772− {OV5640_MODE_VGA_640_480, SUBSAMPLING, 640, 480,
750+ {OV5640_MODE_VGA_640_480, SUBSAMPLING,
751+ 640, 1896, 480, 1080,
773752 ov5640_setting_30fps_VGA_640_480,
774753 ARRAY_SIZE(ov5640_setting_30fps_VGA_640_480)},
775− {OV5640_MODE_NTSC_720_480, SUBSAMPLING, 720, 480,
754+ {OV5640_MODE_NTSC_720_480, SUBSAMPLING,
755+ 720, 1896, 480, 984,
776756 ov5640_setting_30fps_NTSC_720_480,
777757 ARRAY_SIZE(ov5640_setting_30fps_NTSC_720_480)},
778− {OV5640_MODE_PAL_720_576, SUBSAMPLING, 720, 576,
758+ {OV5640_MODE_PAL_720_576, SUBSAMPLING,
759+ 720, 1896, 576, 984,
779760 ov5640_setting_30fps_PAL_720_576,
780761 ARRAY_SIZE(ov5640_setting_30fps_PAL_720_576)},
781− {OV5640_MODE_XGA_1024_768, SUBSAMPLING, 1024, 768,
762+ {OV5640_MODE_XGA_1024_768, SUBSAMPLING,
763+ 1024, 1896, 768, 1080,
782764 ov5640_setting_30fps_XGA_1024_768,
783765 ARRAY_SIZE(ov5640_setting_30fps_XGA_1024_768)},
784− {OV5640_MODE_720P_1280_720, SUBSAMPLING, 1280, 720,
766+ {OV5640_MODE_720P_1280_720, SUBSAMPLING,
767+ 1280, 1892, 720, 740,
785768 ov5640_setting_30fps_720P_1280_720,
786769 ARRAY_SIZE(ov5640_setting_30fps_720P_1280_720)},
787− {OV5640_MODE_1080P_1920_1080, SCALING, 1920, 1080,
770+ {OV5640_MODE_1080P_1920_1080, SCALING,
771+ 1920, 2500, 1080, 1120,
788772 ov5640_setting_30fps_1080P_1920_1080,
789773 ARRAY_SIZE(ov5640_setting_30fps_1080P_1920_1080)},
790− {OV5640_MODE_QSXGA_2592_1944, -1, 0, 0, NULL, 0},
774+ {OV5640_MODE_QSXGA_2592_1944, -1, 0, 0, 0, 0, NULL, 0},
791775 },
792776 };
793777
@@ -1377,6 +1361,30 @@ static int ov5640_set_virtual_channel(struct ov5640_dev *sensor) · 583 unmodified lines
13771361 return ov5640_write_reg(sensor, OV5640_REG_DEBUG_MODE, temp);
13781362 }
13791363
1364+static int ov5640_set_timings(struct ov5640_dev *sensor,
1365+ const struct ov5640_mode_info *mode)
1366+{
1367+ int ret;
1368+
1369+ ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPHO, mode->hact);
1370+ if (ret < 0)
1371+ return ret;
1372+
1373+ ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_DVPVO, mode->vact);
1374+ if (ret < 0)
1375+ return ret;
1376+
1377+ ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_HTS, mode->htot);
1378+ if (ret < 0)
1379+ return ret;
1380+
1381+ ret = ov5640_write_reg16(sensor, OV5640_REG_TIMING_VTS, mode->vtot);
1382+ if (ret < 0)
1383+ return ret;
1384+
1385+ return 0;
1386+}
1387+
13801388 static const struct ov5640_mode_info *
13811389 ov5640_find_mode(struct ov5640_dev *sensor, enum ov5640_frame_rate fr,
13821390 int width, int height, bool nearest)
@@ -1390,10 +1398,10 @@ ov5640_find_mode(struct ov5640_dev *sensor, enum ov5640_frame_rate fr, · 7 unmodified lines
13901398 if (!mode->reg_data)
13911399 continue;
13921400
1393− if ((nearest && mode->width <= width &&
1394− mode->height <= height) ||
1395− (!nearest && mode->width == width &&
1396− mode->height == height))
1401+ if ((nearest && mode->hact <= width &&
1402+ mode->vact <= height) ||
1403+ (!nearest && mode->hact == width &&
1404+ mode->vact == height))
13971405 break;
13981406 }
13991407
@@ -1568,7 +1576,8 @@ static int ov5640_set_mode_exposure_calc(struct ov5640_dev *sensor, · 168 unmodified lines
15681576 * change mode directly
15691577 */
15701578 static int ov5640_set_mode_direct(struct ov5640_dev *sensor,
1571− const struct ov5640_mode_info *mode)
1579+ const struct ov5640_mode_info *mode,
1580+ s32 exposure)
15721581 {
15731582 int ret;
15741583
@@ -1584,7 +1593,8 @@ static int ov5640_set_mode_direct(struct ov5640_dev *sensor, · 9 unmodified lines
15841593 ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 1);
15851594 if (ret)
15861595 return ret;
1587− return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, V4L2_EXPOSURE_AUTO);
1596+
1597+ return __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, exposure);
15881598 }
15891599
15901600 static int ov5640_set_mode(struct ov5640_dev *sensor,
@@ -1592,6 +1602,7 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, · 1 unmodified line
15921602 {
15931603 const struct ov5640_mode_info *mode = sensor->current_mode;
15941604 enum ov5640_downsize_mode dn_mode, orig_dn_mode;
1605+ s32 exposure;
15951606 int ret;
15961607
15971608 dn_mode = mode->dn_mode;
@@ -1601,7 +1612,9 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, · 3 unmodified lines
16011612 ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_gain, 0);
16021613 if (ret)
16031614 return ret;
1604− ret = __v4l2_ctrl_s_ctrl(sensor->ctrls.auto_exp, V4L2_EXPOSURE_MANUAL);
1615+
1616+ exposure = sensor->ctrls.auto_exp->val;
1617+ ret = ov5640_set_exposure(sensor, V4L2_EXPOSURE_MANUAL);
16051618 if (ret)
16061619 return ret;
16071620
@@ -1617,9 +1630,13 @@ static int ov5640_set_mode(struct ov5640_dev *sensor, · 9 unmodified lines
16171630 * change inside subsampling or scaling
16181631 * download firmware directly
16191632 */
1620− ret = ov5640_set_mode_direct(sensor, mode);
1633+ ret = ov5640_set_mode_direct(sensor, mode, exposure);
16211634 }
16221635
1636+ if (ret < 0)
1637+ return ret;
1638+
1639+ ret = ov5640_set_timings(sensor, mode);
16231640 if (ret < 0)
16241641 return ret;
16251642
@@ -1654,6 +1671,12 @@ static int ov5640_restore_mode(struct ov5640_dev *sensor) · 28 unmodified lines
16541671 if (ret < 0)
16551672 return ret;
16561673
1674+ ret = ov5640_mod_reg(sensor, OV5640_REG_SYS_ROOT_DIVIDER, 0x3f,
1675+ (ilog2(OV5640_SCLK2X_ROOT_DIVIDER_DEFAULT) << 2) |
1676+ ilog2(OV5640_SCLK_ROOT_DIVIDER_DEFAULT));
1677+ if (ret)
1678+ return ret;
1679+
16571680 /* now restore the last capture mode */
16581681 ret = ov5640_set_mode(sensor, &ov5640_mode_init_data);
16591682 if (ret < 0)
@@ -1871,8 +1894,8 @@ static int ov5640_try_fmt_internal(struct v4l2_subdev *sd, · 211 unmodified lines
18711894 mode = ov5640_find_mode(sensor, fr, fmt->width, fmt->height, true);
18721895 if (!mode)
18731896 return -EINVAL;
1874− fmt->width = mode->width;
1875− fmt->height = mode->height;
1897+ fmt->width = mode->hact;
1898+ fmt->height = mode->vact;
18761899
18771900 if (new_mode)
18781901 *new_mode = mode;
@@ -2155,6 +2178,21 @@ static int ov5640_set_ctrl_test_pattern(struct ov5640_dev *sensor, int value) · 276 unmodified lines
21552178 0xa4, value ? 0xa4 : 0);
21562179 }
21572180
2181+static int ov5640_set_ctrl_light_freq(struct ov5640_dev *sensor, int value)
2182+{
2183+ int ret;
2184+
2185+ ret = ov5640_mod_reg(sensor, OV5640_REG_HZ5060_CTRL01, BIT(7),
2186+ (value == V4L2_CID_POWER_LINE_FREQUENCY_AUTO) ?
2187+ 0 : BIT(7));
2188+ if (ret)
2189+ return ret;
2190+
2191+ return ov5640_mod_reg(sensor, OV5640_REG_HZ5060_CTRL00, BIT(2),
2192+ (value == V4L2_CID_POWER_LINE_FREQUENCY_50HZ) ?
2193+ BIT(2) : 0);
2194+}
2195+
21582196 static int ov5640_g_volatile_ctrl(struct v4l2_ctrl *ctrl)
21592197 {
21602198 struct v4l2_subdev *sd = ctrl_to_sd(ctrl);
@@ -2223,6 +2261,9 @@ static int ov5640_s_ctrl(struct v4l2_ctrl *ctrl) · 62 unmodified lines
22232261 case V4L2_CID_TEST_PATTERN:
22242262 ret = ov5640_set_ctrl_test_pattern(sensor, ctrl->val);
22252263 break;
2264+ case V4L2_CID_POWER_LINE_FREQUENCY:
2265+ ret = ov5640_set_ctrl_light_freq(sensor, ctrl->val);
2266+ break;
22262267 default:
22272268 ret = -EINVAL;
22282269 break;
@@ -2285,6 +2326,12 @@ static int ov5640_init_controls(struct ov5640_dev *sensor) · 56 unmodified lines
22852326 ARRAY_SIZE(test_pattern_menu) - 1,
22862327 0, 0, test_pattern_menu);
22872328
2329+ ctrls->light_freq =
2330+ v4l2_ctrl_new_std_menu(hdl, ops,
2331+ V4L2_CID_POWER_LINE_FREQUENCY,
2332+ V4L2_CID_POWER_LINE_FREQUENCY_AUTO, 0,
2333+ V4L2_CID_POWER_LINE_FREQUENCY_50HZ);
2334+
22882335 if (hdl->error) {
22892336 ret = hdl->error;
22902337 goto free_ctrls;
@@ -2315,10 +2362,10 @@ static int ov5640_enum_frame_size(struct v4l2_subdev *sd, · 24 unmodified lines
23152362 return -EINVAL;
23162363
23172364 fse->min_width =
2318− ov5640_mode_data[0][fse->index].width;
2365+ ov5640_mode_data[0][fse->index].hact;
23192366 fse->max_width = fse->min_width;
23202367 fse->min_height =
2321− ov5640_mode_data[0][fse->index].height;
2368+ ov5640_mode_data[0][fse->index].vact;
23222369 fse->max_height = fse->min_height;
23232370
23242371 return 0;
@@ -2382,14 +2429,14 @@ static int ov5640_s_frame_interval(struct v4l2_subdev *sd, · 57 unmodified lines
23822429 mode = sensor->current_mode;
23832430
23842431 frame_rate = ov5640_try_frame_interval(sensor, &fi->interval,
2385− mode->width, mode->height);
2432+ mode->hact, mode->vact);
23862433 if (frame_rate < 0)
23872434 frame_rate = OV5640_15_FPS;
23882435
23892436 sensor->current_fr = frame_rate;
23902437 sensor->frame_interval = fi->interval;
2391− sensor->current_mode = ov5640_find_mode(sensor, frame_rate, mode->width,
2392− mode->height, true);
2438+ sensor->current_mode = ov5640_find_mode(sensor, frame_rate, mode->hact,
2439+ mode->vact, true);
23932440 sensor->pending_mode_change = true;
23942441 out:
23952442 mutex_unlock(&sensor->lock);
@@ -2536,8 +2583,8 @@ static int ov5640_probe(struct i2c_client *client, · 140 unmodified lines
25362583
25372584 sensor->ae_target = 52;
25382585
2539− endpoint = fwnode_graph_get_next_endpoint(
2540− of_fwnode_handle(client->dev.of_node), NULL);
2586+ endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(&client->dev),
2587+ NULL);
25412588 if (!endpoint) {
25422589 dev_err(dev, "endpoint node not found\n");
25432590 return -EINVAL;
drivers/media/i2c/ov5645.c+4−2
@@ -600,11 +600,13 @@ static int ov5645_write_reg(struct ov5645 *ov5645, u16 reg, u8 val) · 599 unmodified lines
600600 regbuf[2] = val;
601601
602602 ret = i2c_master_send(ov5645->i2c_client, regbuf, 3);
603− if (ret < 0)
603+ if (ret < 0) {
604604 dev_err(ov5645->dev, "%s: write reg error %d: reg=%x, val=%x\n",
605605 __func__, ret, reg, val);
606+ return ret;
607+ }
606608
607− return ret;
609+ return 0;
608610 }
609611
610612 static int ov5645_read_reg(struct ov5645 *ov5645, u16 reg, u8 *val)
drivers/media/i2c/ov5695.c+0−1
@@ -1385,7 +1385,6 @@ MODULE_DEVICE_TABLE(of, ov5695_of_match); · 1384 unmodified lines
13851385 static struct i2c_driver ov5695_i2c_driver = {
13861386 .driver = {
13871387 .name = "ov5695",
1388− .owner = THIS_MODULE,
13891388 .pm = &ov5695_pm_ops,
13901389 .of_match_table = of_match_ptr(ov5695_of_match),
13911390 },
drivers/media/i2c/ov7251.c+1503−0
@@ -0,0 +1,1503 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Driver for the OV7251 camera sensor.
4+ *
5+ * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
6+ * Copyright (c) 2017-2018, Linaro Ltd.
7+ */
8+
9+#include <linux/bitops.h>
10+#include <linux/clk.h>
11+#include <linux/delay.h>
12+#include <linux/device.h>
13+#include <linux/gpio/consumer.h>
14+#include <linux/i2c.h>
15+#include <linux/init.h>
16+#include <linux/module.h>
17+#include <linux/regulator/consumer.h>
18+#include <linux/slab.h>
19+#include <linux/types.h>
20+#include <media/v4l2-ctrls.h>
21+#include <media/v4l2-fwnode.h>
22+#include <media/v4l2-subdev.h>
23+
24+#define OV7251_SC_MODE_SELECT 0x0100
25+#define OV7251_SC_MODE_SELECT_SW_STANDBY 0x0
26+#define OV7251_SC_MODE_SELECT_STREAMING 0x1
27+
28+#define OV7251_CHIP_ID_HIGH 0x300a
29+#define OV7251_CHIP_ID_HIGH_BYTE 0x77
30+#define OV7251_CHIP_ID_LOW 0x300b
31+#define OV7251_CHIP_ID_LOW_BYTE 0x50
32+#define OV7251_SC_GP_IO_IN1 0x3029
33+#define OV7251_AEC_EXPO_0 0x3500
34+#define OV7251_AEC_EXPO_1 0x3501
35+#define OV7251_AEC_EXPO_2 0x3502
36+#define OV7251_AEC_AGC_ADJ_0 0x350a
37+#define OV7251_AEC_AGC_ADJ_1 0x350b
38+#define OV7251_TIMING_FORMAT1 0x3820
39+#define OV7251_TIMING_FORMAT1_VFLIP BIT(2)
40+#define OV7251_TIMING_FORMAT2 0x3821
41+#define OV7251_TIMING_FORMAT2_MIRROR BIT(2)
42+#define OV7251_PRE_ISP_00 0x5e00
43+#define OV7251_PRE_ISP_00_TEST_PATTERN BIT(7)
44+
45+struct reg_value {
46+ u16 reg;
47+ u8 val;
48+};
49+
50+struct ov7251_mode_info {
51+ u32 width;
52+ u32 height;
53+ const struct reg_value *data;
54+ u32 data_size;
55+ u32 pixel_clock;
56+ u32 link_freq;
57+ u16 exposure_max;
58+ u16 exposure_def;
59+ struct v4l2_fract timeperframe;
60+};
61+
62+struct ov7251 {
63+ struct i2c_client *i2c_client;
64+ struct device *dev;
65+ struct v4l2_subdev sd;
66+ struct media_pad pad;
67+ struct v4l2_fwnode_endpoint ep;
68+ struct v4l2_mbus_framefmt fmt;
69+ struct v4l2_rect crop;
70+ struct clk *xclk;
71+ u32 xclk_freq;
72+
73+ struct regulator *io_regulator;
74+ struct regulator *core_regulator;
75+ struct regulator *analog_regulator;
76+
77+ const struct ov7251_mode_info *current_mode;
78+
79+ struct v4l2_ctrl_handler ctrls;
80+ struct v4l2_ctrl *pixel_clock;
81+ struct v4l2_ctrl *link_freq;
82+ struct v4l2_ctrl *exposure;
83+ struct v4l2_ctrl *gain;
84+
85+ /* Cached register values */
86+ u8 aec_pk_manual;
87+ u8 pre_isp_00;
88+ u8 timing_format1;
89+ u8 timing_format2;
90+
91+ struct mutex lock; /* lock to protect power state, ctrls and mode */
92+ bool power_on;
93+
94+ struct gpio_desc *enable_gpio;
95+};
96+
97+static inline struct ov7251 *to_ov7251(struct v4l2_subdev *sd)
98+{
99+ return container_of(sd, struct ov7251, sd);
100+}
101+
102+static const struct reg_value ov7251_global_init_setting[] = {
103+ { 0x0103, 0x01 },
104+ { 0x303b, 0x02 },
105+};
106+
107+static const struct reg_value ov7251_setting_vga_30fps[] = {
108+ { 0x3005, 0x00 },
109+ { 0x3012, 0xc0 },
110+ { 0x3013, 0xd2 },
111+ { 0x3014, 0x04 },
112+ { 0x3016, 0xf0 },
113+ { 0x3017, 0xf0 },
114+ { 0x3018, 0xf0 },
115+ { 0x301a, 0xf0 },
116+ { 0x301b, 0xf0 },
117+ { 0x301c, 0xf0 },
118+ { 0x3023, 0x05 },
119+ { 0x3037, 0xf0 },
120+ { 0x3098, 0x04 }, /* pll2 pre divider */
121+ { 0x3099, 0x28 }, /* pll2 multiplier */
122+ { 0x309a, 0x05 }, /* pll2 sys divider */
123+ { 0x309b, 0x04 }, /* pll2 adc divider */
124+ { 0x309d, 0x00 }, /* pll2 divider */
125+ { 0x30b0, 0x0a }, /* pll1 pix divider */
126+ { 0x30b1, 0x01 }, /* pll1 divider */
127+ { 0x30b3, 0x64 }, /* pll1 multiplier */
128+ { 0x30b4, 0x03 }, /* pll1 pre divider */
129+ { 0x30b5, 0x05 }, /* pll1 mipi divider */
130+ { 0x3106, 0xda },
131+ { 0x3503, 0x07 },
132+ { 0x3509, 0x10 },
133+ { 0x3600, 0x1c },
134+ { 0x3602, 0x62 },
135+ { 0x3620, 0xb7 },
136+ { 0x3622, 0x04 },
137+ { 0x3626, 0x21 },
138+ { 0x3627, 0x30 },
139+ { 0x3630, 0x44 },
140+ { 0x3631, 0x35 },
141+ { 0x3634, 0x60 },
142+ { 0x3636, 0x00 },
143+ { 0x3662, 0x01 },
144+ { 0x3663, 0x70 },
145+ { 0x3664, 0x50 },
146+ { 0x3666, 0x0a },
147+ { 0x3669, 0x1a },
148+ { 0x366a, 0x00 },
149+ { 0x366b, 0x50 },
150+ { 0x3673, 0x01 },
151+ { 0x3674, 0xff },
152+ { 0x3675, 0x03 },
153+ { 0x3705, 0xc1 },
154+ { 0x3709, 0x40 },
155+ { 0x373c, 0x08 },
156+ { 0x3742, 0x00 },
157+ { 0x3757, 0xb3 },
158+ { 0x3788, 0x00 },
159+ { 0x37a8, 0x01 },
160+ { 0x37a9, 0xc0 },
161+ { 0x3800, 0x00 },
162+ { 0x3801, 0x04 },
163+ { 0x3802, 0x00 },
164+ { 0x3803, 0x04 },
165+ { 0x3804, 0x02 },
166+ { 0x3805, 0x8b },
167+ { 0x3806, 0x01 },
168+ { 0x3807, 0xeb },
169+ { 0x3808, 0x02 }, /* width high */
170+ { 0x3809, 0x80 }, /* width low */
171+ { 0x380a, 0x01 }, /* height high */
172+ { 0x380b, 0xe0 }, /* height low */
173+ { 0x380c, 0x03 }, /* total horiz timing high */
174+ { 0x380d, 0xa0 }, /* total horiz timing low */
175+ { 0x380e, 0x06 }, /* total vertical timing high */
176+ { 0x380f, 0xbc }, /* total vertical timing low */
177+ { 0x3810, 0x00 },
178+ { 0x3811, 0x04 },
179+ { 0x3812, 0x00 },
180+ { 0x3813, 0x05 },
181+ { 0x3814, 0x11 },
182+ { 0x3815, 0x11 },
183+ { 0x3820, 0x40 },
184+ { 0x3821, 0x00 },
185+ { 0x382f, 0x0e },
186+ { 0x3832, 0x00 },
187+ { 0x3833, 0x05 },
188+ { 0x3834, 0x00 },
189+ { 0x3835, 0x0c },
190+ { 0x3837, 0x00 },
191+ { 0x3b80, 0x00 },
192+ { 0x3b81, 0xa5 },
193+ { 0x3b82, 0x10 },
194+ { 0x3b83, 0x00 },
195+ { 0x3b84, 0x08 },
196+ { 0x3b85, 0x00 },
197+ { 0x3b86, 0x01 },
198+ { 0x3b87, 0x00 },
199+ { 0x3b88, 0x00 },
200+ { 0x3b89, 0x00 },
201+ { 0x3b8a, 0x00 },
202+ { 0x3b8b, 0x05 },
203+ { 0x3b8c, 0x00 },
204+ { 0x3b8d, 0x00 },
205+ { 0x3b8e, 0x00 },
206+ { 0x3b8f, 0x1a },
207+ { 0x3b94, 0x05 },
208+ { 0x3b95, 0xf2 },
209+ { 0x3b96, 0x40 },
210+ { 0x3c00, 0x89 },
211+ { 0x3c01, 0x63 },
212+ { 0x3c02, 0x01 },
213+ { 0x3c03, 0x00 },
214+ { 0x3c04, 0x00 },
215+ { 0x3c05, 0x03 },
216+ { 0x3c06, 0x00 },
217+ { 0x3c07, 0x06 },
218+ { 0x3c0c, 0x01 },
219+ { 0x3c0d, 0xd0 },
220+ { 0x3c0e, 0x02 },
221+ { 0x3c0f, 0x0a },
222+ { 0x4001, 0x42 },
223+ { 0x4004, 0x04 },
224+ { 0x4005, 0x00 },
225+ { 0x404e, 0x01 },
226+ { 0x4300, 0xff },
227+ { 0x4301, 0x00 },
228+ { 0x4315, 0x00 },
229+ { 0x4501, 0x48 },
230+ { 0x4600, 0x00 },
231+ { 0x4601, 0x4e },
232+ { 0x4801, 0x0f },
233+ { 0x4806, 0x0f },
234+ { 0x4819, 0xaa },
235+ { 0x4823, 0x3e },
236+ { 0x4837, 0x19 },
237+ { 0x4a0d, 0x00 },
238+ { 0x4a47, 0x7f },
239+ { 0x4a49, 0xf0 },
240+ { 0x4a4b, 0x30 },
241+ { 0x5000, 0x85 },
242+ { 0x5001, 0x80 },
243+};
244+
245+static const struct reg_value ov7251_setting_vga_60fps[] = {
246+ { 0x3005, 0x00 },
247+ { 0x3012, 0xc0 },
248+ { 0x3013, 0xd2 },
249+ { 0x3014, 0x04 },
250+ { 0x3016, 0x10 },
251+ { 0x3017, 0x00 },
252+ { 0x3018, 0x00 },
253+ { 0x301a, 0x00 },
254+ { 0x301b, 0x00 },
255+ { 0x301c, 0x00 },
256+ { 0x3023, 0x05 },
257+ { 0x3037, 0xf0 },
258+ { 0x3098, 0x04 }, /* pll2 pre divider */
259+ { 0x3099, 0x28 }, /* pll2 multiplier */
260+ { 0x309a, 0x05 }, /* pll2 sys divider */
261+ { 0x309b, 0x04 }, /* pll2 adc divider */
262+ { 0x309d, 0x00 }, /* pll2 divider */
263+ { 0x30b0, 0x0a }, /* pll1 pix divider */
264+ { 0x30b1, 0x01 }, /* pll1 divider */
265+ { 0x30b3, 0x64 }, /* pll1 multiplier */
266+ { 0x30b4, 0x03 }, /* pll1 pre divider */
267+ { 0x30b5, 0x05 }, /* pll1 mipi divider */
268+ { 0x3106, 0xda },
269+ { 0x3503, 0x07 },
270+ { 0x3509, 0x10 },
271+ { 0x3600, 0x1c },
272+ { 0x3602, 0x62 },
273+ { 0x3620, 0xb7 },
274+ { 0x3622, 0x04 },
275+ { 0x3626, 0x21 },
276+ { 0x3627, 0x30 },
277+ { 0x3630, 0x44 },
278+ { 0x3631, 0x35 },
279+ { 0x3634, 0x60 },
280+ { 0x3636, 0x00 },
281+ { 0x3662, 0x01 },
282+ { 0x3663, 0x70 },
283+ { 0x3664, 0x50 },
284+ { 0x3666, 0x0a },
285+ { 0x3669, 0x1a },
286+ { 0x366a, 0x00 },
287+ { 0x366b, 0x50 },
288+ { 0x3673, 0x01 },
289+ { 0x3674, 0xff },
290+ { 0x3675, 0x03 },
291+ { 0x3705, 0xc1 },
292+ { 0x3709, 0x40 },
293+ { 0x373c, 0x08 },
294+ { 0x3742, 0x00 },
295+ { 0x3757, 0xb3 },
296+ { 0x3788, 0x00 },
297+ { 0x37a8, 0x01 },
298+ { 0x37a9, 0xc0 },
299+ { 0x3800, 0x00 },
300+ { 0x3801, 0x04 },
301+ { 0x3802, 0x00 },
302+ { 0x3803, 0x04 },
303+ { 0x3804, 0x02 },
304+ { 0x3805, 0x8b },
305+ { 0x3806, 0x01 },
306+ { 0x3807, 0xeb },
307+ { 0x3808, 0x02 }, /* width high */
308+ { 0x3809, 0x80 }, /* width low */
309+ { 0x380a, 0x01 }, /* height high */
310+ { 0x380b, 0xe0 }, /* height low */
311+ { 0x380c, 0x03 }, /* total horiz timing high */
312+ { 0x380d, 0xa0 }, /* total horiz timing low */
313+ { 0x380e, 0x03 }, /* total vertical timing high */
314+ { 0x380f, 0x5c }, /* total vertical timing low */
315+ { 0x3810, 0x00 },
316+ { 0x3811, 0x04 },
317+ { 0x3812, 0x00 },
318+ { 0x3813, 0x05 },
319+ { 0x3814, 0x11 },
320+ { 0x3815, 0x11 },
321+ { 0x3820, 0x40 },
322+ { 0x3821, 0x00 },
323+ { 0x382f, 0x0e },
324+ { 0x3832, 0x00 },
325+ { 0x3833, 0x05 },
326+ { 0x3834, 0x00 },
327+ { 0x3835, 0x0c },
328+ { 0x3837, 0x00 },
329+ { 0x3b80, 0x00 },
330+ { 0x3b81, 0xa5 },
331+ { 0x3b82, 0x10 },
332+ { 0x3b83, 0x00 },
333+ { 0x3b84, 0x08 },
334+ { 0x3b85, 0x00 },
335+ { 0x3b86, 0x01 },
336+ { 0x3b87, 0x00 },
337+ { 0x3b88, 0x00 },
338+ { 0x3b89, 0x00 },
339+ { 0x3b8a, 0x00 },
340+ { 0x3b8b, 0x05 },
341+ { 0x3b8c, 0x00 },
342+ { 0x3b8d, 0x00 },
343+ { 0x3b8e, 0x00 },
344+ { 0x3b8f, 0x1a },
345+ { 0x3b94, 0x05 },
346+ { 0x3b95, 0xf2 },
347+ { 0x3b96, 0x40 },
348+ { 0x3c00, 0x89 },
349+ { 0x3c01, 0x63 },
350+ { 0x3c02, 0x01 },
351+ { 0x3c03, 0x00 },
352+ { 0x3c04, 0x00 },
353+ { 0x3c05, 0x03 },
354+ { 0x3c06, 0x00 },
355+ { 0x3c07, 0x06 },
356+ { 0x3c0c, 0x01 },
357+ { 0x3c0d, 0xd0 },
358+ { 0x3c0e, 0x02 },
359+ { 0x3c0f, 0x0a },
360+ { 0x4001, 0x42 },
361+ { 0x4004, 0x04 },
362+ { 0x4005, 0x00 },
363+ { 0x404e, 0x01 },
364+ { 0x4300, 0xff },
365+ { 0x4301, 0x00 },
366+ { 0x4315, 0x00 },
367+ { 0x4501, 0x48 },
368+ { 0x4600, 0x00 },
369+ { 0x4601, 0x4e },
370+ { 0x4801, 0x0f },
371+ { 0x4806, 0x0f },
372+ { 0x4819, 0xaa },
373+ { 0x4823, 0x3e },
374+ { 0x4837, 0x19 },
375+ { 0x4a0d, 0x00 },
376+ { 0x4a47, 0x7f },
377+ { 0x4a49, 0xf0 },
378+ { 0x4a4b, 0x30 },
379+ { 0x5000, 0x85 },
380+ { 0x5001, 0x80 },
381+};
382+
383+static const struct reg_value ov7251_setting_vga_90fps[] = {
384+ { 0x3005, 0x00 },
385+ { 0x3012, 0xc0 },
386+ { 0x3013, 0xd2 },
387+ { 0x3014, 0x04 },
388+ { 0x3016, 0x10 },
389+ { 0x3017, 0x00 },
390+ { 0x3018, 0x00 },
391+ { 0x301a, 0x00 },
392+ { 0x301b, 0x00 },
393+ { 0x301c, 0x00 },
394+ { 0x3023, 0x05 },
395+ { 0x3037, 0xf0 },
396+ { 0x3098, 0x04 }, /* pll2 pre divider */
397+ { 0x3099, 0x28 }, /* pll2 multiplier */
398+ { 0x309a, 0x05 }, /* pll2 sys divider */
399+ { 0x309b, 0x04 }, /* pll2 adc divider */
400+ { 0x309d, 0x00 }, /* pll2 divider */
401+ { 0x30b0, 0x0a }, /* pll1 pix divider */
402+ { 0x30b1, 0x01 }, /* pll1 divider */
403+ { 0x30b3, 0x64 }, /* pll1 multiplier */
404+ { 0x30b4, 0x03 }, /* pll1 pre divider */
405+ { 0x30b5, 0x05 }, /* pll1 mipi divider */
406+ { 0x3106, 0xda },
407+ { 0x3503, 0x07 },
408+ { 0x3509, 0x10 },
409+ { 0x3600, 0x1c },
410+ { 0x3602, 0x62 },
411+ { 0x3620, 0xb7 },
412+ { 0x3622, 0x04 },
413+ { 0x3626, 0x21 },
414+ { 0x3627, 0x30 },
415+ { 0x3630, 0x44 },
416+ { 0x3631, 0x35 },
417+ { 0x3634, 0x60 },
418+ { 0x3636, 0x00 },
419+ { 0x3662, 0x01 },
420+ { 0x3663, 0x70 },
421+ { 0x3664, 0x50 },
422+ { 0x3666, 0x0a },
423+ { 0x3669, 0x1a },
424+ { 0x366a, 0x00 },
425+ { 0x366b, 0x50 },
426+ { 0x3673, 0x01 },
427+ { 0x3674, 0xff },
428+ { 0x3675, 0x03 },
429+ { 0x3705, 0xc1 },
430+ { 0x3709, 0x40 },
431+ { 0x373c, 0x08 },
432+ { 0x3742, 0x00 },
433+ { 0x3757, 0xb3 },
434+ { 0x3788, 0x00 },
435+ { 0x37a8, 0x01 },
436+ { 0x37a9, 0xc0 },
437+ { 0x3800, 0x00 },
438+ { 0x3801, 0x04 },
439+ { 0x3802, 0x00 },
440+ { 0x3803, 0x04 },
441+ { 0x3804, 0x02 },
442+ { 0x3805, 0x8b },
443+ { 0x3806, 0x01 },
444+ { 0x3807, 0xeb },
445+ { 0x3808, 0x02 }, /* width high */
446+ { 0x3809, 0x80 }, /* width low */
447+ { 0x380a, 0x01 }, /* height high */
448+ { 0x380b, 0xe0 }, /* height low */
449+ { 0x380c, 0x03 }, /* total horiz timing high */
450+ { 0x380d, 0xa0 }, /* total horiz timing low */
451+ { 0x380e, 0x02 }, /* total vertical timing high */
452+ { 0x380f, 0x3c }, /* total vertical timing low */
453+ { 0x3810, 0x00 },
454+ { 0x3811, 0x04 },
455+ { 0x3812, 0x00 },
456+ { 0x3813, 0x05 },
457+ { 0x3814, 0x11 },
458+ { 0x3815, 0x11 },
459+ { 0x3820, 0x40 },
460+ { 0x3821, 0x00 },
461+ { 0x382f, 0x0e },
462+ { 0x3832, 0x00 },
463+ { 0x3833, 0x05 },
464+ { 0x3834, 0x00 },
465+ { 0x3835, 0x0c },
466+ { 0x3837, 0x00 },
467+ { 0x3b80, 0x00 },
468+ { 0x3b81, 0xa5 },
469+ { 0x3b82, 0x10 },
470+ { 0x3b83, 0x00 },
471+ { 0x3b84, 0x08 },
472+ { 0x3b85, 0x00 },
473+ { 0x3b86, 0x01 },
474+ { 0x3b87, 0x00 },
475+ { 0x3b88, 0x00 },
476+ { 0x3b89, 0x00 },
477+ { 0x3b8a, 0x00 },
478+ { 0x3b8b, 0x05 },
479+ { 0x3b8c, 0x00 },
480+ { 0x3b8d, 0x00 },
481+ { 0x3b8e, 0x00 },
482+ { 0x3b8f, 0x1a },
483+ { 0x3b94, 0x05 },
484+ { 0x3b95, 0xf2 },
485+ { 0x3b96, 0x40 },
486+ { 0x3c00, 0x89 },
487+ { 0x3c01, 0x63 },
488+ { 0x3c02, 0x01 },
489+ { 0x3c03, 0x00 },
490+ { 0x3c04, 0x00 },
491+ { 0x3c05, 0x03 },
492+ { 0x3c06, 0x00 },
493+ { 0x3c07, 0x06 },
494+ { 0x3c0c, 0x01 },
495+ { 0x3c0d, 0xd0 },
496+ { 0x3c0e, 0x02 },
497+ { 0x3c0f, 0x0a },
498+ { 0x4001, 0x42 },
499+ { 0x4004, 0x04 },
500+ { 0x4005, 0x00 },
501+ { 0x404e, 0x01 },
502+ { 0x4300, 0xff },
503+ { 0x4301, 0x00 },
504+ { 0x4315, 0x00 },
505+ { 0x4501, 0x48 },
506+ { 0x4600, 0x00 },
507+ { 0x4601, 0x4e },
508+ { 0x4801, 0x0f },
509+ { 0x4806, 0x0f },
510+ { 0x4819, 0xaa },
511+ { 0x4823, 0x3e },
512+ { 0x4837, 0x19 },
513+ { 0x4a0d, 0x00 },
514+ { 0x4a47, 0x7f },
515+ { 0x4a49, 0xf0 },
516+ { 0x4a4b, 0x30 },
517+ { 0x5000, 0x85 },
518+ { 0x5001, 0x80 },
519+};
520+
521+static const s64 link_freq[] = {
522+ 240000000,
523+};
524+
525+static const struct ov7251_mode_info ov7251_mode_info_data[] = {
526+ {
527+ .width = 640,
528+ .height = 480,
529+ .data = ov7251_setting_vga_30fps,
530+ .data_size = ARRAY_SIZE(ov7251_setting_vga_30fps),
531+ .pixel_clock = 48000000,
532+ .link_freq = 0, /* an index in link_freq[] */
533+ .exposure_max = 1704,
534+ .exposure_def = 504,
535+ .timeperframe = {
536+ .numerator = 100,
537+ .denominator = 3000
538+ }
539+ },
540+ {
541+ .width = 640,
542+ .height = 480,
543+ .data = ov7251_setting_vga_60fps,
544+ .data_size = ARRAY_SIZE(ov7251_setting_vga_60fps),
545+ .pixel_clock = 48000000,
546+ .link_freq = 0, /* an index in link_freq[] */
547+ .exposure_max = 840,
548+ .exposure_def = 504,
549+ .timeperframe = {
550+ .numerator = 100,
551+ .denominator = 6014
552+ }
553+ },
554+ {
555+ .width = 640,
556+ .height = 480,
557+ .data = ov7251_setting_vga_90fps,
558+ .data_size = ARRAY_SIZE(ov7251_setting_vga_90fps),
559+ .pixel_clock = 48000000,
560+ .link_freq = 0, /* an index in link_freq[] */
561+ .exposure_max = 552,
562+ .exposure_def = 504,
563+ .timeperframe = {
564+ .numerator = 100,
565+ .denominator = 9043
566+ }
567+ },
568+};
569+
570+static int ov7251_regulators_enable(struct ov7251 *ov7251)
571+{
572+ int ret;
573+
574+ /* OV7251 power up sequence requires core regulator
575+ * to be enabled not earlier than io regulator
576+ */
577+
578+ ret = regulator_enable(ov7251->io_regulator);
579+ if (ret < 0) {
580+ dev_err(ov7251->dev, "set io voltage failed\n");
581+ return ret;
582+ }
583+
584+ ret = regulator_enable(ov7251->analog_regulator);
585+ if (ret) {
586+ dev_err(ov7251->dev, "set analog voltage failed\n");
587+ goto err_disable_io;
588+ }
589+
590+ ret = regulator_enable(ov7251->core_regulator);
591+ if (ret) {
592+ dev_err(ov7251->dev, "set core voltage failed\n");
593+ goto err_disable_analog;
594+ }
595+
596+ return 0;
597+
598+err_disable_analog:
599+ regulator_disable(ov7251->analog_regulator);
600+
601+err_disable_io:
602+ regulator_disable(ov7251->io_regulator);
603+
604+ return ret;
605+}
606+
607+static void ov7251_regulators_disable(struct ov7251 *ov7251)
608+{
609+ int ret;
610+
611+ ret = regulator_disable(ov7251->core_regulator);
612+ if (ret < 0)
613+ dev_err(ov7251->dev, "core regulator disable failed\n");
614+
615+ ret = regulator_disable(ov7251->analog_regulator);
616+ if (ret < 0)
617+ dev_err(ov7251->dev, "analog regulator disable failed\n");
618+
619+ ret = regulator_disable(ov7251->io_regulator);
620+ if (ret < 0)
621+ dev_err(ov7251->dev, "io regulator disable failed\n");
622+}
623+
624+static int ov7251_write_reg(struct ov7251 *ov7251, u16 reg, u8 val)
625+{
626+ u8 regbuf[3];
627+ int ret;
628+
629+ regbuf[0] = reg >> 8;
630+ regbuf[1] = reg & 0xff;
631+ regbuf[2] = val;
632+
633+ ret = i2c_master_send(ov7251->i2c_client, regbuf, 3);
634+ if (ret < 0) {
635+ dev_err(ov7251->dev, "%s: write reg error %d: reg=%x, val=%x\n",
636+ __func__, ret, reg, val);
637+ return ret;
638+ }
639+
640+ return 0;
641+}
642+
643+static int ov7251_write_seq_regs(struct ov7251 *ov7251, u16 reg, u8 *val,
644+ u8 num)
645+{
646+ u8 regbuf[5];
647+ u8 nregbuf = sizeof(reg) + num * sizeof(*val);
648+ int ret = 0;
649+
650+ if (nregbuf > sizeof(regbuf))
651+ return -EINVAL;
652+
653+ regbuf[0] = reg >> 8;
654+ regbuf[1] = reg & 0xff;
655+
656+ memcpy(regbuf + 2, val, num);
657+
658+ ret = i2c_master_send(ov7251->i2c_client, regbuf, nregbuf);
659+ if (ret < 0) {
660+ dev_err(ov7251->dev,
661+ "%s: write seq regs error %d: first reg=%x\n",
662+ __func__, ret, reg);
663+ return ret;
664+ }
665+
666+ return 0;
667+}
668+
669+static int ov7251_read_reg(struct ov7251 *ov7251, u16 reg, u8 *val)
670+{
671+ u8 regbuf[2];
672+ int ret;
673+
674+ regbuf[0] = reg >> 8;
675+ regbuf[1] = reg & 0xff;
676+
677+ ret = i2c_master_send(ov7251->i2c_client, regbuf, 2);
678+ if (ret < 0) {
679+ dev_err(ov7251->dev, "%s: write reg error %d: reg=%x\n",
680+ __func__, ret, reg);
681+ return ret;
682+ }
683+
684+ ret = i2c_master_recv(ov7251->i2c_client, val, 1);
685+ if (ret < 0) {
686+ dev_err(ov7251->dev, "%s: read reg error %d: reg=%x\n",
687+ __func__, ret, reg);
688+ return ret;
689+ }
690+
691+ return 0;
692+}
693+
694+static int ov7251_set_exposure(struct ov7251 *ov7251, s32 exposure)
695+{
696+ u16 reg;
697+ u8 val[3];
698+
699+ reg = OV7251_AEC_EXPO_0;
700+ val[0] = (exposure & 0xf000) >> 12; /* goes to OV7251_AEC_EXPO_0 */
701+ val[1] = (exposure & 0x0ff0) >> 4; /* goes to OV7251_AEC_EXPO_1 */
702+ val[2] = (exposure & 0x000f) << 4; /* goes to OV7251_AEC_EXPO_2 */
703+
704+ return ov7251_write_seq_regs(ov7251, reg, val, 3);
705+}
706+
707+static int ov7251_set_gain(struct ov7251 *ov7251, s32 gain)
708+{
709+ u16 reg;
710+ u8 val[2];
711+
712+ reg = OV7251_AEC_AGC_ADJ_0;
713+ val[0] = (gain & 0x0300) >> 8; /* goes to OV7251_AEC_AGC_ADJ_0 */
714+ val[1] = gain & 0xff; /* goes to OV7251_AEC_AGC_ADJ_1 */
715+
716+ return ov7251_write_seq_regs(ov7251, reg, val, 2);
717+}
718+
719+static int ov7251_set_register_array(struct ov7251 *ov7251,
720+ const struct reg_value *settings,
721+ unsigned int num_settings)
722+{
723+ unsigned int i;
724+ int ret;
725+
726+ for (i = 0; i < num_settings; ++i, ++settings) {
727+ ret = ov7251_write_reg(ov7251, settings->reg, settings->val);
728+ if (ret < 0)
729+ return ret;
730+ }
731+
732+ return 0;
733+}
734+
735+static int ov7251_set_power_on(struct ov7251 *ov7251)
736+{
737+ int ret;
738+ u32 wait_us;
739+
740+ ret = ov7251_regulators_enable(ov7251);
741+ if (ret < 0)
742+ return ret;
743+
744+ ret = clk_prepare_enable(ov7251->xclk);
745+ if (ret < 0) {
746+ dev_err(ov7251->dev, "clk prepare enable failed\n");
747+ ov7251_regulators_disable(ov7251);
748+ return ret;
749+ }
750+
751+ gpiod_set_value_cansleep(ov7251->enable_gpio, 1);
752+
753+ /* wait at least 65536 external clock cycles */
754+ wait_us = DIV_ROUND_UP(65536 * 1000,
755+ DIV_ROUND_UP(ov7251->xclk_freq, 1000));
756+ usleep_range(wait_us, wait_us + 1000);
757+
758+ return 0;
759+}
760+
761+static void ov7251_set_power_off(struct ov7251 *ov7251)
762+{
763+ clk_disable_unprepare(ov7251->xclk);
764+ gpiod_set_value_cansleep(ov7251->enable_gpio, 0);
765+ ov7251_regulators_disable(ov7251);
766+}
767+
768+static int ov7251_s_power(struct v4l2_subdev *sd, int on)
769+{
770+ struct ov7251 *ov7251 = to_ov7251(sd);
771+ int ret = 0;
772+
773+ mutex_lock(&ov7251->lock);
774+
775+ /* If the power state is not modified - no work to do. */
776+ if (ov7251->power_on == !!on)
777+ goto exit;
778+
779+ if (on) {
780+ ret = ov7251_set_power_on(ov7251);
781+ if (ret < 0)
782+ goto exit;
783+
784+ ret = ov7251_set_register_array(ov7251,
785+ ov7251_global_init_setting,
786+ ARRAY_SIZE(ov7251_global_init_setting));
787+ if (ret < 0) {
788+ dev_err(ov7251->dev, "could not set init registers\n");
789+ ov7251_set_power_off(ov7251);
790+ goto exit;
791+ }
792+
793+ ov7251->power_on = true;
794+ } else {
795+ ov7251_set_power_off(ov7251);
796+ ov7251->power_on = false;
797+ }
798+
799+exit:
800+ mutex_unlock(&ov7251->lock);
801+
802+ return ret;
803+}
804+
805+static int ov7251_set_hflip(struct ov7251 *ov7251, s32 value)
806+{
807+ u8 val = ov7251->timing_format2;
808+ int ret;
809+
810+ if (value)
811+ val |= OV7251_TIMING_FORMAT2_MIRROR;
812+ else
813+ val &= ~OV7251_TIMING_FORMAT2_MIRROR;
814+
815+ ret = ov7251_write_reg(ov7251, OV7251_TIMING_FORMAT2, val);
816+ if (!ret)
817+ ov7251->timing_format2 = val;
818+
819+ return ret;
820+}
821+
822+static int ov7251_set_vflip(struct ov7251 *ov7251, s32 value)
823+{
824+ u8 val = ov7251->timing_format1;
825+ int ret;
826+
827+ if (value)
828+ val |= OV7251_TIMING_FORMAT1_VFLIP;
829+ else
830+ val &= ~OV7251_TIMING_FORMAT1_VFLIP;
831+
832+ ret = ov7251_write_reg(ov7251, OV7251_TIMING_FORMAT1, val);
833+ if (!ret)
834+ ov7251->timing_format1 = val;
835+
836+ return ret;
837+}
838+
839+static int ov7251_set_test_pattern(struct ov7251 *ov7251, s32 value)
840+{
841+ u8 val = ov7251->pre_isp_00;
842+ int ret;
843+
844+ if (value)
845+ val |= OV7251_PRE_ISP_00_TEST_PATTERN;
846+ else
847+ val &= ~OV7251_PRE_ISP_00_TEST_PATTERN;
848+
849+ ret = ov7251_write_reg(ov7251, OV7251_PRE_ISP_00, val);
850+ if (!ret)
851+ ov7251->pre_isp_00 = val;
852+
853+ return ret;
854+}
855+
856+static const char * const ov7251_test_pattern_menu[] = {
857+ "Disabled",
858+ "Vertical Pattern Bars",
859+};
860+
861+static int ov7251_s_ctrl(struct v4l2_ctrl *ctrl)
862+{
863+ struct ov7251 *ov7251 = container_of(ctrl->handler,
864+ struct ov7251, ctrls);
865+ int ret;
866+
867+ /* v4l2_ctrl_lock() locks our mutex */
868+
869+ if (!ov7251->power_on)
870+ return 0;
871+
872+ switch (ctrl->id) {
873+ case V4L2_CID_EXPOSURE:
874+ ret = ov7251_set_exposure(ov7251, ctrl->val);
875+ break;
876+ case V4L2_CID_GAIN:
877+ ret = ov7251_set_gain(ov7251, ctrl->val);
878+ break;
879+ case V4L2_CID_TEST_PATTERN:
880+ ret = ov7251_set_test_pattern(ov7251, ctrl->val);
881+ break;
882+ case V4L2_CID_HFLIP:
883+ ret = ov7251_set_hflip(ov7251, ctrl->val);
884+ break;
885+ case V4L2_CID_VFLIP:
886+ ret = ov7251_set_vflip(ov7251, ctrl->val);
887+ break;
888+ default:
889+ ret = -EINVAL;
890+ break;
891+ }
892+
893+ return ret;
894+}
895+
896+static const struct v4l2_ctrl_ops ov7251_ctrl_ops = {
897+ .s_ctrl = ov7251_s_ctrl,
898+};
899+
900+static int ov7251_enum_mbus_code(struct v4l2_subdev *sd,
901+ struct v4l2_subdev_pad_config *cfg,
902+ struct v4l2_subdev_mbus_code_enum *code)
903+{
904+ if (code->index > 0)
905+ return -EINVAL;
906+
907+ code->code = MEDIA_BUS_FMT_Y10_1X10;
908+
909+ return 0;
910+}
911+
912+static int ov7251_enum_frame_size(struct v4l2_subdev *subdev,
913+ struct v4l2_subdev_pad_config *cfg,
914+ struct v4l2_subdev_frame_size_enum *fse)
915+{
916+ if (fse->code != MEDIA_BUS_FMT_Y10_1X10)
917+ return -EINVAL;
918+
919+ if (fse->index >= ARRAY_SIZE(ov7251_mode_info_data))
920+ return -EINVAL;
921+
922+ fse->min_width = ov7251_mode_info_data[fse->index].width;
923+ fse->max_width = ov7251_mode_info_data[fse->index].width;
924+ fse->min_height = ov7251_mode_info_data[fse->index].height;
925+ fse->max_height = ov7251_mode_info_data[fse->index].height;
926+
927+ return 0;
928+}
929+
930+static int ov7251_enum_frame_ival(struct v4l2_subdev *subdev,
931+ struct v4l2_subdev_pad_config *cfg,
932+ struct v4l2_subdev_frame_interval_enum *fie)
933+{
934+ unsigned int index = fie->index;
935+ unsigned int i;
936+
937+ for (i = 0; i < ARRAY_SIZE(ov7251_mode_info_data); i++) {
938+ if (fie->width != ov7251_mode_info_data[i].width ||
939+ fie->height != ov7251_mode_info_data[i].height)
940+ continue;
941+
942+ if (index-- == 0) {
943+ fie->interval = ov7251_mode_info_data[i].timeperframe;
944+ return 0;
945+ }
946+ }
947+
948+ return -EINVAL;
949+}
950+
951+static struct v4l2_mbus_framefmt *
952+__ov7251_get_pad_format(struct ov7251 *ov7251,
953+ struct v4l2_subdev_pad_config *cfg,
954+ unsigned int pad,
955+ enum v4l2_subdev_format_whence which)
956+{
957+ switch (which) {
958+ case V4L2_SUBDEV_FORMAT_TRY:
959+ return v4l2_subdev_get_try_format(&ov7251->sd, cfg, pad);
960+ case V4L2_SUBDEV_FORMAT_ACTIVE:
961+ return &ov7251->fmt;
962+ default:
963+ return NULL;
964+ }
965+}
966+
967+static int ov7251_get_format(struct v4l2_subdev *sd,
968+ struct v4l2_subdev_pad_config *cfg,
969+ struct v4l2_subdev_format *format)
970+{
971+ struct ov7251 *ov7251 = to_ov7251(sd);
972+
973+ mutex_lock(&ov7251->lock);
974+ format->format = *__ov7251_get_pad_format(ov7251, cfg, format->pad,
975+ format->which);
976+ mutex_unlock(&ov7251->lock);
977+
978+ return 0;
979+}
980+
981+static struct v4l2_rect *
982+__ov7251_get_pad_crop(struct ov7251 *ov7251, struct v4l2_subdev_pad_config *cfg,
983+ unsigned int pad, enum v4l2_subdev_format_whence which)
984+{
985+ switch (which) {
986+ case V4L2_SUBDEV_FORMAT_TRY:
987+ return v4l2_subdev_get_try_crop(&ov7251->sd, cfg, pad);
988+ case V4L2_SUBDEV_FORMAT_ACTIVE:
989+ return &ov7251->crop;
990+ default:
991+ return NULL;
992+ }
993+}
994+
995+static inline u32 avg_fps(const struct v4l2_fract *t)
996+{
997+ return (t->denominator + (t->numerator >> 1)) / t->numerator;
998+}
999+
1000+static const struct ov7251_mode_info *
1001+ov7251_find_mode_by_ival(struct ov7251 *ov7251, struct v4l2_fract *timeperframe)
1002+{
1003+ const struct ov7251_mode_info *mode = ov7251->current_mode;
1004+ unsigned int fps_req = avg_fps(timeperframe);
1005+ unsigned int max_dist_match = (unsigned int) -1;
1006+ unsigned int i, n = 0;
1007+
1008+ for (i = 0; i < ARRAY_SIZE(ov7251_mode_info_data); i++) {
1009+ unsigned int dist;
1010+ unsigned int fps_tmp;
1011+
1012+ if (mode->width != ov7251_mode_info_data[i].width ||
1013+ mode->height != ov7251_mode_info_data[i].height)
1014+ continue;
1015+
1016+ fps_tmp = avg_fps(&ov7251_mode_info_data[i].timeperframe);
1017+
1018+ dist = abs(fps_req - fps_tmp);
1019+
1020+ if (dist < max_dist_match) {
1021+ n = i;
1022+ max_dist_match = dist;
1023+ }
1024+ }
1025+
1026+ return &ov7251_mode_info_data[n];
1027+}
1028+
1029+static int ov7251_set_format(struct v4l2_subdev *sd,
1030+ struct v4l2_subdev_pad_config *cfg,
1031+ struct v4l2_subdev_format *format)
1032+{
1033+ struct ov7251 *ov7251 = to_ov7251(sd);
1034+ struct v4l2_mbus_framefmt *__format;
1035+ struct v4l2_rect *__crop;
1036+ const struct ov7251_mode_info *new_mode;
1037+ int ret = 0;
1038+
1039+ mutex_lock(&ov7251->lock);
1040+
1041+ __crop = __ov7251_get_pad_crop(ov7251, cfg, format->pad, format->which);
1042+
1043+ new_mode = v4l2_find_nearest_size(ov7251_mode_info_data,
1044+ ARRAY_SIZE(ov7251_mode_info_data),
1045+ width, height,
1046+ format->format.width, format->format.height);
1047+
1048+ __crop->width = new_mode->width;
1049+ __crop->height = new_mode->height;
1050+
1051+ if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
1052+ ret = __v4l2_ctrl_s_ctrl_int64(ov7251->pixel_clock,
1053+ new_mode->pixel_clock);
1054+ if (ret < 0)
1055+ goto exit;
1056+
1057+ ret = __v4l2_ctrl_s_ctrl(ov7251->link_freq,
1058+ new_mode->link_freq);
1059+ if (ret < 0)
1060+ goto exit;
1061+
1062+ ret = __v4l2_ctrl_modify_range(ov7251->exposure,
1063+ 1, new_mode->exposure_max,
1064+ 1, new_mode->exposure_def);
1065+ if (ret < 0)
1066+ goto exit;
1067+
1068+ ret = __v4l2_ctrl_s_ctrl(ov7251->exposure,
1069+ new_mode->exposure_def);
1070+ if (ret < 0)
1071+ goto exit;
1072+
1073+ ret = __v4l2_ctrl_s_ctrl(ov7251->gain, 16);
1074+ if (ret < 0)
1075+ goto exit;
1076+
1077+ ov7251->current_mode = new_mode;
1078+ }
1079+
1080+ __format = __ov7251_get_pad_format(ov7251, cfg, format->pad,
1081+ format->which);
1082+ __format->width = __crop->width;
1083+ __format->height = __crop->height;
1084+ __format->code = MEDIA_BUS_FMT_Y10_1X10;
1085+ __format->field = V4L2_FIELD_NONE;
1086+ __format->colorspace = V4L2_COLORSPACE_SRGB;
1087+ __format->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(__format->colorspace);
1088+ __format->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true,
1089+ __format->colorspace, __format->ycbcr_enc);
1090+ __format->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(__format->colorspace);
1091+
1092+ format->format = *__format;
1093+
1094+exit:
1095+ mutex_unlock(&ov7251->lock);
1096+
1097+ return ret;
1098+}
1099+
1100+static int ov7251_entity_init_cfg(struct v4l2_subdev *subdev,
1101+ struct v4l2_subdev_pad_config *cfg)
1102+{
1103+ struct v4l2_subdev_format fmt = {
1104+ .which = cfg ? V4L2_SUBDEV_FORMAT_TRY
1105+ : V4L2_SUBDEV_FORMAT_ACTIVE,
1106+ .format = {
1107+ .width = 640,
1108+ .height = 480
1109+ }
1110+ };
1111+
1112+ ov7251_set_format(subdev, cfg, &fmt);
1113+
1114+ return 0;
1115+}
1116+
1117+static int ov7251_get_selection(struct v4l2_subdev *sd,
1118+ struct v4l2_subdev_pad_config *cfg,
1119+ struct v4l2_subdev_selection *sel)
1120+{
1121+ struct ov7251 *ov7251 = to_ov7251(sd);
1122+
1123+ if (sel->target != V4L2_SEL_TGT_CROP)
1124+ return -EINVAL;
1125+
1126+ mutex_lock(&ov7251->lock);
1127+ sel->r = *__ov7251_get_pad_crop(ov7251, cfg, sel->pad,
1128+ sel->which);
1129+ mutex_unlock(&ov7251->lock);
1130+
1131+ return 0;
1132+}
1133+
1134+static int ov7251_s_stream(struct v4l2_subdev *subdev, int enable)
1135+{
1136+ struct ov7251 *ov7251 = to_ov7251(subdev);
1137+ int ret;
1138+
1139+ mutex_lock(&ov7251->lock);
1140+
1141+ if (enable) {
1142+ ret = ov7251_set_register_array(ov7251,
1143+ ov7251->current_mode->data,
1144+ ov7251->current_mode->data_size);
1145+ if (ret < 0) {
1146+ dev_err(ov7251->dev, "could not set mode %dx%d\n",
1147+ ov7251->current_mode->width,
1148+ ov7251->current_mode->height);
1149+ goto exit;
1150+ }
1151+ ret = __v4l2_ctrl_handler_setup(&ov7251->ctrls);
1152+ if (ret < 0) {
1153+ dev_err(ov7251->dev, "could not sync v4l2 controls\n");
1154+ goto exit;
1155+ }
1156+ ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
1157+ OV7251_SC_MODE_SELECT_STREAMING);
1158+ } else {
1159+ ret = ov7251_write_reg(ov7251, OV7251_SC_MODE_SELECT,
1160+ OV7251_SC_MODE_SELECT_SW_STANDBY);
1161+ }
1162+
1163+exit:
1164+ mutex_unlock(&ov7251->lock);
1165+
1166+ return ret;
1167+}
1168+
1169+static int ov7251_get_frame_interval(struct v4l2_subdev *subdev,
1170+ struct v4l2_subdev_frame_interval *fi)
1171+{
1172+ struct ov7251 *ov7251 = to_ov7251(subdev);
1173+
1174+ mutex_lock(&ov7251->lock);
1175+ fi->interval = ov7251->current_mode->timeperframe;
1176+ mutex_unlock(&ov7251->lock);
1177+
1178+ return 0;
1179+}
1180+
1181+static int ov7251_set_frame_interval(struct v4l2_subdev *subdev,
1182+ struct v4l2_subdev_frame_interval *fi)
1183+{
1184+ struct ov7251 *ov7251 = to_ov7251(subdev);
1185+ const struct ov7251_mode_info *new_mode;
1186+ int ret = 0;
1187+
1188+ mutex_lock(&ov7251->lock);
1189+ new_mode = ov7251_find_mode_by_ival(ov7251, &fi->interval);
1190+
1191+ if (new_mode != ov7251->current_mode) {
1192+ ret = __v4l2_ctrl_s_ctrl_int64(ov7251->pixel_clock,
1193+ new_mode->pixel_clock);
1194+ if (ret < 0)
1195+ goto exit;
1196+
1197+ ret = __v4l2_ctrl_s_ctrl(ov7251->link_freq,
1198+ new_mode->link_freq);
1199+ if (ret < 0)
1200+ goto exit;
1201+
1202+ ret = __v4l2_ctrl_modify_range(ov7251->exposure,
1203+ 1, new_mode->exposure_max,
1204+ 1, new_mode->exposure_def);
1205+ if (ret < 0)
1206+ goto exit;
1207+
1208+ ret = __v4l2_ctrl_s_ctrl(ov7251->exposure,
1209+ new_mode->exposure_def);
1210+ if (ret < 0)
1211+ goto exit;
1212+
1213+ ret = __v4l2_ctrl_s_ctrl(ov7251->gain, 16);
1214+ if (ret < 0)
1215+ goto exit;
1216+
1217+ ov7251->current_mode = new_mode;
1218+ }
1219+
1220+ fi->interval = ov7251->current_mode->timeperframe;
1221+
1222+exit:
1223+ mutex_unlock(&ov7251->lock);
1224+
1225+ return ret;
1226+}
1227+
1228+static const struct v4l2_subdev_core_ops ov7251_core_ops = {
1229+ .s_power = ov7251_s_power,
1230+};
1231+
1232+static const struct v4l2_subdev_video_ops ov7251_video_ops = {
1233+ .s_stream = ov7251_s_stream,
1234+ .g_frame_interval = ov7251_get_frame_interval,
1235+ .s_frame_interval = ov7251_set_frame_interval,
1236+};
1237+
1238+static const struct v4l2_subdev_pad_ops ov7251_subdev_pad_ops = {
1239+ .init_cfg = ov7251_entity_init_cfg,
1240+ .enum_mbus_code = ov7251_enum_mbus_code,
1241+ .enum_frame_size = ov7251_enum_frame_size,
1242+ .enum_frame_interval = ov7251_enum_frame_ival,
1243+ .get_fmt = ov7251_get_format,
1244+ .set_fmt = ov7251_set_format,
1245+ .get_selection = ov7251_get_selection,
1246+};
1247+
1248+static const struct v4l2_subdev_ops ov7251_subdev_ops = {
1249+ .core = &ov7251_core_ops,
1250+ .video = &ov7251_video_ops,
1251+ .pad = &ov7251_subdev_pad_ops,
1252+};
1253+
1254+static int ov7251_probe(struct i2c_client *client)
1255+{
1256+ struct device *dev = &client->dev;
1257+ struct fwnode_handle *endpoint;
1258+ struct ov7251 *ov7251;
1259+ u8 chip_id_high, chip_id_low, chip_rev;
1260+ int ret;
1261+
1262+ ov7251 = devm_kzalloc(dev, sizeof(struct ov7251), GFP_KERNEL);
1263+ if (!ov7251)
1264+ return -ENOMEM;
1265+
1266+ ov7251->i2c_client = client;
1267+ ov7251->dev = dev;
1268+
1269+ endpoint = fwnode_graph_get_next_endpoint(dev_fwnode(dev), NULL);
1270+ if (!endpoint) {
1271+ dev_err(dev, "endpoint node not found\n");
1272+ return -EINVAL;
1273+ }
1274+
1275+ ret = v4l2_fwnode_endpoint_parse(endpoint, &ov7251->ep);
1276+ fwnode_handle_put(endpoint);
1277+ if (ret < 0) {
1278+ dev_err(dev, "parsing endpoint node failed\n");
1279+ return ret;
1280+ }
1281+
1282+ if (ov7251->ep.bus_type != V4L2_MBUS_CSI2) {
1283+ dev_err(dev, "invalid bus type (%u), must be CSI2 (%u)\n",
1284+ ov7251->ep.bus_type, V4L2_MBUS_CSI2);
1285+ return -EINVAL;
1286+ }
1287+
1288+ /* get system clock (xclk) */
1289+ ov7251->xclk = devm_clk_get(dev, "xclk");
1290+ if (IS_ERR(ov7251->xclk)) {
1291+ dev_err(dev, "could not get xclk");
1292+ return PTR_ERR(ov7251->xclk);
1293+ }
1294+
1295+ ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",
1296+ &ov7251->xclk_freq);
1297+ if (ret) {
1298+ dev_err(dev, "could not get xclk frequency\n");
1299+ return ret;
1300+ }
1301+
1302+ /* external clock must be 24MHz, allow 1% tolerance */
1303+ if (ov7251->xclk_freq < 23760000 || ov7251->xclk_freq > 24240000) {
1304+ dev_err(dev, "external clock frequency %u is not supported\n",
1305+ ov7251->xclk_freq);
1306+ return -EINVAL;
1307+ }
1308+
1309+ ret = clk_set_rate(ov7251->xclk, ov7251->xclk_freq);
1310+ if (ret) {
1311+ dev_err(dev, "could not set xclk frequency\n");
1312+ return ret;
1313+ }
1314+
1315+ ov7251->io_regulator = devm_regulator_get(dev, "vdddo");
1316+ if (IS_ERR(ov7251->io_regulator)) {
1317+ dev_err(dev, "cannot get io regulator\n");
1318+ return PTR_ERR(ov7251->io_regulator);
1319+ }
1320+
1321+ ov7251->core_regulator = devm_regulator_get(dev, "vddd");
1322+ if (IS_ERR(ov7251->core_regulator)) {
1323+ dev_err(dev, "cannot get core regulator\n");
1324+ return PTR_ERR(ov7251->core_regulator);
1325+ }
1326+
1327+ ov7251->analog_regulator = devm_regulator_get(dev, "vdda");
1328+ if (IS_ERR(ov7251->analog_regulator)) {
1329+ dev_err(dev, "cannot get analog regulator\n");
1330+ return PTR_ERR(ov7251->analog_regulator);
1331+ }
1332+
1333+ ov7251->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
1334+ if (IS_ERR(ov7251->enable_gpio)) {
1335+ dev_err(dev, "cannot get enable gpio\n");
1336+ return PTR_ERR(ov7251->enable_gpio);
1337+ }
1338+
1339+ mutex_init(&ov7251->lock);
1340+
1341+ v4l2_ctrl_handler_init(&ov7251->ctrls, 7);
1342+ ov7251->ctrls.lock = &ov7251->lock;
1343+
1344+ v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
1345+ V4L2_CID_HFLIP, 0, 1, 1, 0);
1346+ v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
1347+ V4L2_CID_VFLIP, 0, 1, 1, 0);
1348+ ov7251->exposure = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
1349+ V4L2_CID_EXPOSURE, 1, 32, 1, 32);
1350+ ov7251->gain = v4l2_ctrl_new_std(&ov7251->ctrls, &ov7251_ctrl_ops,
1351+ V4L2_CID_GAIN, 16, 1023, 1, 16);
1352+ v4l2_ctrl_new_std_menu_items(&ov7251->ctrls, &ov7251_ctrl_ops,
1353+ V4L2_CID_TEST_PATTERN,
1354+ ARRAY_SIZE(ov7251_test_pattern_menu) - 1,
1355+ 0, 0, ov7251_test_pattern_menu);
1356+ ov7251->pixel_clock = v4l2_ctrl_new_std(&ov7251->ctrls,
1357+ &ov7251_ctrl_ops,
1358+ V4L2_CID_PIXEL_RATE,
1359+ 1, INT_MAX, 1, 1);
1360+ ov7251->link_freq = v4l2_ctrl_new_int_menu(&ov7251->ctrls,
1361+ &ov7251_ctrl_ops,
1362+ V4L2_CID_LINK_FREQ,
1363+ ARRAY_SIZE(link_freq) - 1,
1364+ 0, link_freq);
1365+ if (ov7251->link_freq)
1366+ ov7251->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1367+
1368+ ov7251->sd.ctrl_handler = &ov7251->ctrls;
1369+
1370+ if (ov7251->ctrls.error) {
1371+ dev_err(dev, "%s: control initialization error %d\n",
1372+ __func__, ov7251->ctrls.error);
1373+ ret = ov7251->ctrls.error;
1374+ goto free_ctrl;
1375+ }
1376+
1377+ v4l2_i2c_subdev_init(&ov7251->sd, client, &ov7251_subdev_ops);
1378+ ov7251->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1379+ ov7251->pad.flags = MEDIA_PAD_FL_SOURCE;
1380+ ov7251->sd.dev = &client->dev;
1381+ ov7251->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
1382+
1383+ ret = media_entity_pads_init(&ov7251->sd.entity, 1, &ov7251->pad);
1384+ if (ret < 0) {
1385+ dev_err(dev, "could not register media entity\n");
1386+ goto free_ctrl;
1387+ }
1388+
1389+ ret = ov7251_s_power(&ov7251->sd, true);
1390+ if (ret < 0) {
1391+ dev_err(dev, "could not power up OV7251\n");
1392+ goto free_entity;
1393+ }
1394+
1395+ ret = ov7251_read_reg(ov7251, OV7251_CHIP_ID_HIGH, &chip_id_high);
1396+ if (ret < 0 || chip_id_high != OV7251_CHIP_ID_HIGH_BYTE) {
1397+ dev_err(dev, "could not read ID high\n");
1398+ ret = -ENODEV;
1399+ goto power_down;
1400+ }
1401+ ret = ov7251_read_reg(ov7251, OV7251_CHIP_ID_LOW, &chip_id_low);
1402+ if (ret < 0 || chip_id_low != OV7251_CHIP_ID_LOW_BYTE) {
1403+ dev_err(dev, "could not read ID low\n");
1404+ ret = -ENODEV;
1405+ goto power_down;
1406+ }
1407+
1408+ ret = ov7251_read_reg(ov7251, OV7251_SC_GP_IO_IN1, &chip_rev);
1409+ if (ret < 0) {
1410+ dev_err(dev, "could not read revision\n");
1411+ ret = -ENODEV;
1412+ goto power_down;
1413+ }
1414+ chip_rev >>= 4;
1415+
1416+ dev_info(dev, "OV7251 revision %x (%s) detected at address 0x%02x\n",
1417+ chip_rev,
1418+ chip_rev == 0x4 ? "1A / 1B" :
1419+ chip_rev == 0x5 ? "1C / 1D" :
1420+ chip_rev == 0x6 ? "1E" :
1421+ chip_rev == 0x7 ? "1F" : "unknown",
1422+ client->addr);
1423+
1424+ ret = ov7251_read_reg(ov7251, OV7251_PRE_ISP_00,
1425+ &ov7251->pre_isp_00);
1426+ if (ret < 0) {
1427+ dev_err(dev, "could not read test pattern value\n");
1428+ ret = -ENODEV;
1429+ goto power_down;
1430+ }
1431+
1432+ ret = ov7251_read_reg(ov7251, OV7251_TIMING_FORMAT1,
1433+ &ov7251->timing_format1);
1434+ if (ret < 0) {
1435+ dev_err(dev, "could not read vflip value\n");
1436+ ret = -ENODEV;
1437+ goto power_down;
1438+ }
1439+
1440+ ret = ov7251_read_reg(ov7251, OV7251_TIMING_FORMAT2,
1441+ &ov7251->timing_format2);
1442+ if (ret < 0) {
1443+ dev_err(dev, "could not read hflip value\n");
1444+ ret = -ENODEV;
1445+ goto power_down;
1446+ }
1447+
1448+ ov7251_s_power(&ov7251->sd, false);
1449+
1450+ ret = v4l2_async_register_subdev(&ov7251->sd);
1451+ if (ret < 0) {
1452+ dev_err(dev, "could not register v4l2 device\n");
1453+ goto free_entity;
1454+ }
1455+
1456+ ov7251_entity_init_cfg(&ov7251->sd, NULL);
1457+
1458+ return 0;
1459+
1460+power_down:
1461+ ov7251_s_power(&ov7251->sd, false);
1462+free_entity:
1463+ media_entity_cleanup(&ov7251->sd.entity);
1464+free_ctrl:
1465+ v4l2_ctrl_handler_free(&ov7251->ctrls);
1466+ mutex_destroy(&ov7251->lock);
1467+
1468+ return ret;
1469+}
1470+
1471+static int ov7251_remove(struct i2c_client *client)
1472+{
1473+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
1474+ struct ov7251 *ov7251 = to_ov7251(sd);
1475+
1476+ v4l2_async_unregister_subdev(&ov7251->sd);
1477+ media_entity_cleanup(&ov7251->sd.entity);
1478+ v4l2_ctrl_handler_free(&ov7251->ctrls);
1479+ mutex_destroy(&ov7251->lock);
1480+
1481+ return 0;
1482+}
1483+
1484+static const struct of_device_id ov7251_of_match[] = {
1485+ { .compatible = "ovti,ov7251" },
1486+ { /* sentinel */ }
1487+};
1488+MODULE_DEVICE_TABLE(of, ov7251_of_match);
1489+
1490+static struct i2c_driver ov7251_i2c_driver = {
1491+ .driver = {
1492+ .of_match_table = ov7251_of_match,
1493+ .name = "ov7251",
1494+ },
1495+ .probe_new = ov7251_probe,
1496+ .remove = ov7251_remove,
1497+};
1498+
1499+module_i2c_driver(ov7251_i2c_driver);
1500+
1501+MODULE_DESCRIPTION("Omnivision OV7251 Camera Driver");
1502+MODULE_AUTHOR("Todor Tomov <todor.tomov@linaro.org>");
1503+MODULE_LICENSE("GPL v2");
drivers/media/i2c/ov772x.c+1−1
@@ -1035,7 +1035,7 @@ static int ov772x_set_params(struct ov772x_priv *priv, · 1034 unmodified lines
10351035
10361036 /* Set COM8. */
10371037 if (priv->band_filter) {
1038− ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, 1);
1038+ ret = ov772x_mask_set(client, COM8, BNDF_ON_OFF, BNDF_ON_OFF);
10391039 if (!ret)
10401040 ret = ov772x_mask_set(client, BDBASE,
10411041 0xff, 256 - priv->band_filter);
drivers/media/i2c/ov7740.c+17−5
@@ -953,7 +953,7 @@ static int ov7740_init_controls(struct ov7740 *ov7740) · 952 unmodified lines
953953 struct v4l2_ctrl_handler *ctrl_hdlr = &ov7740->ctrl_handler;
954954 int ret;
955955
956− ret = v4l2_ctrl_handler_init(ctrl_hdlr, 2);
956+ ret = v4l2_ctrl_handler_init(ctrl_hdlr, 12);
957957 if (ret < 0)
958958 return ret;
959959
@@ -980,27 +980,39 @@ static int ov7740_init_controls(struct ov7740 *ov7740) · 20 unmodified lines
980980 V4L2_CID_HFLIP, 0, 1, 1, 0);
981981 ov7740->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov7740_ctrl_ops,
982982 V4L2_CID_VFLIP, 0, 1, 1, 0);
983+
983984 ov7740->gain = v4l2_ctrl_new_std(ctrl_hdlr, &ov7740_ctrl_ops,
984985 V4L2_CID_GAIN, 0, 1023, 1, 500);
986+ if (ov7740->gain)
987+ ov7740->gain->flags |= V4L2_CTRL_FLAG_VOLATILE;
988+
985989 ov7740->auto_gain = v4l2_ctrl_new_std(ctrl_hdlr, &ov7740_ctrl_ops,
986990 V4L2_CID_AUTOGAIN, 0, 1, 1, 1);
991+
987992 ov7740->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &ov7740_ctrl_ops,
988993 V4L2_CID_EXPOSURE, 0, 65535, 1, 500);
994+ if (ov7740->exposure)
995+ ov7740->exposure->flags |= V4L2_CTRL_FLAG_VOLATILE;
996+
989997 ov7740->auto_exposure = v4l2_ctrl_new_std_menu(ctrl_hdlr,
990998 &ov7740_ctrl_ops,
991999 V4L2_CID_EXPOSURE_AUTO,
9921000 V4L2_EXPOSURE_MANUAL, 0,
9931001 V4L2_EXPOSURE_AUTO);
9941002
995− ov7740->gain->flags |= V4L2_CTRL_FLAG_VOLATILE;
996− ov7740->exposure->flags |= V4L2_CTRL_FLAG_VOLATILE;
997−
9981003 v4l2_ctrl_auto_cluster(3, &ov7740->auto_wb, 0, false);
9991004 v4l2_ctrl_auto_cluster(2, &ov7740->auto_gain, 0, true);
10001005 v4l2_ctrl_auto_cluster(2, &ov7740->auto_exposure,
10011006 V4L2_EXPOSURE_MANUAL, false);
10021007 v4l2_ctrl_cluster(2, &ov7740->hflip);
10031008
1009+ if (ctrl_hdlr->error) {
1010+ ret = ctrl_hdlr->error;
1011+ dev_err(&client->dev, "controls initialisation failed (%d)\n",
1012+ ret);
1013+ goto error;
1014+ }
1015+
10041016 ret = v4l2_ctrl_handler_setup(ctrl_hdlr);
10051017 if (ret) {
10061018 dev_err(&client->dev, "%s control init failed (%d)\n",
@@ -1074,7 +1086,7 @@ static int ov7740_probe(struct i2c_client *client, · 67 unmodified lines
10741086
10751087 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
10761088 sd->internal_ops = &ov7740_subdev_internal_ops;
1077− sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1089+ sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
10781090 #endif
10791091
10801092 #if defined(CONFIG_MEDIA_CONTROLLER)
drivers/media/i2c/smiapp/smiapp-core.c+5−6
@@ -1001,7 +1001,7 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor, · 1000 unmodified lines
10011001 if (rval)
10021002 goto out;
10031003
1004− for (i = 0; i < 1000; i++) {
1004+ for (i = 1000; i > 0; i--) {
10051005 rval = smiapp_read(
10061006 sensor,
10071007 SMIAPP_REG_U8_DATA_TRANSFER_IF_1_STATUS, &s);
@@ -1012,11 +1012,10 @@ static int smiapp_read_nvm(struct smiapp_sensor *sensor, · 4 unmodified lines
10121012 if (s & SMIAPP_DATA_TRANSFER_IF_1_STATUS_RD_READY)
10131013 break;
10141014
1015− if (--i == 0) {
1016− rval = -ETIMEDOUT;
1017− goto out;
1018− }
1019−
1015+ }
1016+ if (!i) {
1017+ rval = -ETIMEDOUT;
1018+ goto out;
10201019 }
10211020
10221021 for (i = 0; i < SMIAPP_NVM_PAGE_SIZE; i++) {
drivers/media/i2c/tda1997x.c+2−2
@@ -2569,7 +2569,7 @@ static int tda1997x_probe(struct i2c_client *client, · 2568 unmodified lines
25692569 snprintf(sd->name, sizeof(sd->name), "%s %d-%04x",
25702570 id->name, i2c_adapter_id(client->adapter),
25712571 client->addr);
2572− sd->flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
2572+ sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
25732573 sd->entity.function = MEDIA_ENT_F_DTV_DECODER;
25742574 sd->entity.ops = &tda1997x_media_ops;
25752575
@@ -2723,7 +2723,7 @@ static int tda1997x_probe(struct i2c_client *client, · 147 unmodified lines
27232723 state->pads);
27242724 if (ret) {
27252725 v4l_err(client, "failed entity_init: %d", ret);
2726− goto err_free_mutex;
2726+ goto err_free_handler;
27272727 }
27282728
27292729 ret = v4l2_async_register_subdev(sd);
drivers/media/i2c/tvp5150.c+82−77
@@ -319,136 +319,136 @@ struct i2c_reg_value { · 318 unmodified lines
319319 /* Default values as sugested at TVP5150AM1 datasheet */
320320 static const struct i2c_reg_value tvp5150_init_default[] = {
321321 { /* 0x00 */
322− TVP5150_VD_IN_SRC_SEL_1,0x00
322+ TVP5150_VD_IN_SRC_SEL_1, 0x00
323323 },
324324 { /* 0x01 */
325− TVP5150_ANAL_CHL_CTL,0x15
325+ TVP5150_ANAL_CHL_CTL, 0x15
326326 },
327327 { /* 0x02 */
328− TVP5150_OP_MODE_CTL,0x00
328+ TVP5150_OP_MODE_CTL, 0x00
329329 },
330330 { /* 0x03 */
331− TVP5150_MISC_CTL,0x01
331+ TVP5150_MISC_CTL, 0x01
332332 },
333333 { /* 0x06 */
334− TVP5150_COLOR_KIL_THSH_CTL,0x10
334+ TVP5150_COLOR_KIL_THSH_CTL, 0x10
335335 },
336336 { /* 0x07 */
337− TVP5150_LUMA_PROC_CTL_1,0x60
337+ TVP5150_LUMA_PROC_CTL_1, 0x60
338338 },
339339 { /* 0x08 */
340− TVP5150_LUMA_PROC_CTL_2,0x00
340+ TVP5150_LUMA_PROC_CTL_2, 0x00
341341 },
342342 { /* 0x09 */
343− TVP5150_BRIGHT_CTL,0x80
343+ TVP5150_BRIGHT_CTL, 0x80
344344 },
345345 { /* 0x0a */
346− TVP5150_SATURATION_CTL,0x80
346+ TVP5150_SATURATION_CTL, 0x80
347347 },
348348 { /* 0x0b */
349− TVP5150_HUE_CTL,0x00
349+ TVP5150_HUE_CTL, 0x00
350350 },
351351 { /* 0x0c */
352− TVP5150_CONTRAST_CTL,0x80
352+ TVP5150_CONTRAST_CTL, 0x80
353353 },
354354 { /* 0x0d */
355− TVP5150_DATA_RATE_SEL,0x47
355+ TVP5150_DATA_RATE_SEL, 0x47
356356 },
357357 { /* 0x0e */
358− TVP5150_LUMA_PROC_CTL_3,0x00
358+ TVP5150_LUMA_PROC_CTL_3, 0x00
359359 },
360360 { /* 0x0f */
361− TVP5150_CONF_SHARED_PIN,0x08
361+ TVP5150_CONF_SHARED_PIN, 0x08
362362 },
363363 { /* 0x11 */
364− TVP5150_ACT_VD_CROP_ST_MSB,0x00
364+ TVP5150_ACT_VD_CROP_ST_MSB, 0x00
365365 },
366366 { /* 0x12 */
367− TVP5150_ACT_VD_CROP_ST_LSB,0x00
367+ TVP5150_ACT_VD_CROP_ST_LSB, 0x00
368368 },
369369 { /* 0x13 */
370− TVP5150_ACT_VD_CROP_STP_MSB,0x00
370+ TVP5150_ACT_VD_CROP_STP_MSB, 0x00
371371 },
372372 { /* 0x14 */
373− TVP5150_ACT_VD_CROP_STP_LSB,0x00
373+ TVP5150_ACT_VD_CROP_STP_LSB, 0x00
374374 },
375375 { /* 0x15 */
376− TVP5150_GENLOCK,0x01
376+ TVP5150_GENLOCK, 0x01
377377 },
378378 { /* 0x16 */
379− TVP5150_HORIZ_SYNC_START,0x80
379+ TVP5150_HORIZ_SYNC_START, 0x80
380380 },
381381 { /* 0x18 */
382− TVP5150_VERT_BLANKING_START,0x00
382+ TVP5150_VERT_BLANKING_START, 0x00
383383 },
384384 { /* 0x19 */
385− TVP5150_VERT_BLANKING_STOP,0x00
385+ TVP5150_VERT_BLANKING_STOP, 0x00
386386 },
387387 { /* 0x1a */
388− TVP5150_CHROMA_PROC_CTL_1,0x0c
388+ TVP5150_CHROMA_PROC_CTL_1, 0x0c
389389 },
390390 { /* 0x1b */
391− TVP5150_CHROMA_PROC_CTL_2,0x14
391+ TVP5150_CHROMA_PROC_CTL_2, 0x14
392392 },
393393 { /* 0x1c */
394− TVP5150_INT_RESET_REG_B,0x00
394+ TVP5150_INT_RESET_REG_B, 0x00
395395 },
396396 { /* 0x1d */
397− TVP5150_INT_ENABLE_REG_B,0x00
397+ TVP5150_INT_ENABLE_REG_B, 0x00
398398 },
399399 { /* 0x1e */
400− TVP5150_INTT_CONFIG_REG_B,0x00
400+ TVP5150_INTT_CONFIG_REG_B, 0x00
401401 },
402402 { /* 0x28 */
403− TVP5150_VIDEO_STD,0x00
403+ TVP5150_VIDEO_STD, 0x00
404404 },
405405 { /* 0x2e */
406− TVP5150_MACROVISION_ON_CTR,0x0f
406+ TVP5150_MACROVISION_ON_CTR, 0x0f
407407 },
408408 { /* 0x2f */
409− TVP5150_MACROVISION_OFF_CTR,0x01
409+ TVP5150_MACROVISION_OFF_CTR, 0x01
410410 },
411411 { /* 0xbb */
412− TVP5150_TELETEXT_FIL_ENA,0x00
412+ TVP5150_TELETEXT_FIL_ENA, 0x00
413413 },
414414 { /* 0xc0 */
415− TVP5150_INT_STATUS_REG_A,0x00
415+ TVP5150_INT_STATUS_REG_A, 0x00
416416 },
417417 { /* 0xc1 */
418− TVP5150_INT_ENABLE_REG_A,0x00
418+ TVP5150_INT_ENABLE_REG_A, 0x00
419419 },
420420 { /* 0xc2 */
421− TVP5150_INT_CONF,0x04
421+ TVP5150_INT_CONF, 0x04
422422 },
423423 { /* 0xc8 */
424− TVP5150_FIFO_INT_THRESHOLD,0x80
424+ TVP5150_FIFO_INT_THRESHOLD, 0x80
425425 },
426426 { /* 0xc9 */
427− TVP5150_FIFO_RESET,0x00
427+ TVP5150_FIFO_RESET, 0x00
428428 },
429429 { /* 0xca */
430− TVP5150_LINE_NUMBER_INT,0x00
430+ TVP5150_LINE_NUMBER_INT, 0x00
431431 },
432432 { /* 0xcb */
433− TVP5150_PIX_ALIGN_REG_LOW,0x4e
433+ TVP5150_PIX_ALIGN_REG_LOW, 0x4e
434434 },
435435 { /* 0xcc */
436− TVP5150_PIX_ALIGN_REG_HIGH,0x00
436+ TVP5150_PIX_ALIGN_REG_HIGH, 0x00
437437 },
438438 { /* 0xcd */
439− TVP5150_FIFO_OUT_CTRL,0x01
439+ TVP5150_FIFO_OUT_CTRL, 0x01
440440 },
441441 { /* 0xcf */
442− TVP5150_FULL_FIELD_ENA,0x00
442+ TVP5150_FULL_FIELD_ENA, 0x00
443443 },
444444 { /* 0xd0 */
445− TVP5150_LINE_MODE_INI,0x00
445+ TVP5150_LINE_MODE_INI, 0x00
446446 },
447447 { /* 0xfc */
448− TVP5150_FULL_FIELD_MODE_REG,0x7f
448+ TVP5150_FULL_FIELD_MODE_REG, 0x7f
449449 },
450450 { /* end of data */
451− 0xff,0xff
451+ 0xff, 0xff
452452 }
453453 };
454454
@@ -456,27 +456,27 @@ static const struct i2c_reg_value tvp5150_init_default[] = { · 1 unmodified line
456456 static const struct i2c_reg_value tvp5150_init_enable[] = {
457457 {
458458 TVP5150_CONF_SHARED_PIN, 2
459− },{ /* Automatic offset and AGC enabled */
459+ }, { /* Automatic offset and AGC enabled */
460460 TVP5150_ANAL_CHL_CTL, 0x15
461− },{ /* Activate YCrCb output 0x9 or 0xd ? */
461+ }, { /* Activate YCrCb output 0x9 or 0xd ? */
462462 TVP5150_MISC_CTL, TVP5150_MISC_CTL_GPCL |
463463 TVP5150_MISC_CTL_INTREQ_OE |
464464 TVP5150_MISC_CTL_YCBCR_OE |
465465 TVP5150_MISC_CTL_SYNC_OE |
466466 TVP5150_MISC_CTL_VBLANK |
467467 TVP5150_MISC_CTL_CLOCK_OE,
468− },{ /* Activates video std autodetection for all standards */
468+ }, { /* Activates video std autodetection for all standards */
469469 TVP5150_AUTOSW_MSK, 0x0
470− },{ /* Default format: 0x47. For 4:2:2: 0x40 */
470+ }, { /* Default format: 0x47. For 4:2:2: 0x40 */
471471 TVP5150_DATA_RATE_SEL, 0x47
472− },{
472+ }, {
473473 TVP5150_CHROMA_PROC_CTL_1, 0x0c
474− },{
474+ }, {
475475 TVP5150_CHROMA_PROC_CTL_2, 0x54
476− },{ /* Non documented, but initialized on WinTV USB2 */
476+ }, { /* Non documented, but initialized on WinTV USB2 */
477477 0x27, 0x20
478− },{
479− 0xff,0xff
478+ }, {
479+ 0xff, 0xff
480480 }
481481 };
482482
@@ -500,78 +500,80 @@ struct i2c_vbi_ram_value { · 17 unmodified lines
500500 * and so on. There are 16 possible locations from 0 to 15.
501501 */
502502
503−static struct i2c_vbi_ram_value vbi_ram_default[] =
504−{
505− /* FIXME: Current api doesn't handle all VBI types, those not
506− yet supported are placed under #if 0 */
503+static struct i2c_vbi_ram_value vbi_ram_default[] = {
504+
505+ /*
506+ * FIXME: Current api doesn't handle all VBI types, those not
507+ * yet supported are placed under #if 0
508+ */
507509 #if 0
508510 [0] = {0x010, /* Teletext, SECAM, WST System A */
509− {V4L2_SLICED_TELETEXT_SECAM,6,23,1},
511+ {V4L2_SLICED_TELETEXT_SECAM, 6, 23, 1},
510512 { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26,
511513 0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 }
512514 },
513515 #endif
514516 [1] = {0x030, /* Teletext, PAL, WST System B */
515− {V4L2_SLICED_TELETEXT_B,6,22,1},
517+ {V4L2_SLICED_TELETEXT_B, 6, 22, 1},
516518 { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b,
517519 0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 }
518520 },
519521 #if 0
520522 [2] = {0x050, /* Teletext, PAL, WST System C */
521− {V4L2_SLICED_TELETEXT_PAL_C,6,22,1},
523+ {V4L2_SLICED_TELETEXT_PAL_C, 6, 22, 1},
522524 { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
523525 0xa6, 0x98, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
524526 },
525527 [3] = {0x070, /* Teletext, NTSC, WST System B */
526− {V4L2_SLICED_TELETEXT_NTSC_B,10,21,1},
528+ {V4L2_SLICED_TELETEXT_NTSC_B, 10, 21, 1},
527529 { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x23,
528530 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
529531 },
530532 [4] = {0x090, /* Tetetext, NTSC NABTS System C */
531− {V4L2_SLICED_TELETEXT_NTSC_C,10,21,1},
533+ {V4L2_SLICED_TELETEXT_NTSC_C, 10, 21, 1},
532534 { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22,
533535 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x15, 0x00 }
534536 },
535537 [5] = {0x0b0, /* Teletext, NTSC-J, NABTS System D */
536− {V4L2_SLICED_TELETEXT_NTSC_D,10,21,1},
538+ {V4L2_SLICED_TELETEXT_NTSC_D, 10, 21, 1},
537539 { 0xaa, 0xaa, 0xff, 0xff, 0xa7, 0x2e, 0x20, 0x23,
538540 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 }
539541 },
540542 [6] = {0x0d0, /* Closed Caption, PAL/SECAM */
541− {V4L2_SLICED_CAPTION_625,22,22,1},
543+ {V4L2_SLICED_CAPTION_625, 22, 22, 1},
542544 { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
543545 0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
544546 },
545547 #endif
546548 [7] = {0x0f0, /* Closed Caption, NTSC */
547− {V4L2_SLICED_CAPTION_525,21,21,1},
549+ {V4L2_SLICED_CAPTION_525, 21, 21, 1},
548550 { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02,
549551 0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 }
550552 },
551553 [8] = {0x110, /* Wide Screen Signal, PAL/SECAM */
552− {V4L2_SLICED_WSS_625,23,23,1},
554+ {V4L2_SLICED_WSS_625, 23, 23, 1},
553555 { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42,
554556 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 }
555557 },
556558 #if 0
557559 [9] = {0x130, /* Wide Screen Signal, NTSC C */
558− {V4L2_SLICED_WSS_525,20,20,1},
560+ {V4L2_SLICED_WSS_525, 20, 20, 1},
559561 { 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43,
560562 0x69, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00 }
561563 },
562564 [10] = {0x150, /* Vertical Interval Timecode (VITC), PAL/SECAM */
563− {V4l2_SLICED_VITC_625,6,22,0},
565+ {V4l2_SLICED_VITC_625, 6, 22, 0},
564566 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
565567 0xa6, 0x85, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
566568 },
567569 [11] = {0x170, /* Vertical Interval Timecode (VITC), NTSC */
568− {V4l2_SLICED_VITC_525,10,20,0},
570+ {V4l2_SLICED_VITC_525, 10, 20, 0},
569571 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49,
570572 0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 }
571573 },
572574 #endif
573575 [12] = {0x190, /* Video Program System (VPS), PAL */
574− {V4L2_SLICED_VPS,16,16,0},
576+ {V4L2_SLICED_VPS, 16, 16, 0},
575577 { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d,
576578 0xa6, 0xda, 0x0b, 0x00, 0x00, 0x00, 0x60, 0x00 }
577579 },
@@ -623,7 +625,7 @@ static int tvp5150_g_sliced_vbi_cap(struct v4l2_subdev *sd, · 45 unmodified lines
623625 int line, i;
624626
625627 dev_dbg_lvl(sd->dev, 1, debug, "g_sliced_vbi_cap\n");
626− memset(cap, 0, sizeof *cap);
628+ memset(cap, 0, sizeof(*cap));
627629
628630 for (i = 0; i < ARRAY_SIZE(vbi_ram_default); i++) {
629631 const struct i2c_vbi_ram_value *regs = &vbi_ram_default[i];
@@ -655,7 +657,7 @@ static int tvp5150_g_sliced_vbi_cap(struct v4l2_subdev *sd, · 25 unmodified lines
655657 * MSB = field2
656658 */
657659 static int tvp5150_set_vbi(struct v4l2_subdev *sd,
658− unsigned int type,u8 flags, int line,
660+ unsigned int type, u8 flags, int line,
659661 const int fields)
660662 {
661663 struct tvp5150 *decoder = to_tvp5150(sd);
@@ -1101,11 +1103,14 @@ static int tvp5150_s_routing(struct v4l2_subdev *sd, · 439 unmodified lines
11011103
11021104 static int tvp5150_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt)
11031105 {
1104− /* this is for capturing 36 raw vbi lines
1105− if there's a way to cut off the beginning 2 vbi lines
1106− with the tvp5150 then the vbi line count could be lowered
1107− to 17 lines/field again, although I couldn't find a register
1108− which could do that cropping */
1106+ /*
1107+ * this is for capturing 36 raw vbi lines
1108+ * if there's a way to cut off the beginning 2 vbi lines
1109+ * with the tvp5150 then the vbi line count could be lowered
1110+ * to 17 lines/field again, although I couldn't find a register
1111+ * which could do that cropping
1112+ */
1113+
11091114 if (fmt->sample_format == V4L2_PIX_FMT_GREY)
11101115 tvp5150_write(sd, TVP5150_LUMA_PROC_CTL_1, 0x70);
11111116 if (fmt->count[0] == 18 && fmt->count[1] == 18) {
drivers/media/i2c/video-i2c.c+564−0
@@ -0,0 +1,564 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * video-i2c.c - Support for I2C transport video devices
4+ *
5+ * Copyright (C) 2018 Matt Ranostay <matt.ranostay@konsulko.com>
6+ *
7+ * Supported:
8+ * - Panasonic AMG88xx Grid-Eye Sensors
9+ */
10+
11+#include <linux/delay.h>
12+#include <linux/freezer.h>
13+#include <linux/kthread.h>
14+#include <linux/i2c.h>
15+#include <linux/list.h>
16+#include <linux/module.h>
17+#include <linux/mutex.h>
18+#include <linux/of_device.h>
19+#include <linux/sched.h>
20+#include <linux/slab.h>
21+#include <linux/videodev2.h>
22+#include <media/v4l2-common.h>
23+#include <media/v4l2-device.h>
24+#include <media/v4l2-event.h>
25+#include <media/v4l2-fh.h>
26+#include <media/v4l2-ioctl.h>
27+#include <media/videobuf2-v4l2.h>
28+#include <media/videobuf2-vmalloc.h>
29+
30+#define VIDEO_I2C_DRIVER "video-i2c"
31+
32+struct video_i2c_chip;
33+
34+struct video_i2c_buffer {
35+ struct vb2_v4l2_buffer vb;
36+ struct list_head list;
37+};
38+
39+struct video_i2c_data {
40+ struct i2c_client *client;
41+ const struct video_i2c_chip *chip;
42+ struct mutex lock;
43+ spinlock_t slock;
44+ unsigned int sequence;
45+ struct mutex queue_lock;
46+
47+ struct v4l2_device v4l2_dev;
48+ struct video_device vdev;
49+ struct vb2_queue vb_vidq;
50+
51+ struct task_struct *kthread_vid_cap;
52+ struct list_head vid_cap_active;
53+};
54+
55+static const struct v4l2_fmtdesc amg88xx_format = {
56+ .pixelformat = V4L2_PIX_FMT_Y12,
57+};
58+
59+static const struct v4l2_frmsize_discrete amg88xx_size = {
60+ .width = 8,
61+ .height = 8,
62+};
63+
64+struct video_i2c_chip {
65+ /* video dimensions */
66+ const struct v4l2_fmtdesc *format;
67+ const struct v4l2_frmsize_discrete *size;
68+
69+ /* max frames per second */
70+ unsigned int max_fps;
71+
72+ /* pixel buffer size */
73+ unsigned int buffer_size;
74+
75+ /* pixel size in bits */
76+ unsigned int bpp;
77+
78+ /* xfer function */
79+ int (*xfer)(struct video_i2c_data *data, char *buf);
80+};
81+
82+static int amg88xx_xfer(struct video_i2c_data *data, char *buf)
83+{
84+ struct i2c_client *client = data->client;
85+ struct i2c_msg msg[2];
86+ u8 reg = 0x80;
87+ int ret;
88+
89+ msg[0].addr = client->addr;
90+ msg[0].flags = 0;
91+ msg[0].len = 1;
92+ msg[0].buf = (char *)&reg;
93+
94+ msg[1].addr = client->addr;
95+ msg[1].flags = I2C_M_RD;
96+ msg[1].len = data->chip->buffer_size;
97+ msg[1].buf = (char *)buf;
98+
99+ ret = i2c_transfer(client->adapter, msg, 2);
100+
101+ return (ret == 2) ? 0 : -EIO;
102+}
103+
104+#define AMG88XX 0
105+
106+static const struct video_i2c_chip video_i2c_chip[] = {
107+ [AMG88XX] = {
108+ .size = &amg88xx_size,
109+ .format = &amg88xx_format,
110+ .max_fps = 10,
111+ .buffer_size = 128,
112+ .bpp = 16,
113+ .xfer = &amg88xx_xfer,
114+ },
115+};
116+
117+static const struct v4l2_file_operations video_i2c_fops = {
118+ .owner = THIS_MODULE,
119+ .open = v4l2_fh_open,
120+ .release = vb2_fop_release,
121+ .poll = vb2_fop_poll,
122+ .read = vb2_fop_read,
123+ .mmap = vb2_fop_mmap,
124+ .unlocked_ioctl = video_ioctl2,
125+};
126+
127+static int queue_setup(struct vb2_queue *vq,
128+ unsigned int *nbuffers, unsigned int *nplanes,
129+ unsigned int sizes[], struct device *alloc_devs[])
130+{
131+ struct video_i2c_data *data = vb2_get_drv_priv(vq);
132+ unsigned int size = data->chip->buffer_size;
133+
134+ if (vq->num_buffers + *nbuffers < 2)
135+ *nbuffers = 2;
136+
137+ if (*nplanes)
138+ return sizes[0] < size ? -EINVAL : 0;
139+
140+ *nplanes = 1;
141+ sizes[0] = size;
142+
143+ return 0;
144+}
145+
146+static int buffer_prepare(struct vb2_buffer *vb)
147+{
148+ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
149+ struct video_i2c_data *data = vb2_get_drv_priv(vb->vb2_queue);
150+ unsigned int size = data->chip->buffer_size;
151+
152+ if (vb2_plane_size(vb, 0) < size)
153+ return -EINVAL;
154+
155+ vbuf->field = V4L2_FIELD_NONE;
156+ vb2_set_plane_payload(vb, 0, size);
157+
158+ return 0;
159+}
160+
161+static void buffer_queue(struct vb2_buffer *vb)
162+{
163+ struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
164+ struct video_i2c_data *data = vb2_get_drv_priv(vb->vb2_queue);
165+ struct video_i2c_buffer *buf =
166+ container_of(vbuf, struct video_i2c_buffer, vb);
167+
168+ spin_lock(&data->slock);
169+ list_add_tail(&buf->list, &data->vid_cap_active);
170+ spin_unlock(&data->slock);
171+}
172+
173+static int video_i2c_thread_vid_cap(void *priv)
174+{
175+ struct video_i2c_data *data = priv;
176+ unsigned int delay = msecs_to_jiffies(1000 / data->chip->max_fps);
177+
178+ set_freezable();
179+
180+ do {
181+ unsigned long start_jiffies = jiffies;
182+ struct video_i2c_buffer *vid_cap_buf = NULL;
183+ int schedule_delay;
184+
185+ try_to_freeze();
186+
187+ spin_lock(&data->slock);
188+
189+ if (!list_empty(&data->vid_cap_active)) {
190+ vid_cap_buf = list_last_entry(&data->vid_cap_active,
191+ struct video_i2c_buffer, list);
192+ list_del(&vid_cap_buf->list);
193+ }
194+
195+ spin_unlock(&data->slock);
196+
197+ if (vid_cap_buf) {
198+ struct vb2_buffer *vb2_buf = &vid_cap_buf->vb.vb2_buf;
199+ void *vbuf = vb2_plane_vaddr(vb2_buf, 0);
200+ int ret;
201+
202+ ret = data->chip->xfer(data, vbuf);
203+ vb2_buf->timestamp = ktime_get_ns();
204+ vid_cap_buf->vb.sequence = data->sequence++;
205+ vb2_buffer_done(vb2_buf, ret ?
206+ VB2_BUF_STATE_ERROR : VB2_BUF_STATE_DONE);
207+ }
208+
209+ schedule_delay = delay - (jiffies - start_jiffies);
210+
211+ if (time_after(jiffies, start_jiffies + delay))
212+ schedule_delay = delay;
213+
214+ schedule_timeout_interruptible(schedule_delay);
215+ } while (!kthread_should_stop());
216+
217+ return 0;
218+}
219+
220+static void video_i2c_del_list(struct vb2_queue *vq, enum vb2_buffer_state state)
221+{
222+ struct video_i2c_data *data = vb2_get_drv_priv(vq);
223+ struct video_i2c_buffer *buf, *tmp;
224+
225+ spin_lock(&data->slock);
226+
227+ list_for_each_entry_safe(buf, tmp, &data->vid_cap_active, list) {
228+ list_del(&buf->list);
229+ vb2_buffer_done(&buf->vb.vb2_buf, state);
230+ }
231+
232+ spin_unlock(&data->slock);
233+}
234+
235+static int start_streaming(struct vb2_queue *vq, unsigned int count)
236+{
237+ struct video_i2c_data *data = vb2_get_drv_priv(vq);
238+
239+ if (data->kthread_vid_cap)
240+ return 0;
241+
242+ data->sequence = 0;
243+ data->kthread_vid_cap = kthread_run(video_i2c_thread_vid_cap, data,
244+ "%s-vid-cap", data->v4l2_dev.name);
245+ if (!IS_ERR(data->kthread_vid_cap))
246+ return 0;
247+
248+ video_i2c_del_list(vq, VB2_BUF_STATE_QUEUED);
249+
250+ return PTR_ERR(data->kthread_vid_cap);
251+}
252+
253+static void stop_streaming(struct vb2_queue *vq)
254+{
255+ struct video_i2c_data *data = vb2_get_drv_priv(vq);
256+
257+ if (data->kthread_vid_cap == NULL)
258+ return;
259+
260+ kthread_stop(data->kthread_vid_cap);
261+ data->kthread_vid_cap = NULL;
262+
263+ video_i2c_del_list(vq, VB2_BUF_STATE_ERROR);
264+}
265+
266+static struct vb2_ops video_i2c_video_qops = {
267+ .queue_setup = queue_setup,
268+ .buf_prepare = buffer_prepare,
269+ .buf_queue = buffer_queue,
270+ .start_streaming = start_streaming,
271+ .stop_streaming = stop_streaming,
272+ .wait_prepare = vb2_ops_wait_prepare,
273+ .wait_finish = vb2_ops_wait_finish,
274+};
275+
276+static int video_i2c_querycap(struct file *file, void *priv,
277+ struct v4l2_capability *vcap)
278+{
279+ struct video_i2c_data *data = video_drvdata(file);
280+ struct i2c_client *client = data->client;
281+
282+ strlcpy(vcap->driver, data->v4l2_dev.name, sizeof(vcap->driver));
283+ strlcpy(vcap->card, data->vdev.name, sizeof(vcap->card));
284+
285+ sprintf(vcap->bus_info, "I2C:%d-%d", client->adapter->nr, client->addr);
286+
287+ return 0;
288+}
289+
290+static int video_i2c_g_input(struct file *file, void *fh, unsigned int *inp)
291+{
292+ *inp = 0;
293+
294+ return 0;
295+}
296+
297+static int video_i2c_s_input(struct file *file, void *fh, unsigned int inp)
298+{
299+ return (inp > 0) ? -EINVAL : 0;
300+}
301+
302+static int video_i2c_enum_input(struct file *file, void *fh,
303+ struct v4l2_input *vin)
304+{
305+ if (vin->index > 0)
306+ return -EINVAL;
307+
308+ strlcpy(vin->name, "Camera", sizeof(vin->name));
309+
310+ vin->type = V4L2_INPUT_TYPE_CAMERA;
311+
312+ return 0;
313+}
314+
315+static int video_i2c_enum_fmt_vid_cap(struct file *file, void *fh,
316+ struct v4l2_fmtdesc *fmt)
317+{
318+ struct video_i2c_data *data = video_drvdata(file);
319+ enum v4l2_buf_type type = fmt->type;
320+
321+ if (fmt->index > 0)
322+ return -EINVAL;
323+
324+ *fmt = *data->chip->format;
325+ fmt->type = type;
326+
327+ return 0;
328+}
329+
330+static int video_i2c_enum_framesizes(struct file *file, void *fh,
331+ struct v4l2_frmsizeenum *fsize)
332+{
333+ const struct video_i2c_data *data = video_drvdata(file);
334+ const struct v4l2_frmsize_discrete *size = data->chip->size;
335+
336+ /* currently only one frame size is allowed */
337+ if (fsize->index > 0)
338+ return -EINVAL;
339+
340+ if (fsize->pixel_format != data->chip->format->pixelformat)
341+ return -EINVAL;
342+
343+ fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
344+ fsize->discrete.width = size->width;
345+ fsize->discrete.height = size->height;
346+
347+ return 0;
348+}
349+
350+static int video_i2c_enum_frameintervals(struct file *file, void *priv,
351+ struct v4l2_frmivalenum *fe)
352+{
353+ const struct video_i2c_data *data = video_drvdata(file);
354+ const struct v4l2_frmsize_discrete *size = data->chip->size;
355+
356+ if (fe->index > 0)
357+ return -EINVAL;
358+
359+ if (fe->width != size->width || fe->height != size->height)
360+ return -EINVAL;
361+
362+ fe->type = V4L2_FRMIVAL_TYPE_DISCRETE;
363+ fe->discrete.numerator = 1;
364+ fe->discrete.denominator = data->chip->max_fps;
365+
366+ return 0;
367+}
368+
369+static int video_i2c_try_fmt_vid_cap(struct file *file, void *fh,
370+ struct v4l2_format *fmt)
371+{
372+ const struct video_i2c_data *data = video_drvdata(file);
373+ const struct v4l2_frmsize_discrete *size = data->chip->size;
374+ struct v4l2_pix_format *pix = &fmt->fmt.pix;
375+ unsigned int bpp = data->chip->bpp / 8;
376+
377+ pix->width = size->width;
378+ pix->height = size->height;
379+ pix->pixelformat = data->chip->format->pixelformat;
380+ pix->field = V4L2_FIELD_NONE;
381+ pix->bytesperline = pix->width * bpp;
382+ pix->sizeimage = pix->bytesperline * pix->height;
383+ pix->colorspace = V4L2_COLORSPACE_RAW;
384+
385+ return 0;
386+}
387+
388+static int video_i2c_s_fmt_vid_cap(struct file *file, void *fh,
389+ struct v4l2_format *fmt)
390+{
391+ struct video_i2c_data *data = video_drvdata(file);
392+
393+ if (vb2_is_busy(&data->vb_vidq))
394+ return -EBUSY;
395+
396+ return video_i2c_try_fmt_vid_cap(file, fh, fmt);
397+}
398+
399+static int video_i2c_g_parm(struct file *filp, void *priv,
400+ struct v4l2_streamparm *parm)
401+{
402+ struct video_i2c_data *data = video_drvdata(filp);
403+
404+ if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
405+ return -EINVAL;
406+
407+ parm->parm.capture.readbuffers = 1;
408+ parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
409+ parm->parm.capture.timeperframe.numerator = 1;
410+ parm->parm.capture.timeperframe.denominator = data->chip->max_fps;
411+
412+ return 0;
413+}
414+
415+static const struct v4l2_ioctl_ops video_i2c_ioctl_ops = {
416+ .vidioc_querycap = video_i2c_querycap,
417+ .vidioc_g_input = video_i2c_g_input,
418+ .vidioc_s_input = video_i2c_s_input,
419+ .vidioc_enum_input = video_i2c_enum_input,
420+ .vidioc_enum_fmt_vid_cap = video_i2c_enum_fmt_vid_cap,
421+ .vidioc_enum_framesizes = video_i2c_enum_framesizes,
422+ .vidioc_enum_frameintervals = video_i2c_enum_frameintervals,
423+ .vidioc_g_fmt_vid_cap = video_i2c_try_fmt_vid_cap,
424+ .vidioc_s_fmt_vid_cap = video_i2c_s_fmt_vid_cap,
425+ .vidioc_g_parm = video_i2c_g_parm,
426+ .vidioc_s_parm = video_i2c_g_parm,
427+ .vidioc_try_fmt_vid_cap = video_i2c_try_fmt_vid_cap,
428+ .vidioc_reqbufs = vb2_ioctl_reqbufs,
429+ .vidioc_create_bufs = vb2_ioctl_create_bufs,
430+ .vidioc_prepare_buf = vb2_ioctl_prepare_buf,
431+ .vidioc_querybuf = vb2_ioctl_querybuf,
432+ .vidioc_qbuf = vb2_ioctl_qbuf,
433+ .vidioc_dqbuf = vb2_ioctl_dqbuf,
434+ .vidioc_streamon = vb2_ioctl_streamon,
435+ .vidioc_streamoff = vb2_ioctl_streamoff,
436+};
437+
438+static void video_i2c_release(struct video_device *vdev)
439+{
440+ kfree(video_get_drvdata(vdev));
441+}
442+
443+static int video_i2c_probe(struct i2c_client *client,
444+ const struct i2c_device_id *id)
445+{
446+ struct video_i2c_data *data;
447+ struct v4l2_device *v4l2_dev;
448+ struct vb2_queue *queue;
449+ int ret = -ENODEV;
450+
451+ data = kzalloc(sizeof(*data), GFP_KERNEL);
452+ if (!data)
453+ return -ENOMEM;
454+
455+ if (dev_fwnode(&client->dev))
456+ data->chip = device_get_match_data(&client->dev);
457+ else if (id)
458+ data->chip = &video_i2c_chip[id->driver_data];
459+ else
460+ goto error_free_device;
461+
462+ data->client = client;
463+ v4l2_dev = &data->v4l2_dev;
464+ strlcpy(v4l2_dev->name, VIDEO_I2C_DRIVER, sizeof(v4l2_dev->name));
465+
466+ ret = v4l2_device_register(&client->dev, v4l2_dev);
467+ if (ret < 0)
468+ goto error_free_device;
469+
470+ mutex_init(&data->lock);
471+ mutex_init(&data->queue_lock);
472+
473+ queue = &data->vb_vidq;
474+ queue->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
475+ queue->io_modes = VB2_DMABUF | VB2_MMAP | VB2_USERPTR | VB2_READ;
476+ queue->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
477+ queue->drv_priv = data;
478+ queue->buf_struct_size = sizeof(struct video_i2c_buffer);
479+ queue->min_buffers_needed = 1;
480+ queue->ops = &video_i2c_video_qops;
481+ queue->mem_ops = &vb2_vmalloc_memops;
482+
483+ ret = vb2_queue_init(queue);
484+ if (ret < 0)
485+ goto error_unregister_device;
486+
487+ data->vdev.queue = queue;
488+ data->vdev.queue->lock = &data->queue_lock;
489+
490+ snprintf(data->vdev.name, sizeof(data->vdev.name),
491+ "I2C %d-%d Transport Video",
492+ client->adapter->nr, client->addr);
493+
494+ data->vdev.v4l2_dev = v4l2_dev;
495+ data->vdev.fops = &video_i2c_fops;
496+ data->vdev.lock = &data->lock;
497+ data->vdev.ioctl_ops = &video_i2c_ioctl_ops;
498+ data->vdev.release = video_i2c_release;
499+ data->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE |
500+ V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
501+
502+ spin_lock_init(&data->slock);
503+ INIT_LIST_HEAD(&data->vid_cap_active);
504+
505+ video_set_drvdata(&data->vdev, data);
506+ i2c_set_clientdata(client, data);
507+
508+ ret = video_register_device(&data->vdev, VFL_TYPE_GRABBER, -1);
509+ if (ret < 0)
510+ goto error_unregister_device;
511+
512+ return 0;
513+
514+error_unregister_device:
515+ v4l2_device_unregister(v4l2_dev);
516+ mutex_destroy(&data->lock);
517+ mutex_destroy(&data->queue_lock);
518+
519+error_free_device:
520+ kfree(data);
521+
522+ return ret;
523+}
524+
525+static int video_i2c_remove(struct i2c_client *client)
526+{
527+ struct video_i2c_data *data = i2c_get_clientdata(client);
528+
529+ video_unregister_device(&data->vdev);
530+ v4l2_device_unregister(&data->v4l2_dev);
531+
532+ mutex_destroy(&data->lock);
533+ mutex_destroy(&data->queue_lock);
534+
535+ return 0;
536+}
537+
538+static const struct i2c_device_id video_i2c_id_table[] = {
539+ { "amg88xx", AMG88XX },
540+ {}
541+};
542+MODULE_DEVICE_TABLE(i2c, video_i2c_id_table);
543+
544+static const struct of_device_id video_i2c_of_match[] = {
545+ { .compatible = "panasonic,amg88xx", .data = &video_i2c_chip[AMG88XX] },
546+ {}
547+};
548+MODULE_DEVICE_TABLE(of, video_i2c_of_match);
549+
550+static struct i2c_driver video_i2c_driver = {
551+ .driver = {
552+ .name = VIDEO_I2C_DRIVER,
553+ .of_match_table = video_i2c_of_match,
554+ },
555+ .probe = video_i2c_probe,
556+ .remove = video_i2c_remove,
557+ .id_table = video_i2c_id_table,
558+};
559+
560+module_i2c_driver(video_i2c_driver);
561+
562+MODULE_AUTHOR("Matt Ranostay <matt.ranostay@konsulko.com>");
563+MODULE_DESCRIPTION("I2C transport video support");
564+MODULE_LICENSE("GPL v2");
drivers/media/media-device.c+11−10
@@ -54,9 +54,10 @@ static int media_device_close(struct file *filp) · 53 unmodified lines
5454 return 0;
5555 }
5656
57−static int media_device_get_info(struct media_device *dev,
58− struct media_device_info *info)
57+static long media_device_get_info(struct media_device *dev, void *arg)
5958 {
59+ struct media_device_info *info = arg;
60+
6061 memset(info, 0, sizeof(*info));
6162
6263 if (dev->driver_name[0])
@@ -93,9 +94,9 @@ static struct media_entity *find_entity(struct media_device *mdev, u32 id) · 30 unmodified lines
9394 return NULL;
9495 }
9596
96−static long media_device_enum_entities(struct media_device *mdev,
97− struct media_entity_desc *entd)
97+static long media_device_enum_entities(struct media_device *mdev, void *arg)
9898 {
99+ struct media_entity_desc *entd = arg;
99100 struct media_entity *ent;
100101
101102 ent = find_entity(mdev, entd->id);
@@ -146,9 +147,9 @@ static void media_device_kpad_to_upad(const struct media_pad *kpad, · 44 unmodified lines
146147 upad->flags = kpad->flags;
147148 }
148149
149−static long media_device_enum_links(struct media_device *mdev,
150− struct media_links_enum *links)
150+static long media_device_enum_links(struct media_device *mdev, void *arg)
151151 {
152+ struct media_links_enum *links = arg;
152153 struct media_entity *entity;
153154
154155 entity = find_entity(mdev, links->entity);
@@ -195,9 +196,9 @@ static long media_device_enum_links(struct media_device *mdev, · 40 unmodified lines
195196 return 0;
196197 }
197198
198−static long media_device_setup_link(struct media_device *mdev,
199− struct media_link_desc *linkd)
199+static long media_device_setup_link(struct media_device *mdev, void *arg)
200200 {
201+ struct media_link_desc *linkd = arg;
201202 struct media_link *link = NULL;
202203 struct media_entity *source;
203204 struct media_entity *sink;
@@ -225,9 +226,9 @@ static long media_device_setup_link(struct media_device *mdev, · 21 unmodified lines
225226 return __media_entity_setup_link(link, linkd->flags);
226227 }
227228
228−static long media_device_get_topology(struct media_device *mdev,
229− struct media_v2_topology *topo)
229+static long media_device_get_topology(struct media_device *mdev, void *arg)
230230 {
231+ struct media_v2_topology *topo = arg;
231232 struct media_entity *entity;
232233 struct media_interface *intf;
233234 struct media_pad *pad;
drivers/media/mmc/siano/smssdio.c+1−1
@@ -279,7 +279,7 @@ static int smssdio_probe(struct sdio_func *func, · 278 unmodified lines
279279 goto free;
280280 }
281281
282− ret = smscore_register_device(&params, &smsdev->coredev, NULL);
282+ ret = smscore_register_device(&params, &smsdev->coredev, GFP_DMA, NULL);
283283 if (ret < 0)
284284 goto free;
285285
drivers/media/pci/Kconfig+0−1
@@ -16,7 +16,6 @@ source "drivers/media/pci/sta2x11/Kconfig" · 15 unmodified lines
1616 source "drivers/media/pci/tw5864/Kconfig"
1717 source "drivers/media/pci/tw68/Kconfig"
1818 source "drivers/media/pci/tw686x/Kconfig"
19−source "drivers/media/pci/zoran/Kconfig"
2019 endif
2120
2221 if MEDIA_ANALOG_TV_SUPPORT
drivers/media/pci/Makefile+0−1
@@ -18,7 +18,6 @@ obj-y += ttpci/ \ · 17 unmodified lines
1818 intel/
1919
2020 obj-$(CONFIG_VIDEO_IVTV) += ivtv/
21−obj-$(CONFIG_VIDEO_ZORAN) += zoran/
2221 obj-$(CONFIG_VIDEO_CX18) += cx18/
2322 obj-$(CONFIG_VIDEO_CX23885) += cx23885/
2423 obj-$(CONFIG_VIDEO_CX25821) += cx25821/
drivers/media/pci/bt8xx/bttv-risc.c+9−8
@@ -189,20 +189,21 @@ bttv_risc_planar(struct bttv *btv, struct btcx_riscmem *risc, · 188 unmodified lines
189189 yoffset -= sg_dma_len(ysg);
190190 ysg = sg_next(ysg);
191191 }
192− while (uoffset && uoffset >= sg_dma_len(usg)) {
193− uoffset -= sg_dma_len(usg);
194− usg = sg_next(usg);
195− }
196− while (voffset && voffset >= sg_dma_len(vsg)) {
197− voffset -= sg_dma_len(vsg);
198− vsg = sg_next(vsg);
199− }
200192
201193 /* calculate max number of bytes we can write */
202194 ylen = todo;
203195 if (yoffset + ylen > sg_dma_len(ysg))
204196 ylen = sg_dma_len(ysg) - yoffset;
205197 if (chroma) {
198+ while (uoffset && uoffset >= sg_dma_len(usg)) {
199+ uoffset -= sg_dma_len(usg);
200+ usg = sg_next(usg);
201+ }
202+ while (voffset && voffset >= sg_dma_len(vsg)) {
203+ voffset -= sg_dma_len(vsg);
204+ vsg = sg_next(vsg);
205+ }
206+
206207 if (uoffset + (ylen>>hshift) > sg_dma_len(usg))
207208 ylen = (sg_dma_len(usg) - uoffset) << hshift;
208209 if (voffset + (ylen>>hshift) > sg_dma_len(vsg))
drivers/media/pci/bt8xx/dst.c+1−1
@@ -1657,7 +1657,7 @@ static int dst_tune_frontend(struct dvb_frontend* fe, · 1656 unmodified lines
16571657 return 0;
16581658 }
16591659
1660−static int dst_get_tuning_algo(struct dvb_frontend *fe)
1660+static enum dvbfe_algo dst_get_tuning_algo(struct dvb_frontend *fe)
16611661 {
16621662 return dst_algo ? DVBFE_ALGO_HW : DVBFE_ALGO_SW;
16631663 }
drivers/media/pci/bt8xx/dvb-bt8xx.c+2−2
@@ -575,7 +575,6 @@ static struct mt352_config digitv_alps_tded4_config = { · 574 unmodified lines
575575 };
576576
577577 static struct lgdt330x_config tdvs_tua6034_config = {
578− .demod_address = 0x0e,
579578 .demod_chip = LGDT3303,
580579 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
581580 };
@@ -614,7 +613,8 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) · 32 unmodified lines
614613
615614 case BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE:
616615 lgdt330x_reset(card);
617− card->fe = dvb_attach(lgdt330x_attach, &tdvs_tua6034_config, card->i2c_adapter);
616+ card->fe = dvb_attach(lgdt330x_attach, &tdvs_tua6034_config,
617+ 0x0e, card->i2c_adapter);
618618 if (card->fe != NULL) {
619619 dvb_attach(simple_tuner_attach, card->fe,
620620 card->i2c_adapter, 0x61,
drivers/media/pci/cx23885/cx23885-core.c+114−18
@@ -422,19 +422,30 @@ static void cx23885_wakeup(struct cx23885_tsport *port, · 421 unmodified lines
422422 struct cx23885_dmaqueue *q, u32 count)
423423 {
424424 struct cx23885_buffer *buf;
425−
426− if (list_empty(&q->active))
427− return;
428− buf = list_entry(q->active.next,
429− struct cx23885_buffer, queue);
430−
431− buf->vb.vb2_buf.timestamp = ktime_get_ns();
432− buf->vb.sequence = q->count++;
433− dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
434− buf->vb.vb2_buf.index,
435− count, q->count);
436− list_del(&buf->queue);
437− vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
425+ int count_delta;
426+ int max_buf_done = 5; /* service maximum five buffers */
427+
428+ do {
429+ if (list_empty(&q->active))
430+ return;
431+ buf = list_entry(q->active.next,
432+ struct cx23885_buffer, queue);
433+
434+ buf->vb.vb2_buf.timestamp = ktime_get_ns();
435+ buf->vb.sequence = q->count++;
436+ if (count != (q->count % 65536)) {
437+ dprintk(1, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
438+ buf->vb.vb2_buf.index, count, q->count);
439+ } else {
440+ dprintk(7, "[%p/%d] wakeup reg=%d buf=%d\n", buf,
441+ buf->vb.vb2_buf.index, count, q->count);
442+ }
443+ list_del(&buf->queue);
444+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
445+ max_buf_done--;
446+ /* count register is 16 bits so apply modulo appropriately */
447+ count_delta = ((int)count - (int)(q->count % 65536));
448+ } while ((count_delta > 0) && (max_buf_done > 0));
438449 }
439450
440451 int cx23885_sram_channel_setup(struct cx23885_dev *dev,
@@ -590,6 +601,25 @@ static void cx23885_risc_disasm(struct cx23885_tsport *port, · 149 unmodified lines
590601 }
591602 }
592603
604+static void cx23885_clear_bridge_error(struct cx23885_dev *dev)
605+{
606+ uint32_t reg1_val = cx_read(TC_REQ); /* read-only */
607+ uint32_t reg2_val = cx_read(TC_REQ_SET);
608+
609+ if (reg1_val && reg2_val) {
610+ cx_write(TC_REQ, reg1_val);
611+ cx_write(TC_REQ_SET, reg2_val);
612+ cx_read(VID_B_DMA);
613+ cx_read(VBI_B_DMA);
614+ cx_read(VID_C_DMA);
615+ cx_read(VBI_C_DMA);
616+
617+ dev_info(&dev->pci->dev,
618+ "dma in progress detected 0x%08x 0x%08x, clearing\n",
619+ reg1_val, reg2_val);
620+ }
621+}
622+
593623 static void cx23885_shutdown(struct cx23885_dev *dev)
594624 {
595625 /* disable RISC controller */
@@ -635,6 +665,8 @@ static void cx23885_reset(struct cx23885_dev *dev) · 39 unmodified lines
635665 cx_write(CLK_DELAY, cx_read(CLK_DELAY) & 0x80000000);
636666 cx_write(PAD_CTRL, 0x00500300);
637667
668+ /* clear dma in progress */
669+ cx23885_clear_bridge_error(dev);
638670 mdelay(100);
639671
640672 cx23885_sram_channel_setup(dev, &dev->sram_channels[SRAM_CH01],
@@ -651,6 +683,11 @@ static void cx23885_reset(struct cx23885_dev *dev) · 10 unmodified lines
651683 cx23885_sram_channel_setup(dev, &dev->sram_channels[SRAM_CH09], 128, 0);
652684
653685 cx23885_gpio_setup(dev);
686+
687+ cx23885_irq_get_mask(dev);
688+
689+ /* clear dma in progress */
690+ cx23885_clear_bridge_error(dev);
654691 }
655692
656693
@@ -665,6 +702,8 @@ static int cx23885_pci_quirks(struct cx23885_dev *dev) · 8 unmodified lines
665702 if (dev->bridge == CX23885_BRIDGE_885)
666703 cx_clear(RDR_TLCTL0, 1 << 4);
667704
705+ /* clear dma in progress */
706+ cx23885_clear_bridge_error(dev);
668707 return 0;
669708 }
670709
@@ -1329,6 +1368,18 @@ static void cx23885_tsport_reg_dump(struct cx23885_tsport *port) · 658 unmodified lines
13291368 port->reg_ts_clk_en, cx_read(port->reg_ts_clk_en));
13301369 dprintk(1, "%s() ts_int_msk(0x%08X) 0x%08x\n", __func__,
13311370 port->reg_ts_int_msk, cx_read(port->reg_ts_int_msk));
1371+ dprintk(1, "%s() ts_int_status(0x%08X) 0x%08x\n", __func__,
1372+ port->reg_ts_int_stat, cx_read(port->reg_ts_int_stat));
1373+ dprintk(1, "%s() PCI_INT_STAT 0x%08X\n", __func__,
1374+ cx_read(PCI_INT_STAT));
1375+ dprintk(1, "%s() VID_B_INT_MSTAT 0x%08X\n", __func__,
1376+ cx_read(VID_B_INT_MSTAT));
1377+ dprintk(1, "%s() VID_B_INT_SSTAT 0x%08X\n", __func__,
1378+ cx_read(VID_B_INT_SSTAT));
1379+ dprintk(1, "%s() VID_C_INT_MSTAT 0x%08X\n", __func__,
1380+ cx_read(VID_C_INT_MSTAT));
1381+ dprintk(1, "%s() VID_C_INT_SSTAT 0x%08X\n", __func__,
1382+ cx_read(VID_C_INT_SSTAT));
13321383 }
13331384
13341385 int cx23885_start_dma(struct cx23885_tsport *port,
@@ -1341,6 +1392,9 @@ int cx23885_start_dma(struct cx23885_tsport *port, · 6 unmodified lines
13411392 dprintk(1, "%s() w: %d, h: %d, f: %d\n", __func__,
13421393 dev->width, dev->height, dev->field);
13431394
1395+ /* clear dma in progress */
1396+ cx23885_clear_bridge_error(dev);
1397+
13441398 /* Stop the fifo and risc engine for this port */
13451399 cx_clear(port->reg_dma_ctl, port->dma_ctl_val);
13461400
@@ -1410,8 +1464,15 @@ int cx23885_start_dma(struct cx23885_tsport *port, · 63 unmodified lines
14101464 reg = reg | 0xa;
14111465 cx_write(PAD_CTRL, reg);
14121466
1413− /* FIXME and these two registers should be documented. */
1467+ /* Sets MOE_CLK_DIS to disable MoE clock */
1468+ /* sets MCLK_DLY_SEL/BCLK_DLY_SEL to 1 buffer delay each */
14141469 cx_write(CLK_DELAY, cx_read(CLK_DELAY) | 0x80000011);
1470+
1471+ /* ALT_GPIO_ALT_SET: GPIO[0]
1472+ * IR_ALT_TX_SEL: GPIO[1]
1473+ * GPIO1_ALT_SEL: VIP_656_DATA[0]
1474+ * GPIO0_ALT_SEL: VIP_656_CLK
1475+ */
14151476 cx_write(ALT_PIN_OUT_SEL, 0x10100045);
14161477 }
14171478
@@ -1421,16 +1482,26 @@ int cx23885_start_dma(struct cx23885_tsport *port, · 3 unmodified lines
14211482 case CX23885_BRIDGE_888:
14221483 /* enable irqs */
14231484 dprintk(1, "%s() enabling TS int's and DMA\n", __func__);
1485+ /* clear dma in progress */
1486+ cx23885_clear_bridge_error(dev);
14241487 cx_set(port->reg_ts_int_msk, port->ts_int_msk_val);
14251488 cx_set(port->reg_dma_ctl, port->dma_ctl_val);
1489+
1490+ /* clear dma in progress */
1491+ cx23885_clear_bridge_error(dev);
14261492 cx23885_irq_add(dev, port->pci_irqmask);
14271493 cx23885_irq_enable_all(dev);
1494+
1495+ /* clear dma in progress */
1496+ cx23885_clear_bridge_error(dev);
14281497 break;
14291498 default:
14301499 BUG();
14311500 }
14321501
14331502 cx_set(DEV_CNTRL2, (1<<5)); /* Enable RISC controller */
1503+ /* clear dma in progress */
1504+ cx23885_clear_bridge_error(dev);
14341505
14351506 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER)
14361507 cx23885_av_clk(dev, 1);
@@ -1438,6 +1509,11 @@ int cx23885_start_dma(struct cx23885_tsport *port, · 1 unmodified line
14381509 if (debug > 4)
14391510 cx23885_tsport_reg_dump(port);
14401511
1512+ cx23885_irq_get_mask(dev);
1513+
1514+ /* clear dma in progress */
1515+ cx23885_clear_bridge_error(dev);
1516+
14411517 return 0;
14421518 }
14431519
@@ -1445,15 +1521,28 @@ static int cx23885_stop_dma(struct cx23885_tsport *port) · 1 unmodified line
14451521 {
14461522 struct cx23885_dev *dev = port->dev;
14471523 u32 reg;
1524+ int delay = 0;
1525+ uint32_t reg1_val;
1526+ uint32_t reg2_val;
14481527
14491528 dprintk(1, "%s()\n", __func__);
14501529
14511530 /* Stop interrupts and DMA */
14521531 cx_clear(port->reg_ts_int_msk, port->ts_int_msk_val);
14531532 cx_clear(port->reg_dma_ctl, port->dma_ctl_val);
1533+ /* just in case wait for any dma to complete before allowing dealloc */
1534+ mdelay(20);
1535+ for (delay = 0; delay < 100; delay++) {
1536+ reg1_val = cx_read(TC_REQ);
1537+ reg2_val = cx_read(TC_REQ_SET);
1538+ if (reg1_val == 0 || reg2_val == 0)
1539+ break;
1540+ mdelay(1);
1541+ }
1542+ dev_dbg(&dev->pci->dev, "delay=%d reg1=0x%08x reg2=0x%08x\n",
1543+ delay, reg1_val, reg2_val);
14541544
14551545 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER) {
1456−
14571546 reg = cx_read(PAD_CTRL);
14581547
14591548 /* Set TS1_OE */
@@ -1464,7 +1553,6 @@ static int cx23885_stop_dma(struct cx23885_tsport *port) · 4 unmodified lines
14641553 cx_write(PAD_CTRL, reg);
14651554 cx_write(port->reg_src_sel, 0);
14661555 cx_write(port->reg_gen_ctrl, 8);
1467−
14681556 }
14691557
14701558 if (cx23885_boards[dev->board].portb == CX23885_MPEG_ENCODER)
@@ -1693,6 +1781,12 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) · 222 unmodified lines
16931781
16941782 pci_status = cx_read(PCI_INT_STAT);
16951783 pci_mask = cx23885_irq_get_mask(dev);
1784+ if ((pci_status & pci_mask) == 0) {
1785+ dprintk(7, "pci_status: 0x%08x pci_mask: 0x%08x\n",
1786+ pci_status, pci_mask);
1787+ goto out;
1788+ }
1789+
16961790 vida_status = cx_read(VID_A_INT_STAT);
16971791 vida_mask = cx_read(VID_A_INT_MSK);
16981792 audint_status = cx_read(AUDIO_INT_INT_STAT);
@@ -1702,7 +1796,9 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) · 3 unmodified lines
17021796 ts2_status = cx_read(VID_C_INT_STAT);
17031797 ts2_mask = cx_read(VID_C_INT_MSK);
17041798
1705− if ((pci_status == 0) && (ts2_status == 0) && (ts1_status == 0))
1799+ if (((pci_status & pci_mask) == 0) &&
1800+ ((ts2_status & ts2_mask) == 0) &&
1801+ ((ts1_status & ts1_mask) == 0))
17061802 goto out;
17071803
17081804 vida_count = cx_read(VID_A_GPCNT);
@@ -1829,7 +1925,7 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id) · 120 unmodified lines
18291925 }
18301926
18311927 if (handled)
1832− cx_write(PCI_INT_STAT, pci_status);
1928+ cx_write(PCI_INT_STAT, pci_status & pci_mask);
18331929 out:
18341930 return IRQ_RETVAL(handled);
18351931 }
drivers/media/pci/cx23885/cx23885-dvb.c+3−3
@@ -252,7 +252,6 @@ static struct mt2131_config hauppauge_generic_tunerconfig = { · 251 unmodified lines
252252 };
253253
254254 static struct lgdt330x_config fusionhdtv_5_express = {
255− .demod_address = 0x0e,
256255 .demod_chip = LGDT3303,
257256 .serial_mpeg = 0x40,
258257 };
@@ -1321,8 +1320,9 @@ static int dvb_register(struct cx23885_tsport *port) · 1062 unmodified lines
13211320 case CX23885_BOARD_DVICO_FUSIONHDTV_5_EXP:
13221321 i2c_bus = &dev->i2c_bus[0];
13231322 fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
1324− &fusionhdtv_5_express,
1325− &i2c_bus->i2c_adap);
1323+ &fusionhdtv_5_express,
1324+ 0x0e,
1325+ &i2c_bus->i2c_adap);
13261326 if (fe0->dvb.frontend == NULL)
13271327 break;
13281328 dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
drivers/media/pci/cx23885/cx23885-reg.h+14−0
@@ -288,6 +288,18 @@ Channel manager Data Structure entry = 20 DWORD · 287 unmodified lines
288288 #define AUDIO_EXT_INT_MSTAT 0x00040068
289289 #define AUDIO_EXT_INT_SSTAT 0x0004006C
290290
291+/* Bits [7:0] set in both TC_REQ and TC_REQ_SET
292+ * indicate a stall in the RISC engine for a
293+ * particular rider traffic class. This causes
294+ * the 885 and 888 bridges (unknown about 887)
295+ * to become inoperable. Setting bits in
296+ * TC_REQ_SET resets the corresponding bits
297+ * in TC_REQ (and TC_REQ_SET) allowing
298+ * operation to continue.
299+ */
300+#define TC_REQ 0x00040090
301+#define TC_REQ_SET 0x00040094
302+
291303 #define RDR_CFG0 0x00050000
292304 #define RDR_CFG1 0x00050004
293305 #define RDR_CFG2 0x00050008
@@ -386,6 +398,8 @@ Channel manager Data Structure entry = 20 DWORD · 92 unmodified lines
386398 #define VID_B_PIXEL_FRMT 0x00130184
387399
388400 /* Video C Interface */
401+#define VID_C_DMA 0x00130200
402+#define VBI_C_DMA 0x00130208
389403 #define VID_C_GPCNT 0x00130220
390404 #define VID_C_GPCNT_CTL 0x00130230
391405 #define VBI_C_GPCNT_CTL 0x00130234
drivers/media/pci/cx88/cx88-dvb.c+4−3
@@ -411,21 +411,18 @@ static int lgdt330x_set_ts_param(struct dvb_frontend *fe, int is_punctured) · 410 unmodified lines
411411 }
412412
413413 static struct lgdt330x_config fusionhdtv_3_gold = {
414− .demod_address = 0x0e,
415414 .demod_chip = LGDT3302,
416415 .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */
417416 .set_ts_params = lgdt330x_set_ts_param,
418417 };
419418
420419 static const struct lgdt330x_config fusionhdtv_5_gold = {
421− .demod_address = 0x0e,
422420 .demod_chip = LGDT3303,
423421 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
424422 .set_ts_params = lgdt330x_set_ts_param,
425423 };
426424
427425 static const struct lgdt330x_config pchdtv_hd5500 = {
428− .demod_address = 0x59,
429426 .demod_chip = LGDT3303,
430427 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
431428 .set_ts_params = lgdt330x_set_ts_param,
@@ -1237,6 +1234,7 @@ static int dvb_register(struct cx8802_dev *dev) · 805 unmodified lines
12371234 fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set;
12381235 fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
12391236 &fusionhdtv_3_gold,
1237+ 0x0e,
12401238 &core->i2c_adap);
12411239 if (fe0->dvb.frontend) {
12421240 if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
@@ -1255,6 +1253,7 @@ static int dvb_register(struct cx8802_dev *dev) · 12 unmodified lines
12551253 mdelay(200);
12561254 fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
12571255 &fusionhdtv_3_gold,
1256+ 0x0e,
12581257 &core->i2c_adap);
12591258 if (fe0->dvb.frontend) {
12601259 if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
@@ -1273,6 +1272,7 @@ static int dvb_register(struct cx8802_dev *dev) · 12 unmodified lines
12731272 mdelay(200);
12741273 fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
12751274 &fusionhdtv_5_gold,
1275+ 0x0e,
12761276 &core->i2c_adap);
12771277 if (fe0->dvb.frontend) {
12781278 if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
@@ -1294,6 +1294,7 @@ static int dvb_register(struct cx8802_dev *dev) · 15 unmodified lines
12941294 mdelay(200);
12951295 fe0->dvb.frontend = dvb_attach(lgdt330x_attach,
12961296 &pchdtv_hd5500,
1297+ 0x59,
12971298 &core->i2c_adap);
12981299 if (fe0->dvb.frontend) {
12991300 if (!dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
drivers/media/pci/cx88/cx88-input.c+7−4
@@ -180,7 +180,8 @@ static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer) · 179 unmodified lines
180180 struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer);
181181
182182 cx88_ir_handle_key(ir);
183− missed = hrtimer_forward_now(&ir->timer, ir->polling * 1000000LL);
183+ missed = hrtimer_forward_now(&ir->timer,
184+ ktime_set(0, ir->polling * 1000000));
184185 if (missed > 1)
185186 ir_dprintk("Missed ticks %ld\n", missed - 1);
186187
@@ -200,7 +201,8 @@ static int __cx88_ir_start(void *priv) · 13 unmodified lines
200201 if (ir->polling) {
201202 hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
202203 ir->timer.function = cx88_ir_work;
203− hrtimer_start(&ir->timer, ir->polling * 1000000LL,
204+ hrtimer_start(&ir->timer,
205+ ktime_set(0, ir->polling * 1000000),
204206 HRTIMER_MODE_REL);
205207 }
206208 if (ir->sampling) {
@@ -632,8 +634,9 @@ void cx88_i2c_init_ir(struct cx88_core *core) · 425 unmodified lines
632634 memset(&core->init_data, 0, sizeof(core->init_data));
633635
634636 if (*addrp == 0x71) {
635− /* Hauppauge XVR */
636− core->init_data.name = "cx88 Hauppauge XVR remote";
637+ /* Hauppauge Z8F0811 */
638+ strlcpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE);
639+ core->init_data.name = core->board.name;
637640 core->init_data.ir_codes = RC_MAP_HAUPPAUGE;
638641 core->init_data.type = RC_PROTO_BIT_RC5 |
639642 RC_PROTO_BIT_RC6_MCE | RC_PROTO_BIT_RC6_6A_32;
drivers/media/pci/cx88/cx88-vbi.c+0−1
@@ -178,7 +178,6 @@ static void buffer_queue(struct vb2_buffer *vb) · 177 unmodified lines
178178
179179 if (list_empty(&q->active)) {
180180 list_add_tail(&buf->list, &q->active);
181− cx8800_start_vbi_dma(dev, q, buf);
182181 dprintk(2, "[%p/%d] vbi_queue - first active\n",
183182 buf, buf->vb.vb2_buf.index);
184183
drivers/media/pci/ddbridge/Kconfig+1−0
@@ -14,6 +14,7 @@ config DVB_DDBRIDGE · 13 unmodified lines
1414 select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT
1515 select DVB_MXL5XX if MEDIA_SUBDRV_AUTOSELECT
1616 select DVB_CXD2099 if MEDIA_SUBDRV_AUTOSELECT
17+ select DVB_DUMMY_FE if MEDIA_SUBDRV_AUTOSELECT
1718 ---help---
1819 Support for cards with the Digital Devices PCI express bridge:
1920 - Octopus PCIe Bridge
drivers/media/pci/ddbridge/Makefile+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44 #
55
66 ddbridge-objs := ddbridge-main.o ddbridge-core.o ddbridge-ci.o \
7− ddbridge-hw.o ddbridge-i2c.o ddbridge-max.o
7+ ddbridge-hw.o ddbridge-i2c.o ddbridge-max.o ddbridge-mci.o
88
99 obj-$(CONFIG_DVB_DDBRIDGE) += ddbridge.o
1010
drivers/media/pci/ddbridge/ddbridge-ci.c+1−1
@@ -164,7 +164,7 @@ static struct dvb_ca_en50221 en_templ = { · 163 unmodified lines
164164
165165 static void ci_attach(struct ddb_port *port)
166166 {
167− struct ddb_ci *ci = NULL;
167+ struct ddb_ci *ci;
168168
169169 ci = kzalloc(sizeof(*ci), GFP_KERNEL);
170170 if (!ci)
drivers/media/pci/ddbridge/ddbridge-core.c+275−144
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454 #include "stv6111.h"
5555 #include "lnbh25.h"
5656 #include "cxd2099.h"
57+#include "dvb_dummy_fe.h"
5758
5859 /****************************************************************************/
5960
@@ -68,11 +69,53 @@ module_param(adapter_alloc, int, 0444); · 8 unmodified lines
6869 MODULE_PARM_DESC(adapter_alloc,
6970 "0-one adapter per io, 1-one per tab with io, 2-one per tab, 3-one for all");
7071
72+static int ci_bitrate = 70000;
73+module_param(ci_bitrate, int, 0444);
74+MODULE_PARM_DESC(ci_bitrate, " Bitrate in KHz for output to CI.");
75+
76+static int ts_loop = -1;
77+module_param(ts_loop, int, 0444);
78+MODULE_PARM_DESC(ts_loop, "TS in/out test loop on port ts_loop");
79+
80+static int xo2_speed = 2;
81+module_param(xo2_speed, int, 0444);
82+MODULE_PARM_DESC(xo2_speed, "default transfer speed for xo2 based duoflex, 0=55,1=75,2=90,3=104 MBit/s, default=2, use attribute to change for individual cards");
83+
84+#ifdef __arm__
85+static int alt_dma = 1;
86+#else
87+static int alt_dma;
88+#endif
89+module_param(alt_dma, int, 0444);
90+MODULE_PARM_DESC(alt_dma, "use alternative DMA buffer handling");
91+
92+static int no_init;
93+module_param(no_init, int, 0444);
94+MODULE_PARM_DESC(no_init, "do not initialize most devices");
95+
96+static int stv0910_single;
97+module_param(stv0910_single, int, 0444);
98+MODULE_PARM_DESC(stv0910_single, "use stv0910 cards as single demods");
99+
100+static int dma_buf_num = 8;
101+module_param(dma_buf_num, int, 0444);
102+MODULE_PARM_DESC(dma_buf_num, "Number of DMA buffers, possible values: 8-32");
103+
104+static int dma_buf_size = 21;
105+module_param(dma_buf_size, int, 0444);
106+MODULE_PARM_DESC(dma_buf_size,
107+ "DMA buffer size as multiple of 128*47, possible values: 1-43");
108+
109+static int dummy_tuner;
110+module_param(dummy_tuner, int, 0444);
111+MODULE_PARM_DESC(dummy_tuner,
112+ "attach dummy tuner to port 0 on Octopus V3 or Octopus Mini cards");
113+
71114 /****************************************************************************/
72115
73116 static DEFINE_MUTEX(redirect_lock);
74117
75−struct workqueue_struct *ddb_wq;
118+static struct workqueue_struct *ddb_wq;
76119
77120 static struct ddb *ddbs[DDB_MAX_ADAPTER];
78121
@@ -80,6 +123,16 @@ static struct ddb *ddbs[DDB_MAX_ADAPTER]; · 1 unmodified line
80123 /****************************************************************************/
81124 /****************************************************************************/
82125
126+struct ddb_irq *ddb_irq_set(struct ddb *dev, u32 link, u32 nr,
127+ void (*handler)(void *), void *data)
128+{
129+ struct ddb_irq *irq = &dev->link[link].irq[nr];
130+
131+ irq->handler = handler;
132+ irq->data = data;
133+ return irq;
134+}
135+
83136 static void ddb_set_dma_table(struct ddb_io *io)
84137 {
85138 struct ddb *dev = io->port->dev;
@@ -410,13 +463,11 @@ static void ddb_output_start(struct ddb_output *output) · 324 unmodified lines
410463 struct ddb *dev = output->port->dev;
411464 u32 con = 0x11c, con2 = 0;
412465
413− if (output->dma) {
414− spin_lock_irq(&output->dma->lock);
415− output->dma->cbuf = 0;
416− output->dma->coff = 0;
417− output->dma->stat = 0;
418− ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma));
419− }
466+ spin_lock_irq(&output->dma->lock);
467+ output->dma->cbuf = 0;
468+ output->dma->coff = 0;
469+ output->dma->stat = 0;
470+ ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma));
420471
421472 if (output->port->input[0]->port->class == DDB_PORT_LOOP)
422473 con = (1UL << 13) | 0x14;
@@ -429,36 +480,29 @@ static void ddb_output_start(struct ddb_output *output) · 6 unmodified lines
429480 ddbwritel(dev, con, TS_CONTROL(output));
430481 ddbwritel(dev, con2, TS_CONTROL2(output));
431482
432− if (output->dma) {
433− ddbwritel(dev, output->dma->bufval,
434− DMA_BUFFER_SIZE(output->dma));
435− ddbwritel(dev, 0, DMA_BUFFER_ACK(output->dma));
436− ddbwritel(dev, 1, DMA_BASE_READ);
437− ddbwritel(dev, 7, DMA_BUFFER_CONTROL(output->dma));
438− }
483+ ddbwritel(dev, output->dma->bufval,
484+ DMA_BUFFER_SIZE(output->dma));
485+ ddbwritel(dev, 0, DMA_BUFFER_ACK(output->dma));
486+ ddbwritel(dev, 1, DMA_BASE_READ);
487+ ddbwritel(dev, 7, DMA_BUFFER_CONTROL(output->dma));
439488
440489 ddbwritel(dev, con | 1, TS_CONTROL(output));
441490
442− if (output->dma) {
443− output->dma->running = 1;
444− spin_unlock_irq(&output->dma->lock);
445− }
491+ output->dma->running = 1;
492+ spin_unlock_irq(&output->dma->lock);
446493 }
447494
448495 static void ddb_output_stop(struct ddb_output *output)
449496 {
450497 struct ddb *dev = output->port->dev;
451498
452− if (output->dma)
453− spin_lock_irq(&output->dma->lock);
499+ spin_lock_irq(&output->dma->lock);
454500
455501 ddbwritel(dev, 0, TS_CONTROL(output));
456502
457− if (output->dma) {
458− ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma));
459− output->dma->running = 0;
460− spin_unlock_irq(&output->dma->lock);
461− }
503+ ddbwritel(dev, 0, DMA_BUFFER_CONTROL(output->dma));
504+ output->dma->running = 0;
505+ spin_unlock_irq(&output->dma->lock);
462506 }
463507
464508 static void ddb_input_stop(struct ddb_input *input)
@@ -466,45 +510,42 @@ static void ddb_input_stop(struct ddb_input *input) · 1 unmodified line
466510 struct ddb *dev = input->port->dev;
467511 u32 tag = DDB_LINK_TAG(input->port->lnr);
468512
469− if (input->dma)
470− spin_lock_irq(&input->dma->lock);
513+ spin_lock_irq(&input->dma->lock);
514+
471515 ddbwritel(dev, 0, tag | TS_CONTROL(input));
472− if (input->dma) {
473− ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma));
474− input->dma->running = 0;
475− spin_unlock_irq(&input->dma->lock);
476− }
516+
517+ ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma));
518+ input->dma->running = 0;
519+ spin_unlock_irq(&input->dma->lock);
477520 }
478521
479522 static void ddb_input_start(struct ddb_input *input)
480523 {
481524 struct ddb *dev = input->port->dev;
482525
483− if (input->dma) {
484− spin_lock_irq(&input->dma->lock);
485− input->dma->cbuf = 0;
486− input->dma->coff = 0;
487− input->dma->stat = 0;
488− ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma));
489− }
526+ spin_lock_irq(&input->dma->lock);
527+ input->dma->cbuf = 0;
528+ input->dma->coff = 0;
529+ input->dma->stat = 0;
530+ ddbwritel(dev, 0, DMA_BUFFER_CONTROL(input->dma));
531+
490532 ddbwritel(dev, 0, TS_CONTROL(input));
491533 ddbwritel(dev, 2, TS_CONTROL(input));
492534 ddbwritel(dev, 0, TS_CONTROL(input));
493535
494− if (input->dma) {
495− ddbwritel(dev, input->dma->bufval,
496− DMA_BUFFER_SIZE(input->dma));
497− ddbwritel(dev, 0, DMA_BUFFER_ACK(input->dma));
498− ddbwritel(dev, 1, DMA_BASE_WRITE);
499− ddbwritel(dev, 3, DMA_BUFFER_CONTROL(input->dma));
500− }
536+ ddbwritel(dev, input->dma->bufval,
537+ DMA_BUFFER_SIZE(input->dma));
538+ ddbwritel(dev, 0, DMA_BUFFER_ACK(input->dma));
539+ ddbwritel(dev, 1, DMA_BASE_WRITE);
540+ ddbwritel(dev, 3, DMA_BUFFER_CONTROL(input->dma));
501541
502542 ddbwritel(dev, 0x09, TS_CONTROL(input));
503543
504− if (input->dma) {
505− input->dma->running = 1;
506− spin_unlock_irq(&input->dma->lock);
507− }
544+ if (input->port->type == DDB_TUNER_DUMMY)
545+ ddbwritel(dev, 0x000fff01, TS_CONTROL2(input));
546+
547+ input->dma->running = 1;
548+ spin_unlock_irq(&input->dma->lock);
508549 }
509550
510551 static void ddb_input_start_all(struct ddb_input *input)
@@ -549,12 +590,12 @@ static u32 ddb_output_free(struct ddb_output *output) · 38 unmodified lines
549590
550591 if (output->dma->cbuf != idx) {
551592 if ((((output->dma->cbuf + 1) % output->dma->num) == idx) &&
552− (output->dma->size - output->dma->coff <= 188))
593+ (output->dma->size - output->dma->coff <= (2 * 188)))
553594 return 0;
554595 return 188;
555596 }
556597 diff = off - output->dma->coff;
557− if (diff <= 0 || diff > 188)
598+ if (diff <= 0 || diff > (2 * 188))
558599 return 188;
559600 return 0;
560601 }
@@ -1142,6 +1183,7 @@ static const struct stv0910_cfg stv0910_p = { · 581 unmodified lines
11421183 .parallel = 1,
11431184 .rptlvl = 4,
11441185 .clk = 30000000,
1186+ .tsspeed = 0x28,
11451187 };
11461188
11471189 static const struct lnbh25_config lnbh25_cfg = {
@@ -1149,7 +1191,7 @@ static const struct lnbh25_config lnbh25_cfg = { · 1 unmodified line
11491191 .data2_config = LNBH25_TEN
11501192 };
11511193
1152−static int demod_attach_stv0910(struct ddb_input *input, int type)
1194+static int demod_attach_stv0910(struct ddb_input *input, int type, int tsfast)
11531195 {
11541196 struct i2c_adapter *i2c = &input->port->i2c->adap;
11551197 struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
@@ -1162,6 +1204,12 @@ static int demod_attach_stv0910(struct ddb_input *input, int type) · 6 unmodified lines
11621204
11631205 if (type)
11641206 cfg.parallel = 2;
1207+
1208+ if (tsfast) {
1209+ dev_info(dev, "Enabling stv0910 higher speed TS\n");
1210+ cfg.tsspeed = 0x10;
1211+ }
1212+
11651213 dvb->fe = dvb_attach(stv0910_attach, i2c, &cfg, (input->nr & 1));
11661214 if (!dvb->fe) {
11671215 cfg.adr = 0x6c;
@@ -1208,6 +1256,20 @@ static int tuner_attach_stv6111(struct ddb_input *input, int type) · 40 unmodified lines
12081256 return 0;
12091257 }
12101258
1259+static int demod_attach_dummy(struct ddb_input *input)
1260+{
1261+ struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
1262+ struct device *dev = input->port->dev->dev;
1263+
1264+ dvb->fe = dvb_attach(dvb_dummy_fe_qam_attach);
1265+ if (!dvb->fe) {
1266+ dev_err(dev, "QAM dummy attach failed!\n");
1267+ return -ENODEV;
1268+ }
1269+
1270+ return 0;
1271+}
1272+
12111273 static int start_feed(struct dvb_demux_feed *dvbdmxfeed)
12121274 {
12131275 struct dvb_demux *dvbdmx = dvbdmxfeed->demux;
@@ -1383,7 +1445,25 @@ static int dvb_input_attach(struct ddb_input *input) · 169 unmodified lines
13831445 struct ddb_port *port = input->port;
13841446 struct dvb_adapter *adap = dvb->adap;
13851447 struct dvb_demux *dvbdemux = &dvb->demux;
1386− int par = 0, osc24 = 0;
1448+ struct ddb_ids *devids = &input->port->dev->link[input->port->lnr].ids;
1449+ int par = 0, osc24 = 0, tsfast = 0;
1450+
1451+ /*
1452+ * Determine if bridges with stv0910 demods can run with fast TS and
1453+ * thus support high bandwidth transponders.
1454+ * STV0910_PR and STV0910_P tuner types covers all relevant bridges,
1455+ * namely the CineS2 V7(A) and the Octopus CI S2 Pro/Advanced. All
1456+ * DuoFlex S2 V4(A) have type=DDB_TUNER_DVBS_STV0910 without any suffix
1457+ * and are limited by the serial link to the bridge, thus won't work
1458+ * in fast TS mode.
1459+ */
1460+ if (port->nr == 0 &&
1461+ (port->type == DDB_TUNER_DVBS_STV0910_PR ||
1462+ port->type == DDB_TUNER_DVBS_STV0910_P)) {
1463+ /* fast TS on port 0 requires FPGA version >= 1.7 */
1464+ if ((devids->hwid & 0x00ffffff) >= 0x00010007)
1465+ tsfast = 1;
1466+ }
13871467
13881468 dvb->attached = 0x01;
13891469
@@ -1440,19 +1520,19 @@ static int dvb_input_attach(struct ddb_input *input) · 50 unmodified lines
14401520 goto err_tuner;
14411521 break;
14421522 case DDB_TUNER_DVBS_STV0910:
1443− if (demod_attach_stv0910(input, 0) < 0)
1523+ if (demod_attach_stv0910(input, 0, tsfast) < 0)
14441524 goto err_detach;
14451525 if (tuner_attach_stv6111(input, 0) < 0)
14461526 goto err_tuner;
14471527 break;
14481528 case DDB_TUNER_DVBS_STV0910_PR:
1449− if (demod_attach_stv0910(input, 1) < 0)
1529+ if (demod_attach_stv0910(input, 1, tsfast) < 0)
14501530 goto err_detach;
14511531 if (tuner_attach_stv6111(input, 1) < 0)
14521532 goto err_tuner;
14531533 break;
14541534 case DDB_TUNER_DVBS_STV0910_P:
1455− if (demod_attach_stv0910(input, 0) < 0)
1535+ if (demod_attach_stv0910(input, 0, tsfast) < 0)
14561536 goto err_detach;
14571537 if (tuner_attach_stv6111(input, 1) < 0)
14581538 goto err_tuner;
@@ -1500,6 +1580,14 @@ static int dvb_input_attach(struct ddb_input *input) · 41 unmodified lines
15001580 if (tuner_attach_tda18212(input, port->type) < 0)
15011581 goto err_tuner;
15021582 break;
1583+ case DDB_TUNER_DUMMY:
1584+ if (demod_attach_dummy(input) < 0)
1585+ goto err_detach;
1586+ break;
1587+ case DDB_TUNER_MCI:
1588+ if (ddb_fe_attach_mci(input) < 0)
1589+ goto err_detach;
1590+ break;
15031591 default:
15041592 return 0;
15051593 }
@@ -1762,6 +1850,15 @@ static void ddb_port_probe(struct ddb_port *port) · 256 unmodified lines
17621850
17631851 /* Handle missing ports and ports without I2C */
17641852
1853+ if (dummy_tuner && !port->nr &&
1854+ dev->link[0].ids.device == 0x0005) {
1855+ port->name = "DUMMY";
1856+ port->class = DDB_PORT_TUNER;
1857+ port->type = DDB_TUNER_DUMMY;
1858+ port->type_name = "DUMMY";
1859+ return;
1860+ }
1861+
17651862 if (port->nr == ts_loop) {
17661863 port->name = "TS LOOP";
17671864 port->class = DDB_PORT_LOOP;
@@ -1786,6 +1883,16 @@ static void ddb_port_probe(struct ddb_port *port) · 18 unmodified lines
17861883 return;
17871884 }
17881885
1886+ if (dev->link[l].info->type == DDB_OCTOPUS_MCI) {
1887+ if (port->nr >= dev->link[l].info->mci)
1888+ return;
1889+ port->name = "DUAL MCI";
1890+ port->type_name = "MCI";
1891+ port->class = DDB_PORT_TUNER;
1892+ port->type = DDB_TUNER_MCI;
1893+ return;
1894+ }
1895+
17891896 if (port->nr > 1 && dev->link[l].info->type == DDB_OCTOPUS_CI) {
17901897 port->name = "CI internal";
17911898 port->type_name = "INTERNAL";
@@ -2081,39 +2188,39 @@ static void input_work(struct work_struct *work) · 289 unmodified lines
20812188 spin_unlock_irqrestore(&dma->lock, flags);
20822189 }
20832190
2084−static void input_handler(unsigned long data)
2191+static void input_handler(void *data)
20852192 {
20862193 struct ddb_input *input = (struct ddb_input *)data;
20872194 struct ddb_dma *dma = input->dma;
20882195
2089− /*
2090− * If there is no input connected, input_tasklet() will
2091− * just copy pointers and ACK. So, there is no need to go
2092− * through the tasklet scheduler.
2093− */
2094− if (input->redi)
2095− queue_work(ddb_wq, &dma->work);
2096− else
2097− input_work(&dma->work);
2196+ queue_work(ddb_wq, &dma->work);
20982197 }
20992198
2100−static void output_handler(unsigned long data)
2199+static void output_work(struct work_struct *work)
21012200 {
2102− struct ddb_output *output = (struct ddb_output *)data;
2103− struct ddb_dma *dma = output->dma;
2201+ struct ddb_dma *dma = container_of(work, struct ddb_dma, work);
2202+ struct ddb_output *output = (struct ddb_output *)dma->io;
21042203 struct ddb *dev = output->port->dev;
2204+ unsigned long flags;
21052205
2106− spin_lock(&dma->lock);
2107− if (!dma->running) {
2108− spin_unlock(&dma->lock);
2109− return;
2110− }
2206+ spin_lock_irqsave(&dma->lock, flags);
2207+ if (!dma->running)
2208+ goto unlock_exit;
21112209 dma->stat = ddbreadl(dev, DMA_BUFFER_CURRENT(dma));
21122210 dma->ctrl = ddbreadl(dev, DMA_BUFFER_CONTROL(dma));
21132211 if (output->redi)
21142212 output_ack_input(output, output->redi);
21152213 wake_up(&dma->wq);
2116− spin_unlock(&dma->lock);
2214+unlock_exit:
2215+ spin_unlock_irqrestore(&dma->lock, flags);
2216+}
2217+
2218+static void output_handler(void *data)
2219+{
2220+ struct ddb_output *output = (struct ddb_output *)data;
2221+ struct ddb_dma *dma = output->dma;
2222+
2223+ queue_work(ddb_wq, &dma->work);
21172224 }
21182225
21192226 /****************************************************************************/
@@ -2146,18 +2253,19 @@ static void ddb_dma_init(struct ddb_io *io, int nr, int out) · 26 unmodified lines
21462253 spin_lock_init(&dma->lock);
21472254 init_waitqueue_head(&dma->wq);
21482255 if (out) {
2256+ INIT_WORK(&dma->work, output_work);
21492257 dma->regs = rm->odma->base + rm->odma->size * nr;
21502258 dma->bufregs = rm->odma_buf->base + rm->odma_buf->size * nr;
2151− dma->num = OUTPUT_DMA_BUFS;
2152− dma->size = OUTPUT_DMA_SIZE;
2153− dma->div = OUTPUT_DMA_IRQ_DIV;
2259+ dma->num = dma_buf_num;
2260+ dma->size = dma_buf_size * 128 * 47;
2261+ dma->div = 1;
21542262 } else {
21552263 INIT_WORK(&dma->work, input_work);
21562264 dma->regs = rm->idma->base + rm->idma->size * nr;
21572265 dma->bufregs = rm->idma_buf->base + rm->idma_buf->size * nr;
2158− dma->num = INPUT_DMA_BUFS;
2159− dma->size = INPUT_DMA_SIZE;
2160− dma->div = INPUT_DMA_IRQ_DIV;
2266+ dma->num = dma_buf_num;
2267+ dma->size = dma_buf_size * 128 * 47;
2268+ dma->div = 1;
21612269 }
21622270 ddbwritel(io->port->dev, 0, DMA_BUFFER_ACK(dma));
21632271 dev_dbg(io->port->dev->dev, "init link %u, io %u, dma %u, dmaregs %08x bufregs %08x\n",
@@ -2190,8 +2298,7 @@ static void ddb_input_init(struct ddb_port *port, int nr, int pnr, int anr) · 26 unmodified lines
21902298 dev_dbg(dev->dev, "init link %u, input %u, handler %u\n",
21912299 port->lnr, nr, dma_nr + base);
21922300
2193− dev->handler[0][dma_nr + base] = input_handler;
2194− dev->handler_data[0][dma_nr + base] = (unsigned long)input;
2301+ ddb_irq_set(dev, 0, dma_nr + base, &input_handler, input);
21952302 ddb_dma_init(input, dma_nr, 0);
21962303 }
21972304 }
@@ -2216,8 +2323,7 @@ static void ddb_output_init(struct ddb_port *port, int nr) · 18 unmodified lines
22162323 const struct ddb_regmap *rm0 = io_regmap(output, 0);
22172324 u32 base = rm0->irq_base_odma;
22182325
2219− dev->handler[0][nr + base] = output_handler;
2220− dev->handler_data[0][nr + base] = (unsigned long)output;
2326+ ddb_irq_set(dev, 0, nr + base, &output_handler, output);
22212327 ddb_dma_init(output, nr, 1);
22222328 }
22232329 }
@@ -2329,6 +2435,7 @@ void ddb_ports_init(struct ddb *dev) · 105 unmodified lines
23292435 break;
23302436 case DDB_OCTOPUS_MAX:
23312437 case DDB_OCTOPUS_MAX_CT:
2438+ case DDB_OCTOPUS_MCI:
23322439 ddb_input_init(port, 2 * i, 0, 2 * p);
23332440 ddb_input_init(port, 2 * i + 1, 1, 2 * p + 1);
23342441 break;
@@ -2361,73 +2468,62 @@ void ddb_ports_release(struct ddb *dev) · 26 unmodified lines
23612468 /****************************************************************************/
23622469
23632470 #define IRQ_HANDLE(_nr) \
2364− do { if ((s & (1UL << ((_nr) & 0x1f))) && dev->handler[0][_nr]) \
2365− dev->handler[0][_nr](dev->handler_data[0][_nr]); } \
2471+ do { if ((s & (1UL << ((_nr) & 0x1f))) && \
2472+ dev->link[0].irq[_nr].handler) \
2473+ dev->link[0].irq[_nr].handler(dev->link[0].irq[_nr].data); } \
23662474 while (0)
23672475
2476+#define IRQ_HANDLE_NIBBLE(_shift) { \
2477+ if (s & (0x0000000f << ((_shift) & 0x1f))) { \
2478+ IRQ_HANDLE(0 + (_shift)); \
2479+ IRQ_HANDLE(1 + (_shift)); \
2480+ IRQ_HANDLE(2 + (_shift)); \
2481+ IRQ_HANDLE(3 + (_shift)); \
2482+ } \
2483+}
2484+
2485+#define IRQ_HANDLE_BYTE(_shift) { \
2486+ if (s & (0x000000ff << ((_shift) & 0x1f))) { \
2487+ IRQ_HANDLE(0 + (_shift)); \
2488+ IRQ_HANDLE(1 + (_shift)); \
2489+ IRQ_HANDLE(2 + (_shift)); \
2490+ IRQ_HANDLE(3 + (_shift)); \
2491+ IRQ_HANDLE(4 + (_shift)); \
2492+ IRQ_HANDLE(5 + (_shift)); \
2493+ IRQ_HANDLE(6 + (_shift)); \
2494+ IRQ_HANDLE(7 + (_shift)); \
2495+ } \
2496+}
2497+
23682498 static void irq_handle_msg(struct ddb *dev, u32 s)
23692499 {
23702500 dev->i2c_irq++;
2371− IRQ_HANDLE(0);
2372− IRQ_HANDLE(1);
2373− IRQ_HANDLE(2);
2374− IRQ_HANDLE(3);
2501+ IRQ_HANDLE_NIBBLE(0);
23752502 }
23762503
23772504 static void irq_handle_io(struct ddb *dev, u32 s)
23782505 {
23792506 dev->ts_irq++;
2380− if ((s & 0x000000f0)) {
2381− IRQ_HANDLE(4);
2382− IRQ_HANDLE(5);
2383− IRQ_HANDLE(6);
2384− IRQ_HANDLE(7);
2385− }
2386− if ((s & 0x0000ff00)) {
2387− IRQ_HANDLE(8);
2388− IRQ_HANDLE(9);
2389− IRQ_HANDLE(10);
2390− IRQ_HANDLE(11);
2391− IRQ_HANDLE(12);
2392− IRQ_HANDLE(13);
2393− IRQ_HANDLE(14);
2394− IRQ_HANDLE(15);
2395− }
2396− if ((s & 0x00ff0000)) {
2397− IRQ_HANDLE(16);
2398− IRQ_HANDLE(17);
2399− IRQ_HANDLE(18);
2400− IRQ_HANDLE(19);
2401− IRQ_HANDLE(20);
2402− IRQ_HANDLE(21);
2403− IRQ_HANDLE(22);
2404− IRQ_HANDLE(23);
2405− }
2406− if ((s & 0xff000000)) {
2407− IRQ_HANDLE(24);
2408− IRQ_HANDLE(25);
2409− IRQ_HANDLE(26);
2410− IRQ_HANDLE(27);
2411− IRQ_HANDLE(28);
2412− IRQ_HANDLE(29);
2413− IRQ_HANDLE(30);
2414− IRQ_HANDLE(31);
2415− }
2507+ IRQ_HANDLE_NIBBLE(4);
2508+ IRQ_HANDLE_BYTE(8);
2509+ IRQ_HANDLE_BYTE(16);
2510+ IRQ_HANDLE_BYTE(24);
24162511 }
24172512
24182513 irqreturn_t ddb_irq_handler0(int irq, void *dev_id)
24192514 {
24202515 struct ddb *dev = (struct ddb *)dev_id;
2421− u32 s = ddbreadl(dev, INTERRUPT_STATUS);
2516+ u32 mask = 0x8fffff00;
2517+ u32 s = mask & ddbreadl(dev, INTERRUPT_STATUS);
24222518
2519+ if (!s)
2520+ return IRQ_NONE;
24232521 do {
24242522 if (s & 0x80000000)
24252523 return IRQ_NONE;
2426− if (!(s & 0xfffff00))
2427− return IRQ_NONE;
2428− ddbwritel(dev, s & 0xfffff00, INTERRUPT_ACK);
2524+ ddbwritel(dev, s, INTERRUPT_ACK);
24292525 irq_handle_io(dev, s);
2430− } while ((s = ddbreadl(dev, INTERRUPT_STATUS)));
2526+ } while ((s = mask & ddbreadl(dev, INTERRUPT_STATUS)));
24312527
24322528 return IRQ_HANDLED;
24332529 }
@@ -2435,16 +2531,17 @@ irqreturn_t ddb_irq_handler0(int irq, void *dev_id) · 1 unmodified line
24352531 irqreturn_t ddb_irq_handler1(int irq, void *dev_id)
24362532 {
24372533 struct ddb *dev = (struct ddb *)dev_id;
2438− u32 s = ddbreadl(dev, INTERRUPT_STATUS);
2534+ u32 mask = 0x8000000f;
2535+ u32 s = mask & ddbreadl(dev, INTERRUPT_STATUS);
24392536
2537+ if (!s)
2538+ return IRQ_NONE;
24402539 do {
24412540 if (s & 0x80000000)
24422541 return IRQ_NONE;
2443− if (!(s & 0x0000f))
2444− return IRQ_NONE;
2445− ddbwritel(dev, s & 0x0000f, INTERRUPT_ACK);
2542+ ddbwritel(dev, s, INTERRUPT_ACK);
24462543 irq_handle_msg(dev, s);
2447− } while ((s = ddbreadl(dev, INTERRUPT_STATUS)));
2544+ } while ((s = mask & ddbreadl(dev, INTERRUPT_STATUS)));
24482545
24492546 return IRQ_HANDLED;
24502547 }
@@ -3027,7 +3124,7 @@ static struct class ddb_class = { · 576 unmodified lines
30273124 .devnode = ddb_devnode,
30283125 };
30293126
3030−int ddb_class_create(void)
3127+static int ddb_class_create(void)
30313128 {
30323129 ddb_major = register_chrdev(0, DDB_NAME, &ddb_fops);
30333130 if (ddb_major < 0)
@@ -3037,7 +3134,7 @@ int ddb_class_create(void) · 3 unmodified lines
30373134 return 0;
30383135 }
30393136
3040−void ddb_class_destroy(void)
3137+static void ddb_class_destroy(void)
30413138 {
30423139 class_unregister(&ddb_class);
30433140 unregister_chrdev(ddb_major, DDB_NAME);
@@ -3173,7 +3270,7 @@ static void tempmon_setfan(struct ddb_link *link) · 129 unmodified lines
31733270 ddblwritel(link, (pwm << 8), TEMPMON_FANCONTROL);
31743271 }
31753272
3176−static void temp_handler(unsigned long data)
3273+static void temp_handler(void *data)
31773274 {
31783275 struct ddb_link *link = (struct ddb_link *)data;
31793276
@@ -3196,8 +3293,7 @@ static int tempmon_init(struct ddb_link *link, int first_time) · 16 unmodified lines
31963293 memcpy(link->temp_tab, temperature_table,
31973294 sizeof(temperature_table));
31983295 }
3199− dev->handler[l][link->info->tempmon_irq] = temp_handler;
3200− dev->handler_data[l][link->info->tempmon_irq] = (unsigned long)link;
3296+ ddb_irq_set(dev, l, link->info->tempmon_irq, temp_handler, link);
32013297 ddblwritel(link, (TEMPMON_CONTROL_OVERTEMP | TEMPMON_CONTROL_AUTOSCAN |
32023298 TEMPMON_CONTROL_INTENABLE),
32033299 TEMPMON_CONTROL);
@@ -3309,3 +3405,38 @@ void ddb_unmap(struct ddb *dev) · 105 unmodified lines
33093405 iounmap(dev->regs);
33103406 vfree(dev);
33113407 }
3408+
3409+int ddb_exit_ddbridge(int stage, int error)
3410+{
3411+ switch (stage) {
3412+ default:
3413+ case 2:
3414+ destroy_workqueue(ddb_wq);
3415+ /* fall-through */
3416+ case 1:
3417+ ddb_class_destroy();
3418+ break;
3419+ }
3420+
3421+ return error;
3422+}
3423+
3424+int ddb_init_ddbridge(void)
3425+{
3426+ if (dma_buf_num < 8)
3427+ dma_buf_num = 8;
3428+ if (dma_buf_num > 32)
3429+ dma_buf_num = 32;
3430+ if (dma_buf_size < 1)
3431+ dma_buf_size = 1;
3432+ if (dma_buf_size > 43)
3433+ dma_buf_size = 43;
3434+
3435+ if (ddb_class_create() < 0)
3436+ return -1;
3437+ ddb_wq = alloc_workqueue("ddbridge", 0, 0);
3438+ if (!ddb_wq)
3439+ return ddb_exit_ddbridge(1, -1);
3440+
3441+ return 0;
3442+}
drivers/media/pci/ddbridge/ddbridge-hw.c+11−0
@@ -311,6 +311,16 @@ static const struct ddb_info ddb_s2_48 = { · 310 unmodified lines
311311 .tempmon_irq = 24,
312312 };
313313
314+static const struct ddb_info ddb_s2x_48 = {
315+ .type = DDB_OCTOPUS_MCI,
316+ .name = "Digital Devices MAX SX8",
317+ .regmap = &octopus_map,
318+ .port_num = 4,
319+ .i2c_mask = 0x00,
320+ .tempmon_irq = 24,
321+ .mci = 4
322+};
323+
314324 /****************************************************************************/
315325 /****************************************************************************/
316326 /****************************************************************************/
@@ -346,6 +356,7 @@ static const struct ddb_device_id ddb_device_ids[] = { · 29 unmodified lines
346356 DDB_DEVID(0x0008, 0x0036, ddb_isdbt_8),
347357 DDB_DEVID(0x0008, 0x0037, ddb_c2t2i_v0_8),
348358 DDB_DEVID(0x0008, 0x0038, ddb_c2t2i_8),
359+ DDB_DEVID(0x0009, 0x0025, ddb_s2x_48),
349360 DDB_DEVID(0x0006, 0x0039, ddb_ctv7),
350361 DDB_DEVID(0x0011, 0x0040, ddb_ci),
351362 DDB_DEVID(0x0011, 0x0041, ddb_cis),
drivers/media/pci/ddbridge/ddbridge-i2c.c+2−3
@@ -147,7 +147,7 @@ void ddb_i2c_release(struct ddb *dev) · 146 unmodified lines
147147 }
148148 }
149149
150−static void i2c_handler(unsigned long priv)
150+static void i2c_handler(void *priv)
151151 {
152152 struct ddb_i2c *i2c = (struct ddb_i2c *)priv;
153153
@@ -210,8 +210,7 @@ int ddb_i2c_init(struct ddb *dev) · 56 unmodified lines
210210 if (!(dev->link[l].info->i2c_mask & (1 << i)))
211211 continue;
212212 i2c = &dev->i2c[num];
213− dev->handler_data[l][i + base] = (unsigned long)i2c;
214− dev->handler[l][i + base] = i2c_handler;
213+ ddb_irq_set(dev, l, i + base, i2c_handler, i2c);
215214 stat = ddb_i2c_add(dev, i2c, regmap, l, i, num);
216215 if (stat)
217216 break;
drivers/media/pci/ddbridge/ddbridge-main.c+33−58
@@ -55,34 +55,6 @@ MODULE_PARM_DESC(msi, "Control MSI interrupts: 0-disable (default), 1-enable"); · 54 unmodified lines
5555 #endif
5656 #endif
5757
58−int ci_bitrate = 70000;
59−module_param(ci_bitrate, int, 0444);
60−MODULE_PARM_DESC(ci_bitrate, " Bitrate in KHz for output to CI.");
61−
62−int ts_loop = -1;
63−module_param(ts_loop, int, 0444);
64−MODULE_PARM_DESC(ts_loop, "TS in/out test loop on port ts_loop");
65−
66−int xo2_speed = 2;
67−module_param(xo2_speed, int, 0444);
68−MODULE_PARM_DESC(xo2_speed, "default transfer speed for xo2 based duoflex, 0=55,1=75,2=90,3=104 MBit/s, default=2, use attribute to change for individual cards");
69−
70−#ifdef __arm__
71−int alt_dma = 1;
72−#else
73−int alt_dma;
74−#endif
75−module_param(alt_dma, int, 0444);
76−MODULE_PARM_DESC(alt_dma, "use alternative DMA buffer handling");
77−
78−int no_init;
79−module_param(no_init, int, 0444);
80−MODULE_PARM_DESC(no_init, "do not initialize most devices");
81−
82−int stv0910_single;
83−module_param(stv0910_single, int, 0444);
84−MODULE_PARM_DESC(stv0910_single, "use stv0910 cards as single demods");
85−
8658 /****************************************************************************/
8759 /****************************************************************************/
8860 /****************************************************************************/
@@ -93,18 +65,22 @@ static void ddb_irq_disable(struct ddb *dev) · 4 unmodified lines
9365 ddbwritel(dev, 0, MSI1_ENABLE);
9466 }
9567
96−static void ddb_irq_exit(struct ddb *dev)
68+static void ddb_msi_exit(struct ddb *dev)
9769 {
98− ddb_irq_disable(dev);
99− if (dev->msi == 2)
100− free_irq(dev->pdev->irq + 1, dev);
101− free_irq(dev->pdev->irq, dev);
10270 #ifdef CONFIG_PCI_MSI
10371 if (dev->msi)
104− pci_disable_msi(dev->pdev);
72+ pci_free_irq_vectors(dev->pdev);
10573 #endif
10674 }
10775
76+static void ddb_irq_exit(struct ddb *dev)
77+{
78+ ddb_irq_disable(dev);
79+ if (dev->msi == 2)
80+ free_irq(pci_irq_vector(dev->pdev, 1), dev);
81+ free_irq(pci_irq_vector(dev->pdev, 0), dev);
82+}
83+
10884 static void ddb_remove(struct pci_dev *pdev)
10985 {
11086 struct ddb *dev = (struct ddb *)pci_get_drvdata(pdev);
@@ -114,6 +90,7 @@ static void ddb_remove(struct pci_dev *pdev) · 3 unmodified lines
11490 ddb_i2c_release(dev);
11591
11692 ddb_irq_exit(dev);
93+ ddb_msi_exit(dev);
11794 ddb_ports_release(dev);
11895 ddb_buffers_free(dev);
11996
@@ -128,7 +105,8 @@ static void ddb_irq_msi(struct ddb *dev, int nr) · 8 unmodified lines
128105 int stat;
129106
130107 if (msi && pci_msi_enabled()) {
131− stat = pci_alloc_irq_vectors(dev->pdev, 1, nr, PCI_IRQ_MSI);
108+ stat = pci_alloc_irq_vectors(dev->pdev, 1, nr,
109+ PCI_IRQ_MSI | PCI_IRQ_MSIX);
132110 if (stat >= 1) {
133111 dev->msi = stat;
134112 dev_info(dev->dev, "using %d MSI interrupt(s)\n",
@@ -160,21 +138,24 @@ static int ddb_irq_init(struct ddb *dev) · 25 unmodified lines
160138 if (dev->msi)
161139 irq_flag = 0;
162140 if (dev->msi == 2) {
163− stat = request_irq(dev->pdev->irq, ddb_irq_handler0,
164− irq_flag, "ddbridge", (void *)dev);
141+ stat = request_irq(pci_irq_vector(dev->pdev, 0),
142+ ddb_irq_handler0, irq_flag, "ddbridge",
143+ (void *)dev);
165144 if (stat < 0)
166145 return stat;
167− stat = request_irq(dev->pdev->irq + 1, ddb_irq_handler1,
168− irq_flag, "ddbridge", (void *)dev);
146+ stat = request_irq(pci_irq_vector(dev->pdev, 1),
147+ ddb_irq_handler1, irq_flag, "ddbridge",
148+ (void *)dev);
169149 if (stat < 0) {
170− free_irq(dev->pdev->irq, dev);
150+ free_irq(pci_irq_vector(dev->pdev, 0), dev);
171151 return stat;
172152 }
173153 } else
174154 #endif
175155 {
176− stat = request_irq(dev->pdev->irq, ddb_irq_handler,
177− irq_flag, "ddbridge", (void *)dev);
156+ stat = request_irq(pci_irq_vector(dev->pdev, 0),
157+ ddb_irq_handler, irq_flag, "ddbridge",
158+ (void *)dev);
178159 if (stat < 0)
179160 return stat;
180161 }
@@ -217,6 +198,7 @@ static int ddb_probe(struct pci_dev *pdev, · 36 unmodified lines
217198 dev->link[0].ids.device = id->device;
218199 dev->link[0].ids.subvendor = id->subvendor;
219200 dev->link[0].ids.subdevice = pdev->subsystem_device;
201+ dev->link[0].ids.devid = (id->device << 16) | id->vendor;
220202
221203 dev->link[0].dev = dev;
222204 dev->link[0].info = get_ddb_info(id->vendor, id->device,
@@ -258,8 +240,7 @@ static int ddb_probe(struct pci_dev *pdev, · 35 unmodified lines
258240 ddb_irq_exit(dev);
259241 fail0:
260242 dev_err(&pdev->dev, "fail0\n");
261− if (dev->msi)
262− pci_disable_msi(dev->pdev);
243+ ddb_msi_exit(dev);
263244 fail:
264245 dev_err(&pdev->dev, "fail\n");
265246
@@ -283,6 +264,7 @@ static const struct pci_device_id ddb_id_table[] = { · 17 unmodified lines
283264 DDB_DEVICE_ANY(0x0006),
284265 DDB_DEVICE_ANY(0x0007),
285266 DDB_DEVICE_ANY(0x0008),
267+ DDB_DEVICE_ANY(0x0009),
286268 DDB_DEVICE_ANY(0x0011),
287269 DDB_DEVICE_ANY(0x0012),
288270 DDB_DEVICE_ANY(0x0013),
@@ -310,32 +292,25 @@ static struct pci_driver ddb_pci_driver = { · 21 unmodified lines
310292
311293 static __init int module_init_ddbridge(void)
312294 {
313− int stat = -1;
295+ int stat;
314296
315297 pr_info("Digital Devices PCIE bridge driver "
316298 DDBRIDGE_VERSION
317299 ", Copyright (C) 2010-17 Digital Devices GmbH\n");
318− if (ddb_class_create() < 0)
319− return -1;
320− ddb_wq = create_workqueue("ddbridge");
321− if (!ddb_wq)
322− goto exit1;
300+ stat = ddb_init_ddbridge();
301+ if (stat < 0)
302+ return stat;
323303 stat = pci_register_driver(&ddb_pci_driver);
324304 if (stat < 0)
325− goto exit2;
326− return stat;
327−exit2:
328− destroy_workqueue(ddb_wq);
329−exit1:
330− ddb_class_destroy();
305+ ddb_exit_ddbridge(0, stat);
306+
331307 return stat;
332308 }
333309
334310 static __exit void module_exit_ddbridge(void)
335311 {
336312 pci_unregister_driver(&ddb_pci_driver);
337− destroy_workqueue(ddb_wq);
338− ddb_class_destroy();
313+ ddb_exit_ddbridge(0, 0);
339314 }
340315
341316 module_init(module_init_ddbridge);
drivers/media/pci/ddbridge/ddbridge-max.c+42−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include "ddbridge.h"
3434 #include "ddbridge-regs.h"
3535 #include "ddbridge-io.h"
36+#include "ddbridge-mci.h"
3637
3738 #include "ddbridge-max.h"
3839 #include "mxl5xx.h"
@@ -452,3 +453,44 @@ int ddb_fe_attach_mxl5xx(struct ddb_input *input) · 413 unmodified lines
452453 dvb->input = tuner;
453454 return 0;
454455 }
456+
457+/******************************************************************************/
458+/* MAX MCI related functions */
459+
460+int ddb_fe_attach_mci(struct ddb_input *input)
461+{
462+ struct ddb *dev = input->port->dev;
463+ struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1];
464+ struct ddb_port *port = input->port;
465+ struct ddb_link *link = &dev->link[port->lnr];
466+ int demod, tuner;
467+
468+ demod = input->nr;
469+ tuner = demod & 3;
470+ if (fmode == 3)
471+ tuner = 0;
472+ dvb->fe = ddb_mci_attach(input, 0, demod, &dvb->set_input);
473+ if (!dvb->fe) {
474+ dev_err(dev->dev, "No MAXSX8 found!\n");
475+ return -ENODEV;
476+ }
477+ if (!dvb->set_input) {
478+ dev_err(dev->dev, "No MCI set_input function pointer!\n");
479+ return -ENODEV;
480+ }
481+ if (input->nr < 4) {
482+ lnb_command(dev, port->lnr, input->nr, LNB_CMD_INIT);
483+ lnb_set_voltage(dev, port->lnr, input->nr, SEC_VOLTAGE_OFF);
484+ }
485+ ddb_lnb_init_fmode(dev, link, fmode);
486+
487+ dvb->fe->ops.set_voltage = max_set_voltage;
488+ dvb->fe->ops.enable_high_lnb_voltage = max_enable_high_lnb_voltage;
489+ dvb->fe->ops.set_tone = max_set_tone;
490+ dvb->diseqc_send_master_cmd = dvb->fe->ops.diseqc_send_master_cmd;
491+ dvb->fe->ops.diseqc_send_master_cmd = max_send_master_cmd;
492+ dvb->fe->ops.diseqc_send_burst = max_send_burst;
493+ dvb->fe->sec_priv = input;
494+ dvb->input = tuner;
495+ return 0;
496+}
drivers/media/pci/ddbridge/ddbridge-max.h+1−0
@@ -25,5 +25,6 @@ · 24 unmodified lines
2525
2626 int ddb_lnb_init_fmode(struct ddb *dev, struct ddb_link *link, u32 fm);
2727 int ddb_fe_attach_mxl5xx(struct ddb_input *input);
28+int ddb_fe_attach_mci(struct ddb_input *input);
2829
2930 #endif /* _DDBRIDGE_MAX_H */
drivers/media/pci/ddbridge/ddbridge-mci.c+551−0
@@ -0,0 +1,551 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * ddbridge-mci.c: Digital Devices microcode interface
4+ *
5+ * Copyright (C) 2017 Digital Devices GmbH
6+ * Ralph Metzler <rjkm@metzlerbros.de>
7+ * Marcus Metzler <mocm@metzlerbros.de>
8+ *
9+ * This program is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU General Public License
11+ * version 2 only, as published by the Free Software Foundation.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU General Public License for more details.
17+ */
18+
19+#include "ddbridge.h"
20+#include "ddbridge-io.h"
21+#include "ddbridge-mci.h"
22+
23+static LIST_HEAD(mci_list);
24+
25+static const u32 MCLK = (1550000000 / 12);
26+static const u32 MAX_DEMOD_LDPC_BITRATE = (1550000000 / 6);
27+static const u32 MAX_LDPC_BITRATE = (720000000);
28+
29+struct mci_base {
30+ struct list_head mci_list;
31+ void *key;
32+ struct ddb_link *link;
33+ struct completion completion;
34+
35+ struct device *dev;
36+ struct mutex tuner_lock; /* concurrent tuner access lock */
37+ u8 adr;
38+ struct mutex mci_lock; /* concurrent MCI access lock */
39+ int count;
40+
41+ u8 tuner_use_count[MCI_TUNER_MAX];
42+ u8 assigned_demod[MCI_DEMOD_MAX];
43+ u32 used_ldpc_bitrate[MCI_DEMOD_MAX];
44+ u8 demod_in_use[MCI_DEMOD_MAX];
45+ u32 iq_mode;
46+};
47+
48+struct mci {
49+ struct mci_base *base;
50+ struct dvb_frontend fe;
51+ int nr;
52+ int demod;
53+ int tuner;
54+ int first_time_lock;
55+ int started;
56+ struct mci_result signal_info;
57+
58+ u32 bb_mode;
59+};
60+
61+static int mci_reset(struct mci *state)
62+{
63+ struct ddb_link *link = state->base->link;
64+ u32 status = 0;
65+ u32 timeout = 40;
66+
67+ ddblwritel(link, MCI_CONTROL_RESET, MCI_CONTROL);
68+ ddblwritel(link, 0, MCI_CONTROL + 4); /* 1= no internal init */
69+ msleep(300);
70+ ddblwritel(link, 0, MCI_CONTROL);
71+
72+ while (1) {
73+ status = ddblreadl(link, MCI_CONTROL);
74+ if ((status & MCI_CONTROL_READY) == MCI_CONTROL_READY)
75+ break;
76+ if (--timeout == 0)
77+ break;
78+ msleep(50);
79+ }
80+ if ((status & MCI_CONTROL_READY) == 0)
81+ return -1;
82+ if (link->ids.device == 0x0009)
83+ ddblwritel(link, SX8_TSCONFIG_MODE_NORMAL, SX8_TSCONFIG);
84+ return 0;
85+}
86+
87+static int mci_config(struct mci *state, u32 config)
88+{
89+ struct ddb_link *link = state->base->link;
90+
91+ if (link->ids.device != 0x0009)
92+ return -EINVAL;
93+ ddblwritel(link, config, SX8_TSCONFIG);
94+ return 0;
95+}
96+
97+static int _mci_cmd_unlocked(struct mci *state,
98+ u32 *cmd, u32 cmd_len,
99+ u32 *res, u32 res_len)
100+{
101+ struct ddb_link *link = state->base->link;
102+ u32 i, val;
103+ unsigned long stat;
104+
105+ val = ddblreadl(link, MCI_CONTROL);
106+ if (val & (MCI_CONTROL_RESET | MCI_CONTROL_START_COMMAND))
107+ return -EIO;
108+ if (cmd && cmd_len)
109+ for (i = 0; i < cmd_len; i++)
110+ ddblwritel(link, cmd[i], MCI_COMMAND + i * 4);
111+ val |= (MCI_CONTROL_START_COMMAND | MCI_CONTROL_ENABLE_DONE_INTERRUPT);
112+ ddblwritel(link, val, MCI_CONTROL);
113+
114+ stat = wait_for_completion_timeout(&state->base->completion, HZ);
115+ if (stat == 0) {
116+ dev_warn(state->base->dev, "MCI-%d: MCI timeout\n", state->nr);
117+ return -EIO;
118+ }
119+ if (res && res_len)
120+ for (i = 0; i < res_len; i++)
121+ res[i] = ddblreadl(link, MCI_RESULT + i * 4);
122+ return 0;
123+}
124+
125+static int mci_cmd(struct mci *state,
126+ struct mci_command *command,
127+ struct mci_result *result)
128+{
129+ int stat;
130+
131+ mutex_lock(&state->base->mci_lock);
132+ stat = _mci_cmd_unlocked(state,
133+ (u32 *)command, sizeof(*command) / sizeof(u32),
134+ (u32 *)result, sizeof(*result) / sizeof(u32));
135+ mutex_unlock(&state->base->mci_lock);
136+ return stat;
137+}
138+
139+static void mci_handler(void *priv)
140+{
141+ struct mci_base *base = (struct mci_base *)priv;
142+
143+ complete(&base->completion);
144+}
145+
146+static void release(struct dvb_frontend *fe)
147+{
148+ struct mci *state = fe->demodulator_priv;
149+
150+ state->base->count--;
151+ if (state->base->count == 0) {
152+ list_del(&state->base->mci_list);
153+ kfree(state->base);
154+ }
155+ kfree(state);
156+}
157+
158+static int read_status(struct dvb_frontend *fe, enum fe_status *status)
159+{
160+ int stat;
161+ struct mci *state = fe->demodulator_priv;
162+ struct mci_command cmd;
163+ struct mci_result res;
164+
165+ cmd.command = MCI_CMD_GETSTATUS;
166+ cmd.demod = state->demod;
167+ stat = mci_cmd(state, &cmd, &res);
168+ if (stat)
169+ return stat;
170+ *status = 0x00;
171+ if (res.status == SX8_DEMOD_WAIT_MATYPE)
172+ *status = 0x0f;
173+ if (res.status == SX8_DEMOD_LOCKED)
174+ *status = 0x1f;
175+ return stat;
176+}
177+
178+static int mci_set_tuner(struct dvb_frontend *fe, u32 tuner, u32 on)
179+{
180+ struct mci *state = fe->demodulator_priv;
181+ struct mci_command cmd;
182+
183+ memset(&cmd, 0, sizeof(cmd));
184+ cmd.tuner = state->tuner;
185+ cmd.command = on ? SX8_CMD_INPUT_ENABLE : SX8_CMD_INPUT_DISABLE;
186+ return mci_cmd(state, &cmd, NULL);
187+}
188+
189+static int stop(struct dvb_frontend *fe)
190+{
191+ struct mci *state = fe->demodulator_priv;
192+ struct mci_command cmd;
193+ u32 input = state->tuner;
194+
195+ memset(&cmd, 0, sizeof(cmd));
196+ if (state->demod != DEMOD_UNUSED) {
197+ cmd.command = MCI_CMD_STOP;
198+ cmd.demod = state->demod;
199+ mci_cmd(state, &cmd, NULL);
200+ if (state->base->iq_mode) {
201+ cmd.command = MCI_CMD_STOP;
202+ cmd.demod = state->demod;
203+ cmd.output = 0;
204+ mci_cmd(state, &cmd, NULL);
205+ mci_config(state, SX8_TSCONFIG_MODE_NORMAL);
206+ }
207+ }
208+ mutex_lock(&state->base->tuner_lock);
209+ state->base->tuner_use_count[input]--;
210+ if (!state->base->tuner_use_count[input])
211+ mci_set_tuner(fe, input, 0);
212+ if (state->demod < MCI_DEMOD_MAX)
213+ state->base->demod_in_use[state->demod] = 0;
214+ state->base->used_ldpc_bitrate[state->nr] = 0;
215+ state->demod = DEMOD_UNUSED;
216+ state->base->assigned_demod[state->nr] = DEMOD_UNUSED;
217+ state->base->iq_mode = 0;
218+ mutex_unlock(&state->base->tuner_lock);
219+ state->started = 0;
220+ return 0;
221+}
222+
223+static int start(struct dvb_frontend *fe, u32 flags, u32 modmask, u32 ts_config)
224+{
225+ struct mci *state = fe->demodulator_priv;
226+ struct dtv_frontend_properties *p = &fe->dtv_property_cache;
227+ u32 used_ldpc_bitrate = 0, free_ldpc_bitrate;
228+ u32 used_demods = 0;
229+ struct mci_command cmd;
230+ u32 input = state->tuner;
231+ u32 bits_per_symbol = 0;
232+ int i, stat = 0;
233+
234+ if (p->symbol_rate >= (MCLK / 2))
235+ flags &= ~1;
236+ if ((flags & 3) == 0)
237+ return -EINVAL;
238+
239+ if (flags & 2) {
240+ u32 tmp = modmask;
241+
242+ bits_per_symbol = 1;
243+ while (tmp & 1) {
244+ tmp >>= 1;
245+ bits_per_symbol++;
246+ }
247+ }
248+
249+ mutex_lock(&state->base->tuner_lock);
250+ if (state->base->iq_mode) {
251+ stat = -EBUSY;
252+ goto unlock;
253+ }
254+ for (i = 0; i < MCI_DEMOD_MAX; i++) {
255+ used_ldpc_bitrate += state->base->used_ldpc_bitrate[i];
256+ if (state->base->demod_in_use[i])
257+ used_demods++;
258+ }
259+ if (used_ldpc_bitrate >= MAX_LDPC_BITRATE ||
260+ ((ts_config & SX8_TSCONFIG_MODE_MASK) >
261+ SX8_TSCONFIG_MODE_NORMAL && used_demods > 0)) {
262+ stat = -EBUSY;
263+ goto unlock;
264+ }
265+ free_ldpc_bitrate = MAX_LDPC_BITRATE - used_ldpc_bitrate;
266+ if (free_ldpc_bitrate > MAX_DEMOD_LDPC_BITRATE)
267+ free_ldpc_bitrate = MAX_DEMOD_LDPC_BITRATE;
268+
269+ while (p->symbol_rate * bits_per_symbol > free_ldpc_bitrate)
270+ bits_per_symbol--;
271+
272+ if (bits_per_symbol < 2) {
273+ stat = -EBUSY;
274+ goto unlock;
275+ }
276+ i = (p->symbol_rate > (MCLK / 2)) ? 3 : 7;
277+ while (i >= 0 && state->base->demod_in_use[i])
278+ i--;
279+ if (i < 0) {
280+ stat = -EBUSY;
281+ goto unlock;
282+ }
283+ state->base->demod_in_use[i] = 1;
284+ state->base->used_ldpc_bitrate[state->nr] = p->symbol_rate
285+ * bits_per_symbol;
286+ state->demod = i;
287+ state->base->assigned_demod[state->nr] = i;
288+
289+ if (!state->base->tuner_use_count[input])
290+ mci_set_tuner(fe, input, 1);
291+ state->base->tuner_use_count[input]++;
292+ state->base->iq_mode = (ts_config > 1);
293+unlock:
294+ mutex_unlock(&state->base->tuner_lock);
295+ if (stat)
296+ return stat;
297+ memset(&cmd, 0, sizeof(cmd));
298+
299+ if (state->base->iq_mode) {
300+ cmd.command = SX8_CMD_SELECT_IQOUT;
301+ cmd.demod = state->demod;
302+ cmd.output = 0;
303+ mci_cmd(state, &cmd, NULL);
304+ mci_config(state, ts_config);
305+ }
306+ if (p->stream_id != NO_STREAM_ID_FILTER && p->stream_id != 0x80000000)
307+ flags |= 0x80;
308+ dev_dbg(state->base->dev, "MCI-%d: tuner=%d demod=%d\n",
309+ state->nr, state->tuner, state->demod);
310+ cmd.command = MCI_CMD_SEARCH_DVBS;
311+ cmd.dvbs2_search.flags = flags;
312+ cmd.dvbs2_search.s2_modulation_mask =
313+ modmask & ((1 << (bits_per_symbol - 1)) - 1);
314+ cmd.dvbs2_search.retry = 2;
315+ cmd.dvbs2_search.frequency = p->frequency * 1000;
316+ cmd.dvbs2_search.symbol_rate = p->symbol_rate;
317+ cmd.dvbs2_search.scrambling_sequence_index =
318+ p->scrambling_sequence_index;
319+ cmd.dvbs2_search.input_stream_id =
320+ (p->stream_id != NO_STREAM_ID_FILTER) ? p->stream_id : 0;
321+ cmd.tuner = state->tuner;
322+ cmd.demod = state->demod;
323+ cmd.output = state->nr;
324+ if (p->stream_id == 0x80000000)
325+ cmd.output |= 0x80;
326+ stat = mci_cmd(state, &cmd, NULL);
327+ if (stat)
328+ stop(fe);
329+ return stat;
330+}
331+
332+static int start_iq(struct dvb_frontend *fe, u32 ts_config)
333+{
334+ struct mci *state = fe->demodulator_priv;
335+ struct dtv_frontend_properties *p = &fe->dtv_property_cache;
336+ u32 used_demods = 0;
337+ struct mci_command cmd;
338+ u32 input = state->tuner;
339+ int i, stat = 0;
340+
341+ mutex_lock(&state->base->tuner_lock);
342+ if (state->base->iq_mode) {
343+ stat = -EBUSY;
344+ goto unlock;
345+ }
346+ for (i = 0; i < MCI_DEMOD_MAX; i++)
347+ if (state->base->demod_in_use[i])
348+ used_demods++;
349+ if (used_demods > 0) {
350+ stat = -EBUSY;
351+ goto unlock;
352+ }
353+ state->demod = 0;
354+ state->base->assigned_demod[state->nr] = 0;
355+ if (!state->base->tuner_use_count[input])
356+ mci_set_tuner(fe, input, 1);
357+ state->base->tuner_use_count[input]++;
358+ state->base->iq_mode = (ts_config > 1);
359+unlock:
360+ mutex_unlock(&state->base->tuner_lock);
361+ if (stat)
362+ return stat;
363+
364+ memset(&cmd, 0, sizeof(cmd));
365+ cmd.command = SX8_CMD_START_IQ;
366+ cmd.dvbs2_search.frequency = p->frequency * 1000;
367+ cmd.dvbs2_search.symbol_rate = p->symbol_rate;
368+ cmd.tuner = state->tuner;
369+ cmd.demod = state->demod;
370+ cmd.output = 7;
371+ mci_config(state, ts_config);
372+ stat = mci_cmd(state, &cmd, NULL);
373+ if (stat)
374+ stop(fe);
375+ return stat;
376+}
377+
378+static int set_parameters(struct dvb_frontend *fe)
379+{
380+ int stat = 0;
381+ struct mci *state = fe->demodulator_priv;
382+ struct dtv_frontend_properties *p = &fe->dtv_property_cache;
383+ u32 ts_config, iq_mode = 0, isi;
384+
385+ if (state->started)
386+ stop(fe);
387+
388+ isi = p->stream_id;
389+ if (isi != NO_STREAM_ID_FILTER)
390+ iq_mode = (isi & 0x30000000) >> 28;
391+
392+ switch (iq_mode) {
393+ case 1:
394+ ts_config = (SX8_TSCONFIG_TSHEADER | SX8_TSCONFIG_MODE_IQ);
395+ break;
396+ case 2:
397+ ts_config = (SX8_TSCONFIG_TSHEADER | SX8_TSCONFIG_MODE_IQ);
398+ break;
399+ default:
400+ ts_config = SX8_TSCONFIG_MODE_NORMAL;
401+ break;
402+ }
403+
404+ if (iq_mode != 2) {
405+ u32 flags = 3;
406+ u32 mask = 3;
407+
408+ if (p->modulation == APSK_16 ||
409+ p->modulation == APSK_32) {
410+ flags = 2;
411+ mask = 15;
412+ }
413+ stat = start(fe, flags, mask, ts_config);
414+ } else {
415+ stat = start_iq(fe, ts_config);
416+ }
417+
418+ if (!stat) {
419+ state->started = 1;
420+ state->first_time_lock = 1;
421+ state->signal_info.status = SX8_DEMOD_WAIT_SIGNAL;
422+ }
423+
424+ return stat;
425+}
426+
427+static int tune(struct dvb_frontend *fe, bool re_tune,
428+ unsigned int mode_flags,
429+ unsigned int *delay, enum fe_status *status)
430+{
431+ int r;
432+
433+ if (re_tune) {
434+ r = set_parameters(fe);
435+ if (r)
436+ return r;
437+ }
438+ r = read_status(fe, status);
439+ if (r)
440+ return r;
441+
442+ if (*status & FE_HAS_LOCK)
443+ return 0;
444+ *delay = HZ / 10;
445+ return 0;
446+}
447+
448+static enum dvbfe_algo get_algo(struct dvb_frontend *fe)
449+{
450+ return DVBFE_ALGO_HW;
451+}
452+
453+static int set_input(struct dvb_frontend *fe, int input)
454+{
455+ struct mci *state = fe->demodulator_priv;
456+
457+ state->tuner = input;
458+ dev_dbg(state->base->dev, "MCI-%d: input=%d\n", state->nr, input);
459+ return 0;
460+}
461+
462+static struct dvb_frontend_ops mci_ops = {
463+ .delsys = { SYS_DVBS, SYS_DVBS2 },
464+ .info = {
465+ .name = "Digital Devices MaxSX8 MCI DVB-S/S2/S2X",
466+ .frequency_min = 950000,
467+ .frequency_max = 2150000,
468+ .frequency_stepsize = 0,
469+ .frequency_tolerance = 0,
470+ .symbol_rate_min = 100000,
471+ .symbol_rate_max = 100000000,
472+ .caps = FE_CAN_INVERSION_AUTO |
473+ FE_CAN_FEC_AUTO |
474+ FE_CAN_QPSK |
475+ FE_CAN_2G_MODULATION |
476+ FE_CAN_MULTISTREAM,
477+ },
478+ .get_frontend_algo = get_algo,
479+ .tune = tune,
480+ .release = release,
481+ .read_status = read_status,
482+};
483+
484+static struct mci_base *match_base(void *key)
485+{
486+ struct mci_base *p;
487+
488+ list_for_each_entry(p, &mci_list, mci_list)
489+ if (p->key == key)
490+ return p;
491+ return NULL;
492+}
493+
494+static int probe(struct mci *state)
495+{
496+ mci_reset(state);
497+ return 0;
498+}
499+
500+struct dvb_frontend
501+*ddb_mci_attach(struct ddb_input *input,
502+ int mci_type, int nr,
503+ int (**fn_set_input)(struct dvb_frontend *fe, int input))
504+{
505+ struct ddb_port *port = input->port;
506+ struct ddb *dev = port->dev;
507+ struct ddb_link *link = &dev->link[port->lnr];
508+ struct mci_base *base;
509+ struct mci *state;
510+ void *key = mci_type ? (void *)port : (void *)link;
511+
512+ state = kzalloc(sizeof(*state), GFP_KERNEL);
513+ if (!state)
514+ return NULL;
515+
516+ base = match_base(key);
517+ if (base) {
518+ base->count++;
519+ state->base = base;
520+ } else {
521+ base = kzalloc(sizeof(*base), GFP_KERNEL);
522+ if (!base)
523+ goto fail;
524+ base->key = key;
525+ base->count = 1;
526+ base->link = link;
527+ base->dev = dev->dev;
528+ mutex_init(&base->mci_lock);
529+ mutex_init(&base->tuner_lock);
530+ ddb_irq_set(dev, link->nr, 0, mci_handler, base);
531+ init_completion(&base->completion);
532+ state->base = base;
533+ if (probe(state) < 0) {
534+ kfree(base);
535+ goto fail;
536+ }
537+ list_add(&base->mci_list, &mci_list);
538+ }
539+ state->fe.ops = mci_ops;
540+ state->fe.demodulator_priv = state;
541+ state->nr = nr;
542+ *fn_set_input = set_input;
543+
544+ state->tuner = nr;
545+ state->demod = nr;
546+
547+ return &state->fe;
548+fail:
549+ kfree(state);
550+ return NULL;
551+}
drivers/media/pci/ddbridge/ddbridge-mci.h+156−0
@@ -0,0 +1,156 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
2+/*
3+ * ddbridge-mci.h: Digital Devices micro code interface
4+ *
5+ * Copyright (C) 2017 Digital Devices GmbH
6+ * Marcus Metzler <mocm@metzlerbros.de>
7+ * Ralph Metzler <rjkm@metzlerbros.de>
8+ *
9+ * This program is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU General Public License
11+ * version 2 only, as published by the Free Software Foundation.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU General Public License for more details.
17+ */
18+
19+#ifndef _DDBRIDGE_MCI_H_
20+#define _DDBRIDGE_MCI_H_
21+
22+#define MCI_DEMOD_MAX 8
23+#define MCI_TUNER_MAX 4
24+#define DEMOD_UNUSED (0xFF)
25+
26+#define MCI_CONTROL (0x500)
27+#define MCI_COMMAND (0x600)
28+#define MCI_RESULT (0x680)
29+
30+#define MCI_COMMAND_SIZE (0x80)
31+#define MCI_RESULT_SIZE (0x80)
32+
33+#define MCI_CONTROL_START_COMMAND (0x00000001)
34+#define MCI_CONTROL_ENABLE_DONE_INTERRUPT (0x00000002)
35+#define MCI_CONTROL_RESET (0x00008000)
36+#define MCI_CONTROL_READY (0x00010000)
37+
38+#define SX8_TSCONFIG (0x280)
39+
40+#define SX8_TSCONFIG_MODE_MASK (0x00000003)
41+#define SX8_TSCONFIG_MODE_OFF (0x00000000)
42+#define SX8_TSCONFIG_MODE_NORMAL (0x00000001)
43+#define SX8_TSCONFIG_MODE_IQ (0x00000003)
44+
45+#define SX8_TSCONFIG_TSHEADER (0x00000004)
46+#define SX8_TSCONFIG_BURST (0x00000008)
47+
48+#define SX8_TSCONFIG_BURSTSIZE_MASK (0x00000030)
49+#define SX8_TSCONFIG_BURSTSIZE_2K (0x00000000)
50+#define SX8_TSCONFIG_BURSTSIZE_4K (0x00000010)
51+#define SX8_TSCONFIG_BURSTSIZE_8K (0x00000020)
52+#define SX8_TSCONFIG_BURSTSIZE_16K (0x00000030)
53+
54+#define SX8_DEMOD_STOPPED (0)
55+#define SX8_DEMOD_IQ_MODE (1)
56+#define SX8_DEMOD_WAIT_SIGNAL (2)
57+#define SX8_DEMOD_WAIT_MATYPE (3)
58+#define SX8_DEMOD_TIMEOUT (14)
59+#define SX8_DEMOD_LOCKED (15)
60+
61+#define MCI_CMD_STOP (0x01)
62+#define MCI_CMD_GETSTATUS (0x02)
63+#define MCI_CMD_GETSIGNALINFO (0x03)
64+#define MCI_CMD_RFPOWER (0x04)
65+
66+#define MCI_CMD_SEARCH_DVBS (0x10)
67+
68+#define MCI_CMD_GET_IQSYMBOL (0x30)
69+
70+#define SX8_CMD_INPUT_ENABLE (0x40)
71+#define SX8_CMD_INPUT_DISABLE (0x41)
72+#define SX8_CMD_START_IQ (0x42)
73+#define SX8_CMD_STOP_IQ (0x43)
74+#define SX8_CMD_SELECT_IQOUT (0x44)
75+#define SX8_CMD_SELECT_TSOUT (0x45)
76+
77+#define SX8_ERROR_UNSUPPORTED (0x80)
78+
79+#define SX8_SUCCESS(status) (status < SX8_ERROR_UNSUPPORTED)
80+
81+#define SX8_CMD_DIAG_READ8 (0xE0)
82+#define SX8_CMD_DIAG_READ32 (0xE1)
83+#define SX8_CMD_DIAG_WRITE8 (0xE2)
84+#define SX8_CMD_DIAG_WRITE32 (0xE3)
85+
86+#define SX8_CMD_DIAG_READRF (0xE8)
87+#define SX8_CMD_DIAG_WRITERF (0xE9)
88+
89+struct mci_command {
90+ union {
91+ u32 command_word;
92+ struct {
93+ u8 command;
94+ u8 tuner;
95+ u8 demod;
96+ u8 output;
97+ };
98+ };
99+ union {
100+ u32 params[31];
101+ struct {
102+ u8 flags;
103+ u8 s2_modulation_mask;
104+ u8 rsvd1;
105+ u8 retry;
106+ u32 frequency;
107+ u32 symbol_rate;
108+ u8 input_stream_id;
109+ u8 rsvd2[3];
110+ u32 scrambling_sequence_index;
111+ } dvbs2_search;
112+ };
113+};
114+
115+struct mci_result {
116+ union {
117+ u32 status_word;
118+ struct {
119+ u8 status;
120+ u8 rsvd;
121+ u16 time;
122+ };
123+ };
124+ union {
125+ u32 result[27];
126+ struct {
127+ u8 standard;
128+ /* puncture rate for DVB-S */
129+ u8 pls_code;
130+ /* 7-6: rolloff, 5-2: rsrvd, 1:short, 0:pilots */
131+ u8 roll_off;
132+ u8 rsvd;
133+ u32 frequency;
134+ u32 symbol_rate;
135+ s16 channel_power;
136+ s16 band_power;
137+ s16 signal_to_noise;
138+ s16 rsvd2;
139+ u32 packet_errors;
140+ u32 ber_numerator;
141+ u32 ber_denominator;
142+ } dvbs2_signal_info;
143+ struct {
144+ u8 i_symbol;
145+ u8 q_symbol;
146+ } dvbs2_signal_iq;
147+ };
148+ u32 version[4];
149+};
150+
151+struct dvb_frontend
152+*ddb_mci_attach(struct ddb_input *input,
153+ int mci_type, int nr,
154+ int (**fn_set_input)(struct dvb_frontend *fe, int input));
155+
156+#endif /* _DDBRIDGE_MCI_H_ */
drivers/media/pci/ddbridge/ddbridge-regs.h+4−0
@@ -17,6 +17,9 @@ · 16 unmodified lines
1717 * http://www.gnu.org/copyleft/gpl.html
1818 */
1919
20+#ifndef __DDBRIDGE_REGS_H__
21+#define __DDBRIDGE_REGS_H__
22+
2023 /* ------------------------------------------------------------------------- */
2124 /* SPI Controller */
2225
@@ -154,3 +157,4 @@ · 131 unmodified lines
154157 #define LNB_BUF_LEVEL(i) (LNB_BASE + (i) * 0x20 + 0x10)
155158 #define LNB_BUF_WRITE(i) (LNB_BASE + (i) * 0x20 + 0x14)
156159
160+#endif /* __DDBRIDGE_REGS_H__ */
drivers/media/pci/ddbridge/ddbridge.h+19−31
@@ -63,7 +63,7 @@ · 62 unmodified lines
6363 #include <media/dvb_ca_en50221.h>
6464 #include <media/dvb_net.h>
6565
66−#define DDBRIDGE_VERSION "0.9.32-integrated"
66+#define DDBRIDGE_VERSION "0.9.33-integrated"
6767
6868 #define DDB_MAX_I2C 32
6969 #define DDB_MAX_PORT 32
@@ -112,11 +112,12 @@ struct ddb_ids { · 42 unmodified lines
112112
113113 struct ddb_info {
114114 int type;
115−#define DDB_NONE 0
116−#define DDB_OCTOPUS 1
117−#define DDB_OCTOPUS_CI 2
118−#define DDB_OCTOPUS_MAX 5
115+#define DDB_NONE 0
116+#define DDB_OCTOPUS 1
117+#define DDB_OCTOPUS_CI 2
118+#define DDB_OCTOPUS_MAX 5
119119 #define DDB_OCTOPUS_MAX_CT 6
120+#define DDB_OCTOPUS_MCI 9
120121 char *name;
121122 u32 i2c_mask;
122123 u8 port_num;
@@ -133,23 +134,12 @@ struct ddb_info { · 10 unmodified lines
133134 #define TS_QUIRK_REVERSED 2
134135 #define TS_QUIRK_ALT_OSC 8
135136 u32 tempmon_irq;
137+ u8 mci;
136138 const struct ddb_regmap *regmap;
137139 };
138140
139−/* DMA_SIZE MUST be smaller than 256k and
140− * MUST be divisible by 188 and 128 !!!
141− */
142−
143141 #define DMA_MAX_BUFS 32 /* hardware table limit */
144142
145−#define INPUT_DMA_BUFS 8
146−#define INPUT_DMA_SIZE (128 * 47 * 21)
147−#define INPUT_DMA_IRQ_DIV 1
148−
149−#define OUTPUT_DMA_BUFS 8
150−#define OUTPUT_DMA_SIZE (128 * 47 * 21)
151−#define OUTPUT_DMA_IRQ_DIV 1
152−
153143 struct ddb;
154144 struct ddb_port;
155145
@@ -248,6 +238,7 @@ struct ddb_port { · 92 unmodified lines
248238 char *name;
249239 char *type_name;
250240 u32 type;
241+#define DDB_TUNER_DUMMY 0xffffffff
251242 #define DDB_TUNER_NONE 0
252243 #define DDB_TUNER_DVBS_ST 1
253244 #define DDB_TUNER_DVBS_ST_AA 2
@@ -264,6 +255,7 @@ struct ddb_port { · 10 unmodified lines
264255 #define DDB_CI_EXTERNAL_XO2_B 13
265256 #define DDB_TUNER_DVBS_STV0910_PR 14
266257 #define DDB_TUNER_DVBC2T2I_SONY_P 15
258+#define DDB_TUNER_MCI 16
267259
268260 #define DDB_TUNER_XO2 32
269261 #define DDB_TUNER_DVBS_STV0910 (DDB_TUNER_XO2 + 0)
@@ -305,6 +297,11 @@ struct ddb_lnb { · 35 unmodified lines
305297 u32 fmode;
306298 };
307299
300+struct ddb_irq {
301+ void (*handler)(void *);
302+ void *data;
303+};
304+
308305 struct ddb_link {
309306 struct ddb *dev;
310307 const struct ddb_info *info;
@@ -319,6 +316,7 @@ struct ddb_link { · 8 unmodified lines
319316 spinlock_t temp_lock; /* lock temp chip access */
320317 int overtemperature_error;
321318 u8 temp_tab[11];
319+ struct ddb_irq irq[256];
322320 };
323321
324322 struct ddb {
@@ -343,9 +341,6 @@ struct ddb { · 18 unmodified lines
343341 struct ddb_dma idma[DDB_MAX_INPUT];
344342 struct ddb_dma odma[DDB_MAX_OUTPUT];
345343
346− void (*handler[4][256])(unsigned long);
347− unsigned long handler_data[4][256];
348−
349344 struct device *ddb_dev;
350345 u32 ddb_dev_users;
351346 u32 nr;
@@ -368,16 +363,9 @@ int ddbridge_flashread(struct ddb *dev, u32 link, u8 *buf, u32 addr, u32 len); · 16 unmodified lines
368363
369364 /****************************************************************************/
370365
371−/* ddbridge-main.c (modparams) */
372−extern int ci_bitrate;
373−extern int ts_loop;
374−extern int xo2_speed;
375−extern int alt_dma;
376−extern int no_init;
377−extern int stv0910_single;
378−extern struct workqueue_struct *ddb_wq;
379−
380366 /* ddbridge-core.c */
367+struct ddb_irq *ddb_irq_set(struct ddb *dev, u32 link, u32 nr,
368+ void (*handler)(void *), void *data);
381369 void ddb_ports_detach(struct ddb *dev);
382370 void ddb_ports_release(struct ddb *dev);
383371 void ddb_buffers_free(struct ddb *dev);
@@ -389,9 +377,9 @@ void ddb_ports_init(struct ddb *dev); · 5 unmodified lines
389377 int ddb_buffers_alloc(struct ddb *dev);
390378 int ddb_ports_attach(struct ddb *dev);
391379 int ddb_device_create(struct ddb *dev);
392−int ddb_class_create(void);
393−void ddb_class_destroy(void);
394380 int ddb_init(struct ddb *dev);
395381 void ddb_unmap(struct ddb *dev);
382+int ddb_exit_ddbridge(int stage, int error);
383+int ddb_init_ddbridge(void);
396384
397385 #endif /* DDBRIDGE_H */
drivers/media/pci/dt3155/Kconfig+0−1
@@ -1,7 +1,6 @@
11 config VIDEO_DT3155
22 tristate "DT3155 frame grabber"
33 depends on PCI && VIDEO_DEV && VIDEO_V4L2
4− depends on HAS_DMA
54 select VIDEOBUF2_DMA_CONTIG
65 default n
76 ---help---
drivers/media/pci/intel/ipu3/Kconfig+7−9
@@ -2,18 +2,16 @@ config VIDEO_IPU3_CIO2 · 1 unmodified line
22 tristate "Intel ipu3-cio2 driver"
33 depends on VIDEO_V4L2 && PCI
44 depends on VIDEO_V4L2_SUBDEV_API
5− depends on X86 || COMPILE_TEST
5+ depends on (X86 && ACPI) || COMPILE_TEST
66 depends on MEDIA_CONTROLLER
7− depends on HAS_DMA
8− depends on ACPI
97 select V4L2_FWNODE
108 select VIDEOBUF2_DMA_SG
119
1210 ---help---
13− This is the Intel IPU3 CIO2 CSI-2 receiver unit, found in Intel
14− Skylake and Kaby Lake SoCs and used for capturing images and
15− video from a camera sensor.
11+ This is the Intel IPU3 CIO2 CSI-2 receiver unit, found in Intel
12+ Skylake and Kaby Lake SoCs and used for capturing images and
13+ video from a camera sensor.
1614
17− Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2
18− connected camera.
19− The module will be called ipu3-cio2.
15+ Say Y or M here if you have a Skylake/Kaby Lake SoC with MIPI CSI-2
16+ connected camera.
17+ The module will be called ipu3-cio2.
drivers/media/pci/intel/ipu3/ipu3-cio2.c+22−10
@@ -640,18 +640,10 @@ static const char *const cio2_port_errs[] = { · 639 unmodified lines
640640 "PKT2LONG",
641641 };
642642
643−static irqreturn_t cio2_irq(int irq, void *cio2_ptr)
643+static void cio2_irq_handle_once(struct cio2_device *cio2, u32 int_status)
644644 {
645− struct cio2_device *cio2 = cio2_ptr;
646645 void __iomem *const base = cio2->base;
647646 struct device *dev = &cio2->pci_dev->dev;
648− u32 int_status, int_clear;
649−
650− int_status = readl(base + CIO2_REG_INT_STS);
651− int_clear = int_status;
652−
653− if (!int_status)
654− return IRQ_NONE;
655647
656648 if (int_status & CIO2_INT_IOOE) {
657649 /*
@@ -770,9 +762,29 @@ static irqreturn_t cio2_irq(int irq, void *cio2_ptr) · 112 unmodified lines
770762 int_status &= ~(CIO2_INT_IOIE | CIO2_INT_IOIRQ);
771763 }
772764
773− writel(int_clear, base + CIO2_REG_INT_STS);
774765 if (int_status)
775766 dev_warn(dev, "unknown interrupt 0x%x on INT\n", int_status);
767+}
768+
769+static irqreturn_t cio2_irq(int irq, void *cio2_ptr)
770+{
771+ struct cio2_device *cio2 = cio2_ptr;
772+ void __iomem *const base = cio2->base;
773+ struct device *dev = &cio2->pci_dev->dev;
774+ u32 int_status;
775+
776+ int_status = readl(base + CIO2_REG_INT_STS);
777+ dev_dbg(dev, "isr enter - interrupt status 0x%x\n", int_status);
778+ if (!int_status)
779+ return IRQ_NONE;
780+
781+ do {
782+ writel(int_status, base + CIO2_REG_INT_STS);
783+ cio2_irq_handle_once(cio2, int_status);
784+ int_status = readl(base + CIO2_REG_INT_STS);
785+ if (int_status)
786+ dev_dbg(dev, "pending status 0x%x\n", int_status);
787+ } while (int_status);
776788
777789 return IRQ_HANDLED;
778790 }
drivers/media/pci/mantis/mantis_uart.c+7−0
@@ -92,6 +92,7 @@ static void mantis_uart_work(struct work_struct *work) · 91 unmodified lines
9292 {
9393 struct mantis_pci *mantis = container_of(work, struct mantis_pci, uart_work);
9494 u32 stat;
95+ unsigned long timeout;
9596
9697 stat = mmread(MANTIS_UART_STAT);
9798
@@ -102,9 +103,15 @@ static void mantis_uart_work(struct work_struct *work) · 4 unmodified lines
102103 * MANTIS_UART_RXFIFO_DATA is only set if at least
103104 * config->bytes + 1 bytes are in the FIFO.
104105 */
106+
107+ /* FIXME: is 10ms good enough ? */
108+ timeout = jiffies + msecs_to_jiffies(10);
105109 while (stat & MANTIS_UART_RXFIFO_DATA) {
106110 mantis_uart_read(mantis);
107111 stat = mmread(MANTIS_UART_STAT);
112+
113+ if (!time_is_after_jiffies(timeout))
114+ break;
108115 }
109116
110117 /* re-enable UART (RX) interrupt */
drivers/media/pci/meye/Kconfig+2−1
@@ -1,6 +1,7 @@
11 config VIDEO_MEYE
22 tristate "Sony Vaio Picturebook Motion Eye Video For Linux"
3− depends on PCI && SONY_LAPTOP && VIDEO_V4L2
3+ depends on PCI && VIDEO_V4L2
4+ depends on SONY_LAPTOP || COMPILE_TEST
45 ---help---
56 This is the video4linux driver for the Motion Eye camera found
67 in the Vaio Picturebook laptops. Please read the material in
drivers/media/pci/ngene/ngene-cards.c+3−15
@@ -137,11 +137,6 @@ static int tuner_attach_stv6110(struct ngene_channel *chan) · 136 unmodified lines
137137 chan->dev->card_info->tuner_config[chan->number];
138138 const struct stv6110x_devctl *ctl;
139139
140− if (chan->number < 2)
141− i2c = &chan->dev->channel[0].i2c_adapter;
142− else
143− i2c = &chan->dev->channel[1].i2c_adapter;
144−
145140 ctl = dvb_attach(stv6110x_attach, chan->fe, tunerconf, i2c);
146141 if (ctl == NULL) {
147142 dev_err(pdev, "No STV6110X found!\n");
@@ -304,14 +299,6 @@ static int demod_attach_stv0900(struct ngene_channel *chan) · 156 unmodified lines
304299 struct stv090x_config *feconf = (struct stv090x_config *)
305300 chan->dev->card_info->fe_config[chan->number];
306301
307− /* tuner 1+2: i2c adapter #0, tuner 3+4: i2c adapter #1 */
308− /* Note: Both adapters share the same i2c bus, but the demod */
309− /* driver requires that each demod has its own i2c adapter */
310− if (chan->number < 2)
311− i2c = &chan->dev->channel[0].i2c_adapter;
312− else
313− i2c = &chan->dev->channel[1].i2c_adapter;
314−
315302 chan->fe = dvb_attach(stv090x_attach, feconf, i2c,
316303 (chan->number & 1) == 0 ? STV090x_DEMODULATOR_0
317304 : STV090x_DEMODULATOR_1);
@@ -340,6 +327,7 @@ static struct stv0910_cfg stv0910_p = { · 22 unmodified lines
340327 .parallel = 1,
341328 .rptlvl = 4,
342329 .clk = 30000000,
330+ .tsspeed = 0x28,
343331 };
344332
345333 static struct lnbh25_config lnbh25_cfg = {
@@ -721,7 +709,6 @@ static int cineS2_probe(struct ngene_channel *chan) · 375 unmodified lines
721709
722710
723711 static struct lgdt330x_config aver_m780 = {
724− .demod_address = 0xb2 >> 1,
725712 .demod_chip = LGDT3303,
726713 .serial_mpeg = 0x00, /* PARALLEL */
727714 .clock_polarity_flip = 1,
@@ -738,7 +725,8 @@ static int demod_attach_lg330x(struct ngene_channel *chan) · 10 unmodified lines
738725 {
739726 struct device *pdev = &chan->dev->pci_dev->dev;
740727
741− chan->fe = dvb_attach(lgdt330x_attach, &aver_m780, &chan->i2c_adapter);
728+ chan->fe = dvb_attach(lgdt330x_attach, &aver_m780,
729+ 0xb2 >> 1, &chan->i2c_adapter);
742730 if (chan->fe == NULL) {
743731 dev_err(pdev, "No LGDT330x found!\n");
744732 return -ENODEV;
drivers/media/pci/ngene/ngene-dvb.c+1−1
@@ -40,7 +40,7 @@ · 39 unmodified lines
4040
4141 static int ci_tsfix = 1;
4242 module_param(ci_tsfix, int, 0444);
43−MODULE_PARM_DESC(ci_tsfix, "Detect and fix TS buffer offset shifs in conjunction with CI expansions (default: 1/enabled)");
43+MODULE_PARM_DESC(ci_tsfix, "Detect and fix TS buffer offset shifts in conjunction with CI expansions (default: 1/enabled)");
4444
4545 /****************************************************************************/
4646 /* COMMAND API interface ****************************************************/
drivers/media/pci/pt1/Kconfig+3−0
@@ -1,6 +1,9 @@
11 config DVB_PT1
22 tristate "PT1 cards"
33 depends on DVB_CORE && PCI && I2C
4+ select DVB_TC90522 if MEDIA_SUBDRV_AUTOSELECT
5+ select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
6+ select MEDIA_TUNER_QM1D1B0004 if MEDIA_SUBDRV_AUTOSELECT
47 help
58 Support for Earthsoft PT1 PCI cards.
69
drivers/media/pci/pt1/Makefile+2−1
@@ -1,5 +1,6 @@
1−earth-pt1-objs := pt1.o va1j5jf8007s.o va1j5jf8007t.o
1+earth-pt1-objs := pt1.o
22
33 obj-$(CONFIG_DVB_PT1) += earth-pt1.o
44
55 ccflags-y += -Idrivers/media/dvb-frontends
6+ccflags-y += -Idrivers/media/tuners
drivers/media/pci/pt1/pt1.c+351−120
@@ -18,7 +18,10 @@ · 17 unmodified lines
1818 */
1919
2020 #include <linux/kernel.h>
21+#include <linux/sched.h>
2122 #include <linux/sched/signal.h>
23+#include <linux/hrtimer.h>
24+#include <linux/delay.h>
2225 #include <linux/module.h>
2326 #include <linux/slab.h>
2427 #include <linux/vmalloc.h>
@@ -26,6 +29,8 @@ · 1 unmodified line
2629 #include <linux/kthread.h>
2730 #include <linux/freezer.h>
2831 #include <linux/ratelimit.h>
32+#include <linux/string.h>
33+#include <linux/i2c.h>
2934
3035 #include <media/dvbdev.h>
3136 #include <media/dvb_demux.h>
@@ -33,8 +38,9 @@ · 1 unmodified line
3338 #include <media/dvb_net.h>
3439 #include <media/dvb_frontend.h>
3540
36−#include "va1j5jf8007t.h"
37−#include "va1j5jf8007s.h"
41+#include "tc90522.h"
42+#include "qm1d1b0004.h"
43+#include "dvb-pll.h"
3844
3945 #define DRIVER_NAME "earth-pt1"
4046
@@ -63,6 +69,11 @@ struct pt1_table { · 22 unmodified lines
6369 struct pt1_buffer bufs[PT1_NR_BUFS];
6470 };
6571
72+enum pt1_fe_clk {
73+ PT1_FE_CLK_20MHZ, /* PT1 */
74+ PT1_FE_CLK_25MHZ, /* PT2 */
75+};
76+
6677 #define PT1_NR_ADAPS 4
6778
6879 struct pt1_adapter;
@@ -81,6 +92,8 @@ struct pt1 { · 12 unmodified lines
8192 struct mutex lock;
8293 int power;
8394 int reset;
95+
96+ enum pt1_fe_clk fe_clk;
8497 };
8598
8699 struct pt1_adapter {
@@ -97,6 +110,8 @@ struct pt1_adapter { · 10 unmodified lines
97110 int users;
98111 struct dmxdev dmxdev;
99112 struct dvb_frontend *fe;
113+ struct i2c_client *demod_i2c_client;
114+ struct i2c_client *tuner_i2c_client;
100115 int (*orig_set_voltage)(struct dvb_frontend *fe,
101116 enum fe_sec_voltage voltage);
102117 int (*orig_sleep)(struct dvb_frontend *fe);
@@ -106,6 +121,145 @@ struct pt1_adapter { · 3 unmodified lines
106121 int sleep;
107122 };
108123
124+union pt1_tuner_config {
125+ struct qm1d1b0004_config qm1d1b0004;
126+ struct dvb_pll_config tda6651;
127+};
128+
129+struct pt1_config {
130+ struct i2c_board_info demod_info;
131+ struct tc90522_config demod_cfg;
132+
133+ struct i2c_board_info tuner_info;
134+ union pt1_tuner_config tuner_cfg;
135+};
136+
137+static const struct pt1_config pt1_configs[PT1_NR_ADAPS] = {
138+ {
139+ .demod_info = {
140+ I2C_BOARD_INFO(TC90522_I2C_DEV_SAT, 0x1b),
141+ },
142+ .tuner_info = {
143+ I2C_BOARD_INFO("qm1d1b0004", 0x60),
144+ },
145+ },
146+ {
147+ .demod_info = {
148+ I2C_BOARD_INFO(TC90522_I2C_DEV_TER, 0x1a),
149+ },
150+ .tuner_info = {
151+ I2C_BOARD_INFO("tda665x_earthpt1", 0x61),
152+ },
153+ },
154+ {
155+ .demod_info = {
156+ I2C_BOARD_INFO(TC90522_I2C_DEV_SAT, 0x19),
157+ },
158+ .tuner_info = {
159+ I2C_BOARD_INFO("qm1d1b0004", 0x60),
160+ },
161+ },
162+ {
163+ .demod_info = {
164+ I2C_BOARD_INFO(TC90522_I2C_DEV_TER, 0x18),
165+ },
166+ .tuner_info = {
167+ I2C_BOARD_INFO("tda665x_earthpt1", 0x61),
168+ },
169+ },
170+};
171+
172+static const u8 va1j5jf8007s_20mhz_configs[][2] = {
173+ {0x04, 0x02}, {0x0d, 0x55}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01},
174+ {0x1c, 0x0a}, {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0},
175+ {0x52, 0x89}, {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69},
176+ {0x87, 0x04}, {0x8e, 0x02}, {0xa3, 0xf7}, {0xa5, 0xc0},
177+};
178+
179+static const u8 va1j5jf8007s_25mhz_configs[][2] = {
180+ {0x04, 0x02}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01}, {0x1c, 0x0a},
181+ {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0}, {0x52, 0x89},
182+ {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69}, {0x87, 0x04},
183+ {0x8e, 0x26}, {0xa3, 0xf7}, {0xa5, 0xc0},
184+};
185+
186+static const u8 va1j5jf8007t_20mhz_configs[][2] = {
187+ {0x03, 0x90}, {0x14, 0x8f}, {0x1c, 0x2a}, {0x1d, 0xa8}, {0x1e, 0xa2},
188+ {0x22, 0x83}, {0x31, 0x0d}, {0x32, 0xe0}, {0x39, 0xd3}, {0x3a, 0x00},
189+ {0x3b, 0x11}, {0x3c, 0x3f},
190+ {0x5c, 0x40}, {0x5f, 0x80}, {0x75, 0x02}, {0x76, 0x4e}, {0x77, 0x03},
191+ {0xef, 0x01}
192+};
193+
194+static const u8 va1j5jf8007t_25mhz_configs[][2] = {
195+ {0x03, 0x90}, {0x1c, 0x2a}, {0x1d, 0xa8}, {0x1e, 0xa2}, {0x22, 0x83},
196+ {0x3a, 0x04}, {0x3b, 0x11}, {0x3c, 0x3f}, {0x5c, 0x40}, {0x5f, 0x80},
197+ {0x75, 0x0a}, {0x76, 0x4c}, {0x77, 0x03}, {0xef, 0x01}
198+};
199+
200+static int config_demod(struct i2c_client *cl, enum pt1_fe_clk clk)
201+{
202+ int ret;
203+ u8 buf[2] = {0x01, 0x80};
204+ bool is_sat;
205+ const u8 (*cfg_data)[2];
206+ int i, len;
207+
208+ ret = i2c_master_send(cl, buf, 2);
209+ if (ret < 0)
210+ return ret;
211+ usleep_range(30000, 50000);
212+
213+ is_sat = !strncmp(cl->name, TC90522_I2C_DEV_SAT,
214+ strlen(TC90522_I2C_DEV_SAT));
215+ if (is_sat) {
216+ struct i2c_msg msg[2];
217+ u8 wbuf, rbuf;
218+
219+ wbuf = 0x07;
220+ msg[0].addr = cl->addr;
221+ msg[0].flags = 0;
222+ msg[0].len = 1;
223+ msg[0].buf = &wbuf;
224+
225+ msg[1].addr = cl->addr;
226+ msg[1].flags = I2C_M_RD;
227+ msg[1].len = 1;
228+ msg[1].buf = &rbuf;
229+ ret = i2c_transfer(cl->adapter, msg, 2);
230+ if (ret < 0)
231+ return ret;
232+ if (rbuf != 0x41)
233+ return -EIO;
234+ }
235+
236+ /* frontend init */
237+ if (clk == PT1_FE_CLK_20MHZ) {
238+ if (is_sat) {
239+ cfg_data = va1j5jf8007s_20mhz_configs;
240+ len = ARRAY_SIZE(va1j5jf8007s_20mhz_configs);
241+ } else {
242+ cfg_data = va1j5jf8007t_20mhz_configs;
243+ len = ARRAY_SIZE(va1j5jf8007t_20mhz_configs);
244+ }
245+ } else {
246+ if (is_sat) {
247+ cfg_data = va1j5jf8007s_25mhz_configs;
248+ len = ARRAY_SIZE(va1j5jf8007s_25mhz_configs);
249+ } else {
250+ cfg_data = va1j5jf8007t_25mhz_configs;
251+ len = ARRAY_SIZE(va1j5jf8007t_25mhz_configs);
252+ }
253+ }
254+
255+ for (i = 0; i < len; i++) {
256+ ret = i2c_master_send(cl, cfg_data[i], 2);
257+ if (ret < 0)
258+ return ret;
259+ }
260+ return 0;
261+}
262+
109263 static void pt1_write_reg(struct pt1 *pt1, int reg, u32 data)
110264 {
111265 writel(data, pt1->regs + reg * 4);
@@ -171,7 +325,7 @@ static int pt1_unlock(struct pt1 *pt1) · 59 unmodified lines
171325 for (i = 0; i < 3; i++) {
172326 if (pt1_read_reg(pt1, 0) & 0x80000000)
173327 return 0;
174− schedule_timeout_uninterruptible((HZ + 999) / 1000);
328+ usleep_range(1000, 2000);
175329 }
176330 dev_err(&pt1->pdev->dev, "could not unlock\n");
177331 return -EIO;
@@ -185,7 +339,7 @@ static int pt1_reset_pci(struct pt1 *pt1) · 7 unmodified lines
185339 for (i = 0; i < 10; i++) {
186340 if (pt1_read_reg(pt1, 0) & 0x00000001)
187341 return 0;
188− schedule_timeout_uninterruptible((HZ + 999) / 1000);
342+ usleep_range(1000, 2000);
189343 }
190344 dev_err(&pt1->pdev->dev, "could not reset PCI\n");
191345 return -EIO;
@@ -199,7 +353,7 @@ static int pt1_reset_ram(struct pt1 *pt1) · 7 unmodified lines
199353 for (i = 0; i < 10; i++) {
200354 if (pt1_read_reg(pt1, 0) & 0x00000002)
201355 return 0;
202− schedule_timeout_uninterruptible((HZ + 999) / 1000);
356+ usleep_range(1000, 2000);
203357 }
204358 dev_err(&pt1->pdev->dev, "could not reset RAM\n");
205359 return -EIO;
@@ -216,7 +370,7 @@ static int pt1_do_enable_ram(struct pt1 *pt1) · 10 unmodified lines
216370 if ((pt1_read_reg(pt1, 0) & 0x00000004) != status)
217371 return 0;
218372 }
219− schedule_timeout_uninterruptible((HZ + 999) / 1000);
373+ usleep_range(1000, 2000);
220374 }
221375 dev_err(&pt1->pdev->dev, "could not enable RAM\n");
222376 return -EIO;
@@ -226,7 +380,7 @@ static int pt1_enable_ram(struct pt1 *pt1) · 3 unmodified lines
226380 {
227381 int i, ret;
228382 int phase;
229− schedule_timeout_uninterruptible((HZ + 999) / 1000);
383+ usleep_range(1000, 2000);
230384 phase = pt1->pdev->device == 0x211a ? 128 : 166;
231385 for (i = 0; i < phase; i++) {
232386 ret = pt1_do_enable_ram(pt1);
@@ -311,16 +465,31 @@ static int pt1_thread(void *data) · 78 unmodified lines
311465 {
312466 struct pt1 *pt1;
313467 struct pt1_buffer_page *page;
468+ bool was_frozen;
469+
470+#define PT1_FETCH_DELAY 10
471+#define PT1_FETCH_DELAY_DELTA 2
314472
315473 pt1 = data;
316474 set_freezable();
317475
318− while (!kthread_should_stop()) {
319− try_to_freeze();
476+ while (!kthread_freezable_should_stop(&was_frozen)) {
477+ if (was_frozen) {
478+ int i;
479+
480+ for (i = 0; i < PT1_NR_ADAPS; i++)
481+ pt1_set_stream(pt1, i, !!pt1->adaps[i]->users);
482+ }
320483
321484 page = pt1->tables[pt1->table_index].bufs[pt1->buf_index].page;
322485 if (!pt1_filter(pt1, page)) {
323− schedule_timeout_interruptible((HZ + 999) / 1000);
486+ ktime_t delay;
487+
488+ delay = ktime_set(0, PT1_FETCH_DELAY * NSEC_PER_MSEC);
489+ set_current_state(TASK_INTERRUPTIBLE);
490+ schedule_hrtimeout_range(&delay,
491+ PT1_FETCH_DELAY_DELTA * NSEC_PER_MSEC,
492+ HRTIMER_MODE_REL);
324493 continue;
325494 }
326495
@@ -556,7 +725,7 @@ pt1_update_power(struct pt1 *pt1) · 229 unmodified lines
556725 adap = pt1->adaps[i];
557726 switch (adap->voltage) {
558727 case SEC_VOLTAGE_13: /* actually 11V */
559− bits |= 1 << 1;
728+ bits |= 1 << 2;
560729 break;
561730 case SEC_VOLTAGE_18: /* actually 15V */
562731 bits |= 1 << 1 | 1 << 2;
@@ -589,30 +758,33 @@ static int pt1_set_voltage(struct dvb_frontend *fe, enum fe_sec_voltage voltage) · 26 unmodified lines
589758 static int pt1_sleep(struct dvb_frontend *fe)
590759 {
591760 struct pt1_adapter *adap;
761+ int ret;
592762
593763 adap = container_of(fe->dvb, struct pt1_adapter, adap);
594− adap->sleep = 1;
595− pt1_update_power(adap->pt1);
596764
765+ ret = 0;
597766 if (adap->orig_sleep)
598− return adap->orig_sleep(fe);
599− else
600− return 0;
767+ ret = adap->orig_sleep(fe);
768+
769+ adap->sleep = 1;
770+ pt1_update_power(adap->pt1);
771+ return ret;
601772 }
602773
603774 static int pt1_wakeup(struct dvb_frontend *fe)
604775 {
605776 struct pt1_adapter *adap;
777+ int ret;
606778
607779 adap = container_of(fe->dvb, struct pt1_adapter, adap);
608780 adap->sleep = 0;
609781 pt1_update_power(adap->pt1);
610− schedule_timeout_uninterruptible((HZ + 999) / 1000);
782+ usleep_range(1000, 2000);
611783
612− if (adap->orig_init)
613− return adap->orig_init(fe);
614− else
615− return 0;
784+ ret = config_demod(adap->demod_i2c_client, adap->pt1->fe_clk);
785+ if (ret == 0 && adap->orig_init)
786+ ret = adap->orig_init(fe);
787+ return ret;
616788 }
617789
618790 static void pt1_free_adapter(struct pt1_adapter *adap)
@@ -735,6 +907,8 @@ err: · 116 unmodified lines
735907 static void pt1_cleanup_frontend(struct pt1_adapter *adap)
736908 {
737909 dvb_unregister_frontend(adap->fe);
910+ dvb_module_release(adap->tuner_i2c_client);
911+ dvb_module_release(adap->demod_i2c_client);
738912 }
739913
740914 static int pt1_init_frontend(struct pt1_adapter *adap, struct dvb_frontend *fe)
@@ -763,112 +937,70 @@ static void pt1_cleanup_frontends(struct pt1 *pt1) · 22 unmodified lines
763937 pt1_cleanup_frontend(pt1->adaps[i]);
764938 }
765939
766−struct pt1_config {
767− struct va1j5jf8007s_config va1j5jf8007s_config;
768− struct va1j5jf8007t_config va1j5jf8007t_config;
769−};
770−
771−static const struct pt1_config pt1_configs[2] = {
772− {
773− {
774− .demod_address = 0x1b,
775− .frequency = VA1J5JF8007S_20MHZ,
776− },
777− {
778− .demod_address = 0x1a,
779− .frequency = VA1J5JF8007T_20MHZ,
780− },
781− }, {
782− {
783− .demod_address = 0x19,
784− .frequency = VA1J5JF8007S_20MHZ,
785− },
786− {
787− .demod_address = 0x18,
788− .frequency = VA1J5JF8007T_20MHZ,
789− },
790− },
791−};
792−
793−static const struct pt1_config pt2_configs[2] = {
794− {
795− {
796− .demod_address = 0x1b,
797− .frequency = VA1J5JF8007S_25MHZ,
798− },
799− {
800− .demod_address = 0x1a,
801− .frequency = VA1J5JF8007T_25MHZ,
802− },
803− }, {
804− {
805− .demod_address = 0x19,
806− .frequency = VA1J5JF8007S_25MHZ,
807− },
808− {
809− .demod_address = 0x18,
810− .frequency = VA1J5JF8007T_25MHZ,
811− },
812− },
813−};
814−
815940 static int pt1_init_frontends(struct pt1 *pt1)
816941 {
817− int i, j;
818− struct i2c_adapter *i2c_adap;
819− const struct pt1_config *configs, *config;
820− struct dvb_frontend *fe[4];
942+ int i;
821943 int ret;
822944
823− i = 0;
824− j = 0;
825−
826− i2c_adap = &pt1->i2c_adap;
827− configs = pt1->pdev->device == 0x211a ? pt1_configs : pt2_configs;
828− do {
829− config = &configs[i / 2];
830−
831− fe[i] = va1j5jf8007s_attach(&config->va1j5jf8007s_config,
832− i2c_adap);
833− if (!fe[i]) {
834− ret = -ENODEV; /* This does not sound nice... */
835− goto err;
836− }
837− i++;
838−
839− fe[i] = va1j5jf8007t_attach(&config->va1j5jf8007t_config,
840− i2c_adap);
841− if (!fe[i]) {
842− ret = -ENODEV;
843− goto err;
945+ for (i = 0; i < ARRAY_SIZE(pt1_configs); i++) {
946+ const struct i2c_board_info *info;
947+ struct tc90522_config dcfg;
948+ struct i2c_client *cl;
949+
950+ info = &pt1_configs[i].demod_info;
951+ dcfg = pt1_configs[i].demod_cfg;
952+ dcfg.tuner_i2c = NULL;
953+
954+ ret = -ENODEV;
955+ cl = dvb_module_probe("tc90522", info->type, &pt1->i2c_adap,
956+ info->addr, &dcfg);
957+ if (!cl)
958+ goto fe_unregister;
959+ pt1->adaps[i]->demod_i2c_client = cl;
960+
961+ if (!strncmp(cl->name, TC90522_I2C_DEV_SAT,
962+ strlen(TC90522_I2C_DEV_SAT))) {
963+ struct qm1d1b0004_config tcfg;
964+
965+ info = &pt1_configs[i].tuner_info;
966+ tcfg = pt1_configs[i].tuner_cfg.qm1d1b0004;
967+ tcfg.fe = dcfg.fe;
968+ cl = dvb_module_probe("qm1d1b0004",
969+ info->type, dcfg.tuner_i2c,
970+ info->addr, &tcfg);
971+ } else {
972+ struct dvb_pll_config tcfg;
973+
974+ info = &pt1_configs[i].tuner_info;
975+ tcfg = pt1_configs[i].tuner_cfg.tda6651;
976+ tcfg.fe = dcfg.fe;
977+ cl = dvb_module_probe("dvb_pll",
978+ info->type, dcfg.tuner_i2c,
979+ info->addr, &tcfg);
844980 }
845− i++;
846−
847− ret = va1j5jf8007s_prepare(fe[i - 2]);
848− if (ret < 0)
849− goto err;
981+ if (!cl)
982+ goto demod_release;
983+ pt1->adaps[i]->tuner_i2c_client = cl;
850984
851− ret = va1j5jf8007t_prepare(fe[i - 1]);
852− if (ret < 0)
853− goto err;
854−
855− } while (i < 4);
856−
857− do {
858− ret = pt1_init_frontend(pt1->adaps[j], fe[j]);
985+ ret = pt1_init_frontend(pt1->adaps[i], dcfg.fe);
859986 if (ret < 0)
860− goto err;
861− } while (++j < 4);
987+ goto tuner_release;
988+ }
862989
863990 return 0;
864991
865−err:
866− while (i-- > j)
867− fe[i]->ops.release(fe[i]);
868−
869− while (j--)
870− dvb_unregister_frontend(fe[j]);
871−
992+tuner_release:
993+ dvb_module_release(pt1->adaps[i]->tuner_i2c_client);
994+demod_release:
995+ dvb_module_release(pt1->adaps[i]->demod_i2c_client);
996+fe_unregister:
997+ dev_warn(&pt1->pdev->dev, "failed to init FE(%d).\n", i);
998+ i--;
999+ for (; i >= 0; i--) {
1000+ dvb_unregister_frontend(pt1->adaps[i]->fe);
1001+ dvb_module_release(pt1->adaps[i]->tuner_i2c_client);
1002+ dvb_module_release(pt1->adaps[i]->demod_i2c_client);
1003+ }
8721004 return ret;
8731005 }
8741006
@@ -954,7 +1086,7 @@ static int pt1_i2c_end(struct pt1 *pt1, int addr) · 79 unmodified lines
9541086 do {
9551087 if (signal_pending(current))
9561088 return -EINTR;
957− schedule_timeout_interruptible((HZ + 999) / 1000);
1089+ usleep_range(1000, 2000);
9581090 } while (pt1_read_reg(pt1, 0) & 0x00000080);
9591091 return 0;
9601092 }
@@ -1052,6 +1184,98 @@ static void pt1_i2c_init(struct pt1 *pt1) · 91 unmodified lines
10521184 pt1_i2c_emit(pt1, i, 0, 0, 1, 1, 0);
10531185 }
10541186
1187+#ifdef CONFIG_PM_SLEEP
1188+
1189+static int pt1_suspend(struct device *dev)
1190+{
1191+ struct pci_dev *pdev = to_pci_dev(dev);
1192+ struct pt1 *pt1 = pci_get_drvdata(pdev);
1193+
1194+ pt1_init_streams(pt1);
1195+ pt1_disable_ram(pt1);
1196+ pt1->power = 0;
1197+ pt1->reset = 1;
1198+ pt1_update_power(pt1);
1199+ return 0;
1200+}
1201+
1202+static int pt1_resume(struct device *dev)
1203+{
1204+ struct pci_dev *pdev = to_pci_dev(dev);
1205+ struct pt1 *pt1 = pci_get_drvdata(pdev);
1206+ int ret;
1207+ int i;
1208+
1209+ pt1->power = 0;
1210+ pt1->reset = 1;
1211+ pt1_update_power(pt1);
1212+
1213+ pt1_i2c_init(pt1);
1214+ pt1_i2c_wait(pt1);
1215+
1216+ ret = pt1_sync(pt1);
1217+ if (ret < 0)
1218+ goto resume_err;
1219+
1220+ pt1_identify(pt1);
1221+
1222+ ret = pt1_unlock(pt1);
1223+ if (ret < 0)
1224+ goto resume_err;
1225+
1226+ ret = pt1_reset_pci(pt1);
1227+ if (ret < 0)
1228+ goto resume_err;
1229+
1230+ ret = pt1_reset_ram(pt1);
1231+ if (ret < 0)
1232+ goto resume_err;
1233+
1234+ ret = pt1_enable_ram(pt1);
1235+ if (ret < 0)
1236+ goto resume_err;
1237+
1238+ pt1_init_streams(pt1);
1239+
1240+ pt1->power = 1;
1241+ pt1_update_power(pt1);
1242+ msleep(20);
1243+
1244+ pt1->reset = 0;
1245+ pt1_update_power(pt1);
1246+ usleep_range(1000, 2000);
1247+
1248+ for (i = 0; i < PT1_NR_ADAPS; i++)
1249+ dvb_frontend_reinitialise(pt1->adaps[i]->fe);
1250+
1251+ pt1_init_table_count(pt1);
1252+ for (i = 0; i < pt1_nr_tables; i++) {
1253+ int j;
1254+
1255+ for (j = 0; j < PT1_NR_BUFS; j++)
1256+ pt1->tables[i].bufs[j].page->upackets[PT1_NR_UPACKETS-1]
1257+ = 0;
1258+ pt1_increment_table_count(pt1);
1259+ }
1260+ pt1_register_tables(pt1, pt1->tables[0].addr >> PT1_PAGE_SHIFT);
1261+
1262+ pt1->table_index = 0;
1263+ pt1->buf_index = 0;
1264+ for (i = 0; i < PT1_NR_ADAPS; i++) {
1265+ pt1->adaps[i]->upacket_count = 0;
1266+ pt1->adaps[i]->packet_count = 0;
1267+ pt1->adaps[i]->st_count = -1;
1268+ }
1269+
1270+ return 0;
1271+
1272+resume_err:
1273+ dev_info(&pt1->pdev->dev, "failed to resume PT1/PT2.");
1274+ return 0; /* resume anyway */
1275+}
1276+
1277+#endif /* CONFIG_PM_SLEEP */
1278+
10551279 static void pt1_remove(struct pci_dev *pdev)
10561280 {
10571281 struct pt1 *pt1;
@@ -1112,6 +1336,8 @@ static int pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 54 unmodified lines
11121336 mutex_init(&pt1->lock);
11131337 pt1->pdev = pdev;
11141338 pt1->regs = regs;
1339+ pt1->fe_clk = (pdev->device == 0x211a) ?
1340+ PT1_FE_CLK_20MHZ : PT1_FE_CLK_25MHZ;
11151341 pci_set_drvdata(pdev, pt1);
11161342
11171343 ret = pt1_init_adapters(pt1);
@@ -1163,11 +1389,11 @@ static int pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) · 45 unmodified lines
11631389
11641390 pt1->power = 1;
11651391 pt1_update_power(pt1);
1166− schedule_timeout_uninterruptible((HZ + 49) / 50);
1392+ msleep(20);
11671393
11681394 pt1->reset = 0;
11691395 pt1_update_power(pt1);
1170− schedule_timeout_uninterruptible((HZ + 999) / 1000);
1396+ usleep_range(1000, 2000);
11711397
11721398 ret = pt1_init_frontends(pt1);
11731399 if (ret < 0)
@@ -1210,11 +1436,16 @@ static const struct pci_device_id pt1_id_table[] = { · 36 unmodified lines
12101436 };
12111437 MODULE_DEVICE_TABLE(pci, pt1_id_table);
12121438
1439+static SIMPLE_DEV_PM_OPS(pt1_pm_ops, pt1_suspend, pt1_resume);
1440+
12131441 static struct pci_driver pt1_driver = {
12141442 .name = DRIVER_NAME,
12151443 .probe = pt1_probe,
12161444 .remove = pt1_remove,
12171445 .id_table = pt1_id_table,
1446+#ifdef CONFIG_PM_SLEEP
1447+ .driver.pm = &pt1_pm_ops,
1448+#endif
12181449 };
12191450
12201451 module_pci_driver(pt1_driver);
drivers/media/pci/pt1/va1j5jf8007s.c+0−732
@@ -1,732 +0,0 @@
1−/*
2− * ISDB-S driver for VA1J5JF8007/VA1J5JF8011
3− *
4− * Copyright (C) 2009 HIRANO Takahito <hiranotaka@zng.info>
5− *
6− * based on pt1dvr - http://pt1dvr.sourceforge.jp/
7− * by Tomoaki Ishikawa <tomy@users.sourceforge.jp>
8− *
9− * This program is free software; you can redistribute it and/or modify
10− * it under the terms of the GNU General Public License as published by
11− * the Free Software Foundation; either version 2 of the License, or
12− * (at your option) any later version.
13− *
14− * This program is distributed in the hope that it will be useful,
15− * but WITHOUT ANY WARRANTY; without even the implied warranty of
16− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17− * GNU General Public License for more details.
18− */
19−
20−#include <linux/kernel.h>
21−#include <linux/module.h>
22−#include <linux/slab.h>
23−#include <linux/i2c.h>
24−#include <media/dvb_frontend.h>
25−#include "va1j5jf8007s.h"
26−
27−enum va1j5jf8007s_tune_state {
28− VA1J5JF8007S_IDLE,
29− VA1J5JF8007S_SET_FREQUENCY_1,
30− VA1J5JF8007S_SET_FREQUENCY_2,
31− VA1J5JF8007S_SET_FREQUENCY_3,
32− VA1J5JF8007S_CHECK_FREQUENCY,
33− VA1J5JF8007S_SET_MODULATION,
34− VA1J5JF8007S_CHECK_MODULATION,
35− VA1J5JF8007S_SET_TS_ID,
36− VA1J5JF8007S_CHECK_TS_ID,
37− VA1J5JF8007S_TRACK,
38−};
39−
40−struct va1j5jf8007s_state {
41− const struct va1j5jf8007s_config *config;
42− struct i2c_adapter *adap;
43− struct dvb_frontend fe;
44− enum va1j5jf8007s_tune_state tune_state;
45−};
46−
47−static int va1j5jf8007s_read_snr(struct dvb_frontend *fe, u16 *snr)
48−{
49− struct va1j5jf8007s_state *state;
50− u8 addr;
51− int i;
52− u8 write_buf[1], read_buf[1];
53− struct i2c_msg msgs[2];
54− s32 word, x1, x2, x3, x4, x5, y;
55−
56− state = fe->demodulator_priv;
57− addr = state->config->demod_address;
58−
59− word = 0;
60− for (i = 0; i < 2; i++) {
61− write_buf[0] = 0xbc + i;
62−
63− msgs[0].addr = addr;
64− msgs[0].flags = 0;
65− msgs[0].len = sizeof(write_buf);
66− msgs[0].buf = write_buf;
67−
68− msgs[1].addr = addr;
69− msgs[1].flags = I2C_M_RD;
70− msgs[1].len = sizeof(read_buf);
71− msgs[1].buf = read_buf;
72−
73− if (i2c_transfer(state->adap, msgs, 2) != 2)
74− return -EREMOTEIO;
75−
76− word <<= 8;
77− word |= read_buf[0];
78− }
79−
80− word -= 3000;
81− if (word < 0)
82− word = 0;
83−
84− x1 = int_sqrt(word << 16) * ((15625ll << 21) / 1000000);
85− x2 = (s64)x1 * x1 >> 31;
86− x3 = (s64)x2 * x1 >> 31;
87− x4 = (s64)x2 * x2 >> 31;
88− x5 = (s64)x4 * x1 >> 31;
89−
90− y = (58857ll << 23) / 1000;
91− y -= (s64)x1 * ((89565ll << 24) / 1000) >> 30;
92− y += (s64)x2 * ((88977ll << 24) / 1000) >> 28;
93− y -= (s64)x3 * ((50259ll << 25) / 1000) >> 27;
94− y += (s64)x4 * ((14341ll << 27) / 1000) >> 27;
95− y -= (s64)x5 * ((16346ll << 30) / 10000) >> 28;
96−
97− *snr = y < 0 ? 0 : y >> 15;
98− return 0;
99−}
100−
101−static int va1j5jf8007s_get_frontend_algo(struct dvb_frontend *fe)
102−{
103− return DVBFE_ALGO_HW;
104−}
105−
106−static int
107−va1j5jf8007s_read_status(struct dvb_frontend *fe, enum fe_status *status)
108−{
109− struct va1j5jf8007s_state *state;
110−
111− state = fe->demodulator_priv;
112−
113− switch (state->tune_state) {
114− case VA1J5JF8007S_IDLE:
115− case VA1J5JF8007S_SET_FREQUENCY_1:
116− case VA1J5JF8007S_SET_FREQUENCY_2:
117− case VA1J5JF8007S_SET_FREQUENCY_3:
118− case VA1J5JF8007S_CHECK_FREQUENCY:
119− *status = 0;
120− return 0;
121−
122−
123− case VA1J5JF8007S_SET_MODULATION:
124− case VA1J5JF8007S_CHECK_MODULATION:
125− *status |= FE_HAS_SIGNAL;
126− return 0;
127−
128− case VA1J5JF8007S_SET_TS_ID:
129− case VA1J5JF8007S_CHECK_TS_ID:
130− *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER;
131− return 0;
132−
133− case VA1J5JF8007S_TRACK:
134− *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_LOCK;
135− return 0;
136− }
137−
138− BUG();
139−}
140−
141−struct va1j5jf8007s_cb_map {
142− u32 frequency;
143− u8 cb;
144−};
145−
146−static const struct va1j5jf8007s_cb_map va1j5jf8007s_cb_maps[] = {
147− { 986000, 0xb2 },
148− { 1072000, 0xd2 },
149− { 1154000, 0xe2 },
150− { 1291000, 0x20 },
151− { 1447000, 0x40 },
152− { 1615000, 0x60 },
153− { 1791000, 0x80 },
154− { 1972000, 0xa0 },
155−};
156−
157−static u8 va1j5jf8007s_lookup_cb(u32 frequency)
158−{
159− int i;
160− const struct va1j5jf8007s_cb_map *map;
161−
162− for (i = 0; i < ARRAY_SIZE(va1j5jf8007s_cb_maps); i++) {
163− map = &va1j5jf8007s_cb_maps[i];
164− if (frequency < map->frequency)
165− return map->cb;
166− }
167− return 0xc0;
168−}
169−
170−static int va1j5jf8007s_set_frequency_1(struct va1j5jf8007s_state *state)
171−{
172− u32 frequency;
173− u16 word;
174− u8 buf[6];
175− struct i2c_msg msg;
176−
177− frequency = state->fe.dtv_property_cache.frequency;
178−
179− word = (frequency + 500) / 1000;
180− if (frequency < 1072000)
181− word = (word << 1 & ~0x1f) | (word & 0x0f);
182−
183− buf[0] = 0xfe;
184− buf[1] = 0xc0;
185− buf[2] = 0x40 | word >> 8;
186− buf[3] = word;
187− buf[4] = 0xe0;
188− buf[5] = va1j5jf8007s_lookup_cb(frequency);
189−
190− msg.addr = state->config->demod_address;
191− msg.flags = 0;
192− msg.len = sizeof(buf);
193− msg.buf = buf;
194−
195− if (i2c_transfer(state->adap, &msg, 1) != 1)
196− return -EREMOTEIO;
197−
198− return 0;
199−}
200−
201−static int va1j5jf8007s_set_frequency_2(struct va1j5jf8007s_state *state)
202−{
203− u8 buf[3];
204− struct i2c_msg msg;
205−
206− buf[0] = 0xfe;
207− buf[1] = 0xc0;
208− buf[2] = 0xe4;
209−
210− msg.addr = state->config->demod_address;
211− msg.flags = 0;
212− msg.len = sizeof(buf);
213− msg.buf = buf;
214−
215− if (i2c_transfer(state->adap, &msg, 1) != 1)
216− return -EREMOTEIO;
217−
218− return 0;
219−}
220−
221−static int va1j5jf8007s_set_frequency_3(struct va1j5jf8007s_state *state)
222−{
223− u32 frequency;
224− u8 buf[4];
225− struct i2c_msg msg;
226−
227− frequency = state->fe.dtv_property_cache.frequency;
228−
229− buf[0] = 0xfe;
230− buf[1] = 0xc0;
231− buf[2] = 0xf4;
232− buf[3] = va1j5jf8007s_lookup_cb(frequency) | 0x4;
233−
234− msg.addr = state->config->demod_address;
235− msg.flags = 0;
236− msg.len = sizeof(buf);
237− msg.buf = buf;
238−
239− if (i2c_transfer(state->adap, &msg, 1) != 1)
240− return -EREMOTEIO;
241−
242− return 0;
243−}
244−
245−static int
246−va1j5jf8007s_check_frequency(struct va1j5jf8007s_state *state, int *lock)
247−{
248− u8 addr;
249− u8 write_buf[2], read_buf[1];
250− struct i2c_msg msgs[2];
251−
252− addr = state->config->demod_address;
253−
254− write_buf[0] = 0xfe;
255− write_buf[1] = 0xc1;
256−
257− msgs[0].addr = addr;
258− msgs[0].flags = 0;
259− msgs[0].len = sizeof(write_buf);
260− msgs[0].buf = write_buf;
261−
262− msgs[1].addr = addr;
263− msgs[1].flags = I2C_M_RD;
264− msgs[1].len = sizeof(read_buf);
265− msgs[1].buf = read_buf;
266−
267− if (i2c_transfer(state->adap, msgs, 2) != 2)
268− return -EREMOTEIO;
269−
270− *lock = read_buf[0] & 0x40;
271− return 0;
272−}
273−
274−static int va1j5jf8007s_set_modulation(struct va1j5jf8007s_state *state)
275−{
276− u8 buf[2];
277− struct i2c_msg msg;
278−
279− buf[0] = 0x03;
280− buf[1] = 0x01;
281−
282− msg.addr = state->config->demod_address;
283− msg.flags = 0;
284− msg.len = sizeof(buf);
285− msg.buf = buf;
286−
287− if (i2c_transfer(state->adap, &msg, 1) != 1)
288− return -EREMOTEIO;
289−
290− return 0;
291−}
292−
293−static int
294−va1j5jf8007s_check_modulation(struct va1j5jf8007s_state *state, int *lock)
295−{
296− u8 addr;
297− u8 write_buf[1], read_buf[1];
298− struct i2c_msg msgs[2];
299−
300− addr = state->config->demod_address;
301−
302− write_buf[0] = 0xc3;
303−
304− msgs[0].addr = addr;
305− msgs[0].flags = 0;
306− msgs[0].len = sizeof(write_buf);
307− msgs[0].buf = write_buf;
308−
309− msgs[1].addr = addr;
310− msgs[1].flags = I2C_M_RD;
311− msgs[1].len = sizeof(read_buf);
312− msgs[1].buf = read_buf;
313−
314− if (i2c_transfer(state->adap, msgs, 2) != 2)
315− return -EREMOTEIO;
316−
317− *lock = !(read_buf[0] & 0x10);
318− return 0;
319−}
320−
321−static int
322−va1j5jf8007s_set_ts_id(struct va1j5jf8007s_state *state)
323−{
324− u32 ts_id;
325− u8 buf[3];
326− struct i2c_msg msg;
327−
328− ts_id = state->fe.dtv_property_cache.stream_id;
329− if (!ts_id || ts_id == NO_STREAM_ID_FILTER)
330− return 0;
331−
332− buf[0] = 0x8f;
333− buf[1] = ts_id >> 8;
334− buf[2] = ts_id;
335−
336− msg.addr = state->config->demod_address;
337− msg.flags = 0;
338− msg.len = sizeof(buf);
339− msg.buf = buf;
340−
341− if (i2c_transfer(state->adap, &msg, 1) != 1)
342− return -EREMOTEIO;
343−
344− return 0;
345−}
346−
347−static int
348−va1j5jf8007s_check_ts_id(struct va1j5jf8007s_state *state, int *lock)
349−{
350− u8 addr;
351− u8 write_buf[1], read_buf[2];
352− struct i2c_msg msgs[2];
353− u32 ts_id;
354−
355− ts_id = state->fe.dtv_property_cache.stream_id;
356− if (!ts_id || ts_id == NO_STREAM_ID_FILTER) {
357− *lock = 1;
358− return 0;
359− }
360−
361− addr = state->config->demod_address;
362−
363− write_buf[0] = 0xe6;
364−
365− msgs[0].addr = addr;
366− msgs[0].flags = 0;
367− msgs[0].len = sizeof(write_buf);
368− msgs[0].buf = write_buf;
369−
370− msgs[1].addr = addr;
371− msgs[1].flags = I2C_M_RD;
372− msgs[1].len = sizeof(read_buf);
373− msgs[1].buf = read_buf;
374−
375− if (i2c_transfer(state->adap, msgs, 2) != 2)
376− return -EREMOTEIO;
377−
378− *lock = (read_buf[0] << 8 | read_buf[1]) == ts_id;
379− return 0;
380−}
381−
382−static int
383−va1j5jf8007s_tune(struct dvb_frontend *fe,
384− bool re_tune,
385− unsigned int mode_flags, unsigned int *delay,
386− enum fe_status *status)
387−{
388− struct va1j5jf8007s_state *state;
389− int ret;
390− int lock = 0;
391−
392− state = fe->demodulator_priv;
393−
394− if (re_tune)
395− state->tune_state = VA1J5JF8007S_SET_FREQUENCY_1;
396−
397− switch (state->tune_state) {
398− case VA1J5JF8007S_IDLE:
399− *delay = 3 * HZ;
400− *status = 0;
401− return 0;
402−
403− case VA1J5JF8007S_SET_FREQUENCY_1:
404− ret = va1j5jf8007s_set_frequency_1(state);
405− if (ret < 0)
406− return ret;
407−
408− state->tune_state = VA1J5JF8007S_SET_FREQUENCY_2;
409− *delay = 0;
410− *status = 0;
411− return 0;
412−
413− case VA1J5JF8007S_SET_FREQUENCY_2:
414− ret = va1j5jf8007s_set_frequency_2(state);
415− if (ret < 0)
416− return ret;
417−
418− state->tune_state = VA1J5JF8007S_SET_FREQUENCY_3;
419− *delay = (HZ + 99) / 100;
420− *status = 0;
421− return 0;
422−
423− case VA1J5JF8007S_SET_FREQUENCY_3:
424− ret = va1j5jf8007s_set_frequency_3(state);
425− if (ret < 0)
426− return ret;
427−
428− state->tune_state = VA1J5JF8007S_CHECK_FREQUENCY;
429− *delay = 0;
430− *status = 0;
431− return 0;
432−
433− case VA1J5JF8007S_CHECK_FREQUENCY:
434− ret = va1j5jf8007s_check_frequency(state, &lock);
435− if (ret < 0)
436− return ret;
437−
438− if (!lock) {
439− *delay = (HZ + 999) / 1000;
440− *status = 0;
441− return 0;
442− }
443−
444− state->tune_state = VA1J5JF8007S_SET_MODULATION;
445− *delay = 0;
446− *status = FE_HAS_SIGNAL;
447− return 0;
448−
449− case VA1J5JF8007S_SET_MODULATION:
450− ret = va1j5jf8007s_set_modulation(state);
451− if (ret < 0)
452− return ret;
453−
454− state->tune_state = VA1J5JF8007S_CHECK_MODULATION;
455− *delay = 0;
456− *status = FE_HAS_SIGNAL;
457− return 0;
458−
459− case VA1J5JF8007S_CHECK_MODULATION:
460− ret = va1j5jf8007s_check_modulation(state, &lock);
461− if (ret < 0)
462− return ret;
463−
464− if (!lock) {
465− *delay = (HZ + 49) / 50;
466− *status = FE_HAS_SIGNAL;
467− return 0;
468− }
469−
470− state->tune_state = VA1J5JF8007S_SET_TS_ID;
471− *delay = 0;
472− *status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
473− return 0;
474−
475− case VA1J5JF8007S_SET_TS_ID:
476− ret = va1j5jf8007s_set_ts_id(state);
477− if (ret < 0)
478− return ret;
479−
480− state->tune_state = VA1J5JF8007S_CHECK_TS_ID;
481− return 0;
482−
483− case VA1J5JF8007S_CHECK_TS_ID:
484− ret = va1j5jf8007s_check_ts_id(state, &lock);
485− if (ret < 0)
486− return ret;
487−
488− if (!lock) {
489− *delay = (HZ + 99) / 100;
490− *status = FE_HAS_SIGNAL | FE_HAS_CARRIER;
491− return 0;
492− }
493−
494− state->tune_state = VA1J5JF8007S_TRACK;
495− /* fall through */
496−
497− case VA1J5JF8007S_TRACK:
498− *delay = 3 * HZ;
499− *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_LOCK;
500− return 0;
501− }
502−
503− BUG();
504−}
505−
506−static int va1j5jf8007s_init_frequency(struct va1j5jf8007s_state *state)
507−{
508− u8 buf[4];
509− struct i2c_msg msg;
510−
511− buf[0] = 0xfe;
512− buf[1] = 0xc0;
513− buf[2] = 0xf0;
514− buf[3] = 0x04;
515−
516− msg.addr = state->config->demod_address;
517− msg.flags = 0;
518− msg.len = sizeof(buf);
519− msg.buf = buf;
520−
521− if (i2c_transfer(state->adap, &msg, 1) != 1)
522− return -EREMOTEIO;
523−
524− return 0;
525−}
526−
527−static int va1j5jf8007s_set_sleep(struct va1j5jf8007s_state *state, int sleep)
528−{
529− u8 buf[2];
530− struct i2c_msg msg;
531−
532− buf[0] = 0x17;
533− buf[1] = sleep ? 0x01 : 0x00;
534−
535− msg.addr = state->config->demod_address;
536− msg.flags = 0;
537− msg.len = sizeof(buf);
538− msg.buf = buf;
539−
540− if (i2c_transfer(state->adap, &msg, 1) != 1)
541− return -EREMOTEIO;
542−
543− return 0;
544−}
545−
546−static int va1j5jf8007s_sleep(struct dvb_frontend *fe)
547−{
548− struct va1j5jf8007s_state *state;
549− int ret;
550−
551− state = fe->demodulator_priv;
552−
553− ret = va1j5jf8007s_init_frequency(state);
554− if (ret < 0)
555− return ret;
556−
557− return va1j5jf8007s_set_sleep(state, 1);
558−}
559−
560−static int va1j5jf8007s_init(struct dvb_frontend *fe)
561−{
562− struct va1j5jf8007s_state *state;
563−
564− state = fe->demodulator_priv;
565− state->tune_state = VA1J5JF8007S_IDLE;
566−
567− return va1j5jf8007s_set_sleep(state, 0);
568−}
569−
570−static void va1j5jf8007s_release(struct dvb_frontend *fe)
571−{
572− struct va1j5jf8007s_state *state;
573− state = fe->demodulator_priv;
574− kfree(state);
575−}
576−
577−static const struct dvb_frontend_ops va1j5jf8007s_ops = {
578− .delsys = { SYS_ISDBS },
579− .info = {
580− .name = "VA1J5JF8007/VA1J5JF8011 ISDB-S",
581− .frequency_min = 950000,
582− .frequency_max = 2150000,
583− .frequency_stepsize = 1000,
584− .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_AUTO |
585− FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO |
586− FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO |
587− FE_CAN_MULTISTREAM,
588− },
589−
590− .read_snr = va1j5jf8007s_read_snr,
591− .get_frontend_algo = va1j5jf8007s_get_frontend_algo,
592− .read_status = va1j5jf8007s_read_status,
593− .tune = va1j5jf8007s_tune,
594− .sleep = va1j5jf8007s_sleep,
595− .init = va1j5jf8007s_init,
596− .release = va1j5jf8007s_release,
597−};
598−
599−static int va1j5jf8007s_prepare_1(struct va1j5jf8007s_state *state)
600−{
601− u8 addr;
602− u8 write_buf[1], read_buf[1];
603− struct i2c_msg msgs[2];
604−
605− addr = state->config->demod_address;
606−
607− write_buf[0] = 0x07;
608−
609− msgs[0].addr = addr;
610− msgs[0].flags = 0;
611− msgs[0].len = sizeof(write_buf);
612− msgs[0].buf = write_buf;
613−
614− msgs[1].addr = addr;
615− msgs[1].flags = I2C_M_RD;
616− msgs[1].len = sizeof(read_buf);
617− msgs[1].buf = read_buf;
618−
619− if (i2c_transfer(state->adap, msgs, 2) != 2)
620− return -EREMOTEIO;
621−
622− if (read_buf[0] != 0x41)
623− return -EIO;
624−
625− return 0;
626−}
627−
628−static const u8 va1j5jf8007s_20mhz_prepare_bufs[][2] = {
629− {0x04, 0x02}, {0x0d, 0x55}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01},
630− {0x1c, 0x0a}, {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0},
631− {0x52, 0x89}, {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69},
632− {0x87, 0x04}, {0x8e, 0x02}, {0xa3, 0xf7}, {0xa5, 0xc0},
633−};
634−
635−static const u8 va1j5jf8007s_25mhz_prepare_bufs[][2] = {
636− {0x04, 0x02}, {0x11, 0x40}, {0x13, 0x80}, {0x17, 0x01}, {0x1c, 0x0a},
637− {0x1d, 0xaa}, {0x1e, 0x20}, {0x1f, 0x88}, {0x51, 0xb0}, {0x52, 0x89},
638− {0x53, 0xb3}, {0x5a, 0x2d}, {0x5b, 0xd3}, {0x85, 0x69}, {0x87, 0x04},
639− {0x8e, 0x26}, {0xa3, 0xf7}, {0xa5, 0xc0},
640−};
641−
642−static int va1j5jf8007s_prepare_2(struct va1j5jf8007s_state *state)
643−{
644− const u8 (*bufs)[2];
645− int size;
646− u8 addr;
647− u8 buf[2];
648− struct i2c_msg msg;
649− int i;
650−
651− switch (state->config->frequency) {
652− case VA1J5JF8007S_20MHZ:
653− bufs = va1j5jf8007s_20mhz_prepare_bufs;
654− size = ARRAY_SIZE(va1j5jf8007s_20mhz_prepare_bufs);
655− break;
656− case VA1J5JF8007S_25MHZ:
657− bufs = va1j5jf8007s_25mhz_prepare_bufs;
658− size = ARRAY_SIZE(va1j5jf8007s_25mhz_prepare_bufs);
659− break;
660− default:
661− return -EINVAL;
662− }
663−
664− addr = state->config->demod_address;
665−
666− msg.addr = addr;
667− msg.flags = 0;
668− msg.len = 2;
669− msg.buf = buf;
670− for (i = 0; i < size; i++) {
671− memcpy(buf, bufs[i], sizeof(buf));
672− if (i2c_transfer(state->adap, &msg, 1) != 1)
673− return -EREMOTEIO;
674− }
675−
676− return 0;
677−}
678−
679−/* must be called after va1j5jf8007t_attach */
680−int va1j5jf8007s_prepare(struct dvb_frontend *fe)
681−{
682− struct va1j5jf8007s_state *state;
683− int ret;
684−
685− state = fe->demodulator_priv;
686−
687− ret = va1j5jf8007s_prepare_1(state);
688− if (ret < 0)
689− return ret;
690−
691− ret = va1j5jf8007s_prepare_2(state);
692− if (ret < 0)
693− return ret;
694−
695− return va1j5jf8007s_init_frequency(state);
696−}
697−
698−struct dvb_frontend *
699−va1j5jf8007s_attach(const struct va1j5jf8007s_config *config,
700− struct i2c_adapter *adap)
701−{
702− struct va1j5jf8007s_state *state;
703− struct dvb_frontend *fe;
704− u8 buf[2];
705− struct i2c_msg msg;
706−
707− state = kzalloc(sizeof(struct va1j5jf8007s_state), GFP_KERNEL);
708− if (!state)
709− return NULL;
710−
711− state->config = config;
712− state->adap = adap;
713−
714− fe = &state->fe;
715− memcpy(&fe->ops, &va1j5jf8007s_ops, sizeof(struct dvb_frontend_ops));
716− fe->demodulator_priv = state;
717−
718− buf[0] = 0x01;
719− buf[1] = 0x80;
720−
721− msg.addr = state->config->demod_address;
722− msg.flags = 0;
723− msg.len = sizeof(buf);
724− msg.buf = buf;
725−
726− if (i2c_transfer(state->adap, &msg, 1) != 1) {
727− kfree(state);
728− return NULL;
729− }
730−
731− return fe;
732−}
drivers/media/pci/pt1/va1j5jf8007s.h+0−42
@@ -1,42 +0,0 @@
1−/*
2− * ISDB-S driver for VA1J5JF8007/VA1J5JF8011
3− *
4− * Copyright (C) 2009 HIRANO Takahito <hiranotaka@zng.info>
5− *
6− * based on pt1dvr - http://pt1dvr.sourceforge.jp/
7− * by Tomoaki Ishikawa <tomy@users.sourceforge.jp>
8− *
9− * This program is free software; you can redistribute it and/or modify
10− * it under the terms of the GNU General Public License as published by
11− * the Free Software Foundation; either version 2 of the License, or
12− * (at your option) any later version.
13− *
14− * This program is distributed in the hope that it will be useful,
15− * but WITHOUT ANY WARRANTY; without even the implied warranty of
16− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17− * GNU General Public License for more details.
18− */
19−
20−#ifndef VA1J5JF8007S_H
21−#define VA1J5JF8007S_H
22−
23−enum va1j5jf8007s_frequency {
24− VA1J5JF8007S_20MHZ,
25− VA1J5JF8007S_25MHZ,
26−};
27−
28−struct va1j5jf8007s_config {
29− u8 demod_address;
30− enum va1j5jf8007s_frequency frequency;
31−};
32−
33−struct i2c_adapter;
34−
35−struct dvb_frontend *
36−va1j5jf8007s_attach(const struct va1j5jf8007s_config *config,
37− struct i2c_adapter *adap);
38−
39−/* must be called after va1j5jf8007t_attach */
40−int va1j5jf8007s_prepare(struct dvb_frontend *fe);
41−
42−#endif
drivers/media/pci/pt1/va1j5jf8007t.c+0−532
@@ -1,532 +0,0 @@
1−/*
2− * ISDB-T driver for VA1J5JF8007/VA1J5JF8011
3− *
4− * Copyright (C) 2009 HIRANO Takahito <hiranotaka@zng.info>
5− *
6− * based on pt1dvr - http://pt1dvr.sourceforge.jp/
7− * by Tomoaki Ishikawa <tomy@users.sourceforge.jp>
8− *
9− * This program is free software; you can redistribute it and/or modify
10− * it under the terms of the GNU General Public License as published by
11− * the Free Software Foundation; either version 2 of the License, or
12− * (at your option) any later version.
13− *
14− * This program is distributed in the hope that it will be useful,
15− * but WITHOUT ANY WARRANTY; without even the implied warranty of
16− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17− * GNU General Public License for more details.
18− */
19−
20−#include <linux/kernel.h>
21−#include <linux/module.h>
22−#include <linux/slab.h>
23−#include <linux/i2c.h>
24−#include <media/dvb_frontend.h>
25−#include <media/dvb_math.h>
26−#include "va1j5jf8007t.h"
27−
28−enum va1j5jf8007t_tune_state {
29− VA1J5JF8007T_IDLE,
30− VA1J5JF8007T_SET_FREQUENCY,
31− VA1J5JF8007T_CHECK_FREQUENCY,
32− VA1J5JF8007T_SET_MODULATION,
33− VA1J5JF8007T_CHECK_MODULATION,
34− VA1J5JF8007T_TRACK,
35− VA1J5JF8007T_ABORT,
36−};
37−
38−struct va1j5jf8007t_state {
39− const struct va1j5jf8007t_config *config;
40− struct i2c_adapter *adap;
41− struct dvb_frontend fe;
42− enum va1j5jf8007t_tune_state tune_state;
43−};
44−
45−static int va1j5jf8007t_read_snr(struct dvb_frontend *fe, u16 *snr)
46−{
47− struct va1j5jf8007t_state *state;
48− u8 addr;
49− int i;
50− u8 write_buf[1], read_buf[1];
51− struct i2c_msg msgs[2];
52− s32 word, x, y;
53−
54− state = fe->demodulator_priv;
55− addr = state->config->demod_address;
56−
57− word = 0;
58− for (i = 0; i < 3; i++) {
59− write_buf[0] = 0x8b + i;
60−
61− msgs[0].addr = addr;
62− msgs[0].flags = 0;
63− msgs[0].len = sizeof(write_buf);
64− msgs[0].buf = write_buf;
65−
66− msgs[1].addr = addr;
67− msgs[1].flags = I2C_M_RD;
68− msgs[1].len = sizeof(read_buf);
69− msgs[1].buf = read_buf;
70−
71− if (i2c_transfer(state->adap, msgs, 2) != 2)
72− return -EREMOTEIO;
73−
74− word <<= 8;
75− word |= read_buf[0];
76− }
77−
78− if (!word)
79− return -EIO;
80−
81− x = 10 * (intlog10(0x540000 * 100 / word) - (2 << 24));
82− y = (24ll << 46) / 1000000;
83− y = ((s64)y * x >> 30) - (16ll << 40) / 10000;
84− y = ((s64)y * x >> 29) + (398ll << 35) / 10000;
85− y = ((s64)y * x >> 30) + (5491ll << 29) / 10000;
86− y = ((s64)y * x >> 30) + (30965ll << 23) / 10000;
87− *snr = y >> 15;
88− return 0;
89−}
90−
91−static int va1j5jf8007t_get_frontend_algo(struct dvb_frontend *fe)
92−{
93− return DVBFE_ALGO_HW;
94−}
95−
96−static int
97−va1j5jf8007t_read_status(struct dvb_frontend *fe, enum fe_status *status)
98−{
99− struct va1j5jf8007t_state *state;
100−
101− state = fe->demodulator_priv;
102−
103− switch (state->tune_state) {
104− case VA1J5JF8007T_IDLE:
105− case VA1J5JF8007T_SET_FREQUENCY:
106− case VA1J5JF8007T_CHECK_FREQUENCY:
107− *status = 0;
108− return 0;
109−
110−
111− case VA1J5JF8007T_SET_MODULATION:
112− case VA1J5JF8007T_CHECK_MODULATION:
113− case VA1J5JF8007T_ABORT:
114− *status |= FE_HAS_SIGNAL;
115− return 0;
116−
117− case VA1J5JF8007T_TRACK:
118− *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_LOCK;
119− return 0;
120− }
121−
122− BUG();
123−}
124−
125−struct va1j5jf8007t_cb_map {
126− u32 frequency;
127− u8 cb;
128−};
129−
130−static const struct va1j5jf8007t_cb_map va1j5jf8007t_cb_maps[] = {
131− { 90000000, 0x80 },
132− { 140000000, 0x81 },
133− { 170000000, 0xa1 },
134− { 220000000, 0x62 },
135− { 330000000, 0xa2 },
136− { 402000000, 0xe2 },
137− { 450000000, 0x64 },
138− { 550000000, 0x84 },
139− { 600000000, 0xa4 },
140− { 700000000, 0xc4 },
141−};
142−
143−static u8 va1j5jf8007t_lookup_cb(u32 frequency)
144−{
145− int i;
146− const struct va1j5jf8007t_cb_map *map;
147−
148− for (i = 0; i < ARRAY_SIZE(va1j5jf8007t_cb_maps); i++) {
149− map = &va1j5jf8007t_cb_maps[i];
150− if (frequency < map->frequency)
151− return map->cb;
152− }
153− return 0xe4;
154−}
155−
156−static int va1j5jf8007t_set_frequency(struct va1j5jf8007t_state *state)
157−{
158− u32 frequency;
159− u16 word;
160− u8 buf[6];
161− struct i2c_msg msg;
162−
163− frequency = state->fe.dtv_property_cache.frequency;
164−
165− word = (frequency + 71428) / 142857 + 399;
166− buf[0] = 0xfe;
167− buf[1] = 0xc2;
168− buf[2] = word >> 8;
169− buf[3] = word;
170− buf[4] = 0x80;
171− buf[5] = va1j5jf8007t_lookup_cb(frequency);
172−
173− msg.addr = state->config->demod_address;
174− msg.flags = 0;
175− msg.len = sizeof(buf);
176− msg.buf = buf;
177−
178− if (i2c_transfer(state->adap, &msg, 1) != 1)
179− return -EREMOTEIO;
180−
181− return 0;
182−}
183−
184−static int
185−va1j5jf8007t_check_frequency(struct va1j5jf8007t_state *state, int *lock)
186−{
187− u8 addr;
188− u8 write_buf[2], read_buf[1];
189− struct i2c_msg msgs[2];
190−
191− addr = state->config->demod_address;
192−
193− write_buf[0] = 0xfe;
194− write_buf[1] = 0xc3;
195−
196− msgs[0].addr = addr;
197− msgs[0].flags = 0;
198− msgs[0].len = sizeof(write_buf);
199− msgs[0].buf = write_buf;
200−
201− msgs[1].addr = addr;
202− msgs[1].flags = I2C_M_RD;
203− msgs[1].len = sizeof(read_buf);
204− msgs[1].buf = read_buf;
205−
206− if (i2c_transfer(state->adap, msgs, 2) != 2)
207− return -EREMOTEIO;
208−
209− *lock = read_buf[0] & 0x40;
210− return 0;
211−}
212−
213−static int va1j5jf8007t_set_modulation(struct va1j5jf8007t_state *state)
214−{
215− u8 buf[2];
216− struct i2c_msg msg;
217−
218− buf[0] = 0x01;
219− buf[1] = 0x40;
220−
221− msg.addr = state->config->demod_address;
222− msg.flags = 0;
223− msg.len = sizeof(buf);
224− msg.buf = buf;
225−
226− if (i2c_transfer(state->adap, &msg, 1) != 1)
227− return -EREMOTEIO;
228−
229− return 0;
230−}
231−
232−static int va1j5jf8007t_check_modulation(struct va1j5jf8007t_state *state,
233− int *lock, int *retry)
234−{
235− u8 addr;
236− u8 write_buf[1], read_buf[1];
237− struct i2c_msg msgs[2];
238−
239− addr = state->config->demod_address;
240−
241− write_buf[0] = 0x80;
242−
243− msgs[0].addr = addr;
244− msgs[0].flags = 0;
245− msgs[0].len = sizeof(write_buf);
246− msgs[0].buf = write_buf;
247−
248− msgs[1].addr = addr;
249− msgs[1].flags = I2C_M_RD;
250− msgs[1].len = sizeof(read_buf);
251− msgs[1].buf = read_buf;
252−
253− if (i2c_transfer(state->adap, msgs, 2) != 2)
254− return -EREMOTEIO;
255−
256− *lock = !(read_buf[0] & 0x10);
257− *retry = read_buf[0] & 0x80;
258− return 0;
259−}
260−
261−static int
262−va1j5jf8007t_tune(struct dvb_frontend *fe,
263− bool re_tune,
264− unsigned int mode_flags, unsigned int *delay,
265− enum fe_status *status)
266−{
267− struct va1j5jf8007t_state *state;
268− int ret;
269− int lock = 0, retry = 0;
270−
271− state = fe->demodulator_priv;
272−
273− if (re_tune)
274− state->tune_state = VA1J5JF8007T_SET_FREQUENCY;
275−
276− switch (state->tune_state) {
277− case VA1J5JF8007T_IDLE:
278− *delay = 3 * HZ;
279− *status = 0;
280− return 0;
281−
282− case VA1J5JF8007T_SET_FREQUENCY:
283− ret = va1j5jf8007t_set_frequency(state);
284− if (ret < 0)
285− return ret;
286−
287− state->tune_state = VA1J5JF8007T_CHECK_FREQUENCY;
288− *delay = 0;
289− *status = 0;
290− return 0;
291−
292− case VA1J5JF8007T_CHECK_FREQUENCY:
293− ret = va1j5jf8007t_check_frequency(state, &lock);
294− if (ret < 0)
295− return ret;
296−
297− if (!lock) {
298− *delay = (HZ + 999) / 1000;
299− *status = 0;
300− return 0;
301− }
302−
303− state->tune_state = VA1J5JF8007T_SET_MODULATION;
304− *delay = 0;
305− *status = FE_HAS_SIGNAL;
306− return 0;
307−
308− case VA1J5JF8007T_SET_MODULATION:
309− ret = va1j5jf8007t_set_modulation(state);
310− if (ret < 0)
311− return ret;
312−
313− state->tune_state = VA1J5JF8007T_CHECK_MODULATION;
314− *delay = 0;
315− *status = FE_HAS_SIGNAL;
316− return 0;
317−
318− case VA1J5JF8007T_CHECK_MODULATION:
319− ret = va1j5jf8007t_check_modulation(state, &lock, &retry);
320− if (ret < 0)
321− return ret;
322−
323− if (!lock) {
324− if (!retry) {
325− state->tune_state = VA1J5JF8007T_ABORT;
326− *delay = 3 * HZ;
327− *status = FE_HAS_SIGNAL;
328− return 0;
329− }
330− *delay = (HZ + 999) / 1000;
331− *status = FE_HAS_SIGNAL;
332− return 0;
333− }
334−
335− state->tune_state = VA1J5JF8007T_TRACK;
336− /* fall through */
337−
338− case VA1J5JF8007T_TRACK:
339− *delay = 3 * HZ;
340− *status = FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_LOCK;
341− return 0;
342−
343− case VA1J5JF8007T_ABORT:
344− *delay = 3 * HZ;
345− *status = FE_HAS_SIGNAL;
346− return 0;
347− }
348−
349− BUG();
350−}
351−
352−static int va1j5jf8007t_init_frequency(struct va1j5jf8007t_state *state)
353−{
354− u8 buf[7];
355− struct i2c_msg msg;
356−
357− buf[0] = 0xfe;
358− buf[1] = 0xc2;
359− buf[2] = 0x01;
360− buf[3] = 0x8f;
361− buf[4] = 0xc1;
362− buf[5] = 0x80;
363− buf[6] = 0x80;
364−
365− msg.addr = state->config->demod_address;
366− msg.flags = 0;
367− msg.len = sizeof(buf);
368− msg.buf = buf;
369−
370− if (i2c_transfer(state->adap, &msg, 1) != 1)
371− return -EREMOTEIO;
372−
373− return 0;
374−}
375−
376−static int va1j5jf8007t_set_sleep(struct va1j5jf8007t_state *state, int sleep)
377−{
378− u8 buf[2];
379− struct i2c_msg msg;
380−
381− buf[0] = 0x03;
382− buf[1] = sleep ? 0x90 : 0x80;
383−
384− msg.addr = state->config->demod_address;
385− msg.flags = 0;
386− msg.len = sizeof(buf);
387− msg.buf = buf;
388−
389− if (i2c_transfer(state->adap, &msg, 1) != 1)
390− return -EREMOTEIO;
391−
392− return 0;
393−}
394−
395−static int va1j5jf8007t_sleep(struct dvb_frontend *fe)
396−{
397− struct va1j5jf8007t_state *state;
398− int ret;
399−
400− state = fe->demodulator_priv;
401−
402− ret = va1j5jf8007t_init_frequency(state);
403− if (ret < 0)
404− return ret;
405−
406− return va1j5jf8007t_set_sleep(state, 1);
407−}
408−
409−static int va1j5jf8007t_init(struct dvb_frontend *fe)
410−{
411− struct va1j5jf8007t_state *state;
412−
413− state = fe->demodulator_priv;
414− state->tune_state = VA1J5JF8007T_IDLE;
415−
416− return va1j5jf8007t_set_sleep(state, 0);
417−}
418−
419−static void va1j5jf8007t_release(struct dvb_frontend *fe)
420−{
421− struct va1j5jf8007t_state *state;
422− state = fe->demodulator_priv;
423− kfree(state);
424−}
425−
426−static const struct dvb_frontend_ops va1j5jf8007t_ops = {
427− .delsys = { SYS_ISDBT },
428− .info = {
429− .name = "VA1J5JF8007/VA1J5JF8011 ISDB-T",
430− .frequency_min = 90000000,
431− .frequency_max = 770000000,
432− .frequency_stepsize = 142857,
433− .caps = FE_CAN_INVERSION_AUTO | FE_CAN_FEC_AUTO |
434− FE_CAN_QAM_AUTO | FE_CAN_TRANSMISSION_MODE_AUTO |
435− FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO,
436− },
437−
438− .read_snr = va1j5jf8007t_read_snr,
439− .get_frontend_algo = va1j5jf8007t_get_frontend_algo,
440− .read_status = va1j5jf8007t_read_status,
441− .tune = va1j5jf8007t_tune,
442− .sleep = va1j5jf8007t_sleep,
443− .init = va1j5jf8007t_init,
444− .release = va1j5jf8007t_release,
445−};
446−
447−static const u8 va1j5jf8007t_20mhz_prepare_bufs[][2] = {
448− {0x03, 0x90}, {0x14, 0x8f}, {0x1c, 0x2a}, {0x1d, 0xa8}, {0x1e, 0xa2},
449− {0x22, 0x83}, {0x31, 0x0d}, {0x32, 0xe0}, {0x39, 0xd3}, {0x3a, 0x00},
450− {0x5c, 0x40}, {0x5f, 0x80}, {0x75, 0x02}, {0x76, 0x4e}, {0x77, 0x03},
451− {0xef, 0x01}
452−};
453−
454−static const u8 va1j5jf8007t_25mhz_prepare_bufs[][2] = {
455− {0x03, 0x90}, {0x1c, 0x2a}, {0x1d, 0xa8}, {0x1e, 0xa2}, {0x22, 0x83},
456− {0x3a, 0x00}, {0x5c, 0x40}, {0x5f, 0x80}, {0x75, 0x0a}, {0x76, 0x4c},
457− {0x77, 0x03}, {0xef, 0x01}
458−};
459−
460−int va1j5jf8007t_prepare(struct dvb_frontend *fe)
461−{
462− struct va1j5jf8007t_state *state;
463− const u8 (*bufs)[2];
464− int size;
465− u8 buf[2];
466− struct i2c_msg msg;
467− int i;
468−
469− state = fe->demodulator_priv;
470−
471− switch (state->config->frequency) {
472− case VA1J5JF8007T_20MHZ:
473− bufs = va1j5jf8007t_20mhz_prepare_bufs;
474− size = ARRAY_SIZE(va1j5jf8007t_20mhz_prepare_bufs);
475− break;
476− case VA1J5JF8007T_25MHZ:
477− bufs = va1j5jf8007t_25mhz_prepare_bufs;
478− size = ARRAY_SIZE(va1j5jf8007t_25mhz_prepare_bufs);
479− break;
480− default:
481− return -EINVAL;
482− }
483−
484− msg.addr = state->config->demod_address;
485− msg.flags = 0;
486− msg.len = sizeof(buf);
487− msg.buf = buf;
488−
489− for (i = 0; i < size; i++) {
490− memcpy(buf, bufs[i], sizeof(buf));
491− if (i2c_transfer(state->adap, &msg, 1) != 1)
492− return -EREMOTEIO;
493− }
494−
495− return va1j5jf8007t_init_frequency(state);
496−}
497−
498−struct dvb_frontend *
499−va1j5jf8007t_attach(const struct va1j5jf8007t_config *config,
500− struct i2c_adapter *adap)
501−{
502− struct va1j5jf8007t_state *state;
503− struct dvb_frontend *fe;
504− u8 buf[2];
505− struct i2c_msg msg;
506−
507− state = kzalloc(sizeof(struct va1j5jf8007t_state), GFP_KERNEL);
508− if (!state)
509− return NULL;
510−
511− state->config = config;
512− state->adap = adap;
513−
514− fe = &state->fe;
515− memcpy(&fe->ops, &va1j5jf8007t_ops, sizeof(struct dvb_frontend_ops));
516− fe->demodulator_priv = state;
517−
518− buf[0] = 0x01;
519− buf[1] = 0x80;
520−
521− msg.addr = state->config->demod_address;
522− msg.flags = 0;
523− msg.len = sizeof(buf);
524− msg.buf = buf;
525−
526− if (i2c_transfer(state->adap, &msg, 1) != 1) {
527− kfree(state);
528− return NULL;
529− }
530−
531− return fe;
532−}
drivers/media/pci/pt1/va1j5jf8007t.h+0−42
@@ -1,42 +0,0 @@
1−/*
2− * ISDB-T driver for VA1J5JF8007/VA1J5JF8011
3− *
4− * Copyright (C) 2009 HIRANO Takahito <hiranotaka@zng.info>
5− *
6− * based on pt1dvr - http://pt1dvr.sourceforge.jp/
7− * by Tomoaki Ishikawa <tomy@users.sourceforge.jp>
8− *
9− * This program is free software; you can redistribute it and/or modify
10− * it under the terms of the GNU General Public License as published by
11− * the Free Software Foundation; either version 2 of the License, or
12− * (at your option) any later version.
13− *
14− * This program is distributed in the hope that it will be useful,
15− * but WITHOUT ANY WARRANTY; without even the implied warranty of
16− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17− * GNU General Public License for more details.
18− */
19−
20−#ifndef VA1J5JF8007T_H
21−#define VA1J5JF8007T_H
22−
23−enum va1j5jf8007t_frequency {
24− VA1J5JF8007T_20MHZ,
25− VA1J5JF8007T_25MHZ,
26−};
27−
28−struct va1j5jf8007t_config {
29− u8 demod_address;
30− enum va1j5jf8007t_frequency frequency;
31−};
32−
33−struct i2c_adapter;
34−
35−struct dvb_frontend *
36−va1j5jf8007t_attach(const struct va1j5jf8007t_config *config,
37− struct i2c_adapter *adap);
38−
39−/* must be called after va1j5jf8007s_attach */
40−int va1j5jf8007t_prepare(struct dvb_frontend *fe);
41−
42−#endif
drivers/media/pci/pt3/pt3.c+22−48
@@ -1,17 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Earthsoft PT3 driver
34 *
45 * Copyright (C) 2014 Akihiro Tsukada <tskd08@gmail.com>
5− *
6− * This program is free software; you can redistribute it and/or
7− * modify it under the terms of the GNU General Public License as
8− * published by the Free Software Foundation version 2.
9− *
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
156 */
167
178 #include <linux/freezer.h>
@@ -376,25 +367,22 @@ static int pt3_fe_init(struct pt3_board *pt3) · 358 unmodified lines
376367
377368 static int pt3_attach_fe(struct pt3_board *pt3, int i)
378369 {
379− struct i2c_board_info info;
370+ const struct i2c_board_info *info;
380371 struct tc90522_config cfg;
381372 struct i2c_client *cl;
382373 struct dvb_adapter *dvb_adap;
383374 int ret;
384375
385− info = adap_conf[i].demod_info;
376+ info = &adap_conf[i].demod_info;
386377 cfg = adap_conf[i].demod_cfg;
387378 cfg.tuner_i2c = NULL;
388− info.platform_data = &cfg;
389379
390380 ret = -ENODEV;
391− request_module("tc90522");
392− cl = i2c_new_device(&pt3->i2c_adap, &info);
393− if (!cl || !cl->dev.driver)
381+ cl = dvb_module_probe("tc90522", info->type, &pt3->i2c_adap,
382+ info->addr, &cfg);
383+ if (!cl)
394384 return -ENODEV;
395385 pt3->adaps[i]->i2c_demod = cl;
396− if (!try_module_get(cl->dev.driver->owner))
397− goto err_demod_i2c_unregister_device;
398386
399387 if (!strncmp(cl->name, TC90522_I2C_DEV_SAT,
400388 strlen(TC90522_I2C_DEV_SAT))) {
@@ -402,41 +390,33 @@ static int pt3_attach_fe(struct pt3_board *pt3, int i) · 1 unmodified line
402390
403391 tcfg = adap_conf[i].tuner_cfg.qm1d1c0042;
404392 tcfg.fe = cfg.fe;
405− info = adap_conf[i].tuner_info;
406− info.platform_data = &tcfg;
407− request_module("qm1d1c0042");
408− cl = i2c_new_device(cfg.tuner_i2c, &info);
393+ info = &adap_conf[i].tuner_info;
394+ cl = dvb_module_probe("qm1d1c0042", info->type, cfg.tuner_i2c,
395+ info->addr, &tcfg);
409396 } else {
410397 struct mxl301rf_config tcfg;
411398
412399 tcfg = adap_conf[i].tuner_cfg.mxl301rf;
413400 tcfg.fe = cfg.fe;
414− info = adap_conf[i].tuner_info;
415− info.platform_data = &tcfg;
416− request_module("mxl301rf");
417− cl = i2c_new_device(cfg.tuner_i2c, &info);
401+ info = &adap_conf[i].tuner_info;
402+ cl = dvb_module_probe("mxl301rf", info->type, cfg.tuner_i2c,
403+ info->addr, &tcfg);
418404 }
419− if (!cl || !cl->dev.driver)
420− goto err_demod_module_put;
405+ if (!cl)
406+ goto err_demod_module_release;
421407 pt3->adaps[i]->i2c_tuner = cl;
422− if (!try_module_get(cl->dev.driver->owner))
423− goto err_tuner_i2c_unregister_device;
424408
425409 dvb_adap = &pt3->adaps[one_adapter ? 0 : i]->dvb_adap;
426410 ret = dvb_register_frontend(dvb_adap, cfg.fe);
427411 if (ret < 0)
428− goto err_tuner_module_put;
412+ goto err_tuner_module_release;
429413 pt3->adaps[i]->fe = cfg.fe;
430414 return 0;
431415
432−err_tuner_module_put:
433− module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
434−err_tuner_i2c_unregister_device:
435− i2c_unregister_device(pt3->adaps[i]->i2c_tuner);
436−err_demod_module_put:
437− module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
438−err_demod_i2c_unregister_device:
439− i2c_unregister_device(pt3->adaps[i]->i2c_demod);
416+err_tuner_module_release:
417+ dvb_module_release(pt3->adaps[i]->i2c_tuner);
418+err_demod_module_release:
419+ dvb_module_release(pt3->adaps[i]->i2c_demod);
440420
441421 return ret;
442422 }
@@ -464,7 +444,7 @@ static int pt3_fetch_thread(void *data) · 21 unmodified lines
464444
465445 pt3_proc_dma(adap);
466446
467− delay = PT3_FETCH_DELAY * NSEC_PER_MSEC;
447+ delay = ktime_set(0, PT3_FETCH_DELAY * NSEC_PER_MSEC);
468448 set_current_state(TASK_UNINTERRUPTIBLE);
469449 freezable_schedule_hrtimeout_range(&delay,
470450 PT3_FETCH_DELAY_DELTA * NSEC_PER_MSEC,
@@ -630,14 +610,8 @@ static void pt3_cleanup_adapter(struct pt3_board *pt3, int index) · 159 unmodified lines
630610 adap->fe->callback = NULL;
631611 if (adap->fe->frontend_priv)
632612 dvb_unregister_frontend(adap->fe);
633− if (adap->i2c_tuner) {
634− module_put(adap->i2c_tuner->dev.driver->owner);
635− i2c_unregister_device(adap->i2c_tuner);
636− }
637− if (adap->i2c_demod) {
638− module_put(adap->i2c_demod->dev.driver->owner);
639− i2c_unregister_device(adap->i2c_demod);
640− }
613+ dvb_module_release(adap->i2c_tuner);
614+ dvb_module_release(adap->i2c_demod);
641615 }
642616 pt3_free_dmabuf(adap);
643617 dvb_dmxdev_release(&adap->dmxdev);
drivers/media/pci/pt3/pt3.h+1−10
@@ -1,17 +1,8 @@
1+/* SPDX-License-Identifier: GPL-2.0 */
12 /*
23 * Earthsoft PT3 driver
34 *
45 * Copyright (C) 2014 Akihiro Tsukada <tskd08@gmail.com>
5− *
6− * This program is free software; you can redistribute it and/or
7− * modify it under the terms of the GNU General Public License as
8− * published by the Free Software Foundation version 2.
9− *
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
156 */
167
178 #ifndef PT3_H
drivers/media/pci/pt3/pt3_dma.c+1−10
@@ -1,17 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Earthsoft PT3 driver
34 *
45 * Copyright (C) 2014 Akihiro Tsukada <tskd08@gmail.com>
5− *
6− * This program is free software; you can redistribute it and/or
7− * modify it under the terms of the GNU General Public License as
8− * published by the Free Software Foundation version 2.
9− *
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
156 */
167 #include <linux/dma-mapping.h>
178 #include <linux/kernel.h>
drivers/media/pci/pt3/pt3_i2c.c+1−10
@@ -1,17 +1,8 @@
1+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Earthsoft PT3 driver
34 *
45 * Copyright (C) 2014 Akihiro Tsukada <tskd08@gmail.com>
5− *
6− * This program is free software; you can redistribute it and/or
7− * modify it under the terms of the GNU General Public License as
8− * published by the Free Software Foundation version 2.
9− *
10− *
11− * This program is distributed in the hope that it will be useful,
12− * but WITHOUT ANY WARRANTY; without even the implied warranty of
13− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14− * GNU General Public License for more details.
156 */
167 #include <linux/delay.h>
178 #include <linux/device.h>
drivers/media/pci/saa7164/saa7164-fw.c+2−1
@@ -426,7 +426,8 @@ int saa7164_downloadfirmware(struct saa7164_dev *dev) · 425 unmodified lines
426426 __func__, fw->size);
427427
428428 if (fw->size != fwlength) {
429− printk(KERN_ERR "xc5000: firmware incorrect size\n");
429+ printk(KERN_ERR "saa7164: firmware incorrect size %zu != %u\n",
430+ fw->size, fwlength);
430431 ret = -ENOMEM;
431432 goto out;
432433 }
drivers/media/pci/solo6x10/Kconfig+0−1
@@ -1,7 +1,6 @@
11 config VIDEO_SOLO6X10
22 tristate "Bluecherry / Softlogic 6x10 capture cards (MPEG-4/H.264)"
33 depends on PCI && VIDEO_DEV && SND && I2C
4− depends on HAS_DMA
54 select BITREVERSE
65 select FONT_SUPPORT
76 select FONT_8x16
drivers/media/pci/sta2x11/Kconfig+1−2
@@ -1,7 +1,6 @@
11 config STA2X11_VIP
22 tristate "STA2X11 VIP Video For Linux"
3− depends on STA2X11
4− depends on HAS_DMA
3+ depends on STA2X11 || COMPILE_TEST
54 select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
65 select VIDEOBUF2_DMA_CONTIG
76 depends on PCI && VIDEO_V4L2 && VIRT_TO_BUS
drivers/media/pci/sta2x11/sta2x11_vip.c+15−16
@@ -908,10 +908,10 @@ static int sta2x11_vip_init_controls(struct sta2x11_vip *vip) · 907 unmodified lines
908908 static int vip_gpio_reserve(struct device *dev, int pin, int dir,
909909 const char *name)
910910 {
911− int ret;
911+ int ret = -ENODEV;
912912
913− if (pin == -1)
914− return 0;
913+ if (!gpio_is_valid(pin))
914+ return ret;
915915
916916 ret = gpio_request(pin, name);
917917 if (ret) {
@@ -946,7 +946,7 @@ static int vip_gpio_reserve(struct device *dev, int pin, int dir, · 28 unmodified lines
946946 */
947947 static void vip_gpio_release(struct device *dev, int pin, const char *name)
948948 {
949− if (pin != -1) {
949+ if (gpio_is_valid(pin)) {
950950 dev_dbg(dev, "releasing pin %d (%s)\n", pin, name);
951951 gpio_unexport(pin);
952952 gpio_free(pin);
@@ -1003,25 +1003,24 @@ static int sta2x11_vip_init_one(struct pci_dev *pdev, · 50 unmodified lines
10031003 if (ret)
10041004 goto disable;
10051005
1006− if (config->reset_pin >= 0) {
1007− ret = vip_gpio_reserve(&pdev->dev, config->reset_pin, 0,
1008− config->reset_name);
1009− if (ret) {
1010− vip_gpio_release(&pdev->dev, config->pwr_pin,
1011− config->pwr_name);
1012− goto disable;
1013− }
1006+ ret = vip_gpio_reserve(&pdev->dev, config->reset_pin, 0,
1007+ config->reset_name);
1008+ if (ret) {
1009+ vip_gpio_release(&pdev->dev, config->pwr_pin,
1010+ config->pwr_name);
1011+ goto disable;
10141012 }
1015− if (config->pwr_pin != -1) {
1013+
1014+ if (gpio_is_valid(config->pwr_pin)) {
10161015 /* Datasheet says 5ms between PWR and RST */
10171016 usleep_range(5000, 25000);
1018− ret = gpio_direction_output(config->pwr_pin, 1);
1017+ gpio_direction_output(config->pwr_pin, 1);
10191018 }
10201019
1021− if (config->reset_pin != -1) {
1020+ if (gpio_is_valid(config->reset_pin)) {
10221021 /* Datasheet says 5ms between PWR and RST */
10231022 usleep_range(5000, 25000);
1024− ret = gpio_direction_output(config->reset_pin, 1);
1023+ gpio_direction_output(config->reset_pin, 1);
10251024 }
10261025 usleep_range(5000, 25000);
10271026
drivers/media/pci/tw5864/Kconfig+0−1
@@ -1,7 +1,6 @@
11 config VIDEO_TW5864
22 tristate "Techwell TW5864 video/audio grabber and encoder"
33 depends on VIDEO_DEV && PCI && VIDEO_V4L2
4− depends on HAS_DMA
54 select VIDEOBUF2_DMA_CONTIG
65 ---help---
76 Support for boards based on Techwell TW5864 chip which provides
drivers/media/pci/tw686x/Kconfig+0−1
@@ -1,7 +1,6 @@
11 config VIDEO_TW686X
22 tristate "Intersil/Techwell TW686x video capture cards"
33 depends on PCI && VIDEO_DEV && VIDEO_V4L2 && SND
4− depends on HAS_DMA
54 select VIDEOBUF2_VMALLOC
65 select VIDEOBUF2_DMA_CONTIG
76 select VIDEOBUF2_DMA_SG
drivers/media/pci/tw686x/tw686x-video.c+2−1
@@ -1228,7 +1228,8 @@ int tw686x_video_init(struct tw686x_dev *dev) · 1227 unmodified lines
12281228 vc->vidq.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
12291229 vc->vidq.min_buffers_needed = 2;
12301230 vc->vidq.lock = &vc->vb_mutex;
1231− vc->vidq.gfp_flags = GFP_DMA32;
1231+ vc->vidq.gfp_flags = dev->dma_mode != TW686X_DMA_MODE_MEMCPY ?
1232+ GFP_DMA32 : 0;
12321233 vc->vidq.dev = &dev->pci_dev->dev;
12331234
12341235 err = vb2_queue_init(&vc->vidq);
drivers/media/platform/Kconfig+22−35
@@ -26,6 +26,7 @@ config VIDEO_VIA_CAMERA · 25 unmodified lines
2626 #
2727 # Platform multimedia device configuration
2828 #
29+source "drivers/media/platform/cadence/Kconfig"
2930
3031 source "drivers/media/platform/davinci/Kconfig"
3132
@@ -34,7 +35,7 @@ source "drivers/media/platform/omap/Kconfig" · 2 unmodified lines
3435 config VIDEO_SH_VOU
3536 tristate "SuperH VOU video output driver"
3637 depends on MEDIA_CAMERA_SUPPORT
37− depends on VIDEO_DEV && I2C && HAS_DMA
38+ depends on VIDEO_DEV && I2C
3839 depends on ARCH_SHMOBILE || COMPILE_TEST
3940 select VIDEOBUF2_DMA_CONTIG
4041 help
@@ -42,7 +43,7 @@ config VIDEO_SH_VOU · 1 unmodified line
4243
4344 config VIDEO_VIU
4445 tristate "Freescale VIU Video Driver"
45− depends on VIDEO_V4L2 && PPC_MPC512x
46+ depends on VIDEO_V4L2 && (PPC_MPC512x || COMPILE_TEST) && I2C
4647 select VIDEOBUF_DMA_CONTIG
4748 default y
4849 ---help---
@@ -62,10 +63,10 @@ config VIDEO_MUX · 13 unmodified lines
6263
6364 config VIDEO_OMAP3
6465 tristate "OMAP 3 Camera support"
65− depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API && ARCH_OMAP3
66− depends on HAS_DMA && OF
67− depends on OMAP_IOMMU
68− select ARM_DMA_USE_IOMMU
66+ depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
67+ depends on (ARCH_OMAP3 && OMAP_IOMMU) || COMPILE_TEST
68+ depends on COMMON_CLK && OF
69+ select ARM_DMA_USE_IOMMU if OMAP_IOMMU
6970 select VIDEOBUF2_DMA_CONTIG
7071 select MFD_SYSCON
7172 select V4L2_FWNODE
@@ -80,7 +81,7 @@ config VIDEO_OMAP3_DEBUG · 8 unmodified lines
8081
8182 config VIDEO_PXA27x
8283 tristate "PXA27x Quick Capture Interface driver"
83− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
84+ depends on VIDEO_DEV && VIDEO_V4L2
8485 depends on PXA27x || COMPILE_TEST
8586 select VIDEOBUF2_DMA_SG
8687 select SG_SPLIT
@@ -90,7 +91,7 @@ config VIDEO_PXA27x · 3 unmodified lines
9091
9192 config VIDEO_QCOM_CAMSS
9293 tristate "Qualcomm 8x16 V4L2 Camera Subsystem driver"
93− depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
94+ depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
9495 depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
9596 select VIDEOBUF2_DMA_SG
9697 select V4L2_FWNODE
@@ -100,7 +101,6 @@ config VIDEO_S3C_CAMIF · 3 unmodified lines
100101 depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
101102 depends on PM
102103 depends on ARCH_S3C64XX || PLAT_S3C24XX || COMPILE_TEST
103− depends on HAS_DMA
104104 select VIDEOBUF2_DMA_CONTIG
105105 ---help---
106106 This is a v4l2 driver for s3c24xx and s3c64xx SoC series camera
@@ -111,7 +111,7 @@ config VIDEO_S3C_CAMIF · 4 unmodified lines
111111
112112 config VIDEO_STM32_DCMI
113113 tristate "STM32 Digital Camera Memory Interface (DCMI) support"
114− depends on VIDEO_V4L2 && OF && HAS_DMA
114+ depends on VIDEO_V4L2 && OF
115115 depends on ARCH_STM32 || COMPILE_TEST
116116 select VIDEOBUF2_DMA_CONTIG
117117 select V4L2_FWNODE
@@ -124,7 +124,7 @@ config VIDEO_STM32_DCMI · 6 unmodified lines
124124
125125 config VIDEO_RENESAS_CEU
126126 tristate "Renesas Capture Engine Unit (CEU) driver"
127− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
127+ depends on VIDEO_DEV && VIDEO_V4L2
128128 depends on ARCH_SHMOBILE || ARCH_R7S72100 || COMPILE_TEST
129129 select VIDEOBUF2_DMA_CONTIG
130130 select V4L2_FWNODE
@@ -142,7 +142,6 @@ config VIDEO_TI_CAL · 11 unmodified lines
142142 tristate "TI CAL (Camera Adaptation Layer) driver"
143143 depends on VIDEO_DEV && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
144144 depends on SOC_DRA7XX || COMPILE_TEST
145− depends on HAS_DMA
146145 select VIDEOBUF2_DMA_CONTIG
147146 select V4L2_FWNODE
148147 default n
@@ -170,7 +169,6 @@ if V4L_MEM2MEM_DRIVERS · 21 unmodified lines
170169 config VIDEO_CODA
171170 tristate "Chips&Media Coda multi-standard codec IP"
172171 depends on VIDEO_DEV && VIDEO_V4L2 && (ARCH_MXC || COMPILE_TEST)
173− depends on HAS_DMA
174172 select SRAM
175173 select VIDEOBUF2_DMA_CONTIG
176174 select VIDEOBUF2_VMALLOC
@@ -188,7 +186,6 @@ config VIDEO_MEDIATEK_JPEG · 11 unmodified lines
188186 depends on MTK_IOMMU_V1 || COMPILE_TEST
189187 depends on VIDEO_DEV && VIDEO_V4L2
190188 depends on ARCH_MEDIATEK || COMPILE_TEST
191− depends on HAS_DMA
192189 select VIDEOBUF2_DMA_CONTIG
193190 select V4L2_MEM2MEM_DEV
194191 ---help---
@@ -200,7 +197,7 @@ config VIDEO_MEDIATEK_JPEG · 5 unmodified lines
200197
201198 config VIDEO_MEDIATEK_VPU
202199 tristate "Mediatek Video Processor Unit"
203− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
200+ depends on VIDEO_DEV && VIDEO_V4L2
204201 depends on ARCH_MEDIATEK || COMPILE_TEST
205202 ---help---
206203 This driver provides downloading VPU firmware and
@@ -216,7 +213,6 @@ config VIDEO_MEDIATEK_MDP · 9 unmodified lines
216213 depends on MTK_IOMMU || COMPILE_TEST
217214 depends on VIDEO_DEV && VIDEO_V4L2
218215 depends on ARCH_MEDIATEK || COMPILE_TEST
219− depends on HAS_DMA
220216 select VIDEOBUF2_DMA_CONTIG
221217 select V4L2_MEM2MEM_DEV
222218 select VIDEO_MEDIATEK_VPU
@@ -231,7 +227,7 @@ config VIDEO_MEDIATEK_MDP · 8 unmodified lines
231227 config VIDEO_MEDIATEK_VCODEC
232228 tristate "Mediatek Video Codec driver"
233229 depends on MTK_IOMMU || COMPILE_TEST
234− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
230+ depends on VIDEO_DEV && VIDEO_V4L2
235231 depends on ARCH_MEDIATEK || COMPILE_TEST
236232 select VIDEOBUF2_DMA_CONTIG
237233 select V4L2_MEM2MEM_DEV
@@ -247,7 +243,7 @@ config VIDEO_MEDIATEK_VCODEC · 9 unmodified lines
247243
248244 config VIDEO_MEM2MEM_DEINTERLACE
249245 tristate "Deinterlace support"
250− depends on VIDEO_DEV && VIDEO_V4L2 && DMA_ENGINE
246+ depends on VIDEO_DEV && VIDEO_V4L2
251247 depends on HAS_DMA
252248 select VIDEOBUF2_DMA_CONTIG
253249 select V4L2_MEM2MEM_DEV
@@ -258,7 +254,6 @@ config VIDEO_SAMSUNG_S5P_G2D · 4 unmodified lines
258254 tristate "Samsung S5P and EXYNOS4 G2D 2d graphics accelerator driver"
259255 depends on VIDEO_DEV && VIDEO_V4L2
260256 depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
261− depends on HAS_DMA
262257 select VIDEOBUF2_DMA_CONTIG
263258 select V4L2_MEM2MEM_DEV
264259 default n
@@ -270,7 +265,6 @@ config VIDEO_SAMSUNG_S5P_JPEG · 5 unmodified lines
270265 tristate "Samsung S5P/Exynos3250/Exynos4 JPEG codec driver"
271266 depends on VIDEO_DEV && VIDEO_V4L2
272267 depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
273− depends on HAS_DMA
274268 select VIDEOBUF2_DMA_CONTIG
275269 select V4L2_MEM2MEM_DEV
276270 ---help---
@@ -281,7 +275,6 @@ config VIDEO_SAMSUNG_S5P_MFC · 4 unmodified lines
281275 tristate "Samsung S5P MFC Video Codec"
282276 depends on VIDEO_DEV && VIDEO_V4L2
283277 depends on ARCH_S5PV210 || ARCH_EXYNOS || COMPILE_TEST
284− depends on HAS_DMA
285278 select VIDEOBUF2_DMA_CONTIG
286279 default n
287280 help
@@ -291,7 +284,6 @@ config VIDEO_MX2_EMMAPRP · 3 unmodified lines
291284 tristate "MX2 eMMa-PrP support"
292285 depends on VIDEO_DEV && VIDEO_V4L2
293286 depends on SOC_IMX27 || COMPILE_TEST
294− depends on HAS_DMA
295287 select VIDEOBUF2_DMA_CONTIG
296288 select V4L2_MEM2MEM_DEV
297289 help
@@ -303,7 +295,6 @@ config VIDEO_SAMSUNG_EXYNOS_GSC · 5 unmodified lines
303295 tristate "Samsung Exynos G-Scaler driver"
304296 depends on VIDEO_DEV && VIDEO_V4L2
305297 depends on ARCH_EXYNOS || COMPILE_TEST
306− depends on HAS_DMA
307298 select VIDEOBUF2_DMA_CONTIG
308299 select V4L2_MEM2MEM_DEV
309300 help
@@ -312,7 +303,6 @@ config VIDEO_SAMSUNG_EXYNOS_GSC · 2 unmodified lines
312303 config VIDEO_STI_BDISP
313304 tristate "STMicroelectronics BDISP 2D blitter driver"
314305 depends on VIDEO_DEV && VIDEO_V4L2
315− depends on HAS_DMA
316306 depends on ARCH_STI || COMPILE_TEST
317307 select VIDEOBUF2_DMA_CONTIG
318308 select V4L2_MEM2MEM_DEV
@@ -322,7 +312,6 @@ config VIDEO_STI_BDISP · 3 unmodified lines
322312 config VIDEO_STI_HVA
323313 tristate "STMicroelectronics HVA multi-format video encoder V4L2 driver"
324314 depends on VIDEO_DEV && VIDEO_V4L2
325− depends on HAS_DMA
326315 depends on ARCH_STI || COMPILE_TEST
327316 select VIDEOBUF2_DMA_CONTIG
328317 select V4L2_MEM2MEM_DEV
@@ -349,7 +338,6 @@ config VIDEO_STI_DELTA · 20 unmodified lines
349338 tristate "STMicroelectronics DELTA multi-format video decoder V4L2 driver"
350339 depends on VIDEO_DEV && VIDEO_V4L2
351340 depends on ARCH_STI || COMPILE_TEST
352− depends on HAS_DMA
353341 help
354342 This V4L2 driver enables DELTA multi-format video decoder
355343 of STMicroelectronics STiH4xx SoC series allowing hardware
@@ -395,7 +383,7 @@ config VIDEO_SH_VEU · 39 unmodified lines
395383
396384 config VIDEO_RENESAS_FDP1
397385 tristate "Renesas Fine Display Processor"
398− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
386+ depends on VIDEO_DEV && VIDEO_V4L2
399387 depends on ARCH_SHMOBILE || COMPILE_TEST
400388 depends on (!ARCH_RENESAS && !VIDEO_RENESAS_FCP) || VIDEO_RENESAS_FCP
401389 select VIDEOBUF2_DMA_CONTIG
@@ -409,7 +397,7 @@ config VIDEO_RENESAS_FDP1 · 7 unmodified lines
409397
410398 config VIDEO_RENESAS_JPU
411399 tristate "Renesas JPEG Processing Unit"
412− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
400+ depends on VIDEO_DEV && VIDEO_V4L2
413401 depends on ARCH_RENESAS || COMPILE_TEST
414402 select VIDEOBUF2_DMA_CONTIG
415403 select V4L2_MEM2MEM_DEV
@@ -434,8 +422,8 @@ config VIDEO_RENESAS_FCP · 18 unmodified lines
434422
435423 config VIDEO_RENESAS_VSP1
436424 tristate "Renesas VSP1 Video Processing Engine"
437− depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
438− depends on (ARCH_RENESAS && OF) || COMPILE_TEST
425+ depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
426+ depends on ARCH_RENESAS || COMPILE_TEST
439427 depends on (!ARM64 && !VIDEO_RENESAS_FCP) || VIDEO_RENESAS_FCP
440428 select VIDEOBUF2_DMA_CONTIG
441429 select VIDEOBUF2_VMALLOC
@@ -447,7 +435,7 @@ config VIDEO_RENESAS_VSP1 · 5 unmodified lines
447435
448436 config VIDEO_ROCKCHIP_RGA
449437 tristate "Rockchip Raster 2d Graphic Acceleration Unit"
450− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
438+ depends on VIDEO_DEV && VIDEO_V4L2
451439 depends on ARCH_ROCKCHIP || COMPILE_TEST
452440 select VIDEOBUF2_DMA_SG
453441 select V4L2_MEM2MEM_DEV
@@ -464,7 +452,6 @@ config VIDEO_TI_VPE · 10 unmodified lines
464452 tristate "TI VPE (Video Processing Engine) driver"
465453 depends on VIDEO_DEV && VIDEO_V4L2
466454 depends on SOC_DRA7XX || COMPILE_TEST
467− depends on HAS_DMA
468455 select VIDEOBUF2_DMA_CONTIG
469456 select V4L2_MEM2MEM_DEV
470457 select VIDEO_TI_VPDMA
@@ -483,7 +470,7 @@ config VIDEO_TI_VPE_DEBUG · 12 unmodified lines
483470
484471 config VIDEO_QCOM_VENUS
485472 tristate "Qualcomm Venus V4L2 encoder/decoder driver"
486− depends on VIDEO_DEV && VIDEO_V4L2 && HAS_DMA
473+ depends on VIDEO_DEV && VIDEO_V4L2
487474 depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
488475 select QCOM_MDT_LOADER if ARCH_QCOM
489476 select QCOM_SCM if ARCH_QCOM
@@ -558,7 +545,7 @@ config VIDEO_MESON_AO_CEC · 68 unmodified lines
558545
559546 config CEC_GPIO
560547 tristate "Generic GPIO-based CEC driver"
561− depends on PREEMPT
548+ depends on PREEMPT || COMPILE_TEST
562549 select CEC_CORE
563550 select CEC_PIN
564551 select GPIOLIB
@@ -625,7 +612,7 @@ if SDR_PLATFORM_DRIVERS · 60 unmodified lines
625612
626613 config VIDEO_RCAR_DRIF
627614 tristate "Renesas Digitial Radio Interface (DRIF)"
628− depends on VIDEO_V4L2 && HAS_DMA
615+ depends on VIDEO_V4L2
629616 depends on ARCH_RENESAS || COMPILE_TEST
630617 select VIDEOBUF2_VMALLOC
631618 ---help---
drivers/media/platform/Makefile+1−0
@@ -3,6 +3,7 @@ · 2 unmodified lines
33 # Makefile for the video capture/playback device drivers.
44 #
55
6+obj-$(CONFIG_VIDEO_CADENCE) += cadence/
67 obj-$(CONFIG_VIDEO_VIA_CAMERA) += via-camera.o
78 obj-$(CONFIG_VIDEO_CAFE_CCIC) += marvell-ccic/
89 obj-$(CONFIG_VIDEO_MMP_CAMERA) += marvell-ccic/
drivers/media/platform/am437x/Kconfig+1−1
@@ -1,6 +1,6 @@
11 config VIDEO_AM437X_VPFE
22 tristate "TI AM437x VPFE video capture driver"
3− depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && HAS_DMA
3+ depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
44 depends on SOC_AM43XX || COMPILE_TEST
55 select VIDEOBUF2_DMA_CONTIG
66 select V4L2_FWNODE
drivers/media/platform/am437x/am437x-vpfe.c+2−4
@@ -2662,8 +2662,7 @@ static void vpfe_save_context(struct vpfe_ccdc *ccdc) · 2661 unmodified lines
26622662
26632663 static int vpfe_suspend(struct device *dev)
26642664 {
2665− struct platform_device *pdev = to_platform_device(dev);
2666− struct vpfe_device *vpfe = platform_get_drvdata(pdev);
2665+ struct vpfe_device *vpfe = dev_get_drvdata(dev);
26672666 struct vpfe_ccdc *ccdc = &vpfe->ccdc;
26682667
26692668 /* if streaming has not started we don't care */
@@ -2720,8 +2719,7 @@ static void vpfe_restore_context(struct vpfe_ccdc *ccdc) · 50 unmodified lines
27202719
27212720 static int vpfe_resume(struct device *dev)
27222721 {
2723− struct platform_device *pdev = to_platform_device(dev);
2724− struct vpfe_device *vpfe = platform_get_drvdata(pdev);
2722+ struct vpfe_device *vpfe = dev_get_drvdata(dev);
27252723 struct vpfe_ccdc *ccdc = &vpfe->ccdc;
27262724
27272725 /* if streaming has not started we don't care */
drivers/media/platform/atmel/Kconfig+2−2
@@ -1,6 +1,6 @@
11 config VIDEO_ATMEL_ISC
22 tristate "ATMEL Image Sensor Controller (ISC) support"
3− depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API && HAS_DMA
3+ depends on VIDEO_V4L2 && COMMON_CLK && VIDEO_V4L2_SUBDEV_API
44 depends on ARCH_AT91 || COMPILE_TEST
55 select VIDEOBUF2_DMA_CONTIG
66 select REGMAP_MMIO
@@ -11,7 +11,7 @@ config VIDEO_ATMEL_ISC · 4 unmodified lines
1111
1212 config VIDEO_ATMEL_ISI
1313 tristate "ATMEL Image Sensor Interface (ISI) support"
14− depends on VIDEO_V4L2 && OF && HAS_DMA
14+ depends on VIDEO_V4L2 && OF
1515 depends on ARCH_AT91 || COMPILE_TEST
1616 select VIDEOBUF2_DMA_CONTIG
1717 select V4L2_FWNODE
drivers/media/platform/cadence/Kconfig+34−0
@@ -0,0 +1,34 @@
1+config VIDEO_CADENCE
2+ bool "Cadence Video Devices"
3+ help
4+ If you have a media device designed by Cadence, say Y.
5+
6+ Note that this option doesn't include new drivers in the kernel:
7+ saying N will just cause Kconfig to skip all the questions about
8+ Cadence media devices.
9+
10+if VIDEO_CADENCE
11+
12+config VIDEO_CADENCE_CSI2RX
13+ tristate "Cadence MIPI-CSI2 RX Controller"
14+ depends on MEDIA_CONTROLLER
15+ depends on VIDEO_V4L2_SUBDEV_API
16+ select V4L2_FWNODE
17+ help
18+ Support for the Cadence MIPI CSI2 Receiver controller.
19+
20+ To compile this driver as a module, choose M here: the module will be
21+ called cdns-csi2rx.
22+
23+config VIDEO_CADENCE_CSI2TX
24+ tristate "Cadence MIPI-CSI2 TX Controller"
25+ depends on MEDIA_CONTROLLER
26+ depends on VIDEO_V4L2_SUBDEV_API
27+ select V4L2_FWNODE
28+ help
29+ Support for the Cadence MIPI CSI2 Transceiver controller.
30+
31+ To compile this driver as a module, choose M here: the module will be
32+ called cdns-csi2tx.
33+
34+endif
drivers/media/platform/cadence/Makefile+4−0
@@ -0,0 +1,4 @@
1+# SPDX-License-Identifier: GPL-2.0
2+
3+obj-$(CONFIG_VIDEO_CADENCE_CSI2RX) += cdns-csi2rx.o
4+obj-$(CONFIG_VIDEO_CADENCE_CSI2TX) += cdns-csi2tx.o
drivers/media/platform/cadence/cdns-csi2rx.c+498−0
@@ -0,0 +1,498 @@
1+// SPDX-License-Identifier: GPL-2.0+
2+/*
3+ * Driver for Cadence MIPI-CSI2 RX Controller v1.3
4+ *
5+ * Copyright (C) 2017 Cadence Design Systems Inc.
6+ */
7+
8+#include <linux/clk.h>
9+#include <linux/delay.h>
10+#include <linux/io.h>
11+#include <linux/module.h>
12+#include <linux/of.h>
13+#include <linux/of_graph.h>
14+#include <linux/phy/phy.h>
15+#include <linux/platform_device.h>
16+
17+#include <media/v4l2-ctrls.h>
18+#include <media/v4l2-device.h>
19+#include <media/v4l2-fwnode.h>
20+#include <media/v4l2-subdev.h>
21+
22+#define CSI2RX_DEVICE_CFG_REG 0x000
23+
24+#define CSI2RX_SOFT_RESET_REG 0x004
25+#define CSI2RX_SOFT_RESET_PROTOCOL BIT(1)
26+#define CSI2RX_SOFT_RESET_FRONT BIT(0)
27+
28+#define CSI2RX_STATIC_CFG_REG 0x008
29+#define CSI2RX_STATIC_CFG_DLANE_MAP(llane, plane) ((plane) << (16 + (llane) * 4))
30+#define CSI2RX_STATIC_CFG_LANES_MASK GENMASK(11, 8)
31+
32+#define CSI2RX_STREAM_BASE(n) (((n) + 1) * 0x100)
33+
34+#define CSI2RX_STREAM_CTRL_REG(n) (CSI2RX_STREAM_BASE(n) + 0x000)
35+#define CSI2RX_STREAM_CTRL_START BIT(0)
36+
37+#define CSI2RX_STREAM_DATA_CFG_REG(n) (CSI2RX_STREAM_BASE(n) + 0x008)
38+#define CSI2RX_STREAM_DATA_CFG_EN_VC_SELECT BIT(31)
39+#define CSI2RX_STREAM_DATA_CFG_VC_SELECT(n) BIT((n) + 16)
40+
41+#define CSI2RX_STREAM_CFG_REG(n) (CSI2RX_STREAM_BASE(n) + 0x00c)
42+#define CSI2RX_STREAM_CFG_FIFO_MODE_LARGE_BUF (1 << 8)
43+
44+#define CSI2RX_LANES_MAX 4
45+#define CSI2RX_STREAMS_MAX 4
46+
47+enum csi2rx_pads {
48+ CSI2RX_PAD_SINK,
49+ CSI2RX_PAD_SOURCE_STREAM0,
50+ CSI2RX_PAD_SOURCE_STREAM1,
51+ CSI2RX_PAD_SOURCE_STREAM2,
52+ CSI2RX_PAD_SOURCE_STREAM3,
53+ CSI2RX_PAD_MAX,
54+};
55+
56+struct csi2rx_priv {
57+ struct device *dev;
58+ unsigned int count;
59+
60+ /*
61+ * Used to prevent race conditions between multiple,
62+ * concurrent calls to start and stop.
63+ */
64+ struct mutex lock;
65+
66+ void __iomem *base;
67+ struct clk *sys_clk;
68+ struct clk *p_clk;
69+ struct clk *pixel_clk[CSI2RX_STREAMS_MAX];
70+ struct phy *dphy;
71+
72+ u8 lanes[CSI2RX_LANES_MAX];
73+ u8 num_lanes;
74+ u8 max_lanes;
75+ u8 max_streams;
76+ bool has_internal_dphy;
77+
78+ struct v4l2_subdev subdev;
79+ struct v4l2_async_notifier notifier;
80+ struct media_pad pads[CSI2RX_PAD_MAX];
81+
82+ /* Remote source */
83+ struct v4l2_async_subdev asd;
84+ struct v4l2_subdev *source_subdev;
85+ int source_pad;
86+};
87+
88+static inline
89+struct csi2rx_priv *v4l2_subdev_to_csi2rx(struct v4l2_subdev *subdev)
90+{
91+ return container_of(subdev, struct csi2rx_priv, subdev);
92+}
93+
94+static void csi2rx_reset(struct csi2rx_priv *csi2rx)
95+{
96+ writel(CSI2RX_SOFT_RESET_PROTOCOL | CSI2RX_SOFT_RESET_FRONT,
97+ csi2rx->base + CSI2RX_SOFT_RESET_REG);
98+
99+ udelay(10);
100+
101+ writel(0, csi2rx->base + CSI2RX_SOFT_RESET_REG);
102+}
103+
104+static int csi2rx_start(struct csi2rx_priv *csi2rx)
105+{
106+ unsigned int i;
107+ unsigned long lanes_used = 0;
108+ u32 reg;
109+ int ret;
110+
111+ ret = clk_prepare_enable(csi2rx->p_clk);
112+ if (ret)
113+ return ret;
114+
115+ csi2rx_reset(csi2rx);
116+
117+ reg = csi2rx->num_lanes << 8;
118+ for (i = 0; i < csi2rx->num_lanes; i++) {
119+ reg |= CSI2RX_STATIC_CFG_DLANE_MAP(i, csi2rx->lanes[i]);
120+ set_bit(csi2rx->lanes[i], &lanes_used);
121+ }
122+
123+ /*
124+ * Even the unused lanes need to be mapped. In order to avoid
125+ * to map twice to the same physical lane, keep the lanes used
126+ * in the previous loop, and only map unused physical lanes to
127+ * the rest of our logical lanes.
128+ */
129+ for (i = csi2rx->num_lanes; i < csi2rx->max_lanes; i++) {
130+ unsigned int idx = find_first_zero_bit(&lanes_used,
131+ sizeof(lanes_used));
132+ set_bit(idx, &lanes_used);
133+ reg |= CSI2RX_STATIC_CFG_DLANE_MAP(i, i + 1);
134+ }
135+
136+ writel(reg, csi2rx->base + CSI2RX_STATIC_CFG_REG);
137+
138+ ret = v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, true);
139+ if (ret)
140+ goto err_disable_pclk;
141+
142+ /*
143+ * Create a static mapping between the CSI virtual channels
144+ * and the output stream.
145+ *
146+ * This should be enhanced, but v4l2 lacks the support for
147+ * changing that mapping dynamically.
148+ *
149+ * We also cannot enable and disable independent streams here,
150+ * hence the reference counting.
151+ */
152+ for (i = 0; i < csi2rx->max_streams; i++) {
153+ ret = clk_prepare_enable(csi2rx->pixel_clk[i]);
154+ if (ret)
155+ goto err_disable_pixclk;
156+
157+ writel(CSI2RX_STREAM_CFG_FIFO_MODE_LARGE_BUF,
158+ csi2rx->base + CSI2RX_STREAM_CFG_REG(i));
159+
160+ writel(CSI2RX_STREAM_DATA_CFG_EN_VC_SELECT |
161+ CSI2RX_STREAM_DATA_CFG_VC_SELECT(i),
162+ csi2rx->base + CSI2RX_STREAM_DATA_CFG_REG(i));
163+
164+ writel(CSI2RX_STREAM_CTRL_START,
165+ csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
166+ }
167+
168+ ret = clk_prepare_enable(csi2rx->sys_clk);
169+ if (ret)
170+ goto err_disable_pixclk;
171+
172+ clk_disable_unprepare(csi2rx->p_clk);
173+
174+ return 0;
175+
176+err_disable_pixclk:
177+ for (; i > 0; i--)
178+ clk_disable_unprepare(csi2rx->pixel_clk[i - 1]);
179+
180+err_disable_pclk:
181+ clk_disable_unprepare(csi2rx->p_clk);
182+
183+ return ret;
184+}
185+
186+static void csi2rx_stop(struct csi2rx_priv *csi2rx)
187+{
188+ unsigned int i;
189+
190+ clk_prepare_enable(csi2rx->p_clk);
191+ clk_disable_unprepare(csi2rx->sys_clk);
192+
193+ for (i = 0; i < csi2rx->max_streams; i++) {
194+ writel(0, csi2rx->base + CSI2RX_STREAM_CTRL_REG(i));
195+
196+ clk_disable_unprepare(csi2rx->pixel_clk[i]);
197+ }
198+
199+ clk_disable_unprepare(csi2rx->p_clk);
200+
201+ if (v4l2_subdev_call(csi2rx->source_subdev, video, s_stream, false))
202+ dev_warn(csi2rx->dev, "Couldn't disable our subdev\n");
203+}
204+
205+static int csi2rx_s_stream(struct v4l2_subdev *subdev, int enable)
206+{
207+ struct csi2rx_priv *csi2rx = v4l2_subdev_to_csi2rx(subdev);
208+ int ret = 0;
209+
210+ mutex_lock(&csi2rx->lock);
211+
212+ if (enable) {
213+ /*
214+ * If we're not the first users, there's no need to
215+ * enable the whole controller.
216+ */
217+ if (!csi2rx->count) {
218+ ret = csi2rx_start(csi2rx);
219+ if (ret)
220+ goto out;
221+ }
222+
223+ csi2rx->count++;
224+ } else {
225+ csi2rx->count--;
226+
227+ /*
228+ * Let the last user turn off the lights.
229+ */
230+ if (!csi2rx->count)
231+ csi2rx_stop(csi2rx);
232+ }
233+
234+out:
235+ mutex_unlock(&csi2rx->lock);
236+ return ret;
237+}
238+
239+static const struct v4l2_subdev_video_ops csi2rx_video_ops = {
240+ .s_stream = csi2rx_s_stream,
241+};
242+
243+static const struct v4l2_subdev_ops csi2rx_subdev_ops = {
244+ .video = &csi2rx_video_ops,
245+};
246+
247+static int csi2rx_async_bound(struct v4l2_async_notifier *notifier,
248+ struct v4l2_subdev *s_subdev,
249+ struct v4l2_async_subdev *asd)
250+{
251+ struct v4l2_subdev *subdev = notifier->sd;
252+ struct csi2rx_priv *csi2rx = v4l2_subdev_to_csi2rx(subdev);
253+
254+ csi2rx->source_pad = media_entity_get_fwnode_pad(&s_subdev->entity,
255+ s_subdev->fwnode,
256+ MEDIA_PAD_FL_SOURCE);
257+ if (csi2rx->source_pad < 0) {
258+ dev_err(csi2rx->dev, "Couldn't find output pad for subdev %s\n",
259+ s_subdev->name);
260+ return csi2rx->source_pad;
261+ }
262+
263+ csi2rx->source_subdev = s_subdev;
264+
265+ dev_dbg(csi2rx->dev, "Bound %s pad: %d\n", s_subdev->name,
266+ csi2rx->source_pad);
267+
268+ return media_create_pad_link(&csi2rx->source_subdev->entity,
269+ csi2rx->source_pad,
270+ &csi2rx->subdev.entity, 0,
271+ MEDIA_LNK_FL_ENABLED |
272+ MEDIA_LNK_FL_IMMUTABLE);
273+}
274+
275+static const struct v4l2_async_notifier_operations csi2rx_notifier_ops = {
276+ .bound = csi2rx_async_bound,
277+};
278+
279+static int csi2rx_get_resources(struct csi2rx_priv *csi2rx,
280+ struct platform_device *pdev)
281+{
282+ struct resource *res;
283+ unsigned char i;
284+ u32 dev_cfg;
285+
286+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
287+ csi2rx->base = devm_ioremap_resource(&pdev->dev, res);
288+ if (IS_ERR(csi2rx->base))
289+ return PTR_ERR(csi2rx->base);
290+
291+ csi2rx->sys_clk = devm_clk_get(&pdev->dev, "sys_clk");
292+ if (IS_ERR(csi2rx->sys_clk)) {
293+ dev_err(&pdev->dev, "Couldn't get sys clock\n");
294+ return PTR_ERR(csi2rx->sys_clk);
295+ }
296+
297+ csi2rx->p_clk = devm_clk_get(&pdev->dev, "p_clk");
298+ if (IS_ERR(csi2rx->p_clk)) {
299+ dev_err(&pdev->dev, "Couldn't get P clock\n");
300+ return PTR_ERR(csi2rx->p_clk);
301+ }
302+
303+ csi2rx->dphy = devm_phy_optional_get(&pdev->dev, "dphy");
304+ if (IS_ERR(csi2rx->dphy)) {
305+ dev_err(&pdev->dev, "Couldn't get external D-PHY\n");
306+ return PTR_ERR(csi2rx->dphy);
307+ }
308+
309+ /*
310+ * FIXME: Once we'll have external D-PHY support, the check
311+ * will need to be removed.
312+ */
313+ if (csi2rx->dphy) {
314+ dev_err(&pdev->dev, "External D-PHY not supported yet\n");
315+ return -EINVAL;
316+ }
317+
318+ clk_prepare_enable(csi2rx->p_clk);
319+ dev_cfg = readl(csi2rx->base + CSI2RX_DEVICE_CFG_REG);
320+ clk_disable_unprepare(csi2rx->p_clk);
321+
322+ csi2rx->max_lanes = dev_cfg & 7;
323+ if (csi2rx->max_lanes > CSI2RX_LANES_MAX) {
324+ dev_err(&pdev->dev, "Invalid number of lanes: %u\n",
325+ csi2rx->max_lanes);
326+ return -EINVAL;
327+ }
328+
329+ csi2rx->max_streams = (dev_cfg >> 4) & 7;
330+ if (csi2rx->max_streams > CSI2RX_STREAMS_MAX) {
331+ dev_err(&pdev->dev, "Invalid number of streams: %u\n",
332+ csi2rx->max_streams);
333+ return -EINVAL;
334+ }
335+
336+ csi2rx->has_internal_dphy = dev_cfg & BIT(3) ? true : false;
337+
338+ /*
339+ * FIXME: Once we'll have internal D-PHY support, the check
340+ * will need to be removed.
341+ */
342+ if (csi2rx->has_internal_dphy) {
343+ dev_err(&pdev->dev, "Internal D-PHY not supported yet\n");
344+ return -EINVAL;
345+ }
346+
347+ for (i = 0; i < csi2rx->max_streams; i++) {
348+ char clk_name[16];
349+
350+ snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
351+ csi2rx->pixel_clk[i] = devm_clk_get(&pdev->dev, clk_name);
352+ if (IS_ERR(csi2rx->pixel_clk[i])) {
353+ dev_err(&pdev->dev, "Couldn't get clock %s\n", clk_name);
354+ return PTR_ERR(csi2rx->pixel_clk[i]);
355+ }
356+ }
357+
358+ return 0;
359+}
360+
361+static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx)
362+{
363+ struct v4l2_fwnode_endpoint v4l2_ep;
364+ struct fwnode_handle *fwh;
365+ struct device_node *ep;
366+ int ret;
367+
368+ ep = of_graph_get_endpoint_by_regs(csi2rx->dev->of_node, 0, 0);
369+ if (!ep)
370+ return -EINVAL;
371+
372+ fwh = of_fwnode_handle(ep);
373+ ret = v4l2_fwnode_endpoint_parse(fwh, &v4l2_ep);
374+ if (ret) {
375+ dev_err(csi2rx->dev, "Could not parse v4l2 endpoint\n");
376+ of_node_put(ep);
377+ return ret;
378+ }
379+
380+ if (v4l2_ep.bus_type != V4L2_MBUS_CSI2) {
381+ dev_err(csi2rx->dev, "Unsupported media bus type: 0x%x\n",
382+ v4l2_ep.bus_type);
383+ of_node_put(ep);
384+ return -EINVAL;
385+ }
386+
387+ memcpy(csi2rx->lanes, v4l2_ep.bus.mipi_csi2.data_lanes,
388+ sizeof(csi2rx->lanes));
389+ csi2rx->num_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes;
390+ if (csi2rx->num_lanes > csi2rx->max_lanes) {
391+ dev_err(csi2rx->dev, "Unsupported number of data-lanes: %d\n",
392+ csi2rx->num_lanes);
393+ of_node_put(ep);
394+ return -EINVAL;
395+ }
396+
397+ csi2rx->asd.match.fwnode = fwnode_graph_get_remote_port_parent(fwh);
398+ csi2rx->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
399+ of_node_put(ep);
400+
401+ csi2rx->notifier.subdevs = devm_kzalloc(csi2rx->dev,
402+ sizeof(*csi2rx->notifier.subdevs),
403+ GFP_KERNEL);
404+ if (!csi2rx->notifier.subdevs)
405+ return -ENOMEM;
406+
407+ csi2rx->notifier.subdevs[0] = &csi2rx->asd;
408+ csi2rx->notifier.num_subdevs = 1;
409+ csi2rx->notifier.ops = &csi2rx_notifier_ops;
410+
411+ return v4l2_async_subdev_notifier_register(&csi2rx->subdev,
412+ &csi2rx->notifier);
413+}
414+
415+static int csi2rx_probe(struct platform_device *pdev)
416+{
417+ struct csi2rx_priv *csi2rx;
418+ unsigned int i;
419+ int ret;
420+
421+ csi2rx = kzalloc(sizeof(*csi2rx), GFP_KERNEL);
422+ if (!csi2rx)
423+ return -ENOMEM;
424+ platform_set_drvdata(pdev, csi2rx);
425+ csi2rx->dev = &pdev->dev;
426+ mutex_init(&csi2rx->lock);
427+
428+ ret = csi2rx_get_resources(csi2rx, pdev);
429+ if (ret)
430+ goto err_free_priv;
431+
432+ ret = csi2rx_parse_dt(csi2rx);
433+ if (ret)
434+ goto err_free_priv;
435+
436+ csi2rx->subdev.owner = THIS_MODULE;
437+ csi2rx->subdev.dev = &pdev->dev;
438+ v4l2_subdev_init(&csi2rx->subdev, &csi2rx_subdev_ops);
439+ v4l2_set_subdevdata(&csi2rx->subdev, &pdev->dev);
440+ snprintf(csi2rx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
441+ KBUILD_MODNAME, dev_name(&pdev->dev));
442+
443+ /* Create our media pads */
444+ csi2rx->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
445+ csi2rx->pads[CSI2RX_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
446+ for (i = CSI2RX_PAD_SOURCE_STREAM0; i < CSI2RX_PAD_MAX; i++)
447+ csi2rx->pads[i].flags = MEDIA_PAD_FL_SOURCE;
448+
449+ ret = media_entity_pads_init(&csi2rx->subdev.entity, CSI2RX_PAD_MAX,
450+ csi2rx->pads);
451+ if (ret)
452+ goto err_free_priv;
453+
454+ ret = v4l2_async_register_subdev(&csi2rx->subdev);
455+ if (ret < 0)
456+ goto err_free_priv;
457+
458+ dev_info(&pdev->dev,
459+ "Probed CSI2RX with %u/%u lanes, %u streams, %s D-PHY\n",
460+ csi2rx->num_lanes, csi2rx->max_lanes, csi2rx->max_streams,
461+ csi2rx->has_internal_dphy ? "internal" : "no");
462+
463+ return 0;
464+
465+err_free_priv:
466+ kfree(csi2rx);
467+ return ret;
468+}
469+
470+static int csi2rx_remove(struct platform_device *pdev)
471+{
472+ struct csi2rx_priv *csi2rx = platform_get_drvdata(pdev);
473+
474+ v4l2_async_unregister_subdev(&csi2rx->subdev);
475+ kfree(csi2rx);
476+
477+ return 0;
478+}
479+
480+static const struct of_device_id csi2rx_of_table[] = {
481+ { .compatible = "cdns,csi2rx" },
482+ { },
483+};
484+MODULE_DEVICE_TABLE(of, csi2rx_of_table);
485+
486+static struct platform_driver csi2rx_driver = {
487+ .probe = csi2rx_probe,
488+ .remove = csi2rx_remove,
489+
490+ .driver = {
491+ .name = "cdns-csi2rx",
492+ .of_match_table = csi2rx_of_table,
493+ },
494+};
495+module_platform_driver(csi2rx_driver);
496+MODULE_AUTHOR("Maxime Ripard <maxime.ripard@bootlin.com>");
497+MODULE_DESCRIPTION("Cadence CSI2-RX controller");
498+MODULE_LICENSE("GPL");
drivers/media/platform/cadence/cdns-csi2tx.c+563−0
@@ -0,0 +1,563 @@
1+// SPDX-License-Identifier: GPL-2.0+
2+/*
3+ * Driver for Cadence MIPI-CSI2 TX Controller
4+ *
5+ * Copyright (C) 2017-2018 Cadence Design Systems Inc.
6+ */
7+
8+#include <linux/clk.h>
9+#include <linux/delay.h>
10+#include <linux/io.h>
11+#include <linux/module.h>
12+#include <linux/mutex.h>
13+#include <linux/of.h>
14+#include <linux/of_graph.h>
15+#include <linux/platform_device.h>
16+
17+#include <media/v4l2-ctrls.h>
18+#include <media/v4l2-device.h>
19+#include <media/v4l2-fwnode.h>
20+#include <media/v4l2-subdev.h>
21+
22+#define CSI2TX_DEVICE_CONFIG_REG 0x00
23+#define CSI2TX_DEVICE_CONFIG_STREAMS_MASK GENMASK(6, 4)
24+#define CSI2TX_DEVICE_CONFIG_HAS_DPHY BIT(3)
25+#define CSI2TX_DEVICE_CONFIG_LANES_MASK GENMASK(2, 0)
26+
27+#define CSI2TX_CONFIG_REG 0x20
28+#define CSI2TX_CONFIG_CFG_REQ BIT(2)
29+#define CSI2TX_CONFIG_SRST_REQ BIT(1)
30+
31+#define CSI2TX_DPHY_CFG_REG 0x28
32+#define CSI2TX_DPHY_CFG_CLK_RESET BIT(16)
33+#define CSI2TX_DPHY_CFG_LANE_RESET(n) BIT((n) + 12)
34+#define CSI2TX_DPHY_CFG_MODE_MASK GENMASK(9, 8)
35+#define CSI2TX_DPHY_CFG_MODE_LPDT (2 << 8)
36+#define CSI2TX_DPHY_CFG_MODE_HS (1 << 8)
37+#define CSI2TX_DPHY_CFG_MODE_ULPS (0 << 8)
38+#define CSI2TX_DPHY_CFG_CLK_ENABLE BIT(4)
39+#define CSI2TX_DPHY_CFG_LANE_ENABLE(n) BIT(n)
40+
41+#define CSI2TX_DPHY_CLK_WAKEUP_REG 0x2c
42+#define CSI2TX_DPHY_CLK_WAKEUP_ULPS_CYCLES(n) ((n) & 0xffff)
43+
44+#define CSI2TX_DT_CFG_REG(n) (0x80 + (n) * 8)
45+#define CSI2TX_DT_CFG_DT(n) (((n) & 0x3f) << 2)
46+
47+#define CSI2TX_DT_FORMAT_REG(n) (0x84 + (n) * 8)
48+#define CSI2TX_DT_FORMAT_BYTES_PER_LINE(n) (((n) & 0xffff) << 16)
49+#define CSI2TX_DT_FORMAT_MAX_LINE_NUM(n) ((n) & 0xffff)
50+
51+#define CSI2TX_STREAM_IF_CFG_REG(n) (0x100 + (n) * 4)
52+#define CSI2TX_STREAM_IF_CFG_FILL_LEVEL(n) ((n) & 0x1f)
53+
54+#define CSI2TX_LANES_MAX 4
55+#define CSI2TX_STREAMS_MAX 4
56+
57+enum csi2tx_pads {
58+ CSI2TX_PAD_SOURCE,
59+ CSI2TX_PAD_SINK_STREAM0,
60+ CSI2TX_PAD_SINK_STREAM1,
61+ CSI2TX_PAD_SINK_STREAM2,
62+ CSI2TX_PAD_SINK_STREAM3,
63+ CSI2TX_PAD_MAX,
64+};
65+
66+struct csi2tx_fmt {
67+ u32 mbus;
68+ u32 dt;
69+ u32 bpp;
70+};
71+
72+struct csi2tx_priv {
73+ struct device *dev;
74+ unsigned int count;
75+
76+ /*
77+ * Used to prevent race conditions between multiple,
78+ * concurrent calls to start and stop.
79+ */
80+ struct mutex lock;
81+
82+ void __iomem *base;
83+
84+ struct clk *esc_clk;
85+ struct clk *p_clk;
86+ struct clk *pixel_clk[CSI2TX_STREAMS_MAX];
87+
88+ struct v4l2_subdev subdev;
89+ struct media_pad pads[CSI2TX_PAD_MAX];
90+ struct v4l2_mbus_framefmt pad_fmts[CSI2TX_PAD_MAX];
91+
92+ bool has_internal_dphy;
93+ u8 lanes[CSI2TX_LANES_MAX];
94+ unsigned int num_lanes;
95+ unsigned int max_lanes;
96+ unsigned int max_streams;
97+};
98+
99+static const struct csi2tx_fmt csi2tx_formats[] = {
100+ {
101+ .mbus = MEDIA_BUS_FMT_UYVY8_1X16,
102+ .bpp = 2,
103+ .dt = 0x1e,
104+ },
105+ {
106+ .mbus = MEDIA_BUS_FMT_RGB888_1X24,
107+ .bpp = 3,
108+ .dt = 0x24,
109+ },
110+};
111+
112+static const struct v4l2_mbus_framefmt fmt_default = {
113+ .width = 1280,
114+ .height = 720,
115+ .code = MEDIA_BUS_FMT_RGB888_1X24,
116+ .field = V4L2_FIELD_NONE,
117+ .colorspace = V4L2_COLORSPACE_DEFAULT,
118+};
119+
120+static inline
121+struct csi2tx_priv *v4l2_subdev_to_csi2tx(struct v4l2_subdev *subdev)
122+{
123+ return container_of(subdev, struct csi2tx_priv, subdev);
124+}
125+
126+static const struct csi2tx_fmt *csi2tx_get_fmt_from_mbus(u32 mbus)
127+{
128+ unsigned int i;
129+
130+ for (i = 0; i < ARRAY_SIZE(csi2tx_formats); i++)
131+ if (csi2tx_formats[i].mbus == mbus)
132+ return &csi2tx_formats[i];
133+
134+ return NULL;
135+}
136+
137+static int csi2tx_enum_mbus_code(struct v4l2_subdev *subdev,
138+ struct v4l2_subdev_pad_config *cfg,
139+ struct v4l2_subdev_mbus_code_enum *code)
140+{
141+ if (code->pad || code->index >= ARRAY_SIZE(csi2tx_formats))
142+ return -EINVAL;
143+
144+ code->code = csi2tx_formats[code->index].mbus;
145+
146+ return 0;
147+}
148+
149+static struct v4l2_mbus_framefmt *
150+__csi2tx_get_pad_format(struct v4l2_subdev *subdev,
151+ struct v4l2_subdev_pad_config *cfg,
152+ struct v4l2_subdev_format *fmt)
153+{
154+ struct csi2tx_priv *csi2tx = v4l2_subdev_to_csi2tx(subdev);
155+
156+ if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
157+ return v4l2_subdev_get_try_format(subdev, cfg,
158+ fmt->pad);
159+
160+ return &csi2tx->pad_fmts[fmt->pad];
161+}
162+
163+static int csi2tx_get_pad_format(struct v4l2_subdev *subdev,
164+ struct v4l2_subdev_pad_config *cfg,
165+ struct v4l2_subdev_format *fmt)
166+{
167+ const struct v4l2_mbus_framefmt *format;
168+
169+ /* Multiplexed pad? */
170+ if (fmt->pad == CSI2TX_PAD_SOURCE)
171+ return -EINVAL;
172+
173+ format = __csi2tx_get_pad_format(subdev, cfg, fmt);
174+ if (!format)
175+ return -EINVAL;
176+
177+ fmt->format = *format;
178+
179+ return 0;
180+}
181+
182+static int csi2tx_set_pad_format(struct v4l2_subdev *subdev,
183+ struct v4l2_subdev_pad_config *cfg,
184+ struct v4l2_subdev_format *fmt)
185+{
186+ const struct v4l2_mbus_framefmt *src_format = &fmt->format;
187+ struct v4l2_mbus_framefmt *dst_format;
188+
189+ /* Multiplexed pad? */
190+ if (fmt->pad == CSI2TX_PAD_SOURCE)
191+ return -EINVAL;
192+
193+ if (!csi2tx_get_fmt_from_mbus(fmt->format.code))
194+ src_format = &fmt_default;
195+
196+ dst_format = __csi2tx_get_pad_format(subdev, cfg, fmt);
197+ if (!dst_format)
198+ return -EINVAL;
199+
200+ *dst_format = *src_format;
201+
202+ return 0;
203+}
204+
205+static const struct v4l2_subdev_pad_ops csi2tx_pad_ops = {
206+ .enum_mbus_code = csi2tx_enum_mbus_code,
207+ .get_fmt = csi2tx_get_pad_format,
208+ .set_fmt = csi2tx_set_pad_format,
209+};
210+
211+static void csi2tx_reset(struct csi2tx_priv *csi2tx)
212+{
213+ writel(CSI2TX_CONFIG_SRST_REQ, csi2tx->base + CSI2TX_CONFIG_REG);
214+
215+ udelay(10);
216+}
217+
218+static int csi2tx_start(struct csi2tx_priv *csi2tx)
219+{
220+ struct media_entity *entity = &csi2tx->subdev.entity;
221+ struct media_link *link;
222+ unsigned int i;
223+ u32 reg;
224+
225+ csi2tx_reset(csi2tx);
226+
227+ writel(CSI2TX_CONFIG_CFG_REQ, csi2tx->base + CSI2TX_CONFIG_REG);
228+
229+ udelay(10);
230+
231+ /* Configure our PPI interface with the D-PHY */
232+ writel(CSI2TX_DPHY_CLK_WAKEUP_ULPS_CYCLES(32),
233+ csi2tx->base + CSI2TX_DPHY_CLK_WAKEUP_REG);
234+
235+ /* Put our lanes (clock and data) out of reset */
236+ reg = CSI2TX_DPHY_CFG_CLK_RESET | CSI2TX_DPHY_CFG_MODE_LPDT;
237+ for (i = 0; i < csi2tx->num_lanes; i++)
238+ reg |= CSI2TX_DPHY_CFG_LANE_RESET(csi2tx->lanes[i]);
239+ writel(reg, csi2tx->base + CSI2TX_DPHY_CFG_REG);
240+
241+ udelay(10);
242+
243+ /* Enable our (clock and data) lanes */
244+ reg |= CSI2TX_DPHY_CFG_CLK_ENABLE;
245+ for (i = 0; i < csi2tx->num_lanes; i++)
246+ reg |= CSI2TX_DPHY_CFG_LANE_ENABLE(csi2tx->lanes[i]);
247+ writel(reg, csi2tx->base + CSI2TX_DPHY_CFG_REG);
248+
249+ udelay(10);
250+
251+ /* Switch to HS mode */
252+ reg &= ~CSI2TX_DPHY_CFG_MODE_MASK;
253+ writel(reg | CSI2TX_DPHY_CFG_MODE_HS,
254+ csi2tx->base + CSI2TX_DPHY_CFG_REG);
255+
256+ udelay(10);
257+
258+ /*
259+ * Create a static mapping between the CSI virtual channels
260+ * and the input streams.
261+ *
262+ * This should be enhanced, but v4l2 lacks the support for
263+ * changing that mapping dynamically at the moment.
264+ *
265+ * We're protected from the userspace setting up links at the
266+ * same time by the upper layer having called
267+ * media_pipeline_start().
268+ */
269+ list_for_each_entry(link, &entity->links, list) {
270+ struct v4l2_mbus_framefmt *mfmt;
271+ const struct csi2tx_fmt *fmt;
272+ unsigned int stream;
273+ int pad_idx = -1;
274+
275+ /* Only consider our enabled input pads */
276+ for (i = CSI2TX_PAD_SINK_STREAM0; i < CSI2TX_PAD_MAX; i++) {
277+ struct media_pad *pad = &csi2tx->pads[i];
278+
279+ if ((pad == link->sink) &&
280+ (link->flags & MEDIA_LNK_FL_ENABLED)) {
281+ pad_idx = i;
282+ break;
283+ }
284+ }
285+
286+ if (pad_idx < 0)
287+ continue;
288+
289+ mfmt = &csi2tx->pad_fmts[pad_idx];
290+ fmt = csi2tx_get_fmt_from_mbus(mfmt->code);
291+ if (!fmt)
292+ continue;
293+
294+ stream = pad_idx - CSI2TX_PAD_SINK_STREAM0;
295+
296+ /*
297+ * We use the stream ID there, but it's wrong.
298+ *
299+ * A stream could very well send a data type that is
300+ * not equal to its stream ID. We need to find a
301+ * proper way to address it.
302+ */
303+ writel(CSI2TX_DT_CFG_DT(fmt->dt),
304+ csi2tx->base + CSI2TX_DT_CFG_REG(stream));
305+
306+ writel(CSI2TX_DT_FORMAT_BYTES_PER_LINE(mfmt->width * fmt->bpp) |
307+ CSI2TX_DT_FORMAT_MAX_LINE_NUM(mfmt->height + 1),
308+ csi2tx->base + CSI2TX_DT_FORMAT_REG(stream));
309+
310+ /*
311+ * TODO: This needs to be calculated based on the
312+ * output CSI2 clock rate.
313+ */
314+ writel(CSI2TX_STREAM_IF_CFG_FILL_LEVEL(4),
315+ csi2tx->base + CSI2TX_STREAM_IF_CFG_REG(stream));
316+ }
317+
318+ /* Disable the configuration mode */
319+ writel(0, csi2tx->base + CSI2TX_CONFIG_REG);
320+
321+ return 0;
322+}
323+
324+static void csi2tx_stop(struct csi2tx_priv *csi2tx)
325+{
326+ writel(CSI2TX_CONFIG_CFG_REQ | CSI2TX_CONFIG_SRST_REQ,
327+ csi2tx->base + CSI2TX_CONFIG_REG);
328+}
329+
330+static int csi2tx_s_stream(struct v4l2_subdev *subdev, int enable)
331+{
332+ struct csi2tx_priv *csi2tx = v4l2_subdev_to_csi2tx(subdev);
333+ int ret = 0;
334+
335+ mutex_lock(&csi2tx->lock);
336+
337+ if (enable) {
338+ /*
339+ * If we're not the first users, there's no need to
340+ * enable the whole controller.
341+ */
342+ if (!csi2tx->count) {
343+ ret = csi2tx_start(csi2tx);
344+ if (ret)
345+ goto out;
346+ }
347+
348+ csi2tx->count++;
349+ } else {
350+ csi2tx->count--;
351+
352+ /*
353+ * Let the last user turn off the lights.
354+ */
355+ if (!csi2tx->count)
356+ csi2tx_stop(csi2tx);
357+ }
358+
359+out:
360+ mutex_unlock(&csi2tx->lock);
361+ return ret;
362+}
363+
364+static const struct v4l2_subdev_video_ops csi2tx_video_ops = {
365+ .s_stream = csi2tx_s_stream,
366+};
367+
368+static const struct v4l2_subdev_ops csi2tx_subdev_ops = {
369+ .pad = &csi2tx_pad_ops,
370+ .video = &csi2tx_video_ops,
371+};
372+
373+static int csi2tx_get_resources(struct csi2tx_priv *csi2tx,
374+ struct platform_device *pdev)
375+{
376+ struct resource *res;
377+ unsigned int i;
378+ u32 dev_cfg;
379+
380+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
381+ csi2tx->base = devm_ioremap_resource(&pdev->dev, res);
382+ if (IS_ERR(csi2tx->base))
383+ return PTR_ERR(csi2tx->base);
384+
385+ csi2tx->p_clk = devm_clk_get(&pdev->dev, "p_clk");
386+ if (IS_ERR(csi2tx->p_clk)) {
387+ dev_err(&pdev->dev, "Couldn't get p_clk\n");
388+ return PTR_ERR(csi2tx->p_clk);
389+ }
390+
391+ csi2tx->esc_clk = devm_clk_get(&pdev->dev, "esc_clk");
392+ if (IS_ERR(csi2tx->esc_clk)) {
393+ dev_err(&pdev->dev, "Couldn't get the esc_clk\n");
394+ return PTR_ERR(csi2tx->esc_clk);
395+ }
396+
397+ clk_prepare_enable(csi2tx->p_clk);
398+ dev_cfg = readl(csi2tx->base + CSI2TX_DEVICE_CONFIG_REG);
399+ clk_disable_unprepare(csi2tx->p_clk);
400+
401+ csi2tx->max_lanes = dev_cfg & CSI2TX_DEVICE_CONFIG_LANES_MASK;
402+ if (csi2tx->max_lanes > CSI2TX_LANES_MAX) {
403+ dev_err(&pdev->dev, "Invalid number of lanes: %u\n",
404+ csi2tx->max_lanes);
405+ return -EINVAL;
406+ }
407+
408+ csi2tx->max_streams = (dev_cfg & CSI2TX_DEVICE_CONFIG_STREAMS_MASK) >> 4;
409+ if (csi2tx->max_streams > CSI2TX_STREAMS_MAX) {
410+ dev_err(&pdev->dev, "Invalid number of streams: %u\n",
411+ csi2tx->max_streams);
412+ return -EINVAL;
413+ }
414+
415+ csi2tx->has_internal_dphy = !!(dev_cfg & CSI2TX_DEVICE_CONFIG_HAS_DPHY);
416+
417+ for (i = 0; i < csi2tx->max_streams; i++) {
418+ char clk_name[16];
419+
420+ snprintf(clk_name, sizeof(clk_name), "pixel_if%u_clk", i);
421+ csi2tx->pixel_clk[i] = devm_clk_get(&pdev->dev, clk_name);
422+ if (IS_ERR(csi2tx->pixel_clk[i])) {
423+ dev_err(&pdev->dev, "Couldn't get clock %s\n",
424+ clk_name);
425+ return PTR_ERR(csi2tx->pixel_clk[i]);
426+ }
427+ }
428+
429+ return 0;
430+}
431+
432+static int csi2tx_check_lanes(struct csi2tx_priv *csi2tx)
433+{
434+ struct v4l2_fwnode_endpoint v4l2_ep;
435+ struct device_node *ep;
436+ int ret;
437+
438+ ep = of_graph_get_endpoint_by_regs(csi2tx->dev->of_node, 0, 0);
439+ if (!ep)
440+ return -EINVAL;
441+
442+ ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &v4l2_ep);
443+ if (ret) {
444+ dev_err(csi2tx->dev, "Could not parse v4l2 endpoint\n");
445+ goto out;
446+ }
447+
448+ if (v4l2_ep.bus_type != V4L2_MBUS_CSI2) {
449+ dev_err(csi2tx->dev, "Unsupported media bus type: 0x%x\n",
450+ v4l2_ep.bus_type);
451+ ret = -EINVAL;
452+ goto out;
453+ }
454+
455+ csi2tx->num_lanes = v4l2_ep.bus.mipi_csi2.num_data_lanes;
456+ if (csi2tx->num_lanes > csi2tx->max_lanes) {
457+ dev_err(csi2tx->dev,
458+ "Current configuration uses more lanes than supported\n");
459+ ret = -EINVAL;
460+ goto out;
461+ }
462+
463+ memcpy(csi2tx->lanes, v4l2_ep.bus.mipi_csi2.data_lanes,
464+ sizeof(csi2tx->lanes));
465+
466+out:
467+ of_node_put(ep);
468+ return ret;
469+}
470+
471+static int csi2tx_probe(struct platform_device *pdev)
472+{
473+ struct csi2tx_priv *csi2tx;
474+ unsigned int i;
475+ int ret;
476+
477+ csi2tx = kzalloc(sizeof(*csi2tx), GFP_KERNEL);
478+ if (!csi2tx)
479+ return -ENOMEM;
480+ platform_set_drvdata(pdev, csi2tx);
481+ mutex_init(&csi2tx->lock);
482+ csi2tx->dev = &pdev->dev;
483+
484+ ret = csi2tx_get_resources(csi2tx, pdev);
485+ if (ret)
486+ goto err_free_priv;
487+
488+ v4l2_subdev_init(&csi2tx->subdev, &csi2tx_subdev_ops);
489+ csi2tx->subdev.owner = THIS_MODULE;
490+ csi2tx->subdev.dev = &pdev->dev;
491+ csi2tx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
492+ snprintf(csi2tx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
493+ KBUILD_MODNAME, dev_name(&pdev->dev));
494+
495+ ret = csi2tx_check_lanes(csi2tx);
496+ if (ret)
497+ goto err_free_priv;
498+
499+ /* Create our media pads */
500+ csi2tx->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
501+ csi2tx->pads[CSI2TX_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;
502+ for (i = CSI2TX_PAD_SINK_STREAM0; i < CSI2TX_PAD_MAX; i++)
503+ csi2tx->pads[i].flags = MEDIA_PAD_FL_SINK;
504+
505+ /*
506+ * Only the input pads are considered to have a format at the
507+ * moment. The CSI link can multiplex various streams with
508+ * different formats, and we can't expose this in v4l2 right
509+ * now.
510+ */
511+ for (i = CSI2TX_PAD_SINK_STREAM0; i < CSI2TX_PAD_MAX; i++)
512+ csi2tx->pad_fmts[i] = fmt_default;
513+
514+ ret = media_entity_pads_init(&csi2tx->subdev.entity, CSI2TX_PAD_MAX,
515+ csi2tx->pads);
516+ if (ret)
517+ goto err_free_priv;
518+
519+ ret = v4l2_async_register_subdev(&csi2tx->subdev);
520+ if (ret < 0)
521+ goto err_free_priv;
522+
523+ dev_info(&pdev->dev,
524+ "Probed CSI2TX with %u/%u lanes, %u streams, %s D-PHY\n",
525+ csi2tx->num_lanes, csi2tx->max_lanes, csi2tx->max_streams,
526+ csi2tx->has_internal_dphy ? "internal" : "no");
527+
528+ return 0;
529+
530+err_free_priv:
531+ kfree(csi2tx);
532+ return ret;
533+}
534+
535+static int csi2tx_remove(struct platform_device *pdev)
536+{
537+ struct csi2tx_priv *csi2tx = platform_get_drvdata(pdev);
538+
539+ v4l2_async_unregister_subdev(&csi2tx->subdev);
540+ kfree(csi2tx);
541+
542+ return 0;
543+}
544+
545+static const struct of_device_id csi2tx_of_table[] = {
546+ { .compatible = "cdns,csi2tx" },
547+ { },
548+};
549+MODULE_DEVICE_TABLE(of, csi2tx_of_table);
550+
551+static struct platform_driver csi2tx_driver = {
552+ .probe = csi2tx_probe,
553+ .remove = csi2tx_remove,
554+
555+ .driver = {
556+ .name = "cdns-csi2tx",
557+ .of_match_table = csi2tx_of_table,
558+ },
559+};
560+module_platform_driver(csi2tx_driver);
561+MODULE_AUTHOR("Maxime Ripard <maxime.ripard@bootlin.com>");
562+MODULE_DESCRIPTION("Cadence CSI2-TX controller");
563+MODULE_LICENSE("GPL");
drivers/media/platform/cec-gpio/cec-gpio.c+1−1
@@ -158,7 +158,7 @@ static int cec_gpio_probe(struct platform_device *pdev) · 157 unmodified lines
158158
159159 cec->dev = dev;
160160
161− cec->cec_gpio = devm_gpiod_get(dev, "cec", GPIOD_IN);
161+ cec->cec_gpio = devm_gpiod_get(dev, "cec", GPIOD_OUT_HIGH_OPEN_DRAIN);
162162 if (IS_ERR(cec->cec_gpio))
163163 return PTR_ERR(cec->cec_gpio);
164164 cec->cec_irq = gpiod_to_irq(cec->cec_gpio);
drivers/media/platform/coda/coda-common.c+31−14
@@ -779,16 +779,27 @@ static int coda_s_fmt_vid_cap(struct file *file, void *priv, · 778 unmodified lines
779779 r.width = q_data_src->width;
780780 r.height = q_data_src->height;
781781
782− return coda_s_fmt(ctx, f, &r);
782+ ret = coda_s_fmt(ctx, f, &r);
783+ if (ret)
784+ return ret;
785+
786+ if (ctx->inst_type != CODA_INST_ENCODER)
787+ return 0;
788+
789+ ctx->colorspace = f->fmt.pix.colorspace;
790+ ctx->xfer_func = f->fmt.pix.xfer_func;
791+ ctx->ycbcr_enc = f->fmt.pix.ycbcr_enc;
792+ ctx->quantization = f->fmt.pix.quantization;
793+
794+ return 0;
783795 }
784796
785797 static int coda_s_fmt_vid_out(struct file *file, void *priv,
786798 struct v4l2_format *f)
787799 {
788800 struct coda_ctx *ctx = fh_to_ctx(priv);
789− struct coda_q_data *q_data_src;
790801 struct v4l2_format f_cap;
791− struct v4l2_rect r;
802+ struct vb2_queue *dst_vq;
792803 int ret;
793804
794805 ret = coda_try_fmt_vid_out(file, priv, f);
@@ -799,28 +810,34 @@ static int coda_s_fmt_vid_out(struct file *file, void *priv, · 4 unmodified lines
799810 if (ret)
800811 return ret;
801812
813+ if (ctx->inst_type != CODA_INST_DECODER)
814+ return 0;
815+
802816 ctx->colorspace = f->fmt.pix.colorspace;
803817 ctx->xfer_func = f->fmt.pix.xfer_func;
804818 ctx->ycbcr_enc = f->fmt.pix.ycbcr_enc;
805819 ctx->quantization = f->fmt.pix.quantization;
806820
821+ dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
822+ if (!dst_vq)
823+ return -EINVAL;
824+
825+ /*
826+ * Setting the capture queue format is not possible while the capture
827+ * queue is still busy. This is not an error, but the user will have to
828+ * make sure themselves that the capture format is set correctly before
829+ * starting the output queue again.
830+ */
831+ if (vb2_is_busy(dst_vq))
832+ return 0;
833+
807834 memset(&f_cap, 0, sizeof(f_cap));
808835 f_cap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
809836 coda_g_fmt(file, priv, &f_cap);
810837 f_cap.fmt.pix.width = f->fmt.pix.width;
811838 f_cap.fmt.pix.height = f->fmt.pix.height;
812839
813− ret = coda_try_fmt_vid_cap(file, priv, &f_cap);
814− if (ret)
815− return ret;
816−
817− q_data_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
818− r.left = 0;
819− r.top = 0;
820− r.width = q_data_src->width;
821− r.height = q_data_src->height;
822−
823− return coda_s_fmt(ctx, &f_cap, &r);
840+ return coda_s_fmt_vid_cap(file, priv, &f_cap);
824841 }
825842
826843 static int coda_reqbufs(struct file *file, void *priv,
drivers/media/platform/davinci/Kconfig+4−8
@@ -2,7 +2,6 @@ config VIDEO_DAVINCI_VPIF_DISPLAY · 1 unmodified line
22 tristate "TI DaVinci VPIF V4L2-Display driver"
33 depends on VIDEO_V4L2
44 depends on ARCH_DAVINCI || COMPILE_TEST
5− depends on HAS_DMA
65 depends on I2C
76 select VIDEOBUF2_DMA_CONTIG
87 select VIDEO_ADV7343 if MEDIA_SUBDRV_AUTOSELECT
@@ -19,7 +18,6 @@ config VIDEO_DAVINCI_VPIF_CAPTURE · 10 unmodified lines
1918 tristate "TI DaVinci VPIF video capture driver"
2019 depends on VIDEO_V4L2
2120 depends on ARCH_DAVINCI || COMPILE_TEST
22− depends on HAS_DMA
2321 depends on I2C
2422 select VIDEOBUF2_DMA_CONTIG
2523 select V4L2_FWNODE
@@ -35,7 +33,6 @@ config VIDEO_DM6446_CCDC · 9 unmodified lines
3533 tristate "TI DM6446 CCDC video capture driver"
3634 depends on VIDEO_V4L2
3735 depends on ARCH_DAVINCI || COMPILE_TEST
38− depends on HAS_DMA
3936 depends on I2C
4037 select VIDEOBUF_DMA_CONTIG
4138 help
@@ -52,7 +49,6 @@ config VIDEO_DM355_CCDC · 10 unmodified lines
5249 tristate "TI DM355 CCDC video capture driver"
5350 depends on VIDEO_V4L2
5451 depends on ARCH_DAVINCI || COMPILE_TEST
55− depends on HAS_DMA
5652 depends on I2C
5753 select VIDEOBUF_DMA_CONTIG
5854 help
@@ -67,8 +63,8 @@ config VIDEO_DM355_CCDC · 8 unmodified lines
6763
6864 config VIDEO_DM365_ISIF
6965 tristate "TI DM365 ISIF video capture driver"
70− depends on VIDEO_V4L2 && ARCH_DAVINCI
71− depends on HAS_DMA
66+ depends on VIDEO_V4L2
67+ depends on ARCH_DAVINCI || COMPILE_TEST
7268 depends on I2C
7369 select VIDEOBUF_DMA_CONTIG
7470 help
@@ -81,8 +77,8 @@ config VIDEO_DM365_ISIF · 6 unmodified lines
8177
8278 config VIDEO_DAVINCI_VPBE_DISPLAY
8379 tristate "TI DaVinci VPBE V4L2-Display driver"
84− depends on VIDEO_V4L2 && ARCH_DAVINCI
85− depends on HAS_DMA
80+ depends on VIDEO_V4L2
81+ depends on ARCH_DAVINCI || COMPILE_TEST
8682 depends on I2C
8783 select VIDEOBUF2_DMA_CONTIG
8884 help
drivers/media/platform/davinci/isif.c+1−3
@@ -31,8 +31,6 @@ · 30 unmodified lines
3131 #include <linux/err.h>
3232 #include <linux/module.h>
3333
34−#include <mach/mux.h>
35−
3634 #include <media/davinci/isif.h>
3735 #include <media/davinci/vpss.h>
3836
@@ -1029,7 +1027,7 @@ static int isif_probe(struct platform_device *pdev) · 990 unmodified lines
10291027 {
10301028 void (*setup_pinmux)(void);
10311029 struct resource *res;
1032− void *__iomem addr;
1030+ void __iomem *addr;
10331031 int status = 0, i;
10341032
10351033 /* Platform data holds setup_pinmux function ptr */
drivers/media/platform/davinci/vpbe.c+20−18
@@ -51,7 +51,7 @@ MODULE_AUTHOR("Texas Instruments"); · 50 unmodified lines
5151
5252 /**
5353 * vpbe_current_encoder_info - Get config info for current encoder
54− * @vpbe_dev - vpbe device ptr
54+ * @vpbe_dev: vpbe device ptr
5555 *
5656 * Return ptr to current encoder config info
5757 */
@@ -68,8 +68,8 @@ vpbe_current_encoder_info(struct vpbe_device *vpbe_dev) · 10 unmodified lines
6868 /**
6969 * vpbe_find_encoder_sd_index - Given a name find encoder sd index
7070 *
71− * @vpbe_config - ptr to vpbe cfg
72− * @output_index - index used by application
71+ * @cfg: ptr to vpbe cfg
72+ * @index: index used by application
7373 *
7474 * Return sd index of the encoder
7575 */
@@ -94,8 +94,8 @@ static int vpbe_find_encoder_sd_index(struct vpbe_config *cfg, · 18 unmodified lines
9494
9595 /**
9696 * vpbe_g_cropcap - Get crop capabilities of the display
97− * @vpbe_dev - vpbe device ptr
98− * @cropcap - cropcap is a ptr to struct v4l2_cropcap
97+ * @vpbe_dev: vpbe device ptr
98+ * @cropcap: cropcap is a ptr to struct v4l2_cropcap
9999 *
100100 * Update the crop capabilities in crop cap for current
101101 * mode
@@ -116,8 +116,8 @@ static int vpbe_g_cropcap(struct vpbe_device *vpbe_dev, · 14 unmodified lines
116116
117117 /**
118118 * vpbe_enum_outputs - enumerate outputs
119− * @vpbe_dev - vpbe device ptr
120− * @output - ptr to v4l2_output structure
119+ * @vpbe_dev: vpbe device ptr
120+ * @output: ptr to v4l2_output structure
121121 *
122122 * Enumerates the outputs available at the vpbe display
123123 * returns the status, -EINVAL if end of output list
@@ -212,8 +212,8 @@ static int vpbe_get_std_info_by_name(struct vpbe_device *vpbe_dev, · 88 unmodified lines
212212
213213 /**
214214 * vpbe_set_output - Set output
215− * @vpbe_dev - vpbe device ptr
216− * @index - index of output
215+ * @vpbe_dev: vpbe device ptr
216+ * @index: index of output
217217 *
218218 * Set vpbe output to the output specified by the index
219219 */
@@ -308,7 +308,7 @@ static int vpbe_set_default_output(struct vpbe_device *vpbe_dev) · 88 unmodified lines
308308
309309 /**
310310 * vpbe_get_output - Get output
311− * @vpbe_dev - vpbe device ptr
311+ * @vpbe_dev: vpbe device ptr
312312 *
313313 * return current vpbe output to the the index
314314 */
@@ -317,7 +317,7 @@ static unsigned int vpbe_get_output(struct vpbe_device *vpbe_dev) · 2 unmodified lines
317317 return vpbe_dev->current_out_index;
318318 }
319319
320−/**
320+/*
321321 * vpbe_s_dv_timings - Set the given preset timings in the encoder
322322 *
323323 * Sets the timings if supported by the current encoder. Return the status.
@@ -369,7 +369,7 @@ static int vpbe_s_dv_timings(struct vpbe_device *vpbe_dev, · 45 unmodified lines
369369 return ret;
370370 }
371371
372−/**
372+/*
373373 * vpbe_g_dv_timings - Get the timings in the current encoder
374374 *
375375 * Get the timings in the current encoder. Return the status. 0 - success
@@ -394,7 +394,7 @@ static int vpbe_g_dv_timings(struct vpbe_device *vpbe_dev, · 18 unmodified lines
394394 return -EINVAL;
395395 }
396396
397−/**
397+/*
398398 * vpbe_enum_dv_timings - Enumerate the dv timings in the current encoder
399399 *
400400 * Get the timings in the current encoder. Return the status. 0 - success
@@ -426,7 +426,7 @@ static int vpbe_enum_dv_timings(struct vpbe_device *vpbe_dev, · 25 unmodified lines
426426 return 0;
427427 }
428428
429−/**
429+/*
430430 * vpbe_s_std - Set the given standard in the encoder
431431 *
432432 * Sets the standard if supported by the current encoder. Return the status.
@@ -465,7 +465,7 @@ static int vpbe_s_std(struct vpbe_device *vpbe_dev, v4l2_std_id std_id) · 32 unmodified lines
465465 return ret;
466466 }
467467
468−/**
468+/*
469469 * vpbe_g_std - Get the standard in the current encoder
470470 *
471471 * Get the standard in the current encoder. Return the status. 0 - success
@@ -488,7 +488,7 @@ static int vpbe_g_std(struct vpbe_device *vpbe_dev, v4l2_std_id *std_id) · 16 unmodified lines
488488 return -EINVAL;
489489 }
490490
491−/**
491+/*
492492 * vpbe_set_mode - Set mode in the current encoder using mode info
493493 *
494494 * Use the mode string to decide what timings to set in the encoder
@@ -572,7 +572,8 @@ static int platform_device_get(struct device *dev, void *data) · 77 unmodified lines
572572
573573 /**
574574 * vpbe_initialize() - Initialize the vpbe display controller
575− * @vpbe_dev - vpbe device ptr
575+ * @dev: Master and slave device ptr
576+ * @vpbe_dev: vpbe device ptr
576577 *
577578 * Master frame buffer device drivers calls this to initialize vpbe
578579 * display controller. This will then registers v4l2 device and the sub
@@ -769,7 +770,8 @@ fail_mutex_unlock: · 190 unmodified lines
769770
770771 /**
771772 * vpbe_deinitialize() - de-initialize the vpbe display controller
772− * @dev - Master and slave device ptr
773+ * @dev: Master and slave device ptr
774+ * @vpbe_dev: vpbe device ptr
773775 *
774776 * vpbe_master and slave frame buffer devices calls this to de-initialize
775777 * the display controller. It is called when master and slave device
drivers/media/platform/davinci/vpbe_display.c+18−15
@@ -26,7 +26,10 @@ · 25 unmodified lines
2626 #include <linux/slab.h>
2727
2828 #include <asm/pgtable.h>
29+
30+#ifdef CONFIG_ARCH_DAVINCI
2931 #include <mach/cputype.h>
32+#endif
3033
3134 #include <media/v4l2-dev.h>
3235 #include <media/v4l2-common.h>
@@ -53,8 +56,7 @@ static int vpbe_set_osd_display_params(struct vpbe_display *disp_dev, · 20 unmodified lines
5356 static int venc_is_second_field(struct vpbe_display *disp_dev)
5457 {
5558 struct vpbe_device *vpbe_dev = disp_dev->vpbe_dev;
56− int ret;
57− int val;
59+ int ret, val;
5860
5961 ret = v4l2_subdev_call(vpbe_dev->venc,
6062 core,
@@ -64,6 +66,7 @@ static int venc_is_second_field(struct vpbe_display *disp_dev) · 3 unmodified lines
6466 if (ret < 0) {
6567 v4l2_err(&vpbe_dev->v4l2_dev,
6668 "Error in getting Field ID 0\n");
69+ return 1;
6770 }
6871 return val;
6972 }
@@ -282,7 +285,7 @@ static int vpbe_start_streaming(struct vb2_queue *vq, unsigned int count) · 212 unmodified lines
282285 struct osd_state *osd_device = layer->disp_dev->osd_device;
283286 int ret;
284287
285− osd_device->ops.disable_layer(osd_device, layer->layer_info.id);
288+ osd_device->ops.disable_layer(osd_device, layer->layer_info.id);
286289
287290 /* Get the next frame from the buffer queue */
288291 layer->next_frm = layer->cur_frm = list_entry(layer->dma_queue.next,
@@ -564,7 +567,7 @@ static void vpbe_disp_check_window_params(struct vpbe_display *disp_dev, · 275 unmodified lines
564567
565568 }
566569
567−/**
570+/*
568571 * vpbe_try_format()
569572 * If user application provides width and height, and have bytesperline set
570573 * to zero, driver calculates bytesperline and sizeimage based on hardware
@@ -929,7 +932,7 @@ static int vpbe_display_try_fmt(struct file *file, void *priv, · 358 unmodified lines
929932
930933 }
931934
932−/**
935+/*
933936 * vpbe_display_s_std - Set the given standard in the encoder
934937 *
935938 * Sets the standard if supported by the current encoder. Return the status.
@@ -961,7 +964,7 @@ static int vpbe_display_s_std(struct file *file, void *priv, · 25 unmodified lines
961964 return 0;
962965 }
963966
964−/**
967+/*
965968 * vpbe_display_g_std - Get the standard in the current encoder
966969 *
967970 * Get the standard in the current encoder. Return the status. 0 - success
@@ -984,7 +987,7 @@ static int vpbe_display_g_std(struct file *file, void *priv, · 16 unmodified lines
984987 return -EINVAL;
985988 }
986989
987−/**
990+/*
988991 * vpbe_display_enum_output - enumerate outputs
989992 *
990993 * Enumerates the outputs available at the vpbe display
@@ -1013,7 +1016,7 @@ static int vpbe_display_enum_output(struct file *file, void *priv, · 22 unmodified lines
10131016 return 0;
10141017 }
10151018
1016−/**
1019+/*
10171020 * vpbe_display_s_output - Set output to
10181021 * the output specified by the index
10191022 */
@@ -1042,7 +1045,7 @@ static int vpbe_display_s_output(struct file *file, void *priv, · 22 unmodified lines
10421045 return 0;
10431046 }
10441047
1045−/**
1048+/*
10461049 * vpbe_display_g_output - Get output from subdevice
10471050 * for a given by the index
10481051 */
@@ -1059,7 +1062,7 @@ static int vpbe_display_g_output(struct file *file, void *priv, · 10 unmodified lines
10591062 return 0;
10601063 }
10611064
1062−/**
1065+/*
10631066 * vpbe_display_enum_dv_timings - Enumerate the dv timings
10641067 *
10651068 * enum the timings in the current encoder. Return the status. 0 - success
@@ -1089,7 +1092,7 @@ vpbe_display_enum_dv_timings(struct file *file, void *priv, · 23 unmodified lines
10891092 return 0;
10901093 }
10911094
1092−/**
1095+/*
10931096 * vpbe_display_s_dv_timings - Set the dv timings
10941097 *
10951098 * Set the timings in the current encoder. Return the status. 0 - success
@@ -1122,7 +1125,7 @@ vpbe_display_s_dv_timings(struct file *file, void *priv, · 26 unmodified lines
11221125 return 0;
11231126 }
11241127
1125−/**
1128+/*
11261129 * vpbe_display_g_dv_timings - Set the dv timings
11271130 *
11281131 * Get the timings in the current encoder. Return the status. 0 - success
@@ -1351,9 +1354,9 @@ static int register_device(struct vpbe_layer *vpbe_display_layer, · 222 unmodified lines
13511354 v4l2_info(&disp_dev->vpbe_dev->v4l2_dev,
13521355 "Trying to register VPBE display device.\n");
13531356 v4l2_info(&disp_dev->vpbe_dev->v4l2_dev,
1354− "layer=%x,layer->video_dev=%x\n",
1355− (int)vpbe_display_layer,
1356− (int)&vpbe_display_layer->video_dev);
1357+ "layer=%p,layer->video_dev=%p\n",
1358+ vpbe_display_layer,
1359+ &vpbe_display_layer->video_dev);
13571360
13581361 vpbe_display_layer->video_dev.queue = &vpbe_display_layer->buffer_queue;
13591362 err = video_register_device(&vpbe_display_layer->video_dev,
drivers/media/platform/davinci/vpbe_osd.c+12−9
@@ -24,8 +24,10 @@ · 23 unmodified lines
2424 #include <linux/clk.h>
2525 #include <linux/slab.h>
2626
27+#ifdef CONFIG_ARCH_DAVINCI
2728 #include <mach/cputype.h>
2829 #include <mach/hardware.h>
30+#endif
2931
3032 #include <media/davinci/vpss.h>
3133 #include <media/v4l2-device.h>
@@ -122,10 +124,10 @@ static inline u32 osd_modify(struct osd_state *sd, u32 mask, u32 val, · 90 unmodified lines
122124
123125 /**
124126 * _osd_dm6446_vid0_pingpong() - field inversion fix for DM6446
125− * @sd - ptr to struct osd_state
126− * @field_inversion - inversion flag
127− * @fb_base_phys - frame buffer address
128− * @lconfig - ptr to layer config
127+ * @sd: ptr to struct osd_state
128+ * @field_inversion: inversion flag
129+ * @fb_base_phys: frame buffer address
130+ * @lconfig: ptr to layer config
129131 *
130132 * This routine implements a workaround for the field signal inversion silicon
131133 * erratum described in Advisory 1.3.8 for the DM6446. The fb_base_phys and
@@ -782,9 +784,9 @@ static void osd_get_layer_config(struct osd_state *sd, enum osd_layer layer, · 650 unmodified lines
782784
783785 /**
784786 * try_layer_config() - Try a specific configuration for the layer
785− * @sd - ptr to struct osd_state
786− * @layer - layer to configure
787− * @lconfig - layer configuration to try
787+ * @sd: ptr to struct osd_state
788+ * @layer: layer to configure
789+ * @lconfig: layer configuration to try
788790 *
789791 * If the requested lconfig is completely rejected and the value of lconfig on
790792 * exit is the current lconfig, then try_layer_config() returns 1. Otherwise,
@@ -844,9 +846,10 @@ static int try_layer_config(struct osd_state *sd, enum osd_layer layer, · 53 unmodified lines
844846
845847 /* DM6446: */
846848 /* only one OSD window at a time can use RGB pixel formats */
847− if ((osd->vpbe_type == VPBE_VERSION_1) &&
848− is_osd_win(layer) && is_rgb_pixfmt(lconfig->pixfmt)) {
849+ if ((osd->vpbe_type == VPBE_VERSION_1) &&
850+ is_osd_win(layer) && is_rgb_pixfmt(lconfig->pixfmt)) {
849851 enum osd_pix_format pixfmt;
852+
850853 if (layer == WIN_OSD0)
851854 pixfmt = osd->win[WIN_OSD1].lconfig.pixfmt;
852855 else
drivers/media/platform/davinci/vpbe_venc.c+6−5
@@ -21,8 +21,11 @@ · 20 unmodified lines
2121 #include <linux/videodev2.h>
2222 #include <linux/slab.h>
2323
24+#ifdef CONFIG_ARCH_DAVINCI
2425 #include <mach/hardware.h>
2526 #include <mach/mux.h>
27+#endif
28+
2629 #include <linux/platform_data/i2c-davinci.h>
2730
2831 #include <linux/io.h>
@@ -224,7 +227,6 @@ venc_enable_vpss_clock(int venc_type, · 195 unmodified lines
224227 */
225228 static int venc_set_ntsc(struct v4l2_subdev *sd)
226229 {
227− u32 val;
228230 struct venc_state *venc = to_state(sd);
229231 struct venc_platform_data *pdata = venc->pdata;
230232
@@ -241,7 +243,7 @@ static int venc_set_ntsc(struct v4l2_subdev *sd) · 10 unmodified lines
241243 if (venc->venc_type == VPBE_VERSION_3) {
242244 venc_write(sd, VENC_CLKCTL, 0x01);
243245 venc_write(sd, VENC_VIDCTL, 0);
244− val = vdaccfg_write(sd, VDAC_CONFIG_SD_V3);
246+ vdaccfg_write(sd, VDAC_CONFIG_SD_V3);
245247 } else if (venc->venc_type == VPBE_VERSION_2) {
246248 venc_write(sd, VENC_CLKCTL, 0x01);
247249 venc_write(sd, VENC_VIDCTL, 0);
@@ -604,10 +606,9 @@ static int venc_device_get(struct device *dev, void *data) · 356 unmodified lines
604606 struct v4l2_subdev *venc_sub_dev_init(struct v4l2_device *v4l2_dev,
605607 const char *venc_name)
606608 {
607− struct venc_state *venc;
608− int err;
609+ struct venc_state *venc = NULL;
609610
610− err = bus_for_each_dev(&platform_bus_type, NULL, &venc,
611+ bus_for_each_dev(&platform_bus_type, NULL, &venc,
611612 venc_device_get);
612613 if (venc == NULL)
613614 return NULL;
drivers/media/platform/davinci/vpfe_capture.c+1−1
@@ -1509,7 +1509,7 @@ static int vpfe_streamon(struct file *file, void *priv, · 1508 unmodified lines
15091509 unlock_out:
15101510 mutex_unlock(&vpfe_dev->lock);
15111511 streamoff:
1512− ret = videobuf_streamoff(&vpfe_dev->buffer_queue);
1512+ videobuf_streamoff(&vpfe_dev->buffer_queue);
15131513 return ret;
15141514 }
15151515
drivers/media/platform/exynos4-is/Kconfig+1−3
@@ -41,11 +41,10 @@ config VIDEO_S5P_MIPI_CSIS · 40 unmodified lines
4141 To compile this driver as a module, choose M here: the
4242 module will be called s5p-csis.
4343
44−if SOC_EXYNOS4412 || SOC_EXYNOS5250
45−
4644 config VIDEO_EXYNOS_FIMC_LITE
4745 tristate "EXYNOS FIMC-LITE camera interface driver"
4846 depends on I2C
47+ depends on SOC_EXYNOS4412 || SOC_EXYNOS5250 || COMPILE_TEST
4948 depends on HAS_DMA
5049 select VIDEOBUF2_DMA_CONTIG
5150 select VIDEO_EXYNOS4_IS_COMMON
@@ -55,7 +54,6 @@ config VIDEO_EXYNOS_FIMC_LITE · 3 unmodified lines
5554
5655 To compile this driver as a module, choose M here: the
5756 module will be called exynos-fimc-lite.
58−endif
5957
6058 config VIDEO_EXYNOS4_FIMC_IS
6159 tristate "EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver"
drivers/media/platform/exynos4-is/fimc-lite-reg.c+1−1
@@ -254,7 +254,7 @@ void flite_hw_set_dma_window(struct fimc_lite *dev, struct flite_frame *f) · 253 unmodified lines
254254 /* Maximum output pixel size */
255255 cfg = readl(dev->regs + FLITE_REG_CIOCAN);
256256 cfg &= ~FLITE_REG_CIOCAN_MASK;
257− cfg = (f->f_height << 16) | f->f_width;
257+ cfg |= (f->f_height << 16) | f->f_width;
258258 writel(cfg, dev->regs + FLITE_REG_CIOCAN);
259259
260260 /* DMA offsets */
drivers/media/platform/fsl-viu.c+30−33
@@ -36,6 +36,12 @@ · 35 unmodified lines
3636 #define DRV_NAME "fsl_viu"
3737 #define VIU_VERSION "0.5.1"
3838
39+/* Allow building this driver with COMPILE_TEST */
40+#ifndef CONFIG_PPC
41+#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
42+#define in_be32(a) ioread32be((void __iomem *)a)
43+#endif
44+
3945 #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */
4046
4147 #define VIU_VID_MEM_LIMIT 4 /* Video memory limit, in Mb */
@@ -128,7 +134,7 @@ struct viu_dev { · 86 unmodified lines
128134 int dma_done;
129135
130136 /* Hardware register area */
131− struct viu_reg *vr;
137+ struct viu_reg __iomem *vr;
132138
133139 /* Interrupt vector */
134140 int irq;
@@ -229,7 +235,7 @@ enum status_config { · 94 unmodified lines
229235
230236 static irqreturn_t viu_intr(int irq, void *dev_id);
231237
232−struct viu_fmt *format_by_fourcc(int fourcc)
238+static struct viu_fmt *format_by_fourcc(int fourcc)
233239 {
234240 int i;
235241
@@ -242,9 +248,9 @@ struct viu_fmt *format_by_fourcc(int fourcc) · 6 unmodified lines
242248 return NULL;
243249 }
244250
245−void viu_start_dma(struct viu_dev *dev)
251+static void viu_start_dma(struct viu_dev *dev)
246252 {
247− struct viu_reg *vr = dev->vr;
253+ struct viu_reg __iomem *vr = dev->vr;
248254
249255 dev->field = 0;
250256
@@ -253,9 +259,9 @@ void viu_start_dma(struct viu_dev *dev) · 2 unmodified lines
253259 out_be32(&vr->status_cfg, INT_FIELD_EN);
254260 }
255261
256−void viu_stop_dma(struct viu_dev *dev)
262+static void viu_stop_dma(struct viu_dev *dev)
257263 {
258− struct viu_reg *vr = dev->vr;
264+ struct viu_reg __iomem *vr = dev->vr;
259265 int cnt = 100;
260266 u32 status_cfg;
261267
@@ -290,7 +296,7 @@ static int restart_video_queue(struct viu_dmaqueue *vidq) · 28 unmodified lines
290296 {
291297 struct viu_buf *buf, *prev;
292298
293− dprintk(1, "%s vidq=0x%08lx\n", __func__, (unsigned long)vidq);
299+ dprintk(1, "%s vidq=%p\n", __func__, vidq);
294300 if (!list_empty(&vidq->active)) {
295301 buf = list_entry(vidq->active.next, struct viu_buf, vb.queue);
296302 dprintk(2, "restart_queue [%p/%d]: restart dma\n",
@@ -395,7 +401,7 @@ static void free_buffer(struct videobuf_queue *vq, struct viu_buf *buf) · 98 unmodified lines
395401
396402 inline int buffer_activate(struct viu_dev *dev, struct viu_buf *buf)
397403 {
398− struct viu_reg *vr = dev->vr;
404+ struct viu_reg __iomem *vr = dev->vr;
399405 int bpp;
400406
401407 /* setup the DMA base address */
@@ -497,8 +503,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) · 95 unmodified lines
497503 struct viu_buf *prev;
498504
499505 if (!list_empty(&vidq->queued)) {
500− dprintk(1, "adding vb queue=0x%08lx\n",
501− (unsigned long)&buf->vb.queue);
506+ dprintk(1, "adding vb queue=%p\n", &buf->vb.queue);
502507 dprintk(1, "vidq pointer 0x%p, queued 0x%p\n",
503508 vidq, &vidq->queued);
504509 dprintk(1, "dev %p, queued: self %p, next %p, head %p\n",
@@ -509,8 +514,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) · 4 unmodified lines
509514 dprintk(2, "[%p/%d] buffer_queue - append to queued\n",
510515 buf, buf->vb.i);
511516 } else if (list_empty(&vidq->active)) {
512− dprintk(1, "adding vb active=0x%08lx\n",
513− (unsigned long)&buf->vb.queue);
517+ dprintk(1, "adding vb active=%p\n", &buf->vb.queue);
514518 list_add_tail(&buf->vb.queue, &vidq->active);
515519 buf->vb.state = VIDEOBUF_ACTIVE;
516520 mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT);
@@ -519,8 +523,7 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) · 2 unmodified lines
519523
520524 buffer_activate(dev, buf);
521525 } else {
522− dprintk(1, "adding vb queue2=0x%08lx\n",
523− (unsigned long)&buf->vb.queue);
526+ dprintk(1, "adding vb queue2=%p\n", &buf->vb.queue);
524527 prev = list_entry(vidq->active.prev, struct viu_buf, vb.queue);
525528 if (prev->vb.width == buf->vb.width &&
526529 prev->vb.height == buf->vb.height &&
@@ -703,10 +706,8 @@ static int verify_preview(struct viu_dev *dev, struct v4l2_window *win) · 176 unmodified lines
703706 return 0;
704707 }
705708
706−inline void viu_activate_overlay(struct viu_reg *viu_reg)
709+inline void viu_activate_overlay(struct viu_reg __iomem *vr)
707710 {
708− struct viu_reg *vr = viu_reg;
709−
710711 out_be32(&vr->field_base_addr, reg_val.field_base_addr);
711712 out_be32(&vr->dma_inc, reg_val.dma_inc);
712713 out_be32(&vr->picture_count, reg_val.picture_count);
@@ -749,7 +750,7 @@ static int viu_setup_preview(struct viu_dev *dev, struct viu_fh *fh) · 36 unmodified lines
749750 reg_val.status_cfg |= DMA_ACT | INT_DMA_END_EN | INT_FIELD_EN;
750751
751752 /* setup the base address of the overlay buffer */
752− reg_val.field_base_addr = (u32)dev->ovbuf.base;
753+ reg_val.field_base_addr = (u32)(long)dev->ovbuf.base;
753754
754755 return 0;
755756 }
@@ -802,7 +803,7 @@ static int vidioc_overlay(struct file *file, void *priv, unsigned int on) · 46 unmodified lines
802803 return 0;
803804 }
804805
805−int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg)
806+static int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg)
806807 {
807808 struct viu_fh *fh = priv;
808809 struct viu_dev *dev = fh->dev;
@@ -813,7 +814,7 @@ int vidioc_g_fbuf(struct file *file, void *priv, struct v4l2_framebuffer *arg) · 4 unmodified lines
813814 return 0;
814815 }
815816
816−int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer *arg)
817+static int vidioc_s_fbuf(struct file *file, void *priv, const struct v4l2_framebuffer *arg)
817818 {
818819 struct viu_fh *fh = priv;
819820 struct viu_dev *dev = fh->dev;
@@ -985,10 +986,8 @@ inline void viu_activate_next_buf(struct viu_dev *dev, · 165 unmodified lines
985986 }
986987 }
987988
988−inline void viu_default_settings(struct viu_reg *viu_reg)
989+inline void viu_default_settings(struct viu_reg __iomem *vr)
989990 {
990− struct viu_reg *vr = viu_reg;
991−
992991 out_be32(&vr->luminance, 0x9512A254);
993992 out_be32(&vr->chroma_r, 0x03310000);
994993 out_be32(&vr->chroma_g, 0x06600F38);
@@ -1001,7 +1000,7 @@ inline void viu_default_settings(struct viu_reg *viu_reg) · 6 unmodified lines
10011000
10021001 static void viu_overlay_intr(struct viu_dev *dev, u32 status)
10031002 {
1004− struct viu_reg *vr = dev->vr;
1003+ struct viu_reg __iomem *vr = dev->vr;
10051004
10061005 if (status & INT_DMA_END_STATUS)
10071006 dev->dma_done = 1;
@@ -1032,7 +1031,7 @@ static void viu_overlay_intr(struct viu_dev *dev, u32 status) · 24 unmodified lines
10321031 static void viu_capture_intr(struct viu_dev *dev, u32 status)
10331032 {
10341033 struct viu_dmaqueue *vidq = &dev->vidq;
1035− struct viu_reg *vr = dev->vr;
1034+ struct viu_reg __iomem *vr = dev->vr;
10361035 struct viu_buf *buf;
10371036 int field_num;
10381037 int need_two;
@@ -1104,7 +1103,7 @@ static void viu_capture_intr(struct viu_dev *dev, u32 status) · 65 unmodified lines
11041103 static irqreturn_t viu_intr(int irq, void *dev_id)
11051104 {
11061105 struct viu_dev *dev = (struct viu_dev *)dev_id;
1107− struct viu_reg *vr = dev->vr;
1106+ struct viu_reg __iomem *vr = dev->vr;
11081107 u32 status;
11091108 u32 error;
11101109
@@ -1169,7 +1168,7 @@ static int viu_open(struct file *file) · 58 unmodified lines
11691168 struct video_device *vdev = video_devdata(file);
11701169 struct viu_dev *dev = video_get_drvdata(vdev);
11711170 struct viu_fh *fh;
1172− struct viu_reg *vr;
1171+ struct viu_reg __iomem *vr;
11731172 int minor = vdev->minor;
11741173 u32 status_cfg;
11751174
@@ -1210,9 +1209,7 @@ static int viu_open(struct file *file) · 34 unmodified lines
12101209 dev->crop_current.width = fh->width;
12111210 dev->crop_current.height = fh->height;
12121211
1213− dprintk(1, "Open: fh=0x%08lx, dev=0x%08lx, dev->vidq=0x%08lx\n",
1214− (unsigned long)fh, (unsigned long)dev,
1215− (unsigned long)&dev->vidq);
1212+ dprintk(1, "Open: fh=%p, dev=%p, dev->vidq=%p\n", fh, dev, &dev->vidq);
12161213 dprintk(1, "Open: list_empty queued=%d\n",
12171214 list_empty(&dev->vidq.queued));
12181215 dprintk(1, "Open: list_empty active=%d\n",
@@ -1305,7 +1302,7 @@ static int viu_release(struct file *file) · 86 unmodified lines
13051302 return 0;
13061303 }
13071304
1308−void viu_reset(struct viu_reg *reg)
1305+static void viu_reset(struct viu_reg __iomem *reg)
13091306 {
13101307 out_be32(&reg->status_cfg, 0);
13111308 out_be32(&reg->luminance, 0x9512a254);
@@ -1325,7 +1322,7 @@ static int viu_mmap(struct file *file, struct vm_area_struct *vma) · 13 unmodified lines
13251322 struct viu_dev *dev = fh->dev;
13261323 int ret;
13271324
1328− dprintk(1, "mmap called, vma=0x%08lx\n", (unsigned long)vma);
1325+ dprintk(1, "mmap called, vma=%p\n", vma);
13291326
13301327 if (mutex_lock_interruptible(&dev->lock))
13311328 return -ERESTARTSYS;
@@ -1407,7 +1404,7 @@ static int viu_of_probe(struct platform_device *op) · 75 unmodified lines
14071404 }
14081405
14091406 viu_irq = irq_of_parse_and_map(op->dev.of_node, 0);
1410− if (viu_irq == NO_IRQ) {
1407+ if (!viu_irq) {
14111408 dev_err(&op->dev, "Error while mapping the irq\n");
14121409 return -EINVAL;
14131410 }
drivers/media/platform/marvell-ccic/Kconfig+4−3
@@ -1,7 +1,6 @@
11 config VIDEO_CAFE_CCIC
22 tristate "Marvell 88ALP01 (Cafe) CMOS Camera Controller support"
33 depends on PCI && I2C && VIDEO_V4L2
4− depends on HAS_DMA
54 select VIDEO_OV7670
65 select VIDEOBUF2_VMALLOC
76 select VIDEOBUF2_DMA_CONTIG
@@ -13,10 +12,12 @@ config VIDEO_CAFE_CCIC · 5 unmodified lines
1312
1413 config VIDEO_MMP_CAMERA
1514 tristate "Marvell Armada 610 integrated camera controller support"
16− depends on ARCH_MMP && I2C && VIDEO_V4L2
17− depends on HAS_DMA && BROKEN
15+ depends on I2C && VIDEO_V4L2
16+ depends on ARCH_MMP || COMPILE_TEST
1817 select VIDEO_OV7670
1918 select I2C_GPIO
19+ select VIDEOBUF2_VMALLOC
20+ select VIDEOBUF2_DMA_CONTIG
2021 select VIDEOBUF2_DMA_SG
2122 ---help---
2223 This is a Video4Linux2 driver for the integrated camera
drivers/media/platform/marvell-ccic/Makefile+4−5
@@ -1,6 +1,5 @@
1−obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o
2−cafe_ccic-y := cafe-driver.o mcam-core.o
3−
4−obj-$(CONFIG_VIDEO_MMP_CAMERA) += mmp_camera.o
5−mmp_camera-y := mmp-driver.o mcam-core.o
1+obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o mcam-core.o
2+cafe_ccic-y := cafe-driver.o
63
4+obj-$(CONFIG_VIDEO_MMP_CAMERA) += mmp_camera.o mcam-core.o
5+mmp_camera-y := mmp-driver.o
drivers/media/platform/marvell-ccic/mcam-core.c+8−1
@@ -1720,6 +1720,7 @@ int mccic_irq(struct mcam_camera *cam, unsigned int irqs) · 1719 unmodified lines
17201720 }
17211721 return handled;
17221722 }
1723+EXPORT_SYMBOL_GPL(mccic_irq);
17231724
17241725 /* ---------------------------------------------------------------------- */
17251726 /*
@@ -1830,7 +1831,7 @@ out_unregister: · 104 unmodified lines
18301831 v4l2_device_unregister(&cam->v4l2_dev);
18311832 return ret;
18321833 }
1833−
1834+EXPORT_SYMBOL_GPL(mccic_register);
18341835
18351836 void mccic_shutdown(struct mcam_camera *cam)
18361837 {
@@ -1850,6 +1851,7 @@ void mccic_shutdown(struct mcam_camera *cam) · 13 unmodified lines
18501851 v4l2_ctrl_handler_free(&cam->ctrl_handler);
18511852 v4l2_device_unregister(&cam->v4l2_dev);
18521853 }
1854+EXPORT_SYMBOL_GPL(mccic_shutdown);
18531855
18541856 /*
18551857 * Power management
@@ -1868,6 +1870,7 @@ void mccic_suspend(struct mcam_camera *cam) · 12 unmodified lines
18681870 }
18691871 mutex_unlock(&cam->s_mutex);
18701872 }
1873+EXPORT_SYMBOL_GPL(mccic_suspend);
18711874
18721875 int mccic_resume(struct mcam_camera *cam)
18731876 {
@@ -1898,4 +1901,8 @@ int mccic_resume(struct mcam_camera *cam) · 24 unmodified lines
18981901 }
18991902 return ret;
19001903 }
1904+EXPORT_SYMBOL_GPL(mccic_resume);
19011905 #endif /* CONFIG_PM */
1906+
1907+MODULE_LICENSE("GPL v2");
1908+MODULE_AUTHOR("Jonathan Corbet <corbet@lwn.net>");
drivers/media/platform/marvell-ccic/mmp-driver.c+3−3
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL"); · 36 unmodified lines
3737 static char *mcam_clks[] = {"CCICAXICLK", "CCICFUNCLK", "CCICPHYCLK"};
3838
3939 struct mmp_camera {
40− void *power_regs;
40+ void __iomem *power_regs;
4141 struct platform_device *pdev;
4242 struct mcam_camera mcam;
4343 struct list_head devlist;
@@ -183,7 +183,7 @@ static void mmpcam_power_down(struct mcam_camera *mcam) · 139 unmodified lines
183183 mcam_clk_disable(mcam);
184184 }
185185
186−void mcam_ctlr_reset(struct mcam_camera *mcam)
186+static void mcam_ctlr_reset(struct mcam_camera *mcam)
187187 {
188188 unsigned long val;
189189 struct mmp_camera *cam = mcam_to_cam(mcam);
@@ -214,7 +214,7 @@ void mcam_ctlr_reset(struct mcam_camera *mcam) · 24 unmodified lines
214214 * CSI2_DPHY3 and CSI2_DPHY6 can be set with a default value
215215 * or be calculated dynamically
216216 */
217−void mmpcam_calc_dphy(struct mcam_camera *mcam)
217+static void mmpcam_calc_dphy(struct mcam_camera *mcam)
218218 {
219219 struct mmp_camera *cam = mcam_to_cam(mcam);
220220 struct mmp_camera_platform_data *pdata = cam->pdev->dev.platform_data;
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c+1−4
@@ -1084,10 +1084,7 @@ static int mtk_jpeg_clk_init(struct mtk_jpeg_dev *jpeg) · 1083 unmodified lines
10841084 return PTR_ERR(jpeg->clk_jdec);
10851085
10861086 jpeg->clk_jdec_smi = devm_clk_get(jpeg->dev, "jpgdec-smi");
1087− if (IS_ERR(jpeg->clk_jdec_smi))
1088− return PTR_ERR(jpeg->clk_jdec_smi);
1089−
1090− return 0;
1087+ return PTR_ERR_OR_ZERO(jpeg->clk_jdec_smi);
10911088 }
10921089
10931090 static int mtk_jpeg_probe(struct platform_device *pdev)
drivers/media/platform/omap/Kconfig+4−3
@@ -1,15 +1,16 @@
11 config VIDEO_OMAP2_VOUT_VRFB
22 bool
3+ default y
4+ depends on VIDEO_OMAP2_VOUT && (OMAP2_VRFB || COMPILE_TEST)
35
46 config VIDEO_OMAP2_VOUT
57 tristate "OMAP2/OMAP3 V4L2-Display driver"
68 depends on MMU
7− depends on ARCH_OMAP2 || ARCH_OMAP3
8− depends on FB_OMAP2
9+ depends on FB_OMAP2 || (COMPILE_TEST && FB_OMAP2=n)
10+ depends on ARCH_OMAP2 || ARCH_OMAP3 || COMPILE_TEST
911 select VIDEOBUF_GEN
1012 select VIDEOBUF_DMA_CONTIG
1113 select OMAP2_VRFB if ARCH_OMAP2 || ARCH_OMAP3
12− select VIDEO_OMAP2_VOUT_VRFB if VIDEO_OMAP2_VOUT && OMAP2_VRFB
1314 select FRAME_VECTOR
1415 default n
1516 ---help---
drivers/media/platform/omap/omap_vout.c+8−9
@@ -198,7 +198,7 @@ static int omap_vout_try_format(struct v4l2_pix_format *pix) · 197 unmodified lines
198198 * omap_vout_get_userptr: Convert user space virtual address to physical
199199 * address.
200200 */
201−static int omap_vout_get_userptr(struct videobuf_buffer *vb, u32 virtp,
201+static int omap_vout_get_userptr(struct videobuf_buffer *vb, long virtp,
202202 u32 *physp)
203203 {
204204 struct frame_vector *vec;
@@ -702,19 +702,18 @@ static int omap_vout_buffer_setup(struct videobuf_queue *q, unsigned int *count, · 497 unmodified lines
702702 virt_addr = omap_vout_alloc_buffer(vout->buffer_size,
703703 &phy_addr);
704704 if (!virt_addr) {
705− if (ovid->rotation_type == VOUT_ROT_NONE) {
705+ if (ovid->rotation_type == VOUT_ROT_NONE)
706706 break;
707− } else {
708− if (!is_rotation_enabled(vout))
709− break;
707+
708+ if (!is_rotation_enabled(vout))
709+ break;
710+
710711 /* Free the VRFB buffers if no space for V4L2 buffers */
711712 for (j = i; j < *count; j++) {
712− omap_vout_free_buffer(
713− vout->smsshado_virt_addr[j],
714− vout->smsshado_size);
713+ omap_vout_free_buffer(vout->smsshado_virt_addr[j],
714+ vout->smsshado_size);
715715 vout->smsshado_virt_addr[j] = 0;
716716 vout->smsshado_phy_addr[j] = 0;
717− }
718717 }
719718 }
720719 vout->buf_virt_addr[i] = virt_addr;
drivers/media/platform/omap/omap_vout_vrfb.c+2−2
@@ -54,8 +54,8 @@ static int omap_vout_allocate_vrfb_buffers(struct omap_vout_device *vout, · 53 unmodified lines
5454 *count = 0;
5555 return -ENOMEM;
5656 }
57− memset((void *) vout->smsshado_virt_addr[i], 0,
58− vout->smsshado_size);
57+ memset((void *)(long)vout->smsshado_virt_addr[i], 0,
58+ vout->smsshado_size);
5959 }
6060 return 0;
6161 }
drivers/media/platform/omap3isp/isp.c+12−10
@@ -61,7 +61,9 @@ · 60 unmodified lines
6161 #include <linux/sched.h>
6262 #include <linux/vmalloc.h>
6363
64+#ifdef CONFIG_ARM_DMA_USE_IOMMU
6465 #include <asm/dma-iommu.h>
66+#endif
6567
6668 #include <media/v4l2-common.h>
6769 #include <media/v4l2-fwnode.h>
@@ -284,13 +286,6 @@ static const struct clk_ops isp_xclk_ops = { · 216 unmodified lines
284286
285287 static const char *isp_xclk_parent_name = "cam_mclk";
286288
287−static const struct clk_init_data isp_xclk_init_data = {
288− .name = "cam_xclk",
289− .ops = &isp_xclk_ops,
290− .parent_names = &isp_xclk_parent_name,
291− .num_parents = 1,
292−};
293−
294289 static struct clk *isp_xclk_src_get(struct of_phandle_args *clkspec, void *data)
295290 {
296291 unsigned int idx = clkspec->args[0];
@@ -1945,12 +1940,16 @@ error_csi2: · 1648 unmodified lines
19451940
19461941 static void isp_detach_iommu(struct isp_device *isp)
19471942 {
1943+#ifdef CONFIG_ARM_DMA_USE_IOMMU
1944+ arm_iommu_detach_device(isp->dev);
19481945 arm_iommu_release_mapping(isp->mapping);
19491946 isp->mapping = NULL;
1947+#endif
19501948 }
19511949
19521950 static int isp_attach_iommu(struct isp_device *isp)
19531951 {
1952+#ifdef CONFIG_ARM_DMA_USE_IOMMU
19541953 struct dma_iommu_mapping *mapping;
19551954 int ret;
19561955
@@ -1961,8 +1960,7 @@ static int isp_attach_iommu(struct isp_device *isp) · 4 unmodified lines
19611960 mapping = arm_iommu_create_mapping(&platform_bus_type, SZ_1G, SZ_2G);
19621961 if (IS_ERR(mapping)) {
19631962 dev_err(isp->dev, "failed to create ARM IOMMU mapping\n");
1964− ret = PTR_ERR(mapping);
1965− goto error;
1963+ return PTR_ERR(mapping);
19661964 }
19671965
19681966 isp->mapping = mapping;
@@ -1977,8 +1975,12 @@ static int isp_attach_iommu(struct isp_device *isp) · 8 unmodified lines
19771975 return 0;
19781976
19791977 error:
1980− isp_detach_iommu(isp);
1978+ arm_iommu_release_mapping(isp->mapping);
1979+ isp->mapping = NULL;
19811980 return ret;
1981+#else
1982+ return -ENODEV;
1983+#endif
19821984 }
19831985
19841986 /*
drivers/media/platform/omap3isp/ispccdc.c+1−1
@@ -735,7 +735,7 @@ static int ccdc_config(struct isp_ccdc_device *ccdc, · 734 unmodified lines
735735 return -ENOMEM;
736736
737737 if (copy_from_user(fpc_new.addr,
738− (__force void __user *)fpc.fpcaddr,
738+ (__force void __user *)(long)fpc.fpcaddr,
739739 size)) {
740740 dma_free_coherent(isp->dev, size, fpc_new.addr,
741741 fpc_new.dma);
drivers/media/platform/omap3isp/isph3a_aewb.c+2−0
@@ -250,6 +250,8 @@ static long h3a_aewb_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) · 249 unmodified lines
250250 return omap3isp_stat_config(stat, arg);
251251 case VIDIOC_OMAP3ISP_STAT_REQ:
252252 return omap3isp_stat_request_statistics(stat, arg);
253+ case VIDIOC_OMAP3ISP_STAT_REQ_TIME32:
254+ return omap3isp_stat_request_statistics_time32(stat, arg);
253255 case VIDIOC_OMAP3ISP_STAT_EN: {
254256 unsigned long *en = arg;
255257 return omap3isp_stat_enable(stat, !!*en);
drivers/media/platform/omap3isp/isph3a_af.c+2−0
@@ -314,6 +314,8 @@ static long h3a_af_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) · 313 unmodified lines
314314 return omap3isp_stat_config(stat, arg);
315315 case VIDIOC_OMAP3ISP_STAT_REQ:
316316 return omap3isp_stat_request_statistics(stat, arg);
317+ case VIDIOC_OMAP3ISP_STAT_REQ_TIME32:
318+ return omap3isp_stat_request_statistics_time32(stat, arg);
317319 case VIDIOC_OMAP3ISP_STAT_EN: {
318320 int *en = arg;
319321 return omap3isp_stat_enable(stat, !!*en);
drivers/media/platform/omap3isp/isphist.c+2−0
@@ -435,6 +435,8 @@ static long hist_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) · 434 unmodified lines
435435 return omap3isp_stat_config(stat, arg);
436436 case VIDIOC_OMAP3ISP_STAT_REQ:
437437 return omap3isp_stat_request_statistics(stat, arg);
438+ case VIDIOC_OMAP3ISP_STAT_REQ_TIME32:
439+ return omap3isp_stat_request_statistics_time32(stat, arg);
438440 case VIDIOC_OMAP3ISP_STAT_EN: {
439441 int *en = arg;
440442 return omap3isp_stat_enable(stat, !!*en);
drivers/media/platform/omap3isp/isppreview.c+3−3
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 #include "isppreview.h"
2626
2727 /* Default values in Office Fluorescent Light for RGBtoRGB Blending */
28−static struct omap3isp_prev_rgbtorgb flr_rgb2rgb = {
28+static const struct omap3isp_prev_rgbtorgb flr_rgb2rgb = {
2929 { /* RGB-RGB Matrix */
3030 {0x01E2, 0x0F30, 0x0FEE},
3131 {0x0F9B, 0x01AC, 0x0FB9},
@@ -35,7 +35,7 @@ static struct omap3isp_prev_rgbtorgb flr_rgb2rgb = { · 3 unmodified lines
3535 };
3636
3737 /* Default values in Office Fluorescent Light for RGB to YUV Conversion*/
38−static struct omap3isp_prev_csc flr_prev_csc = {
38+static const struct omap3isp_prev_csc flr_prev_csc = {
3939 { /* CSC Coef Matrix */
4040 {66, 129, 25},
4141 {-38, -75, 112},
@@ -890,7 +890,7 @@ static int preview_config(struct isp_prev_device *prev, · 848 unmodified lines
890890 params = &prev->params.params[!!(active & bit)];
891891
892892 if (cfg->flag & bit) {
893− void __user *from = *(void * __user *)
893+ void __user *from = *(void __user **)
894894 ((void *)cfg + attr->config_offset);
895895 void *to = (void *)params + attr->param_offset;
896896 size_t size = attr->param_size;
drivers/media/platform/omap3isp/ispstat.c+24−13
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717
1818 #include <linux/dma-mapping.h>
1919 #include <linux/slab.h>
20+#include <linux/timekeeping.h>
2021 #include <linux/uaccess.h>
2122
2223 #include "isp.h"
@@ -237,7 +238,7 @@ static int isp_stat_buf_queue(struct ispstat *stat) · 214 unmodified lines
237238 if (!stat->active_buf)
238239 return STAT_NO_BUF;
239240
240− v4l2_get_timestamp(&stat->active_buf->ts);
241+ ktime_get_ts64(&stat->active_buf->ts);
241242
242243 stat->active_buf->buf_size = stat->buf_size;
243244 if (isp_stat_buf_check_magic(stat, stat->active_buf)) {
@@ -370,7 +371,7 @@ static int isp_stat_bufs_alloc_one(struct device *dev, · 126 unmodified lines
370371 int ret;
371372
372373 buf->virt_addr = dma_alloc_coherent(dev, size, &buf->dma_addr,
373− GFP_KERNEL | GFP_DMA);
374+ GFP_KERNEL);
374375 if (!buf->virt_addr)
375376 return -ENOMEM;
376377
@@ -449,10 +450,8 @@ static int isp_stat_bufs_alloc(struct ispstat *stat, u32 size) · 72 unmodified lines
449450 buf->empty = 1;
450451
451452 dev_dbg(stat->isp->dev,
452− "%s: buffer[%u] allocated. dma=0x%08lx virt=0x%08lx",
453− stat->subdev.name, i,
454− (unsigned long)buf->dma_addr,
455− (unsigned long)buf->virt_addr);
453+ "%s: buffer[%u] allocated. dma=%pad virt=%p",
454+ stat->subdev.name, i, &buf->dma_addr, buf->virt_addr);
456455 }
457456
458457 return 0;
@@ -500,7 +499,8 @@ int omap3isp_stat_request_statistics(struct ispstat *stat, · 41 unmodified lines
500499 return PTR_ERR(buf);
501500 }
502501
503− data->ts = buf->ts;
502+ data->ts.tv_sec = buf->ts.tv_sec;
503+ data->ts.tv_usec = buf->ts.tv_nsec / NSEC_PER_USEC;
504504 data->config_counter = buf->config_counter;
505505 data->frame_number = buf->frame_number;
506506 data->buf_size = buf->buf_size;
@@ -512,6 +512,23 @@ int omap3isp_stat_request_statistics(struct ispstat *stat, · 5 unmodified lines
512512 return 0;
513513 }
514514
515+int omap3isp_stat_request_statistics_time32(struct ispstat *stat,
516+ struct omap3isp_stat_data_time32 *data)
517+{
518+ struct omap3isp_stat_data data64;
519+ int ret;
520+
521+ ret = omap3isp_stat_request_statistics(stat, &data64);
522+ if (ret)
523+ return ret;
524+
525+ data->ts.tv_sec = data64.ts.tv_sec;
526+ data->ts.tv_usec = data64.ts.tv_usec;
527+ memcpy(&data->buf, &data64.buf, sizeof(*data) - sizeof(data->ts));
528+
529+ return 0;
530+}
531+
515532 /*
516533 * omap3isp_stat_config - Receives new statistic engine configuration.
517534 * @new_conf: Pointer to config structure.
@@ -527,12 +544,6 @@ int omap3isp_stat_config(struct ispstat *stat, void *new_conf) · 9 unmodified lines
527544 struct ispstat_generic_config *user_cfg = new_conf;
528545 u32 buf_size = user_cfg->buf_size;
529546
530− if (!new_conf) {
531− dev_dbg(stat->isp->dev, "%s: configuration is NULL\n",
532− stat->subdev.name);
533− return -EINVAL;
534− }
535−
536547 mutex_lock(&stat->ioctl_lock);
537548
538549 dev_dbg(stat->isp->dev,
drivers/media/platform/omap3isp/ispstat.h+3−1
@@ -39,7 +39,7 @@ struct ispstat_buffer { · 38 unmodified lines
3939 struct sg_table sgt;
4040 void *virt_addr;
4141 dma_addr_t dma_addr;
42− struct timeval ts;
42+ struct timespec64 ts;
4343 u32 buf_size;
4444 u32 frame_number;
4545 u16 config_counter;
@@ -130,6 +130,8 @@ struct ispstat_generic_config { · 84 unmodified lines
130130 int omap3isp_stat_config(struct ispstat *stat, void *new_conf);
131131 int omap3isp_stat_request_statistics(struct ispstat *stat,
132132 struct omap3isp_stat_data *data);
133+int omap3isp_stat_request_statistics_time32(struct ispstat *stat,
134+ struct omap3isp_stat_data_time32 *data);
133135 int omap3isp_stat_init(struct ispstat *stat, const char *name,
134136 const struct v4l2_subdev_ops *sd_ops);
135137 void omap3isp_stat_cleanup(struct ispstat *stat);
drivers/media/platform/omap3isp/ispvideo.c+1−1
@@ -1403,7 +1403,7 @@ static int isp_video_mmap(struct file *file, struct vm_area_struct *vma) · 1402 unmodified lines
14031403 return vb2_mmap(&vfh->queue, vma);
14041404 }
14051405
1406−static struct v4l2_file_operations isp_video_fops = {
1406+static const struct v4l2_file_operations isp_video_fops = {
14071407 .owner = THIS_MODULE,
14081408 .unlocked_ioctl = video_ioctl2,
14091409 .open = isp_video_open,
drivers/media/platform/pxa_camera.c+34−16
@@ -2030,6 +2030,22 @@ static int pxac_vidioc_s_input(struct file *file, void *priv, unsigned int i) · 2029 unmodified lines
20302030 return 0;
20312031 }
20322032
2033+static int pxac_sensor_set_power(struct pxa_camera_dev *pcdev, int on)
2034+{
2035+ int ret;
2036+
2037+ ret = sensor_call(pcdev, core, s_power, on);
2038+ if (ret == -ENOIOCTLCMD)
2039+ ret = 0;
2040+ if (ret) {
2041+ dev_warn(pcdev_to_dev(pcdev),
2042+ "Failed to put subdevice in %s mode: %d\n",
2043+ on ? "normal operation" : "power saving", ret);
2044+ }
2045+
2046+ return ret;
2047+}
2048+
20332049 static int pxac_fops_camera_open(struct file *filp)
20342050 {
20352051 struct pxa_camera_dev *pcdev = video_drvdata(filp);
@@ -2040,7 +2056,10 @@ static int pxac_fops_camera_open(struct file *filp) · 4 unmodified lines
20402056 if (ret < 0)
20412057 goto out;
20422058
2043− ret = sensor_call(pcdev, core, s_power, 1);
2059+ if (!v4l2_fh_is_singular_file(filp))
2060+ goto out;
2061+
2062+ ret = pxac_sensor_set_power(pcdev, 1);
20442063 if (ret)
20452064 v4l2_fh_release(filp);
20462065 out:
@@ -2052,13 +2071,17 @@ static int pxac_fops_camera_release(struct file *filp) · 5 unmodified lines
20522071 {
20532072 struct pxa_camera_dev *pcdev = video_drvdata(filp);
20542073 int ret;
2055−
2056− ret = vb2_fop_release(filp);
2057− if (ret < 0)
2058− return ret;
2074+ bool fh_singular;
20592075
20602076 mutex_lock(&pcdev->mlock);
2061− ret = sensor_call(pcdev, core, s_power, 0);
2077+
2078+ fh_singular = v4l2_fh_is_singular_file(filp);
2079+
2080+ ret = _vb2_fop_release(filp, NULL);
2081+
2082+ if (fh_singular)
2083+ ret = pxac_sensor_set_power(pcdev, 0);
2084+
20622085 mutex_unlock(&pcdev->mlock);
20632086
20642087 return ret;
@@ -2160,7 +2183,7 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier, · 95 unmodified lines
21602183 pix->pixelformat = pcdev->current_fmt->host_fmt->fourcc;
21612184 v4l2_fill_mbus_format(mf, pix, pcdev->current_fmt->code);
21622185
2163− err = sensor_call(pcdev, core, s_power, 1);
2186+ err = pxac_sensor_set_power(pcdev, 1);
21642187 if (err)
21652188 goto out;
21662189
@@ -2187,7 +2210,7 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier, · 20 unmodified lines
21872210 }
21882211
21892212 out_sensor_poweroff:
2190− err = sensor_call(pcdev, core, s_power, 0);
2213+ err = pxac_sensor_set_power(pcdev, 0);
21912214 out:
21922215 mutex_unlock(&pcdev->mlock);
21932216 return err;
@@ -2242,11 +2265,8 @@ static int pxa_camera_suspend(struct device *dev) · 48 unmodified lines
22422265 pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR3);
22432266 pcdev->save_cicr[i++] = __raw_readl(pcdev->base + CICR4);
22442267
2245− if (pcdev->sensor) {
2246− ret = sensor_call(pcdev, core, s_power, 0);
2247− if (ret == -ENOIOCTLCMD)
2248− ret = 0;
2249− }
2268+ if (pcdev->sensor)
2269+ ret = pxac_sensor_set_power(pcdev, 0);
22502270
22512271 return ret;
22522272 }
@@ -2263,9 +2283,7 @@ static int pxa_camera_resume(struct device *dev) · 10 unmodified lines
22632283 __raw_writel(pcdev->save_cicr[i++], pcdev->base + CICR4);
22642284
22652285 if (pcdev->sensor) {
2266− ret = sensor_call(pcdev, core, s_power, 1);
2267− if (ret == -ENOIOCTLCMD)
2268− ret = 0;
2286+ ret = pxac_sensor_set_power(pcdev, 1);
22692287 }
22702288
22712289 /* Restart frame capture if active buffer exists */
drivers/media/platform/rcar-vin/Kconfig+14−2
@@ -1,12 +1,24 @@
1+config VIDEO_RCAR_CSI2
2+ tristate "R-Car MIPI CSI-2 Receiver"
3+ depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF
4+ depends on ARCH_RENESAS || COMPILE_TEST
5+ select V4L2_FWNODE
6+ help
7+ Support for Renesas R-Car MIPI CSI-2 receiver.
8+ Supports R-Car Gen3 SoCs.
9+
10+ To compile this driver as a module, choose M here: the
11+ module will be called rcar-csi2.
12+
113 config VIDEO_RCAR_VIN
214 tristate "R-Car Video Input (VIN) Driver"
3− depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && HAS_DMA && MEDIA_CONTROLLER
15+ depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API && OF && MEDIA_CONTROLLER
416 depends on ARCH_RENESAS || COMPILE_TEST
517 select VIDEOBUF2_DMA_CONTIG
618 select V4L2_FWNODE
719 ---help---
820 Support for Renesas R-Car Video Input (VIN) driver.
9− Supports R-Car Gen2 SoCs.
21+ Supports R-Car Gen2 and Gen3 SoCs.
1022
1123 To compile this driver as a module, choose M here: the
1224 module will be called rcar-vin.
drivers/media/platform/rcar-vin/Makefile+1−0
@@ -1,3 +1,4 @@
11 rcar-vin-objs = rcar-core.o rcar-dma.o rcar-v4l2.o
22
3+obj-$(CONFIG_VIDEO_RCAR_CSI2) += rcar-csi2.o
34 obj-$(CONFIG_VIDEO_RCAR_VIN) += rcar-vin.o
drivers/media/platform/rcar-vin/rcar-core.c+904−55
@@ -20,12 +20,341 @@ · 19 unmodified lines
2020 #include <linux/of_graph.h>
2121 #include <linux/platform_device.h>
2222 #include <linux/pm_runtime.h>
23+#include <linux/slab.h>
24+#include <linux/sys_soc.h>
2325
2426 #include <media/v4l2-async.h>
2527 #include <media/v4l2-fwnode.h>
28+#include <media/v4l2-mc.h>
2629
2730 #include "rcar-vin.h"
2831
32+/*
33+ * The companion CSI-2 receiver driver (rcar-csi2) is known
34+ * and we know it has one source pad (pad 0) and four sink
35+ * pads (pad 1-4). So to translate a pad on the remote
36+ * CSI-2 receiver to/from the VIN internal channel number simply
37+ * subtract/add one from the pad/channel number.
38+ */
39+#define rvin_group_csi_pad_to_channel(pad) ((pad) - 1)
40+#define rvin_group_csi_channel_to_pad(channel) ((channel) + 1)
41+
42+/*
43+ * Not all VINs are created equal, master VINs control the
44+ * routing for other VIN's. We can figure out which VIN is
45+ * master by looking at a VINs id.
46+ */
47+#define rvin_group_id_to_master(vin) ((vin) < 4 ? 0 : 4)
48+
49+/* -----------------------------------------------------------------------------
50+ * Media Controller link notification
51+ */
52+
53+/* group lock should be held when calling this function. */
54+static int rvin_group_entity_to_csi_id(struct rvin_group *group,
55+ struct media_entity *entity)
56+{
57+ struct v4l2_subdev *sd;
58+ unsigned int i;
59+
60+ sd = media_entity_to_v4l2_subdev(entity);
61+
62+ for (i = 0; i < RVIN_CSI_MAX; i++)
63+ if (group->csi[i].subdev == sd)
64+ return i;
65+
66+ return -ENODEV;
67+}
68+
69+static unsigned int rvin_group_get_mask(struct rvin_dev *vin,
70+ enum rvin_csi_id csi_id,
71+ unsigned char channel)
72+{
73+ const struct rvin_group_route *route;
74+ unsigned int mask = 0;
75+
76+ for (route = vin->info->routes; route->mask; route++) {
77+ if (route->vin == vin->id &&
78+ route->csi == csi_id &&
79+ route->channel == channel) {
80+ vin_dbg(vin,
81+ "Adding route: vin: %d csi: %d channel: %d\n",
82+ route->vin, route->csi, route->channel);
83+ mask |= route->mask;
84+ }
85+ }
86+
87+ return mask;
88+}
89+
90+/*
91+ * Link setup for the links between a VIN and a CSI-2 receiver is a bit
92+ * complex. The reason for this is that the register controlling routing
93+ * is not present in each VIN instance. There are special VINs which
94+ * control routing for themselves and other VINs. There are not many
95+ * different possible links combinations that can be enabled at the same
96+ * time, therefor all already enabled links which are controlled by a
97+ * master VIN need to be taken into account when making the decision
98+ * if a new link can be enabled or not.
99+ *
100+ * 1. Find out which VIN the link the user tries to enable is connected to.
101+ * 2. Lookup which master VIN controls the links for this VIN.
102+ * 3. Start with a bitmask with all bits set.
103+ * 4. For each previously enabled link from the master VIN bitwise AND its
104+ * route mask (see documentation for mask in struct rvin_group_route)
105+ * with the bitmask.
106+ * 5. Bitwise AND the mask for the link the user tries to enable to the bitmask.
107+ * 6. If the bitmask is not empty at this point the new link can be enabled
108+ * while keeping all previous links enabled. Update the CHSEL value of the
109+ * master VIN and inform the user that the link could be enabled.
110+ *
111+ * Please note that no link can be enabled if any VIN in the group is
112+ * currently open.
113+ */
114+static int rvin_group_link_notify(struct media_link *link, u32 flags,
115+ unsigned int notification)
116+{
117+ struct rvin_group *group = container_of(link->graph_obj.mdev,
118+ struct rvin_group, mdev);
119+ unsigned int master_id, channel, mask_new, i;
120+ unsigned int mask = ~0;
121+ struct media_entity *entity;
122+ struct video_device *vdev;
123+ struct media_pad *csi_pad;
124+ struct rvin_dev *vin = NULL;
125+ int csi_id, ret;
126+
127+ ret = v4l2_pipeline_link_notify(link, flags, notification);
128+ if (ret)
129+ return ret;
130+
131+ /* Only care about link enablement for VIN nodes. */
132+ if (!(flags & MEDIA_LNK_FL_ENABLED) ||
133+ !is_media_entity_v4l2_video_device(link->sink->entity))
134+ return 0;
135+
136+ /* If any entity is in use don't allow link changes. */
137+ media_device_for_each_entity(entity, &group->mdev)
138+ if (entity->use_count)
139+ return -EBUSY;
140+
141+ mutex_lock(&group->lock);
142+
143+ /* Find the master VIN that controls the routes. */
144+ vdev = media_entity_to_video_device(link->sink->entity);
145+ vin = container_of(vdev, struct rvin_dev, vdev);
146+ master_id = rvin_group_id_to_master(vin->id);
147+
148+ if (WARN_ON(!group->vin[master_id])) {
149+ ret = -ENODEV;
150+ goto out;
151+ }
152+
153+ /* Build a mask for already enabled links. */
154+ for (i = master_id; i < master_id + 4; i++) {
155+ if (!group->vin[i])
156+ continue;
157+
158+ /* Get remote CSI-2, if any. */
159+ csi_pad = media_entity_remote_pad(
160+ &group->vin[i]->vdev.entity.pads[0]);
161+ if (!csi_pad)
162+ continue;
163+
164+ csi_id = rvin_group_entity_to_csi_id(group, csi_pad->entity);
165+ channel = rvin_group_csi_pad_to_channel(csi_pad->index);
166+
167+ mask &= rvin_group_get_mask(group->vin[i], csi_id, channel);
168+ }
169+
170+ /* Add the new link to the existing mask and check if it works. */
171+ csi_id = rvin_group_entity_to_csi_id(group, link->source->entity);
172+ channel = rvin_group_csi_pad_to_channel(link->source->index);
173+ mask_new = mask & rvin_group_get_mask(vin, csi_id, channel);
174+
175+ vin_dbg(vin, "Try link change mask: 0x%x new: 0x%x\n", mask, mask_new);
176+
177+ if (!mask_new) {
178+ ret = -EMLINK;
179+ goto out;
180+ }
181+
182+ /* New valid CHSEL found, set the new value. */
183+ ret = rvin_set_channel_routing(group->vin[master_id], __ffs(mask_new));
184+out:
185+ mutex_unlock(&group->lock);
186+
187+ return ret;
188+}
189+
190+static const struct media_device_ops rvin_media_ops = {
191+ .link_notify = rvin_group_link_notify,
192+};
193+
194+/* -----------------------------------------------------------------------------
195+ * Gen3 CSI2 Group Allocator
196+ */
197+
198+/* FIXME: This should if we find a system that supports more
199+ * than one group for the whole system be replaced with a linked
200+ * list of groups. And eventually all of this should be replaced
201+ * with a global device allocator API.
202+ *
203+ * But for now this works as on all supported systems there will
204+ * be only one group for all instances.
205+ */
206+
207+static DEFINE_MUTEX(rvin_group_lock);
208+static struct rvin_group *rvin_group_data;
209+
210+static void rvin_group_cleanup(struct rvin_group *group)
211+{
212+ media_device_unregister(&group->mdev);
213+ media_device_cleanup(&group->mdev);
214+ mutex_destroy(&group->lock);
215+}
216+
217+static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin)
218+{
219+ struct media_device *mdev = &group->mdev;
220+ const struct of_device_id *match;
221+ struct device_node *np;
222+ int ret;
223+
224+ mutex_init(&group->lock);
225+
226+ /* Count number of VINs in the system */
227+ group->count = 0;
228+ for_each_matching_node(np, vin->dev->driver->of_match_table)
229+ if (of_device_is_available(np))
230+ group->count++;
231+
232+ vin_dbg(vin, "found %u enabled VIN's in DT", group->count);
233+
234+ mdev->dev = vin->dev;
235+ mdev->ops = &rvin_media_ops;
236+
237+ match = of_match_node(vin->dev->driver->of_match_table,
238+ vin->dev->of_node);
239+
240+ strlcpy(mdev->driver_name, KBUILD_MODNAME, sizeof(mdev->driver_name));
241+ strlcpy(mdev->model, match->compatible, sizeof(mdev->model));
242+ snprintf(mdev->bus_info, sizeof(mdev->bus_info), "platform:%s",
243+ dev_name(mdev->dev));
244+
245+ media_device_init(mdev);
246+
247+ ret = media_device_register(&group->mdev);
248+ if (ret)
249+ rvin_group_cleanup(group);
250+
251+ return ret;
252+}
253+
254+static void rvin_group_release(struct kref *kref)
255+{
256+ struct rvin_group *group =
257+ container_of(kref, struct rvin_group, refcount);
258+
259+ mutex_lock(&rvin_group_lock);
260+
261+ rvin_group_data = NULL;
262+
263+ rvin_group_cleanup(group);
264+
265+ kfree(group);
266+
267+ mutex_unlock(&rvin_group_lock);
268+}
269+
270+static int rvin_group_get(struct rvin_dev *vin)
271+{
272+ struct rvin_group *group;
273+ u32 id;
274+ int ret;
275+
276+ /* Make sure VIN id is present and sane */
277+ ret = of_property_read_u32(vin->dev->of_node, "renesas,id", &id);
278+ if (ret) {
279+ vin_err(vin, "%pOF: No renesas,id property found\n",
280+ vin->dev->of_node);
281+ return -EINVAL;
282+ }
283+
284+ if (id >= RCAR_VIN_NUM) {
285+ vin_err(vin, "%pOF: Invalid renesas,id '%u'\n",
286+ vin->dev->of_node, id);
287+ return -EINVAL;
288+ }
289+
290+ /* Join or create a VIN group */
291+ mutex_lock(&rvin_group_lock);
292+ if (rvin_group_data) {
293+ group = rvin_group_data;
294+ kref_get(&group->refcount);
295+ } else {
296+ group = kzalloc(sizeof(*group), GFP_KERNEL);
297+ if (!group) {
298+ ret = -ENOMEM;
299+ goto err_group;
300+ }
301+
302+ ret = rvin_group_init(group, vin);
303+ if (ret) {
304+ kfree(group);
305+ vin_err(vin, "Failed to initialize group\n");
306+ goto err_group;
307+ }
308+
309+ kref_init(&group->refcount);
310+
311+ rvin_group_data = group;
312+ }
313+ mutex_unlock(&rvin_group_lock);
314+
315+ /* Add VIN to group */
316+ mutex_lock(&group->lock);
317+
318+ if (group->vin[id]) {
319+ vin_err(vin, "Duplicate renesas,id property value %u\n", id);
320+ mutex_unlock(&group->lock);
321+ kref_put(&group->refcount, rvin_group_release);
322+ return -EINVAL;
323+ }
324+
325+ group->vin[id] = vin;
326+
327+ vin->id = id;
328+ vin->group = group;
329+ vin->v4l2_dev.mdev = &group->mdev;
330+
331+ mutex_unlock(&group->lock);
332+
333+ return 0;
334+err_group:
335+ mutex_unlock(&rvin_group_lock);
336+ return ret;
337+}
338+
339+static void rvin_group_put(struct rvin_dev *vin)
340+{
341+ struct rvin_group *group = vin->group;
342+
343+ mutex_lock(&group->lock);
344+
345+ vin->group = NULL;
346+ vin->v4l2_dev.mdev = NULL;
347+
348+ if (WARN_ON(group->vin[vin->id] != vin))
349+ goto out;
350+
351+ group->vin[vin->id] = NULL;
352+out:
353+ mutex_unlock(&group->lock);
354+
355+ kref_put(&group->refcount, rvin_group_release);
356+}
357+
29358 /* -----------------------------------------------------------------------------
30359 * Async notifier
31360 */
@@ -46,30 +375,93 @@ static int rvin_find_pad(struct v4l2_subdev *sd, int direction) · 14 unmodified lines
46375 return -EINVAL;
47376 }
48377
49−static bool rvin_mbus_supported(struct rvin_graph_entity *entity)
378+/* -----------------------------------------------------------------------------
379+ * Digital async notifier
380+ */
381+
382+/* The vin lock should be held when calling the subdevice attach and detach */
383+static int rvin_digital_subdevice_attach(struct rvin_dev *vin,
384+ struct v4l2_subdev *subdev)
50385 {
51− struct v4l2_subdev *sd = entity->subdev;
52386 struct v4l2_subdev_mbus_code_enum code = {
53387 .which = V4L2_SUBDEV_FORMAT_ACTIVE,
54388 };
389+ int ret;
55390
391+ /* Find source and sink pad of remote subdevice */
392+ ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SOURCE);
393+ if (ret < 0)
394+ return ret;
395+ vin->digital->source_pad = ret;
396+
397+ ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SINK);
398+ vin->digital->sink_pad = ret < 0 ? 0 : ret;
399+
400+ /* Find compatible subdevices mbus format */
401+ vin->mbus_code = 0;
56402 code.index = 0;
57− code.pad = entity->source_pad;
58− while (!v4l2_subdev_call(sd, pad, enum_mbus_code, NULL, &code)) {
403+ code.pad = vin->digital->source_pad;
404+ while (!vin->mbus_code &&
405+ !v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, &code)) {
59406 code.index++;
60407 switch (code.code) {
61408 case MEDIA_BUS_FMT_YUYV8_1X16:
409+ case MEDIA_BUS_FMT_UYVY8_1X16:
62410 case MEDIA_BUS_FMT_UYVY8_2X8:
63411 case MEDIA_BUS_FMT_UYVY10_2X10:
64412 case MEDIA_BUS_FMT_RGB888_1X24:
65− entity->code = code.code;
66− return true;
413+ vin->mbus_code = code.code;
414+ vin_dbg(vin, "Found media bus format for %s: %d\n",
415+ subdev->name, vin->mbus_code);
416+ break;
67417 default:
68418 break;
69419 }
70420 }
71421
72− return false;
422+ if (!vin->mbus_code) {
423+ vin_err(vin, "Unsupported media bus format for %s\n",
424+ subdev->name);
425+ return -EINVAL;
426+ }
427+
428+ /* Read tvnorms */
429+ ret = v4l2_subdev_call(subdev, video, g_tvnorms, &vin->vdev.tvnorms);
430+ if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV)
431+ return ret;
432+
433+ /* Read standard */
434+ vin->std = V4L2_STD_UNKNOWN;
435+ ret = v4l2_subdev_call(subdev, video, g_std, &vin->std);
436+ if (ret < 0 && ret != -ENOIOCTLCMD)
437+ return ret;
438+
439+ /* Add the controls */
440+ ret = v4l2_ctrl_handler_init(&vin->ctrl_handler, 16);
441+ if (ret < 0)
442+ return ret;
443+
444+ ret = v4l2_ctrl_add_handler(&vin->ctrl_handler, subdev->ctrl_handler,
445+ NULL);
446+ if (ret < 0) {
447+ v4l2_ctrl_handler_free(&vin->ctrl_handler);
448+ return ret;
449+ }
450+
451+ vin->vdev.ctrl_handler = &vin->ctrl_handler;
452+
453+ vin->digital->subdev = subdev;
454+
455+ return 0;
456+}
457+
458+static void rvin_digital_subdevice_detach(struct rvin_dev *vin)
459+{
460+ rvin_v4l2_unregister(vin);
461+ v4l2_ctrl_handler_free(&vin->ctrl_handler);
462+
463+ vin->vdev.ctrl_handler = NULL;
464+ vin->digital->subdev = NULL;
73465 }
74466
75467 static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier)
@@ -77,23 +469,13 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) · 1 unmodified line
77469 struct rvin_dev *vin = notifier_to_vin(notifier);
78470 int ret;
79471
80− /* Verify subdevices mbus format */
81− if (!rvin_mbus_supported(vin->digital)) {
82− vin_err(vin, "Unsupported media bus format for %s\n",
83− vin->digital->subdev->name);
84− return -EINVAL;
85− }
86−
87− vin_dbg(vin, "Found media bus format for %s: %d\n",
88− vin->digital->subdev->name, vin->digital->code);
89−
90472 ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev);
91473 if (ret < 0) {
92474 vin_err(vin, "Failed to register subdev nodes\n");
93475 return ret;
94476 }
95477
96− return rvin_v4l2_probe(vin);
478+ return rvin_v4l2_register(vin);
97479 }
98480
99481 static void rvin_digital_notify_unbind(struct v4l2_async_notifier *notifier,
@@ -103,8 +485,10 @@ static void rvin_digital_notify_unbind(struct v4l2_async_notifier *notifier, · 3 unmodified lines
103485 struct rvin_dev *vin = notifier_to_vin(notifier);
104486
105487 vin_dbg(vin, "unbind digital subdev %s\n", subdev->name);
106− rvin_v4l2_remove(vin);
107− vin->digital->subdev = NULL;
488+
489+ mutex_lock(&vin->lock);
490+ rvin_digital_subdevice_detach(vin);
491+ mutex_unlock(&vin->lock);
108492 }
109493
110494 static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier,
@@ -114,19 +498,13 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, · 3 unmodified lines
114498 struct rvin_dev *vin = notifier_to_vin(notifier);
115499 int ret;
116500
117− v4l2_set_subdev_hostdata(subdev, vin);
118−
119− /* Find source and sink pad of remote subdevice */
120−
121− ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SOURCE);
122− if (ret < 0)
501+ mutex_lock(&vin->lock);
502+ ret = rvin_digital_subdevice_attach(vin, subdev);
503+ mutex_unlock(&vin->lock);
504+ if (ret)
123505 return ret;
124− vin->digital->source_pad = ret;
125506
126− ret = rvin_find_pad(subdev, MEDIA_PAD_FL_SINK);
127− vin->digital->sink_pad = ret < 0 ? 0 : ret;
128−
129− vin->digital->subdev = subdev;
507+ v4l2_set_subdev_hostdata(subdev, vin);
130508
131509 vin_dbg(vin, "bound subdev %s source pad: %u sink pad: %u\n",
132510 subdev->name, vin->digital->source_pad,
@@ -134,13 +512,13 @@ static int rvin_digital_notify_bound(struct v4l2_async_notifier *notifier, · 1 unmodified line
134512
135513 return 0;
136514 }
515+
137516 static const struct v4l2_async_notifier_operations rvin_digital_notify_ops = {
138517 .bound = rvin_digital_notify_bound,
139518 .unbind = rvin_digital_notify_unbind,
140519 .complete = rvin_digital_notify_complete,
141520 };
142521
143−
144522 static int rvin_digital_parse_v4l2(struct device *dev,
145523 struct v4l2_fwnode_endpoint *vep,
146524 struct v4l2_async_subdev *asd)
@@ -152,16 +530,16 @@ static int rvin_digital_parse_v4l2(struct device *dev, · 5 unmodified lines
152530 if (vep->base.port || vep->base.id)
153531 return -ENOTCONN;
154532
155− rvge->mbus_cfg.type = vep->bus_type;
533+ vin->mbus_cfg.type = vep->bus_type;
156534
157− switch (rvge->mbus_cfg.type) {
535+ switch (vin->mbus_cfg.type) {
158536 case V4L2_MBUS_PARALLEL:
159537 vin_dbg(vin, "Found PARALLEL media bus\n");
160− rvge->mbus_cfg.flags = vep->bus.parallel.flags;
538+ vin->mbus_cfg.flags = vep->bus.parallel.flags;
161539 break;
162540 case V4L2_MBUS_BT656:
163541 vin_dbg(vin, "Found BT656 media bus\n");
164− rvge->mbus_cfg.flags = 0;
542+ vin->mbus_cfg.flags = 0;
165543 break;
166544 default:
167545 vin_err(vin, "Unknown media bus type\n");
@@ -199,25 +577,478 @@ static int rvin_digital_graph_init(struct rvin_dev *vin) · 31 unmodified lines
199577 return 0;
200578 }
201579
580+/* -----------------------------------------------------------------------------
581+ * Group async notifier
582+ */
583+
584+static int rvin_group_notify_complete(struct v4l2_async_notifier *notifier)
585+{
586+ struct rvin_dev *vin = notifier_to_vin(notifier);
587+ const struct rvin_group_route *route;
588+ unsigned int i;
589+ int ret;
590+
591+ ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev);
592+ if (ret) {
593+ vin_err(vin, "Failed to register subdev nodes\n");
594+ return ret;
595+ }
596+
597+ /* Register all video nodes for the group. */
598+ for (i = 0; i < RCAR_VIN_NUM; i++) {
599+ if (vin->group->vin[i]) {
600+ ret = rvin_v4l2_register(vin->group->vin[i]);
601+ if (ret)
602+ return ret;
603+ }
604+ }
605+
606+ /* Create all media device links between VINs and CSI-2's. */
607+ mutex_lock(&vin->group->lock);
608+ for (route = vin->info->routes; route->mask; route++) {
609+ struct media_pad *source_pad, *sink_pad;
610+ struct media_entity *source, *sink;
611+ unsigned int source_idx;
612+
613+ /* Check that VIN is part of the group. */
614+ if (!vin->group->vin[route->vin])
615+ continue;
616+
617+ /* Check that VIN' master is part of the group. */
618+ if (!vin->group->vin[rvin_group_id_to_master(route->vin)])
619+ continue;
620+
621+ /* Check that CSI-2 is part of the group. */
622+ if (!vin->group->csi[route->csi].subdev)
623+ continue;
624+
625+ source = &vin->group->csi[route->csi].subdev->entity;
626+ source_idx = rvin_group_csi_channel_to_pad(route->channel);
627+ source_pad = &source->pads[source_idx];
628+
629+ sink = &vin->group->vin[route->vin]->vdev.entity;
630+ sink_pad = &sink->pads[0];
631+
632+ /* Skip if link already exists. */
633+ if (media_entity_find_link(source_pad, sink_pad))
634+ continue;
635+
636+ ret = media_create_pad_link(source, source_idx, sink, 0, 0);
637+ if (ret) {
638+ vin_err(vin, "Error adding link from %s to %s\n",
639+ source->name, sink->name);
640+ break;
641+ }
642+ }
643+ mutex_unlock(&vin->group->lock);
644+
645+ return ret;
646+}
647+
648+static void rvin_group_notify_unbind(struct v4l2_async_notifier *notifier,
649+ struct v4l2_subdev *subdev,
650+ struct v4l2_async_subdev *asd)
651+{
652+ struct rvin_dev *vin = notifier_to_vin(notifier);
653+ unsigned int i;
654+
655+ for (i = 0; i < RCAR_VIN_NUM; i++)
656+ if (vin->group->vin[i])
657+ rvin_v4l2_unregister(vin->group->vin[i]);
658+
659+ mutex_lock(&vin->group->lock);
660+
661+ for (i = 0; i < RVIN_CSI_MAX; i++) {
662+ if (vin->group->csi[i].fwnode != asd->match.fwnode)
663+ continue;
664+ vin->group->csi[i].subdev = NULL;
665+ vin_dbg(vin, "Unbind CSI-2 %s from slot %u\n", subdev->name, i);
666+ break;
667+ }
668+
669+ mutex_unlock(&vin->group->lock);
670+}
671+
672+static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
673+ struct v4l2_subdev *subdev,
674+ struct v4l2_async_subdev *asd)
675+{
676+ struct rvin_dev *vin = notifier_to_vin(notifier);
677+ unsigned int i;
678+
679+ mutex_lock(&vin->group->lock);
680+
681+ for (i = 0; i < RVIN_CSI_MAX; i++) {
682+ if (vin->group->csi[i].fwnode != asd->match.fwnode)
683+ continue;
684+ vin->group->csi[i].subdev = subdev;
685+ vin_dbg(vin, "Bound CSI-2 %s to slot %u\n", subdev->name, i);
686+ break;
687+ }
688+
689+ mutex_unlock(&vin->group->lock);
690+
691+ return 0;
692+}
693+
694+static const struct v4l2_async_notifier_operations rvin_group_notify_ops = {
695+ .bound = rvin_group_notify_bound,
696+ .unbind = rvin_group_notify_unbind,
697+ .complete = rvin_group_notify_complete,
698+};
699+
700+static int rvin_mc_parse_of_endpoint(struct device *dev,
701+ struct v4l2_fwnode_endpoint *vep,
702+ struct v4l2_async_subdev *asd)
703+{
704+ struct rvin_dev *vin = dev_get_drvdata(dev);
705+
706+ if (vep->base.port != 1 || vep->base.id >= RVIN_CSI_MAX)
707+ return -EINVAL;
708+
709+ if (!of_device_is_available(to_of_node(asd->match.fwnode))) {
710+
711+ vin_dbg(vin, "OF device %pOF disabled, ignoring\n",
712+ to_of_node(asd->match.fwnode));
713+ return -ENOTCONN;
714+
715+ }
716+
717+ if (vin->group->csi[vep->base.id].fwnode) {
718+ vin_dbg(vin, "OF device %pOF already handled\n",
719+ to_of_node(asd->match.fwnode));
720+ return -ENOTCONN;
721+ }
722+
723+ vin->group->csi[vep->base.id].fwnode = asd->match.fwnode;
724+
725+ vin_dbg(vin, "Add group OF device %pOF to slot %u\n",
726+ to_of_node(asd->match.fwnode), vep->base.id);
727+
728+ return 0;
729+}
730+
731+static int rvin_mc_parse_of_graph(struct rvin_dev *vin)
732+{
733+ unsigned int count = 0;
734+ unsigned int i;
735+ int ret;
736+
737+ mutex_lock(&vin->group->lock);
738+
739+ /* If there already is a notifier something has gone wrong, bail out. */
740+ if (WARN_ON(vin->group->notifier)) {
741+ mutex_unlock(&vin->group->lock);
742+ return -EINVAL;
743+ }
744+
745+ /* If not all VIN's are registered don't register the notifier. */
746+ for (i = 0; i < RCAR_VIN_NUM; i++)
747+ if (vin->group->vin[i])
748+ count++;
749+
750+ if (vin->group->count != count) {
751+ mutex_unlock(&vin->group->lock);
752+ return 0;
753+ }
754+
755+ /*
756+ * Have all VIN's look for subdevices. Some subdevices will overlap
757+ * but the parser function can handle it, so each subdevice will
758+ * only be registered once with the notifier.
759+ */
760+
761+ vin->group->notifier = &vin->notifier;
762+
763+ for (i = 0; i < RCAR_VIN_NUM; i++) {
764+ if (!vin->group->vin[i])
765+ continue;
766+
767+ ret = v4l2_async_notifier_parse_fwnode_endpoints_by_port(
768+ vin->group->vin[i]->dev, vin->group->notifier,
769+ sizeof(struct v4l2_async_subdev), 1,
770+ rvin_mc_parse_of_endpoint);
771+ if (ret) {
772+ mutex_unlock(&vin->group->lock);
773+ return ret;
774+ }
775+ }
776+
777+ mutex_unlock(&vin->group->lock);
778+
779+ vin->group->notifier->ops = &rvin_group_notify_ops;
780+
781+ ret = v4l2_async_notifier_register(&vin->v4l2_dev, &vin->notifier);
782+ if (ret < 0) {
783+ vin_err(vin, "Notifier registration failed\n");
784+ return ret;
785+ }
786+
787+ return 0;
788+}
789+
790+static int rvin_mc_init(struct rvin_dev *vin)
791+{
792+ int ret;
793+
794+ /* All our sources are CSI-2 */
795+ vin->mbus_cfg.type = V4L2_MBUS_CSI2;
796+ vin->mbus_cfg.flags = 0;
797+
798+ vin->pad.flags = MEDIA_PAD_FL_SINK;
799+ ret = media_entity_pads_init(&vin->vdev.entity, 1, &vin->pad);
800+ if (ret)
801+ return ret;
802+
803+ ret = rvin_group_get(vin);
804+ if (ret)
805+ return ret;
806+
807+ ret = rvin_mc_parse_of_graph(vin);
808+ if (ret)
809+ rvin_group_put(vin);
810+
811+ return ret;
812+}
813+
202814 /* -----------------------------------------------------------------------------
203815 * Platform Device Driver
204816 */
205817
818+static const struct rvin_info rcar_info_h1 = {
819+ .model = RCAR_H1,
820+ .use_mc = false,
821+ .max_width = 2048,
822+ .max_height = 2048,
823+};
824+
825+static const struct rvin_info rcar_info_m1 = {
826+ .model = RCAR_M1,
827+ .use_mc = false,
828+ .max_width = 2048,
829+ .max_height = 2048,
830+};
831+
832+static const struct rvin_info rcar_info_gen2 = {
833+ .model = RCAR_GEN2,
834+ .use_mc = false,
835+ .max_width = 2048,
836+ .max_height = 2048,
837+};
838+
839+static const struct rvin_group_route rcar_info_r8a7795_routes[] = {
840+ { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
841+ { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
842+ { .csi = RVIN_CSI40, .channel = 1, .vin = 0, .mask = BIT(2) },
843+ { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
844+ { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(1) | BIT(3) },
845+ { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
846+ { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
847+ { .csi = RVIN_CSI20, .channel = 1, .vin = 2, .mask = BIT(0) },
848+ { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
849+ { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
850+ { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
851+ { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
852+ { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
853+ { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) | BIT(2) },
854+ { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
855+ { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
856+ { .csi = RVIN_CSI41, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
857+ { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
858+ { .csi = RVIN_CSI41, .channel = 1, .vin = 4, .mask = BIT(2) },
859+ { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
860+ { .csi = RVIN_CSI41, .channel = 1, .vin = 5, .mask = BIT(1) | BIT(3) },
861+ { .csi = RVIN_CSI41, .channel = 0, .vin = 5, .mask = BIT(2) },
862+ { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
863+ { .csi = RVIN_CSI20, .channel = 1, .vin = 6, .mask = BIT(0) },
864+ { .csi = RVIN_CSI41, .channel = 0, .vin = 6, .mask = BIT(1) },
865+ { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
866+ { .csi = RVIN_CSI41, .channel = 2, .vin = 6, .mask = BIT(3) },
867+ { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
868+ { .csi = RVIN_CSI41, .channel = 1, .vin = 7, .mask = BIT(0) },
869+ { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) | BIT(2) },
870+ { .csi = RVIN_CSI41, .channel = 3, .vin = 7, .mask = BIT(3) },
871+ { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
872+ { /* Sentinel */ }
873+};
874+
875+static const struct rvin_info rcar_info_r8a7795 = {
876+ .model = RCAR_GEN3,
877+ .use_mc = true,
878+ .max_width = 4096,
879+ .max_height = 4096,
880+ .routes = rcar_info_r8a7795_routes,
881+};
882+
883+static const struct rvin_group_route rcar_info_r8a7795es1_routes[] = {
884+ { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
885+ { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
886+ { .csi = RVIN_CSI21, .channel = 0, .vin = 0, .mask = BIT(2) | BIT(5) },
887+ { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
888+ { .csi = RVIN_CSI21, .channel = 0, .vin = 1, .mask = BIT(1) },
889+ { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
890+ { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
891+ { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
892+ { .csi = RVIN_CSI21, .channel = 1, .vin = 1, .mask = BIT(5) },
893+ { .csi = RVIN_CSI21, .channel = 0, .vin = 2, .mask = BIT(0) },
894+ { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
895+ { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
896+ { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
897+ { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
898+ { .csi = RVIN_CSI21, .channel = 2, .vin = 2, .mask = BIT(5) },
899+ { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
900+ { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) },
901+ { .csi = RVIN_CSI21, .channel = 1, .vin = 3, .mask = BIT(2) },
902+ { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
903+ { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
904+ { .csi = RVIN_CSI21, .channel = 3, .vin = 3, .mask = BIT(5) },
905+ { .csi = RVIN_CSI41, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
906+ { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
907+ { .csi = RVIN_CSI21, .channel = 0, .vin = 4, .mask = BIT(2) | BIT(5) },
908+ { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
909+ { .csi = RVIN_CSI21, .channel = 0, .vin = 5, .mask = BIT(1) },
910+ { .csi = RVIN_CSI41, .channel = 0, .vin = 5, .mask = BIT(2) },
911+ { .csi = RVIN_CSI41, .channel = 1, .vin = 5, .mask = BIT(3) },
912+ { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
913+ { .csi = RVIN_CSI21, .channel = 1, .vin = 5, .mask = BIT(5) },
914+ { .csi = RVIN_CSI21, .channel = 0, .vin = 6, .mask = BIT(0) },
915+ { .csi = RVIN_CSI41, .channel = 0, .vin = 6, .mask = BIT(1) },
916+ { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
917+ { .csi = RVIN_CSI41, .channel = 2, .vin = 6, .mask = BIT(3) },
918+ { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
919+ { .csi = RVIN_CSI21, .channel = 2, .vin = 6, .mask = BIT(5) },
920+ { .csi = RVIN_CSI41, .channel = 1, .vin = 7, .mask = BIT(0) },
921+ { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) },
922+ { .csi = RVIN_CSI21, .channel = 1, .vin = 7, .mask = BIT(2) },
923+ { .csi = RVIN_CSI41, .channel = 3, .vin = 7, .mask = BIT(3) },
924+ { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
925+ { .csi = RVIN_CSI21, .channel = 3, .vin = 7, .mask = BIT(5) },
926+ { /* Sentinel */ }
927+};
928+
929+static const struct rvin_info rcar_info_r8a7795es1 = {
930+ .model = RCAR_GEN3,
931+ .use_mc = true,
932+ .max_width = 4096,
933+ .max_height = 4096,
934+ .routes = rcar_info_r8a7795es1_routes,
935+};
936+
937+static const struct rvin_group_route rcar_info_r8a7796_routes[] = {
938+ { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
939+ { .csi = RVIN_CSI20, .channel = 0, .vin = 0, .mask = BIT(1) | BIT(4) },
940+ { .csi = RVIN_CSI20, .channel = 0, .vin = 1, .mask = BIT(0) },
941+ { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
942+ { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
943+ { .csi = RVIN_CSI20, .channel = 1, .vin = 1, .mask = BIT(4) },
944+ { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
945+ { .csi = RVIN_CSI20, .channel = 0, .vin = 2, .mask = BIT(2) },
946+ { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
947+ { .csi = RVIN_CSI20, .channel = 2, .vin = 2, .mask = BIT(4) },
948+ { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
949+ { .csi = RVIN_CSI20, .channel = 1, .vin = 3, .mask = BIT(1) },
950+ { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
951+ { .csi = RVIN_CSI20, .channel = 3, .vin = 3, .mask = BIT(4) },
952+ { .csi = RVIN_CSI40, .channel = 0, .vin = 4, .mask = BIT(0) | BIT(3) },
953+ { .csi = RVIN_CSI20, .channel = 0, .vin = 4, .mask = BIT(1) | BIT(4) },
954+ { .csi = RVIN_CSI20, .channel = 0, .vin = 5, .mask = BIT(0) },
955+ { .csi = RVIN_CSI40, .channel = 0, .vin = 5, .mask = BIT(2) },
956+ { .csi = RVIN_CSI40, .channel = 1, .vin = 5, .mask = BIT(3) },
957+ { .csi = RVIN_CSI20, .channel = 1, .vin = 5, .mask = BIT(4) },
958+ { .csi = RVIN_CSI40, .channel = 0, .vin = 6, .mask = BIT(1) },
959+ { .csi = RVIN_CSI20, .channel = 0, .vin = 6, .mask = BIT(2) },
960+ { .csi = RVIN_CSI40, .channel = 2, .vin = 6, .mask = BIT(3) },
961+ { .csi = RVIN_CSI20, .channel = 2, .vin = 6, .mask = BIT(4) },
962+ { .csi = RVIN_CSI40, .channel = 1, .vin = 7, .mask = BIT(0) },
963+ { .csi = RVIN_CSI20, .channel = 1, .vin = 7, .mask = BIT(1) },
964+ { .csi = RVIN_CSI40, .channel = 3, .vin = 7, .mask = BIT(3) },
965+ { .csi = RVIN_CSI20, .channel = 3, .vin = 7, .mask = BIT(4) },
966+ { /* Sentinel */ }
967+};
968+
969+static const struct rvin_info rcar_info_r8a7796 = {
970+ .model = RCAR_GEN3,
971+ .use_mc = true,
972+ .max_width = 4096,
973+ .max_height = 4096,
974+ .routes = rcar_info_r8a7796_routes,
975+};
976+
977+static const struct rvin_group_route _rcar_info_r8a77970_routes[] = {
978+ { .csi = RVIN_CSI40, .channel = 0, .vin = 0, .mask = BIT(0) | BIT(3) },
979+ { .csi = RVIN_CSI40, .channel = 0, .vin = 1, .mask = BIT(2) },
980+ { .csi = RVIN_CSI40, .channel = 1, .vin = 1, .mask = BIT(3) },
981+ { .csi = RVIN_CSI40, .channel = 0, .vin = 2, .mask = BIT(1) },
982+ { .csi = RVIN_CSI40, .channel = 2, .vin = 2, .mask = BIT(3) },
983+ { .csi = RVIN_CSI40, .channel = 1, .vin = 3, .mask = BIT(0) },
984+ { .csi = RVIN_CSI40, .channel = 3, .vin = 3, .mask = BIT(3) },
985+ { /* Sentinel */ }
986+};
987+
988+static const struct rvin_info rcar_info_r8a77970 = {
989+ .model = RCAR_GEN3,
990+ .use_mc = true,
991+ .max_width = 4096,
992+ .max_height = 4096,
993+ .routes = _rcar_info_r8a77970_routes,
994+};
995+
206996 static const struct of_device_id rvin_of_id_table[] = {
207− { .compatible = "renesas,vin-r8a7794", .data = (void *)RCAR_GEN2 },
208− { .compatible = "renesas,vin-r8a7793", .data = (void *)RCAR_GEN2 },
209− { .compatible = "renesas,vin-r8a7791", .data = (void *)RCAR_GEN2 },
210− { .compatible = "renesas,vin-r8a7790", .data = (void *)RCAR_GEN2 },
211− { .compatible = "renesas,vin-r8a7779", .data = (void *)RCAR_H1 },
212− { .compatible = "renesas,vin-r8a7778", .data = (void *)RCAR_M1 },
213− { .compatible = "renesas,rcar-gen2-vin", .data = (void *)RCAR_GEN2 },
214− { },
997+ {
998+ .compatible = "renesas,vin-r8a7778",
999+ .data = &rcar_info_m1,
1000+ },
1001+ {
1002+ .compatible = "renesas,vin-r8a7779",
1003+ .data = &rcar_info_h1,
1004+ },
1005+ {
1006+ .compatible = "renesas,vin-r8a7790",
1007+ .data = &rcar_info_gen2,
1008+ },
1009+ {
1010+ .compatible = "renesas,vin-r8a7791",
1011+ .data = &rcar_info_gen2,
1012+ },
1013+ {
1014+ .compatible = "renesas,vin-r8a7793",
1015+ .data = &rcar_info_gen2,
1016+ },
1017+ {
1018+ .compatible = "renesas,vin-r8a7794",
1019+ .data = &rcar_info_gen2,
1020+ },
1021+ {
1022+ .compatible = "renesas,rcar-gen2-vin",
1023+ .data = &rcar_info_gen2,
1024+ },
1025+ {
1026+ .compatible = "renesas,vin-r8a7795",
1027+ .data = &rcar_info_r8a7795,
1028+ },
1029+ {
1030+ .compatible = "renesas,vin-r8a7796",
1031+ .data = &rcar_info_r8a7796,
1032+ },
1033+ {
1034+ .compatible = "renesas,vin-r8a77970",
1035+ .data = &rcar_info_r8a77970,
1036+ },
1037+ { /* Sentinel */ },
2151038 };
2161039 MODULE_DEVICE_TABLE(of, rvin_of_id_table);
2171040
1041+static const struct soc_device_attribute r8a7795es1[] = {
1042+ {
1043+ .soc_id = "r8a7795", .revision = "ES1.*",
1044+ .data = &rcar_info_r8a7795es1,
1045+ },
1046+ { /* Sentinel */ }
1047+};
1048+
2181049 static int rcar_vin_probe(struct platform_device *pdev)
2191050 {
220− const struct of_device_id *match;
1051+ const struct soc_device_attribute *attr;
2211052 struct rvin_dev *vin;
2221053 struct resource *mem;
2231054 int irq, ret;
@@ -226,12 +1057,16 @@ static int rcar_vin_probe(struct platform_device *pdev) · 2 unmodified lines
2261057 if (!vin)
2271058 return -ENOMEM;
2281059
229− match = of_match_device(of_match_ptr(rvin_of_id_table), &pdev->dev);
230− if (!match)
231− return -ENODEV;
232−
2331060 vin->dev = &pdev->dev;
234− vin->chip = (enum chip_id)match->data;
1061+ vin->info = of_device_get_match_data(&pdev->dev);
1062+
1063+ /*
1064+ * Special care is needed on r8a7795 ES1.x since it
1065+ * uses different routing than r8a7795 ES2.0.
1066+ */
1067+ attr = soc_device_match(r8a7795es1);
1068+ if (attr)
1069+ vin->info = attr->data;
2351070
2361071 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2371072 if (mem == NULL)
@@ -245,13 +1080,15 @@ static int rcar_vin_probe(struct platform_device *pdev) · 7 unmodified lines
2451080 if (irq < 0)
2461081 return irq;
2471082
248− ret = rvin_dma_probe(vin, irq);
1083+ ret = rvin_dma_register(vin, irq);
2491084 if (ret)
2501085 return ret;
2511086
2521087 platform_set_drvdata(pdev, vin);
253−
254− ret = rvin_digital_graph_init(vin);
1088+ if (vin->info->use_mc)
1089+ ret = rvin_mc_init(vin);
1090+ else
1091+ ret = rvin_digital_graph_init(vin);
2551092 if (ret < 0)
2561093 goto error;
2571094
@@ -260,7 +1097,7 @@ static int rcar_vin_probe(struct platform_device *pdev) · 2 unmodified lines
2601097
2611098 return 0;
2621099 error:
263− rvin_dma_remove(vin);
1100+ rvin_dma_unregister(vin);
2641101 v4l2_async_notifier_cleanup(&vin->notifier);
2651102
2661103 return ret;
@@ -272,10 +1109,22 @@ static int rcar_vin_remove(struct platform_device *pdev) · 5 unmodified lines
2721109
2731110 pm_runtime_disable(&pdev->dev);
2741111
1112+ rvin_v4l2_unregister(vin);
1113+
2751114 v4l2_async_notifier_unregister(&vin->notifier);
2761115 v4l2_async_notifier_cleanup(&vin->notifier);
2771116
278− rvin_dma_remove(vin);
1117+ if (vin->info->use_mc) {
1118+ mutex_lock(&vin->group->lock);
1119+ if (vin->group->notifier == &vin->notifier)
1120+ vin->group->notifier = NULL;
1121+ mutex_unlock(&vin->group->lock);
1122+ rvin_group_put(vin);
1123+ } else {
1124+ v4l2_ctrl_handler_free(&vin->ctrl_handler);
1125+ }
1126+
1127+ rvin_dma_unregister(vin);
2791128
2801129 return 0;
2811130 }
drivers/media/platform/rcar-vin/rcar-csi2.c+1084−0
@@ -0,0 +1,1084 @@
1+// SPDX-License-Identifier: GPL-2.0
2+/*
3+ * Driver for Renesas R-Car MIPI CSI-2 Receiver
4+ *
5+ * Copyright (C) 2018 Renesas Electronics Corp.
6+ */
7+
8+#include <linux/delay.h>
9+#include <linux/interrupt.h>
10+#include <linux/io.h>
11+#include <linux/module.h>
12+#include <linux/of.h>
13+#include <linux/of_device.h>
14+#include <linux/of_graph.h>
15+#include <linux/platform_device.h>
16+#include <linux/pm_runtime.h>
17+#include <linux/sys_soc.h>
18+
19+#include <media/v4l2-ctrls.h>
20+#include <media/v4l2-device.h>
21+#include <media/v4l2-fwnode.h>
22+#include <media/v4l2-mc.h>
23+#include <media/v4l2-subdev.h>
24+
25+struct rcar_csi2;
26+
27+/* Register offsets and bits */
28+
29+/* Control Timing Select */
30+#define TREF_REG 0x00
31+#define TREF_TREF BIT(0)
32+
33+/* Software Reset */
34+#define SRST_REG 0x04
35+#define SRST_SRST BIT(0)
36+
37+/* PHY Operation Control */
38+#define PHYCNT_REG 0x08
39+#define PHYCNT_SHUTDOWNZ BIT(17)
40+#define PHYCNT_RSTZ BIT(16)
41+#define PHYCNT_ENABLECLK BIT(4)
42+#define PHYCNT_ENABLE_3 BIT(3)
43+#define PHYCNT_ENABLE_2 BIT(2)
44+#define PHYCNT_ENABLE_1 BIT(1)
45+#define PHYCNT_ENABLE_0 BIT(0)
46+
47+/* Checksum Control */
48+#define CHKSUM_REG 0x0c
49+#define CHKSUM_ECC_EN BIT(1)
50+#define CHKSUM_CRC_EN BIT(0)
51+
52+/*
53+ * Channel Data Type Select
54+ * VCDT[0-15]: Channel 1 VCDT[16-31]: Channel 2
55+ * VCDT2[0-15]: Channel 3 VCDT2[16-31]: Channel 4
56+ */
57+#define VCDT_REG 0x10
58+#define VCDT2_REG 0x14
59+#define VCDT_VCDTN_EN BIT(15)
60+#define VCDT_SEL_VC(n) (((n) & 0x3) << 8)
61+#define VCDT_SEL_DTN_ON BIT(6)
62+#define VCDT_SEL_DT(n) (((n) & 0x3f) << 0)
63+
64+/* Frame Data Type Select */
65+#define FRDT_REG 0x18
66+
67+/* Field Detection Control */
68+#define FLD_REG 0x1c
69+#define FLD_FLD_NUM(n) (((n) & 0xff) << 16)
70+#define FLD_FLD_EN4 BIT(3)
71+#define FLD_FLD_EN3 BIT(2)
72+#define FLD_FLD_EN2 BIT(1)
73+#define FLD_FLD_EN BIT(0)
74+
75+/* Automatic Standby Control */
76+#define ASTBY_REG 0x20
77+
78+/* Long Data Type Setting 0 */
79+#define LNGDT0_REG 0x28
80+
81+/* Long Data Type Setting 1 */
82+#define LNGDT1_REG 0x2c
83+
84+/* Interrupt Enable */
85+#define INTEN_REG 0x30
86+
87+/* Interrupt Source Mask */
88+#define INTCLOSE_REG 0x34
89+
90+/* Interrupt Status Monitor */
91+#define INTSTATE_REG 0x38
92+#define INTSTATE_INT_ULPS_START BIT(7)
93+#define INTSTATE_INT_ULPS_END BIT(6)
94+
95+/* Interrupt Error Status Monitor */
96+#define INTERRSTATE_REG 0x3c
97+
98+/* Short Packet Data */
99+#define SHPDAT_REG 0x40
100+
101+/* Short Packet Count */
102+#define SHPCNT_REG 0x44
103+
104+/* LINK Operation Control */
105+#define LINKCNT_REG 0x48
106+#define LINKCNT_MONITOR_EN BIT(31)
107+#define LINKCNT_REG_MONI_PACT_EN BIT(25)
108+#define LINKCNT_ICLK_NONSTOP BIT(24)
109+
110+/* Lane Swap */
111+#define LSWAP_REG 0x4c
112+#define LSWAP_L3SEL(n) (((n) & 0x3) << 6)
113+#define LSWAP_L2SEL(n) (((n) & 0x3) << 4)
114+#define LSWAP_L1SEL(n) (((n) & 0x3) << 2)
115+#define LSWAP_L0SEL(n) (((n) & 0x3) << 0)
116+
117+/* PHY Test Interface Write Register */
118+#define PHTW_REG 0x50
119+#define PHTW_DWEN BIT(24)
120+#define PHTW_TESTDIN_DATA(n) (((n & 0xff)) << 16)
121+#define PHTW_CWEN BIT(8)
122+#define PHTW_TESTDIN_CODE(n) ((n & 0xff))
123+
124+struct phtw_value {
125+ u16 data;
126+ u16 code;
127+};
128+
129+struct rcsi2_mbps_reg {
130+ u16 mbps;
131+ u16 reg;
132+};
133+
134+static const struct rcsi2_mbps_reg phtw_mbps_h3_v3h_m3n[] = {
135+ { .mbps = 80, .reg = 0x86 },
136+ { .mbps = 90, .reg = 0x86 },
137+ { .mbps = 100, .reg = 0x87 },
138+ { .mbps = 110, .reg = 0x87 },
139+ { .mbps = 120, .reg = 0x88 },
140+ { .mbps = 130, .reg = 0x88 },
141+ { .mbps = 140, .reg = 0x89 },
142+ { .mbps = 150, .reg = 0x89 },
143+ { .mbps = 160, .reg = 0x8a },
144+ { .mbps = 170, .reg = 0x8a },
145+ { .mbps = 180, .reg = 0x8b },
146+ { .mbps = 190, .reg = 0x8b },
147+ { .mbps = 205, .reg = 0x8c },
148+ { .mbps = 220, .reg = 0x8d },
149+ { .mbps = 235, .reg = 0x8e },
150+ { .mbps = 250, .reg = 0x8e },
151+ { /* sentinel */ },
152+};
153+
154+static const struct rcsi2_mbps_reg phtw_mbps_v3m_e3[] = {
155+ { .mbps = 80, .reg = 0x00 },
156+ { .mbps = 90, .reg = 0x20 },
157+ { .mbps = 100, .reg = 0x40 },
158+ { .mbps = 110, .reg = 0x02 },
159+ { .mbps = 130, .reg = 0x22 },
160+ { .mbps = 140, .reg = 0x42 },
161+ { .mbps = 150, .reg = 0x04 },
162+ { .mbps = 170, .reg = 0x24 },
163+ { .mbps = 180, .reg = 0x44 },
164+ { .mbps = 200, .reg = 0x06 },
165+ { .mbps = 220, .reg = 0x26 },
166+ { .mbps = 240, .reg = 0x46 },
167+ { .mbps = 250, .reg = 0x08 },
168+ { .mbps = 270, .reg = 0x28 },
169+ { .mbps = 300, .reg = 0x0a },
170+ { .mbps = 330, .reg = 0x2a },
171+ { .mbps = 360, .reg = 0x4a },
172+ { .mbps = 400, .reg = 0x0c },
173+ { .mbps = 450, .reg = 0x2c },
174+ { .mbps = 500, .reg = 0x0e },
175+ { .mbps = 550, .reg = 0x2e },
176+ { .mbps = 600, .reg = 0x10 },
177+ { .mbps = 650, .reg = 0x30 },
178+ { .mbps = 700, .reg = 0x12 },
179+ { .mbps = 750, .reg = 0x32 },
180+ { .mbps = 800, .reg = 0x52 },
181+ { .mbps = 850, .reg = 0x72 },
182+ { .mbps = 900, .reg = 0x14 },
183+ { .mbps = 950, .reg = 0x34 },
184+ { .mbps = 1000, .reg = 0x54 },
185+ { .mbps = 1050, .reg = 0x74 },
186+ { .mbps = 1125, .reg = 0x16 },
187+ { /* sentinel */ },
188+};
189+
190+/* PHY Test Interface Clear */
191+#define PHTC_REG 0x58
192+#define PHTC_TESTCLR BIT(0)
193+
194+/* PHY Frequency Control */
195+#define PHYPLL_REG 0x68
196+#define PHYPLL_HSFREQRANGE(n) ((n) << 16)
197+
198+static const struct rcsi2_mbps_reg hsfreqrange_h3_v3h_m3n[] = {
199+ { .mbps = 80, .reg = 0x00 },
200+ { .mbps = 90, .reg = 0x10 },
201+ { .mbps = 100, .reg = 0x20 },
202+ { .mbps = 110, .reg = 0x30 },
203+ { .mbps = 120, .reg = 0x01 },
204+ { .mbps = 130, .reg = 0x11 },
205+ { .mbps = 140, .reg = 0x21 },
206+ { .mbps = 150, .reg = 0x31 },
207+ { .mbps = 160, .reg = 0x02 },
208+ { .mbps = 170, .reg = 0x12 },
209+ { .mbps = 180, .reg = 0x22 },
210+ { .mbps = 190, .reg = 0x32 },
211+ { .mbps = 205, .reg = 0x03 },
212+ { .mbps = 220, .reg = 0x13 },
213+ { .mbps = 235, .reg = 0x23 },
214+ { .mbps = 250, .reg = 0x33 },
215+ { .mbps = 275, .reg = 0x04 },
216+ { .mbps = 300, .reg = 0x14 },
217+ { .mbps = 325, .reg = 0x25 },
218+ { .mbps = 350, .reg = 0x35 },
219+ { .mbps = 400, .reg = 0x05 },
220+ { .mbps = 450, .reg = 0x16 },
221+ { .mbps = 500, .reg = 0x26 },
222+ { .mbps = 550, .reg = 0x37 },
223+ { .mbps = 600, .reg = 0x07 },
224+ { .mbps = 650, .reg = 0x18 },
225+ { .mbps = 700, .reg = 0x28 },
226+ { .mbps = 750, .reg = 0x39 },
227+ { .mbps = 800, .reg = 0x09 },
228+ { .mbps = 850, .reg = 0x19 },
229+ { .mbps = 900, .reg = 0x29 },
230+ { .mbps = 950, .reg = 0x3a },
231+ { .mbps = 1000, .reg = 0x0a },
232+ { .mbps = 1050, .reg = 0x1a },
233+ { .mbps = 1100, .reg = 0x2a },
234+ { .mbps = 1150, .reg = 0x3b },
235+ { .mbps = 1200, .reg = 0x0b },
236+ { .mbps = 1250, .reg = 0x1b },
237+ { .mbps = 1300, .reg = 0x2b },
238+ { .mbps = 1350, .reg = 0x3c },
239+ { .mbps = 1400, .reg = 0x0c },
240+ { .mbps = 1450, .reg = 0x1c },
241+ { .mbps = 1500, .reg = 0x2c },
242+ { /* sentinel */ },
243+};
244+
245+static const struct rcsi2_mbps_reg hsfreqrange_m3w_h3es1[] = {
246+ { .mbps = 80, .reg = 0x00 },
247+ { .mbps = 90, .reg = 0x10 },
248+ { .mbps = 100, .reg = 0x20 },
249+ { .mbps = 110, .reg = 0x30 },
250+ { .mbps = 120, .reg = 0x01 },
251+ { .mbps = 130, .reg = 0x11 },
252+ { .mbps = 140, .reg = 0x21 },
253+ { .mbps = 150, .reg = 0x31 },
254+ { .mbps = 160, .reg = 0x02 },
255+ { .mbps = 170, .reg = 0x12 },
256+ { .mbps = 180, .reg = 0x22 },
257+ { .mbps = 190, .reg = 0x32 },
258+ { .mbps = 205, .reg = 0x03 },
259+ { .mbps = 220, .reg = 0x13 },
260+ { .mbps = 235, .reg = 0x23 },
261+ { .mbps = 250, .reg = 0x33 },
262+ { .mbps = 275, .reg = 0x04 },
263+ { .mbps = 300, .reg = 0x14 },
264+ { .mbps = 325, .reg = 0x05 },
265+ { .mbps = 350, .reg = 0x15 },
266+ { .mbps = 400, .reg = 0x25 },
267+ { .mbps = 450, .reg = 0x06 },
268+ { .mbps = 500, .reg = 0x16 },
269+ { .mbps = 550, .reg = 0x07 },
270+ { .mbps = 600, .reg = 0x17 },
271+ { .mbps = 650, .reg = 0x08 },
272+ { .mbps = 700, .reg = 0x18 },
273+ { .mbps = 750, .reg = 0x09 },
274+ { .mbps = 800, .reg = 0x19 },
275+ { .mbps = 850, .reg = 0x29 },
276+ { .mbps = 900, .reg = 0x39 },
277+ { .mbps = 950, .reg = 0x0a },
278+ { .mbps = 1000, .reg = 0x1a },
279+ { .mbps = 1050, .reg = 0x2a },
280+ { .mbps = 1100, .reg = 0x3a },
281+ { .mbps = 1150, .reg = 0x0b },
282+ { .mbps = 1200, .reg = 0x1b },
283+ { .mbps = 1250, .reg = 0x2b },
284+ { .mbps = 1300, .reg = 0x3b },
285+ { .mbps = 1350, .reg = 0x0c },
286+ { .mbps = 1400, .reg = 0x1c },
287+ { .mbps = 1450, .reg = 0x2c },
288+ { .mbps = 1500, .reg = 0x3c },
289+ { /* sentinel */ },
290+};
291+
292+/* PHY ESC Error Monitor */
293+#define PHEERM_REG 0x74
294+
295+/* PHY Clock Lane Monitor */
296+#define PHCLM_REG 0x78
297+#define PHCLM_STOPSTATECKL BIT(0)
298+
299+/* PHY Data Lane Monitor */
300+#define PHDLM_REG 0x7c
301+
302+/* CSI0CLK Frequency Configuration Preset Register */
303+#define CSI0CLKFCPR_REG 0x260
304+#define CSI0CLKFREQRANGE(n) ((n & 0x3f) << 16)
305+
306+struct rcar_csi2_format {
307+ u32 code;
308+ unsigned int datatype;
309+ unsigned int bpp;
310+};
311+
312+static const struct rcar_csi2_format rcar_csi2_formats[] = {
313+ { .code = MEDIA_BUS_FMT_RGB888_1X24, .datatype = 0x24, .bpp = 24 },
314+ { .code = MEDIA_BUS_FMT_UYVY8_1X16, .datatype = 0x1e, .bpp = 16 },
315+ { .code = MEDIA_BUS_FMT_YUYV8_1X16, .datatype = 0x1e, .bpp = 16 },
316+ { .code = MEDIA_BUS_FMT_UYVY8_2X8, .datatype = 0x1e, .bpp = 16 },
317+ { .code = MEDIA_BUS_FMT_YUYV10_2X10, .datatype = 0x1e, .bpp = 20 },
318+};
319+
320+static const struct rcar_csi2_format *rcsi2_code_to_fmt(unsigned int code)
321+{
322+ unsigned int i;
323+
324+ for (i = 0; i < ARRAY_SIZE(rcar_csi2_formats); i++)
325+ if (rcar_csi2_formats[i].code == code)
326+ return &rcar_csi2_formats[i];
327+
328+ return NULL;
329+}
330+
331+enum rcar_csi2_pads {
332+ RCAR_CSI2_SINK,
333+ RCAR_CSI2_SOURCE_VC0,
334+ RCAR_CSI2_SOURCE_VC1,
335+ RCAR_CSI2_SOURCE_VC2,
336+ RCAR_CSI2_SOURCE_VC3,
337+ NR_OF_RCAR_CSI2_PAD,
338+};
339+
340+struct rcar_csi2_info {
341+ int (*init_phtw)(struct rcar_csi2 *priv, unsigned int mbps);
342+ const struct rcsi2_mbps_reg *hsfreqrange;
343+ unsigned int csi0clkfreqrange;
344+ bool clear_ulps;
345+};
346+
347+struct rcar_csi2 {
348+ struct device *dev;
349+ void __iomem *base;
350+ const struct rcar_csi2_info *info;
351+
352+ struct v4l2_subdev subdev;
353+ struct media_pad pads[NR_OF_RCAR_CSI2_PAD];
354+
355+ struct v4l2_async_notifier notifier;
356+ struct v4l2_async_subdev asd;
357+ struct v4l2_subdev *remote;
358+
359+ struct v4l2_mbus_framefmt mf;
360+
361+ struct mutex lock;
362+ int stream_count;
363+
364+ unsigned short lanes;
365+ unsigned char lane_swap[4];
366+};
367+
368+static inline struct rcar_csi2 *sd_to_csi2(struct v4l2_subdev *sd)
369+{
370+ return container_of(sd, struct rcar_csi2, subdev);
371+}
372+
373+static inline struct rcar_csi2 *notifier_to_csi2(struct v4l2_async_notifier *n)
374+{
375+ return container_of(n, struct rcar_csi2, notifier);
376+}
377+
378+static u32 rcsi2_read(struct rcar_csi2 *priv, unsigned int reg)
379+{
380+ return ioread32(priv->base + reg);
381+}
382+
383+static void rcsi2_write(struct rcar_csi2 *priv, unsigned int reg, u32 data)
384+{
385+ iowrite32(data, priv->base + reg);
386+}
387+
388+static void rcsi2_reset(struct rcar_csi2 *priv)
389+{
390+ rcsi2_write(priv, SRST_REG, SRST_SRST);
391+ usleep_range(100, 150);
392+ rcsi2_write(priv, SRST_REG, 0);
393+}
394+
395+static int rcsi2_wait_phy_start(struct rcar_csi2 *priv)
396+{
397+ unsigned int timeout;
398+
399+ /* Wait for the clock and data lanes to enter LP-11 state. */
400+ for (timeout = 0; timeout <= 20; timeout++) {
401+ const u32 lane_mask = (1 << priv->lanes) - 1;
402+
403+ if ((rcsi2_read(priv, PHCLM_REG) & PHCLM_STOPSTATECKL) &&
404+ (rcsi2_read(priv, PHDLM_REG) & lane_mask) == lane_mask)
405+ return 0;
406+
407+ usleep_range(1000, 2000);
408+ }
409+
410+ dev_err(priv->dev, "Timeout waiting for LP-11 state\n");
411+
412+ return -ETIMEDOUT;
413+}
414+
415+static int rcsi2_set_phypll(struct rcar_csi2 *priv, unsigned int mbps)
416+{
417+ const struct rcsi2_mbps_reg *hsfreq;
418+
419+ for (hsfreq = priv->info->hsfreqrange; hsfreq->mbps != 0; hsfreq++)
420+ if (hsfreq->mbps >= mbps)
421+ break;
422+
423+ if (!hsfreq->mbps) {
424+ dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps);
425+ return -ERANGE;
426+ }
427+
428+ rcsi2_write(priv, PHYPLL_REG, PHYPLL_HSFREQRANGE(hsfreq->reg));
429+
430+ return 0;
431+}
432+
433+static int rcsi2_calc_mbps(struct rcar_csi2 *priv, unsigned int bpp)
434+{
435+ struct v4l2_subdev *source;
436+ struct v4l2_ctrl *ctrl;
437+ u64 mbps;
438+
439+ if (!priv->remote)
440+ return -ENODEV;
441+
442+ source = priv->remote;
443+
444+ /* Read the pixel rate control from remote. */
445+ ctrl = v4l2_ctrl_find(source->ctrl_handler, V4L2_CID_PIXEL_RATE);
446+ if (!ctrl) {
447+ dev_err(priv->dev, "no pixel rate control in subdev %s\n",
448+ source->name);
449+ return -EINVAL;
450+ }
451+
452+ /*
453+ * Calculate the phypll in mbps.
454+ * link_freq = (pixel_rate * bits_per_sample) / (2 * nr_of_lanes)
455+ * bps = link_freq * 2
456+ */
457+ mbps = v4l2_ctrl_g_ctrl_int64(ctrl) * bpp;
458+ do_div(mbps, priv->lanes * 1000000);
459+
460+ return mbps;
461+}
462+
463+static int rcsi2_start(struct rcar_csi2 *priv)
464+{
465+ const struct rcar_csi2_format *format;
466+ u32 phycnt, vcdt = 0, vcdt2 = 0;
467+ unsigned int i;
468+ int mbps, ret;
469+
470+ dev_dbg(priv->dev, "Input size (%ux%u%c)\n",
471+ priv->mf.width, priv->mf.height,
472+ priv->mf.field == V4L2_FIELD_NONE ? 'p' : 'i');
473+
474+ /* Code is validated in set_fmt. */
475+ format = rcsi2_code_to_fmt(priv->mf.code);
476+
477+ /*
478+ * Enable all Virtual Channels.
479+ *
480+ * NOTE: It's not possible to get individual datatype for each
481+ * source virtual channel. Once this is possible in V4L2
482+ * it should be used here.
483+ */
484+ for (i = 0; i < 4; i++) {
485+ u32 vcdt_part;
486+
487+ vcdt_part = VCDT_SEL_VC(i) | VCDT_VCDTN_EN | VCDT_SEL_DTN_ON |
488+ VCDT_SEL_DT(format->datatype);
489+
490+ /* Store in correct reg and offset. */
491+ if (i < 2)
492+ vcdt |= vcdt_part << ((i % 2) * 16);
493+ else
494+ vcdt2 |= vcdt_part << ((i % 2) * 16);
495+ }
496+
497+ phycnt = PHYCNT_ENABLECLK;
498+ phycnt |= (1 << priv->lanes) - 1;
499+
500+ mbps = rcsi2_calc_mbps(priv, format->bpp);
501+ if (mbps < 0)
502+ return mbps;
503+
504+ /* Init */
505+ rcsi2_write(priv, TREF_REG, TREF_TREF);
506+ rcsi2_reset(priv);
507+ rcsi2_write(priv, PHTC_REG, 0);
508+
509+ /* Configure */
510+ rcsi2_write(priv, FLD_REG, FLD_FLD_NUM(2) | FLD_FLD_EN4 |
511+ FLD_FLD_EN3 | FLD_FLD_EN2 | FLD_FLD_EN);
512+ rcsi2_write(priv, VCDT_REG, vcdt);
513+ rcsi2_write(priv, VCDT2_REG, vcdt2);
514+ /* Lanes are zero indexed. */
515+ rcsi2_write(priv, LSWAP_REG,
516+ LSWAP_L0SEL(priv->lane_swap[0] - 1) |
517+ LSWAP_L1SEL(priv->lane_swap[1] - 1) |
518+ LSWAP_L2SEL(priv->lane_swap[2] - 1) |
519+ LSWAP_L3SEL(priv->lane_swap[3] - 1));
520+
521+ /* Start */
522+ if (priv->info->init_phtw) {
523+ ret = priv->info->init_phtw(priv, mbps);
524+ if (ret)
525+ return ret;
526+ }
527+
528+ if (priv->info->hsfreqrange) {
529+ ret = rcsi2_set_phypll(priv, mbps);
530+ if (ret)
531+ return ret;
532+ }
533+
534+ if (priv->info->csi0clkfreqrange)
535+ rcsi2_write(priv, CSI0CLKFCPR_REG,
536+ CSI0CLKFREQRANGE(priv->info->csi0clkfreqrange));
537+
538+ rcsi2_write(priv, PHYCNT_REG, phycnt);
539+ rcsi2_write(priv, LINKCNT_REG, LINKCNT_MONITOR_EN |
540+ LINKCNT_REG_MONI_PACT_EN | LINKCNT_ICLK_NONSTOP);
541+ rcsi2_write(priv, PHYCNT_REG, phycnt | PHYCNT_SHUTDOWNZ);
542+ rcsi2_write(priv, PHYCNT_REG, phycnt | PHYCNT_SHUTDOWNZ | PHYCNT_RSTZ);
543+
544+ ret = rcsi2_wait_phy_start(priv);
545+ if (ret)
546+ return ret;
547+
548+ /* Clear Ultra Low Power interrupt. */
549+ if (priv->info->clear_ulps)
550+ rcsi2_write(priv, INTSTATE_REG,
551+ INTSTATE_INT_ULPS_START |
552+ INTSTATE_INT_ULPS_END);
553+ return 0;
554+}
555+
556+static void rcsi2_stop(struct rcar_csi2 *priv)
557+{
558+ rcsi2_write(priv, PHYCNT_REG, 0);
559+
560+ rcsi2_reset(priv);
561+
562+ rcsi2_write(priv, PHTC_REG, PHTC_TESTCLR);
563+}
564+
565+static int rcsi2_s_stream(struct v4l2_subdev *sd, int enable)
566+{
567+ struct rcar_csi2 *priv = sd_to_csi2(sd);
568+ struct v4l2_subdev *nextsd;
569+ int ret = 0;
570+
571+ mutex_lock(&priv->lock);
572+
573+ if (!priv->remote) {
574+ ret = -ENODEV;
575+ goto out;
576+ }
577+
578+ nextsd = priv->remote;
579+
580+ if (enable && priv->stream_count == 0) {
581+ pm_runtime_get_sync(priv->dev);
582+
583+ ret = rcsi2_start(priv);
584+ if (ret) {
585+ pm_runtime_put(priv->dev);
586+ goto out;
587+ }
588+
589+ ret = v4l2_subdev_call(nextsd, video, s_stream, 1);
590+ if (ret) {
591+ rcsi2_stop(priv);
592+ pm_runtime_put(priv->dev);
593+ goto out;
594+ }
595+ } else if (!enable && priv->stream_count == 1) {
596+ rcsi2_stop(priv);
597+ v4l2_subdev_call(nextsd, video, s_stream, 0);
598+ pm_runtime_put(priv->dev);
599+ }
600+
601+ priv->stream_count += enable ? 1 : -1;
602+out:
603+ mutex_unlock(&priv->lock);
604+
605+ return ret;
606+}
607+
608+static int rcsi2_set_pad_format(struct v4l2_subdev *sd,
609+ struct v4l2_subdev_pad_config *cfg,
610+ struct v4l2_subdev_format *format)
611+{
612+ struct rcar_csi2 *priv = sd_to_csi2(sd);
613+ struct v4l2_mbus_framefmt *framefmt;
614+
615+ if (!rcsi2_code_to_fmt(format->format.code))
616+ format->format.code = rcar_csi2_formats[0].code;
617+
618+ if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
619+ priv->mf = format->format;
620+ } else {
621+ framefmt = v4l2_subdev_get_try_format(sd, cfg, 0);
622+ *framefmt = format->format;
623+ }
624+
625+ return 0;
626+}
627+
628+static int rcsi2_get_pad_format(struct v4l2_subdev *sd,
629+ struct v4l2_subdev_pad_config *cfg,
630+ struct v4l2_subdev_format *format)
631+{
632+ struct rcar_csi2 *priv = sd_to_csi2(sd);
633+
634+ if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
635+ format->format = priv->mf;
636+ else
637+ format->format = *v4l2_subdev_get_try_format(sd, cfg, 0);
638+
639+ return 0;
640+}
641+
642+static const struct v4l2_subdev_video_ops rcar_csi2_video_ops = {
643+ .s_stream = rcsi2_s_stream,
644+};
645+
646+static const struct v4l2_subdev_pad_ops rcar_csi2_pad_ops = {
647+ .set_fmt = rcsi2_set_pad_format,
648+ .get_fmt = rcsi2_get_pad_format,
649+};
650+
651+static const struct v4l2_subdev_ops rcar_csi2_subdev_ops = {
652+ .video = &rcar_csi2_video_ops,
653+ .pad = &rcar_csi2_pad_ops,
654+};
655+
656+/* -----------------------------------------------------------------------------
657+ * Async handling and registration of subdevices and links.
658+ */
659+
660+static int rcsi2_notify_bound(struct v4l2_async_notifier *notifier,
661+ struct v4l2_subdev *subdev,
662+ struct v4l2_async_subdev *asd)
663+{
664+ struct rcar_csi2 *priv = notifier_to_csi2(notifier);
665+ int pad;
666+
667+ pad = media_entity_get_fwnode_pad(&subdev->entity, asd->match.fwnode,
668+ MEDIA_PAD_FL_SOURCE);
669+ if (pad < 0) {
670+ dev_err(priv->dev, "Failed to find pad for %s\n", subdev->name);
671+ return pad;
672+ }
673+
674+ priv->remote = subdev;
675+
676+ dev_dbg(priv->dev, "Bound %s pad: %d\n", subdev->name, pad);
677+
678+ return media_create_pad_link(&subdev->entity, pad,
679+ &priv->subdev.entity, 0,
680+ MEDIA_LNK_FL_ENABLED |
681+ MEDIA_LNK_FL_IMMUTABLE);
682+}
683+
684+static void rcsi2_notify_unbind(struct v4l2_async_notifier *notifier,
685+ struct v4l2_subdev *subdev,
686+ struct v4l2_async_subdev *asd)
687+{
688+ struct rcar_csi2 *priv = notifier_to_csi2(notifier);
689+
690+ priv->remote = NULL;
691+
692+ dev_dbg(priv->dev, "Unbind %s\n", subdev->name);
693+}
694+
695+static const struct v4l2_async_notifier_operations rcar_csi2_notify_ops = {
696+ .bound = rcsi2_notify_bound,
697+ .unbind = rcsi2_notify_unbind,
698+};
699+
700+static int rcsi2_parse_v4l2(struct rcar_csi2 *priv,
701+ struct v4l2_fwnode_endpoint *vep)
702+{
703+ unsigned int i;
704+
705+ /* Only port 0 endpoint 0 is valid. */
706+ if (vep->base.port || vep->base.id)
707+ return -ENOTCONN;
708+
709+ if (vep->bus_type != V4L2_MBUS_CSI2) {
710+ dev_err(priv->dev, "Unsupported bus: %u\n", vep->bus_type);
711+ return -EINVAL;
712+ }
713+
714+ priv->lanes = vep->bus.mipi_csi2.num_data_lanes;
715+ if (priv->lanes != 1 && priv->lanes != 2 && priv->lanes != 4) {
716+ dev_err(priv->dev, "Unsupported number of data-lanes: %u\n",
717+ priv->lanes);
718+ return -EINVAL;
719+ }
720+
721+ for (i = 0; i < ARRAY_SIZE(priv->lane_swap); i++) {
722+ priv->lane_swap[i] = i < priv->lanes ?
723+ vep->bus.mipi_csi2.data_lanes[i] : i;
724+
725+ /* Check for valid lane number. */
726+ if (priv->lane_swap[i] < 1 || priv->lane_swap[i] > 4) {
727+ dev_err(priv->dev, "data-lanes must be in 1-4 range\n");
728+ return -EINVAL;
729+ }
730+ }
731+
732+ return 0;
733+}
734+
735+static int rcsi2_parse_dt(struct rcar_csi2 *priv)
736+{
737+ struct device_node *ep;
738+ struct v4l2_fwnode_endpoint v4l2_ep;
739+ int ret;
740+
741+ ep = of_graph_get_endpoint_by_regs(priv->dev->of_node, 0, 0);
742+ if (!ep) {
743+ dev_err(priv->dev, "Not connected to subdevice\n");
744+ return -EINVAL;
745+ }
746+
747+ ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(ep), &v4l2_ep);
748+ if (ret) {
749+ dev_err(priv->dev, "Could not parse v4l2 endpoint\n");
750+ of_node_put(ep);
751+ return -EINVAL;
752+ }
753+
754+ ret = rcsi2_parse_v4l2(priv, &v4l2_ep);
755+ if (ret) {
756+ of_node_put(ep);
757+ return ret;
758+ }
759+
760+ priv->asd.match.fwnode =
761+ fwnode_graph_get_remote_endpoint(of_fwnode_handle(ep));
762+ priv->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
763+
764+ of_node_put(ep);
765+
766+ priv->notifier.subdevs = devm_kzalloc(priv->dev,
767+ sizeof(*priv->notifier.subdevs),
768+ GFP_KERNEL);
769+ if (!priv->notifier.subdevs)
770+ return -ENOMEM;
771+
772+ priv->notifier.num_subdevs = 1;
773+ priv->notifier.subdevs[0] = &priv->asd;
774+ priv->notifier.ops = &rcar_csi2_notify_ops;
775+
776+ dev_dbg(priv->dev, "Found '%pOF'\n",
777+ to_of_node(priv->asd.match.fwnode));
778+
779+ return v4l2_async_subdev_notifier_register(&priv->subdev,
780+ &priv->notifier);
781+}
782+
783+/* -----------------------------------------------------------------------------
784+ * PHTW initialization sequences.
785+ *
786+ * NOTE: Magic values are from the datasheet and lack documentation.
787+ */
788+
789+static int rcsi2_phtw_write(struct rcar_csi2 *priv, u16 data, u16 code)
790+{
791+ unsigned int timeout;
792+
793+ rcsi2_write(priv, PHTW_REG,
794+ PHTW_DWEN | PHTW_TESTDIN_DATA(data) |
795+ PHTW_CWEN | PHTW_TESTDIN_CODE(code));
796+
797+ /* Wait for DWEN and CWEN to be cleared by hardware. */
798+ for (timeout = 0; timeout <= 20; timeout++) {
799+ if (!(rcsi2_read(priv, PHTW_REG) & (PHTW_DWEN | PHTW_CWEN)))
800+ return 0;
801+
802+ usleep_range(1000, 2000);
803+ }
804+
805+ dev_err(priv->dev, "Timeout waiting for PHTW_DWEN and/or PHTW_CWEN\n");
806+
807+ return -ETIMEDOUT;
808+}
809+
810+static int rcsi2_phtw_write_array(struct rcar_csi2 *priv,
811+ const struct phtw_value *values)
812+{
813+ const struct phtw_value *value;
814+ int ret;
815+
816+ for (value = values; value->data || value->code; value++) {
817+ ret = rcsi2_phtw_write(priv, value->data, value->code);
818+ if (ret)
819+ return ret;
820+ }
821+
822+ return 0;
823+}
824+
825+static int rcsi2_phtw_write_mbps(struct rcar_csi2 *priv, unsigned int mbps,
826+ const struct rcsi2_mbps_reg *values, u16 code)
827+{
828+ const struct rcsi2_mbps_reg *value;
829+
830+ for (value = values; value->mbps; value++)
831+ if (value->mbps >= mbps)
832+ break;
833+
834+ if (!value->mbps) {
835+ dev_err(priv->dev, "Unsupported PHY speed (%u Mbps)", mbps);
836+ return -ERANGE;
837+ }
838+
839+ return rcsi2_phtw_write(priv, value->reg, code);
840+}
841+
842+static int rcsi2_init_phtw_h3_v3h_m3n(struct rcar_csi2 *priv, unsigned int mbps)
843+{
844+ static const struct phtw_value step1[] = {
845+ { .data = 0xcc, .code = 0xe2 },
846+ { .data = 0x01, .code = 0xe3 },
847+ { .data = 0x11, .code = 0xe4 },
848+ { .data = 0x01, .code = 0xe5 },
849+ { .data = 0x10, .code = 0x04 },
850+ { /* sentinel */ },
851+ };
852+
853+ static const struct phtw_value step2[] = {
854+ { .data = 0x38, .code = 0x08 },
855+ { .data = 0x01, .code = 0x00 },
856+ { .data = 0x4b, .code = 0xac },
857+ { .data = 0x03, .code = 0x00 },
858+ { .data = 0x80, .code = 0x07 },
859+ { /* sentinel */ },
860+ };
861+
862+ int ret;
863+
864+ ret = rcsi2_phtw_write_array(priv, step1);
865+ if (ret)
866+ return ret;
867+
868+ if (mbps <= 250) {
869+ ret = rcsi2_phtw_write(priv, 0x39, 0x05);
870+ if (ret)
871+ return ret;
872+
873+ ret = rcsi2_phtw_write_mbps(priv, mbps, phtw_mbps_h3_v3h_m3n,
874+ 0xf1);
875+ if (ret)
876+ return ret;
877+ }
878+
879+ return rcsi2_phtw_write_array(priv, step2);
880+}
881+
882+static int rcsi2_init_phtw_v3m_e3(struct rcar_csi2 *priv, unsigned int mbps)
883+{
884+ static const struct phtw_value step1[] = {
885+ { .data = 0xed, .code = 0x34 },
886+ { .data = 0xed, .code = 0x44 },
887+ { .data = 0xed, .code = 0x54 },
888+ { .data = 0xed, .code = 0x84 },
889+ { .data = 0xed, .code = 0x94 },
890+ { /* sentinel */ },
891+ };
892+
893+ int ret;
894+
895+ ret = rcsi2_phtw_write_mbps(priv, mbps, phtw_mbps_v3m_e3, 0x44);
896+ if (ret)
897+ return ret;
898+
899+ return rcsi2_phtw_write_array(priv, step1);
900+}
901+
902+/* -----------------------------------------------------------------------------
903+ * Platform Device Driver.
904+ */
905+
906+static const struct media_entity_operations rcar_csi2_entity_ops = {
907+ .link_validate = v4l2_subdev_link_validate,
908+};
909+
910+static int rcsi2_probe_resources(struct rcar_csi2 *priv,
911+ struct platform_device *pdev)
912+{
913+ struct resource *res;
914+ int irq;
915+
916+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
917+ priv->base = devm_ioremap_resource(&pdev->dev, res);
918+ if (IS_ERR(priv->base))
919+ return PTR_ERR(priv->base);
920+
921+ irq = platform_get_irq(pdev, 0);
922+ if (irq < 0)
923+ return irq;
924+
925+ return 0;
926+}
927+
928+static const struct rcar_csi2_info rcar_csi2_info_r8a7795 = {
929+ .init_phtw = rcsi2_init_phtw_h3_v3h_m3n,
930+ .hsfreqrange = hsfreqrange_h3_v3h_m3n,
931+ .csi0clkfreqrange = 0x20,
932+ .clear_ulps = true,
933+};
934+
935+static const struct rcar_csi2_info rcar_csi2_info_r8a7795es1 = {
936+ .hsfreqrange = hsfreqrange_m3w_h3es1,
937+};
938+
939+static const struct rcar_csi2_info rcar_csi2_info_r8a7796 = {
940+ .hsfreqrange = hsfreqrange_m3w_h3es1,
941+};
942+
943+static const struct rcar_csi2_info rcar_csi2_info_r8a77965 = {
944+ .init_phtw = rcsi2_init_phtw_h3_v3h_m3n,
945+ .hsfreqrange = hsfreqrange_h3_v3h_m3n,
946+ .csi0clkfreqrange = 0x20,
947+ .clear_ulps = true,
948+};
949+
950+static const struct rcar_csi2_info rcar_csi2_info_r8a77970 = {
951+ .init_phtw = rcsi2_init_phtw_v3m_e3,
952+};
953+
954+static const struct of_device_id rcar_csi2_of_table[] = {
955+ {
956+ .compatible = "renesas,r8a7795-csi2",
957+ .data = &rcar_csi2_info_r8a7795,
958+ },
959+ {
960+ .compatible = "renesas,r8a7796-csi2",
961+ .data = &rcar_csi2_info_r8a7796,
962+ },
963+ {
964+ .compatible = "renesas,r8a77965-csi2",
965+ .data = &rcar_csi2_info_r8a77965,
966+ },
967+ {
968+ .compatible = "renesas,r8a77970-csi2",
969+ .data = &rcar_csi2_info_r8a77970,
970+ },
971+ { /* sentinel */ },
972+};
973+MODULE_DEVICE_TABLE(of, rcar_csi2_of_table);
974+
975+static const struct soc_device_attribute r8a7795es1[] = {
976+ {
977+ .soc_id = "r8a7795", .revision = "ES1.*",
978+ .data = &rcar_csi2_info_r8a7795es1,
979+ },
980+ { /* sentinel */ },
981+};
982+
983+static int rcsi2_probe(struct platform_device *pdev)
984+{
985+ const struct soc_device_attribute *attr;
986+ struct rcar_csi2 *priv;
987+ unsigned int i;
988+ int ret;
989+
990+ priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
991+ if (!priv)
992+ return -ENOMEM;
993+
994+ priv->info = of_device_get_match_data(&pdev->dev);
995+
996+ /*
997+ * r8a7795 ES1.x behaves differently than the ES2.0+ but doesn't
998+ * have it's own compatible string.
999+ */
1000+ attr = soc_device_match(r8a7795es1);
1001+ if (attr)
1002+ priv->info = attr->data;
1003+
1004+ priv->dev = &pdev->dev;
1005+
1006+ mutex_init(&priv->lock);
1007+ priv->stream_count = 0;
1008+
1009+ ret = rcsi2_probe_resources(priv, pdev);
1010+ if (ret) {
1011+ dev_err(priv->dev, "Failed to get resources\n");
1012+ return ret;
1013+ }
1014+
1015+ platform_set_drvdata(pdev, priv);
1016+
1017+ ret = rcsi2_parse_dt(priv);
1018+ if (ret)
1019+ return ret;
1020+
1021+ priv->subdev.owner = THIS_MODULE;
1022+ priv->subdev.dev = &pdev->dev;
1023+ v4l2_subdev_init(&priv->subdev, &rcar_csi2_subdev_ops);
1024+ v4l2_set_subdevdata(&priv->subdev, &pdev->dev);
1025+ snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
1026+ KBUILD_MODNAME, dev_name(&pdev->dev));
1027+ priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;
1028+
1029+ priv->subdev.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER;
1030+ priv->subdev.entity.ops = &rcar_csi2_entity_ops;
1031+
1032+ priv->pads[RCAR_CSI2_SINK].flags = MEDIA_PAD_FL_SINK;
1033+ for (i = RCAR_CSI2_SOURCE_VC0; i < NR_OF_RCAR_CSI2_PAD; i++)
1034+ priv->pads[i].flags = MEDIA_PAD_FL_SOURCE;
1035+
1036+ ret = media_entity_pads_init(&priv->subdev.entity, NR_OF_RCAR_CSI2_PAD,
1037+ priv->pads);
1038+ if (ret)
1039+ goto error;
1040+
1041+ pm_runtime_enable(&pdev->dev);
1042+
1043+ ret = v4l2_async_register_subdev(&priv->subdev);
1044+ if (ret < 0)
1045+ goto error;
1046+
1047+ dev_info(priv->dev, "%d lanes found\n", priv->lanes);
1048+
1049+ return 0;
1050+
1051+error:
1052+ v4l2_async_notifier_unregister(&priv->notifier);
1053+ v4l2_async_notifier_cleanup(&priv->notifier);
1054+
1055+ return ret;
1056+}
1057+
1058+static int rcsi2_remove(struct platform_device *pdev)
1059+{
1060+ struct rcar_csi2 *priv = platform_get_drvdata(pdev);
1061+
1062+ v4l2_async_notifier_unregister(&priv->notifier);
1063+ v4l2_async_notifier_cleanup(&priv->notifier);
1064+ v4l2_async_unregister_subdev(&priv->subdev);
1065+
1066+ pm_runtime_disable(&pdev->dev);
1067+
1068+ return 0;
1069+}
1070+
1071+static struct platform_driver rcar_csi2_pdrv = {
1072+ .remove = rcsi2_remove,
1073+ .probe = rcsi2_probe,
1074+ .driver = {
1075+ .name = "rcar-csi2",
1076+ .of_match_table = rcar_csi2_of_table,
1077+ },
1078+};
1079+
1080+module_platform_driver(rcar_csi2_pdrv);
1081+
1082+MODULE_AUTHOR("Niklas Söderlund <niklas.soderlund@ragnatech.se>");
1083+MODULE_DESCRIPTION("Renesas R-Car MIPI CSI-2 receiver driver");
1084+MODULE_LICENSE("GPL");
drivers/media/platform/rcar-vin/rcar-dma.c+542−370
@@ -16,6 +16,7 @@ · 15 unmodified lines
1616
1717 #include <linux/delay.h>
1818 #include <linux/interrupt.h>
19+#include <linux/pm_runtime.h>
1920
2021 #include <media/videobuf2-dma-contig.h>
2122
@@ -33,21 +34,23 @@ · 11 unmodified lines
3334 #define VNELPRC_REG 0x10 /* Video n End Line Pre-Clip Register */
3435 #define VNSPPRC_REG 0x14 /* Video n Start Pixel Pre-Clip Register */
3536 #define VNEPPRC_REG 0x18 /* Video n End Pixel Pre-Clip Register */
36−#define VNSLPOC_REG 0x1C /* Video n Start Line Post-Clip Register */
37−#define VNELPOC_REG 0x20 /* Video n End Line Post-Clip Register */
38−#define VNSPPOC_REG 0x24 /* Video n Start Pixel Post-Clip Register */
39−#define VNEPPOC_REG 0x28 /* Video n End Pixel Post-Clip Register */
4037 #define VNIS_REG 0x2C /* Video n Image Stride Register */
4138 #define VNMB_REG(m) (0x30 + ((m) << 2)) /* Video n Memory Base m Register */
4239 #define VNIE_REG 0x40 /* Video n Interrupt Enable Register */
4340 #define VNINTS_REG 0x44 /* Video n Interrupt Status Register */
4441 #define VNSI_REG 0x48 /* Video n Scanline Interrupt Register */
4542 #define VNMTC_REG 0x4C /* Video n Memory Transfer Control Register */
46−#define VNYS_REG 0x50 /* Video n Y Scale Register */
47−#define VNXS_REG 0x54 /* Video n X Scale Register */
4843 #define VNDMR_REG 0x58 /* Video n Data Mode Register */
4944 #define VNDMR2_REG 0x5C /* Video n Data Mode Register 2 */
5045 #define VNUVAOF_REG 0x60 /* Video n UV Address Offset Register */
46+
47+/* Register offsets specific for Gen2 */
48+#define VNSLPOC_REG 0x1C /* Video n Start Line Post-Clip Register */
49+#define VNELPOC_REG 0x20 /* Video n End Line Post-Clip Register */
50+#define VNSPPOC_REG 0x24 /* Video n Start Pixel Post-Clip Register */
51+#define VNEPPOC_REG 0x28 /* Video n End Pixel Post-Clip Register */
52+#define VNYS_REG 0x50 /* Video n Y Scale Register */
53+#define VNXS_REG 0x54 /* Video n X Scale Register */
5154 #define VNC1A_REG 0x80 /* Video n Coefficient Set C1A Register */
5255 #define VNC1B_REG 0x84 /* Video n Coefficient Set C1B Register */
5356 #define VNC1C_REG 0x88 /* Video n Coefficient Set C1C Register */
@@ -73,9 +76,13 @@ · 19 unmodified lines
7376 #define VNC8B_REG 0xF4 /* Video n Coefficient Set C8B Register */
7477 #define VNC8C_REG 0xF8 /* Video n Coefficient Set C8C Register */
7578
79+/* Register offsets specific for Gen3 */
80+#define VNCSI_IFMD_REG 0x20 /* Video n CSI2 Interface Mode Register */
7681
7782 /* Register bit fields for R-Car VIN */
7883 /* Video n Main Control Register bits */
84+#define VNMC_DPINE (1 << 27) /* Gen3 specific */
85+#define VNMC_SCLE (1 << 26) /* Gen3 specific */
7986 #define VNMC_FOC (1 << 21)
8087 #define VNMC_YCAL (1 << 19)
8188 #define VNMC_INF_YUV8_BT656 (0 << 16)
@@ -119,6 +126,12 @@ · 37 unmodified lines
119126 #define VNDMR2_FTEV (1 << 17)
120127 #define VNDMR2_VLV(n) ((n & 0xf) << 12)
121128
129+/* Video n CSI2 Interface Mode Register (Gen3) */
130+#define VNCSI_IFMD_DES1 (1 << 26)
131+#define VNCSI_IFMD_DES0 (1 << 25)
132+#define VNCSI_IFMD_CSI_CHSEL(n) (((n) & 0xf) << 0)
133+#define VNCSI_IFMD_CSI_CHSEL_MASK 0xf
134+
122135 struct rvin_buffer {
123136 struct vb2_v4l2_buffer vb;
124137 struct list_head list;
@@ -138,267 +151,6 @@ static u32 rvin_read(struct rvin_dev *vin, u32 offset) · 13 unmodified lines
138151 return ioread32(vin->base + offset);
139152 }
140153
141−static int rvin_setup(struct rvin_dev *vin)
142−{
143− u32 vnmc, dmr, dmr2, interrupts;
144− v4l2_std_id std;
145− bool progressive = false, output_is_yuv = false, input_is_yuv = false;
146−
147− switch (vin->format.field) {
148− case V4L2_FIELD_TOP:
149− vnmc = VNMC_IM_ODD;
150− break;
151− case V4L2_FIELD_BOTTOM:
152− vnmc = VNMC_IM_EVEN;
153− break;
154− case V4L2_FIELD_INTERLACED:
155− /* Default to TB */
156− vnmc = VNMC_IM_FULL;
157− /* Use BT if video standard can be read and is 60 Hz format */
158− if (!v4l2_subdev_call(vin_to_source(vin), video, g_std, &std)) {
159− if (std & V4L2_STD_525_60)
160− vnmc = VNMC_IM_FULL | VNMC_FOC;
161− }
162− break;
163− case V4L2_FIELD_INTERLACED_TB:
164− vnmc = VNMC_IM_FULL;
165− break;
166− case V4L2_FIELD_INTERLACED_BT:
167− vnmc = VNMC_IM_FULL | VNMC_FOC;
168− break;
169− case V4L2_FIELD_ALTERNATE:
170− case V4L2_FIELD_NONE:
171− vnmc = VNMC_IM_ODD_EVEN;
172− progressive = true;
173− break;
174− default:
175− vnmc = VNMC_IM_ODD;
176− break;
177− }
178−
179− /*
180− * Input interface
181− */
182− switch (vin->digital->code) {
183− case MEDIA_BUS_FMT_YUYV8_1X16:
184− /* BT.601/BT.1358 16bit YCbCr422 */
185− vnmc |= VNMC_INF_YUV16;
186− input_is_yuv = true;
187− break;
188− case MEDIA_BUS_FMT_UYVY8_2X8:
189− /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
190− vnmc |= vin->digital->mbus_cfg.type == V4L2_MBUS_BT656 ?
191− VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
192− input_is_yuv = true;
193− break;
194− case MEDIA_BUS_FMT_RGB888_1X24:
195− vnmc |= VNMC_INF_RGB888;
196− break;
197− case MEDIA_BUS_FMT_UYVY10_2X10:
198− /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
199− vnmc |= vin->digital->mbus_cfg.type == V4L2_MBUS_BT656 ?
200− VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601;
201− input_is_yuv = true;
202− break;
203− default:
204− break;
205− }
206−
207− /* Enable VSYNC Field Toogle mode after one VSYNC input */
208− dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1);
209−
210− /* Hsync Signal Polarity Select */
211− if (!(vin->digital->mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW))
212− dmr2 |= VNDMR2_HPS;
213−
214− /* Vsync Signal Polarity Select */
215− if (!(vin->digital->mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW))
216− dmr2 |= VNDMR2_VPS;
217−
218− /*
219− * Output format
220− */
221− switch (vin->format.pixelformat) {
222− case V4L2_PIX_FMT_NV16:
223− rvin_write(vin,
224− ALIGN(vin->format.width * vin->format.height, 0x80),
225− VNUVAOF_REG);
226− dmr = VNDMR_DTMD_YCSEP;
227− output_is_yuv = true;
228− break;
229− case V4L2_PIX_FMT_YUYV:
230− dmr = VNDMR_BPSM;
231− output_is_yuv = true;
232− break;
233− case V4L2_PIX_FMT_UYVY:
234− dmr = 0;
235− output_is_yuv = true;
236− break;
237− case V4L2_PIX_FMT_XRGB555:
238− dmr = VNDMR_DTMD_ARGB1555;
239− break;
240− case V4L2_PIX_FMT_RGB565:
241− dmr = 0;
242− break;
243− case V4L2_PIX_FMT_XBGR32:
244− /* Note: not supported on M1 */
245− dmr = VNDMR_EXRGB;
246− break;
247− default:
248− vin_err(vin, "Invalid pixelformat (0x%x)\n",
249− vin->format.pixelformat);
250− return -EINVAL;
251− }
252−
253− /* Always update on field change */
254− vnmc |= VNMC_VUP;
255−
256− /* If input and output use the same colorspace, use bypass mode */
257− if (input_is_yuv == output_is_yuv)
258− vnmc |= VNMC_BPS;
259−
260− /* Progressive or interlaced mode */
261− interrupts = progressive ? VNIE_FIE : VNIE_EFE;
262−
263− /* Ack interrupts */
264− rvin_write(vin, interrupts, VNINTS_REG);
265− /* Enable interrupts */
266− rvin_write(vin, interrupts, VNIE_REG);
267− /* Start capturing */
268− rvin_write(vin, dmr, VNDMR_REG);
269− rvin_write(vin, dmr2, VNDMR2_REG);
270−
271− /* Enable module */
272− rvin_write(vin, vnmc | VNMC_ME, VNMC_REG);
273−
274− return 0;
275−}
276−
277−static void rvin_disable_interrupts(struct rvin_dev *vin)
278−{
279− rvin_write(vin, 0, VNIE_REG);
280−}
281−
282−static u32 rvin_get_interrupt_status(struct rvin_dev *vin)
283−{
284− return rvin_read(vin, VNINTS_REG);
285−}
286−
287−static void rvin_ack_interrupt(struct rvin_dev *vin)
288−{
289− rvin_write(vin, rvin_read(vin, VNINTS_REG), VNINTS_REG);
290−}
291−
292−static bool rvin_capture_active(struct rvin_dev *vin)
293−{
294− return rvin_read(vin, VNMS_REG) & VNMS_CA;
295−}
296−
297−static enum v4l2_field rvin_get_active_field(struct rvin_dev *vin, u32 vnms)
298−{
299− if (vin->format.field == V4L2_FIELD_ALTERNATE) {
300− /* If FS is set it's a Even field */
301− if (vnms & VNMS_FS)
302− return V4L2_FIELD_BOTTOM;
303− return V4L2_FIELD_TOP;
304− }
305−
306− return vin->format.field;
307−}
308−
309−static void rvin_set_slot_addr(struct rvin_dev *vin, int slot, dma_addr_t addr)
310−{
311− const struct rvin_video_format *fmt;
312− int offsetx, offsety;
313− dma_addr_t offset;
314−
315− fmt = rvin_format_from_pixel(vin->format.pixelformat);
316−
317− /*
318− * There is no HW support for composition do the beast we can
319− * by modifying the buffer offset
320− */
321− offsetx = vin->compose.left * fmt->bpp;
322− offsety = vin->compose.top * vin->format.bytesperline;
323− offset = addr + offsetx + offsety;
324−
325− /*
326− * The address needs to be 128 bytes aligned. Driver should never accept
327− * settings that do not satisfy this in the first place...
328− */
329− if (WARN_ON((offsetx | offsety | offset) & HW_BUFFER_MASK))
330− return;
331−
332− rvin_write(vin, offset, VNMB_REG(slot));
333−}
334−
335−/*
336− * Moves a buffer from the queue to the HW slot. If no buffer is
337− * available use the scratch buffer. The scratch buffer is never
338− * returned to userspace, its only function is to enable the capture
339− * loop to keep running.
340− */
341−static void rvin_fill_hw_slot(struct rvin_dev *vin, int slot)
342−{
343− struct rvin_buffer *buf;
344− struct vb2_v4l2_buffer *vbuf;
345− dma_addr_t phys_addr;
346−
347− /* A already populated slot shall never be overwritten. */
348− if (WARN_ON(vin->queue_buf[slot] != NULL))
349− return;
350−
351− vin_dbg(vin, "Filling HW slot: %d\n", slot);
352−
353− if (list_empty(&vin->buf_list)) {
354− vin->queue_buf[slot] = NULL;
355− phys_addr = vin->scratch_phys;
356− } else {
357− /* Keep track of buffer we give to HW */
358− buf = list_entry(vin->buf_list.next, struct rvin_buffer, list);
359− vbuf = &buf->vb;
360− list_del_init(to_buf_list(vbuf));
361− vin->queue_buf[slot] = vbuf;
362−
363− /* Setup DMA */
364− phys_addr = vb2_dma_contig_plane_dma_addr(&vbuf->vb2_buf, 0);
365− }
366−
367− rvin_set_slot_addr(vin, slot, phys_addr);
368−}
369−
370−static int rvin_capture_start(struct rvin_dev *vin)
371−{
372− int slot, ret;
373−
374− for (slot = 0; slot < HW_BUFFER_NUM; slot++)
375− rvin_fill_hw_slot(vin, slot);
376−
377− rvin_crop_scale_comp(vin);
378−
379− ret = rvin_setup(vin);
380− if (ret)
381− return ret;
382−
383− vin_dbg(vin, "Starting to capture\n");
384−
385− /* Continuous Frame Capture Mode */
386− rvin_write(vin, VNFC_C_FRAME, VNFC_REG);
387−
388− vin->state = RUNNING;
389−
390− return 0;
391−}
392−
393−static void rvin_capture_stop(struct rvin_dev *vin)
394−{
395− /* Set continuous & single transfer off */
396− rvin_write(vin, 0, VNFC_REG);
397−
398− /* Disable module */
399− rvin_write(vin, rvin_read(vin, VNMC_REG) & ~VNMC_ME, VNMC_REG);
400−}
401−
402154 /* -----------------------------------------------------------------------------
403155 * Crop and Scaling Gen2
404156 */
@@ -736,122 +488,386 @@ static void rvin_set_coeff(struct rvin_dev *vin, unsigned short xs) · 331 unmodified lines
736488 break;
737489 }
738490
739− /* Use previous value if its XS value is closer */
740− if (p_prev_set && p_set &&
741− xs - p_prev_set->xs_value < p_set->xs_value - xs)
742− p_set = p_prev_set;
491+ /* Use previous value if its XS value is closer */
492+ if (p_prev_set && p_set &&
493+ xs - p_prev_set->xs_value < p_set->xs_value - xs)
494+ p_set = p_prev_set;
495+
496+ /* Set coefficient registers */
497+ rvin_write(vin, p_set->coeff_set[0], VNC1A_REG);
498+ rvin_write(vin, p_set->coeff_set[1], VNC1B_REG);
499+ rvin_write(vin, p_set->coeff_set[2], VNC1C_REG);
500+
501+ rvin_write(vin, p_set->coeff_set[3], VNC2A_REG);
502+ rvin_write(vin, p_set->coeff_set[4], VNC2B_REG);
503+ rvin_write(vin, p_set->coeff_set[5], VNC2C_REG);
504+
505+ rvin_write(vin, p_set->coeff_set[6], VNC3A_REG);
506+ rvin_write(vin, p_set->coeff_set[7], VNC3B_REG);
507+ rvin_write(vin, p_set->coeff_set[8], VNC3C_REG);
508+
509+ rvin_write(vin, p_set->coeff_set[9], VNC4A_REG);
510+ rvin_write(vin, p_set->coeff_set[10], VNC4B_REG);
511+ rvin_write(vin, p_set->coeff_set[11], VNC4C_REG);
512+
513+ rvin_write(vin, p_set->coeff_set[12], VNC5A_REG);
514+ rvin_write(vin, p_set->coeff_set[13], VNC5B_REG);
515+ rvin_write(vin, p_set->coeff_set[14], VNC5C_REG);
516+
517+ rvin_write(vin, p_set->coeff_set[15], VNC6A_REG);
518+ rvin_write(vin, p_set->coeff_set[16], VNC6B_REG);
519+ rvin_write(vin, p_set->coeff_set[17], VNC6C_REG);
520+
521+ rvin_write(vin, p_set->coeff_set[18], VNC7A_REG);
522+ rvin_write(vin, p_set->coeff_set[19], VNC7B_REG);
523+ rvin_write(vin, p_set->coeff_set[20], VNC7C_REG);
524+
525+ rvin_write(vin, p_set->coeff_set[21], VNC8A_REG);
526+ rvin_write(vin, p_set->coeff_set[22], VNC8B_REG);
527+ rvin_write(vin, p_set->coeff_set[23], VNC8C_REG);
528+}
529+
530+static void rvin_crop_scale_comp_gen2(struct rvin_dev *vin)
531+{
532+ u32 xs, ys;
533+
534+ /* Set scaling coefficient */
535+ ys = 0;
536+ if (vin->crop.height != vin->compose.height)
537+ ys = (4096 * vin->crop.height) / vin->compose.height;
538+ rvin_write(vin, ys, VNYS_REG);
539+
540+ xs = 0;
541+ if (vin->crop.width != vin->compose.width)
542+ xs = (4096 * vin->crop.width) / vin->compose.width;
543+
544+ /* Horizontal upscaling is up to double size */
545+ if (xs > 0 && xs < 2048)
546+ xs = 2048;
547+
548+ rvin_write(vin, xs, VNXS_REG);
549+
550+ /* Horizontal upscaling is done out by scaling down from double size */
551+ if (xs < 4096)
552+ xs *= 2;
553+
554+ rvin_set_coeff(vin, xs);
555+
556+ /* Set Start/End Pixel/Line Post-Clip */
557+ rvin_write(vin, 0, VNSPPOC_REG);
558+ rvin_write(vin, 0, VNSLPOC_REG);
559+ rvin_write(vin, vin->format.width - 1, VNEPPOC_REG);
560+ switch (vin->format.field) {
561+ case V4L2_FIELD_INTERLACED:
562+ case V4L2_FIELD_INTERLACED_TB:
563+ case V4L2_FIELD_INTERLACED_BT:
564+ rvin_write(vin, vin->format.height / 2 - 1, VNELPOC_REG);
565+ break;
566+ default:
567+ rvin_write(vin, vin->format.height - 1, VNELPOC_REG);
568+ break;
569+ }
570+
571+ vin_dbg(vin,
572+ "Pre-Clip: %ux%u@%u:%u YS: %d XS: %d Post-Clip: %ux%u@%u:%u\n",
573+ vin->crop.width, vin->crop.height, vin->crop.left,
574+ vin->crop.top, ys, xs, vin->format.width, vin->format.height,
575+ 0, 0);
576+}

632 more lines aren’t shown here.

drivers/media/platform/rcar-vin/rcar-v4l2.c+296−194

This diff is large: its 644 lines aren’t shown here.

drivers/media/platform/rcar-vin/rcar-vin.h+120−26

This diff is large: its 244 lines aren’t shown here.

drivers/media/platform/rcar_jpu.c+3−1

This diff is large: its 18 lines aren’t shown here.

drivers/media/platform/renesas-ceu.c+17−6

This diff is large: its 61 lines aren’t shown here.

drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c+2−2

This diff is large: its 12 lines aren’t shown here.

drivers/media/platform/s5p-mfc/s5p_mfc_dec.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/media/platform/s5p-mfc/s5p_mfc_enc.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/media/platform/soc_camera/Kconfig+1−2

This diff is large: its 11 lines aren’t shown here.

drivers/media/platform/soc_camera/soc_camera_platform.c+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/media/platform/sti/bdisp/bdisp-hw.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/platform/sti/bdisp/bdisp-v4l2.c+4−0

This diff is large: its 11 lines aren’t shown here.

drivers/media/platform/sti/c8sectpfe/Kconfig+1−1

This diff is large: its 8 lines aren’t shown here.

drivers/media/platform/sti/hva/hva-mem.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/platform/sti/hva/hva-v4l2.c+4−0

This diff is large: its 11 lines aren’t shown here.

drivers/media/platform/via-camera.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/platform/video-mux.c+15−1

This diff is large: its 51 lines aren’t shown here.

drivers/media/platform/vivid/vivid-vid-common.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/platform/vsp1/Makefile+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1.h+8−8

This diff is large: its 65 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_bru.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_brx.crenamed from drivers/media/platform/vsp1/vsp1_bru.c+105−113

This diff is large: its 520 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_brx.h+44−0

This diff is large: its 45 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_clu.c+80−104

This diff is large: its 266 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_clu.h+2−5

This diff is large: its 24 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_dl.c+264−177

This diff is large: its 722 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_dl.h+20−16

This diff is large: its 66 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_drm.c+605−346

This diff is large: its 1117 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_drm.h+23−8

This diff is large: its 70 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_drv.c+27−11

This diff is large: its 132 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_entity.c+128−9

This diff is large: its 196 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_entity.h+38−22

This diff is large: its 121 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_hgo.c+12−20

This diff is large: its 87 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_hgo.h+1−5

This diff is large: its 16 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_hgt.c+13−21

This diff is large: its 94 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_hgt.h+1−5

This diff is large: its 16 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_histo.c+6−61

This diff is large: its 96 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_histo.h+1−8

This diff is large: its 34 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_hsit.c+9−17

This diff is large: its 59 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_hsit.h+1−5

This diff is large: its 16 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_lif.c+23−73

This diff is large: its 165 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_lif.h+1−5

This diff is large: its 16 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_lut.c+64−87

This diff is large: its 237 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_lut.h+2−5

This diff is large: its 24 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_pipe.c+19−108

This diff is large: its 203 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_pipe.h+10−14

This diff is large: its 81 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_regs.h+42−4

This diff is large: its 71 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_rpf.c+108−99

This diff is large: its 293 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_rwpf.c+1−5

This diff is large: its 16 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_rwpf.h+2−8

This diff is large: its 41 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_sru.c+11−19

This diff is large: its 76 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_sru.h+1−5

This diff is large: its 16 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_uds.c+40−39

This diff is large: its 148 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_uds.h+2−6

This diff is large: its 25 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_uif.c+264−0

This diff is large: its 265 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_uif.h+32−0

This diff is large: its 33 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_video.c+152−68

This diff is large: its 445 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_video.h+4−5

This diff is large: its 26 lines aren’t shown here.

drivers/media/platform/vsp1/vsp1_wpf.c+178−162

This diff is large: its 429 lines aren’t shown here.

drivers/media/platform/xilinx/xilinx-dma.c+6−4

This diff is large: its 20 lines aren’t shown here.

drivers/media/radio/Kconfig+26−18

This diff is large: its 146 lines aren’t shown here.

drivers/media/radio/si470x/Kconfig+15−1

This diff is large: its 27 lines aren’t shown here.

drivers/media/radio/si470x/Makefile+3−5

This diff is large: its 12 lines aren’t shown here.

drivers/media/radio/si470x/radio-si470x-common.c+51−19

This diff is large: its 230 lines aren’t shown here.

drivers/media/radio/si470x/radio-si470x-i2c.c+15−9

This diff is large: its 76 lines aren’t shown here.

drivers/media/radio/si470x/radio-si470x-usb.c+12−6

This diff is large: its 57 lines aren’t shown here.

drivers/media/radio/si470x/radio-si470x.h+9−6

This diff is large: its 30 lines aren’t shown here.

drivers/media/rc/Kconfig+5−5

This diff is large: its 45 lines aren’t shown here.

drivers/media/rc/ir-imon-decoder.c+133−3

This diff is large: its 178 lines aren’t shown here.

drivers/media/rc/ir-jvc-decoder.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/rc/ir-mce_kbd-decoder.c+37−27

This diff is large: its 139 lines aren’t shown here.

drivers/media/rc/ir-nec-decoder.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/rc/ir-rc5-decoder.c+1−3

This diff is large: its 18 lines aren’t shown here.

drivers/media/rc/ir-rc6-decoder.c+1−10

This diff is large: its 39 lines aren’t shown here.

drivers/media/rc/ir-sanyo-decoder.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/rc/ir-sharp-decoder.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/rc/ir-sony-decoder.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/rc/ir-spi.c+2−2

This diff is large: its 17 lines aren’t shown here.

drivers/media/rc/ir-xmp-decoder.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/rc/ite-cir.c+5−3

This diff is large: its 15 lines aren’t shown here.

drivers/media/rc/ite-cir.h+0−7

This diff is large: its 14 lines aren’t shown here.

drivers/media/rc/lirc_dev.c+28−3

This diff is large: its 54 lines aren’t shown here.

drivers/media/rc/mceusb.c+51−2

This diff is large: its 117 lines aren’t shown here.

drivers/media/rc/mtk-cir.c+1−3

This diff is large: its 18 lines aren’t shown here.

drivers/media/rc/nuvoton-cir.c+41−48

This diff is large: its 150 lines aren’t shown here.

drivers/media/rc/rc-core-priv.h+6−0

This diff is large: its 27 lines aren’t shown here.

drivers/media/rc/rc-ir-raw.c+64−17

This diff is large: its 146 lines aren’t shown here.

drivers/media/rc/rc-main.c+37−35

This diff is large: its 169 lines aren’t shown here.

drivers/media/rc/st_rc.c+10−6

This diff is large: its 39 lines aren’t shown here.

drivers/media/rc/winbond-cir.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/media/spi/cxd2880-spi.c+10−22

This diff is large: its 82 lines aren’t shown here.

drivers/media/tuners/Kconfig+7−0

This diff is large: its 12 lines aren’t shown here.

drivers/media/tuners/Makefile+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/tuners/mxl301rf.c+1−10

This diff is large: its 19 lines aren’t shown here.

drivers/media/tuners/mxl301rf.h+1−10

This diff is large: its 19 lines aren’t shown here.

drivers/media/tuners/qm1d1b0004.c+266−0

This diff is large: its 267 lines aren’t shown here.

drivers/media/tuners/qm1d1b0004.h+24−0

This diff is large: its 25 lines aren’t shown here.

drivers/media/tuners/qm1d1c0042.c+1−10

This diff is large: its 19 lines aren’t shown here.

drivers/media/tuners/qm1d1c0042.h+1−10

This diff is large: its 19 lines aren’t shown here.

drivers/media/usb/cx231xx/Kconfig+1−4

This diff is large: its 23 lines aren’t shown here.

drivers/media/usb/cx231xx/cx231xx-417.c+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/usb/cx231xx/cx231xx-cards.c+6−3

This diff is large: its 37 lines aren’t shown here.

drivers/media/usb/cx231xx/cx231xx-dvb.c+103−279

This diff is large: its 647 lines aren’t shown here.

drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/cx231xx/cx231xx.h+0−3

This diff is large: its 17 lines aren’t shown here.

drivers/media/usb/dvb-usb-v2/dvbsky.c+136−289

This diff is large: its 577 lines aren’t shown here.

drivers/media/usb/dvb-usb-v2/gl861.c+18−4

This diff is large: its 37 lines aren’t shown here.

drivers/media/usb/dvb-usb-v2/usb_urb.c+4−13

This diff is large: its 57 lines aren’t shown here.

drivers/media/usb/dvb-usb/cxusb.c+5−4

This diff is large: its 34 lines aren’t shown here.

drivers/media/usb/dvb-usb/dvb-usb-dvb.c+4−0

This diff is large: its 15 lines aren’t shown here.

drivers/media/usb/dvb-usb/gp8psk.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/dvb-usb/usb-urb.c+3−3

This diff is large: its 27 lines aren’t shown here.

drivers/media/usb/em28xx/em28xx-cards.c+39−11

This diff is large: its 153 lines aren’t shown here.

drivers/media/usb/em28xx/em28xx-core.c+3−2

This diff is large: its 12 lines aren’t shown here.

drivers/media/usb/em28xx/em28xx-dvb.c+6−2

This diff is large: its 57 lines aren’t shown here.

drivers/media/usb/em28xx/em28xx-v4l.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/em28xx/em28xx.h+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/usb/go7007/go7007-fw.c+3−0

This diff is large: its 11 lines aren’t shown here.

drivers/media/usb/go7007/go7007-v4l2.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/gspca/Kconfig+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/media/usb/gspca/gspca.c+184−762

This diff is large: its 1217 lines aren’t shown here.

drivers/media/usb/gspca/gspca.h+19−19

This diff is large: its 81 lines aren’t shown here.

drivers/media/usb/gspca/jl2005bcd.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/gspca/m5602/m5602_core.c+2−2

This diff is large: its 18 lines aren’t shown here.

drivers/media/usb/gspca/ov534.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/media/usb/gspca/sq905.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/gspca/sq905c.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/gspca/topro.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/media/usb/gspca/vc032x.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/gspca/vicam.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/gspca/zc3xx.c+40−18

This diff is large: its 130 lines aren’t shown here.

drivers/media/usb/hackrf/hackrf.c+4−7

This diff is large: its 23 lines aren’t shown here.

drivers/media/usb/hdpvr/hdpvr-i2c.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/hdpvr/hdpvr-video.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/pvrusb2/pvrusb2-cx2584x-v4l.c+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/media/usb/pvrusb2/pvrusb2-devattr.c+2−2

This diff is large: its 31 lines aren’t shown here.

drivers/media/usb/pvrusb2/pvrusb2-v4l2.c+31−52

This diff is large: its 182 lines aren’t shown here.

drivers/media/usb/siano/smsusb.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/stk1160/stk1160-core.c+3−1

This diff is large: its 18 lines aren’t shown here.

drivers/media/usb/usbtv/usbtv-video.c+101−16

This diff is large: its 201 lines aren’t shown here.

drivers/media/usb/usbtv/usbtv.h+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/usbvision/usbvision-core.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/media/usb/uvc/uvc_ctrl.c+9−8

This diff is large: its 31 lines aren’t shown here.

drivers/media/usb/uvc/uvc_driver.c+2−9

This diff is large: its 39 lines aren’t shown here.

drivers/media/usb/uvc/uvc_video.c+18−6

This diff is large: its 61 lines aren’t shown here.

drivers/media/v4l2-core/Kconfig+0−6

This diff is large: its 19 lines aren’t shown here.

drivers/media/v4l2-core/Makefile+0−1

This diff is large: its 8 lines aren’t shown here.

drivers/media/v4l2-core/v4l2-compat-ioctl32.c+497−310

This diff is large: its 1441 lines aren’t shown here.

drivers/media/v4l2-core/v4l2-dev.c+37−36

This diff is large: its 266 lines aren’t shown here.

drivers/media/v4l2-core/v4l2-fwnode.c+18−10

This diff is large: its 36 lines aren’t shown here.

drivers/media/v4l2-core/v4l2-ioctl.c+164−122

This diff is large: its 374 lines aren’t shown here.

drivers/media/v4l2-core/v4l2-subdev.c+16−1

This diff is large: its 27 lines aren’t shown here.

drivers/media/v4l2-core/videobuf-dma-sg.c+3−3

This diff is large: its 27 lines aren’t shown here.

drivers/media/v4l2-core/videobuf-dvb.c+0−398

This diff is large: its 399 lines aren’t shown here.

drivers/pnp/isapnp/Kconfig+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/media/Kconfig+2−2

This diff is large: its 16 lines aren’t shown here.

drivers/staging/media/Makefile+1−1

This diff is large: its 7 lines aren’t shown here.

drivers/staging/media/atomisp/Kconfig+0−12

This diff is large: its 13 lines aren’t shown here.

drivers/staging/media/atomisp/Makefile+0−6

This diff is large: its 7 lines aren’t shown here.

drivers/staging/media/atomisp/TODO+0−74

This diff is large: its 75 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/Kconfig+0−86

This diff is large: its 87 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/Makefile+0−25

This diff is large: its 26 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/atomisp-gc0310.c+0−1392

This diff is large: its 1393 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/atomisp-gc2235.c+0−1122

This diff is large: its 1123 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/atomisp-libmsrlisthelper.c+0−205

This diff is large: its 206 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/atomisp-lm3554.c+0−968

This diff is large: its 969 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c+0−1917

This diff is large: its 1918 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/atomisp-ov2680.c+0−1470

This diff is large: its 1471 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/atomisp-ov2722.c+0−1271

This diff is large: its 1272 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/gc0310.h+0−404

This diff is large: its 405 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/gc2235.h+0−670

This diff is large: its 671 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/mt9m114.h+0−1777

This diff is large: its 1778 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/ov2680.h+0−856

This diff is large: its 857 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/ov2722.h+0−1262

This diff is large: its 1263 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/ov5693/Kconfig+0−11

This diff is large: its 12 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/ov5693/Makefile+0−9

This diff is large: its 10 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/ov5693/ad5823.h+0−63

This diff is large: its 64 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c+0−1993

This diff is large: its 1994 lines aren’t shown here.

drivers/staging/media/atomisp/i2c/ov5693/ov5693.h+0−1376

This diff is large: its 1377 lines aren’t shown here.

drivers/staging/media/atomisp/include/linux/atomisp.h+0−1359

This diff is large: its 1360 lines aren’t shown here.

drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/include/linux/atomisp_platform.h+0−249

This diff is large: its 250 lines aren’t shown here.

drivers/staging/media/atomisp/include/linux/libmsrlisthelper.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/include/media/lm3554.h+0−131

This diff is large: its 132 lines aren’t shown here.

drivers/staging/media/atomisp/pci/Kconfig+0−14

This diff is large: its 15 lines aren’t shown here.

drivers/staging/media/atomisp/pci/Makefile+0−5

This diff is large: its 6 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/Makefile+0−349

This diff is large: its 350 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp-regs.h+0−205

This diff is large: its 206 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c+0−604

This diff is large: its 605 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.h+0−120

This diff is large: its 121 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c+0−6696

This diff is large: its 6697 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.h+0−446

This diff is large: its 447 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_common.h+0−75

This diff is large: its 76 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat.h+0−662

This diff is large: its 663 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.c+0−4704

This diff is large: its 4705 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_css20.h+0−277

This diff is large: its 278 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c+0−1259

This diff is large: its 1260 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.h+0−365

This diff is large: its 366 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.c+0−442

This diff is large: its 443 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_csi2.h+0−57

This diff is large: its 58 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_dfs_tables.h+0−408

This diff is large: its 409 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.c+0−205

This diff is large: its 206 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.h+0−24

This diff is large: its 25 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.c+0−225

This diff is large: its 226 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_file.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c+0−1304

This diff is large: its 1305 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.h+0−50

This diff is large: its 51 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_helper.h+0−29

This diff is large: its 30 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_internal.h+0−310

This diff is large: its 311 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c+0−3124

This diff is large: its 3125 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.c+0−1422

This diff is large: its 1423 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_subdev.h+0−467

This diff is large: its 468 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_tables.h+0−187

This diff is large: its 188 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.c+0−164

This diff is large: its 165 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_tpg.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_trace_event.h+0−129

This diff is large: its 130 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c+0−1573

This diff is large: its 1574 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/Makefile+0−2

This diff is large: its 3 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf.h+0−376

This diff is large: its 377 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_comm.h+0−56

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/interface/ia_css_circbuf_desc.h+0−169

This diff is large: its 170 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/base/circbuf/src/circbuf.c+0−321

This diff is large: its 322 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/base/refcount/interface/ia_css_refcount.h+0−83

This diff is large: its 84 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/base/refcount/src/refcount.c+0−281

This diff is large: its 282 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/interface/ia_css_pipe_binarydesc.h+0−297

This diff is large: its 298 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/interface/ia_css_pipe_stagedesc.h+0−52

This diff is large: its 53 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/interface/ia_css_pipe_util.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_binarydesc.c+0−880

This diff is large: its 881 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_stagedesc.c+0−115

This diff is large: its 116 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/pipe/src/pipe_util.c+0−51

This diff is large: its 52 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/interface/ia_css_util.h+0−141

This diff is large: its 142 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/camera/util/src/util.c+0−227

This diff is large: its 228 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_configs.c+0−360

This diff is large: its 361 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_configs.h+0−189

This diff is large: its 190 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_params.c+0−3221

This diff is large: its 3222 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_params.h+0−399

This diff is large: its 400 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_states.c+0−214

This diff is large: its 215 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hive_isp_css_2400_system_generated/ia_css_isp_states.h+0−72

This diff is large: its 73 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/bits.h+0−104

This diff is large: its 105 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/cell_params.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/css_receiver_2400_common_defs.h+0−200

This diff is large: its 201 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/css_receiver_2400_defs.h+0−258

This diff is large: its 259 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/defs.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/dma_v2_defs.h+0−199

This diff is large: its 200 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gdc_v2_defs.h+0−170

This diff is large: its 171 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gp_timer_defs.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/gpio_block_defs.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_defs.h+0−416

This diff is large: its 417 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_host_ids_hrt.h+0−84

This diff is large: its 85 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_irq_types_hrt.h+0−72

This diff is large: its 73 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_isp_css_streaming_to_mipi_types_hrt.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/hive_types.h+0−128

This diff is large: its 129 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/if_defs.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_formatter_subsystem_defs.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_selector_defs.h+0−89

This diff is large: its 90 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_switch_2400_defs.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_system_ctrl_defs.h+0−254

This diff is large: its 255 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/input_system_defs.h+0−126

This diff is large: its 127 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/irq_controller_defs.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp2400_mamoiada_params.h+0−254

This diff is large: its 255 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp2400_support.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp_acquisition_defs.h+0−234

This diff is large: its 235 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/isp_capture_defs.h+0−310

This diff is large: its 311 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/mmu_defs.h+0−23

This diff is large: its 24 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/scalar_processor_2400_params.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/str2mem_defs.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/streaming_to_mipi_defs.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/timed_controller_defs.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/var.h+0−74

This diff is large: its 75 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/hrt/version.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2400_system/spmem_dump.c+0−3634

This diff is large: its 3635 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/csi_rx_global.h+0−63

This diff is large: its 64 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_configs.c+0−360

This diff is large: its 361 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_configs.h+0−189

This diff is large: its 190 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_params.c+0−3220

This diff is large: its 3221 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_params.h+0−399

This diff is large: its 400 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_states.c+0−214

This diff is large: its 215 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hive_isp_css_2401_system_csi2p_generated/ia_css_isp_states.h+0−72

This diff is large: its 73 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx.c+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_local.h+0−61

This diff is large: its 62 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/csi_rx_private.h+0−282

This diff is large: its 283 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/ibuf_ctrl.c+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/ibuf_ctrl_local.h+0−58

This diff is large: its 59 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/ibuf_ctrl_private.h+0−233

This diff is large: its 234 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/input_system_local.h+0−106

This diff is large: its 107 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/input_system_private.h+0−128

This diff is large: its 129 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_dma.c+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_dma_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_dma_private.h+0−60

This diff is large: its 61 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_irq.c+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_irq_local.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_irq_private.h+0−108

This diff is large: its 109 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_stream2mmio.c+0−21

This diff is large: its 22 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_stream2mmio_local.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/isys_stream2mmio_private.h+0−168

This diff is large: its 169 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/pixelgen_local.h+0−50

This diff is large: its 51 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/pixelgen_private.h+0−164

This diff is large: its 165 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/host/system_local.h+0−381

This diff is large: its 382 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/PixelGen_SysBlock_defs.h+0−126

This diff is large: its 127 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/bits.h+0−104

This diff is large: its 105 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/cell_params.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/css_receiver_2400_common_defs.h+0−200

This diff is large: its 201 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/css_receiver_2400_defs.h+0−258

This diff is large: its 259 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/defs.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/dma_v2_defs.h+0−199

This diff is large: its 200 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gdc_v2_defs.h+0−170

This diff is large: its 171 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gp_timer_defs.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/gpio_block_defs.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_2401_irq_types_hrt.h+0−68

This diff is large: its 69 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_defs.h+0−435

This diff is large: its 436 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_host_ids_hrt.h+0−119

This diff is large: its 120 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_isp_css_streaming_to_mipi_types_hrt.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/hive_types.h+0−128

This diff is large: its 129 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/ibuf_cntrl_defs.h+0−138

This diff is large: its 139 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/if_defs.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_formatter_subsystem_defs.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_selector_defs.h+0−89

This diff is large: its 90 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_switch_2400_defs.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_system_ctrl_defs.h+0−254

This diff is large: its 255 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/input_system_defs.h+0−126

This diff is large: its 127 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/irq_controller_defs.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp2400_support.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp2401_mamoiada_params.h+0−258

This diff is large: its 259 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp_acquisition_defs.h+0−234

This diff is large: its 235 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/isp_capture_defs.h+0−310

This diff is large: its 311 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/mipi_backend_common_defs.h+0−210

This diff is large: its 211 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/mipi_backend_defs.h+0−215

This diff is large: its 216 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/mmu_defs.h+0−23

This diff is large: its 24 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/rx_csi_defs.h+0−175

This diff is large: its 176 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/scalar_processor_2400_params.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/str2mem_defs.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/stream2mmio_defs.h+0−71

This diff is large: its 72 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/streaming_to_mipi_defs.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/timed_controller_defs.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/var.h+0−99

This diff is large: its 100 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/hrt/version.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/ibuf_ctrl_global.h+0−80

This diff is large: its 81 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/input_system_global.h+0−206

This diff is large: its 207 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/isys_dma_global.h+0−87

This diff is large: its 88 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/isys_irq_global.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/isys_stream2mmio_global.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/pixelgen_global.h+0−91

This diff is large: its 92 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/spmem_dump.c+0−3686

This diff is large: its 3687 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_csi2p_system/system_global.h+0−458

This diff is large: its 459 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_configs.c+0−360

This diff is large: its 361 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_configs.h+0−189

This diff is large: its 190 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_params.c+0−3220

This diff is large: its 3221 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_params.h+0−399

This diff is large: its 400 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_states.c+0−214

This diff is large: its 215 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hive_isp_css_2401_system_generated/ia_css_isp_states.h+0−72

This diff is large: its 73 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/bits.h+0−104

This diff is large: its 105 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/cell_params.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/css_receiver_2400_common_defs.h+0−200

This diff is large: its 201 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/css_receiver_2400_defs.h+0−258

This diff is large: its 259 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/defs.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/dma_v2_defs.h+0−199

This diff is large: its 200 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gdc_v2_defs.h+0−170

This diff is large: its 171 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gp_timer_defs.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/gpio_block_defs.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_2401_irq_types_hrt.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_defs.h+0−435

This diff is large: its 436 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_host_ids_hrt.h+0−119

This diff is large: its 120 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_isp_css_streaming_to_mipi_types_hrt.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/hive_types.h+0−128

This diff is large: its 129 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/if_defs.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_formatter_subsystem_defs.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_selector_defs.h+0−89

This diff is large: its 90 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_switch_2400_defs.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_system_ctrl_defs.h+0−254

This diff is large: its 255 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/input_system_defs.h+0−126

This diff is large: its 127 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/irq_controller_defs.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp2400_support.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp2401_mamoiada_params.h+0−258

This diff is large: its 259 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp_acquisition_defs.h+0−234

This diff is large: its 235 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/isp_capture_defs.h+0−310

This diff is large: its 311 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/mmu_defs.h+0−23

This diff is large: its 24 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/scalar_processor_2400_params.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/str2mem_defs.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/streaming_to_mipi_defs.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/timed_controller_defs.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/var.h+0−99

This diff is large: its 100 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/hrt/version.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_2401_system/spmem_dump.c+0−3634

This diff is large: its 3635 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/css_trace.h+0−388

This diff is large: its 389 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/debug_global.h+0−83

This diff is large: its 84 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/dma_global.h+0−255

This diff is large: its 256 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/event_fifo_global.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/fifo_monitor_global.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gdc_global.h+0−90

This diff is large: its 91 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gp_device_global.h+0−85

This diff is large: its 86 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gp_timer_global.h+0−33

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/gpio_global.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/hmem_global.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug.c+0−72

This diff is large: its 73 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug_local.h+0−21

This diff is large: its 22 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/debug_private.h+0−99

This diff is large: its 100 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma.c+0−299

This diff is large: its 300 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma_local.h+0−207

This diff is large: its 208 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/dma_private.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo.c+0−19

This diff is large: its 20 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_local.h+0−57

This diff is large: its 58 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/event_fifo_private.h+0−75

This diff is large: its 76 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor.c+0−567

This diff is large: its 568 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_local.h+0−99

This diff is large: its 100 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/fifo_monitor_private.h+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc.c+0−127

This diff is large: its 128 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gdc_private.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device.c+0−108

This diff is large: its 109 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_local.h+0−143

This diff is large: its 144 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_device_private.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer.c+0−70

This diff is large: its 71 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer_local.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gp_timer_private.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/gpio_private.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem.c+0−19

This diff is large: its 20 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/hmem_private.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter.c+0−228

This diff is large: its 229 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_local.h+0−120

This diff is large: its 121 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_formatter_private.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system.c+0−1823

This diff is large: its 1824 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_local.h+0−533

This diff is large: its 534 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/input_system_private.h+0−116

This diff is large: its 117 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq.c+0−448

This diff is large: its 449 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_local.h+0−136

This diff is large: its 137 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/irq_private.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp.c+0−129

This diff is large: its 130 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp_local.h+0−57

This diff is large: its 58 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/isp_private.h+0−157

This diff is large: its 158 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c+0−50

This diff is large: its 51 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp.c+0−81

This diff is large: its 82 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_local.h+0−101

This diff is large: its 102 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/sp_private.h+0−163

This diff is large: its 164 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/system_local.h+0−306

This diff is large: its 307 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/timed_ctrl.c+0−74

This diff is large: its 75 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/timed_ctrl_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/timed_ctrl_private.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vamem_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vamem_private.h+0−37

This diff is large: its 38 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vmem.c+0−258

This diff is large: its 259 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vmem_local.h+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/vmem_private.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_formatter_global.h+0−114

This diff is large: its 115 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/input_system_global.h+0−155

This diff is large: its 156 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/irq_global.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/isp_global.h+0−115

This diff is large: its 116 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/mmu_global.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/sp_global.h+0−93

This diff is large: its 94 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/system_global.h+0−348

This diff is large: its 349 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/timed_ctrl_global.h+0−56

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/vamem_global.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/vmem_global.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/assert_support.h+0−102

This diff is large: its 103 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/bitop_support.h+0−25

This diff is large: its 26 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/csi_rx.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/debug.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/device_access/device_access.h+0−194

This diff is large: its 195 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/dma.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/error_support.h+0−70

This diff is large: its 71 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/event_fifo.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/fifo_monitor.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gdc_device.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_device.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gp_timer.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/gpio.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/hmem.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/csi_rx_public.h+0−135

This diff is large: its 136 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/debug_public.h+0−99

This diff is large: its 100 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/dma_public.h+0−73

This diff is large: its 74 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/event_fifo_public.h+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/fifo_monitor_public.h+0−110

This diff is large: its 111 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gdc_public.h+0−59

This diff is large: its 60 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gp_device_public.h+0−58

This diff is large: its 59 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gp_timer_public.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/gpio_public.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/hmem_public.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/ibuf_ctrl_public.h+0−93

This diff is large: its 94 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_formatter_public.h+0−115

This diff is large: its 116 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/input_system_public.h+0−376

This diff is large: its 377 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/irq_public.h+0−184

This diff is large: its 185 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_public.h+0−186

This diff is large: its 187 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_dma_public.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_irq_public.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_public.h+0−37

This diff is large: its 38 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isys_stream2mmio_public.h+0−101

This diff is large: its 102 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h+0−82

This diff is large: its 83 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/pixelgen_public.h+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/sp_public.h+0−223

This diff is large: its 224 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/tag_public.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/timed_ctrl_public.h+0−59

This diff is large: its 60 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/vamem_public.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/vmem_public.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/ibuf_ctrl.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_formatter.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/input_system.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/irq.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isp.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_dma.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_irq.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/isys_stream2mmio.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/math_support.h+0−223

This diff is large: its 224 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/memory_access/memory_access.h+0−174

This diff is large: its 175 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/memory_realloc.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/misc_support.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/pixelgen.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/platform_support.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/print_support.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/queue.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/resource.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/socket.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/sp.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/string_support.h+0−165

This diff is large: its 166 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/system_types.h+0−25

This diff is large: its 26 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/tag.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/timed_ctrl.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/type_support.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vamem.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/vmem.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/queue_local.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/queue_private.h+0−18

This diff is large: its 19 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/tag.c+0−95

This diff is large: its 96 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/tag_local.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/host/tag_private.h+0−18

This diff is large: its 19 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/queue_global.h+0−19

This diff is large: its 20 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/sw_event_global.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_shared/tag_global.h+0−56

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css.h+0−57

This diff is large: its 58 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_3a.h+0−188

This diff is large: its 189 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_acc_types.h+0−468

This diff is large: its 469 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_buffer.h+0−84

This diff is large: its 85 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_control.h+0−157

This diff is large: its 158 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_device_access.c+0−95

This diff is large: its 96 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_device_access.h+0−59

This diff is large: its 60 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_dvs.h+0−299

This diff is large: its 300 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_env.h+0−94

This diff is large: its 95 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_err.h+0−63

This diff is large: its 64 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_event_public.h+0−196

This diff is large: its 197 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_firmware.h+0−74

This diff is large: its 75 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frac.h+0−37

This diff is large: its 38 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_format.h+0−101

This diff is large: its 102 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_frame_public.h+0−352

This diff is large: its 353 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_host_data.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_input_port.h+0−60

This diff is large: its 61 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_irq.h+0−235

This diff is large: its 236 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_memory_access.c+0−83

This diff is large: its 84 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_metadata.h+0−71

This diff is large: its 72 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mipi.h+0−82

This diff is large: its 83 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_mmu_private.h+0−29

This diff is large: its 30 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_morph.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe.h+0−195

This diff is large: its 196 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_pipe_public.h+0−579

This diff is large: its 580 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_prbs.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_properties.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_shading.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream.h+0−110

This diff is large: its 111 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_format.h+0−29

This diff is large: its 30 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_stream_public.h+0−582

This diff is large: its 583 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_timer.h+0−84

This diff is large: its 85 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_tpg.h+0−78

This diff is large: its 79 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_types.h+0−616

This diff is large: its 617 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_version.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/ia_css_version_data.h+0−33

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2.host.c+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2.host.h+0−27

This diff is large: its 28 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2_param.h+0−24

This diff is large: its 25 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/aa/aa_2/ia_css_aa2_types.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr.host.c+0−60

This diff is large: its 61 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr.host.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr_param.h+0−25

This diff is large: its 26 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_1.0/ia_css_anr_types.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2.host.c+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2.host.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2_table.host.c+0−52

This diff is large: its 53 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2_table.host.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr2_types.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/anr/anr_2/ia_css_anr_param.h+0−27

This diff is large: its 28 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh.host.c+0−66

This diff is large: its 67 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh.host.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh_param.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bh/bh_2/ia_css_bh_types.h+0−37

This diff is large: its 38 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.c+0−183

This diff is large: its 184 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm.host.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_param.h+0−63

This diff is large: its 64 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnlm/ia_css_bnlm_types.h+0−106

This diff is large: its 107 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2.host.c+0−122

This diff is large: its 123 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2.host.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2_param.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr2_2/ia_css_bnr2_2_types.h+0−71

This diff is large: its 72 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.c+0−64

This diff is large: its 65 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr_1.0/ia_css_bnr.host.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bnr/bnr_1.0/ia_css_bnr_param.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr.host.c+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr.host.h+0−25

This diff is large: its 26 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_1.0/ia_css_cnr_param.h+0−24

This diff is large: its 25 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2.host.c+0−76

This diff is large: its 77 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2.host.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2_param.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr2_types.h+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/cnr/cnr_2/ia_css_cnr_param.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion.host.c+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion.host.h+0−33

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion_param.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/conversion/conversion_1.0/ia_css_conversion_types.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/copy_output/copy_output_1.0/ia_css_copy_output.host.c+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/copy_output/copy_output_1.0/ia_css_copy_output.host.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/copy_output/copy_output_1.0/ia_css_copy_output_param.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop.host.c+0−64

This diff is large: its 65 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop.host.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop_param.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/crop/crop_1.0/ia_css_crop_types.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc.host.c+0−132

This diff is large: its 133 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc.host.h+0−54

This diff is large: its 55 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc_param.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/csc/csc_1.0/ia_css_csc_types.h+0−78

This diff is large: its 79 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5.host.c+0−120

This diff is large: its 121 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5.host.h+0−33

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc1_5_param.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc1_5/ia_css_ctc_param.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2.host.c+0−156

This diff is large: its 157 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2.host.h+0−33

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2_param.h+0−49

This diff is large: its 50 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc2/ia_css_ctc2_types.h+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc.host.c+0−63

This diff is large: its 64 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc.host.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_param.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.c+0−215

This diff is large: its 216 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_table.host.h+0−24

This diff is large: its 25 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ctc/ctc_1.0/ia_css_ctc_types.h+0−110

This diff is large: its 111 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de.host.c+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de.host.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de_param.h+0−27

This diff is large: its 28 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de_state.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_1.0/ia_css_de_types.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2.host.c+0−54

This diff is large: its 55 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2.host.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2_param.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de2_types.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de_param.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/de/de_2/ia_css_de_state.h+0−21

This diff is large: its 22 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp.host.c+0−132

This diff is large: its 133 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp.host.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp_param.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dp/dp_1.0/ia_css_dp_types.h+0−50

This diff is large: its 51 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.c+0−65

This diff is large: its 66 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2.host.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_param.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dpc2/ia_css_dpc2_types.h+0−59

This diff is large: its 60 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.c+0−306

This diff is large: its 307 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs.host.h+0−60

This diff is large: its 61 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs_param.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/dvs/dvs_1.0/ia_css_dvs_types.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c+0−321

This diff is large: its 322 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_param.h+0−154

This diff is large: its 155 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8_types.h+0−86

This diff is large: its 87 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats.host.c+0−62

This diff is large: its 63 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats.host.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats_param.h+0−25

This diff is large: its 26 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fc/fc_1.0/ia_css_formats_types.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_param.h+0−33

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_types.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.c+0−89

This diff is large: its 90 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn.host.h+0−44

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn_param.h+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/fpn/fpn_1.0/ia_css_fpn_types.h+0−52

This diff is large: its 53 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc.host.c+0−118

This diff is large: its 119 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc.host.h+0−65

This diff is large: its 66 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_param.h+0−61

This diff is large: its 62 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.c+0−214

This diff is large: its 215 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_table.host.h+0−24

This diff is large: its 25 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_1.0/ia_css_gc_types.h+0−97

This diff is large: its 98 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2.host.c+0−110

This diff is large: its 111 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2.host.h+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_param.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_table.host.c+0−132

This diff is large: its 133 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_table.host.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/gc/gc_2/ia_css_gc2_types.h+0−54

This diff is large: its 55 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr.host.c+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr.host.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr_param.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/hdr/ia_css_hdr_types.h+0−64

This diff is large: its 65 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io.host.c+0−86

This diff is large: its 87 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io.host.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io_param.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/bayer_io_ls/ia_css_bayer_io_types.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/common/ia_css_common_io_param.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/common/ia_css_common_io_types.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv444_io_ls/ia_css_yuv444_io_param.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv444_io_ls/ia_css_yuv444_io_types.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c+0−86

This diff is large: its 87 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io_param.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io_types.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/common/ia_css_common_io_param.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/common/ia_css_common_io_types.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c+0−86

This diff is large: its 87 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io_param.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io_types.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.c+0−80

This diff is large: its 81 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/iterator/iterator_1.0/ia_css_iterator.host.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/iterator/iterator_1.0/ia_css_iterator_param.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5.host.c+0−74

This diff is large: its 75 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5.host.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_param.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_table.host.c+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_table.host.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc1_5/ia_css_macc1_5_types.h+0−74

This diff is large: its 75 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc.host.c+0−49

This diff is large: its 50 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc.host.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_param.h+0−25

This diff is large: its 26 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_table.host.c+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_table.host.h+0−23

This diff is large: its 24 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/macc/macc_1.0/ia_css_macc_types.h+0−63

This diff is large: its 64 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm.host.c+0−16

This diff is large: its 17 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm.host.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/norm/norm_1.0/ia_css_norm_param.h+0−19

This diff is large: its 20 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2.host.c+0−79

This diff is large: its 80 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2.host.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2_param.h+0−29

This diff is large: its 30 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob2/ia_css_ob2_types.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob.host.c+0−159

This diff is large: its 160 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob.host.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob_param.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ob/ob_1.0/ia_css_ob_types.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.c+0−162

This diff is large: its 163 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output.host.h+0−75

This diff is large: its 76 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output_param.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/output/output_1.0/ia_css_output_types.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane.host.c+0−61

This diff is large: its 62 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane.host.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane_param.h+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/qplane/qplane_2/ia_css_qplane_types.h+0−33

This diff is large: its 34 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.c+0−136

This diff is large: its 137 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw.host.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_param.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw/raw_1.0/ia_css_raw_types.h+0−37

This diff is large: its 38 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.c+0−35

This diff is large: its 36 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/raw_aa_binning/raw_aa_binning_1.0/ia_css_raa.host.h+0−27

This diff is large: its 28 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref.host.c+0−74

This diff is large: its 75 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref.host.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref_param.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref_state.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ref/ref_1.0/ia_css_ref_types.h+0−28

This diff is large: its 29 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.c+0−386

This diff is large: its 387 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a.host.h+0−77

This diff is large: its 78 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_param.h+0−54

This diff is large: its 55 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a/s3a_1.0/ia_css_s3a_types.h+0−220

This diff is large: its 221 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc.host.c+0−130

This diff is large: its 131 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc.host.h+0−77

This diff is large: its 78 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc_param.h+0−71

This diff is large: its 72 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sc/sc_1.0/ia_css_sc_types.h+0−136

This diff is large: its 137 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common.host.h+0−99

This diff is large: its 100 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/common/ia_css_sdis_common_types.h+0−219

This diff is large: its 220 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.c+0−423

This diff is large: its 424 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis.host.h+0−101

This diff is large: its 102 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_1.0/ia_css_sdis_types.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.c+0−338

This diff is large: its 339 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2.host.h+0−95

This diff is large: its 96 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/sdis/sdis_2/ia_css_sdis2_types.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.c+0−76

This diff is large: its 77 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf.host.h+0−38

This diff is large: its 39 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_param.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tdf/tdf_1.0/ia_css_tdf_types.h+0−53

This diff is large: its 54 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr3/ia_css_tnr3_types.h+0−61

This diff is large: its 62 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.c+0−130

This diff is large: its 131 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr.host.h+0−56

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr_param.h+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr_state.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/tnr/tnr_1.0/ia_css_tnr_types.h+0−60

This diff is large: its 61 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/uds/uds_1.0/ia_css_uds_param.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.c+0−140

This diff is large: its 141 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf.host.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf_param.h+0−37

This diff is large: its 38 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/vf/vf_1.0/ia_css_vf_types.h+0−32

This diff is large: its 33 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb.host.c+0−89

This diff is large: its 90 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb.host.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb_param.h+0−29

This diff is large: its 30 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/wb/wb_1.0/ia_css_wb_types.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr.host.c+0−66

This diff is large: its 67 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr.host.h+0−47

This diff is large: its 48 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_param.h+0−51

This diff is large: its 52 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.c+0−81

This diff is large: its 82 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_table.host.h+0−22

This diff is large: its 23 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_1.0/ia_css_xnr_types.h+0−71

This diff is large: its 72 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.c+0−265

This diff is large: its 266 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3_param.h+0−96

This diff is large: its 97 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/xnr/xnr_3.0/ia_css_xnr3_types.h+0−98

This diff is large: its 99 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr.host.c+0−219

This diff is large: its 220 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr.host.h+0−60

This diff is large: its 61 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr_param.h+0−49

This diff is large: its 50 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr_state.h+0−26

This diff is large: its 27 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_1.0/ia_css_ynr_types.h+0−81

This diff is large: its 82 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2.host.c+0−125

This diff is large: its 126 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2.host.h+0−56

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2_param.h+0−45

This diff is large: its 46 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr2_types.h+0−94

This diff is large: its 95 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr_param.h+0−20

This diff is large: its 21 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ynr/ynr_2/ia_css_ynr_state.h+0−21

This diff is large: its 22 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/input_buf.isp.h+0−73

This diff is large: its 74 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_const.h+0−482

This diff is large: its 483 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/modes/interface/isp_types.h+0−128

This diff is large: its 129 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/memory_realloc.c+0−81

This diff is large: its 82 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/interface/ia_css_binary.h+0−257

This diff is large: its 258 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/binary/src/binary.c+0−1838

This diff is large: its 1839 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/interface/ia_css_bufq.h+0−197

This diff is large: its 198 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/interface/ia_css_bufq_comm.h+0−66

This diff is large: its 67 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/bufq/src/bufq.c+0−589

This diff is large: its 590 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug.h+0−509

This diff is large: its 510 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug_internal.h+0−31

This diff is large: its 32 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/interface/ia_css_debug_pipe.h+0−84

This diff is large: its 85 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/debug/src/ia_css_debug.c+0−3596

This diff is large: its 3597 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/event/interface/ia_css_event.h+0−46

This diff is large: its 47 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/event/src/event.c+0−126

This diff is large: its 127 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/eventq/interface/ia_css_eventq.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/eventq/src/eventq.c+0−77

This diff is large: its 78 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/interface/ia_css_frame.h+0−180

This diff is large: its 181 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/interface/ia_css_frame_comm.h+0−132

This diff is large: its 133 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/frame/src/frame.c+0−1026

This diff is large: its 1027 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/interface/ia_css_ifmtr.h+0−49

This diff is large: its 50 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/ifmtr/src/ifmtr.c+0−569

This diff is large: its 570 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/interface/ia_css_inputfifo.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/inputfifo/src/inputfifo.c+0−613

This diff is large: its 614 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param.h+0−118

This diff is large: its 119 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/interface/ia_css_isp_param_types.h+0−98

This diff is large: its 99 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isp_param/src/isp_param.c+0−227

This diff is large: its 228 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys.h+0−201

This diff is large: its 202 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/interface/ia_css_isys_comm.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.c+0−179

This diff is large: its 180 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/csi_rx_rmgr.h+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c+0−140

This diff is large: its 141 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.h+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.c+0−103

This diff is large: its 104 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_dma_rmgr.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_init.c+0−139

This diff is large: its 140 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_stream2mmio_rmgr.c+0−105

This diff is large: its 106 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/isys_stream2mmio_rmgr.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/rx.c+0−607

This diff is large: its 608 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.c+0−898

This diff is large: its 899 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/virtual_isys.h+0−41

This diff is large: its 42 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline.h+0−302

This diff is large: its 303 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline_common.h+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/src/pipeline.c+0−805

This diff is large: its 806 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/interface/ia_css_queue.h+0−192

This diff is large: its 193 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/interface/ia_css_queue_comm.h+0−69

This diff is large: its 70 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/src/queue.c+0−412

This diff is large: its 413 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/src/queue_access.c+0−192

This diff is large: its 193 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/queue/src/queue_access.h+0−101

This diff is large: its 102 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr.h+0−88

This diff is large: its 89 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/interface/ia_css_rmgr_vbuf.h+0−115

This diff is large: its 116 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr.c+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/rmgr/src/rmgr_vbuf.c+0−330

This diff is large: its 331 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/interface/ia_css_spctrl.h+0−87

This diff is large: its 88 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/interface/ia_css_spctrl_comm.h+0−61

This diff is large: its 62 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/spctrl/src/spctrl.c+0−193

This diff is large: its 194 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/tagger/interface/ia_css_tagger_common.h+0−59

This diff is large: its 60 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/timer/src/timer.c+0−48

This diff is large: its 49 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css.c+0−11094

This diff is large: its 11095 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_defs.h+0−410

This diff is large: its 411 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_dvs_info.h+0−36

This diff is large: its 37 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c+0−315

This diff is large: its 316 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.h+0−54

This diff is large: its 55 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_frac.h+0−40

This diff is large: its 41 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_host_data.c+0−42

This diff is large: its 43 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.c+0−84

This diff is large: its 85 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_hrt.h+0−34

This diff is large: its 35 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_internal.h+0−1089

This diff is large: its 1090 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_legacy.h+0−77

This diff is large: its 78 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metadata.c+0−16

This diff is large: its 17 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.c+0−176

This diff is large: its 177 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_metrics.h+0−55

This diff is large: its 56 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.c+0−749

This diff is large: its 750 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mipi.h+0−49

This diff is large: its 50 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_mmu.c+0−56

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_morph.c+0−16

This diff is large: its 17 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_dvs.c+0−267

This diff is large: its 268 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_dvs.h+0−86

This diff is large: its 87 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.c+0−417

This diff is large: its 418 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_param_shading.h+0−39

This diff is large: its 40 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c+0−5253

This diff is large: its 5254 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.h+0−188

This diff is large: its 189 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params_internal.h+0−21

This diff is large: its 22 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_pipe.c+0−16

This diff is large: its 17 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_properties.c+0−43

This diff is large: its 44 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_shading.c+0−16

This diff is large: its 17 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.c+0−1803

This diff is large: its 1804 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_sp.h+0−248

This diff is large: its 249 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream.c+0−16

This diff is large: its 17 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.c+0−76

This diff is large: its 77 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.h+0−23

This diff is large: its 24 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_struct.h+0−80

This diff is large: its 81 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_uds.h+0−37

This diff is large: its 38 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_version.c+0−30

This diff is large: its 31 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c+0−727

This diff is large: its 728 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c+0−1528

This diff is large: its 1529 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_dynamic_pool.c+0−233

This diff is large: its 234 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_reserved_pool.c+0−252

This diff is large: its 253 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_vm.c+0−212

This diff is large: its 213 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_custom_host_hrt.h+0−103

This diff is large: its 104 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c+0−125

This diff is large: its 126 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h+0−56

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm.h+0−102

This diff is large: its 103 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_bo.h+0−319

This diff is large: its 320 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_common.h+0−96

This diff is large: its 97 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_pool.h+0−115

This diff is large: its 116 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/include/hmm/hmm_vm.h+0−64

This diff is large: its 65 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/include/mmu/isp_mmu.h+0−169

This diff is large: its 170 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/include/mmu/sh_mmu_mrfld.h+0−24

This diff is large: its 25 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/mmu/isp_mmu.c+0−584

This diff is large: its 585 lines aren’t shown here.

drivers/staging/media/atomisp/pci/atomisp2/mmu/sh_mmu_mrfld.c+0−75

This diff is large: its 76 lines aren’t shown here.

drivers/staging/media/atomisp/platform/Makefile+0−5

This diff is large: its 6 lines aren’t shown here.

drivers/staging/media/atomisp/platform/intel-mid/Makefile+0−4

This diff is large: its 5 lines aren’t shown here.

drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c+0−785

This diff is large: its 786 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/Kconfig+2−2

This diff is large: its 10 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/Makefile+5−0

This diff is large: its 9 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/TODO+1−0

This diff is large: its 8 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/dm365_ipipe.c+65−78

This diff is large: its 253 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c+3−16

This diff is large: its 58 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/dm365_ipipeif.c+7−7

This diff is large: its 57 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/dm365_isif.c+2−7

This diff is large: its 17 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/dm365_resizer.c+8−7

This diff is large: its 45 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c+1−1

This diff is large: its 9 lines aren’t shown here.

drivers/staging/media/davinci_vpfe/vpfe_video.c+1−3

This diff is large: its 25 lines aren’t shown here.

drivers/staging/media/imx/imx-media-capture.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/media/imx/imx-media-csi.c+2−1

This diff is large: its 10 lines aren’t shown here.

drivers/staging/media/imx/imx-media-utils.c+9−0

This diff is large: its 16 lines aren’t shown here.

drivers/staging/media/omap4iss/Kconfig+2−2

This diff is large: its 10 lines aren’t shown here.

drivers/staging/media/tegra-vde/tegra-vde.c+67−31

This diff is large: its 250 lines aren’t shown here.

drivers/staging/media/zoran/Kconfigrenamed from drivers/media/pci/zoran/Kconfig+1−1

This diff is large: its 7 lines aren’t shown here.

drivers/staging/media/zoran/Makefilerenamed from drivers/media/pci/zoran/Makefile+0−0

File renamed without changes.

drivers/staging/media/zoran/TODO+4−0

This diff is large: its 5 lines aren’t shown here.

drivers/staging/media/zoran/videocodec.crenamed from drivers/media/pci/zoran/videocodec.c+0−0

File renamed without changes.

drivers/staging/media/zoran/videocodec.hrenamed from drivers/media/pci/zoran/videocodec.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zoran.hrenamed from drivers/media/pci/zoran/zoran.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zoran_card.crenamed from drivers/media/pci/zoran/zoran_card.c+0−0

File renamed without changes.

drivers/staging/media/zoran/zoran_card.hrenamed from drivers/media/pci/zoran/zoran_card.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zoran_device.crenamed from drivers/media/pci/zoran/zoran_device.c+0−0

File renamed without changes.

drivers/staging/media/zoran/zoran_device.hrenamed from drivers/media/pci/zoran/zoran_device.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zoran_driver.crenamed from drivers/media/pci/zoran/zoran_driver.c+2−2

This diff is large: its 11 lines aren’t shown here.

drivers/staging/media/zoran/zoran_procfs.crenamed from drivers/media/pci/zoran/zoran_procfs.c+0−0

File renamed without changes.

drivers/staging/media/zoran/zoran_procfs.hrenamed from drivers/media/pci/zoran/zoran_procfs.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zr36016.crenamed from drivers/media/pci/zoran/zr36016.c+0−0

File renamed without changes.

drivers/staging/media/zoran/zr36016.hrenamed from drivers/media/pci/zoran/zr36016.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zr36050.crenamed from drivers/media/pci/zoran/zr36050.c+0−0

File renamed without changes.

drivers/staging/media/zoran/zr36050.hrenamed from drivers/media/pci/zoran/zr36050.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zr36057.hrenamed from drivers/media/pci/zoran/zr36057.h+0−0

File renamed without changes.

drivers/staging/media/zoran/zr36060.crenamed from drivers/media/pci/zoran/zr36060.c+0−0

File renamed without changes.

drivers/staging/media/zoran/zr36060.hrenamed from drivers/media/pci/zoran/zr36060.h+0−0

File renamed without changes.

drivers/video/fbdev/omap2/Kconfig+1−1

This diff is large: its 6 lines aren’t shown here.

include/linux/omap-iommu.h+5−0

This diff is large: its 13 lines aren’t shown here.

include/linux/platform_data/media/mmp-camera.h+19−0

This diff is large: its 28 lines aren’t shown here.

include/linux/sony-laptop.h+4−0

This diff is large: its 12 lines aren’t shown here.

include/media/dvb-usb-ids.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/media/dvbdev.h+2−0

This diff is large: its 16 lines aren’t shown here.

include/media/media-entity.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/media/rc-core.h+1−0

This diff is large: its 8 lines aren’t shown here.

include/media/v4l2-dev.h+1−24

This diff is large: its 53 lines aren’t shown here.

include/media/v4l2-device.h+1−3

This diff is large: its 19 lines aren’t shown here.

include/media/v4l2-fwnode.h+1−1

This diff is large: its 9 lines aren’t shown here.

include/media/v4l2-ioctl.h+0−12

This diff is large: its 19 lines aren’t shown here.

include/media/videobuf-dvb.h+0−59

This diff is large: its 60 lines aren’t shown here.

include/media/vsp1.h+43−2

This diff is large: its 69 lines aren’t shown here.

include/uapi/linux/lirc.h+6−0

This diff is large: its 13 lines aren’t shown here.

include/uapi/linux/omap3isp.h+22−0

This diff is large: its 44 lines aren’t shown here.

include/video/omapfb_dss.h+52−2

This diff is large: its 81 lines aren’t shown here.

sound/isa/Kconfig+2−1

This diff is large: its 10 lines aren’t shown here.