Robert Jarzmik [Tue, 6 Sep 2016 09:04:20 +0000 (06:04 -0300)]
[media] media: platform: pxa_camera: make a standalone v4l2 device
This patch removes the soc_camera API dependency from pxa_camera.
In the current status :
- all previously captures are working the same on pxa270
- the s_crop() call was removed, judged not working
(see what happens soc_camera_s_crop() when get_crop() == NULL)
- if the pixel clock is provided by then sensor, ie. not MCLK, the dual
stage change is not handled yet.
=> there is no in-tree user of this, so I'll let it that way
- the MCLK is not yet finished, it's as in the legacy way,
ie. activated at video device opening and closed at video device
closing.
In a subsequence patch pxa_camera_mclk_ops should be used, and
platform data MCLK ignored. It will be the sensor's duty to request
the clock and enable it, which will end in pxa_camera_mclk_ops.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This is to be seen as a regression as the set_selection (former
set_crop) function is removed. This is a temporary situation in the v4l2
porting, and will have to be added later.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Introduce sensor_call(), which will be used for all sensor invocations.
This is a preparation move to v4l2 device conversion, ie. soc_camera
adherence removal.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Robert Jarzmik [Tue, 6 Sep 2016 09:04:15 +0000 (06:04 -0300)]
[media] media: platform: pxa_camera: trivial move of functions
Move the functions in the file to be regrouped into meaningful blocks :
1. pxa camera core handling functions, manipulating the herdware
2. videobuf2 functions, dealing with video buffers
3. video ioctl (vidioc) related functions
4. driver probing, removal, suspend and resume
This patch doesn't modify a single line of code.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Robert Jarzmik [Tue, 6 Sep 2016 09:04:11 +0000 (06:04 -0300)]
[media] media: mt9m111: make a standalone v4l2 subdevice
Remove the soc_camera adherence. Mostly the change removes the power
manipulation provided by soc_camera, and instead :
- powers on the sensor when the s_power control is activated
- powers on the sensor in initial probe
- enables and disables the MCLK provided to it in power on/off
This patch also drops support for inverters on synchronisation and clock
lines. It is assumed, if any board ever needs such inverters, support
for them can be added in the future
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This patch adds the H.264 video encoding capability in the V4L2 HVA
video encoder driver for STMicroelectronics SoC (hva-h264.c).
The main supported features are:
- profile: baseline, main, high, stereo high
- level: up to 4.2
- bitrate mode: CBR, VBR
- entropy mode: CABAC, CAVLC
- video aspect: 1x1 only
[media] st-hva: multi-format video encoder V4L2 driver
This patch adds V4L2 HVA (Hardware Video Accelerator) video encoder
driver for STMicroelectronics SoC. It uses the V4L2 mem2mem framework.
This patch only contains the core parts of the driver:
- the V4L2 interface with the userland (hva-v4l2.c)
- the hardware services (hva-hw.c)
- the memory management utilities (hva-mem.c)
This patch doesn't include the support of specific codec (e.g. H.264)
video encoding: this support is part of subsequent patches.
[media] videobuf2-v4l2: document two helper functions
Document vb2_ops_wait_prepare() and vb2_ops_wait_finish(),
in order to fix those two warnings:
Documentation/media/kapi/v4l2-dev.rst:166: WARNING: c:func reference target not found: vb2_ops_wait_prepare
Documentation/media/kapi/v4l2-dev.rst:166: WARNING: c:func reference target not found: vb2_ops_wait_finish
[media] videobuf2-core.h: move function descriptions from c file
There are several functions that were documented at the .c
file. As we only include the headers, we need to move them to
there, in order to have documentation.
[media] mc-core.rst: fix a warning about an internal routine
Fix this warning:
Documentation/media/kapi/mc-core.rst:97: WARNING: c:func reference target not found: media_devnode_release
The media_device_release() is a function internal to media-devnode.c,
and not exported elsewhere. So, we can't cross-reference it here.
Make it explicit at the documentation.
[media] media-ioc-g-topology.rst: fix a c domain reference
One reference there is still using :ref:. Fix it, to solve this
warning:
Documentation/media/uapi/mediactl/media-ioc-g-topology.rst:236: WARNING: undefined label: media-v2-intf-devnode (if the link has no caption the label must precede a section header)
[media] docs-rst: fix cross-references for videodev2.h
There are several broken references there, due to the conversion to
C domain. Fix them using this shell script and manually adjust what's
broken:
# funcs is a file with the broken functions/references
for i in $(cat funcs|sort|uniq|perl -ne 'print "$1\n" if (m/(\S+)$/)'); do
i=${i//-/_}
echo $i
j=${i//_/-}
for k in $(git grep -l "_$j:" Documentation/); do
sed s,\_$j\:,"c\:type\:\: $i", <$k >a && mv a $k
done
for k in $(git grep -l "$j" Documentation/media/*.exceptions); do
sed s,$j,":c\:type\:\`$i\`", <$k >a && mv a $k
done
for k in $(git grep -l "$j" Documentation/); do
sed "s,:ref:\`$i <$j>\`,:c:type:\`$i\`," <$k >a && mv a $k
sed "s,:ref:\`$j\`,:c:type:\`$i\`," <$k >a && mv a $k
sed -E "s,:ref:\`(.*)<$j>\`,:c:type:\`\1<$i>\`," <$k >a && mv a $k
done
for k in $(git grep -l "<$j>" include/media); do
sed -E "s,:ref:\`(.*)<$j>\`,enum \&$i," <$k >a && mv a $k
done
done
Documentation/media/uapi/cec/cec-ioc-dqevent.rst:124: WARNING: c:func reference target not found: clock_gettime(2)
By replacing it with the right function name, using this shell script:
for i in `find Documentation/media -type f`; do sed 's,clock_gettime(2),clock_gettime,' <$i >a && mv a $i; done
Please notice that this will make the nitpick mode to shut up
complaining about that, becasue clock_gettime is on its exclude list,
but the cross reference will be undefined until someone documents
this function at the core documentation.
Trivially fix those broken references, by copying the structs
fron the header, just like other API documentation at the
DVB side.
This doesn't have the level of quality used at the V4L2 side
of the API, but, as this documents a deprecated API, used
only by av7110 driver, it doesn't make much sense to invest
time making it better.
[media] ca-get-msg.rst: add a boilerplate for struct ca_msg
There are no descriptions at ca.h header for this struct.
Yet, as we want to get rid of the warnings, let's add a
boilerplate, with just the struct types and fields.
[media] v4l2-ctrls.h: fix doc reference for prepare_ext_ctrls()
The prepare_ext_ctrls() function is actually internal to the
v4l2-ctrls.c implementation, so it doesn't have a declaration
for the kAPI header to reference it.
[media] conf_nitpick.py: ignore external functions used on mediactl
There are some functions/macros used by the mediactl documentation
that are alien to the media subsystem. Ignore them.
After this patch, the media core will only complain about this
static function:
Documentation/media/kapi/mc-core.rst:97: WARNING: c:func reference target not found: media_devnode_release
[media] docs-rst: improve the kAPI documentation for the mediactl
There are several issues on the documentation:
- the media.h header were not properly referenced;
- verbatim expressions were not properly marked as such;
- struct member references were wrong;
- some notes were not using the right markup;
- a comment that were moved to the kernel-doc markup were
duplicated as a comment inside the struct media_entity;
- some args were not pointing to the struct they're using;
- macros weren't documented.
[media] mc-core.rst: Fix cross-references to the source
The cross-reference to "struct media_pad" was pointing to
a place that doesn't exist. Fix it, and adjust the second
reference on the same paragraph to use the same text.
demux.h was lacking documentation for the DMX_FE_ENTRY macro:
./drivers/media/dvb-core/demux.h:511: WARNING: c:func reference target not found: DMX_FE_ENTRY
While here, get rid of unused parameters and fix a few minor issues
at the header file.
[media] docs-rst: parse-headers.pl: use the C domain for cross-references
Instead of keep using the normal reference, move to the C
domain ones. Using C domains everywhere will allow
cross-references between kAPI and uAPI docs.
Acked-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Andrey Utkin [Wed, 24 Aug 2016 23:17:18 +0000 (20:17 -0300)]
[media] tw5864-core: remove excessive irqsave
As warned by smatch:
drivers/media/pci/tw5864/tw5864-core.c:160 tw5864_h264_isr() error: double lock 'irqsave:flags'
drivers/media/pci/tw5864/tw5864-core.c:174 tw5864_h264_isr() error: double unlock 'irqsave:flags'
Two different spinlocks are obtained, so having two calls is correct,
but second irqsave is superfluous, and using same "flags" variable is
just wrong.
Johan Fjeldtvedt [Tue, 30 Aug 2016 12:31:28 +0000 (09:31 -0300)]
[media] pulse8-cec: some small fixes
Fix some small things:
- clean up setup function
- use MSGEND instead of 0xfe
- don't assign "return value" from cec_phys_addr to err,
it has return type void.
Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Johan Fjeldtvedt [Mon, 22 Aug 2016 09:04:54 +0000 (06:04 -0300)]
[media] pulse8-cec: sync configuration with adapter
When the configuration is changed, they are also written to the adapter.
This allows the adapter to continue operating in autonomous mode with
the same settings when it is disconnected from the driver (typically by
going into suspend). For adapters with firmware version 2 or greater, the
settings are also persisted in EEPROM.
A new module parameter is added to optionally also use the configuration
already present in the adapter when it is connected. This option is
enabled by default.
When a new configuration is written, the autonomous mode is
automatically enabled. When the device is unconfigured, autonomous mode
is disabled.
Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Johan Fjeldtvedt [Mon, 22 Aug 2016 09:04:52 +0000 (06:04 -0300)]
[media] pulse8-cec: serialize communication with adapter
Make sending messages to the adapter serialized within the driver.
send_and_wait is split into send_and_wait_once, which only sends once
and checks for the result, and the higher level send_and_wait, which
performs locking and retries.
Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Johan Fjeldtvedt [Mon, 22 Aug 2016 09:04:51 +0000 (06:04 -0300)]
[media] cec: allow configuration both from within driver and from user space
It makes sense for adapters such as the Pulse-Eight to be configurable
both from within the driver and from user space, so remove the
requirement that drivers only can call cec_s_log_addrs or
cec_s_phys_addr if they don't expose those capabilities to user space.
Signed-off-by: Johan Fjeldtvedt <jaffe1@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Tiffany Lin [Mon, 15 Aug 2016 02:15:33 +0000 (23:15 -0300)]
[media] vcodec: mediatek: Add g/s_selection support for V4L2 Encoder
This patch add g/s_selection for MT8173 V4L2 Encoder.
Only output queue support g/s_selection to configure crop.
The top/left of active rectangle should always be (0,0)
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[media] cx231xx: can't proceed if I2C bus register fails
The driver should not ignore errors while registering the I2C
bus, as this device can't even minimally work without the buses,
as it uses those buses internally to talk with the several IP
blocks inside the chip.
[media] cx231xx-i2c: handle errors with cx231xx_get_i2c_adap()
The cx231xx_get_i2c_adap() function should return the I2C
adapter that will be used to talk with a device. It should never
be NULL, as otherwise the driver will try to dereference a
null pointer.
We might instead fix the callers, but if this condition
ever happens, it is really a driver bug, because i2c_port
should always be a value from enum CX231XX_I2C_MASTER_PORT.
Found when checking the code due to this bug:
[ 39.769021] BUG: unable to handle kernel NULL pointer dereference at 0000000000000002
[ 39.769105] IP: [<ffffffff81638393>] i2c_master_send+0x13/0x70