Commit Graph

1565 Commits

Author SHA1 Message Date
Tao Huang
f9eefeeaa7 rk: add SPDX license identifier to files with no license
Change-Id: I754250669891307b0deab2bdab1bd01512713f79
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-01-31 20:56:06 +08:00
zhangyunlong
df069b4939 camera: rockchip: camsys_drv: v0.0x22.4
Change-Id: I169afc59a55a4056da76d2bdd1a32fbf86d28658
Signed-off-by: Zhang Yunlong <dalon.zhang@rock-chips.com>
2018-01-25 10:03:41 +08:00
zhangyunlong
1cea76da68 camera: rockchip: camsys driver v0.0x23.0
Change-Id: Ia4f527488f588c3adb6c3ea6cd1be868fe006d14
Signed-off-by: zhangyunlong <dalon.zhang@rock-chips.com>
2018-01-25 10:03:31 +08:00
Jacob Chen
c1df7dec16 media: rk-isp10: grab a copy of userspace headers
Change-Id: I75ceb19f0f4c9a420440ae73538f030aaf49fb95
Signed-off-by: Jacob Chen <cc@rock-chips.com>
2018-01-20 15:26:04 +08:00
Algea Cao
cef745a23a media: cec: Add an interface for hdmi report HPD
Add cec-notifier interface that hdmi can call it when
HPD is occurred.

Change-Id: I0087a879bf3ba65e300c3db3a67ddaa7e22f16ad
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2018-01-18 16:53:37 +08:00
Zhou weixin
05ba6262c6 Rockchip: vip: add gc0312 driver
Change-Id: I2cc81469f48b35833832ff102b45221ea340f5a9
Signed-off-by: Zhou weixin <zwx@rock-chips.com>
2018-01-12 19:31:29 +08:00
Algea Cao
f2da070b51 UPSTREAM: [media] cec: Add cec_get_drvdata()
Add a helper function to get driver private data from CEC
adapter. This helps the readability a little bit and allows
to change the 'priv' field name to something else without
needing to touch all drivers.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 0b0b97dcc7)

Change-Id: I2691d8328350e968b74a90d1622b8e857cefc112
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:43:52 +08:00
Algea Cao
f7c2f7e904 UPSTREAM: media: cec-pin.h: move non-kAPI parts into cec-pin-priv.h
The kAPI cec-pin.h header also defined data structures that did
not belong here but were private to the CEC core code.

Split that part off into a cec-pin-priv.h header.

Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
(cherry picked from commit 5bf24e08b6)

Change-Id: I8a0100eb9731a5657ef51939ef56d0c22e046023
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
1dc19a6a92 UPSTREAM: media: cec: add CEC_EVENT_PIN_HPD_LOW/HIGH events
Add support for two new low-level events: PIN_HPD_LOW and PIN_HPD_HIGH.

This is specifically meant for use with the upcoming cec-gpio driver
and makes it possible to trace when the HPD pin changes. Some HDMI
sinks do strange things with the HPD and this makes it easy to debug
this.

Note that this also moves the initialization of a devnode mutex and
list to the allocate_adapter function: if the HPD is high, then as
soon as the HPD interrupt is created an interrupt occurs and
cec_queue_pin_hpd_event() is called which requires that the devnode
mutex and list are initialized.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 333ef6bd10)

Change-Id: I2fc5ca673ed67247d6f1a60906e515caa828a064
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
3630139097 UPSTREAM: media: cec: replace pin->cur_value by adap->cec_pin_is_high
The current CEC pin value (0 or 1) was part of the cec_pin struct,
but that assumes that CEC pin monitoring can only be used with
a driver that uses the low-level CEC pin framework.

But hardware that has both a high-level API and can monitor the
CEC pin at low-level at the same time does not need to depend on
the cec pin framework.

