staging: media: bring back zoran driver
Subsystems (3)
cover staging: media: bring back zoran driver
Hello
The zoran driver was removed in 5.3
The main reason of the removing was lack of motivation to convert it to VB2
Since I need it, I worked on bringing it back.
So the plan to achieve it was:
- clean up the coding style.
- convert old usage/API
- clean unused code
- convert to VB2
I have tried to split a bit the VB2 patch (by adding/removing code in another patch), but the result is unfortunately still a big patch.
The result of this serie is a working zoran driver. Furthermore it is now compliant to v4l-compliance.
In the process some old (useless) feature (fbuf, overlay) was removed for simplifying maintenance.
The zoran hardware support MJPEG decompression, but this feature is temporarily disabled by this serie.
But basically, this feature was unusable, since the only tool which permitted to use it was a mplayer option.
But this mplayer option no longer compile (probably since a long time) and is such a hack (a copy of some private ffmpeg structure) that it is unfixable. Happily, when I started to work on zoran, a patch was posted on ffmpeg ML which permit it to output non-raw video stream (and so MJPEG for zoran case). But the zoran hw does not like some part of JPEG header it receives, so a filter need to be written.
Anyway, this disabling is not a regression, since this feature was not usable since a long time.
Since the driver was in staging, I targeted staging, but probably the driver is in a sufficient good shape to target media and bypass staging.
This driver is tested on a DC10+ (on x86). Tests on different hardware are welcome.
I would like to thanks all people that helped me to achieve this (mostly #v4l)
Regards
Corentin Labbe (49):
staging: media: Revert "media: zoran: remove deprecated driver"
MAINTAINERS: change maintainer of the zoran driver
staging: media: zoran: datasheet is no longer available from zoran.com
staging: media: zoran: Documentation: fix typo
staging: media: zoran: fix checkpatch issue
staging: media: zoran: unsplit lines
staging: media: zoran: do not forward declare zr36057_init_vfe
staging: media: zoran: convert all error dprintk to pci_err/pr_err
staging: media: zoran: convert dprintk warn
staging: media: zoran: convert dprintk info to pci_info
staging: media: zoran: convert dprintk debug
staging: media: zoran: zoran_device.c: convert pr_x to pci_x
staging: media: zoran: remove proc_fs
staging: media: zoran: use VFL_TYPE_VIDEO
staging: media: zoran: use v4l2_buffer_set_timestamp
staging: media: zoran: do not print random guest 0
staging: media: zoran: move buffer_size out of zoran_fh
staging: media: zoran: move v4l_settings out of zoran_fh
staging: media: zoran: move jpg_settings out of zoran_fh
staging: media: zoran: move overlay_settings out of zoran_fh
staging: media: zoran: Use video_drvdata to get struct zoran
staging: media: zoran: Change zoran_v4l_set_format parameter from
zoran_fh to zoran
staging: media: zoran: remove overlay
staging: media: zoran: Use DMA coherent for stat_com
staging: media: zoran: use ZR_NORM
staging: media: zoran: zoran does not support STD_ALL
staging: media: zoran: convert irq to pci irq
staging: media: zoran: convert zoran alloc to devm
staging: media: zoran: convert mdelay to udelay
staging: media: zoran: use devm for videocodec_master alloc
staging: media: zoran: use pci_request_regions
staging: media: zoran: use devm_ioremap
staging: media: zoran: add stat_com buffer
staging: media: zoran: constify struct tvnorm
staging: media: zoran: constify codec_name
staging: media: zoran: Add more check for compliance
staging: media: zoran: add fallthrough keyword
staging: media: zoran: Add vb_queue
staging: media: zoran: disable output
staging: media: zoran: device support only 32bit DMA address
staging: media: zoran: enable makefile
staging: media: zoran: remove framebuffer support
staging: media: zoran: add vidioc_g_parm
staging: media: zoran: remove test_interrupts
staging: media: zoran: fix use of buffer_size and sizeimage
staging: media: zoran: fix some compliance test
staging: media: zoran: remove deprecated .vidioc_g_jpegcomp
staging: media: zoran: convert to vb2
staging: media: zoran: update TODO
Documentation/media/v4l-drivers/zoran.rst | 575 +++++++++ MAINTAINERS | 10 + drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/zoran/Kconfig | 76 ++ drivers/staging/media/zoran/Makefile | 7 + drivers/staging/media/zoran/TODO | 19 + drivers/staging/media/zoran/videocodec.c | 330 +++++ drivers/staging/media/zoran/videocodec.h | 308 +++++ drivers/staging/media/zoran/zoran.h | 320 +++++ drivers/staging/media/zoran/zoran_card.c | 1320 ++++++++++++++++++++ drivers/staging/media/zoran/zoran_card.h | 30 + drivers/staging/media/zoran/zoran_device.c | 1002 +++++++++++++++ drivers/staging/media/zoran/zoran_device.h | 64 + drivers/staging/media/zoran/zoran_driver.c | 1022 +++++++++++++++ drivers/staging/media/zoran/zr36016.c | 433 +++++++ drivers/staging/media/zoran/zr36016.h | 92 ++ drivers/staging/media/zoran/zr36050.c | 842 +++++++++++++ drivers/staging/media/zoran/zr36050.h | 163 +++ drivers/staging/media/zoran/zr36057.h | 154 +++ drivers/staging/media/zoran/zr36060.c | 872 +++++++++++++ drivers/staging/media/zoran/zr36060.h | 201 +++ 22 files changed, 7843 insertions(+) create mode 100644 Documentation/media/v4l-drivers/zoran.rst create mode 100644 drivers/staging/media/zoran/Kconfig create mode 100644 drivers/staging/media/zoran/Makefile create mode 100644 drivers/staging/media/zoran/TODO create mode 100644 drivers/staging/media/zoran/videocodec.c create mode 100644 drivers/staging/media/zoran/videocodec.h create mode 100644 drivers/staging/media/zoran/zoran.h create mode 100644 drivers/staging/media/zoran/zoran_card.c create mode 100644 drivers/staging/media/zoran/zoran_card.h create mode 100644 drivers/staging/media/zoran/zoran_device.c create mode 100644 drivers/staging/media/zoran/zoran_device.h create mode 100644 drivers/staging/media/zoran/zoran_driver.c create mode 100644 drivers/staging/media/zoran/zr36016.c create mode 100644 drivers/staging/media/zoran/zr36016.h create mode 100644 drivers/staging/media/zoran/zr36050.c create mode 100644 drivers/staging/media/zoran/zr36050.h create mode 100644 drivers/staging/media/zoran/zr36057.h create mode 100644 drivers/staging/media/zoran/zr36060.c create mode 100644 drivers/staging/media/zoran/zr36060.h
Signature · 1 line
2.26.2
PATCH 1/49 staging: media: Revert "media: zoran: remove deprecated driver"
This reverts commit 8dce4b265a5357731058f69645840dabc718c687.
The revert is slighly modified:
- Documentation/media/v4l-drivers/index.rst is ,ot restored since removed from tree
- drivers/staging/media/Makefile is not restored since the zoran driver is not compilable yet.
--- Documentation/media/v4l-drivers/zoran.rst | 583 ++++ drivers/staging/media/Kconfig | 2 + drivers/staging/media/zoran/Kconfig | 75 + drivers/staging/media/zoran/Makefile | 7 + drivers/staging/media/zoran/TODO | 4 + drivers/staging/media/zoran/videocodec.c | 391 +++ drivers/staging/media/zoran/videocodec.h | 349 +++ drivers/staging/media/zoran/zoran.h | 402 +++ drivers/staging/media/zoran/zoran_card.c | 1524 +++++++++++ drivers/staging/media/zoran/zoran_card.h | 50 + drivers/staging/media/zoran/zoran_device.c | 1619 +++++++++++ drivers/staging/media/zoran/zoran_device.h | 91 + drivers/staging/media/zoran/zoran_driver.c | 2850 ++++++++++++++++++++ drivers/staging/media/zoran/zoran_procfs.c | 221 ++ drivers/staging/media/zoran/zoran_procfs.h | 32 + drivers/staging/media/zoran/zr36016.c | 516 ++++ drivers/staging/media/zoran/zr36016.h | 107 + drivers/staging/media/zoran/zr36050.c | 896 ++++++ drivers/staging/media/zoran/zr36050.h | 179 ++ drivers/staging/media/zoran/zr36057.h | 164 ++ drivers/staging/media/zoran/zr36060.c | 1006 +++++++ drivers/staging/media/zoran/zr36060.h | 216 ++ 22 files changed, 11284 insertions(+) create mode 100644 Documentation/media/v4l-drivers/zoran.rst create mode 100644 drivers/staging/media/zoran/Kconfig create mode 100644 drivers/staging/media/zoran/Makefile create mode 100644 drivers/staging/media/zoran/TODO create mode 100644 drivers/staging/media/zoran/videocodec.c create mode 100644 drivers/staging/media/zoran/videocodec.h create mode 100644 drivers/staging/media/zoran/zoran.h create mode 100644 drivers/staging/media/zoran/zoran_card.c create mode 100644 drivers/staging/media/zoran/zoran_card.h create mode 100644 drivers/staging/media/zoran/zoran_device.c create mode 100644 drivers/staging/media/zoran/zoran_device.h create mode 100644 drivers/staging/media/zoran/zoran_driver.c create mode 100644 drivers/staging/media/zoran/zoran_procfs.c create mode 100644 drivers/staging/media/zoran/zoran_procfs.h create mode 100644 drivers/staging/media/zoran/zr36016.c create mode 100644 drivers/staging/media/zoran/zr36016.h create mode 100644 drivers/staging/media/zoran/zr36050.c create mode 100644 drivers/staging/media/zoran/zr36050.h create mode 100644 drivers/staging/media/zoran/zr36057.h create mode 100644 drivers/staging/media/zoran/zr36060.c create mode 100644 drivers/staging/media/zoran/zr36060.h
Documentation/media/v4l-drivers/zoran.rst new file +583 -0
@@ -0,0 +1,583 @@ +.. SPDX-License-Identifier: GPL-2.0 + +The Zoran driver +================ + +unified zoran driver (zr360x7, zoran, buz, dc10(+), dc30(+), lml33) + +website: http://mjpeg.sourceforge.net/driver-zoran/ + + +Frequently Asked Questions +-------------------------- + +What cards are supported +------------------------ + +Iomega Buz, Linux Media Labs LML33/LML33R10, Pinnacle/Miro +DC10/DC10+/DC30/DC30+ and related boards (available under various names). + +Iomega Buz +~~~~~~~~~~ + +* Zoran zr36067 PCI controller +* Zoran zr36060 MJPEG codec +* Philips saa7111 TV decoder +* Philips saa7185 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, saa7111, saa7185, zr36060, zr36067 + +Inputs/outputs: Composite and S-video + +Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) + +Card number: 7 + +AverMedia 6 Eyes AVS6EYES +~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Zoran zr36067 PCI controller +* Zoran zr36060 MJPEG codec +* Samsung ks0127 TV decoder +* Conexant bt866 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, ks0127, bt866, zr36060, zr36067 + +Inputs/outputs: + Six physical inputs. 1-6 are composite, + 1-2, 3-4, 5-6 doubles as S-video, + 1-3 triples as component. + One composite output. + +Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) + +Card number: 8 + +.. note:: + + Not autodetected, card=8 is necessary. + +Linux Media Labs LML33 +~~~~~~~~~~~~~~~~~~~~~~ + +* Zoran zr36067 PCI controller +* Zoran zr36060 MJPEG codec +* Brooktree bt819 TV decoder +* Brooktree bt856 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, bt819, bt856, zr36060, zr36067 + +Inputs/outputs: Composite and S-video + +Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) + +Card number: 5 + +Linux Media Labs LML33R10 +~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Zoran zr36067 PCI controller +* Zoran zr36060 MJPEG codec +* Philips saa7114 TV decoder +* Analog Devices adv7170 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, saa7114, adv7170, zr36060, zr36067 + +Inputs/outputs: Composite and S-video + +Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) + +Card number: 6 + +Pinnacle/Miro DC10(new) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Zoran zr36057 PCI controller +* Zoran zr36060 MJPEG codec +* Philips saa7110a TV decoder +* Analog Devices adv7176 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, saa7110, adv7175, zr36060, zr36067 + +Inputs/outputs: Composite, S-video and Internal + +Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) + +Card number: 1 + +Pinnacle/Miro DC10+ +~~~~~~~~~~~~~~~~~~~ + +* Zoran zr36067 PCI controller +* Zoran zr36060 MJPEG codec +* Philips saa7110a TV decoder +* Analog Devices adv7176 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, sa7110, adv7175, zr36060, zr36067 + +Inputs/outputs: Composite, S-video and Internal + +Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) + +Card number: 2 + +Pinnacle/Miro DC10(old) +~~~~~~~~~~~~~~~~~~~~~~~ + +* Zoran zr36057 PCI controller +* Zoran zr36050 MJPEG codec +* Zoran zr36016 Video Front End or Fuji md0211 Video Front End (clone?) +* Micronas vpx3220a TV decoder +* mse3000 TV encoder or Analog Devices adv7176 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, vpx3220, mse3000/adv7175, zr36050, zr36016, zr36067 + +Inputs/outputs: Composite, S-video and Internal + +Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) + +Card number: 0 + +Pinnacle/Miro DC30 +~~~~~~~~~~~~~~~~~~ + +* Zoran zr36057 PCI controller +* Zoran zr36050 MJPEG codec +* Zoran zr36016 Video Front End +* Micronas vpx3225d/vpx3220a/vpx3216b TV decoder +* Analog Devices adv7176 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36016, zr36067 + +Inputs/outputs: Composite, S-video and Internal + +Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) + +Card number: 3 + +Pinnacle/Miro DC30+ +~~~~~~~~~~~~~~~~~~~ + +* Zoran zr36067 PCI controller +* Zoran zr36050 MJPEG codec +* Zoran zr36016 Video Front End +* Micronas vpx3225d/vpx3220a/vpx3216b TV decoder +* Analog Devices adv7176 TV encoder + +Drivers to use: videodev, i2c-core, i2c-algo-bit, +videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36015, zr36067 + +Inputs/outputs: Composite, S-video and Internal + +Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) + +Card number: 4 + +.. note:: + + #) No module for the mse3000 is available yet + #) No module for the vpx3224 is available yet + +1.1 What the TV decoder can do an what not +------------------------------------------ + +The best know TV standards are NTSC/PAL/SECAM. but for decoding a frame that +information is not enough. There are several formats of the TV standards. +And not every TV decoder is able to handle every format. Also the every +combination is supported by the driver. There are currently 11 different +tv broadcast formats all aver the world. + +The CCIR defines parameters needed for broadcasting the signal. +The CCIR has defined different standards: A,B,D,E,F,G,D,H,I,K,K1,L,M,N,... +The CCIR says not much about the colorsystem used !!! +And talking about a colorsystem says not to much about how it is broadcast. + +The CCIR standards A,E,F are not used any more. + +When you speak about NTSC, you usually mean the standard: CCIR - M using +the NTSC colorsystem which is used in the USA, Japan, Mexico, Canada +and a few others. + +When you talk about PAL, you usually mean: CCIR - B/G using the PAL +colorsystem which is used in many Countries. + +When you talk about SECAM, you mean: CCIR - L using the SECAM Colorsystem +which is used in France, and a few others. + +There the other version of SECAM, CCIR - D/K is used in Bulgaria, China, +Slovakai, Hungary, Korea (Rep.), Poland, Rumania and a others. + +The CCIR - H uses the PAL colorsystem (sometimes SECAM) and is used in +Egypt, Libya, Sri Lanka, Syrain Arab. Rep. + +The CCIR - I uses the PAL colorsystem, and is used in Great Britain, Hong Kong, +Ireland, Nigeria, South Africa. + +The CCIR - N uses the PAL colorsystem and PAL frame size but the NTSC framerate, +and is used in Argentinia, Uruguay, an a few others + +We do not talk about how the audio is broadcast ! + +A rather good sites about the TV standards are: +http://www.sony.jp/support/ +http://info.electronicwerkstatt.de/bereiche/fernsehtechnik/frequenzen_und_normen/Fernsehnormen/ +and http://www.cabl.com/restaurant/channel.html + +Other weird things around: NTSC 4.43 is a modificated NTSC, which is mainly +used in PAL VCR's that are able to play back NTSC. PAL 60 seems to be the same +as NTSC 4.43 . The Datasheets also talk about NTSC 44, It seems as if it would +be the same as NTSC 4.43. +NTSC Combs seems to be a decoder mode where the decoder uses a comb filter +to split coma and luma instead of a Delay line. + +But I did not defiantly find out what NTSC Comb is. + +Philips saa7111 TV decoder +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1997, is used in the BUZ and +- can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC N, NTSC 4.43 and SECAM + +Philips saa7110a TV decoder +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1995, is used in the Pinnacle/Miro DC10(new), DC10+ and +- can handle: PAL B/G, NTSC M and SECAM + +Philips saa7114 TV decoder +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 2000, is used in the LML33R10 and +- can handle: PAL B/G/D/H/I/N, PAL N, PAL M, NTSC M, NTSC 4.43 and SECAM + +Brooktree bt819 TV decoder +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1996, and is used in the LML33 and +- can handle: PAL B/D/G/H/I, NTSC M + +Micronas vpx3220a TV decoder +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1996, is used in the DC30 and DC30+ and +- can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC 44, PAL 60, SECAM,NTSC Comb + +Samsung ks0127 TV decoder +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- is used in the AVS6EYES card and +- can handle: NTSC-M/N/44, PAL-M/N/B/G/H/I/D/K/L and SECAM + + +What the TV encoder can do an what not +-------------------------------------- + +The TV encoder are doing the "same" as the decoder, but in the oder direction. +You feed them digital data and the generate a Composite or SVHS signal. +For information about the colorsystems and TV norm take a look in the +TV decoder section. + +Philips saa7185 TV Encoder +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1996, is used in the BUZ +- can generate: PAL B/G, NTSC M + +Brooktree bt856 TV Encoder +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1994, is used in the LML33 +- can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL-N (Argentina) + +Analog Devices adv7170 TV Encoder +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 2000, is used in the LML300R10 +- can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL 60 + +Analog Devices adv7175 TV Encoder +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1996, is used in the DC10, DC10+, DC10 old, DC30, DC30+ +- can generate: PAL B/D/G/H/I/N, PAL M, NTSC M + +ITT mse3000 TV encoder +~~~~~~~~~~~~~~~~~~~~~~ + +- was introduced in 1991, is used in the DC10 old +- can generate: PAL , NTSC , SECAM + +Conexant bt866 TV encoder +~~~~~~~~~~~~~~~~~~~~~~~~~ + +- is used in AVS6EYES, and +- can generate: NTSC/PAL, PALM, PALN + +The adv717x, should be able to produce PAL N. But you find nothing PAL N +specific in the registers. Seem that you have to reuse a other standard +to generate PAL N, maybe it would work if you use the PAL M settings. + +How do I get this damn thing to work +------------------------------------ + +Load zr36067.o. If it can't autodetect your card, use the card=X insmod +option with X being the card number as given in the previous section. +To have more than one card, use card=X1[,X2[,X3,[X4[..]]]] + +To automate this, add the following to your /etc/modprobe.d/zoran.conf: + +options zr36067 card=X1[,X2[,X3[,X4[..]]]] +alias char-major-81-0 zr36067 + +One thing to keep in mind is that this doesn't load zr36067.o itself yet. It +just automates loading. If you start using xawtv, the device won't load on +some systems, since you're trying to load modules as a user, which is not +allowed ("permission denied"). A quick workaround is to add 'Load "v4l"' to +XF86Config-4 when you use X by default, or to run 'v4l-conf -c <device>' in +one of your startup scripts (normally rc.local) if you don't use X. Both +make sure that the modules are loaded on startup, under the root account. + +What mainboard should I use (or why doesn't my card work) +--------------------------------------------------------- + + +<insert lousy disclaimer here>. In short: good=SiS/Intel, bad=VIA. + +Experience tells us that people with a Buz, on average, have more problems +than users with a DC10+/LML33. Also, it tells us that people owning a VIA- +based mainboard (ktXXX, MVP3) have more problems than users with a mainboard +based on a different chipset. Here's some notes from Andrew Stevens: + +Here's my experience of using LML33 and Buz on various motherboards: + +- VIA MVP3 + - Forget it. Pointless. Doesn't work. +- Intel 430FX (Pentium 200) + - LML33 perfect, Buz tolerable (3 or 4 frames dropped per movie) +- Intel 440BX (early stepping) + - LML33 tolerable. Buz starting to get annoying (6-10 frames/hour) +- Intel 440BX (late stepping) + - Buz tolerable, LML3 almost perfect (occasional single frame drops) +- SiS735 + - LML33 perfect, Buz tolerable. +- VIA KT133(*) + - LML33 starting to get annoying, Buz poor enough that I have up. + +- Both 440BX boards were dual CPU versions. + +Bernhard Praschinger later added: + +- AMD 751 + - Buz perfect-tolerable +- AMD 760 + - Buz perfect-tolerable + +In general, people on the user mailinglist won't give you much of a chance +if you have a VIA-based motherboard. They may be cheap, but sometimes, you'd +rather want to spend some more money on better boards. In general, VIA +mainboard's IDE/PCI performance will also suck badly compared to others. +You'll noticed the DC10+/DC30+ aren't mentioned anywhere in the overview. +Basically, you can assume that if the Buz works, the LML33 will work too. If +the LML33 works, the DC10+/DC30+ will work too. They're most tolerant to +different mainboard chipsets from all of the supported cards. + +If you experience timeouts during capture, buy a better mainboard or lower +the quality/buffersize during capture (see 'Concerning buffer sizes, quality, +output size etc.'). If it hangs, there's little we can do as of now. Check +your IRQs and make sure the card has its own interrupts. + +Programming interface +--------------------- + +This driver conforms to video4linux2. Support for V4L1 and for the custom +zoran ioctls has been removed in kernel 2.6.38. + +For programming example, please, look at lavrec.c and lavplay.c code in +the MJPEG-tools (http://mjpeg.sf.net/). + +Additional notes for software developers: + + The driver returns maxwidth and maxheight parameters according to + the current TV standard (norm). Therefore, the software which + communicates with the driver and "asks" for these parameters should + first set the correct norm. Well, it seems logically correct: TV + standard is "more constant" for current country than geometry + settings of a variety of TV capture cards which may work in ITU or + square pixel format. + +Applications +------------ + +Applications known to work with this driver: + +TV viewing: + +* xawtv +* kwintv +* probably any TV application that supports video4linux or video4linux2. + +MJPEG capture/playback: + +* mjpegtools/lavtools (or Linux Video Studio) +* gstreamer +* mplayer + +General raw capture: + +* xawtv +* gstreamer +* probably any application that supports video4linux or video4linux2 + +Video editing: + +* Cinelerra +* MainActor +* mjpegtools (or Linux Video Studio) + + +Concerning buffer sizes, quality, output size etc. +-------------------------------------------------- + + +The zr36060 can do 1:2 JPEG compression. This is really the theoretical +maximum that the chipset can reach. The driver can, however, limit compression +to a maximum (size) of 1:4. The reason for this is that some cards (e.g. Buz) +can't handle 1:2 compression without stopping capture after only a few minutes. +With 1:4, it'll mostly work. If you have a Buz, use 'low_bitrate=1' to go into +1:4 max. compression mode. + +100% JPEG quality is thus 1:2 compression in practice. So for a full PAL frame +(size 720x576). The JPEG fields are stored in YUY2 format, so the size of the +fields are 720x288x16/2 bits/field (2 fields/frame) = 207360 bytes/field x 2 = +414720 bytes/frame (add some more bytes for headers and DHT (huffman)/DQT +(quantization) tables, and you'll get to something like 512kB per frame for +1:2 compression. For 1:4 compression, you'd have frames of half this size. + +Some additional explanation by Martin Samuelsson, which also explains the +importance of buffer sizes: +-- +> Hmm, I do not think it is really that way. With the current (downloaded +> at 18:00 Monday) driver I get that output sizes for 10 sec: +> -q 50 -b 128 : 24.283.332 Bytes +> -q 50 -b 256 : 48.442.368 +> -q 25 -b 128 : 24.655.992 +> -q 25 -b 256 : 25.859.820 + +I woke up, and can't go to sleep again. I'll kill some time explaining why +this doesn't look strange to me. + +Let's do some math using a width of 704 pixels. I'm not sure whether the Buz +actually use that number or not, but that's not too important right now. + +704x288 pixels, one field, is 202752 pixels. Divided by 64 pixels per block; +3168 blocks per field. Each pixel consist of two bytes; 128 bytes per block; +1024 bits per block. 100% in the new driver mean 1:2 compression; the maximum +output becomes 512 bits per block. Actually 510, but 512 is simpler to use +for calculations. + +Let's say that we specify d1q50. We thus want 256 bits per block; times 3168 +becomes 811008 bits; 101376 bytes per field. We're talking raw bits and bytes +here, so we don't need to do any fancy corrections for bits-per-pixel or such +things. 101376 bytes per field. + +d1 video contains two fields per frame. Those sum up to 202752 bytes per +frame, and one of those frames goes into each buffer. + +But wait a second! -b128 gives 128kB buffers! It's not possible to cram +202752 bytes of JPEG data into 128kB! + +This is what the driver notice and automatically compensate for in your +examples. Let's do some math using this information: + +128kB is 131072 bytes. In this buffer, we want to store two fields, which +leaves 65536 bytes for each field. Using 3168 blocks per field, we get +20.68686868... available bytes per block; 165 bits. We can't allow the +request for 256 bits per block when there's only 165 bits available! The -q50 +option is silently overridden, and the -b128 option takes precedence, leaving +us with the equivalence of -q32. + +This gives us a data rate of 165 bits per block, which, times 3168, sums up +to 65340 bytes per field, out of the allowed 65536. The current driver has +another level of rate limiting; it won't accept -q values that fill more than +6/8 of the specified buffers. (I'm not sure why. "Playing it safe" seem to be +a safe bet. Personally, I think I would have lowered requested-bits-per-block +by one, or something like that.) We can't use 165 bits per block, but have to +lower it again, to 6/8 of the available buffer space: We end up with 124 bits +per block, the equivalence of -q24. With 128kB buffers, you can't use greater +than -q24 at -d1. (And PAL, and 704 pixels width...) + +The third example is limited to -q24 through the same process. The second +example, using very similar calculations, is limited to -q48. The only +example that actually grab at the specified -q value is the last one, which +is clearly visible, looking at the file size. +-- + +Conclusion: the quality of the resulting movie depends on buffer size, quality, +whether or not you use 'low_bitrate=1' as insmod option for the zr36060.c +module to do 1:4 instead of 1:2 compression, etc. + +If you experience timeouts, lowering the quality/buffersize or using +'low_bitrate=1 as insmod option for zr36060.o might actually help, as is +proven by the Buz. + +It hangs/crashes/fails/whatevers! Help! +--------------------------------------- + +Make sure that the card has its own interrupts (see /proc/interrupts), check +the output of dmesg at high verbosity (load zr36067.o with debug=2, +load all other modules with debug=1). Check that your mainboard is favorable +(see question 2) and if not, test the card in another computer. Also see the +notes given in question 3 and try lowering quality/buffersize/capturesize +if recording fails after a period of time. + +If all this doesn't help, give a clear description of the problem including +detailed hardware information (memory+brand, mainboard+chipset+brand, which +MJPEG card, processor, other PCI cards that might be of interest), give the +system PnP information (/proc/interrupts, /proc/dma, /proc/devices), and give +the kernel version, driver version, glibc version, gcc version and any other +information that might possibly be of interest. Also provide the dmesg output +at high verbosity. See 'Contacting' on how to contact the developers. + +Maintainers/Contacting +---------------------- + +The driver is currently maintained by Laurent Pinchart and Ronald Bultje +(<[email protected]> and <[email protected]>). For bug +reports or questions, please contact the mailinglist instead of the developers +individually. For user questions (i.e. bug reports or how-to questions), send +an email to <[email protected]>, for developers (i.e. if you want to +help programming), send an email to <[email protected]>. See +http://www.sf.net/projects/mjpeg/ for subscription information. + +For bug reports, be sure to include all the information as described in +the section 'It hangs/crashes/fails/whatevers! Help!'. Please make sure +you're using the latest version (http://mjpeg.sf.net/driver-zoran/). + +Previous maintainers/developers of this driver include Serguei Miridonov +<[email protected]>, Wolfgang Scherr <[email protected]>, Dave Perks +<[email protected]> and Rainer Johanni <[email protected]>. + +Driver's License +---------------- + + This driver is distributed under the terms of the General Public License. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +See http://www.gnu.org/ for more information.
drivers/staging/media/Kconfig +2 -0
@@ -38,6 +38,8 @@ source "drivers/staging/media/sunxi/Kconfig" source "drivers/staging/media/tegra-vde/Kconfig" +source "drivers/staging/media/zoran/Kconfig" + source "drivers/staging/media/tegra-video/Kconfig" source "drivers/staging/media/ipu3/Kconfig"
drivers/staging/media/zoran/Kconfig new file +75 -0
75 lines not on this page · raw message
drivers/staging/media/zoran/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +zr36067-objs := zoran_procfs.o zoran_device.o \ + zoran_driver.o zoran_card.o + +obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o +obj-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o +obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o
drivers/staging/media/zoran/TODO new file +4 -0
@@ -0,0 +1,4 @@ +The zoran driver is marked deprecated. It will be removed +around May 2019 unless someone is willing to update this +driver to the latest V4L2 frameworks (especially the vb2 +framework).
drivers/staging/media/zoran/videocodec.c new file +391 -0
391 lines not on this page · raw message
drivers/staging/media/zoran/videocodec.h new file +349 -0
349 lines not on this page · raw message
drivers/staging/media/zoran/zoran.h new file +402 -0
402 lines not on this page · raw message
drivers/staging/media/zoran/zoran_card.c new file +1524 -0
1,181 lines not on this page · raw message
drivers/staging/media/zoran/zoran_card.h new file +50 -0
50 lines not on this page · raw message
drivers/staging/media/zoran/zoran_device.c new file +1619 -0
1,619 lines not on this page · raw message
drivers/staging/media/zoran/zoran_device.h new file +91 -0
91 lines not on this page · raw message
drivers/staging/media/zoran/zoran_driver.c new file +2850 -0
2,850 lines not on this page · raw message
drivers/staging/media/zoran/zoran_procfs.c new file +221 -0
221 lines not on this page · raw message
drivers/staging/media/zoran/zoran_procfs.h new file +32 -0
Lines of this file are not shown. View the raw message.
drivers/staging/media/zoran/zr36016.c new file +516 -0
516 lines not on this page · raw message
drivers/staging/media/zoran/zr36016.h new file +107 -0
107 lines not on this page · raw message
drivers/staging/media/zoran/zr36050.c new file +896 -0
896 lines not on this page · raw message
drivers/staging/media/zoran/zr36050.h new file +179 -0
179 lines not on this page · raw message
drivers/staging/media/zoran/zr36057.h new file +164 -0
164 lines not on this page · raw message
drivers/staging/media/zoran/zr36060.c new file +1006 -0
1,006 lines not on this page · raw message
drivers/staging/media/zoran/zr36060.h new file +216 -0
216 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.26.2
Part of the diff is not shown here. View the raw message.
Re: [PATCH RFT/RFC 01/49] staging: media: Revert "media: zoran: remove deprecated driver"
drivers/staging/media/zoran/zoran_driver.c line 241
Quoted 6 lines
drivers/staging/media/zoran/zoran_driver.c new file +6
-0+ fh->buffers.buffer[i].v4l.fbuffer = mem; + fh->buffers.buffer[i].v4l.fbuffer_phys =virt_to_phys (mem); + fh->buffers.buffer[i].v4l.fbuffer_bus =virt_to_bus (mem); +for (off =0 ; off < fh->buffers.buffer_size; + off +=PAGE_SIZE ) +SetPageReserved (virt_to_page (mem + off));
This messing with SetPageReserved needs to go away before we bring back the driver, even for staging.
Re: [PATCH RFT/RFC 01/49] staging: media: Revert "media: zoran: remove deprecated driver"
Quoted 9 lines · Christoph Hellwig
drivers/staging/media/zoran/zoran_driver.c line 241
Quoted 6 lines
drivers/staging/media/zoran/zoran_driver.c new file +6
-0+ fh->buffers.buffer[i].v4l.fbuffer = mem; + fh->buffers.buffer[i].v4l.fbuffer_phys =virt_to_phys (mem); + fh->buffers.buffer[i].v4l.fbuffer_bus =virt_to_bus (mem); +for (off =0 ; off < fh->buffers.buffer_size; + off +=PAGE_SIZE ) +SetPageReserved (virt_to_page (mem + off));This messing with SetPageReserved needs to go away before we bring back the driver, even for staging.
The whole old buffer management (with some virt_to_phys, virt_to_bus, SetPageReserved, etc...) is removed in "zoran: convert to vb2".
Regards
PATCH 2/49 MAINTAINERS: change maintainer of the zoran driver
In reply to Corentin LabbeAdd myself as maintainer.
--- Documentation/media/v4l-drivers/zoran.rst | 22 +++++++--------------- MAINTAINERS | 10 ++++++++++ drivers/staging/media/zoran/zoran_card.c | 5 ----- drivers/staging/media/zoran/zoran_card.h | 5 ----- drivers/staging/media/zoran/zoran_device.c | 5 ----- drivers/staging/media/zoran/zoran_device.h | 5 ----- 6 files changed, 17 insertions(+), 35 deletions(-)
Documentation/media/v4l-drivers/zoran.rst +7 -15
@@ -549,21 +549,13 @@ at high verbosity. See 'Contacting' on how to contact the developers. Maintainers/Contacting ---------------------- -The driver is currently maintained by Laurent Pinchart and Ronald Bultje -(<[email protected]> and <[email protected]>). For bug -reports or questions, please contact the mailinglist instead of the developers -individually. For user questions (i.e. bug reports or how-to questions), send -an email to <[email protected]>, for developers (i.e. if you want to -help programming), send an email to <[email protected]>. See -http://www.sf.net/projects/mjpeg/ for subscription information. - -For bug reports, be sure to include all the information as described in -the section 'It hangs/crashes/fails/whatevers! Help!'. Please make sure -you're using the latest version (http://mjpeg.sf.net/driver-zoran/). - -Previous maintainers/developers of this driver include Serguei Miridonov -<[email protected]>, Wolfgang Scherr <[email protected]>, Dave Perks -<[email protected]> and Rainer Johanni <[email protected]>. +Previous maintainers/developers of this driver are +- Laurent Pinchart <[email protected]> +- Ronald Bultje [email protected] +- Serguei Miridonov <[email protected]> +- Wolfgang Scherr <[email protected]> +- Dave Perks <[email protected]> +- Rainer Johanni <[email protected]> Driver's License ----------------
MAINTAINERS +10 -0
@@ -19233,6 +19233,16 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/zonefs.git F: Documentation/filesystems/zonefs.rst F: fs/zonefs/ +ZR36067 VIDEO FOR LINUX DRIVER +M: Corentin Labbe <[email protected]> +L: [email protected] +L: [email protected] +S: Maintained +W: http://mjpeg.sourceforge.net/driver-zoran/ +Q: https://patchwork.linuxtv.org/project/linux-media/list/ +F: drivers/staging/media/zoran/ +F: Documentation/media/v4l-drivers/zoran.rst + ZPOOL COMPRESSED PAGE STORAGE API M: Dan Streetman <[email protected]> L: [email protected]
drivers/staging/media/zoran/zoran_card.c +0 -5
@@ -7,11 +7,6 @@* * Copyright (C) 2000 Serguei Miridonov <[email protected]> * -* Currently maintained by: -* Ronald Bultje <[email protected]> -* Laurent Pinchart <[email protected]> -* Mailinglist <[email protected]> -* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
drivers/staging/media/zoran/zoran_card.h +0 -5
@@ -7,11 +7,6 @@* * Copyright (C) 2000 Serguei Miridonov <[email protected]> * -* Currently maintained by: -* Ronald Bultje <[email protected]> -* Laurent Pinchart <[email protected]> -* Mailinglist <[email protected]> -* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
drivers/staging/media/zoran/zoran_device.c +0 -5
@@ -7,11 +7,6 @@* * Copyright (C) 2000 Serguei Miridonov <[email protected]> * -* Currently maintained by: -* Ronald Bultje <[email protected]> -* Laurent Pinchart <[email protected]> -* Mailinglist <[email protected]> -* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
drivers/staging/media/zoran/zoran_device.h +0 -5
@@ -7,11 +7,6 @@* * Copyright (C) 2000 Serguei Miridonov <[email protected]> * -* Currently maintained by: -* Ronald Bultje <[email protected]> -* Laurent Pinchart <[email protected]> -* Mailinglist <[email protected]> -* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or
Signature · 1 line
2.26.2
PATCH 3/49 staging: media: zoran: datasheet is no longer available from zoran.com
In reply to Corentin LabbeSimply remove this broken reference
--- drivers/staging/media/zoran/zoran_device.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/media/zoran/zoran_device.c +0 -3
@@ -265,9 +265,6 @@ jpeg_codec_reset (struct zoran *zr)* Set the registers for the size we have specified. Don't bother * trying to understand this without the ZR36057 manual in front of * you [AC]. -* -* PS: The manual is free for download in .pdf format from -* www.zoran.com - nicely done those folks. */ static void
Signature · 1 line
2.26.2
PATCH 4/49 staging: media: zoran: Documentation: fix typo
In reply to Corentin LabbeFix some typo in doc.
--- Documentation/media/v4l-drivers/zoran.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/media/v4l-drivers/zoran.rst +2 -2
@@ -119,7 +119,7 @@ Pinnacle/Miro DC10+ * Analog Devices adv7176 TV encoder Drivers to use: videodev, i2c-core, i2c-algo-bit, -videocodec, sa7110, adv7175, zr36060, zr36067 +videocodec, saa7110, adv7175, zr36060, zr36067 Inputs/outputs: Composite, S-video and Internal
@@ -280,7 +280,7 @@ Samsung ks0127 TV decoder What the TV encoder can do an what not -------------------------------------- -The TV encoder are doing the "same" as the decoder, but in the oder direction. +The TV encoder are doing the "same" as the decoder, but in the other direction. You feed them digital data and the generate a Composite or SVHS signal. For information about the colorsystems and TV norm take a look in the TV decoder section.
Signature · 1 line
2.26.2
PATCH 5/49 staging: media: zoran: fix checkpatch issue
In reply to Corentin LabbeFix a lot of style issue found by checkpatch.
--- drivers/staging/media/zoran/videocodec.c | 116 ++----- drivers/staging/media/zoran/videocodec.h | 75 +---- drivers/staging/media/zoran/zoran.h | 52 ++- drivers/staging/media/zoran/zoran_card.c | 319 +++++++----------- drivers/staging/media/zoran/zoran_card.h | 11 +- drivers/staging/media/zoran/zoran_device.c | 372 ++++++++------------- drivers/staging/media/zoran/zoran_device.h | 40 +-- drivers/staging/media/zoran/zoran_driver.c | 257 ++++++-------- drivers/staging/media/zoran/zoran_procfs.c | 28 +- drivers/staging/media/zoran/zr36016.c | 166 +++------ drivers/staging/media/zoran/zr36016.h | 17 +- drivers/staging/media/zoran/zr36050.c | 116 ++----- drivers/staging/media/zoran/zr36050.h | 26 +- drivers/staging/media/zoran/zr36057.h | 96 +++--- drivers/staging/media/zoran/zr36060.c | 314 ++++++----------- drivers/staging/media/zoran/zr36060.h | 111 +++--- 16 files changed, 740 insertions(+), 1376 deletions(-)
drivers/staging/media/zoran/videocodec.c +34 -82
@@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * VIDEO MOTION CODECs internal API for video devices *
@@ -5,22 +6,6 @@* bound to a master device. * * (c) 2002 Wolfgang Scherr <[email protected]> -* -* $Id: videocodec.c,v 1.1.2.8 2003/03/29 07:16:04 rbultje Exp $ -* -* ------------------------------------------------------------------------ -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* ------------------------------------------------------------------------ */ #define VIDEOCODEC_VERSION "v0.2"
@@ -69,8 +54,7 @@ static struct codec_list *codeclist_top;/* function prototypes of the master/slave interface */ /* ================================================= */ -struct videocodec * -videocodec_attach (struct videocodec_master *master) +struct videocodec *videocodec_attach (struct videocodec_master *master) {struct codec_list *h = codeclist_top;struct attached_list *a, *ptr;
@@ -82,8 +66,7 @@ videocodec_attach (struct videocodec_master *master)return NULL ; } -dprintk (2 , -"videocodec_attach: '%s', flags %lx, magic %lx\n" , +dprintk (2 ,"%s: '%s', flags %lx, magic %lx\n" , __func__, master->name, master->flags, master->magic);if (!h) {
@@ -97,50 +80,35 @@ videocodec_attach (struct videocodec_master *master)// attach only if the slave has at least the flags // expected by the master if ((master->flags & h->codec->flags) == master->flags) { -dprintk (4 ,"videocodec_attach: try '%s'\n" , - h->codec->name); +dprintk (4 ,"%s: try '%s'\n" , __func__, h->codec->name);if (!try_module_get (h->codec->owner))return NULL ; - codec =kmemdup (h->codec,sizeof (struct videocodec ), -GFP_KERNEL ); -if (!codec) { -dprintk (1 , -KERN_ERR -"videocodec_attach: no mem\n" ); + codec =kmemdup (h->codec,sizeof (struct videocodec ),GFP_KERNEL ); +if (!codec) goto out_module_put; - } res =strlen (codec->name); -snprintf (codec->name + res,sizeof (codec->name) - res, -"[%d]" , h->attached); +snprintf (codec->name + res,sizeof (codec->name) - res,"[%d]" , h->attached); codec->master_data = master; res = codec->setup (codec);if (res ==0 ) { -dprintk (3 ,"videocodec_attach '%s'\n" , - codec->name); - ptr =kzalloc (sizeof (struct attached_list ),GFP_KERNEL ); -if (!ptr) { -dprintk (1 , -KERN_ERR -"videocodec_attach: no memory\n" ); +dprintk (3 ,"%s: '%s'\n" , __func__, codec->name); + ptr =kzalloc (sizeof (*ptr),GFP_KERNEL ); +if (!ptr) goto out_kfree; - } ptr->codec = codec; a = h->list;if (!a) { h->list = ptr; -dprintk (4 , -"videocodec: first element\n" ); +dprintk (4 ,"videocodec: first element\n" ); }else {while (a->next) a = a->next;// find end a->next = ptr; -dprintk (4 , -"videocodec: in after '%s'\n" , - h->codec->name); +dprintk (4 ,"videocodec: in after '%s'\n" , h->codec->name); } h->attached +=1 ;
@@ -161,9 +129,9 @@ videocodec_attach (struct videocodec_master *master)kfree (codec);return NULL ; } +EXPORT_SYMBOL (videocodec_attach); -int -videocodec_detach (struct videocodec *codec) +int videocodec_detach (struct videocodec *codec) {struct codec_list *h = codeclist_top;struct attached_list *a, *prev;
@@ -174,8 +142,7 @@ videocodec_detach (struct videocodec *codec)return -EINVAL ; } -dprintk (2 , -"videocodec_detach: '%s', type: %x, flags %lx, magic %lx\n" , +dprintk (2 ,"%s: '%s', type: %x, flags %lx, magic %lx\n" , __func__, codec->name, codec->type, codec->flags, codec->magic);if (!h) {
@@ -191,9 +158,7 @@ videocodec_detach (struct videocodec *codec)if (codec == a->codec) { res = a->codec->unset (a->codec);if (res >=0 ) { -dprintk (3 , -"videocodec_detach: '%s'\n" , - a->codec->name); +dprintk (3 ,"%s: '%s'\n" , __func__, a->codec->name); a->codec->master_data =NULL ; }else { dprintk(1,
@@ -202,14 +167,12 @@ videocodec_detach (struct videocodec *codec) a->codec->name); a->codec->master_data =NULL ; } -if (prev ==NULL ) { +if (!prev) { h->list = a->next; -dprintk (4 , -"videocodec: delete first\n" ); +dprintk (4 ,"videocodec: delete first\n" ); }else { prev->next = a->next; -dprintk (4 , -"videocodec: delete middle\n" ); +dprintk (4 ,"videocodec: delete middle\n" ); }module_put (a->codec->owner);kfree (a->codec);
@@ -226,9 +189,9 @@ videocodec_detach (struct videocodec *codec)dprintk (1 ,KERN_ERR "videocodec_detach: given codec not found!\n" );return -EINVAL ; } +EXPORT_SYMBOL (videocodec_detach); -int -videocodec_register (const struct videocodec *codec) +int videocodec_register (const struct videocodec *codec) {struct codec_list *ptr, *h = codeclist_top;
@@ -241,11 +204,9 @@ videocodec_register (const struct videocodec *codec)"videocodec: register '%s', type: %x, flags %lx, magic %lx\n" , codec->name, codec->type, codec->flags, codec->magic); - ptr =kzalloc (sizeof (struct codec_list ),GFP_KERNEL ); -if (!ptr) { -dprintk (1 ,KERN_ERR "videocodec_register: no memory\n" ); + ptr =kzalloc (sizeof (*ptr),GFP_KERNEL ); +if (!ptr)return -ENOMEM ; - } ptr->codec = codec;if (!h) {
@@ -261,9 +222,9 @@ videocodec_register (const struct videocodec *codec)return 0 ; } +EXPORT_SYMBOL (videocodec_register); -int -videocodec_unregister (const struct videocodec *codec) +int videocodec_unregister (const struct videocodec *codec) {struct codec_list *prev =NULL , *h = codeclist_top;
@@ -294,7 +255,7 @@ videocodec_unregister (const struct videocodec *codec) }dprintk (3 ,"videocodec: unregister '%s' is ok.\n" , h->codec->name); -if (prev ==NULL ) { +if (!prev) { codeclist_top = h->next;dprintk (4 ,"videocodec: delete first element\n" );
@@ -315,6 +276,7 @@ videocodec_unregister (const struct videocodec *codec) "videocodec_unregister: given codec not found!\n");return -EINVAL ; } +EXPORT_SYMBOL (videocodec_unregister);#ifdef CONFIG_PROC_FS static int proc_videocodecs_show (struct seq_file *m,void *v)
@@ -327,12 +289,12 @@ static int proc_videocodecs_show(struct seq_file *m, void *v)while (h) {seq_printf (m,"S %32s %04x %08lx %08lx (TEMPLATE)\n" , - h->codec->name, h->codec->type, + h->codec->name, h->codec->type, h->codec->flags, h->codec->magic); a = h->list;while (a) { seq_printf(m, "M %32s %04x %08lx %08lx (%s)\n", - a->codec->master_data->name, + a->codec->master_data->name, a->codec->master_data->type, a->codec->master_data->flags, a->codec->master_data->magic,
@@ -349,39 +311,29 @@ static int proc_videocodecs_show(struct seq_file *m, void *v)/* ===================== */ /* hook in driver module */ /* ===================== */ -static int __init -videocodec_init (void ) +static int __init videocodec_init (void ) {#ifdef CONFIG_PROC_FS static struct proc_dir_entry *videocodec_proc_entry;#endif -printk (KERN_INFO "Linux video codec intermediate layer: %s\n" , -VIDEOCODEC_VERSION ); +pr_info ("Linux video codec intermediate layer: %s\n" ,VIDEOCODEC_VERSION );#ifdef CONFIG_PROC_FS - videocodec_proc_entry =proc_create_single ("videocodecs" ,0 ,NULL , - proc_videocodecs_show); -if (!videocodec_proc_entry) { + videocodec_proc_entry =proc_create_single ("videocodecs" ,0 ,NULL , proc_videocodecs_show); +if (!videocodec_proc_entry)dprintk (1 ,KERN_ERR "videocodec: can't init procfs.\n" ); - }#endif return 0 ; } -static void __exit -videocodec_exit (void ) +static void __exit videocodec_exit(void) {#ifdef CONFIG_PROC_FS remove_proc_entry ("videocodecs" ,NULL );#endif } -EXPORT_SYMBOL (videocodec_attach); -EXPORT_SYMBOL (videocodec_detach); -EXPORT_SYMBOL (videocodec_register); -EXPORT_SYMBOL (videocodec_unregister); -module_init (videocodec_init);module_exit (videocodec_exit);
drivers/staging/media/zoran/videocodec.h +17 -58
132 lines not on this page · raw message
drivers/staging/media/zoran/zoran.h +22 -30
98 lines not on this page · raw message
drivers/staging/media/zoran/zoran_card.c +124 -195
727 lines not on this page · raw message
drivers/staging/media/zoran/zoran_card.h +1 -10
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Zoran zr36057/zr36067 PCI controller driver, for the * Pinnacle/Miro DC10/DC10+/DC30/DC30+, Iomega Buz, Linux
@@ -6,16 +7,6 @@* This part handles card-specific data and detection * * Copyright (C) 2000 Serguei Miridonov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #ifndef __ZORAN_CARD_H__
drivers/staging/media/zoran/zoran_device.c +138 -234
836 lines not on this page · raw message
drivers/staging/media/zoran/zoran_device.h +9 -31
@@ -1,3 +1,4 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Zoran zr36057/zr36067 PCI controller driver, for the * Pinnacle/Miro DC10/DC10+/DC30/DC30+, Iomega Buz, Linux
@@ -6,50 +7,28 @@* This part handles card-specific data and detection * * Copyright (C) 2000 Serguei Miridonov <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. */ #ifndef __ZORAN_DEVICE_H__#define __ZORAN_DEVICE_H__/* general purpose I/O */ -extern void GPIO (struct zoran *zr, -int bit, -unsigned int value); +extern void GPIO (struct zoran *zr,int bit,unsigned int value);/* codec (or actually: guest bus) access */ extern int post_office_wait (struct zoran *zr); -extern int post_office_write (struct zoran *zr, -unsigned guest, -unsigned reg, -unsigned value); -extern int post_office_read (struct zoran *zr, -unsigned guest, -unsigned reg); +extern int post_office_write (struct zoran *zr,unsigned int guest,unsigned int reg,unsigned int value); +extern int post_office_read (struct zoran *zr,unsigned int guest,unsigned int reg);extern void detect_guest_activity (struct zoran *zr); -extern void jpeg_codec_sleep (struct zoran *zr, -int sleep); +extern void jpeg_codec_sleep (struct zoran *zr,int sleep);extern int jpeg_codec_reset (struct zoran *zr);/* zr360x7 access to raw capture */ -extern void zr36057_overlay (struct zoran *zr, -int on); -extern void write_overlay_mask (struct zoran_fh *fh, -struct v4l2_clip *vp, -int count); -extern void zr36057_set_memgrab (struct zoran *zr, -int mode); +extern void zr36057_overlay (struct zoran *zr,int on); +extern void write_overlay_mask (struct zoran_fh *fh,struct v4l2_clip *vp,int count); +extern void zr36057_set_memgrab (struct zoran *zr,int mode);extern int wait_grab_pending (struct zoran *zr);/* interrupts */
@@ -64,8 +43,7 @@ extern void zr36057_enable_jpg(struct zoran *zr,extern void zoran_feed_stat_com (struct zoran *zr);/* general */ -extern void zoran_set_pci_master (struct zoran *zr, -int set_master); +extern void zoran_set_pci_master (struct zoran *zr,int set_master);extern void zoran_init_hardware (struct zoran *zr);extern void zr36057_restart (struct zoran *zr);
drivers/staging/media/zoran/zoran_driver.c +108 -149
774 lines not on this page · raw message
drivers/staging/media/zoran/zoran_procfs.c +10 -18
@@ -83,14 +83,11 @@ static const struct procfs_params_zr36067 zr67[] = { {NULL, 0, 0, 0}, }; -static void -setparam (struct zoran *zr, -char *name, -char *sval) +static void setparam (struct zoran *zr,char *name,char *sval) {int i =0 , reg0, reg, val; -while (zr67[i].name !=NULL ) { +while (zr67[i].name) {if (!strncmp (name, zr67[i].name,strlen (zr67[i].name))) { reg = reg0 =btread (zr67[i].reg); reg &= ~(zr67[i].mask << zr67[i].bit);
@@ -119,19 +116,20 @@ static int zoran_show(struct seq_file *p, void *v)seq_printf (p,"ZR36067 registers:\n" );for (i =0 ; i <0x130 ; i +=16 ) -seq_printf (p,"%03X %08X %08X %08X %08X \n" , i, -btread (i),btread (i+4 ),btread (i+8 ),btread (i+12 )); +seq_printf (p,"%03X %08X %08X %08X %08X\n" , i, +btread (i),btread (i +4 ),btread (i +8 ),btread (i +12 ));return 0 ; }static int zoran_open (struct inode *inode,struct file *file) {struct zoran *data =PDE_DATA (inode); +return single_open (file, zoran_show, data); }static ssize_t zoran_write (struct file *file,const char __user *buffer, -size_t count,loff_t *ppos) +size_t count,loff_t *ppos) {struct zoran *zr =PDE_DATA (file_inode (file));char *string, *sp;
@@ -142,14 +140,10 @@ static ssize_t zoran_write(struct file *file, const char __user *buffer, string = sp =vmalloc (count +1 );if (!string) { -dprintk (1 , -KERN_ERR -"%s: write_proc: can not allocate memory\n" , -ZR_DEVNAME (zr));return -ENOMEM ; }if (copy_from_user (string, buffer, count)) { -vfree (string); +vfree (string);return -EFAULT ; } string[count] =0 ;
@@ -185,15 +179,14 @@ static const struct file_operations zoran_operations = { };#endif -int -zoran_proc_init (struct zoran *zr) +int zoran_proc_init(struct zoran *zr) { #ifdef CONFIG_PROC_FS char name[8]; snprintf(name, 7, "zoran%d", zr->id); zr->zoran_proc = proc_create_data(name, 0, NULL, &zoran_operations, zr); - if (zr->zoran_proc != NULL) { + if (zr->zoran_proc) { dprintk(2, KERN_INFO "%s: procfs entry /proc/%s allocated. data=%p\n",
@@ -207,8 +200,7 @@ zoran_proc_init (struct zoran *zr)return 0 ; } -void -zoran_proc_cleanup (struct zoran *zr) +void zoran_proc_cleanup (struct zoran *zr) {#ifdef CONFIG_PROC_FS char name[8 ];
drivers/staging/media/zoran/zr36016.c +51 -115
5 lines not on this page · raw message
drivers/staging/media/zoran/zr36050.c +33 -83
116 lines not on this page · raw message
drivers/staging/media/zoran/zr36057.h +43 -53
96 lines not on this page · raw message
drivers/staging/media/zoran/zr36060.c +96 -218
314 lines not on this page · raw message
drivers/staging/media/zoran/zr36060.h +48 -63
111 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.26.2
Part of the diff is not shown here. View the raw message.
PATCH 6/49 staging: media: zoran: unsplit lines
In reply to Corentin LabbeThis patch un-split some lines.
--- drivers/staging/media/zoran/zoran_card.c | 27 ++++-------- drivers/staging/media/zoran/zoran_device.c | 49 +++++++--------------- drivers/staging/media/zoran/zoran_driver.c | 27 ++++-------- 3 files changed, 34 insertions(+), 69 deletions(-)
drivers/staging/media/zoran/zoran_card.c +9 -18
@@ -652,8 +652,7 @@ static int zoran_register_i2c(struct zoran *zr) { zr->i2c_algo = zoran_i2c_bit_data_template; zr->i2c_algo.data = zr; -strscpy (zr->i2c_adapter.name,ZR_DEVNAME (zr), -sizeof (zr->i2c_adapter.name)); +strscpy (zr->i2c_adapter.name,ZR_DEVNAME (zr),sizeof (zr->i2c_adapter.name));i2c_set_adapdata (&zr->i2c_adapter, &zr->v4l2_dev); zr->i2c_adapter.algo_data = &zr->i2c_algo; zr->i2c_adapter.dev.parent = &zr->pci_dev->dev;
@@ -666,8 +665,7 @@ static void zoran_unregister_i2c(struct zoran *zr) }/* Check a zoran_params struct for correctness, insert default params */ -int zoran_check_jpg_settings (struct zoran *zr, -struct zoran_jpg_settings *settings,int try) +int zoran_check_jpg_settings (struct zoran *zr,struct zoran_jpg_settings *settings,int try) {int err =0 , err0 =0 ;
@@ -866,13 +864,10 @@ void zoran_open_init_params(struct zoran *zr) zr->jpg_settings.odd_even =0 ; zr->jpg_settings.jpg_comp.APPn =0 ; zr->jpg_settings.jpg_comp.APP_len =0 ;/* No APPn marker */ -memset (zr->jpg_settings.jpg_comp.APP_data,0 , -sizeof (zr->jpg_settings.jpg_comp.APP_data)); +memset (zr->jpg_settings.jpg_comp.APP_data,0 ,sizeof (zr->jpg_settings.jpg_comp.APP_data)); zr->jpg_settings.jpg_comp.COM_len =0 ;/* No COM marker */ -memset (zr->jpg_settings.jpg_comp.COM_data,0 , -sizeof (zr->jpg_settings.jpg_comp.COM_data)); - zr->jpg_settings.jpg_comp.jpeg_markers = -V4L2_JPEG_MARKER_DHT |V4L2_JPEG_MARKER_DQT ; +memset (zr->jpg_settings.jpg_comp.COM_data,0 ,sizeof (zr->jpg_settings.jpg_comp.COM_data)); + zr->jpg_settings.jpg_comp.jpeg_markers =V4L2_JPEG_MARKER_DHT |V4L2_JPEG_MARKER_DQT ; i =zoran_check_jpg_settings (zr, &zr->jpg_settings,0 );if (i) dprintk(1, KERN_ERR "%s: %s internal error\n",
@@ -1059,8 +1054,7 @@ void zoran_vdev_release(struct video_device *vdev)kfree (vdev); } -static struct videocodec_master *zoran_setup_videocodec (struct zoran *zr, -int type) +static struct videocodec_master *zoran_setup_videocodec (struct zoran *zr,int type) {struct videocodec_master *m =NULL ;
@@ -1214,8 +1208,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)* keep general card information, no settings or anything */ zr->card = zoran_cards[card_num]; -snprintf (ZR_DEVNAME (zr),sizeof (ZR_DEVNAME (zr)),"%s[%u]" , - zr->card.name, zr->id); +snprintf (ZR_DEVNAME (zr),sizeof (ZR_DEVNAME (zr)),"%s[%u]" , zr->card.name, zr->id); zr->zr36057_mem =pci_ioremap_bar (zr->pci_dev,0 );if (!zr->zr36057_mem) {
@@ -1266,14 +1259,12 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto zr_free_irq; } - zr->decoder =v4l2_i2c_new_subdev (&zr->v4l2_dev, &zr->i2c_adapter, - zr->card.i2c_decoder,0 , + zr->decoder =v4l2_i2c_new_subdev (&zr->v4l2_dev, &zr->i2c_adapter, zr->card.i2c_decoder,0 , zr->card.addrs_decoder);if (zr->card.i2c_encoder) zr->encoder =v4l2_i2c_new_subdev (&zr->v4l2_dev, &zr->i2c_adapter, - zr->card.i2c_encoder,0 , - zr->card.addrs_encoder); + zr->card.i2c_encoder,0 , zr->card.addrs_encoder);dprintk (2 ,KERN_INFO "%s: Initializing videocodec bus...\n" ,ZR_DEVNAME (zr));
drivers/staging/media/zoran/zoran_device.c +16 -33
117 lines not on this page · raw message
drivers/staging/media/zoran/zoran_driver.c +9 -18
@@ -1501,8 +1501,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)for (num = i =0 ; i <NUM_FORMATS ; i++) {if (zoran_formats[i].flags & flag && num++ == fmt->index) { -strscpy (fmt->description, zoran_formats[i].name, -sizeof (fmt->description)); +strscpy (fmt->description, zoran_formats[i].name,sizeof (fmt->description));/* fmt struct pre-zeroed, so adding '\0' not needed */ fmt->pixelformat = zoran_formats[i].fourcc;if (zoran_formats[i].flags &ZORAN_FORMAT_COMPRESSED )
@@ -1540,8 +1539,7 @@ static int zoran_enum_fmt_vid_overlay(struct file *file, void *__fh,return zoran_enum_fmt (zr, f,ZORAN_FORMAT_OVERLAY ); } -static int zoran_g_fmt_vid_out (struct file *file,void *__fh, -struct v4l2_format *fmt) +static int zoran_g_fmt_vid_out (struct file *file,void *__fh,struct v4l2_format *fmt) {struct zoran_fh *fh = __fh;
@@ -1562,8 +1560,7 @@ static int zoran_g_fmt_vid_out(struct file *file, void *__fh,return 0 ; } -static int zoran_g_fmt_vid_cap (struct file *file,void *__fh, -struct v4l2_format *fmt) +static int zoran_g_fmt_vid_cap (struct file *file,void *__fh,struct v4l2_format *fmt) {struct zoran_fh *fh = __fh;struct zoran *zr = fh->zr;
@@ -1728,8 +1725,7 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh,return res; } -static int zoran_s_fmt_vid_out (struct file *file,void *__fh, -struct v4l2_format *fmt) +static int zoran_s_fmt_vid_out (struct file *file,void *__fh,struct v4l2_format *fmt) {struct zoran_fh *fh = __fh;struct zoran *zr = fh->zr;
@@ -1795,8 +1791,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh,/* tell the user what we actually did */ fmt->fmt.pix.width = settings.img_width / settings.HorDcm; - fmt->fmt.pix.height = settings.img_height *2 / - (settings.TmpDcm * settings.VerDcm); + fmt->fmt.pix.height = settings.img_height *2 / (settings.TmpDcm * settings.VerDcm);if (settings.TmpDcm ==1 ) fmt->fmt.pix.field = (fh->jpg_settings.odd_even ?V4L2_FIELD_SEQ_TB :V4L2_FIELD_SEQ_BT );
@@ -1809,8 +1804,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh,return res; } -static int zoran_s_fmt_vid_cap (struct file *file,void *__fh, -struct v4l2_format *fmt) +static int zoran_s_fmt_vid_cap (struct file *file,void *__fh,struct v4l2_format *fmt) {struct zoran_fh *fh = __fh;struct zoran *zr = fh->zr;
@@ -1843,8 +1837,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,map_mode_raw (fh); - res =zoran_v4l_set_format (fh, fmt->fmt.pix.width, fmt->fmt.pix.height, - &zoran_formats[i]); + res =zoran_v4l_set_format (fh, fmt->fmt.pix.width, fmt->fmt.pix.height, &zoran_formats[i]);if (res)return res;
@@ -2259,8 +2252,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)return res; } -static int zoran_enum_input (struct file *file,void *__fh, -struct v4l2_input *inp) +static int zoran_enum_input (struct file *file,void *__fh,struct v4l2_input *inp) {struct zoran_fh *fh = __fh;struct zoran *zr = fh->zr;
@@ -2416,8 +2408,7 @@ static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selectioreturn res; } -static int zoran_g_jpegcomp (struct file *file,void *__fh, -struct v4l2_jpegcompression *params) +static int zoran_g_jpegcomp (struct file *file,void *__fh,struct v4l2_jpegcompression *params) {struct zoran_fh *fh = __fh;
Signature · 1 line
2.26.2
Re: [PATCH RFT/RFC 06/49] staging: media: zoran: unsplit lines
Quoted 2 lines · Corentin Labbe
This patch un-split some lines.
Signed-off-by Corentin Labbe <[email protected]>
Just don't do this. This is a purious change going over 80 chars for absolutely no reason, and you'd still need a very good reason for that.
PATCH 7/49 staging: media: zoran: do not forward declare zr36057_init_vfe
In reply to Corentin Labbemove function for avoiding forward declaration
--- drivers/staging/media/zoran/zoran_device.c | 44 +++++++++++----------- 1 file changed, 21 insertions(+), 23 deletions(-)
drivers/staging/media/zoran/zoran_device.c +21 -23
@@ -55,7 +55,27 @@ static bool lml33dpath; /* default = 0module_param (lml33dpath, bool,0644 );MODULE_PARM_DESC (lml33dpath,"Use digital path capture mode (on LML33 cards)" ); -static void zr36057_init_vfe (struct zoran *zr); +/* +* initialize video front end +*/ +static void zr36057_init_vfe (struct zoran *zr) +{ +u32 reg; + + reg =btread (ZR36057_VFESPFR ); + reg |= ZR36057_VFESPFR_LittleEndian; + reg &= ~ZR36057_VFESPFR_VCLKPol; + reg |= ZR36057_VFESPFR_ExtFl; + reg |= ZR36057_VFESPFR_TopField; +btwrite (reg,ZR36057_VFESPFR ); + reg =btread (ZR36057_VDCR ); +if (pci_pci_problems &PCIPCI_TRITON ) +// || zr->revision < 1) // Revision 1 has also Triton support + reg &= ~ZR36057_VDCR_Triton; +else + reg |= ZR36057_VDCR_Triton; +btwrite (reg,ZR36057_VDCR ); +}/* * General Purpose I/O and Guest bus access
@@ -1474,25 +1494,3 @@ void zr36057_restart(struct zoran *zr)btwrite ((0x81 <<24 ) |0x8888 ,ZR36057_GPPGCR1 ); } -/* -* initialize video front end -*/ - -static void zr36057_init_vfe (struct zoran *zr) -{ -u32 reg; - - reg =btread (ZR36057_VFESPFR ); - reg |= ZR36057_VFESPFR_LittleEndian; - reg &= ~ZR36057_VFESPFR_VCLKPol; - reg |= ZR36057_VFESPFR_ExtFl; - reg |= ZR36057_VFESPFR_TopField; -btwrite (reg,ZR36057_VFESPFR ); - reg =btread (ZR36057_VDCR ); -if (pci_pci_problems &PCIPCI_TRITON ) -// || zr->revision < 1) // Revision 1 has also Triton support - reg &= ~ZR36057_VDCR_Triton; -else - reg |= ZR36057_VDCR_Triton; -btwrite (reg,ZR36057_VDCR ); -}
Signature · 1 line
2.26.2
PATCH 8/49 staging: media: zoran: convert all error dprintk to pci_err/pr_err
In reply to Corentin LabbeThis patch converts all errors dprintk to pci_err/pr_err.
--- drivers/staging/media/zoran/videocodec.c | 39 +-- drivers/staging/media/zoran/zoran_card.c | 96 ++---- drivers/staging/media/zoran/zoran_device.c | 28 +- drivers/staging/media/zoran/zoran_driver.c | 334 +++++---------------- drivers/staging/media/zoran/zoran_procfs.c | 4 +- drivers/staging/media/zoran/zr36016.c | 39 +-- drivers/staging/media/zoran/zr36050.c | 10 +- drivers/staging/media/zoran/zr36060.c | 24 +- 8 files changed, 145 insertions(+), 429 deletions(-)
drivers/staging/media/zoran/videocodec.c +13 -26
@@ -62,7 +62,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)int res;if (!master) { -dprintk (1 ,KERN_ERR "videocodec_attach: no data\n" ); +pr_err ("%s: no data\n" , __func__);return NULL ; }
@@ -70,9 +70,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) master->name, master->flags, master->magic);if (!h) { -dprintk (1 , -KERN_ERR -"videocodec_attach: no device available\n" ); +pr_err ("%s: no device available\n" , __func__);return NULL ; }
@@ -120,7 +118,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) h = h->next; } -dprintk (1 ,KERN_ERR "videocodec_attach: no codec found!\n" ); +pr_err ("%s: no codec found!\n" , __func__);return NULL ; out_module_put:
@@ -138,7 +136,7 @@ int videocodec_detach(struct videocodec *codec)int res;if (!codec) { -dprintk (1 ,KERN_ERR "videocodec_detach: no data\n" ); +pr_err ("%s: no data\n" , __func__);return -EINVAL ; }
@@ -146,8 +144,7 @@ int videocodec_detach(struct videocodec *codec) codec->name, codec->type, codec->flags, codec->magic);if (!h) { -dprintk (1 , -KERN_ERR "videocodec_detach: no device left...\n" ); +pr_err ("%s: no device left...\n" , __func__);return -ENXIO ; }
@@ -161,10 +158,7 @@ int videocodec_detach(struct videocodec *codec)dprintk (3 ,"%s: '%s'\n" , __func__, a->codec->name); a->codec->master_data =NULL ; }else { -dprintk (1 , -KERN_ERR -"videocodec_detach: '%s'\n" , - a->codec->name); +pr_err ("%s: '%s'\n" , __func__, a->codec->name); a->codec->master_data =NULL ; }if (!prev) {
@@ -186,7 +180,7 @@ int videocodec_detach(struct videocodec *codec) h = h->next; } -dprintk (1 ,KERN_ERR "videocodec_detach: given codec not found!\n" ); +pr_err ("%s: given codec not found!\n" , __func__);return -EINVAL ; }EXPORT_SYMBOL (videocodec_detach);
@@ -196,7 +190,7 @@ int videocodec_register(const struct videocodec *codec)struct codec_list *ptr, *h = codeclist_top;if (!codec) { -dprintk (1 ,KERN_ERR "videocodec_register: no data!\n" ); +pr_err ("%s: no data!\n" , __func__);return -EINVAL ; }
@@ -229,7 +223,7 @@ int videocodec_unregister(const struct videocodec *codec)struct codec_list *prev =NULL , *h = codeclist_top;if (!codec) { -dprintk (1 ,KERN_ERR "videocodec_unregister: no data!\n" ); +pr_err ("%s: no data!\n" , __func__);return -EINVAL ; }
@@ -238,19 +232,14 @@ int videocodec_unregister(const struct videocodec *codec) codec->name, codec->type, codec->flags, codec->magic);if (!h) { -dprintk (1 , -KERN_ERR -"videocodec_unregister: no device left...\n" ); +pr_err ("%s: no device left...\n" , __func__);return -ENXIO ; }while (h) {if (codec == h->codec) {if (h->attached) { -dprintk (1 , -KERN_ERR -"videocodec: '%s' is used\n" , - h->codec->name); +pr_err ("videocodec: '%s' is used\n" , h->codec->name);return -EBUSY ; } dprintk(3, "videocodec: unregister '%s' is ok.\n",
@@ -271,9 +260,7 @@ int videocodec_unregister(const struct videocodec *codec) h = h->next; } -dprintk (1 , -KERN_ERR -"videocodec_unregister: given codec not found!\n" ); +pr_err ("%s: given codec not found!\n" , __func__);return -EINVAL ; }EXPORT_SYMBOL (videocodec_unregister);
@@ -322,7 +309,7 @@ static int __init videocodec_init(void)#ifdef CONFIG_PROC_FS videocodec_proc_entry =proc_create_single ("videocodecs" ,0 ,NULL , proc_videocodecs_show);if (!videocodec_proc_entry) -dprintk (1 ,KERN_ERR "videocodec: can't init procfs.\n" ); +pr_err ("videocodec: can't init procfs.\n" );#endif return 0 ; }
drivers/staging/media/zoran/zoran_card.c +25 -71
197 lines not on this page · raw message
drivers/staging/media/zoran/zoran_device.c +8 -20
@@ -315,8 +315,7 @@ static void zr36057_set_vfe(struct zoran *zr, int video_width, int video_height,if (video_width <BUZ_MIN_WIDTH || video_height <BUZ_MIN_HEIGHT || video_width > Wa || video_height > Ha) { -dprintk (1 ,KERN_ERR "%s: set_vfe: w=%d h=%d not valid\n" , -ZR_DEVNAME (zr), video_width, video_height); +pci_err (zr->pci_dev,"set_vfe: w=%d h=%d not valid\n" , video_width, video_height);return ; }
@@ -451,10 +450,7 @@ void zr36057_overlay(struct zoran *zr, int on) zr->vbuf_bytesperline;btwrite (reg,ZR36057_VDTR );if (reg &3 ) -dprintk (1 , -KERN_ERR -"%s: zr36057_overlay() - video_address not aligned\n" , -ZR_DEVNAME (zr)); +pci_err (zr->pci_dev,"zr36057_overlay() - video_address not aligned\n" );if (zr->overlay_settings.height >BUZ_MAX_HEIGHT /2 ) reg += zr->vbuf_bytesperline;btwrite (reg,ZR36057_VDBR );
@@ -466,10 +462,7 @@ void zr36057_overlay(struct zoran *zr, int on)if (zr->overlay_settings.height >BUZ_MAX_HEIGHT /2 ) reg += zr->vbuf_bytesperline;if (reg &3 ) -dprintk (1 , -KERN_ERR -"%s: zr36057_overlay() - video_stride not aligned\n" , -ZR_DEVNAME (zr)); +pci_err (zr->pci_dev,"zr36057_overlay() - video_stride not aligned\n" ); reg = (reg << ZR36057_VSSFGR_DispStride); reg |= ZR36057_VSSFGR_VidOvf;/* clear overflow status */ btwrite (reg,ZR36057_VSSFGR );
@@ -1187,8 +1180,8 @@ static void error_handler(struct zoran *zr, u32 astat, u32 stat)int j; frame = zr->jpg_pend[zr->jpg_dma_tail &BUZ_MASK_FRAME ]; -pr_err ("%s: JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. " , -ZR_DEVNAME (zr), stat, zr->last_isr, +pci_err (zr->pci_dev,"JPEG error stat=0x%08x(0x%08x) queue_state=%ld/%ld/%ld/%ld seq=%ld frame=%ld. Codec stopped. " , + stat, zr->last_isr, zr->jpg_que_tail, zr->jpg_dma_tail, zr->jpg_dma_head, zr->jpg_que_head, zr->jpg_seq_num, frame);
@@ -1256,10 +1249,8 @@ irqreturn_t zoran_irq(int irq, void *dev_id)while ((stat =count_reset_interrupt (zr))) {if (count++ >100 ) {btand (~ZR36057_ICR_IntPinEn,ZR36057_ICR ); -dprintk (1 , -KERN_ERR -"%s: IRQ lockup while testing, isr=0x%08x, cleared int mask\n" , -ZR_DEVNAME (zr), stat); +pci_err (zr->pci_dev,"IRQ lockup while testing, isr=0x%08x, cleared int mask\n" , + stat);wake_up_interruptible (&zr->test_q); } }
@@ -1419,10 +1410,7 @@ irqreturn_t zoran_irq(int irq, void *dev_id) ZR_DEVNAME(zr), count);if (count >20 ) {btand (~ZR36057_ICR_IntPinEn,ZR36057_ICR ); -dprintk (2 , -KERN_ERR -"%s: IRQ lockup, cleared int mask\n" , -ZR_DEVNAME (zr)); +pci_err (zr->pci_dev,"IRQ lockup, cleared int mask\n" );break ; } }
drivers/staging/media/zoran/zoran_driver.c +78 -256
728 lines not on this page · raw message
drivers/staging/media/zoran/zoran_procfs.c +2 -2
@@ -26,6 +26,7 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/printk.h> #include <linux/vmalloc.h> #include <linux/proc_fs.h>
@@ -192,8 +193,7 @@ int zoran_proc_init(struct zoran *zr)"%s: procfs entry /proc/%s allocated. data=%p\n" , ZR_DEVNAME(zr), name, zr); }else { -dprintk (1 ,KERN_ERR "%s: Unable to initialise /proc/%s\n" , -ZR_DEVNAME (zr), name); +pr_err ("%s: Unable to initialise /proc/%s\n" ,ZR_DEVNAME (zr), name);return 1 ; }#endif
drivers/staging/media/zoran/zr36016.c +10 -29
@@ -48,9 +48,7 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg)if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg (ptr->codec, reg)) &0xFF ;else -dprintk (1 , -KERN_ERR "%s: invalid I/O setup, nothing read!\n" , - ptr->name); +pr_err ("%s: invalid I/O setup, nothing read!\n" , ptr->name);dprintk (4 ,"%s: reading from 0x%04x: %02x\n" , ptr->name, reg, value);
@@ -65,10 +63,7 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value)if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg (ptr->codec, reg, value);else -dprintk (1 , -KERN_ERR -"%s: invalid I/O setup, nothing written!\n" , - ptr->name); +pr_err ("%s: invalid I/O setup, nothing written!\n" , ptr->name); }/* indirect read and write functions */
@@ -83,10 +78,7 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg) ptr->codec->master_data->writereg (ptr->codec,ZR016_IADDR , reg &0x0F );// ADDR value = (ptr->codec->master_data->readreg (ptr->codec,ZR016_IDATA )) &0xFF ;// DATA }else { -dprintk (1 , -KERN_ERR -"%s: invalid I/O setup, nothing read (i)!\n" , - ptr->name); +pr_err ("%s: invalid I/O setup, nothing read (i)!\n" , ptr->name); }dprintk (4 ,"%s: reading indirect from 0x%04x: %02x\n" , ptr->name, reg, value);
@@ -103,10 +95,7 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value) ptr->codec->master_data->writereg (ptr->codec,ZR016_IADDR , reg &0x0F );// ADDR ptr->codec->master_data->writereg (ptr->codec,ZR016_IDATA , value &0x0FF );// DATA }else { -dprintk (1 , -KERN_ERR -"%s: invalid I/O setup, nothing written (i)!\n" , - ptr->name); +pr_err ("%s: invalid I/O setup, nothing written (i)!\n" , ptr->name); } }
@@ -144,27 +133,19 @@ static int zr36016_basic_test(struct zr36016 *ptr)// it back in both cases zr36016_writei (ptr,ZR016I_PAX_LO ,0x00 );if (zr36016_readi (ptr,ZR016I_PAX_LO ) !=0x0 ) { -dprintk (1 , -KERN_ERR -"%s: attach failed, can't connect to vfe processor!\n" , - ptr->name); +pr_err ("%s: attach failed, can't connect to vfe processor!\n" , ptr->name);return -ENXIO ; }zr36016_writei (ptr,ZR016I_PAX_LO ,0x0d0 );if (zr36016_readi (ptr,ZR016I_PAX_LO ) !=0x0d0 ) { -dprintk (1 , -KERN_ERR -"%s: attach failed, can't connect to vfe processor!\n" , - ptr->name); +pr_err ("%s: attach failed, can't connect to vfe processor!\n" , ptr->name);return -ENXIO ; }// we allow version numbers from 0-3, should be enough, though zr36016_read_version (ptr);if (ptr->version &0x0c ) { -dprintk (1 , -KERN_ERR -"%s: attach failed, suspicious version %d found...\n" , - ptr->name, ptr->version); +pr_err ("%s: attach failed, suspicious version %d found...\n" , ptr->name, + ptr->version);return -ENXIO ; }
@@ -376,12 +357,12 @@ static int zr36016_setup(struct videocodec *codec)dprintk (2 ,"zr36016: initializing VFE subsystem #%d.\n" , zr36016_codecs);if (zr36016_codecs ==MAX_CODECS ) { -dprintk (1 ,KERN_ERR "zr36016: Can't attach more codecs!\n" ); +pr_err ("zr36016: Can't attach more codecs!\n" );return -ENOSPC ; }//mem structure init codec->data = ptr =kzalloc (sizeof (struct zr36016 ),GFP_KERNEL ); -if (!ptr) { +if (!ptr)return -ENOMEM ;snprintf (ptr->name,sizeof (ptr->name),"zr36016[%d]" , zr36016_codecs);
drivers/staging/media/zoran/zr36050.c +3 -7
@@ -448,8 +448,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1);if ((ptr->status1 &0x4 ) ==0 ) { -dprintk (1 ,KERN_ERR "%s: init aborted!\n" , - ptr->name); +pr_err ("%s: init aborted!\n" , ptr->name);return ;// something is wrong, its timed out!!!! }
@@ -518,8 +517,7 @@ static void zr36050_init(struct zr36050 *ptr) ptr->name, ptr->status1);if ((ptr->status1 &0x4 ) ==0 ) { -dprintk (1 ,KERN_ERR "%s: init aborted!\n" , - ptr->name); +pr_err ("%s: init aborted!\n" , ptr->name);return ;// something is wrong, its timed out!!!! }
@@ -757,10 +755,8 @@ static int zr36050_setup(struct videocodec *codec) }//mem structure init codec->data = ptr =kzalloc (sizeof (struct zr36050 ),GFP_KERNEL ); -if (!ptr) { -dprintk (1 ,KERN_ERR "zr36050: Can't get enough memory!\n" ); +if (!ptr)return -ENOMEM ; - }snprintf (ptr->name,sizeof (ptr->name),"zr36050[%d]" , zr36050_codecs);
drivers/staging/media/zoran/zr36060.c +6 -18
@@ -59,9 +59,7 @@ static u8 zr36060_read(struct zr36060 *ptr, u16 reg)if (ptr->codec->master_data->readreg) value = (ptr->codec->master_data->readreg (ptr->codec, reg)) &0xff ;else -dprintk (1 , -KERN_ERR "%s: invalid I/O setup, nothing read!\n" , - ptr->name); +pr_err ("%s: invalid I/O setup, nothing read!\n" , ptr->name);return value; }
@@ -74,10 +72,7 @@ static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value)if (ptr->codec->master_data->writereg) ptr->codec->master_data->writereg (ptr->codec, reg, value);else -dprintk (1 , -KERN_ERR -"%s: invalid I/O setup, nothing written!\n" , - ptr->name); +pr_err ("%s: invalid I/O setup, nothing written!\n" , ptr->name); }/* =========================================================================
@@ -127,19 +122,13 @@ static int zr36060_basic_test(struct zr36060 *ptr) {if ((zr36060_read (ptr,ZR060_IDR_DEV ) !=0x33 ) && (zr36060_read (ptr,ZR060_IDR_REV ) !=0x01 )) { -dprintk (1 , -KERN_ERR -"%s: attach failed, can't connect to jpeg processor!\n" , - ptr->name); +pr_err ("%s: attach failed, can't connect to jpeg processor!\n" , ptr->name);return -ENXIO ; }zr36060_wait_end (ptr);if (ptr->status & ZR060_CFSR_Busy) { -dprintk (1 , -KERN_ERR -"%s: attach failed, jpeg processor failed (end flag)!\n" , - ptr->name); +pr_err ("%s: attach failed, jpeg processor failed (end flag)!\n" , ptr->name);return -EBUSY ; }
@@ -458,7 +447,7 @@ static void zr36060_init(struct zr36060 *ptr)dprintk (2 ,"%s: Status after table preload: 0x%02x\n" , ptr->name, ptr->status);if (ptr->status & ZR060_CFSR_Busy) { -dprintk (1 ,KERN_ERR "%s: init aborted!\n" , ptr->name); +pr_err ("%s: init aborted!\n" , ptr->name);return ;// something is wrong, its timed out!!!! } }
@@ -797,8 +786,7 @@ static int zr36060_setup(struct videocodec *codec)dprintk (2 ,"zr36060: initializing MJPEG subsystem #%d.\n" , zr36060_codecs);if (zr36060_codecs ==MAX_CODECS ) { -dprintk (1 , -KERN_ERR "zr36060: Can't attach more codecs!\n" ); +pr_err ("zr36060: Can't attach more codecs!\n" );return -ENOSPC ; }//mem structure init
Signature · 1 line
2.26.2
PATCH 9/49 staging: media: zoran: convert dprintk warn
In reply to Corentin LabbeThis patch convert dprintk(warn) to pci_warn.
--- drivers/staging/media/zoran/zoran_card.c | 18 ++++---------- drivers/staging/media/zoran/zoran_device.c | 13 +++------- drivers/staging/media/zoran/zoran_driver.c | 29 +++++----------------- 3 files changed, 14 insertions(+), 46 deletions(-)
drivers/staging/media/zoran/zoran_card.c +5 -13
@@ -933,19 +933,14 @@ static int zr36057_init(struct zoran *zr) zr->timing = zr->card.tvn[2 ]; }if (!zr->timing) { -dprintk (1 , -KERN_WARNING -"%s: %s - default TV standard not supported by hardware. PAL will be used.\n" , -ZR_DEVNAME (zr), __func__); +pci_warn (zr->pci_dev,"%s - default TV standard not supported by hardware. PAL will be used.\n" , __func__); zr->norm =V4L2_STD_PAL ; zr->timing = zr->card.tvn[0 ]; }if (default_input > zr->card.inputs -1 ) { -dprintk (1 , -KERN_WARNING -"%s: default_input value %d out of range (0-%d)\n" , -ZR_DEVNAME (zr), default_input, zr->card.inputs -1 ); +pci_warn (zr->pci_dev,"default_input value %d out of range (0-%d)\n" , + default_input, zr->card.inputs -1 ); default_input =0 ; } zr->input = default_input;
@@ -1369,11 +1364,8 @@ static int __init zoran_init(void) }/* some mainboards might not do PCI-PCI data transfer well */ -if (pci_pci_problems & (PCIPCI_FAIL |PCIAGP_FAIL |PCIPCI_ALIMAGIK )) { -dprintk (1 , -KERN_WARNING -"%s: chipset does not support reliable PCI-PCI DMA\n" ,ZORAN_NAME ); - } +if (pci_pci_problems & (PCIPCI_FAIL |PCIAGP_FAIL |PCIPCI_ALIMAGIK )) +pr_warn ("%s: chipset does not support reliable PCI-PCI DMA\n" ,ZORAN_NAME ); res =pci_register_driver (&zoran_driver);if (res) {
drivers/staging/media/zoran/zoran_device.c +3 -10
@@ -547,10 +547,7 @@ void zr36057_set_memgrab(struct zoran *zr, int mode)* will be stuck at 1 until capturing is turned back on. */ if (btread (ZR36057_VSSFGR ) & ZR36057_VSSFGR_SnapShot) -dprintk (1 , -KERN_WARNING -"%s: zr36057_set_memgrab(1) with SnapShot on!?\n" , -ZR_DEVNAME (zr)); +pci_warn (zr->pci_dev,"zr36057_set_memgrab(1) with SnapShot on!?\n" );/* switch on VSync interrupts */ btwrite (IRQ_MASK ,ZR36057_ISR );// Clear Interrupts
@@ -1284,10 +1281,7 @@ irqreturn_t zoran_irq(int irq, void *dev_id)if (zr->v4l_memgrab_active) {/* A lot more checks should be here ... */ if ((btread (ZR36057_VSSFGR ) & ZR36057_VSSFGR_SnapShot) ==0 ) -dprintk (1 , -KERN_WARNING -"%s: BuzIRQ with SnapShot off ???\n" , -ZR_DEVNAME (zr)); +pci_warn (zr->pci_dev,"BuzIRQ with SnapShot off ???\n" );if (zr->v4l_grab_frame !=NO_GRAB_ACTIVE ) {/* There is a grab on a frame going on, check if it has finished */
@@ -1406,8 +1400,7 @@ irqreturn_t zoran_irq(int irq, void *dev_id) count++;if (count >10 ) { -dprintk (2 ,KERN_WARNING "%s: irq loop %d\n" , -ZR_DEVNAME (zr), count); +pci_warn (zr->pci_dev,"irq loop %d\n" , count);if (count >20 ) {btand (~ZR36057_ICR_IntPinEn,ZR36057_ICR );pci_err (zr->pci_dev,"IRQ lockup, cleared int mask\n" );
drivers/staging/media/zoran/zoran_driver.c +6 -23
@@ -210,10 +210,7 @@ static int v4l_fbuffer_alloc(struct zoran_fh *fh)for (i =0 ; i < fh->buffers.num_buffers; i++) {if (fh->buffers.buffer[i].v4l.fbuffer) -dprintk (2 , -KERN_WARNING -"%s: %s - buffer %d already allocated!?\n" , -ZR_DEVNAME (zr), __func__, i); +pci_warn (zr->pci_dev,"%s - buffer %d already allocated!?\n" , __func__, i);//udelay(20); mem =kmalloc (fh->buffers.buffer_size,GFP_KERNEL | __GFP_NOWARN);
@@ -300,10 +297,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh)for (i =0 ; i < fh->buffers.num_buffers; i++) {if (fh->buffers.buffer[i].jpg.frag_tab) -dprintk (2 , -KERN_WARNING -"%s: %s - buffer %d already allocated!?\n" , -ZR_DEVNAME (zr), __func__, i); +pci_warn (zr->pci_dev,"%s - buffer %d already allocated!?\n" , __func__, i);/* Allocate fragment table for this buffer */
@@ -490,10 +484,7 @@ static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num) res = -EBUSY ;/* what are you doing? */ break ;case BUZ_STATE_DONE : -dprintk (2 , -KERN_WARNING -"%s: %s - queueing buffer %d in state DONE!?\n" , -ZR_DEVNAME (zr), __func__, num); +pci_warn (zr->pci_dev,"%s - queueing buffer %d in state DONE!?\n" , __func__, num);/* fallthrough */ case BUZ_STATE_USER :/* since there is at least one unused buffer there's room for at least
@@ -627,10 +618,7 @@ static int zoran_jpg_queue_frame(struct zoran_fh *fh, int num,if (!res) {switch (zr->jpg_buffers.buffer[num].state) {case BUZ_STATE_DONE : -dprintk (2 , -KERN_WARNING -"%s: %s - queuing frame in BUZ_STATE_DONE state!?\n" , -ZR_DEVNAME (zr), __func__); +pci_warn (zr->pci_dev,"%s - queuing frame in BUZ_STATE_DONE state!?\n" , __func__);/* fallthrough */ case BUZ_STATE_USER :/* since there is at least one unused buffer there's room for at
@@ -1330,10 +1318,7 @@ static int zoran_set_input(struct zoran *zr, int input)if (zr->v4l_buffers.active !=ZORAN_FREE || zr->jpg_buffers.active !=ZORAN_FREE ) { -dprintk (1 , -KERN_WARNING -"%s: %s called while in playback/capture mode\n" , -ZR_DEVNAME (zr), __func__); +pci_warn (zr->pci_dev,"%s called while in playback/capture mode\n" , __func__);return -EBUSY ; }
@@ -2285,9 +2270,7 @@ static int zoran_s_jpegcomp(struct file *file, void *__fh, settings.jpg_comp = *params;if (fh->buffers.active !=ZORAN_FREE ) { -dprintk (1 ,KERN_WARNING -"%s: VIDIOC_S_JPEGCOMP called while in playback/capture mode\n" , -ZR_DEVNAME (zr)); +pci_warn (zr->pci_dev,"VIDIOC_S_JPEGCOMP called while in playback/capture mode\n" ); res = -EBUSY ;return res; }
Signature · 1 line
2.26.2
PATCH 10/49 staging: media: zoran: convert dprintk info to pci_info
In reply to Corentin LabbeThis patch convert dprintk(info) to pci_info (or pci_dbg if the message is not important).
--- drivers/staging/media/zoran/zoran_card.c | 46 +++++++--------------- drivers/staging/media/zoran/zoran_device.c | 27 ++++--------- drivers/staging/media/zoran/zoran_driver.c | 34 ++++++---------- 3 files changed, 36 insertions(+), 71 deletions(-)
drivers/staging/media/zoran/zoran_card.c +15 -31
@@ -887,9 +887,9 @@ static void test_interrupts(struct zoran *zr)btwrite (0 ,ZR36057_ICR );btwrite (0x78000000 ,ZR36057_ISR ); zr->testing =0 ; -dprintk (5 ,KERN_INFO "%s: Testing interrupts...\n" ,ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"Testing interrupts...\n" );if (timeout) -dprintk (1 ,": time spent: %d\n" ,1 *HZ - timeout); +pci_info (zr->pci_dev,": time spent: %d\n" ,1 *HZ - timeout);if (zr36067_debug >1 )print_interrupts (zr);btwrite (icr,ZR36057_ICR );
@@ -899,10 +899,7 @@ static int zr36057_init(struct zoran *zr) {int j, err; -dprintk (1 , -KERN_INFO -"%s: %s - initializing card[%d], zr=%p\n" , -ZR_DEVNAME (zr), __func__, zr->id, zr); +pci_info (zr->pci_dev,"initializing card[%d]\n" , zr->id);/* default setup of all parameters which will persist between opens */ zr->user =0 ;
@@ -1134,18 +1131,12 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto zr_unreg; zr->revision = zr->pci_dev->revision; -dprintk (1 , -KERN_INFO -"%s: Zoran ZR360%c7 (rev %d), irq: %d, memory: 0x%08llx\n" , -ZR_DEVNAME (zr), zr->revision <2 ?'5' :'6' , zr->revision, - zr->pci_dev->irq, (uint64_t )pci_resource_start (zr->pci_dev,0 )); -if (zr->revision >=2 ) { -dprintk (1 , -KERN_INFO -"%s: Subsystem vendor=0x%04x id=0x%04x\n" , -ZR_DEVNAME (zr), zr->pci_dev->subsystem_vendor, - zr->pci_dev->subsystem_device); - } +pci_info (zr->pci_dev,"Zoran ZR360%c7 (rev %d), irq: %d, memory: 0x%08llx\n" , + zr->revision <2 ?'5' :'6' , zr->revision, + zr->pci_dev->irq, (uint64_t )pci_resource_start (zr->pci_dev,0 )); +if (zr->revision >=2 ) +pci_info (zr->pci_dev,"Subsystem vendor=0x%04x id=0x%04x\n" , + zr->pci_dev->subsystem_vendor, zr->pci_dev->subsystem_device);/* Use auto-detected card type? */ if (card[nr] ==-1 ) {
@@ -1208,14 +1199,13 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) &latency); need_latency = zr->revision >1 ?32 :48 ;if (latency != need_latency) { -dprintk (2 ,KERN_INFO "%s: Changing PCI latency from %d to %d\n" , -ZR_DEVNAME (zr), latency, need_latency); +pci_info (zr->pci_dev,"Changing PCI latency from %d to %d\n" , latency, need_latency);pci_write_config_byte (zr->pci_dev,PCI_LATENCY_TIMER , need_latency); }zr36057_restart (zr);/* i2c */ -dprintk (2 ,KERN_INFO "%s: Initializing i2c bus...\n" ,ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"Initializing i2c bus...\n" );if (zoran_register_i2c (zr) <0 ) {pci_err (pdev,"%s - can't initialize i2c bus\n" , __func__);
@@ -1229,7 +1219,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->encoder =v4l2_i2c_new_subdev (&zr->v4l2_dev, &zr->i2c_adapter, zr->card.i2c_encoder,0 , zr->card.addrs_encoder); -dprintk (2 ,KERN_INFO "%s: Initializing videocodec bus...\n" ,ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"Initializing videocodec bus...\n" );if (zr->card.video_codec) { codec_name =codecid_to_modulename (zr->card.video_codec);
@@ -1285,9 +1275,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* take care of Natoma chipset and a revision 1 zr36057 */ if ((pci_pci_problems &PCIPCI_NATOMA ) && zr->revision <=1 ) { zr->jpg_buffers.need_contiguous =1 ; -dprintk (1 ,KERN_INFO -"%s: ZR36057/Natoma bug, max. buffer size is 128K\n" , -ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"ZR36057/Natoma bug, max. buffer size is 128K\n" ); }if (zr36057_init (zr) <0 )
@@ -1356,12 +1344,8 @@ static int __init zoran_init(void)if (jpg_bufsize > (512 *1024 )) jpg_bufsize =512 *1024 ;/* Use parameter for vidmem or try to find a video card */ -if (vidmem) { -dprintk (1 , -KERN_INFO -"%s: Using supplied video memory base address @ 0x%lx\n" , -ZORAN_NAME , vidmem); - } +if (vidmem) +pr_info ("%s: Using supplied video memory base address @ 0x%lx\n" ,ZORAN_NAME , vidmem);/* some mainboards might not do PCI-PCI data transfer well */ if (pci_pci_problems & (PCIPCI_FAIL |PCIAGP_FAIL |PCIPCI_ALIMAGIK ))
drivers/staging/media/zoran/zoran_device.c +8 -19
@@ -118,8 +118,7 @@ int post_office_wait(struct zoran *zr) }if ((por & ZR36057_POR_POTime) && !zr->card.gws_not_connected) {/* In LML33/BUZ \GWS line is not connected, so it has always timeout set */ -dprintk (1 ,KERN_INFO "%s: pop timeout %08x\n" ,ZR_DEVNAME (zr), - por); +pci_info (zr->pci_dev,"pop timeout %08x\n" , por);return -1 ; }
@@ -218,16 +217,10 @@ void jpeg_codec_sleep(struct zoran *zr, int sleep) {GPIO (zr, zr->card.gpio[ZR_GPIO_JPEG_SLEEP ], !sleep);if (!sleep) { -dprintk (3 , -KERN_INFO -"%s: %s() - wake GPIO=0x%08x\n" , -ZR_DEVNAME (zr), __func__,btread (ZR36057_GPPGCR1 )); +pci_dbg (zr->pci_dev,"%s() - wake GPIO=0x%08x\n" , __func__,btread (ZR36057_GPPGCR1 ));udelay (500 ); }else { -dprintk (3 , -KERN_INFO -"%s: %s() - sleep GPIO=0x%08x\n" , -ZR_DEVNAME (zr), __func__,btread (ZR36057_GPPGCR1 )); +pci_dbg (zr->pci_dev,"%s() - sleep GPIO=0x%08x\n" , __func__,btread (ZR36057_GPPGCR1 ));udelay (2 ); } }
@@ -309,8 +302,7 @@ static void zr36057_set_vfe(struct zoran *zr, int video_width, int video_height, Wa = tvn->Wa; Ha = tvn->Ha; -dprintk (2 ,KERN_INFO "%s: set_vfe() - width = %d, height = %d\n" , -ZR_DEVNAME (zr), video_width, video_height); +pci_info (zr->pci_dev,"set_vfe() - width = %d, height = %d\n" , video_width, video_height); if (video_width < BUZ_MIN_WIDTH || video_height < BUZ_MIN_HEIGHT ||
@@ -940,8 +932,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode)zr36057_set_jpg (zr, mode);// \P_Reset, ... Video param, FIFO clear_interrupt_counters (zr); -dprintk (2 ,KERN_INFO "%s: enable_jpg(MOTION_COMPRESS)\n" , -ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"enable_jpg(MOTION_COMPRESS)\n" );break ; }
@@ -968,8 +959,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode)zr36057_set_jpg (zr, mode);// \P_Reset, ... Video param, FIFO clear_interrupt_counters (zr); -dprintk (2 ,KERN_INFO "%s: enable_jpg(MOTION_DECOMPRESS)\n" , -ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"enable_jpg(MOTION_DECOMPRESS)\n" );break ;case BUZ_MODE_IDLE :
@@ -994,7 +984,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode)decoder_call (zr, video, s_stream,1 );encoder_call (zr, video, s_routing,0 ,0 ,0 ); -dprintk (2 ,KERN_INFO "%s: enable_jpg(IDLE)\n" ,ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"enable_jpg(IDLE)\n" );break ; } }
@@ -1112,8 +1102,7 @@ static void zoran_restart(struct zoran *zr)jpeg_start (zr);if (zr->num_errors <=8 ) -dprintk (2 ,KERN_INFO "%s: Restart\n" , -ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"Restart\n" ); zr->JPEG_missed =0 ; zr->JPEG_error =2 ;
drivers/staging/media/zoran/zoran_driver.c +13 -21
@@ -225,11 +225,8 @@ static int v4l_fbuffer_alloc(struct zoran_fh *fh)for (off =0 ; off < fh->buffers.buffer_size; off +=PAGE_SIZE )SetPageReserved (virt_to_page (mem + off)); -dprintk (4 , -KERN_INFO -"%s: %s - V4L frame %d mem %p (bus: 0x%llx)\n" , -ZR_DEVNAME (zr), __func__, i, mem, - (unsigned long long )virt_to_bus (mem)); +pci_info (zr->pci_dev,"%s - V4L frame %d mem %p (bus: 0x%llx)\n" , __func__, i, mem, + (unsigned long long )virt_to_bus (mem)); } fh->buffers.allocated =1 ;
@@ -244,7 +241,7 @@ static void v4l_fbuffer_free(struct zoran_fh *fh)int i, off;unsigned char *mem; -dprintk (4 ,KERN_INFO "%s: %s\n" ,ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s\n" , __func__);for (i =0 ; i < fh->buffers.num_buffers; i++) {if (!fh->buffers.buffer[i].v4l.fbuffer)
@@ -820,8 +817,8 @@ static int zoran_open(struct file *file)struct zoran_fh *fh;int res, first_open =0 ; -dprintk (2 ,KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n" , -ZR_DEVNAME (zr), __func__, current->comm,task_pid_nr (current), zr->user +1 ); +pci_info (zr->pci_dev,"%s(%s, pid=[%d]), users(-)=%d\n" , __func__, current->comm, +task_pid_nr (current), zr->user +1 );mutex_lock (&zr->lock);
@@ -876,8 +873,7 @@ static int zoran_open(struct file *file) fail_unlock:mutex_unlock (&zr->lock); -dprintk (2 ,KERN_INFO "%s: open failed (%d), users(-)=%d\n" , -ZR_DEVNAME (zr), res, zr->user); +pci_info (zr->pci_dev,"open failed (%d), users(-)=%d\n" , res, zr->user);return res; }
@@ -887,8 +883,8 @@ static int zoran_close(struct file *file)struct zoran_fh *fh = file->private_data;struct zoran *zr = fh->zr; -dprintk (2 ,KERN_INFO "%s: %s(%s, pid=[%d]), users(+)=%d\n" , -ZR_DEVNAME (zr), __func__, current->comm,task_pid_nr (current), zr->user -1 ); +pci_info (zr->pci_dev,"%s(%s, pid=[%d]), users(+)=%d\n" , __func__, current->comm, +task_pid_nr (current), zr->user -1 );/* kernel locks (fs/device.c), so don't do that ourselves * (prevents deadlocks) */
@@ -933,7 +929,7 @@ static int zoran_close(struct file *file)kfree (fh->overlay_mask);kfree (fh); -dprintk (4 ,KERN_INFO "%s: %s done\n" ,ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s done\n" , __func__);return 0 ; }
@@ -2381,8 +2377,7 @@ static void zoran_vm_close(struct vm_area_struct *vma)struct zoran *zr = fh->zr;int i; -dprintk (3 ,KERN_INFO "%s: %s - munmap(%s)\n" ,ZR_DEVNAME (zr), - __func__,mode_name (fh->map_mode)); +pci_info (zr->pci_dev,"%s - munmap(%s)\n" ,ZR_DEVNAME (zr),mode_name (fh->map_mode));for (i =0 ; i < fh->buffers.num_buffers; i++) {if (fh->buffers.buffer[i].map == map)
@@ -2396,8 +2391,7 @@ static void zoran_vm_close(struct vm_area_struct *vma)return ; } -dprintk (3 ,KERN_INFO "%s: %s - free %s buffers\n" ,ZR_DEVNAME (zr), - __func__,mode_name (fh->map_mode)); +pci_info (zr->pci_dev,"%s - free %s buffers\n" , __func__,mode_name (fh->map_mode));if (fh->map_mode ==ZORAN_MAP_MODE_RAW ) {if (fh->buffers.active !=ZORAN_FREE ) {
@@ -2437,10 +2431,8 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma)struct zoran_mapping *map;int res =0 ; -dprintk (3 , -KERN_INFO "%s: %s(%s) of 0x%08lx-0x%08lx (size=%lu)\n" , -ZR_DEVNAME (zr), __func__, -mode_name (fh->map_mode), vma->vm_start, vma->vm_end, size); +pci_info (zr->pci_dev,"%s(%s) of 0x%08lx-0x%08lx (size=%lu)\n" , __func__, +mode_name (fh->map_mode), vma->vm_start, vma->vm_end, size);if (!(vma->vm_flags &VM_SHARED ) || !(vma->vm_flags &VM_READ ) || !(vma->vm_flags &VM_WRITE )) {
Signature · 1 line
2.26.2
PATCH 11/49 staging: media: zoran: convert dprintk debug
In reply to Corentin LabbeThis patch convert dprintk(debug) to pci_dbg.
--- drivers/staging/media/zoran/zoran_card.c | 30 ++++++++-------------- drivers/staging/media/zoran/zoran_card.h | 6 ----- drivers/staging/media/zoran/zoran_device.c | 2 +- drivers/staging/media/zoran/zoran_driver.c | 28 ++++++++------------ 4 files changed, 21 insertions(+), 45 deletions(-)
drivers/staging/media/zoran/zoran_card.c +10 -20
@@ -203,7 +203,7 @@ void zr36016_write(struct videocodec *codec, u16 reg, u32 val)static void dc10_init (struct zoran *zr) { -dprintk (3 ,KERN_DEBUG "%s: %s\n" ,ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s\n" , __func__);/* Pixel clock selection */ GPIO (zr,4 ,0 );
@@ -214,12 +214,12 @@ static void dc10_init(struct zoran *zr)static void dc10plus_init (struct zoran *zr) { -dprintk (3 ,KERN_DEBUG "%s: %s\n" ,ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s\n" , __func__); }static void buz_init (struct zoran *zr) { -dprintk (3 ,KERN_DEBUG "%s: %s\n" ,ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s\n" , __func__);/* some stuff from Iomega */ pci_write_config_dword (zr->pci_dev,0xfc ,0x90680f15 );
@@ -229,7 +229,7 @@ static void buz_init(struct zoran *zr)static void lml33_init (struct zoran *zr) { -dprintk (3 ,KERN_DEBUG "%s: %s\n" ,ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s\n" , __func__);GPIO (zr,2 ,1 );// Set Composite input/output }
@@ -669,15 +669,11 @@ int zoran_check_jpg_settings(struct zoran *zr, struct zoran_jpg_settings *settin {int err =0 , err0 =0 ; -dprintk (4 , -KERN_DEBUG -"%s: %s - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n" , -ZR_DEVNAME (zr), __func__, settings->decimation, settings->HorDcm, +pci_dbg (zr->pci_dev,"%s - dec: %d, Hdcm: %d, Vdcm: %d, Tdcm: %d\n" , + __func__, settings->decimation, settings->HorDcm, settings->VerDcm, settings->TmpDcm); -dprintk (4 , -KERN_DEBUG -"%s: %s - x: %d, y: %d, w: %d, y: %d\n" , -ZR_DEVNAME (zr), __func__, settings->img_x, settings->img_y, +pci_dbg (zr->pci_dev,"%s - x: %d, y: %d, w: %d, y: %d\n" , __func__, + settings->img_x, settings->img_y, settings->img_width, settings->img_height);/* Check decimation, set default values for decimation = 1, 2, 4 */ switch (settings->decimation) {
@@ -707,10 +703,7 @@ int zoran_check_jpg_settings(struct zoran *zr, struct zoran_jpg_settings *settincase 4 :if (zr->card.type == DC10_new) { -dprintk (1 , -KERN_DEBUG -"%s: %s - HDec by 4 is not supported on the DC10\n" , -ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s - HDec by 4 is not supported on the DC10\n" , __func__); err0++;break ; }
@@ -1151,10 +1144,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_err (pdev,"Unknown card, try specifying card=X module parameter\n" ); goto zr_unreg; } -dprintk (3 , -KERN_DEBUG -"%s: %s() - card %s detected\n" , -ZR_DEVNAME (zr), __func__, zoran_cards[card_num].name); +pci_info (zr->pci_dev,"%s() - card %s detected\n" , __func__, zoran_cards[card_num].name); }else { card_num = card[nr];if (card_num >=NUM_CARDS || card_num <0 ) {
drivers/staging/media/zoran/zoran_card.h +0 -6
@@ -14,12 +14,6 @@extern int zr36067_debug; -#define dprintk(num, format, args...) \ - do { \ - if (zr36067_debug >= num) \ - printk(format, ##args); \ - } while (0) -/* Anybody who uses more than four? */ #define BUZ_MAX 4
drivers/staging/media/zoran/zoran_device.c +1 -1
@@ -871,7 +871,7 @@ void jpeg_start(struct zoran *zr)set_frame (zr,1 );// /FRAME -dprintk (3 ,KERN_DEBUG "%s: jpeg_start\n" ,ZR_DEVNAME (zr)); +pci_dbg (zr->pci_dev,"jpeg_start\n" ); }void zr36057_enable_jpg (struct zoran *zr,enum zoran_codec_mode mode)
drivers/staging/media/zoran/zoran_driver.c +10 -18
@@ -341,9 +341,7 @@ static int jpg_fbuffer_alloc(struct zoran_fh *fh) } } -dprintk (4 , -KERN_DEBUG "%s: %s - %d KB allocated\n" , -ZR_DEVNAME (zr), __func__, +pci_dbg (zr->pci_dev,"%s - %d KB allocated\n" , __func__, (fh->buffers.num_buffers * fh->buffers.buffer_size) >>10 ); fh->buffers.allocated =1 ;
@@ -360,7 +358,7 @@ static void jpg_fbuffer_free(struct zoran_fh *fh)__le32 frag_tab;struct zoran_buffer *buffer; -dprintk (4 ,KERN_DEBUG "%s: %s\n" ,ZR_DEVNAME (zr), __func__); +pci_dbg (zr->pci_dev,"%s\n" , __func__);for (i =0 , buffer = &fh->buffers.buffer[0 ]; i < fh->buffers.num_buffers; i++, buffer++) {
@@ -1185,10 +1183,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, }spin_lock_irqsave (&zr->spinlock, flags); -dprintk (3 , -KERN_DEBUG -"%s: %s() - raw active=%c, buffer %d: state=%c, map=%c\n" , -ZR_DEVNAME (zr), __func__, +pci_dbg (zr->pci_dev,"%s() - raw active=%c, buffer %d: state=%c, map=%c\n" , __func__,"FAL" [fh->buffers.active], num,"UPMD" [zr->v4l_buffers.buffer[num].state], fh->buffers.buffer[num].map ?'Y' :'N' );
@@ -1563,9 +1558,10 @@ static int zoran_s_fmt_vid_overlay(struct file *file, void *__fh, struct v4l2_format *fmt) {struct zoran_fh *fh = __fh; +struct zoran *zr = fh->zr;int res; - dprintk(3, "x=%d, y=%d, w=%d, h=%d, cnt=%d, map=0x%p\n", + pci_dbg(zr->pci_dev, "x=%d, y=%d, w=%d, h=%d, cnt=%d, map=0x%p\n", fmt->fmt.win.w.left, fmt->fmt.win.w.top, fmt->fmt.win.w.width, fmt->fmt.win.w.height,
@@ -1586,7 +1582,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_formatstruct zoran_jpg_settings settings;int res =0 ; -dprintk (3 ,"size=%dx%d, fmt=0x%x (%4.4s)\n" , +pci_dbg (zr->pci_dev,"size=%dx%d, fmt=0x%x (%4.4s)\n" , fmt->fmt.pix.width, fmt->fmt.pix.height, fmt->fmt.pix.pixelformat, (char *)&printformat);
@@ -2303,10 +2299,8 @@ static __poll_t zoran_poll(struct file *file, poll_table *wait) frame = zr->v4l_pend[zr->v4l_sync_tail &V4L_MASK_FRAME ];spin_lock_irqsave (&zr->spinlock, flags); -dprintk (3 , -KERN_DEBUG -"%s: %s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n" , -ZR_DEVNAME (zr), __func__, +pci_dbg (zr->pci_dev,"%s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n" , + __func__,"FAL" [fh->buffers.active], zr->v4l_sync_tail,"UPMD" [zr->v4l_buffers.buffer[frame].state], zr->v4l_pend_tail, zr->v4l_pend_head);
@@ -2325,10 +2319,8 @@ static __poll_t zoran_poll(struct file *file, poll_table *wait) frame = zr->jpg_pend[zr->jpg_que_tail &BUZ_MASK_FRAME ];spin_lock_irqsave (&zr->spinlock, flags); -dprintk (3 , -KERN_DEBUG -"%s: %s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n" , -ZR_DEVNAME (zr), __func__, +pci_dbg (zr->pci_dev,"%s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n" , + __func__,"FAL" [fh->buffers.active], zr->jpg_que_tail,"UPMD" [zr->jpg_buffers.buffer[frame].state], zr->jpg_que_head, zr->jpg_dma_tail, zr->jpg_dma_head);
Signature · 1 line
2.26.2
PATCH 12/49 staging: media: zoran: zoran_device.c: convert pr_x to pci_x
In reply to Corentin Labbe--- drivers/staging/media/zoran/zoran_device.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/staging/media/zoran/zoran_device.c +5 -6
@@ -162,7 +162,7 @@ static void dump_guests(struct zoran *zr)for (i =1 ; i <8 ; i++)/* Don't read jpeg codec here */ guest[i] =post_office_read (zr, i,0 ); -pr_info ("%s: Guests: %*ph\n" ,ZR_DEVNAME (zr),8 , guest); +pci_info (zr->pci_dev,"Guests: %*ph\n" ,8 , guest); } }
@@ -172,7 +172,7 @@ void detect_guest_activity(struct zoran *zr)ktime_t t0, t1;dump_guests (zr); -pr_info ("%s: Detecting guests activity, please wait...\n" ,ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"Detecting guests activity, please wait...\n" );for (i =1 ; i <8 ; i++)/* Don't read jpeg codec here */ guest0[i] = guest[i] =post_office_read (zr, i,0 );
@@ -198,15 +198,14 @@ void detect_guest_activity(struct zoran *zr)break ; } -pr_info ("%s: Guests: %*ph\n" ,ZR_DEVNAME (zr),8 , guest0); +pci_info (zr->pci_dev,"Guests: %*ph\n" ,8 , guest0);if (j ==0 ) { -pr_info ("%s: No activity detected.\n" ,ZR_DEVNAME (zr)); +pci_info (zr->pci_dev,"No activity detected.\n" );return ; }for (i =0 ; i < j; i++) -pr_info ("%s: %6d: %d => 0x%02x\n" ,ZR_DEVNAME (zr), - change[i][0 ], change[i][1 ], change[i][2 ]); +pci_info (zr->pci_dev,"%6d: %d => 0x%02x\n" , change[i][0 ], change[i][1 ], change[i][2 ]); }/*
Signature · 1 line
2.26.2
PATCH 13/49 staging: media: zoran: remove proc_fs
In reply to Corentin LabbeThe zoran driver give some debug information in procfs, but this is not the right place.
So let's remove them, we will use debugfs later.
--- drivers/staging/media/zoran/Makefile | 2 +- drivers/staging/media/zoran/zoran.h | 5 - drivers/staging/media/zoran/zoran_card.c | 6 - drivers/staging/media/zoran/zoran_device.c | 1 - drivers/staging/media/zoran/zoran_driver.c | 1 - drivers/staging/media/zoran/zoran_procfs.c | 213 --------------------- drivers/staging/media/zoran/zoran_procfs.h | 32 ---- 7 files changed, 1 insertion(+), 259 deletions(-) delete mode 100644 drivers/staging/media/zoran/zoran_procfs.c delete mode 100644 drivers/staging/media/zoran/zoran_procfs.h
drivers/staging/media/zoran/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -zr36067-objs := zoran_procfs.o zoran_device.o \ +zr36067-objs := zoran_device.o \ zoran_driver.o zoran_card.o obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o
drivers/staging/media/zoran/zoran.h +0 -5
@@ -346,11 +346,6 @@ struct zoran {struct zoran_buffer_col jpg_buffers;/* MJPEG buffers' info */ /* Additional stuff for testing */ -#ifdef CONFIG_PROC_FS -struct proc_dir_entry *zoran_proc; -#else -void *zoran_proc; -#endif int testing;int jpeg_error;int intr_counter_GIRQ1;
drivers/staging/media/zoran/zoran_card.c +0 -6
@@ -18,7 +18,6 @@#include <linux/vmalloc.h> #include <linux/slab.h> -#include <linux/proc_fs.h> #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> #include <linux/videodev2.h>
@@ -38,7 +37,6 @@#include "zoran.h" #include "zoran_card.h" #include "zoran_device.h" -#include "zoran_procfs.h" extern const struct zoran_format zoran_formats[];
@@ -973,7 +971,6 @@ static int zr36057_init(struct zoran *zr)encoder_call (zr, video, s_routing,2 ,0 ,0 ); } - zr->zoran_proc =NULL ; zr->initialized =1 ;return 0 ;
@@ -1014,7 +1011,6 @@ static void zoran_remove(struct pci_dev *pdev)free_irq (zr->pci_dev->irq, zr);/* unmap and free memory */ kfree (zr->stat_com); -zoran_proc_cleanup (zr);iounmap (zr->zr36057_mem);pci_disable_device (zr->pci_dev);video_unregister_device (zr->video_dev);
@@ -1271,8 +1267,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (zr36057_init (zr) <0 ) goto zr_detach_vfe; -zoran_proc_init (zr); -return 0 ; zr_detach_vfe:
drivers/staging/media/zoran/zoran_device.c +0 -1
@@ -17,7 +17,6 @@#include <linux/sched/signal.h> #include <linux/interrupt.h> -#include <linux/proc_fs.h> #include <linux/i2c.h> #include <linux/i2c-algo-bit.h> #include <linux/videodev2.h>
drivers/staging/media/zoran/zoran_driver.c +0 -1
@@ -53,7 +53,6 @@#include <asm/byteorder.h> #include <linux/io.h> #include <linux/uaccess.h> -#include <linux/proc_fs.h> #include <linux/mutex.h> #include "zoran.h"
drivers/staging/media/zoran/zoran_procfs.c deleted +0 -213
213 lines not on this page · raw message
drivers/staging/media/zoran/zoran_procfs.h deleted +0 -32
@@ -1,32 +0,0 @@ -/* -* Zoran zr36057/zr36067 PCI controller driver, for the -* Pinnacle/Miro DC10/DC10+/DC30/DC30+, Iomega Buz, Linux -* Media Labs LML33/LML33R10. -* -* This part handles card-specific data and detection -* -* Copyright (C) 2000 Serguei Miridonov <[email protected]> -* -* Currently maintained by: -* Ronald Bultje <[email protected]> -* Laurent Pinchart <[email protected]> -* Mailinglist <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 2 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ - -#ifndef __ZORAN_PROCFS_H__ -#define __ZORAN_PROCFS_H__ - -extern int zoran_proc_init (struct zoran *zr); -extern void zoran_proc_cleanup (struct zoran *zr); - -#endif /* __ZORAN_PROCFS_H__ */
Signature · 1 line
2.26.2
PATCH 14/49 staging: media: zoran: use VFL_TYPE_VIDEO
In reply to Corentin LabbeThe VFL_TYPE_GRABBER type was removed, so let's use the new type.
--- drivers/staging/media/zoran/zoran_card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/zoran/zoran_card.c +1 -1
@@ -957,7 +957,7 @@ static int zr36057_init(struct zoran *zr)* another day. */ zr->video_dev->vfl_dir =VFL_DIR_M2M ; - err =video_register_device (zr->video_dev,VFL_TYPE_GRABBER , video_nr[zr->id]); + err =video_register_device (zr->video_dev,VFL_TYPE_VIDEO , video_nr[zr->id]);if (err <0 ) goto exit_free;video_set_drvdata (zr->video_dev, zr);
Signature · 1 line
2.26.2
PATCH 15/49 staging: media: zoran: use v4l2_buffer_set_timestamp
In reply to Corentin LabbeThe ns_to_timeval function is removed, so replace it with v4l2_buffer_set_timestamp().
--- drivers/staging/media/zoran/zoran_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/zoran/zoran_driver.c +2 -2
@@ -1197,7 +1197,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, fh->buffers.buffer[num].state == BUZ_STATE_USER) { buf->sequence = fh->buffers.buffer[num].bs.seq; buf->flags |= V4L2_BUF_FLAG_DONE; - buf->timestamp = ns_to_timeval(fh->buffers.buffer[num].bs.ts); + v4l2_buffer_set_timestamp(buf, fh->buffers.buffer[num].bs.ts); } else { buf->flags |=V4L2_BUF_FLAG_QUEUED ; }
@@ -1228,7 +1228,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh,if (fh->buffers.buffer[num].state ==BUZ_STATE_DONE || fh->buffers.buffer[num].state ==BUZ_STATE_USER ) { buf->sequence = fh->buffers.buffer[num].bs.seq; - buf->timestamp =ns_to_timeval (fh->buffers.buffer[num].bs.ts); +v4l2_buffer_set_timestamp (buf, fh->buffers.buffer[num].bs.ts); buf->bytesused = fh->buffers.buffer[num].bs.length; buf->flags |=V4L2_BUF_FLAG_DONE ; }else {
Signature · 1 line
2.26.2
PATCH 16/49 staging: media: zoran: do not print random guest 0
In reply to Corentin LabbeThe slot 0 of guest is never initialized and so we print later random data.
--- drivers/staging/media/zoran/zoran_device.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/staging/media/zoran/zoran_device.c +7 -0
@@ -158,6 +158,9 @@ static void dump_guests(struct zoran *zr)if (zr36067_debug >2 ) {int i, guest[8 ]; +/* do not print random data */ + guest[0 ] =0 ; +for (i =1 ; i <8 ; i++)/* Don't read jpeg codec here */ guest[i] =post_office_read (zr, i,0 );
@@ -170,6 +173,10 @@ void detect_guest_activity(struct zoran *zr)int timeout, i, j, res, guest[8 ], guest0[8 ], change[8 ][3 ];ktime_t t0, t1; +/* do not print random data */ + guest[0 ] =0 ; + guest0[0 ] =0 ; +dump_guests (zr);pci_info (zr->pci_dev,"Detecting guests activity, please wait...\n" );for (i =1 ; i <8 ; i++)/* Don't read jpeg codec here */
Signature · 1 line
2.26.2
PATCH 17/49 staging: media: zoran: move buffer_size out of zoran_fh
In reply to Corentin LabbeWe need to get rid of zoran_fh, so move the buffer_size directly in the zoran structure.
--- drivers/staging/media/zoran/zoran.h | 3 +- drivers/staging/media/zoran/zoran_device.c | 3 +- drivers/staging/media/zoran/zoran_driver.c | 62 +++++++++++----------- 3 files changed, 35 insertions(+), 33 deletions(-)
drivers/staging/media/zoran/zoran.h +2 -1
@@ -195,7 +195,7 @@ enum zoran_lock_activity {/* buffer collections */ struct zoran_buffer_col {enum zoran_lock_activity active;/* feature currently in use? */ -unsigned int num_buffers, buffer_size; +unsigned int num_buffers;struct zoran_buffer buffer[MAX_FRAME ];/* buffers */ u8 allocated;/* Flag if buffers are allocated */ u8 need_contiguous;/* Flag if contiguous buffers are needed */
@@ -292,6 +292,7 @@ struct zoran {v4l2_std_id norm;/* Current buffer params */ +unsigned int buffer_size;void *vbuf_base;int vbuf_height, vbuf_width;int vbuf_depth;
drivers/staging/media/zoran/zoran_device.c +1 -2
@@ -882,8 +882,7 @@ void jpeg_start(struct zoran *zr)void zr36057_enable_jpg (struct zoran *zr,enum zoran_codec_mode mode) {struct vfe_settings cap; -int field_size = - zr->jpg_buffers.buffer_size / zr->jpg_settings.field_per_buff; +int field_size = zr->buffer_size / zr->jpg_settings.field_per_buff; zr->codec_mode = mode;
drivers/staging/media/zoran/zoran_driver.c +32 -30
190 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 18/49 staging: media: zoran: move v4l_settings out of zoran_fh
In reply to Corentin LabbeWe need to get rid of zoran_fh, so move the v4l_settings directly in the zoran structure.
--- drivers/staging/media/zoran/zoran.h | 1 - drivers/staging/media/zoran/zoran_driver.c | 38 ++++++++++------------ 2 files changed, 17 insertions(+), 22 deletions(-)
drivers/staging/media/zoran/zoran.h +0 -1
@@ -217,7 +217,6 @@ struct zoran_fh {struct zoran_buffer_col buffers;/* buffers' info */ -struct zoran_v4l_settings v4l_settings;/* structure with a lot of things to play with */ struct zoran_jpg_settings jpg_settings;/* structure with a lot of things to play with */ };
drivers/staging/media/zoran/zoran_driver.c +17 -21
@@ -432,10 +432,10 @@ static int zoran_v4l_set_format(struct zoran_fh *fh, int width, int height,return -EINVAL ; } - fh->v4l_settings.width = width; - fh->v4l_settings.height = height; - fh->v4l_settings.format = format; - fh->v4l_settings.bytesperline = bpp * fh->v4l_settings.width; + zr->v4l_settings.width = width; + zr->v4l_settings.height = height; + zr->v4l_settings.format = format; + zr->v4l_settings.bytesperline = bpp * zr->v4l_settings.width;return 0 ; }
@@ -489,7 +489,7 @@ static int zoran_v4l_queue_frame(struct zoran_fh *fh, int num) zr->v4l_pend[zr->v4l_pend_head++ &V4L_MASK_FRAME ] = num; zr->v4l_buffers.buffer[num].state =BUZ_STATE_PEND ; zr->v4l_buffers.buffer[num].bs.length = - fh->v4l_settings.bytesperline * + zr->v4l_settings.bytesperline * zr->v4l_settings.height; fh->buffers.buffer[num] = zr->v4l_buffers.buffer[num];break ;
@@ -751,8 +751,6 @@ static void zoran_open_init_session(struct zoran_fh *fh) fh->overlay_settings.format = zr->overlay_settings.format; fh->overlay_active =ZORAN_FREE ; -/* v4l settings */ - fh->v4l_settings = zr->v4l_settings;/* jpg settings */ fh->jpg_settings = zr->jpg_settings;
@@ -1205,7 +1203,7 @@ static int zoran_v4l2_buffer_status(struct zoran_fh *fh, buf->flags |=V4L2_BUF_FLAG_QUEUED ; } -if (fh->v4l_settings.height <=BUZ_MAX_HEIGHT /2 ) +if (zr->v4l_settings.height <=BUZ_MAX_HEIGHT /2 ) buf->field =V4L2_FIELD_TOP ;else buf->field =V4L2_FIELD_INTERLACED ;
@@ -1418,14 +1416,13 @@ static int zoran_g_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_formatif (fh->map_mode !=ZORAN_MAP_MODE_RAW )return zoran_g_fmt_vid_out (file, fh, fmt); - fmt->fmt.pix.width = fh->v4l_settings.width; - fmt->fmt.pix.height = fh->v4l_settings.height; - fmt->fmt.pix.sizeimage = fh->v4l_settings.bytesperline * - fh->v4l_settings.height; - fmt->fmt.pix.pixelformat = fh->v4l_settings.format->fourcc; - fmt->fmt.pix.colorspace = fh->v4l_settings.format->colorspace; - fmt->fmt.pix.bytesperline = fh->v4l_settings.bytesperline; -if (BUZ_MAX_HEIGHT < (fh->v4l_settings.height *2 )) + fmt->fmt.pix.width = zr->v4l_settings.width; + fmt->fmt.pix.height = zr->v4l_settings.height; + fmt->fmt.pix.sizeimage = zr->v4l_settings.bytesperline * zr->v4l_settings.height; + fmt->fmt.pix.pixelformat = zr->v4l_settings.format->fourcc; + fmt->fmt.pix.colorspace = zr->v4l_settings.format->colorspace; + fmt->fmt.pix.bytesperline = zr->v4l_settings.bytesperline; +if (BUZ_MAX_HEIGHT < (zr->v4l_settings.height *2 )) fmt->fmt.pix.field =V4L2_FIELD_INTERLACED ;else fmt->fmt.pix.field =V4L2_FIELD_TOP ;
@@ -1691,10 +1688,10 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_formatreturn res;/* tell the user the results/missing stuff */ - fmt->fmt.pix.bytesperline = fh->v4l_settings.bytesperline; - fmt->fmt.pix.sizeimage = fh->v4l_settings.height * fh->v4l_settings.bytesperline; - fmt->fmt.pix.colorspace = fh->v4l_settings.format->colorspace; -if (BUZ_MAX_HEIGHT < (fh->v4l_settings.height *2 )) + fmt->fmt.pix.bytesperline = zr->v4l_settings.bytesperline; + fmt->fmt.pix.sizeimage = zr->v4l_settings.height * zr->v4l_settings.bytesperline; + fmt->fmt.pix.colorspace = zr->v4l_settings.format->colorspace; +if (BUZ_MAX_HEIGHT < (zr->v4l_settings.height *2 )) fmt->fmt.pix.field =V4L2_FIELD_INTERLACED ;else fmt->fmt.pix.field =V4L2_FIELD_TOP ;
@@ -1961,7 +1958,6 @@ static int zoran_streamon(struct file *file, void *__fh, enum v4l2_buf_type type } zr->v4l_buffers.active = fh->buffers.active =ZORAN_LOCKED ; - zr->v4l_settings = fh->v4l_settings; zr->v4l_sync_tail = zr->v4l_pend_tail; if (!zr->v4l_memgrab_active &&
Signature · 1 line
2.26.2
PATCH 19/49 staging: media: zoran: move jpg_settings out of zoran_fh
In reply to Corentin LabbeWe need to get rid of zoran_fh, so move the jpg_settings directly in the zoran structure.
--- drivers/staging/media/zoran/zoran.h | 2 - drivers/staging/media/zoran/zoran_driver.c | 103 ++++++++++----------- 2 files changed, 47 insertions(+), 58 deletions(-)
drivers/staging/media/zoran/zoran.h +0 -2
@@ -216,8 +216,6 @@ struct zoran_fh {enum zoran_lock_activity overlay_active;/* feature currently in use? */ struct zoran_buffer_col buffers;/* buffers' info */ - -struct zoran_jpg_settings jpg_settings;/* structure with a lot of things to play with */ };struct card_info {
drivers/staging/media/zoran/zoran_driver.c +47 -56
238 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 20/49 staging: media: zoran: move overlay_settings out of zoran_fh
In reply to Corentin LabbeWe need to get rid of zoran_fh, so move the overlay_settings directly in the zoran structure.
--- drivers/staging/media/zoran/zoran.h | 1 - drivers/staging/media/zoran/zoran_device.c | 8 ++--- drivers/staging/media/zoran/zoran_driver.c | 40 +++++++++------------- 3 files changed, 21 insertions(+), 28 deletions(-)
drivers/staging/media/zoran/zoran.h +0 -1
@@ -211,7 +211,6 @@ struct zoran_fh {enum zoran_map_mode map_mode;/* Flag which bufferset will map by next mmap() */ -struct zoran_overlay_settings overlay_settings;u32 *overlay_mask;/* overlay mask */ enum zoran_lock_activity overlay_active;/* feature currently in use? */
drivers/staging/media/zoran/zoran_device.c +4 -4
@@ -508,10 +508,10 @@ void write_overlay_mask(struct zoran_fh *fh, struct v4l2_clip *vp, int count) height += y; y =0 ; } -if (x + width > fh->overlay_settings.width) - width = fh->overlay_settings.width - x; -if (y + height > fh->overlay_settings.height) - height = fh->overlay_settings.height - y; +if (x + width > zr->overlay_settings.width) + width = zr->overlay_settings.width - x; +if (y + height > zr->overlay_settings.height) + height = zr->overlay_settings.height - y;/* ignore degenerate clips */ if (height <=0 )
drivers/staging/media/zoran/zoran_driver.c +17 -23
@@ -744,9 +744,7 @@ static void zoran_open_init_session(struct zoran_fh *fh)map_mode_raw (fh);/* take over the card's current settings */ - fh->overlay_settings = zr->overlay_settings; - fh->overlay_settings.is_set =0 ; - fh->overlay_settings.format = zr->overlay_settings.format; + zr->overlay_settings.is_set =0 ; fh->overlay_active =ZORAN_FREE ;/* buffers */
@@ -1005,7 +1003,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int heightreturn -EINVAL ; } -if (!fh->overlay_settings.format) { +if (!zr->overlay_settings.format) {pci_err (zr->pci_dev,"%s - no overlay format set\n" , __func__);return -EINVAL ; }
@@ -1043,11 +1041,11 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int heightreturn -EINVAL ; } - fh->overlay_settings.x = x; - fh->overlay_settings.y = y; - fh->overlay_settings.width = width; - fh->overlay_settings.height = height; - fh->overlay_settings.clipcount = clipcount; + zr->overlay_settings.x = x; + zr->overlay_settings.y = y; + zr->overlay_settings.width = width; + zr->overlay_settings.height = height; + zr->overlay_settings.clipcount = clipcount;/* * If an overlay is running, we have to switch it off
@@ -1069,7 +1067,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int height*/ if (bitmap) {/* fake value - it just means we want clips */ - fh->overlay_settings.clipcount =1 ; + zr->overlay_settings.clipcount =1 ;if (copy_from_user (fh->overlay_mask, bitmap, (width * height +7 ) /8 )) {
@@ -1091,10 +1089,7 @@ static int setup_window(struct zoran_fh *fh, int x, int y, int width, int heightvfree (vcp); } - fh->overlay_settings.is_set =1 ; -if (fh->overlay_active !=ZORAN_FREE && - zr->overlay_active !=ZORAN_FREE ) - zr->overlay_settings = fh->overlay_settings; + zr->overlay_settings.is_set =1 ;if (on)zr36057_overlay (zr,1 );
@@ -1135,18 +1130,17 @@ static int setup_overlay(struct zoran_fh *fh, int on)zr36057_overlay (zr,0 ); zr->overlay_mask =NULL ; }else { -if (!zr->vbuf_base || !fh->overlay_settings.is_set) { +if (!zr->vbuf_base || !zr->overlay_settings.is_set) {pci_err (zr->pci_dev,"%s - buffer or window not set\n" , __func__);return -EINVAL ; } -if (!fh->overlay_settings.format) { +if (!zr->overlay_settings.format) {pci_err (zr->pci_dev,"%s - no overlay format set\n" , __func__);return -EINVAL ; } zr->overlay_active = fh->overlay_active =ZORAN_LOCKED ; zr->v4l_overlay_active =1 ; zr->overlay_mask = fh->overlay_mask; - zr->overlay_settings = fh->overlay_settings;if (!zr->v4l_memgrab_active)zr36057_overlay (zr,1 );/*
@@ -1430,11 +1424,11 @@ static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh,struct zoran_fh *fh = __fh;struct zoran *zr = fh->zr; - fmt->fmt.win.w.left = fh->overlay_settings.x; - fmt->fmt.win.w.top = fh->overlay_settings.y; - fmt->fmt.win.w.width = fh->overlay_settings.width; - fmt->fmt.win.w.height = fh->overlay_settings.height; -if (fh->overlay_settings.width *2 >BUZ_MAX_HEIGHT ) + fmt->fmt.win.w.left = zr->overlay_settings.x; + fmt->fmt.win.w.top = zr->overlay_settings.y; + fmt->fmt.win.w.width = zr->overlay_settings.width; + fmt->fmt.win.w.height = zr->overlay_settings.height; +if (zr->overlay_settings.width *2 >BUZ_MAX_HEIGHT ) fmt->fmt.win.field =V4L2_FIELD_INTERLACED ;else fmt->fmt.win.field =V4L2_FIELD_TOP ;
@@ -1703,7 +1697,7 @@ static int zoran_g_fbuf(struct file *file, void *__fh, fb->fmt.width = zr->vbuf_width; fb->fmt.height = zr->vbuf_height;if (zr->overlay_settings.format) - fb->fmt.pixelformat = fh->overlay_settings.format->fourcc; + fb->fmt.pixelformat = zr->overlay_settings.format->fourcc; fb->fmt.bytesperline = zr->vbuf_bytesperline; fb->fmt.colorspace =V4L2_COLORSPACE_SRGB ; fb->fmt.field =V4L2_FIELD_INTERLACED ;
Signature · 1 line
2.26.2
PATCH 21/49 staging: media: zoran: Use video_drvdata to get struct zoran
In reply to Corentin LabbeUsing video_drvdata() is proper and shorter than using directly fh pointers.
--- drivers/staging/media/zoran/zoran_driver.c | 40 ++++++++-------------- 1 file changed, 14 insertions(+), 26 deletions(-)
drivers/staging/media/zoran/zoran_driver.c +14 -26
@@ -1320,8 +1320,7 @@ static int zoran_set_input(struct zoran *zr, int input)static int zoran_querycap (struct file *file,void *__fh,struct v4l2_capability *cap) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);strscpy (cap->card,ZR_DEVNAME (zr),sizeof (cap->card));strscpy (cap->driver,"zoran" ,sizeof (cap->driver));
@@ -1352,8 +1351,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)static int zoran_enum_fmt_vid_cap (struct file *file,void *__fh,struct v4l2_fmtdesc *f) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);return zoran_enum_fmt (zr, f,ZORAN_FORMAT_CAPTURE ); }
@@ -1361,8 +1359,7 @@ static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh,static int zoran_enum_fmt_vid_out (struct file *file,void *__fh,struct v4l2_fmtdesc *f) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);return zoran_enum_fmt (zr, f,ZORAN_FORMAT_PLAYBACK ); }
@@ -1370,8 +1367,7 @@ static int zoran_enum_fmt_vid_out(struct file *file, void *__fh,static int zoran_enum_fmt_vid_overlay (struct file *file,void *__fh,struct v4l2_fmtdesc *f) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);return zoran_enum_fmt (zr, f,ZORAN_FORMAT_OVERLAY ); }
@@ -1421,8 +1417,7 @@ static int zoran_g_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_formatstatic int zoran_g_fmt_vid_overlay (struct file *file,void *__fh,struct v4l2_format *fmt) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file); fmt->fmt.win.w.left = zr->overlay_settings.x; fmt->fmt.win.w.top = zr->overlay_settings.y;
@@ -1439,8 +1434,7 @@ static int zoran_g_fmt_vid_overlay(struct file *file, void *__fh,static int zoran_try_fmt_vid_overlay (struct file *file,void *__fh,struct v4l2_format *fmt) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);if (fmt->fmt.win.w.width >BUZ_MAX_WIDTH ) fmt->fmt.win.w.width =BUZ_MAX_WIDTH ;
@@ -1641,8 +1635,8 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_formatstatic int zoran_s_fmt_vid_cap (struct file *file,void *__fh,struct v4l2_format *fmt) { +struct zoran *zr =video_drvdata (file);struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr;int i;int res =0 ;
@@ -1689,8 +1683,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_formatstatic int zoran_g_fbuf (struct file *file,void *__fh,struct v4l2_framebuffer *fb) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);memset (fb,0 ,sizeof (*fb)); fb->base = zr->vbuf_base;
@@ -1709,8 +1702,8 @@ static int zoran_g_fbuf(struct file *file, void *__fh,static int zoran_s_fbuf (struct file *file,void *__fh,const struct v4l2_framebuffer *fb) { +struct zoran *zr =video_drvdata (file);struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr;int i, res =0 ;__le32 printformat =__cpu_to_le32 (fb->fmt.pixelformat);
@@ -2042,8 +2035,7 @@ static int zoran_streamoff(struct file *file, void *__fh, enum v4l2_buf_type typstatic int zoran_g_std (struct file *file,void *__fh,v4l2_std_id *std) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file); *std = zr->norm;return 0 ;
@@ -2051,8 +2043,7 @@ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std)static int zoran_s_std (struct file *file,void *__fh,v4l2_std_id std) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);int res =0 ; res =zoran_set_norm (zr, std);
@@ -2065,8 +2056,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)static int zoran_enum_input (struct file *file,void *__fh,struct v4l2_input *inp) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);if (inp->index >= zr->card.inputs)return -EINVAL ;
@@ -2082,8 +2072,7 @@ static int zoran_enum_input(struct file *file, void *__fh, struct v4l2_input *instatic int zoran_g_input (struct file *file,void *__fh,unsigned int *input) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file); *input = zr->input;
@@ -2092,8 +2081,7 @@ static int zoran_g_input(struct file *file, void *__fh, unsigned int *input)static int zoran_s_input (struct file *file,void *__fh,unsigned int input) { -struct zoran_fh *fh = __fh; -struct zoran *zr = fh->zr; +struct zoran *zr =video_drvdata (file);int res; res =zoran_set_input (zr, input);
Signature · 1 line
2.26.2
PATCH 22/49 staging: media: zoran: Change zoran_v4l_set_format parameter from zoran_fh to zoran
In reply to Corentin LabbeWe need to get rid of zoran_fh, so let's change function arguments.
--- drivers/staging/media/zoran/zoran_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/media/zoran/zoran_driver.c +2 -4
@@ -401,11 +401,9 @@ static void jpg_fbuffer_free(struct zoran_fh *fh)/* * V4L Buffer grabbing */ - -static int zoran_v4l_set_format (struct zoran_fh *fh,int width,int height, +static int zoran_v4l_set_format (struct zoran *zr,int width,int height,const struct zoran_format *format) { -struct zoran *zr = fh->zr;int bpp;/* Check size and format of the grab wanted */
@@ -1665,7 +1663,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_formatmap_mode_raw (fh); - res =zoran_v4l_set_format (fh, fmt->fmt.pix.width, fmt->fmt.pix.height, &zoran_formats[i]); + res =zoran_v4l_set_format (zr, fmt->fmt.pix.width, fmt->fmt.pix.height, &zoran_formats[i]);if (res)return res;
Signature · 1 line
2.26.2
PATCH 23/49 staging: media: zoran: remove overlay
In reply to Corentin LabbeSupporting overlay is not necessary today, so let's reduce the code size by removing it.
--- drivers/staging/media/zoran/zoran.h | 16 - drivers/staging/media/zoran/zoran_card.c | 6 - drivers/staging/media/zoran/zoran_device.c | 143 +-------- drivers/staging/media/zoran/zoran_driver.c | 337 +-------------------- 4 files changed, 12 insertions(+), 490 deletions(-)
drivers/staging/media/zoran/zoran.h +0 -16
@@ -139,14 +139,6 @@ struct zoran_format {#define ZORAN_FORMAT_CAPTURE BIT(2)#define ZORAN_FORMAT_PLAYBACK BIT(3) -/* overlay-settings */ -struct zoran_overlay_settings { -int is_set; -int x, y, width, height;/* position */ -int clipcount;/* position and number of clips */ -const struct zoran_format *format;/* overlay format */ -}; -/* v4l-capture settings */ struct zoran_v4l_settings {int width, height, bytesperline;/* capture size */
@@ -211,9 +203,6 @@ struct zoran_fh {enum zoran_map_mode map_mode;/* Flag which bufferset will map by next mmap() */ -u32 *overlay_mask;/* overlay mask */ -enum zoran_lock_activity overlay_active;/* feature currently in use? */ -struct zoran_buffer_col buffers;/* buffers' info */ };
@@ -294,13 +283,8 @@ struct zoran {int vbuf_depth;int vbuf_bytesperline; -struct zoran_overlay_settings overlay_settings; -u32 *overlay_mask;/* overlay mask */ -enum zoran_lock_activity overlay_active;/* feature currently in use? */ -wait_queue_head_t v4l_capq; -int v4l_overlay_active;/* Overlay grab is activated */ int v4l_memgrab_active;/* Memory grab is activated */ int v4l_grab_frame;/* Frame number being currently grabbed */
drivers/staging/media/zoran/zoran_card.c +0 -6
@@ -812,13 +812,7 @@ void zoran_open_init_params(struct zoran *zr) {int i; -/* User must explicitly set a window */ - zr->overlay_settings.is_set =0 ; - zr->overlay_mask =NULL ; - zr->overlay_active =ZORAN_FREE ; - zr->v4l_memgrab_active =0 ; - zr->v4l_overlay_active =0 ; zr->v4l_grab_frame =NO_GRAB_ACTIVE ; zr->v4l_grab_seq =0 ; zr->v4l_settings.width =192 ;
drivers/staging/media/zoran/zoran_device.c +2 -141
164 lines not on this page · raw message
drivers/staging/media/zoran/zoran_driver.c +10 -327
517 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 24/49 staging: media: zoran: Use DMA coherent for stat_com
In reply to Corentin LabbeInstead of using a fragile virt_to_bus, let's use proper DMA coherent for the stat_com entry.
--- drivers/staging/media/zoran/zoran.h | 2 ++ drivers/staging/media/zoran/zoran_card.c | 20 +++++++++++++------- drivers/staging/media/zoran/zoran_device.c | 3 +-- 3 files changed, 16 insertions(+), 9 deletions(-)
drivers/staging/media/zoran/zoran.h +2 -0
@@ -351,6 +351,8 @@ struct zoran {unsigned long frame_num;wait_queue_head_t test_q; + +dma_addr_t p_sc; };static inline struct zoran *to_zoran (struct v4l2_device *v4l2_dev)
drivers/staging/media/zoran/zoran_card.c +13 -7
@@ -931,11 +931,15 @@ static int zr36057_init(struct zoran *zr)zoran_open_init_params (zr);/* allocate memory *before* doing anything to the hardware in case allocation fails */ - zr->stat_com =kzalloc (BUZ_NUM_STAT_COM *4 ,GFP_KERNEL ); zr->video_dev =video_device_alloc (); -if (!zr->stat_com || !zr->video_dev) { +if (!zr->video_dev) { err = -ENOMEM ; - goto exit_free; + goto exit; + } + zr->stat_com =dma_alloc_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), &zr->p_sc,GFP_KERNEL ); +if (!zr->stat_com) { + err = -ENOMEM ; + goto exit_video; }for (j =0 ; j <BUZ_NUM_STAT_COM ; j++) zr->stat_com[j] =cpu_to_le32 (1 );/* mark as unavailable to zr36057 */
@@ -953,7 +957,7 @@ static int zr36057_init(struct zoran *zr) zr->video_dev->vfl_dir =VFL_DIR_M2M ; err =video_register_device (zr->video_dev,VFL_TYPE_VIDEO , video_nr[zr->id]);if (err <0 ) - goto exit_free; + goto exit_statcom;video_set_drvdata (zr->video_dev, zr);zoran_init_hardware (zr);
@@ -968,9 +972,11 @@ static int zr36057_init(struct zoran *zr) zr->initialized =1 ;return 0 ; -exit_free: -kfree (zr->stat_com); +exit_statcom: +dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), zr->stat_com, zr->p_sc); +exit_video:kfree (zr->video_dev); +exit:return err; }
@@ -1004,7 +1010,7 @@ static void zoran_remove(struct pci_dev *pdev)btwrite (0 ,ZR36057_SPGPPCR );free_irq (zr->pci_dev->irq, zr);/* unmap and free memory */ -kfree (zr->stat_com); +dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), zr->stat_com, zr->p_sc);iounmap (zr->zr36057_mem);pci_disable_device (zr->pci_dev);video_unregister_device (zr->video_dev);
drivers/staging/media/zoran/zoran_device.c +1 -2
@@ -576,8 +576,7 @@ static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode)//btor(ZR36057_VFESPFR_VCLKPol, ZR36057_VFESPFR); /* code base address */ - reg =virt_to_bus (zr->stat_com); -btwrite (reg,ZR36057_JCBA ); +btwrite (zr->p_sc,ZR36057_JCBA );/* FIFO threshold (FIFO is 160. double words) */ /* NOTE: decimal values here */
Signature · 1 line
2.26.2
Re: [PATCH RFT/RFC 24/49] staging: media: zoran: Use DMA coherent for stat_com
Quoted 30 lines · Corentin Labbe
Instead of using a fragile
virt_to_bus, let's use proper DMA coherent for thestat_comentry.Signed-off-by Corentin Labbe <[email protected]>--- drivers/staging/media/zoran/zoran.h | 2 ++ drivers/staging/media/zoran/zoran_card.c | 20 +++++++++++++------- drivers/staging/media/zoran/zoran_device.c | 3 +-- 3 files changed, 16 insertions(+), 9 deletions(-)drivers/staging/media/zoran/zoran.h +2
-0@@ -351,6 +351,8 @@ struct zoran {unsigned long frame_num;wait_queue_head_t test_q; + +dma_addr_t p_sc; };static inline struct zoran *to_zoran (struct v4l2_device *v4l2_dev)drivers/staging/media/zoran/zoran_card.c +0
-0@@ -931,11 +931,15 @@ static int zr36057_init(struct zoran *zr)zoran_open_init_params (zr);
drivers/staging/media/zoran/zoran_card.c static int zr36057_init(struct zoran *zr) · line 939
Quoted 10 lines
drivers/staging/media/zoran/zoran_card.c +4
-3/* allocate memory *before* doing anything to the hardware in case allocation fails */ - zr->stat_com =kzalloc (BUZ_NUM_STAT_COM *4 ,GFP_KERNEL ); zr->video_dev =video_device_alloc (); -if (!zr->stat_com || !zr->video_dev) { +if (!zr->video_dev) { err = -ENOMEM ; - goto exit_free; + goto exit; + } + zr->stat_com =dma_alloc_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), &zr->p_sc,GFP_KERNEL );
Again, don't write junk coe like this. Stick to the 80 lines unless you have a very good reason.
PATCH 25/49 staging: media: zoran: use ZR_NORM
In reply to Corentin LabbeInstead of using hardcoded numbers, let's use some define for ZR NORM.
--- drivers/staging/media/zoran/zoran.h | 4 ++++ drivers/staging/media/zoran/zoran_card.c | 8 ++++---- drivers/staging/media/zoran/zoran_driver.c | 6 +++--- 3 files changed, 11 insertions(+), 7 deletions(-)
drivers/staging/media/zoran/zoran.h +4 -0
@@ -22,6 +22,10 @@#include <media/v4l2-ctrls.h> #include <media/v4l2-fh.h> +#define ZR_NORM_PAL 0 +#define ZR_NORM_NTSC 1 +#define ZR_NORM_SECAM 2 +struct zoran_sync {unsigned long frame;/* number of buffer that has been free'd */ unsigned long length;/* number of code bytes in buffer (capture only) */
drivers/staging/media/zoran/zoran_card.c +4 -4
@@ -906,18 +906,18 @@ static int zr36057_init(struct zoran *zr) default_norm =0 ;if (default_norm ==0 ) { zr->norm =V4L2_STD_PAL ; - zr->timing = zr->card.tvn[0 ]; + zr->timing = zr->card.tvn[ZR_NORM_PAL ]; }else if (default_norm ==1 ) { zr->norm =V4L2_STD_NTSC ; - zr->timing = zr->card.tvn[1 ]; + zr->timing = zr->card.tvn[ZR_NORM_NTSC ]; }else { zr->norm =V4L2_STD_SECAM ; - zr->timing = zr->card.tvn[2 ]; + zr->timing = zr->card.tvn[ZR_NORM_SECAM ]; }if (!zr->timing) {pci_warn (zr->pci_dev,"%s - default TV standard not supported by hardware. PAL will be used.\n" , __func__); zr->norm =V4L2_STD_PAL ; - zr->timing = zr->card.tvn[0 ]; + zr->timing = zr->card.tvn[ZR_NORM_PAL ]; }if (default_input > zr->card.inputs -1 ) {
drivers/staging/media/zoran/zoran_driver.c +3 -3
@@ -1033,11 +1033,11 @@ static int zoran_set_norm(struct zoran *zr, v4l2_std_id norm) }if (norm &V4L2_STD_SECAM ) - zr->timing = zr->card.tvn[2 ]; + zr->timing = zr->card.tvn[ZR_NORM_SECAM ];else if (norm &V4L2_STD_NTSC ) - zr->timing = zr->card.tvn[1 ]; + zr->timing = zr->card.tvn[ZR_NORM_NTSC ];else - zr->timing = zr->card.tvn[0 ]; + zr->timing = zr->card.tvn[ZR_NORM_PAL ];decoder_call (zr, video, s_std, norm);encoder_call (zr, video, s_std_output, norm);
Signature · 1 line
2.26.2
PATCH 26/49 staging: media: zoran: zoran does not support STD_ALL
In reply to Corentin LabbeIn fact, zoran does not support V4L2_STD_ALL, so let's enumerate what we support.
--- drivers/staging/media/zoran/zoran_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/zoran/zoran_driver.c +1 -1
@@ -1749,7 +1749,7 @@ static int zoran_enum_input(struct file *file, void *__fh, struct v4l2_input *instrscpy (inp->name, zr->card.input[inp->index].name,sizeof (inp->name)); inp->type =V4L2_INPUT_TYPE_CAMERA ; - inp->std =V4L2_STD_ALL ; + inp->std =V4L2_STD_NTSC |V4L2_STD_PAL |V4L2_STD_SECAM ;/* Get status of video decoder */ decoder_call (zr, video, g_input_status, &inp->status);
Signature · 1 line
2.26.2
PATCH 27/49 staging: media: zoran: convert irq to pci irq
In reply to Corentin LabbeThis patch convert zoran to pci_irq functions.
--- drivers/staging/media/zoran/zoran_card.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/media/zoran/zoran_card.c +3 -4
@@ -1008,7 +1008,7 @@ static void zoran_remove(struct pci_dev *pdev)zoran_set_pci_master (zr,0 );/* put chip into reset */ btwrite (0 ,ZR36057_SPGPPCR ); -free_irq (zr->pci_dev->irq, zr); +pci_free_irq (zr->pci_dev,0 , zr);/* unmap and free memory */ dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), zr->stat_com, zr->p_sc);iounmap (zr->zr36057_mem);
@@ -1166,8 +1166,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto zr_unreg; } - result =request_irq (zr->pci_dev->irq, zoran_irq, -IRQF_SHARED ,ZR_DEVNAME (zr), zr); + result =pci_request_irq (pdev,0 , zoran_irq,NULL , zr,ZR_DEVNAME (zr));if (result <0 ) {if (result == -EINVAL ) {pci_err (pdev,"%s - bad IRQ number or handler\n" , __func__);
@@ -1281,7 +1280,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)zoran_unregister_i2c (zr); zr_free_irq:btwrite (0 ,ZR36057_SPGPPCR ); -free_irq (zr->pci_dev->irq, zr); +pci_free_irq (zr->pci_dev,0 , zr); zr_unmap:iounmap (zr->zr36057_mem); zr_unreg:
Signature · 1 line
2.26.2
PATCH 28/49 staging: media: zoran: convert zoran alloc to devm
In reply to Corentin LabbeAllocate the zoran structure with devm_ functions permit to simplify code.
--- drivers/staging/media/zoran/zoran_card.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/media/zoran/zoran_card.c +1 -3
@@ -1017,7 +1017,6 @@ static void zoran_remove(struct pci_dev *pdev) exit_free:v4l2_ctrl_handler_free (&zr->hdl);v4l2_device_unregister (&zr->v4l2_dev); -kfree (zr); }void zoran_vdev_release (struct video_device *vdev)
@@ -1101,7 +1100,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return -ENOENT ; } - zr =kzalloc (sizeof (*zr),GFP_KERNEL ); + zr =devm_kzalloc (&pdev->dev,sizeof (*zr),GFP_KERNEL );if (!zr)return -ENOMEM ;
@@ -1287,7 +1286,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)v4l2_ctrl_handler_free (&zr->hdl);v4l2_device_unregister (&zr->v4l2_dev); zr_free_mem: -kfree (zr);return -ENODEV ; }
Signature · 1 line
2.26.2
PATCH 29/49 staging: media: zoran: convert mdelay to udelay
In reply to Corentin LabbeAs asked by checkpath, let's use udelay.
--- drivers/staging/media/zoran/zoran_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/zoran/zoran_device.c +2 -2
@@ -1315,9 +1315,9 @@ void zoran_init_hardware(struct zoran *zr)void zr36057_restart (struct zoran *zr) {btwrite (0 ,ZR36057_SPGPPCR ); -mdelay (1 ); +udelay (1000 );btor (ZR36057_SPGPPCR_SoftReset,ZR36057_SPGPPCR ); -mdelay (1 ); +udelay (1000 );/* assert P_Reset */ btwrite (0 ,ZR36057_JPC );
Signature · 1 line
2.26.2
PATCH 30/49 staging: media: zoran: use devm for videocodec_master alloc
In reply to Corentin LabbeLet's use devm allocations for videocodec, this simplify code.
--- drivers/staging/media/zoran/zoran_card.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-)
drivers/staging/media/zoran/zoran_card.c +5 -17
@@ -989,18 +989,10 @@ static void zoran_remove(struct pci_dev *pdev) goto exit_free;/* unregister videocodec bus */ -if (zr->codec) { -struct videocodec_master *master = zr->codec->master_data; - +if (zr->codec)videocodec_detach (zr->codec); -kfree (master); - } -if (zr->vfe) { -struct videocodec_master *master = zr->vfe->master_data; - +if (zr->vfe)videocodec_detach (zr->vfe); -kfree (master); - }/* unregister i2c bus */ zoran_unregister_i2c (zr);
@@ -1028,7 +1020,7 @@ static struct videocodec_master *zoran_setup_videocodec(struct zoran *zr, int ty {struct videocodec_master *m =NULL ; - m =kmalloc (sizeof (*m),GFP_KERNEL ); + m =devm_kmalloc (&zr->pci_dev->dev,sizeof (*m),GFP_KERNEL );if (!m)return m;
@@ -1234,7 +1226,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->codec =videocodec_attach (master_codec);if (!zr->codec) {pci_err (pdev,"%s - no codec found\n" , __func__); - goto zr_free_codec; + goto zr_unreg_i2c; }if (zr->codec->type != zr->card.video_codec) {pci_err (pdev,"%s - wrong codec\n" , __func__);
@@ -1248,7 +1240,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->vfe =videocodec_attach (master_vfe);if (!zr->vfe) {pci_err (pdev,"%s - no VFE found\n" , __func__); - goto zr_free_vfe; + goto zr_detach_codec; }if (zr->vfe->type != zr->card.video_vfe) {pci_err (pdev,"%s = wrong VFE\n" , __func__);
@@ -1269,12 +1261,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr_detach_vfe:videocodec_detach (zr->vfe); -zr_free_vfe: -kfree (master_vfe); zr_detach_codec:videocodec_detach (zr->codec); -zr_free_codec: -kfree (master_codec); zr_unreg_i2c:zoran_unregister_i2c (zr); zr_free_irq:
Signature · 1 line
2.26.2
PATCH 31/49 staging: media: zoran: use pci_request_regions
In reply to Corentin LabbeUse pci_request_regions so now we can see zoran in /proc/iomem.
--- drivers/staging/media/zoran/zoran_card.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/staging/media/zoran/zoran_card.c +8 -1
@@ -1004,6 +1004,7 @@ static void zoran_remove(struct pci_dev *pdev)/* unmap and free memory */ dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), zr->stat_com, zr->p_sc);iounmap (zr->zr36057_mem); +pci_release_regions (pdev);pci_disable_device (zr->pci_dev);video_unregister_device (zr->video_dev); exit_free:
@@ -1151,10 +1152,14 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->card = zoran_cards[card_num];snprintf (ZR_DEVNAME (zr),sizeof (ZR_DEVNAME (zr)),"%s[%u]" , zr->card.name, zr->id); + err =pci_request_regions (pdev,ZR_DEVNAME (zr)); +if (err) + goto zr_unreg; + zr->zr36057_mem =pci_ioremap_bar (zr->pci_dev,0 );if (!zr->zr36057_mem) {pci_err (pdev,"%s() - ioremap failed\n" , __func__); - goto zr_unreg; + goto zr_pci_release; } result =pci_request_irq (pdev,0 , zoran_irq,NULL , zr,ZR_DEVNAME (zr));
@@ -1270,6 +1275,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)pci_free_irq (zr->pci_dev,0 , zr); zr_unmap:iounmap (zr->zr36057_mem); +zr_pci_release: +pci_release_regions (pdev); zr_unreg:v4l2_ctrl_handler_free (&zr->hdl);v4l2_device_unregister (&zr->v4l2_dev);
Signature · 1 line
2.26.2
PATCH 32/49 staging: media: zoran: use devm_ioremap
In reply to Corentin LabbeUsing devm_ioremap simplify code.
--- drivers/staging/media/zoran/zoran_card.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/media/zoran/zoran_card.c +2 -5
@@ -1003,7 +1003,6 @@ static void zoran_remove(struct pci_dev *pdev)pci_free_irq (zr->pci_dev,0 , zr);/* unmap and free memory */ dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), zr->stat_com, zr->p_sc); -iounmap (zr->zr36057_mem);pci_release_regions (pdev);pci_disable_device (zr->pci_dev);video_unregister_device (zr->video_dev);
@@ -1156,7 +1155,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (err) goto zr_unreg; - zr->zr36057_mem =pci_ioremap_bar (zr->pci_dev,0 ); + zr->zr36057_mem =devm_ioremap (&pdev->dev,pci_resource_start (pdev,0 ),pci_resource_len (pdev,0 ));if (!zr->zr36057_mem) {pci_err (pdev,"%s() - ioremap failed\n" , __func__); goto zr_pci_release;
@@ -1172,7 +1171,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }else {pci_err (pdev,"%s - cannot assign IRQ, error code %d\n" , __func__, result); } - goto zr_unmap; + goto zr_pci_release; }/* set PCI latency timer */
@@ -1273,8 +1272,6 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr_free_irq:btwrite (0 ,ZR36057_SPGPPCR );pci_free_irq (zr->pci_dev,0 , zr); -zr_unmap: -iounmap (zr->zr36057_mem); zr_pci_release:pci_release_regions (pdev); zr_unreg:
Signature · 1 line
2.26.2
PATCH 33/49 staging: media: zoran: add stat_com buffer
In reply to Corentin LabbeThis patch adds the allocation of the stat_com buffer which be used later.
--- drivers/staging/media/zoran/zoran.h | 2 ++ drivers/staging/media/zoran/zoran_card.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/staging/media/zoran/zoran.h +2 -0
@@ -357,6 +357,8 @@ struct zoran {wait_queue_head_t test_q;dma_addr_t p_sc; +__le32 *stat_comb; +dma_addr_t p_scb; };static inline struct zoran *to_zoran (struct v4l2_device *v4l2_dev)
drivers/staging/media/zoran/zoran_card.c +10 -1
@@ -944,6 +944,12 @@ static int zr36057_init(struct zoran *zr)for (j =0 ; j <BUZ_NUM_STAT_COM ; j++) zr->stat_com[j] =cpu_to_le32 (1 );/* mark as unavailable to zr36057 */ + zr->stat_comb =dma_alloc_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32) *2 , &zr->p_scb,GFP_KERNEL ); +if (!zr->stat_comb) { + err = -ENOMEM ; + goto exit_statcom; + } +/* Now add the template and register the device unit. */ *zr->video_dev = zoran_template; zr->video_dev->v4l2_dev = &zr->v4l2_dev;
@@ -957,7 +963,7 @@ static int zr36057_init(struct zoran *zr) zr->video_dev->vfl_dir =VFL_DIR_M2M ; err =video_register_device (zr->video_dev,VFL_TYPE_VIDEO , video_nr[zr->id]);if (err <0 ) - goto exit_statcom; + goto exit_statcomb;video_set_drvdata (zr->video_dev, zr);zoran_init_hardware (zr);
@@ -972,6 +978,8 @@ static int zr36057_init(struct zoran *zr) zr->initialized =1 ;return 0 ; +exit_statcomb: +dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32) *2 , zr->stat_comb, zr->p_scb); exit_statcom:dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), zr->stat_com, zr->p_sc); exit_video:
@@ -1003,6 +1011,7 @@ static void zoran_remove(struct pci_dev *pdev)pci_free_irq (zr->pci_dev,0 , zr);/* unmap and free memory */ dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32), zr->stat_com, zr->p_sc); +dma_free_coherent (&zr->pci_dev->dev,BUZ_NUM_STAT_COM *sizeof (u32) *2 , zr->stat_comb, zr->p_scb);pci_release_regions (pdev);pci_disable_device (zr->pci_dev);video_unregister_device (zr->video_dev);
Signature · 1 line
2.26.2
PATCH 34/49 staging: media: zoran: constify struct tvnorm
In reply to Corentin LabbeThe structure tvnorm could be consified.
--- drivers/staging/media/zoran/videocodec.h | 2 +- drivers/staging/media/zoran/zoran.h | 4 ++-- drivers/staging/media/zoran/zoran_card.c | 24 +++++++++++----------- drivers/staging/media/zoran/zoran_device.c | 4 ++-- drivers/staging/media/zoran/zr36016.c | 4 ++-- drivers/staging/media/zoran/zr36050.c | 4 ++-- drivers/staging/media/zoran/zr36060.c | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-)
drivers/staging/media/zoran/videocodec.h +1 -1
@@ -256,7 +256,7 @@ struct videocodec {// set compression or decompression (or freeze, stop, standby, etc) int (*set_mode)(struct videocodec *codec,int mode);// setup picture size and norm (for the codec's video frontend) -int (*set_video)(struct videocodec *codec,struct tvnorm *norm, +int (*set_video)(struct videocodec *codec,const struct tvnorm *norm,struct vfe_settings *cap,struct vfe_polarity *pol);// other control commands, also mmap setup etc. int (*control)(struct videocodec *codec,int type,int size,void *data);
drivers/staging/media/zoran/zoran.h +2 -2
@@ -227,7 +227,7 @@ struct card_info { } input[BUZ_MAX_INPUT ];v4l2_std_id norms; -struct tvnorm *tvn[3 ];/* supported TV norms */ +const struct tvnorm *tvn[3 ];/* supported TV norms */ u32 jpeg_int;/* JPEG interrupt */ u32 vsync_int;/* VSYNC interrupt */
@@ -266,7 +266,7 @@ struct zoran {u8 initialized;/* flag if zoran has been correctly initialized */ int user;/* number of current users */ struct card_info card; -struct tvnorm *timing; +const struct tvnorm *timing;unsigned short id;/* number of this device */ char name[32 ];/* name of this device */
drivers/staging/media/zoran/zoran_card.c +12 -12
@@ -277,24 +277,24 @@ static char *codecid_to_modulename(u16 codecid)// u16 Wt, Wa, HStart, HSyncStart, Ht, Ha, VStart; // }; -static struct tvnorm f50sqpixel = {944 ,768 ,83 ,880 ,625 ,576 ,16 }; -static struct tvnorm f60sqpixel = {780 ,640 ,51 ,716 ,525 ,480 ,12 }; -static struct tvnorm f50ccir601 = {864 ,720 ,75 ,804 ,625 ,576 ,18 }; -static struct tvnorm f60ccir601 = {858 ,720 ,57 ,788 ,525 ,480 ,16 }; +static const struct tvnorm f50sqpixel = {944 ,768 ,83 ,880 ,625 ,576 ,16 }; +static const struct tvnorm f60sqpixel = {780 ,640 ,51 ,716 ,525 ,480 ,12 }; +static const struct tvnorm f50ccir601 = {864 ,720 ,75 ,804 ,625 ,576 ,18 }; +static const struct tvnorm f60ccir601 = {858 ,720 ,57 ,788 ,525 ,480 ,16 }; -static struct tvnorm f50ccir601_lml33 = {864 ,720 ,75 +34 ,804 ,625 ,576 ,18 }; -static struct tvnorm f60ccir601_lml33 = {858 ,720 ,57 +34 ,788 ,525 ,480 ,16 }; +static const struct tvnorm f50ccir601_lml33 = {864 ,720 ,75 +34 ,804 ,625 ,576 ,18 }; +static const struct tvnorm f60ccir601_lml33 = {858 ,720 ,57 +34 ,788 ,525 ,480 ,16 };/* The DC10 (57/16/50) uses VActive as HSync, so HStart must be 0 */ -static struct tvnorm f50sqpixel_dc10 = {944 ,768 ,0 ,880 ,625 ,576 ,0 }; -static struct tvnorm f60sqpixel_dc10 = {780 ,640 ,0 ,716 ,525 ,480 ,12 }; +static const struct tvnorm f50sqpixel_dc10 = {944 ,768 ,0 ,880 ,625 ,576 ,0 }; +static const struct tvnorm f60sqpixel_dc10 = {780 ,640 ,0 ,716 ,525 ,480 ,12 };/* * FIXME: I cannot swap U and V in saa7114, so i do one pixel left shift in zoran (75 -> 74) * (Maxim Yevtyushkin <[email protected]>) */ -static struct tvnorm f50ccir601_lm33r10 = {864 ,720 ,74 +54 ,804 ,625 ,576 ,18 }; -static struct tvnorm f60ccir601_lm33r10 = {858 ,720 ,56 +54 ,788 ,525 ,480 ,16 }; +static const struct tvnorm f50ccir601_lm33r10 = {864 ,720 ,74 +54 ,804 ,625 ,576 ,18 }; +static const struct tvnorm f60ccir601_lm33r10 = {858 ,720 ,56 +54 ,788 ,525 ,480 ,16 };/* * FIXME: The ks0127 seem incapable of swapping U and V, too, which is why I copy Maxim's left
@@ -303,8 +303,8 @@ static struct tvnorm f60ccir601_lm33r10 = { 858, 720, 56 + 54, 788, 525, 480, 16* Christer's driver used the unshifted norms, though... * /Sam */ -static struct tvnorm f50ccir601_avs6eyes = {864 ,720 ,74 ,804 ,625 ,576 ,18 }; -static struct tvnorm f60ccir601_avs6eyes = {858 ,720 ,56 ,788 ,525 ,480 ,16 }; +static const struct tvnorm f50ccir601_avs6eyes = {864 ,720 ,74 ,804 ,625 ,576 ,18 }; +static const struct tvnorm f60ccir601_avs6eyes = {858 ,720 ,56 ,788 ,525 ,480 ,16 };static const unsigned short vpx3220_addrs[] = {0x43 ,0x47 ,I2C_CLIENT_END };static const unsigned short saa7110_addrs[] = {0x4e ,0x4f ,I2C_CLIENT_END };
drivers/staging/media/zoran/zoran_device.c +2 -2
@@ -292,7 +292,7 @@ static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode)static void zr36057_set_vfe (struct zoran *zr,int video_width,int video_height,const struct zoran_format *format) { -struct tvnorm *tvn; +const struct tvnorm *tvn;unsigned int HStart, HEnd, VStart, VEnd;unsigned int DispMode;unsigned int VidWinWid, VidWinHt;
@@ -510,7 +510,7 @@ static void init_jpeg_queue(struct zoran *zr)static void zr36057_set_jpg (struct zoran *zr,enum zoran_codec_mode mode) { -struct tvnorm *tvn; +const struct tvnorm *tvn;u32 reg; tvn = zr->timing;
drivers/staging/media/zoran/zr36016.c +2 -2
@@ -238,8 +238,8 @@ static int zr36016_set_mode(struct videocodec *codec, int mode) }/* set picture size */ -static int zr36016_set_video (struct videocodec *codec,struct tvnorm *norm, -struct vfe_settings *cap,struct vfe_polarity *pol) +static int zr36016_set_video (struct videocodec *codec,const struct tvnorm *norm, +struct vfe_settings *cap,struct vfe_polarity *pol) {struct zr36016 *ptr = (struct zr36016 *)codec->data;
drivers/staging/media/zoran/zr36050.c +2 -2
@@ -554,8 +554,8 @@ static int zr36050_set_mode(struct videocodec *codec, int mode) }/* set picture size (norm is ignored as the codec doesn't know about it) */ -static int zr36050_set_video (struct videocodec *codec,struct tvnorm *norm, -struct vfe_settings *cap,struct vfe_polarity *pol) +static int zr36050_set_video (struct videocodec *codec,const struct tvnorm *norm, +struct vfe_settings *cap,struct vfe_polarity *pol) {struct zr36050 *ptr = (struct zr36050 *)codec->data;int size;
drivers/staging/media/zoran/zr36060.c +1 -1
@@ -477,7 +477,7 @@ static int zr36060_set_mode(struct videocodec *codec, int mode) }/* set picture size (norm is ignored as the codec doesn't know about it) */ -static int zr36060_set_video (struct videocodec *codec,struct tvnorm *norm, +static int zr36060_set_video (struct videocodec *codec,const struct tvnorm *norm,struct vfe_settings *cap,struct vfe_polarity *pol) {struct zr36060 *ptr = (struct zr36060 *)codec->data;
Signature · 1 line
2.26.2
PATCH 35/49 staging: media: zoran: constify codec_name
In reply to Corentin LabbeThe codec_name could be const.
--- drivers/staging/media/zoran/zoran_card.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/zoran/zoran_card.c +3 -3
@@ -254,9 +254,9 @@ static void avs6eyes_init(struct zoran *zr)GPIO (zr,7 , mux &4 );/* MUX S2 */ } -static char *codecid_to_modulename (u16 codecid) +static const char *codecid_to_modulename (u16 codecid) { -char *name =NULL ; +const char *name =NULL ;switch (codecid) {case CODEC_TYPE_ZR36060 :
@@ -1092,7 +1092,7 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)struct videocodec_master *master_vfe =NULL ;struct videocodec_master *master_codec =NULL ;int card_num; -char *codec_name, *vfe_name; +const char *codec_name, *vfe_name;unsigned int nr; nr = zoran_num++;
Signature · 1 line
2.26.2
PATCH 36/49 staging: media: zoran: Add more check for compliance
In reply to Corentin LabbeThe zoran driver miss some sanity checks, and this made v4l compliance happy.
--- drivers/staging/media/zoran/zoran_driver.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/staging/media/zoran/zoran_driver.c +17 -0
@@ -1092,6 +1092,11 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag) {unsigned int num, i; +if (fmt->index >=ARRAY_SIZE (zoran_formats)) +return -EINVAL ; +if (fmt->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE ) +return -EINVAL ; +for (num = i =0 ; i <NUM_FORMATS ; i++) {if (zoran_formats[i].flags & flag && num++ == fmt->index) {strscpy (fmt->description, zoran_formats[i].name,sizeof (fmt->description));
@@ -1244,6 +1249,12 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,if (i ==NUM_FORMATS )return -EINVAL ; + fmt->fmt.pix.colorspace = zoran_formats[i].colorspace; +if (BUZ_MAX_HEIGHT < (fmt->fmt.pix.height *2 )) + fmt->fmt.pix.field =V4L2_FIELD_INTERLACED ; +else + fmt->fmt.pix.field =V4L2_FIELD_TOP ; + bpp =DIV_ROUND_UP (zoran_formats[i].depth,8 );v4l_bound_align_image (&fmt->fmt.pix.width,BUZ_MIN_WIDTH ,BUZ_MAX_WIDTH , bpp ==2 ?1 :2 , &fmt->fmt.pix.height,BUZ_MIN_HEIGHT ,BUZ_MAX_HEIGHT ,0 ,0 );
@@ -1271,6 +1282,9 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh, struct v4l2_formatreturn res; } +if (!fmt->fmt.pix.height || !fmt->fmt.pix.width) +return -EINVAL ; + settings = zr->jpg_settings;/* we actually need to set 'real' parameters now */
@@ -1856,6 +1870,9 @@ static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selectio sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)return -EINVAL ; +if (!sel->r.width || !sel->r.height) +return -EINVAL ; +if (sel->target !=V4L2_SEL_TGT_CROP )return -EINVAL ;
Signature · 1 line
2.26.2
PATCH 37/49 staging: media: zoran: add fallthrough keyword
In reply to Corentin LabbeThis patch adds fallthrough keyword where appropriate.
--- drivers/staging/media/zoran/zoran_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/staging/media/zoran/zoran_device.c +6 -0
@@ -268,7 +268,9 @@ static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode)btwrite (reg,ZR36057_VFEHCR );break ;case BUZ_MODE_MOTION_COMPRESS : + fallthrough;case BUZ_MODE_IDLE : + fallthrough;default : if ((zr->norm & V4L2_STD_NTSC) || (zr->card.type == LML33R10 &&
@@ -521,6 +523,7 @@ static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode)/* MJPEG compression mode */ switch (mode) {case BUZ_MODE_MOTION_COMPRESS : + fallthrough;default : reg = ZR36057_JMC_MJPGCmpMode;break ;
@@ -582,6 +585,7 @@ static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode)/* NOTE: decimal values here */ switch (mode) {case BUZ_MODE_STILL_COMPRESS : + fallthrough;case BUZ_MODE_MOTION_COMPRESS :if (zr->card.type !=BUZ ) reg =140 ;
@@ -590,6 +594,7 @@ static void zr36057_set_jpg(struct zoran *zr, enum zoran_codec_mode mode)break ;case BUZ_MODE_STILL_DECOMPRESS : + fallthrough;case BUZ_MODE_MOTION_DECOMPRESS : reg =20 ;break ;
@@ -827,6 +832,7 @@ void zr36057_enable_jpg(struct zoran *zr, enum zoran_codec_mode mode)break ;case BUZ_MODE_IDLE : + fallthrough;default :/* shut down processing */ btand (~(zr->card.jpeg_int | ZR36057_ICR_JPEGRepIRQ),ZR36057_ICR );
Signature · 1 line
2.26.2
Re: [PATCH RFT/RFC 37/49] staging: media: zoran: add fallthrough keyword
Quoted 12 lines · Corentin Labbe
This patch adds fallthrough keyword where appropriate.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/staging/media/zoran/zoran_device.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/staging/media/zoran/zoran_device.c +0
-0
drivers/staging/media/zoran/zoran_device.c static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode) · line 274
Quoted 7 lines
drivers/staging/media/zoran/zoran_device.c +2
-0@@ -268,7 +268,9 @@ static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode)btwrite (reg,ZR36057_VFEHCR );break ;case BUZ_MODE_MOTION_COMPRESS : + fallthrough;case BUZ_MODE_IDLE : + fallthrough;default :
Hopefully, we don't need fallthrough labels for empty switch statements like this?
regards,
dan carpenter
Re: [PATCH RFT/RFC 37/49] staging: media: zoran: add fallthrough keyword
Quoted 8 lines · Dan Carpenter
Quoted 7 lines · Corentin Labbe
This patch adds fallthrough keyword where appropriate.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/staging/media/zoran/zoran_device.c | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 16 lines
drivers/staging/media/zoran/zoran_device.c static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode) · line 274
Quoted 12 lines
drivers/staging/media/zoran/zoran_device.c +2
-0@@ -268,7 +268,9 @@ static void zr36057_adjust_vfe(struct zoran *zr, enum zoran_codec_mode mode)btwrite (reg,ZR36057_VFEHCR );break ;case BUZ_MODE_MOTION_COMPRESS : + fallthrough;case BUZ_MODE_IDLE : + fallthrough;default :Hopefully, we don't need fallthrough labels for empty switch statements like this?
I have removed this patch and nothing warn about fallthrough missing.
But this is strange, if I have added them, it is because something (checkpatch ?) complained.
Anyway, nothing complains now, it is cleaner without them.
Thanks
PATCH 38/49 staging: media: zoran: Add vb_queue
In reply to Corentin LabbeThis patchs adds a vb_queue without using it.
This reduce the final VB2 conversion patch.
--- drivers/staging/media/zoran/Kconfig | 1 + drivers/staging/media/zoran/zoran.h | 30 +++ drivers/staging/media/zoran/zoran_card.c | 7 + drivers/staging/media/zoran/zoran_driver.c | 233 +++++++++++++++++++++ 4 files changed, 271 insertions(+)
drivers/staging/media/zoran/Kconfig +1 -0
@@ -2,6 +2,7 @@ config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux (Deprecated)" depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS depends on !ALPHA + select VIDEOBUF2_DMA_CONTIG help Say Y for support for MJPEG capture cards based on the Zoran 36057/36067 PCI controller chipset. This includes the Iomega
drivers/staging/media/zoran/zoran.h +30 -0
@@ -21,6 +21,9 @@#include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-fh.h> +#include <media/videobuf2-core.h> +#include <media/videobuf2-v4l2.h> +#include <media/videobuf2-dma-contig.h> #define ZR_NORM_PAL 0#define ZR_NORM_NTSC 1
@@ -33,6 +36,18 @@ struct zoran_sync {u64 ts;/* timestamp */ }; +struct zr_buffer { +/* common v4l buffer stuff -- must be first */ +struct vb2_v4l2_buffer vbuf; +struct list_head queue; +}; + +static inline struct zr_buffer *vb2_to_zr_buffer (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); + + return container_of(vbuf, struct zr_buffer, vbuf); +}#define ZORAN_NAME "ZORAN"/* name of the device */
@@ -104,6 +119,7 @@ enum zoran_buffer_state { };enum zoran_map_mode { +ZORAN_MAP_MODE_NONE ,ZORAN_MAP_MODE_RAW ,ZORAN_MAP_MODE_JPG_REC ,#define ZORAN_MAP_MODE_JPG ZORAN_MAP_MODE_JPG_REC
@@ -250,6 +266,7 @@ struct zoran {struct v4l2_device v4l2_dev;struct v4l2_ctrl_handler hdl;struct video_device *video_dev; +struct vb2_queue vq;struct i2c_adapter i2c_adapter;/* */ struct i2c_algo_bit_data i2c_algo;/* */
@@ -320,6 +337,7 @@ struct zoran {unsigned long jpg_err_seq;/* last seq_num before error */ unsigned long jpg_err_shift;unsigned long jpg_queued_num;/* count of frames queued since grab/play started */ +unsigned long vbseq;/* zr36057's code buffer table */ __le32 *stat_com;/* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */
@@ -350,15 +368,23 @@ struct zoran {int num_errors;int JPEG_max_missed;int JPEG_min_missed; +unsigned int prepared; +unsigned int queued;u32 last_isr;unsigned long frame_num; +int running; +int buf_in_reserve;wait_queue_head_t test_q;dma_addr_t p_sc;__le32 *stat_comb;dma_addr_t p_scb; +enum zoran_map_mode map_mode; +struct list_head queued_bufs; +spinlock_t queued_bufs_lock;/* Protects queued_bufs */ +struct zr_buffer *inuse[BUZ_NUM_STAT_COM *2 ]; };static inline struct zoran *to_zoran (struct v4l2_device *v4l2_dev)
@@ -376,3 +402,7 @@ static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev)#define btaor (dat, mask, adr) btwrite((dat) | ((mask) & btread(adr)), adr)#endif + +int zoran_queue_init (struct zoran *zr,struct vb2_queue *vq); +void zoran_queue_exit (struct zoran *zr); +int zr_set_buf (struct zoran *zr);
drivers/staging/media/zoran/zoran_card.c +7 -0
@@ -961,6 +961,9 @@ static int zr36057_init(struct zoran *zr)* another day. */ zr->video_dev->vfl_dir =VFL_DIR_M2M ; + +zoran_queue_init (zr, &zr->vq); + err =video_register_device (zr->video_dev,VFL_TYPE_VIDEO , video_nr[zr->id]);if (err <0 ) goto exit_statcomb;
@@ -996,6 +999,8 @@ static void zoran_remove(struct pci_dev *pdev)if (!zr->initialized) goto exit_free; +zoran_queue_exit (zr); +/* unregister videocodec bus */ if (zr->codec)videocodec_detach (zr->codec);
@@ -1270,6 +1275,8 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (zr36057_init (zr) <0 ) goto zr_detach_vfe; + zr->map_mode =ZORAN_MAP_MODE_RAW ; +return 0 ; zr_detach_vfe:
drivers/staging/media/zoran/zoran_driver.c +233 -0
236 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 39/49 staging: media: zoran: disable output
In reply to Corentin LabbeZoran is picky about jpeg data it accepts. At least it seems to not support COM and APPn. So until a way to filter data will be done, disable output.
--- drivers/staging/media/zoran/zoran_card.c | 2 ++ drivers/staging/media/zoran/zoran_driver.c | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/staging/media/zoran/zoran_card.c +2 -0
@@ -954,6 +954,8 @@ static int zr36057_init(struct zoran *zr) *zr->video_dev = zoran_template; zr->video_dev->v4l2_dev = &zr->v4l2_dev; zr->video_dev->lock = &zr->lock; + zr->video_dev->device_caps =V4L2_CAP_STREAMING |V4L2_CAP_VIDEO_CAPTURE ; +strscpy (zr->video_dev->name,ZR_DEVNAME (zr),sizeof (zr->video_dev->name));/* * It's not a mem2mem device, but you can both capture and output from one and the same
drivers/staging/media/zoran/zoran_driver.c +12 -8
@@ -1082,8 +1082,7 @@ static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capabilitystrscpy (cap->card,ZR_DEVNAME (zr),sizeof (cap->card));strscpy (cap->driver,"zoran" ,sizeof (cap->driver));snprintf (cap->bus_info,sizeof (cap->bus_info),"PCI:%s" ,pci_name (zr->pci_dev)); - cap->device_caps =V4L2_CAP_STREAMING |V4L2_CAP_VIDEO_CAPTURE | -V4L2_CAP_VIDEO_OUTPUT ; + cap->device_caps = zr->video_dev->device_caps; cap->capabilities = cap->device_caps |V4L2_CAP_DEVICE_CAPS ;return 0 ; }
@@ -2204,6 +2203,11 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma)return res; } +/* +* Output is disabled temporarily +* Zoran is picky about jpeg data it accepts. At least it seems to unsupport COM and APPn. +* So until a way to filter data will be done, disable output. +*/ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_querycap = zoran_querycap, .vidioc_s_selection = zoran_s_selection,
@@ -2211,9 +2215,9 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_enum_input = zoran_enum_input, .vidioc_g_input = zoran_g_input, .vidioc_s_input = zoran_s_input, - .vidioc_enum_output = zoran_enum_output, +/* .vidioc_enum_output = zoran_enum_output, .vidioc_g_output = zoran_g_output, - .vidioc_s_output = zoran_s_output, +.vidioc_s_output = zoran_s_output,*/ .vidioc_g_fbuf = zoran_g_fbuf, .vidioc_s_fbuf = zoran_s_fbuf, .vidioc_g_std = zoran_g_std,
@@ -2227,13 +2231,13 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_streamon = zoran_streamon, .vidioc_streamoff = zoran_streamoff, .vidioc_enum_fmt_vid_cap = zoran_enum_fmt_vid_cap, - .vidioc_enum_fmt_vid_out = zoran_enum_fmt_vid_out, +/* .vidioc_enum_fmt_vid_out = zoran_enum_fmt_vid_out,*/ .vidioc_g_fmt_vid_cap = zoran_g_fmt_vid_cap, - .vidioc_g_fmt_vid_out = zoran_g_fmt_vid_out, +/* .vidioc_g_fmt_vid_out = zoran_g_fmt_vid_out,*/ .vidioc_s_fmt_vid_cap = zoran_s_fmt_vid_cap, - .vidioc_s_fmt_vid_out = zoran_s_fmt_vid_out, +/* .vidioc_s_fmt_vid_out = zoran_s_fmt_vid_out,*/ .vidioc_try_fmt_vid_cap = zoran_try_fmt_vid_cap, - .vidioc_try_fmt_vid_out = zoran_try_fmt_vid_out, +/* .vidioc_try_fmt_vid_out = zoran_try_fmt_vid_out,*/ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe, };
Signature · 1 line
2.26.2
PATCH 40/49 staging: media: zoran: device support only 32bit DMA address
In reply to Corentin LabbeThe zoran device only supports 32bit DMA address.
--- drivers/staging/media/zoran/zoran_card.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/staging/media/zoran/zoran_card.c +6 -0
@@ -1101,6 +1101,12 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)int card_num;const char *codec_name, *vfe_name;unsigned int nr; +int err; + + err =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (32 )); +if (err) +return -ENODEV ; +vb2_dma_contig_set_max_seg_size (&pdev->dev,DMA_BIT_MASK (32 )); nr = zoran_num++;if (nr >=BUZ_MAX ) {
Signature · 1 line
2.26.2
PATCH 41/49 staging: media: zoran: enable makefile
In reply to Corentin LabbeThis patch enables compilation of the zoran driver.
--- drivers/staging/media/Makefile | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/Makefile +1 -0
@@ -12,3 +12,4 @@ obj-$(CONFIG_VIDEO_HANTRO) += hantro/ obj-$(CONFIG_VIDEO_IPU3_IMGU) += ipu3/ obj-$(CONFIG_PHY_ROCKCHIP_DPHY_RX0) += phy-rockchip-dphy-rx0/ obj-$(CONFIG_VIDEO_ROCKCHIP_ISP1) += rkisp1/ +obj-$(CONFIG_VIDEO_ZORAN) += zoran/
Signature · 1 line
2.26.2
PATCH 42/49 staging: media: zoran: remove framebuffer support
In reply to Corentin LabbeThe framebuffer support is obsolete, so let's reduce code size.
--- drivers/staging/media/zoran/zoran.h | 4 - drivers/staging/media/zoran/zoran_card.c | 6 -- drivers/staging/media/zoran/zoran_driver.c | 85 ---------------------- 3 files changed, 95 deletions(-)
drivers/staging/media/zoran/zoran.h +0 -4
@@ -299,10 +299,6 @@ struct zoran {/* Current buffer params */ unsigned int buffer_size; -void *vbuf_base; -int vbuf_height, vbuf_width; -int vbuf_depth; -int vbuf_bytesperline;wait_queue_head_t v4l_capq;
drivers/staging/media/zoran/zoran_card.c +0 -6
@@ -895,12 +895,6 @@ static int zr36057_init(struct zoran *zr) zr->jpg_buffers.allocated =0 ; zr->v4l_buffers.allocated =0 ; - zr->vbuf_base = (void *)vidmem; - zr->vbuf_width =0 ; - zr->vbuf_height =0 ; - zr->vbuf_depth =0 ; - zr->vbuf_bytesperline =0 ; -/* Avoid nonsense settings from user for default input/norm */ if (default_norm <0 || default_norm >2 ) default_norm =0 ;
drivers/staging/media/zoran/zoran_driver.c +0 -85
103 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 43/49 staging: media: zoran: add vidioc_g_parm
In reply to Corentin LabbeAdding vidioc_g_parm made v4l compliance happy.
--- drivers/staging/media/zoran/zoran_driver.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/staging/media/zoran/zoran_driver.c +9 -0
@@ -2120,6 +2120,14 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma)return res; } +static int zoran_g_parm (struct file *file,void *priv,struct v4l2_streamparm *parm) +{ +if (parm->type !=V4L2_BUF_TYPE_VIDEO_CAPTURE ) +return -EINVAL ; + +return 0 ; +} +/* * Output is disabled temporarily * Zoran is picky about jpeg data it accepts. At least it seems to unsupport COM and APPn.
@@ -2127,6 +2135,7 @@ static int zoran_mmap(struct file *file, struct vm_area_struct *vma)*/ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { .vidioc_querycap = zoran_querycap, + .vidioc_g_parm = zoran_g_parm, .vidioc_s_selection = zoran_s_selection, .vidioc_g_selection = zoran_g_selection, .vidioc_enum_input = zoran_enum_input,
Signature · 1 line
2.26.2
PATCH 44/49 staging: media: zoran: remove test_interrupts
In reply to Corentin LabbeThe test_interrupts function is useless, remove it.
--- drivers/staging/media/zoran/zoran.h | 3 --- drivers/staging/media/zoran/zoran_card.c | 27 ---------------------- drivers/staging/media/zoran/zoran_device.c | 16 ------------- 3 files changed, 46 deletions(-)
drivers/staging/media/zoran/zoran.h +0 -3
@@ -345,7 +345,6 @@ struct zoran {struct zoran_buffer_col jpg_buffers;/* MJPEG buffers' info */ /* Additional stuff for testing */ -int testing;int jpeg_error;int intr_counter_GIRQ1;int intr_counter_GIRQ0;
@@ -372,8 +371,6 @@ struct zoran {int running;int buf_in_reserve; -wait_queue_head_t test_q; -dma_addr_t p_sc;__le32 *stat_comb;dma_addr_t p_scb;
drivers/staging/media/zoran/zoran_card.c +0 -27
@@ -853,31 +853,6 @@ void zoran_open_init_params(struct zoran *zr)pci_err (zr->pci_dev,"%s internal error\n" , __func__);clear_interrupt_counters (zr); - zr->testing =0 ; -} - -static void test_interrupts (struct zoran *zr) -{ -DEFINE_WAIT (wait); -int timeout, icr; - -clear_interrupt_counters (zr); - - zr->testing =1 ; - icr =btread (ZR36057_ICR ); -btwrite (0x78000000 | ZR36057_ICR_IntPinEn,ZR36057_ICR ); -prepare_to_wait (&zr->test_q, &wait,TASK_INTERRUPTIBLE ); - timeout =schedule_timeout (HZ ); -finish_wait (&zr->test_q, &wait); -btwrite (0 ,ZR36057_ICR ); -btwrite (0x78000000 ,ZR36057_ISR ); - zr->testing =0 ; -pci_info (zr->pci_dev,"Testing interrupts...\n" ); -if (timeout) -pci_info (zr->pci_dev,": time spent: %d\n" ,1 *HZ - timeout); -if (zr36067_debug >1 ) -print_interrupts (zr); -btwrite (icr,ZR36057_ICR ); }static int zr36057_init (struct zoran *zr)
@@ -891,7 +866,6 @@ static int zr36057_init(struct zoran *zr)init_waitqueue_head (&zr->v4l_capq);init_waitqueue_head (&zr->jpg_capq); -init_waitqueue_head (&zr->test_q); zr->jpg_buffers.allocated =0 ; zr->v4l_buffers.allocated =0 ;
@@ -968,7 +942,6 @@ static int zr36057_init(struct zoran *zr)zoran_init_hardware (zr);if (zr36067_debug >2 )detect_guest_activity (zr); -test_interrupts (zr);if (!pass_through) {decoder_call (zr, video, s_stream,0 );encoder_call (zr, video, s_routing,2 ,0 ,0 );
drivers/staging/media/zoran/zoran_device.c +0 -16
@@ -1099,22 +1099,6 @@ irqreturn_t zoran_irq(int irq, void *dev_id)struct zoran *zr = dev_id;unsigned long flags; -if (zr->testing) { -/* Testing interrupts */ -spin_lock_irqsave (&zr->spinlock, flags); -while ((stat =count_reset_interrupt (zr))) { -if (count++ >100 ) { -btand (~ZR36057_ICR_IntPinEn,ZR36057_ICR ); -pci_err (zr->pci_dev,"IRQ lockup while testing, isr=0x%08x, cleared int mask\n" , - stat); -wake_up_interruptible (&zr->test_q); - } - } - zr->last_isr = stat; -spin_unlock_irqrestore (&zr->spinlock, flags); -return IRQ_HANDLED ; - } -spin_lock_irqsave (&zr->spinlock, flags);while (1 ) {/* get/clear interrupt status bits */
Signature · 1 line
2.26.2
PATCH 45/49 staging: media: zoran: fix use of buffer_size and sizeimage
In reply to Corentin Labbebuffer_size was not set when it should be.
Furthermore, use it instead of recalculate it.
--- drivers/staging/media/zoran/zoran_card.c | 2 ++ drivers/staging/media/zoran/zoran_driver.c | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/staging/media/zoran/zoran_card.c +2 -0
@@ -852,6 +852,8 @@ void zoran_open_init_params(struct zoran *zr)if (i)pci_err (zr->pci_dev,"%s internal error\n" , __func__); + zr->buffer_size = zr->v4l_settings.bytesperline * zr->v4l_settings.height; +clear_interrupt_counters (zr); }
drivers/staging/media/zoran/zoran_driver.c +6 -3
@@ -407,6 +407,8 @@ static int zoran_v4l_set_format(struct zoran *zr, int width, int height, bpp = (format->depth +7 ) /8 ; + zr->buffer_size = height * width * bpp; +/* Check against available buffer size */ if (height * width * bpp > zr->buffer_size) { pci_err(zr->pci_dev, "%s - video buffer size (%d kB) is too small\n",
@@ -1090,7 +1092,7 @@ static int zoran_g_fmt_vid_out(struct file *file, void *__fh, struct v4l2_format fmt->fmt.pix.width = zr->jpg_settings.img_width / zr->jpg_settings.HorDcm; fmt->fmt.pix.height = zr->jpg_settings.img_height *2 / (zr->jpg_settings.VerDcm * zr->jpg_settings.TmpDcm); - fmt->fmt.pix.sizeimage =zoran_v4l2_calc_bufsize (&zr->jpg_settings); + fmt->fmt.pix.sizeimage = zr->buffer_size; fmt->fmt.pix.pixelformat =V4L2_PIX_FMT_MJPEG ;if (zr->jpg_settings.TmpDcm ==1 ) fmt->fmt.pix.field = (zr->jpg_settings.odd_even ?
@@ -1114,7 +1116,7 @@ static int zoran_g_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format fmt->fmt.pix.width = zr->v4l_settings.width; fmt->fmt.pix.height = zr->v4l_settings.height; - fmt->fmt.pix.sizeimage = zr->v4l_settings.bytesperline * zr->v4l_settings.height; + fmt->fmt.pix.sizeimage = zr->buffer_size; fmt->fmt.pix.pixelformat = zr->v4l_settings.format->fourcc; fmt->fmt.pix.colorspace = zr->v4l_settings.format->colorspace; fmt->fmt.pix.bytesperline = zr->v4l_settings.bytesperline;
@@ -1183,6 +1185,7 @@ static int zoran_try_fmt_vid_out(struct file *file, void *__fh, V4L2_FIELD_TOP : V4L2_FIELD_BOTTOM); fmt->fmt.pix.sizeimage =zoran_v4l2_calc_bufsize (&settings); + zr->buffer_size = fmt->fmt.pix.sizeimage; fmt->fmt.pix.bytesperline =0 ; fmt->fmt.pix.colorspace =V4L2_COLORSPACE_SMPTE170M ;return res;
@@ -1337,7 +1340,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format/* tell the user the results/missing stuff */ fmt->fmt.pix.bytesperline = zr->v4l_settings.bytesperline; - fmt->fmt.pix.sizeimage = zr->v4l_settings.height * zr->v4l_settings.bytesperline; + fmt->fmt.pix.sizeimage = zr->buffer_size; fmt->fmt.pix.colorspace = zr->v4l_settings.format->colorspace;if (BUZ_MAX_HEIGHT < (zr->v4l_settings.height *2 )) fmt->fmt.pix.field =V4L2_FIELD_INTERLACED ;
Signature · 1 line
2.26.2
PATCH 46/49 staging: media: zoran: fix some compliance test
In reply to Corentin LabbeAdd TODO for "TRY_FMT cannot handle an invalid pixelformat"
We need to set pixelformat in some case.
We should also handle some minimum requirement.
--- drivers/staging/media/zoran/zoran_driver.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/staging/media/zoran/zoran_driver.c +11 -1
@@ -1206,9 +1206,12 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,if (zoran_formats[i].fourcc == fmt->fmt.pix.pixelformat)break ; -if (i ==NUM_FORMATS ) +if (i ==NUM_FORMATS ) { +/* TODO do not return here to fix the TRY_FMT cannot handle an invalid pixelformat*/ return -EINVAL ; + } + fmt->fmt.pix.pixelformat = zoran_formats[i].fourcc; fmt->fmt.pix.colorspace = zoran_formats[i].colorspace;if (BUZ_MAX_HEIGHT < (fmt->fmt.pix.height *2 )) fmt->fmt.pix.field =V4L2_FIELD_INTERLACED ;
@@ -1318,6 +1321,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_formatif (i ==NUM_FORMATS ) {pci_err (zr->pci_dev,"VIDIOC_S_FMT - unknown/unsupported format 0x%x\n" , fmt->fmt.pix.pixelformat); +/* TODO do not return here to fix the TRY_FMT cannot handle an invalid pixelformat*/ return -EINVAL ; }
@@ -1327,10 +1331,16 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh, struct v4l2_format res = -EBUSY ;return res; } + + fmt->fmt.pix.pixelformat = zoran_formats[i].fourcc;if (fmt->fmt.pix.height >BUZ_MAX_HEIGHT ) fmt->fmt.pix.height =BUZ_MAX_HEIGHT ;if (fmt->fmt.pix.width >BUZ_MAX_WIDTH ) fmt->fmt.pix.width =BUZ_MAX_WIDTH ; +if (fmt->fmt.pix.height <BUZ_MIN_HEIGHT ) + fmt->fmt.pix.height =BUZ_MIN_HEIGHT ; +if (fmt->fmt.pix.width <BUZ_MIN_WIDTH ) + fmt->fmt.pix.width =BUZ_MIN_WIDTH ;map_mode_raw (fh);
Signature · 1 line
2.26.2
PATCH 47/49 staging: media: zoran: remove deprecated .vidioc_g_jpegcomp
In reply to Corentin LabbeThis patchs removed the deprecated .vidioc_g_jpegcomp and replace it with corresponding v4l2_ctrl_ops code.
--- drivers/staging/media/zoran/zoran_card.c | 22 ++++++++++ drivers/staging/media/zoran/zoran_driver.c | 48 ---------------------- 2 files changed, 22 insertions(+), 48 deletions(-)
drivers/staging/media/zoran/zoran_card.c +22 -0
@@ -1056,6 +1056,25 @@ static void zoran_subdev_notify(struct v4l2_subdev *sd, unsigned int cmd, void *GPIO (zr,7 ,1 ); } +static int zoran_video_set_ctrl (struct v4l2_ctrl *ctrl) +{ + struct zoran *zr = container_of(ctrl->handler, struct zoran, hdl); + +switch (ctrl->id) { +case V4L2_CID_JPEG_COMPRESSION_QUALITY : + zr->jpg_settings.jpg_comp.quality = ctrl->val; +return zoran_check_jpg_settings (zr, &zr->jpg_settings,0 ); +default : +return -EINVAL ; + } + +return 0 ; +} + +static const struct v4l2_ctrl_ops zoran_video_ctrl_ops = { + .s_ctrl = zoran_video_set_ctrl, +}; +/* * Scan for a Buz card (actually for the PCI controller ZR36057), * request the irq and map the io memory
@@ -1096,6 +1115,9 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (v4l2_ctrl_handler_init (&zr->hdl,10 )) goto zr_unreg; zr->v4l2_dev.ctrl_handler = &zr->hdl; +v4l2_ctrl_new_std (&zr->hdl, &zoran_video_ctrl_ops, +V4L2_CID_JPEG_COMPRESSION_QUALITY ,0 , +100 ,1 ,50 );spin_lock_init (&zr->spinlock);mutex_init (&zr->lock);if (pci_enable_device (pdev))
drivers/staging/media/zoran/zoran_driver.c +0 -48
60 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 48/49 staging: media: zoran: convert to vb2
In reply to Corentin LabbeThis is it! the ultimate last step, the vb2 conversion.
--- drivers/staging/media/zoran/Kconfig | 2 +- drivers/staging/media/zoran/zoran.h | 83 +- drivers/staging/media/zoran/zoran_card.c | 45 +- drivers/staging/media/zoran/zoran_device.c | 488 ++----- drivers/staging/media/zoran/zoran_driver.c | 1453 +------------------- 5 files changed, 137 insertions(+), 1934 deletions(-)
drivers/staging/media/zoran/Kconfig +1 -1
@@ -1,6 +1,6 @@ config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux (Deprecated)" - depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 && VIRT_TO_BUS + depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 depends on !ALPHA select VIDEOBUF2_DMA_CONTIG help
drivers/staging/media/zoran/zoran.h +1 -82
142 lines not on this page · raw message
drivers/staging/media/zoran/zoran_card.c +4 -41
90 lines not on this page · raw message
drivers/staging/media/zoran/zoran_device.c +85 -403
608 lines not on this page · raw message
drivers/staging/media/zoran/zoran_driver.c +46 -1407
1,628 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 49/49 staging: media: zoran: update TODO
In reply to Corentin LabbeUpdate the TODO of the zoran driver
--- drivers/staging/media/zoran/TODO | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/staging/media/zoran/TODO +19 -4
@@ -1,4 +1,19 @@ -The zoran driver is marked deprecated. It will be removed -around May 2019 unless someone is willing to update this -driver to the latest V4L2 frameworks (especially the vb2 -framework). + +How to test the zoran driver: +- RAW capture + mplayer tv:///dev/video0 -tv driver=v4l2 + +- MJPEG capture (compression) + mplayer tv:///dev/video0 -tv driver=v4l2:outfmt=mjpeg + TODO: need two test for both Dcim path + +- MJPEG play (decompression) + ffmpeg -i test.avi -vcodec mjpeg -an -f v4l2 /dev/video0 + Note: only recent ffmpeg has the ability of sending non-raw video via v4l2 + + The original way of sending video was via mplayer vo_zr/vo_zr2, but it does not compile + anymore and is a dead end (usage of some old private ffmpeg structures). + +TODO +- fix the v4l compliance "TRY_FMT cannot handle an invalid pixelformat" +- Filter JPEG data to made output work
Signature · 1 line
2.26.2