summaryrefslogtreecommitdiff
path: root/drivers/media/usb/em28xx/em28xx-camera.c
Commit message (Collapse)AuthorAge
* [media] em28xx: shed some light on video input formatsFrank Schaefer2017-04-17
| | | | | | | | | | | | | | CbYCrY has been identified by looking into the tvp5150 driver and the saa7115 datasheet. YUV formats have been verified with em2765 + ov2640 (VAD Laplace webcam). RGB8 formats have been verified with em2710/em2820 + mt9v011 (Silvercrest webcam 1.3mpix). I also did some cross-checking with these two camera devices and 0x08-0x0b are at least 16 bits per pixel formats on em2710/em2820, too, and 0x0c-0x0f are at least 8 bits per pixel formats on em2765, too. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: get rid of the dummy clock sourceFrank Schaefer2017-04-17
| | | | | | | | | | | The v4l2 dummy clock has been added with commit fc5d0f8a8878 ("V4L2: em28xx: register a V4L2 clock source") to be able to use the ov2640 soc_camera driver. Since commit 46796cfcd346 ("ov2640: use standard clk and enable it") it is no longer required. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: simplify ID-reading from Micron sensorsFrank Schaefer2017-04-17
| | | | | | | | | | | | | | | | Use i2c_smbus_read_word_data() instead of i2c_master_send() and i2c_master_recv() for reading the ID of Micorn sensors. i2c_smbus_read_word_data() assumes that byes are in little-endian, so, it uses: data->word = msgbuf1[0] | (msgbuf1[1] << 8); However, Micron datasheet describes the ID as if they were read in big-endian. So, we need to change the byte order in order to match the ID number as described on their datasheets. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: drop last soc_camera linkHans Verkuil2017-04-10
| | | | | | | | | | The em28xx driver still used the soc_camera.h header for the ov2640 driver. Since this driver no longer uses soc_camera, that include can be removed. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: reduce stack usage in sensor probing functionsFrank Schaefer2017-03-22
| | | | | | | | | | | | It's no longer necessary to keep the i2c_client in the device struct unmodified until a sensor is found, so reduce stack usage in em28xx_probe_sensor_micron() and em28xx_probe_sensor_omnivision() by using a pointer to the client instead of a local copy. Reported-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: use usb_interface for dev_foo() callsMauro Carvalho Chehab2016-12-12
| | | | | | | | The usb_device->dev is not the right device for dev_foo() calls. Instead, it should use usb_interface->dev. Tested-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: convert it from pr_foo() to dev_foo()Mauro Carvalho Chehab2016-11-18
| | | | | | | | | | | Instead of using pr_foo(), use dev_foo(), with provides a better output. As this device is a multi-interface one, we'll set the device name to show the chipset and the driver used. While here, get rid of printk continuation messages. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: convert the remaining printks to pr_fooMauro Carvalho Chehab2016-10-21
| | | | | | | | | | | | There are still several places with printk's called directly. Convert them to pr_foo() macros, except for the debug printk's, as those are enabled via modprobe vars. While here, realign the pr_foo() arguments to match the recommended CodingStyle. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: use pr_foo instead of em28xx-specific printk macrosMauro Carvalho Chehab2016-10-21
| | | | | | | There's no reason to keep using em28xx-specific printk macros here. Just use pr_foo(). Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
* [media] em28xx: add media controller supportMauro Carvalho Chehab2016-02-01
| | | | | | | Add the needed bits to make em28xx to create a media controller graph. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] v4l2-clk: add new definition: V4L2_CLK_NAME_SIZEJosh Wu2015-11-17
| | | | | | | | | | | Make all v4l2-clk's clock name use V4L2_CLK_NAME_SIZE definition. In future, if the string is increased we just need to change the V4L2_CLK_NAME_SIZE once. Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] include/media: split I2C headers from V4L2 coreMauro Carvalho Chehab2015-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, include/media is messy, as it contains both the V4L2 core headers and some driver-specific headers on the same place. That makes harder to identify what core headers should be documented and what headers belong to I2C drivers that are included only by bridge/main drivers that would require the functions provided by them. Let's move those i2c specific files to its own subdirectory. The files to move were produced via the following script: mkdir include/media/i2c (cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done) (cd include/media; for i in *.h; do n=`echo $i|sed s/.h$/.c/`; if [ -e ../../drivers/media/*/i2c/$n ]; then echo $i; git mv $i i2c/; fi; done) for i in include/media/*.h; do n=`basename $i`; (for j in $(git grep -l $n); do dirname $j; done)|sort|uniq|grep -ve '^.$' > list; num=$(wc -l list|cut -d' ' -f1); if [ $num == 1 ]; then if [ "`grep i2c list`" != "" ]; then git mv $i include/media/i2c; fi; fi; done And the references corrected via this script: MAIN_DIR="media/" PREV_DIR="media/" DIRS="i2c/" echo "Checking affected files" >&2 for i in $DIRS; do for j in $(find include/$MAIN_DIR/$i -type f -name '*.h'); do n=`basename $j` git grep -l $n done done|sort|uniq >files && ( echo "Handling files..." >&2; echo "for i in \$(cat files|grep -v Documentation); do cat \$i | \\"; ( cd include/$MAIN_DIR; for j in $DIRS; do for i in $(ls $j); do echo "perl -ne 's,(include [\\\"\\<])$PREV_DIR($i)([\\\"\\>]),\1$MAIN_DIR$j\2\3,; print \$_' |\\"; done; done; echo "cat > a && mv a \$i; done"; ); echo "Handling documentation..." >&2; echo "for i in MAINTAINERS \$(cat files); do cat \$i | \\"; ( cd include/$MAIN_DIR; for j in $DIRS; do for i in $(ls $j); do echo " perl -ne 's,include/$PREV_DIR($i)\b,include/$MAIN_DIR$j\1,; print \$_' |\\"; done; done; echo "cat > a && mv a \$i; done" ); ) >script && . ./script Merged Sakari Ailus patch that moves smiapp.h to include/media/i2c. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
* [media] v4l2: replace s_mbus_fmt by set_fmt in bridge driversHans Verkuil2015-05-01
| | | | | | | | | | | | | | Replace all calls to s_mbus_fmt in bridge drivers by calls to the set_fmt pad op. Remove the old try/s_mbus_fmt video ops since they are now no longer used. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Prabhakar Lad <prabhakar.csengg@gmail.com> Acked-by: Scott Jiang <scott.jiang.linux@gmail.com> Cc: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] V4L: remove clock name from v4l2_clk APIGuennadi Liakhovetski2015-04-02
| | | | | | | | | | | All uses of the v4l2_clk API so far only register one clock with a fixed name. This allows us to get rid of it, which also will make CCF and DT integration easier. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Tested-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] em28xx: checkpatch cleanup: whitespaces/new lines cleanupsMauro Carvalho Chehab2014-12-04
| | | | | | | | | | | | | | | | | | | This patch is basically produced while testing a tool that Joe Perches sent upstream sometime ago: https://lkml.org/lkml/2014/7/11/794 I used it with those arguments: $ reformat_with_checkpatch.sh drivers/media/usb/em28xx/em28xx*.[ch] It actually produced 24 patches, with is too much, and showed interesting things: gcc produced different codes on most of the patches, even with just linespace changes. The total code data remained the same on all cases I checked though. Anyway, provided that we fold the resulting patches, this tool seems useful. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] usb: Make use of media_bus_format enumBoris BREZILLON2014-11-14
| | | | | | | | | | | | | | In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Reference new definitions in all usb drivers. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] em28xx-v4l: simplify some pointers in em28xx_init_camera()Frank Schaefer2014-07-26
| | | | | | | Pointer v4l2" can be used instead of "dev->v4l2, which saves some characters. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] em28xx: move sensor parameter fields from struct em28xx to struct v4l2Frank Schaefer2014-05-23
| | | | | | | | | Move camera sensor resolution and xtal out of em28xx common struct, as thore are used only by the em28xx v4l2 submodule. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] em28xx: move vinmode and vinctrl data from struct em28xx to struct v4l2Frank Schaefer2014-05-23
| | | | | | | | | The video input mode and control data also belong only to the analog side. move them to struct em28xx_v4l. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] em28xx: move struct v4l2_clk *clk from struct em28xx to struct v4l2Frank Schaefer2014-05-23
| | | | | | | | | The current clock definition applies only to the V4L2 side of the driver. Move its struct pointer to the v4l2_dev, where it belongs. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] em28xx: start moving em28xx-v4l specific data to its own structFrank Schaefer2014-05-23
| | | | | | | | | That reduces a little bit the memory footprint when em28xx-video is not loaded. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] em28xx-camera: fix return value checks on sensor probingFrank Schaefer2014-02-04
| | | | | | | | | | Since commit e63b009d6e the returned error code in case of not connected/responding i2c clients is ENXIO isntead of ENODEV, which causes several error messages on sensor probing. Fix the i2c return value checks on sensor probing to silence these warnings. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] em28xx: make em28xx-video to be a separate moduleMauro Carvalho Chehab2014-01-07
| | | | | | | | | Now that all analog-specific code are at em28xx-video, convert it into an em28xx extension and load it as a separate module. Reviewed-by: Frank Schäfer <fschaefer.oss@googlemail.com> Tested-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] V4L2: em28xx: tell the ov2640 driver to balance clock enabling ↵Guennadi Liakhovetski2013-10-31
| | | | | | | | | | | | | | | internally The em28xx driver only calls subdevices' .s_power() method to power them down, relying on the hardware to wake up automatically, which is usually the case with tuners. This was acceptable with the old .standby() method, but is wrong with .s_power(). Fixing the driver would be difficult due to a broad supported hardware base. Instead this patch makes use of the unbalanced_power soc-camera subdevice flag to tell the ov2640 driver to balance calls to v4l2_clk_enable() and v4l2_clk_disable() internally. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] V4L2: em28xx: register a V4L2 clock sourceGuennadi Liakhovetski2013-10-31
| | | | | | | | | | Camera sensors usually require a master clock for data sampling. This patch registers such a clock source for em28xx cameras. This fixes the currently broken em28xx ov2640 camera support and can also be used by other camera sensors. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
* [media] em28xx: add basic support for OmniVision OV2640 sensorsFrank Schaefer2013-03-29
| | | | | | | | | | | | This sensor is used by the "SpeedLink Vicious And Devine Laplace webcam" and others. It supports resolutions up to 1600x1200 (at 7-8 fps), but for resolutions higher than 640x480, further driver changes will be necessary, such as sensor output resolution switching (including further configuration changes), bridge xclk adjustment and disabling of 16 bit (12 bit) output formats at high resolutions. Image quality should also needs to be improved. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] em28xx: add comment about Samsung and Kodak sensor probing addressesFrank Schaefer2013-03-29
| | | | | | | | | | | The Windows driver also probes at least two further i2c addresses (0x22 >> 1 and 0x66 >> 1). I've got some hints that they are very likely used by Samsung and Kodak sensors, which are known to be used in Empia devices, too. We havn't seen any devices using these sensors yet and don't know how to probe them properly, so leave a comment. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] em28xx: add probing procedure for OmniVision sensorsFrank Schaefer2013-03-29
| | | | | | | | | | | | | OmniVision sensors are used as well in Empiatech based cameras such as the "SpeedLink Vicious And Devine Laplace" webcam (EM2765 + Omnivision OV2640). With this patch applied, OminiVision sensors with 8 bit address and register width are detected (recent models have a 16 bit address width and use different client addresses). The most commonly used sensors (including the ones listed by Empiatech) are detected properly, although there is no support for them yet. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] em28xx: move the probing of Micron sensors to a separate functionFrank Schaefer2013-03-29
| | | | | | | | Other sensors like the ones from OmniVision need a different probing procedure, so it makes sense have separate functions for each manufacturer/sensor type. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] em28xx: detect further Micron sensorsFrank Schaefer2013-03-29
| | | | | | | | | | Add further Micron chip IDs to be able to identify all Micron sensors listed by Empiatech. Also probe the two alternate i2c addresses used by Micron sensors with 8 bit address and 16 bit register width. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
* [media] em28xx: move sensor code to a separate source code file em28xx-camera.cFrank Schaefer2013-03-29
em28xx-cards.c is very large and the sensor/camera related code is growing, so move this code to a separate source code file em28xx-camera.c. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>