To support such devices remove the cur_value field from struct cec_pin
and add a cec_pin_is_high field to cec_adapter. This also makes it
possible to drop the '#ifdef CONFIG_CEC_PIN' in cec-api.c.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 28e11b15b6)

Change-Id: I7f144faf81e6eb3dfdaa7cca5978214f67eaa84d
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
e15d058971 UPSTREAM: media: cec-pin: fix irq handling
The free_irq() function could be called from interrupt context,
which is invalid. Move this to the thread.

In the interrupt handler we just request that the thread disables
the irq. This is done through an atomic so we don't need to add
any spinlocks.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit cb74749493)

Change-Id: Icb6eaa227e0799b33834758c6fa6d148859ec98f
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
8f65162afb UPSTREAM: media: cec: rename pin events/function
The CEC_EVENT_PIN_LOW/HIGH defines and the cec_queue_pin_event() function
did not specify that these were about CEC pin events.

Since in the future there will also be HPD pin events it is wise to rename
the event defines and function to CEC_EVENT_PIN_CEC_LOW/HIGH and
cec_queue_pin_cec_event() now before these become part of the ABI.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 9a6b2a8740)

Change-Id: I292a2aca552575958e0705727ab7ea277839b479
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
497d8fb293 UPSTREAM: media: cec-notifier: small improvements
Allow calling cec_notifier_set_phys_addr and
cec_notifier_set_phys_addr_from_edid with a NULL notifier, in which
case these functions do nothing.

Add a cec_notifier_phys_addr_invalidate helper function (the notifier
equivalent of cec_phys_addr_invalidate).

These changes simplify drm CEC driver support.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit fc1ff45a07)

Change-Id: I301d15d4f7fd710ad8c532035492f7434a089fa7
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
da80af837b UPSTREAM: media: cec-pin: add low-level pin hardware support
Add support for CEC hardware that relies on low-level pin polling or
GPIO interrupts.

One example is the Allwinner SoC. But any GPIO-based CEC implementation can
use this as well.

A GPIO implementation is very suitable as well for debugging: it can use
interrupts to detect state changes and report it. Userspace can then verify
if the bus traffic is correct. This also makes error injection possible.

The disadvantage is that it is hard to get the timings right since linux
isn't a hard realtime system.

In general on an idle system it works quite well, but under load the timer
will miss its mark every so often.

The debugfs file /sys/kernel/debug/cec/cecX/status gives some statistics
with respect to the timer overruns.

When the adapter is unconfigured and the low-level driver supports
interrupts, then the interrupt will be used to detect changes. This should
be quite accurate. But when the adapter is configured a hrtimer has to be
used.

The hrtimer implements a state machine where for each state the code will
read the bus or drive the bus and go on to the next state. It will re-arm
the timer with a delay based on the next state.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit ea5c8ef296)

Change-Id: Iba76fc7d2a93bfe5fff1792afe82416ad4f02c8c
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
35425e92f7 UPSTREAM: media: cec: add core support for low-level CEC pin monitoring
Add support for the new MONITOR_PIN mode.

Add the cec_pin_event function that the CEC pin code will call to queue pin
change events.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit b8d62f50b1)

Change-Id: I52267565092f0f3539e2a0f98328a360839a1d2f
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
8a11dfd7bc UPSTREAM: media: cec: rework the cec event handling
Event handling was always fairly simplistic since there were only
two events. With the addition of pin events this needed to be redesigned.

The state_change and lost_msgs events are now core events with the
guarantee that the last state is always available. The new pin events
are a queue of events (up to 64 for each event) and the oldest event
will be dropped if the application cannot keep up. Lost events are
marked with a new event flag.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 6b2bbb0874)

Change-Id: I922f9ef9ae718ed93e02556cc007b2d943c5b11d
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
8ed255766c UPSTREAM: media: cec: add adap_free op
This is needed for CEC adapters that allocate resources that have
to be freed before the cec_adapter is deleted.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit e6259b5f7a)

Change-Id: I8a3b3270d158a34b79a2036953bcb06e0ebc297d
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
d6055c2fc3 UPSTREAM: media: cec: add *_ts variants for transmit_done/received_msg
Currently the transmit_(attempt_)done and received_msg functions set
the timestamp themselves. For the upcoming low-level pin API we need
to pass this as an argument instead. So make _ts variants that allow
the caller to specify the timestamp.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 0861ad14c6)

Change-Id: I98991dc09741fd6a5c3593e25d70f08897f663a6
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
9b0cf583ab UPSTREAM: media: cec: improve transmit timeout logging
Kernel logging messes up the upcoming low-level CEC monitoring support
which is very time-sensitive. So change the debug level of this message
but keep a counter that is shown in the debugfs status log.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit bb789e03f2)

Change-Id: I4d40fc677c4f5d35db2176aad8846ae780bce53d
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
90d6a371c2 UPSTREAM: [media] cec: add CEC_CAP_NEEDS_HPD
Add a new capability CEC_CAP_NEEDS_HPD. If this capability is set
then the hardware can only use CEC if the HDMI Hotplug Detect pin
is high. Such hardware cannot handle the corner case in the CEC specification
where it is possible to transmit messages even if no hotplug signal is
present (needed for some displays that turn off the HPD when in standby,
but still have CEC enabled).

Typically hardware that needs this capability have the HPD wired to the CEC
block, often to a 'power' or 'active' pin.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit f902c1e95d)

Change-Id: I6bdbb202fb53ae2e8f14e3be15ec7613914f2bbb
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
840e97b554 UPSTREAM: [media] cec: add cec_transmit_attempt_done helper function
A simpler variant of cec_transmit_done to be used where the HW does
just a single attempt at a transmit. So if the status indicates an
error, then the corresponding error count will always be 1 and this
function figures that out based on the status argument.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit c94cdc1e0c)

Change-Id: I707f73b15a3634c7a5883764caf6747422daa888
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
37ce5783c8 UPSTREAM: [media] cec: add cec_s_phys_addr_from_edid helper function
This function simplifies the integration of CEC in DRM drivers.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 23111ec304)

Change-Id: Ibad64be8af1b0548978bd91b467e82bc719afca3
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
c60acde65a UPSTREAM: [media] cec: rename MEDIA_CEC_NOTIFIER to CEC_NOTIFIER
This config option is strictly speaking independent of the
media subsystem since it can be used by drm as well.

Besides, it looks odd when drivers select CEC_CORE and
MEDIA_CEC_NOTIFIER, that's inconsistent naming.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit e94c32818d)

Change-Id: I6f89afe3b6f0bca110451ece5ef3ecb12c2922bb
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
2fc08ce2e5 UPSTREAM: [media] cec.h: merge cec-edid.h into cec.h
Drop the separate cec-edid.h header and merge it into cec.h.

There was really no need to have a separate header for this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit ee7e987133)

Change-Id: Idf14df419f4663f24bcbb2de3603498651a469d4
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
d9b22827d2 UPSTREAM: [media] cec: Kconfig cleanup
The Kconfig options for the CEC subsystem were a bit messy. In
addition there were two cec sources (cec-edid.c and cec-notifier.c)
that were outside of the media/cec directory, which was weird.

Move those sources to media/cec as well.

The cec-edid and cec-notifier functionality is now part of the cec
module and these are no longer separate modules.

Also remove the MEDIA_CEC_EDID config option and include it with the
main CEC config option (which defined CEC_EDID anyway).

Added static inlines to cec-edid.h for dummy functions when CEC_CORE
isn't defined.

CEC drivers should now depend on CEC_CORE.

CEC drivers that need the cec-notifier functionality must explicitly
select CEC_NOTIFIER.

The s5p-cec and stih-cec drivers depended on VIDEO_DEV instead of
CEC_CORE, fix that as well.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 56a263aaa0)

Change-Id: I3c83c4d1aea534c2e8163422c73c8bc276f20f8f
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
f43408f55b UPSTREAM: [media] media: add CEC notifier support
Add support for CEC notifiers, which is used to convey CEC physical address
information from video drivers to their CEC counterpart driver(s).

Based on an earlier version from Russell King:

https://patchwork.kernel.org/patch/9277043/

The cec_notifier is a reference counted object containing the CEC physical address
state of a video device.

When a new notifier is registered the current state will be reported to
that notifier at registration time.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 6917a7b774)

Change-Id: I048f69ccbf5c1de2f856a6820653d8bfc8455e11
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
023a89d7eb UPSTREAM: [media] cec: integrate CEC notifier support
Support the CEC notifier framework, simplifying drivers that
depend on this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit e3a93adcc4)

Change-Id: I0e12ec8a9a0f98c6ff0b322dedaca7d37c557810
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Wen Dingxian
90d186256b camera: rockchip: camsys_drv: v0.0x22.7 camsys_head: v0.e.0
read MRV_MIPI_FRAME register in camsys_mrv_irq, and pass the
value fs_id and fe_id into isp library.

Change-Id: I98c43f1cac25c74c5058b90dbf25937ceb924f84
Signed-off-by: Wen Dingxian <shawn.wen@rock-chips.com>
2017-12-07 15:39:42 +08:00
Sakari Ailus
255a3eb2b7 FROMLIST: v4l: async: Add a convenience function for registering sensors
Add a convenience function for parsing firmware for information on related
devices using v4l2_async_notifier_parse_fwnode_sensor_common() registering
the notifier and finally the async sub-device itself.

This should be useful for sensor drivers that do not have device specific
requirements related to firmware information parsing or the async
framework.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
(cherry picked from commit dd202f9d5346cacd785a482952f54b205eafcc64)
https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd
http://www.spinics.net/lists/linux-media/msg122688.html
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

Conflicts:
	include/media/v4l2-subdev.h
(convert to older documentation style)

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: Ia4af50d7204173d17d04faf9575f6605a1400e46
Reviewed-on: https://chromium-review.googlesource.com/693700
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-27 14:12:20 +08:00
Sakari Ailus
7c4d65f119 FROMLIST: v4l: fwnode: Add convenience function for parsing common external refs
Add v4l2_fwnode_parse_reference_sensor_common for parsing common
sensor properties that refer to adjacent devices such as flash or lens
driver chips.

As this is an association only, there's little a regular driver needs to
know about these devices as such.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
(cherry picked from commit 547be5f2082a4b5d148f8f4ddd8672c91ef52da9)
https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd
http://www.spinics.net/lists/linux-media/msg122688.html
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: I3440987cb1ed89819dc54c9d47f7bd4e27ef3203
Reviewed-on: https://chromium-review.googlesource.com/693699
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-27 14:12:20 +08:00
Sakari Ailus
276604c3b9 FROMLIST: v4l: async: Allow binding notifiers to sub-devices
Registering a notifier has required the knowledge of struct v4l2_device
for the reason that sub-devices generally are registered to the
v4l2_device (as well as the media device, also available through
v4l2_device).

This information is not available for sub-device drivers at probe time.

What this patch does is that it allows registering notifiers without
having v4l2_device around. Instead the sub-device pointer is stored in the
notifier. Once the sub-device of the driver that registered the notifier
is registered, the notifier will gain the knowledge of the v4l2_device,
and the binding of async sub-devices from the sub-device driver's notifier
may proceed.

The root notifier's complete callback is only called when all sub-device
notifiers are completed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
(cherry picked from commit 6527ddc572c6fe60808ed0ee690158498cb50439)
https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd
http://www.spinics.net/lists/linux-media/msg122688.html
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: I4e95e7f72f00a8f88786a26b73fc5ef22d4e4261
Reviewed-on: https://chromium-review.googlesource.com/693695
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-27 14:12:20 +08:00
Sakari Ailus
8c73730716 FROMLIST: v4l: async: Introduce helpers for calling async ops callbacks
Add three helper functions to call async operations callbacks. Besides
simplifying callbacks, this allows async notifiers to have no ops set,
i.e. it can be left NULL.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
(cherry picked from commit 6b4257572d7443669a1f83c6f90c2b43620fba6c)
https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd
http://www.spinics.net/lists/linux-media/msg122688.html
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: I2cb3051601dc068f60dc2072fb9b9a65b916d0a4
Reviewed-on: https://chromium-review.googlesource.com/693690
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-27 14:12:20 +08:00
Laurent Pinchart
5e744b23da FROMLIST: v4l: async: Move async subdev notifier operations to a separate structure
The async subdev notifier .bound(), .unbind() and .complete() operations
are function pointers stored directly in the v4l2_async_subdev
structure. As the structure isn't immutable, this creates a potential
security risk as the function pointers are mutable.

To fix this, move the function pointers to a new
v4l2_async_subdev_operations structure that can be made const in
drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
(cherry picked from commit ef44d7cb0c00968dc62987a6d0438ec30ca8c06c)
https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd
http://www.spinics.net/lists/linux-media/msg122688.html
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

    Conflicts:
            drivers/media/pci/intel/ipu3/ipu3-cio2.c
    (implement change in non-upstream driver)
            drivers/media/platform/davinci/vpif_capture.c
(Change vpif_probe() instead of newer vpif_capture_get_pdata() UNTESTED)
            drivers/media/platform/omap3isp/isp.c
(Add .bound = isp_subdev_notifier_bound which we still have UNTESTED)
            drivers/media/platform/atmel/atmel-isc.c
            drivers/media/platform/atmel/atmel-isi.c
            drivers/media/platform/pxa_camera.c
            drivers/media/platform/qcom/camss-8x16/camss.c
            drivers/media/platform/rcar-vin/rcar-core.c
            drivers/media/platform/rcar_drif.c
            drivers/media/platform/stm32/stm32-dcmi.c
            drivers/media/platform/ti-vpe/cal.c
            drivers/staging/media/imx/imx-media-dev.c
    (Ignore drivers we don't have)

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: Ic3c4a327763507c8b4fa242ae4642a633e3c7dbc
Reviewed-on: https://chromium-review.googlesource.com/693689
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-27 14:12:20 +08:00
Sakari Ailus
01e017d576 FROMLIST: v4l: fwnode: Support generic parsing of graph endpoints in a device
Add two functions for parsing devices graph endpoints:
v4l2_async_notifier_parse_fwnode_endpoints and
v4l2_async_notifier_parse_fwnode_endpoints_by_port. The former iterates
over all endpoints whereas the latter only iterates over the endpoints in
a given port.

The former is mostly useful for existing drivers that currently implement
the iteration over all the endpoints themselves whereas the latter is
especially intended for devices with both sinks and sources: async
sub-devices for external devices connected to the device's sources will
have already been set up, or they are part of the master device.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
(cherry picked from commit 339b5569a4c60144ae8b4aae497080ceea9190fa)
https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd
http://www.spinics.net/lists/linux-media/msg122688.html
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

Conflicts:
	include/media/v4l2-fwnode.h
(purely contextual conflict)

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: I97772ddab949a86f4a0eb2e3610d72cba22709ef
Reviewed-on: https://chromium-review.googlesource.com/693688
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-27 14:12:20 +08:00
Sakari Ailus
b5fb9529d3 FROMLIST: v4l: fwnode: Move KernelDoc documentation to the header
In V4L2 the practice is to have the KernelDoc documentation in the header
and not in .c source code files. This consequently makes the V4L2 fwnode
function documentation part of the Media documentation build.

Also correct the link related function and argument naming in
documentation.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Sderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
(cherry picked from commit 9115ae34c5fb99ea369972b03fa991ade67ff4f0)
https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd
http://www.spinics.net/lists/linux-media/msg122688.html
Signed-off-by: Marc Herbert <marc.herbert@intel.com>

Conflicts:
	drivers/media/v4l2-core/v4l2-fwnode.c
(pure context issue due to _parse_csi1_bus() not here)

BUG=b:64133998
TEST=media device topology shows subdevs registered successfully
TEST=no camera regression

Change-Id: Iccd13312e016a8dfb1f4ed028418f9a35516a9d4
Reviewed-on: https://chromium-review.googlesource.com/693684
Commit-Ready: Tomasz Figa <tfiga@chromium.org>
Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-27 14:12:20 +08:00
Eric Nelson
213bf6dcd9 UPSTREAM: [media] rc-core: define a default timeout for drivers
A default timeout value of 125 ms should work for all decoders.

Declare a constant to help standardize its' use.

Signed-off-by: Eric Nelson <eric@nelint.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
(cherry picked from commit c8e1bbc52d)

Change-Id: I672091f1902c3a91c9746dbfd8438896f7c9433d
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-22 09:25:36 +08:00
Hans Verkuil
ee609c9423 UPSTREAM: [media] cec: pass parent device in register(), not allocate()
The cec_allocate_adapter function doesn't need the parent device, only the
cec_register_adapter function needs it.

Drop the cec_devnode parent field, since devnode.dev.parent can be used
instead.

This change makes the framework consistent with other frameworks where the
parent device is not used until the device is registered.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit f51e80804f)

Change-Id: Ib9a26eedf0e07f5964482d8cbb2c4698031d7bd9
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
2017-11-06 17:52:50 +08:00
Hans Verkuil
7462693803 UPSTREAM: [media] cec: move the CEC framework out of staging and to media
The last open issues have been addressed, so it is time to move
this out of staging and into the mainline and to move the public
cec headers to include/uapi/linux.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 0dbacebede)

Change-Id: I7bf14806f5043a2565328fa715cf44fe2b4ad713
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
2017-11-06 17:50:20 +08:00
Hans Verkuil
f5289f0611 UPSTREAM: [media] cec: rename cec_devnode fhs_lock to just lock
This lock will be used to protect more than just the fhs list.
So rename it to just 'lock'.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 62148f0930)

Change-Id: Ib8f66aec21134ffe333afc3d7d926d1c0844798d
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
2017-11-06 17:48:31 +08:00
Hans Verkuil
9642cfc631 UPSTREAM: [media] cec: limit the size of the transmit queue
The size of the transmit queue was unlimited, which meant that
in non-blocking mode you could flood the CEC adapter with messages
to be transmitted.

Limit this to 18 messages.

Also print the number of pending transmits and the timeout value
in the status debugfs file.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 11065f8531)

Change-Id: I1d143e076ed8a4708a3e6240faf41c6434367d11
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
2017-11-06 17:47:45 +08:00
Hans Verkuil
03b051a099 UPSTREAM: [media] cec: add HDMI CEC framework (core)
The added HDMI CEC framework provides a generic kernel interface for
HDMI CEC devices.

Note that the CEC framework is added to staging/media and that the
cec.h and cec-funcs.h headers are not exported yet. While the kABI
is mature, I would prefer to allow the uABI some more time before
it is mainlined in case it needs more tweaks.

This adds the cec-core.c, media/cec.h and cec-priv.h sources.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
[k.debski@samsung.com: Merged CEC Updates commit by Hans Verkuil]
[k.debski@samsung.com: Merged Update author commit by Hans Verkuil]
[k.debski@samsung.com: code cleanup and fixes]
[k.debski@samsung.com: add missing CEC commands to match spec]
[k.debski@samsung.com: add RC framework support]
[k.debski@samsung.com: move and edit documentation]
[k.debski@samsung.com: add vendor id reporting]
[k.debski@samsung.com: reorder of API structs and add reserved fields]
[k.debski@samsung.com: fix handling of events and fix 32/64bit timespec problem]
[k.debski@samsung.com: add sequence number handling]
[k.debski@samsung.com: add passthrough mode]
[k.debski@samsung.com: fix CEC defines, add missing CEC 2.0 commands]
Signed-off-by: Kamil Debski <kamil@wypas.org>

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit a56960e8b4)
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>

Change-Id: I3063b08b8b818501a683f701d014533bc533d163
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
2017-11-06 17:46:09 +08:00
Hans Verkuil
2629519004 UPSTREAM: [media] cec-edid: add module for EDID CEC helper functions
The cec-edid module contains helper functions to find and manipulate
the CEC physical address inside an EDID. Even if the CEC support itself
is disabled, drivers will still need these functions. Which is the
reason this is module is separate from the upcoming CEC framework.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 29fb44a58a)

Change-Id: Id59a72db27d140abee0e0bb98b062a7131de7263
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
2017-11-06 17:45:46 +08:00
Hans Verkuil
d1a90b84f6 UPSTREAM: [media] v4l2: add device_caps to struct video_device
Instead of letting drivers fill in device_caps at querycap time,
let them fill it in when the video device is registered.

This has the advantage that in the future the v4l2 core can access
the video device's capabilities and take decisions based on that.
(am from 7bbe781329)

Change-Id: I2cc64fc2e562f7def0bea07c9b53a39ba4d772c3
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2017-11-03 10:08:47 +08:00
Sakari Ailus
31c5e2d5bb BACKPORT: FROMLIST: v4l: Add support for V4L2_BUF_TYPE_META_OUTPUT
The V4L2_BUF_TYPE_META_OUTPUT mirrors the V4L2_BUF_TYPE_META_CAPTURE with
the exception that it is an OUTPUT type. The use case for this is to pass
buffers to the device that are not image data but metadata. The formats,
just as the metadata capture formats, are typically device specific and
highly structured.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
(am from https://patchwork.linuxtv.org/patch/43308/)

 Conflicts:
        drivers/media/v4l2-core/v4l2-ioctl.c
        include/media/v4l2-ioctl.h

BUG=b:66317170
TEST=compile

Change-Id: I86495fe82bf8dbddbc40f0ee1eb8e21145f427d3
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/676768
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-03 10:03:41 +08:00
Laurent Pinchart
98781fa62b BACKPORT: [media] v4l: Add metadata buffer type and format
The metadata buffer type is used to transfer metadata between userspace
and kernelspace through a V4L2 buffers queue. It comes with a new
metadata capture capability and format description.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
[hans.verkuil@cisco.com: removed left-over 'experimental' note]
[hans.verkuil@cisco.com: add newline after _v4l2-meta-format label]

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit fb9ffa6a7f)

 Conflicts:
	Documentation/media/uapi/v4l/buffer.rst
	Documentation/media/uapi/v4l/devices.rst
	Documentation/media/uapi/v4l/vidioc-querycap.rst
	Documentation/media/videodev2.h.rst.exceptions
	drivers/media/v4l2-core/v4l2-dev.c
	drivers/media/v4l2-core/videobuf2-v4l2.c
	include/media/v4l2-ioctl.h

Deleted the documentation, as 4.4 is before the conversion to rst.

BUG=b:66317170
TEST=compile

Change-Id: Id43757c0a0b1f34e10d17e5345f89ded25503d13
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/676767
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-11-03 10:03:07 +08:00
Peng Zhou
016f7ec166 Rockchip: vip: support cif controller
Transplant from kernel v3.10.

Change-Id: I8b1f8d664ebcaad435132f260250204255793b66
Signed-off-by: Peng Zhou <benjo.zhou@rock-chips.com>
2017-10-31 09:49:17 +08:00
Jacob Chen
2e3c43155b media: i2c: rename tc358643 driver to tc35864x
tc358649 is similar with tc358643, when VIP in tc358649 is
set to bypassed.
So this driver can also be used for tc358649, we
should rename it to tc35864x.

Below is the function table show differences between tc358643/9:

tc358643 :
- HDMI 1.4a
- MIPI CSI2-TX
- Audio Support
- HDCP Support
- 3D Support

tc358649 :
- HDMI 1.4a
- MIPI CSI2-TX
- Audio Support
- HDCP Support
- 3D Support
- Scalar
- De-interface

Change-Id: I4851f62b58687dfffdc5de686a9d12ece08e6c28
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 18:10:58 +08:00
Jacob Chen
83ff5e5bd9 media: i2c: tc358743: sync to upstream version
Change-Id: I77cb05e16ca36c14a5fa7041c29f98dc4821c2be
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 18:10:47 +08:00
Sakari Ailus
cd40430ed3 BACKPORT: [media] v4l: Switch from V4L2 OF not V4L2 fwnode API
Switch users of the v4l2_of_ APIs to the more generic v4l2_fwnode_ APIs.
Async OF matching is replaced by fwnode matching and OF matching support
is removed.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Benoit Parrot <bparrot@ti.com> # i2c/ov2569.c, am437x/am437x-vpfe.c and ti-vpe/cal.c
Tested-by: Hans Verkuil <hans.verkuil@cisco.com> # Atmel sama5d3 board + ov2640 sensor
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 859969b38e)
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>

Conflicts:
Nathan: context, comment and include deltas, as well as deleting files
that don't apply to ChromeOS-4.4 yet
	drivers/media/i2c/Kconfig
	drivers/media/i2c/mt9v032.c
	drivers/media/i2c/ov5645.c
	drivers/media/i2c/ov5647.c
	drivers/media/i2c/s5c73m3/s5c73m3-core.c
	drivers/media/i2c/smiapp/smiapp-core.c
	drivers/media/i2c/tc358743.c
	drivers/media/i2c/tvp514x.c
	drivers/media/i2c/tvp5150.c
	drivers/media/i2c/tvp7002.c
	drivers/media/platform/Kconfig
	drivers/media/platform/atmel/Kconfig
	drivers/media/platform/atmel/atmel-isc.c
	drivers/media/platform/atmel/atmel-isi.c
	drivers/media/platform/exynos4-is/mipi-csis.c
	drivers/media/platform/omap3isp/isp.c
	drivers/media/platform/pxa_camera.c
	drivers/media/platform/rcar-vin/Kconfig
	drivers/media/platform/rcar-vin/rcar-core.c
	drivers/media/platform/soc_camera/soc_camera.c
	drivers/media/platform/stm32/stm32-dcmi.c
	drivers/media/platform/ti-vpe/cal.c
	include/media/v4l2-subdev.h

BUG=b:62359918
TEST=No regression in camera functionality
TEST=Kernel builds and boots

Change-Id: If338e2ab0c68c72f242988f34202e0449642734c
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528621
Commit-Ready: Nathan D Ciobanu <nathan.d.ciobanu@intel.com>
Tested-by: Yong Zhi <yong.zhi@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 17:31:38 +08:00
Sakari Ailus
aed4e07a75 UPSTREAM: [media] v4l: flash led class: Use fwnode_handle instead of device_node in init
Pass the more generic fwnode_handle to the init function than the
device_node.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 048ea05b4f)

BUG=b:62359918
TEST=No regression in camera functionality
TEST=Kernel builds and boots

Change-Id: Ied9439f2b96be3afe047b54877703d35074bf455
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528620
Commit-Ready: Nathan D Ciobanu <nathan.d.ciobanu@intel.com>
Tested-by: Yong Zhi <yong.zhi@intel.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 17:24:05 +08:00