Commit Graph

603125 Commits

Author SHA1 Message Date
David Wu
a44c7da8e1 ARM64: dts: rockchip: Enable gmac2phy for rk3328-evb
Enable the gmac2phy, make the gmac2phy work on
the rk3328-evb board.

Change-Id: I69ffed728c73c1cbab914582965cafdfefe05807
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-09-01 11:58:01 +08:00
David Wu
fdbf334364 ARM64: dts: rockchip: Add gmac2phy node support for rk3328
The gmac2phy controller of rk3328 is connected to integrated phy
directly inside, add the node for the integrated phy support.

Change-Id: Id96d65d838d17ae4912cf8fd80d0a1f2a2aa3bf7
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-09-01 11:57:17 +08:00
David Wu
f6a020609e net: stmmac: dwmac-rk: Add integrated PHY support
To make integrated PHY work, need to configure the PHY clock,
PHY cru reset and related registers.

Change-Id: I08484c5402a5300f581e968828940383c09faedd
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-01 11:50:47 +08:00
David Wu
2dc9ad744b net: stmmac: dwmac-rk: Remove unwanted code for rk3328_set_to_rmii()
This is wrong setting for rk3328_set_to_rmii(), so remove it.

Change-Id: Ie5c6e33f51c9e54eeaafcd9dd6a2c8e4ded4a3a8
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-01 11:41:41 +08:00
David Wu
f85e00e47b arm64: configs: rockchip: Enable ROCKCHIP_PHY config
Change-Id: Ib052997624c2cbe9656ae841b2847e0e9eaacd2f
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-09-01 11:41:25 +08:00
David Wu
0139b4782c ARM: configs: rockchip: Enable ROCKCHIP_PHY config
Change-Id: Ibe08062628a9ebc8311421ae44c7125e655c1acc
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-09-01 11:41:12 +08:00
David Wu
6ecebf782d net: phy: Add rockchip PHY driver support
Support integrated ethernet PHY currently.

Change-Id: Ie8a21b9abb6064f9d42848734fccc68f22930129
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-01 10:27:48 +08:00
Andrew Lunn
b0c2f1f21c UPSTREAM: phy: Add phydev_err() and phydev_dbg() macros
In preparation for moving some of the phy_device structure members,
add macros for printing errors and debug information.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 72ba48be3e)

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I75021fb43a0317cab4dba81fe737a23dd3f8431c
2017-09-01 09:32:52 +08:00
Heiko Stübner
2556117585 UPSTREAM: net: ethernet: stmmac: dwmac-rk: make clk enablement first in powerup
Right now the dwmac-rk tries to set up the GRF-specific speed and link
options before enabling clocks, phys etc and on previous socs this works
because the GRF is supplied on the whole by one clock.

On the rk3399 however the GRF (General Register Files) clock-supply
has been split into multiple clocks and while there is no specific
grf-gmac clock like for other sub-blocks, it seems the mac-specific
portions are actually supplied by the general mac clock.

This results in hangs on rk3399 boards if the driver is build as module.
When built in te problem of course doesn't surface, as the clocks
are of course still on at the stage before clock_disable_unused.

To solve this, simply move the clock enablement to the first position
in the powerup callback. This is also a good idea in general to
enable clocks before everything else.

Tested on rk3288, rk3368 and rk3399 the dwmac still works on all of them.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f217bfde24)

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I0461d76f48cc9279e31136ce9a448f05cc16a761
2017-09-01 09:32:50 +08:00
Johan Hovold
d4374040ac UPSTREAM: net: ethernet: stmmac: dwmac-rk: fix probe error path
Make sure to disable runtime PM, power down the PHY, and disable clocks
before returning on late probe errors.

Fixes: 27ffefd2d1 ("stmmac: dwmac-rk: create a new probe function")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2d222656db)

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Id44143a0a92fc4d6ccb61293f44cf8dd1a3cd7a4
2017-09-01 09:32:49 +08:00
Joachim Eastwood
65c52788fa UPSTREAM: Revert "net: stmmac: allow to split suspend/resume from init/exit callbacks"
Instead of adding hooks inside stmmac_platform it is better to just use
the standard PM callbacks within the specific dwmac-driver. This only
used by the dwmac-rk driver.

This reverts commit cecbc5563a ("stmmac: allow to split suspend/resume
from init/exit callbacks").

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5a3c7805c4)

Conflicts:
	include/linux/stmmac.h

Change-Id: I3864f8bfe4ee201b449ee766aba6810b498d8a74
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-09-01 09:32:48 +08:00
Joachim Eastwood
996358dcb5 UPSTREAM: stmmac: dwmac-rk: absorb rk_gmac_init into probe
Since the rk_gmac_init() only calls another function move this
function call into probe so rk_gmac_init() can be removed.

Since commit cecbc5563a ("stmmac: allow to split suspend/resume
from init/exit callbacks") the init hook is no longer used in
dwmac-rk so this can be removed.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 07a5e76924)

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I5c591b38e53d5196e4da5fe144f35bbe675f07ba
2017-09-01 09:32:47 +08:00
Joachim Eastwood
ba8f5ed39f UPSTREAM: stmmac: dwmac-rk: turn exit into standard driver remove callback
Convert the exit hook into a standard driver remove function as
the hook doesn't really buy us anything extra.

Eventually the exit hook will be deprecated in favor of the driver
remove function.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0de8c4c9a9)

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I1f8cf997b136b17be9c7e227f57008ffaab6bf1f
2017-09-01 09:32:30 +08:00
Joachim Eastwood
1c10516b3e UPSTREAM: stmmac: dwmac-rk: turn resume/suspend into standard PM callbacks
Use standard PM resume/suspend callbacks instead of the hooks in
stmmac_platform. This gives the driver more control and flexibility
when implementing PM functionality. The hooks in stmmac_platform
also doesn't buy us anything extra.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5619468a41)

Conflicts:
	drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c

Change-Id: I940e17fc5ef0032f91800646d39cc1a50b439df3
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-08-31 21:07:14 +08:00
Joachim Eastwood
383a9165ab UPSTREAM: stmmac: introduce get_stmmac_bsp_priv() helper
Create a helper to retrieve dwmac private data from a dev
pointer. This is useful in PM callbacks and driver remove.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
(cherry picked from commit 1b0acbfdb8)

Change-Id: I6172ef86cab3f921989b8d4295f80334bb154364
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-08-31 21:07:14 +08:00
Vincent Palatin
85429587b4 UPSTREAM: net: stmmac: dwmac-rk: keep the PHY up for WoL
When suspending the machine, do not shutdown the external PHY by cutting
its regulator in the mac platform driver suspend code if Wake-on-Lan is enabled,
else it cannot wake us up.
In order to do this, split the suspend/resume callbacks from the
init/exit callbacks, so we can condition the power-down on the lack of
need to wake-up from the LAN but do it unconditionally when unloading the
module.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 229666c14c)

Conflicts:
	drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c

Change-Id: Icad5f718400e49ff7b27064108a813fa5a8c5639
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-08-31 21:07:13 +08:00
Vincent Palatin
0d54f3c862 UPSTREAM: net: stmmac: allow to split suspend/resume from init/exit callbacks
Let the stmmac platform drivers provide dedicated suspend and resume
callbacks rather than always re-using the init and exits callbacks.
If the driver does not provide the suspend or resume callback, we fall
back to the old behavior trying to use exit or init.

This allows a specific platform to perform only a partial power-down on
suspend if Wake-on-Lan is enabled but always perform the full shutdown
sequence if the module is unloaded.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit cecbc5563a)

Conflicts:
	include/linux/stmmac.h

Change-Id: I06799616dd75175e186bfdde85814ecbda48a654
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-08-31 21:07:13 +08:00
Joachim Eastwood
f45ebc8a06 UPSTREAM: stmmac: let remove/resume/suspend functions take device pointer
Change stmmac_remove/resume/suspend to take a device pointer so
they can be used directly by drivers that doesn't need to perform
anything device specific.

This lets us remove the PCI pm functions and later simplifiy the
platform drivers.

Signed-off-by: Joachim Eastwood <manabian@gmail.com>
Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit f4e7bd81b1)

Change-Id: I84147f3f02dae7a97664083b47a6e1272c7ca3ea
Signed-off-by: David Wu <david.wu@rock-chips.com>
2017-08-31 21:07:13 +08:00
Jacob Chen
31a29aae3d media: rk-isp10: MP/SP support export buffer to user.
Change-Id: I5f6f252a579da9d5e50f69f5062cdbbc62978207
Signed-off-by: Jacob Chen <cc@rock-chips.com>
2017-08-31 15:36:16 +08:00
Hu Kejun
eb1f4ff9ba media: isp: add support to isp1
The running of isp0 or isp1 is ok,
but running of isp0 and isp1 at the same time has not been tested.

Change-Id: I430aafb6060eb5aea464ddce05614604ee015e78
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2017-08-31 15:35:24 +08:00
Hu Kejun
3810fe9156 arm64: dts: rk3399-linux: modify cif isp0 node and add cif isp1 node
Change-Id: I3f240fd6a7c16968c5262a737f1619795affac11
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
2017-08-31 14:12:22 +08:00
Jacob Chen
315f0de380 media: platform: rga: correct rgb24 rb swap
rgb24 don't need enable rbswap

Change-Id: I23e57977b7dd1a4d8fa3cbd357c9cfb3ddfd1126
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-31 11:54:37 +08:00
Zhen Chen
86f562ac0b MALI: utgard: not to treat absence of relative thermal zone as a fatal error
Change-Id: I8831d9dc2f76266d92119ef5acac4a0adb13bc8a
Signed-off-by: Zhen Chen <chenzhen@rock-chips.com>
2017-08-31 11:53:42 +08:00
David Wu
f3880f5f16 pwm: rockchip: Add rk3328 support
The rk3328 SoC supports atomic update, we could lock the configuration
of period and duty at first, after unlock is configured, the period and
duty are effective at the same time.

If the polarity, period and duty need to be configured together,
the way for atomic update is "configure lock and old polarity" ->
"configure period and duty" -> "configure unlock and new polarity".

Change-Id: I93d47566673ab6338d1f7e18212318b8f5277383
Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2017-08-31 10:26:00 +08:00
David Wu
567a2d54ae pwm: rockchip: Use same PWM ops for each IP
Just use the same PWM ops for each IP, and get rid of the ops in struct
rockchip_pwm_data, but still define the three different instances of the
struct to use common interface for each IP.

Change-Id: I8a449b9b5d26be2d0ad85ed0013bf5b764f41a83
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2017-08-31 10:25:38 +08:00
David Wu
31ed1c473e pwm: rockchip: Move the configuration of polarity
It is usually possible to configure the polarity, cycle and duty all at
once, so that the polarity and cycle and duty are applied atomically.
Move it from rockchip_pwm_set_enable() into rockchip_pwm_config(), as
well as prepare for the next atomic update commit.

Change-Id: I051ce87facc892353ee2f061fcc9148085f0f21b
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2017-08-31 10:25:18 +08:00
David Wu
c7d5bfbbba pwm: rockchip: Use pwm_apply() instead of pwm_enable()
Drop the custom hook of pwm_enable() and implement pwm_apply_v1() and
pwm_apply_v2() instead.

Change-Id: I34c6a1206f4ae53ca48756981a2c07b4ec0e7be4
Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2017-08-31 10:23:33 +08:00
David Wu
b407eb761f pwm: rockchip: Remove the judge from return value of pwm_config()
It seems the rockchip_pwm_config() always returns the result 0, so
remove the judge.

Change-Id: I06da8faa583fff1a9274b4a4bb02e8c19446bc57
Signed-off-by: David Wu <david.wu@rock-chips.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
2017-08-31 10:23:16 +08:00
David Wu
42881941a3 pwm: rockchip: Sync with upstream for adding APB and function both clocks support
New PWM module provides two individual clocks for APB clock and function
clock.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: I9f32de5734f9e66472ae5350023ffce9548d717d
2017-08-31 10:23:03 +08:00
Elaine Zhang
f8f956a578 clk: rockchip: rk3126: add sclk_timer5 as critical clock
sclk_timer5 is for arm arch counter, so need always on.
but no dts node to handle this clk, so make it as critical clock

Change-Id: I2533d98a767fd2b296f2737ca8f03a73690820df
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-08-31 10:21:50 +08:00
Elaine Zhang
8550d8ca7e clk: rockchip: rk3128: fix up pvtm gate regs description error
Change-Id: Id2aee42b00871fc90467c09bab53abc7b6c23e41
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-08-31 10:20:52 +08:00
Elaine Zhang
ca9a65cea9 clk: rockchip: rk3128: add pclk_pmu as critical clock
pclk_pmu need always on, and no dts node to handle this clk,
so make it as critical clock

Change-Id: If95d7c45f8935883a335846b42f526cd2f36f131
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-08-31 10:20:37 +08:00
Jacob Chen
6488bce942 media: i2c: tc35874x: allow run out-of-box
This driver are desgined to be take control by userspace
but i'd like to make it support run out-of-box
to act as a normal UVC..

Change-Id: I03f4d29efce12e36334e4819cd4323fe4b0d0408
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 18:11:10 +08:00
Jacob Chen
f4b996231d media: i2c: tc35874x: use lane num form dts
Change-Id: Ia65e1e25249113e18e4df6a688bbf5cea949b36d
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 18:11:06 +08:00
Jacob Chen
c044356791 media: i2c: tc35874x: add tc358749's Chip ID
The Chip ID of tc358749 is 0x47

Change-Id: I70e6e58a15dc2f0001f7c2c962bc0dbbf3d94c2f
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 18:11:03 +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
Jacob Chen
3757f2f78d media: i2c: ov5647: add link_freq ctrl and get_fmt api
rockchip-isp1 driver need those interfaces.

Change-Id: I93a0ffef2e018ba8822dfa80f2ed7c4ff5897f3e
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-08-30 18:07:25 +08:00
Jacob Chen
3ac89ea302 UPSTREAM: media: i2c: Add support for OV5647 sensor
The OV5647 sensor from Omnivision supports up to 2592x1944 @ 15 fps, RAW 8
and RAW 10 output formats, and MIPI CSI-2 interface

The driver adds support for 640x480 RAW 8

Change-Id: Ie7cfe2eef2570f6973a2760eb1125d4a1e329d17
Signed-off-by: Ramiro Oliveira <roliveir@synopsys.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
(cherry picked from commit 3c2472a3c5)
2017-08-30 17:32:21 +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
Sakari Ailus
d99d484173 BACKPORT: [media] v4l: async: Add fwnode match support
Add fwnode matching to complement OF node matching. And fwnode may also be
an OF node.

Do not enable fwnode matching yet. It will replace OF matching soon.

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 ecdf0cfe71)
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>

Conflicts:
Nathan - small comment delta
	include/media/v4l2-async.h
	include/media/v4l2-subdev.h

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

Change-Id: I71720cd1ae4879dbcf2dd5d17cb82777b066584d
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528619
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:23:05 +08:00
Sakari Ailus
263be2ee48 UPSTREAM: [media] v4l: fwnode: Support generic fwnode for parsing standardised properties
The fwnode_handle is a more generic way than OF device_node to describe
firmware nodes. Instead of the OF API, use more generic fwnode API to
obtain the same information.

As the V4L2 fwnode support will be required by a small minority of e.g.
ACPI based systems (the same might actually go for OF), make this a module
instead of embedding it in the videodev module.

The origins of the V4L2 fwnode framework is in the V4L2 OF framework.

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 ca50c197bd)

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

Change-Id: Ie213acbb02b13281e7869816c326497d39ee470a
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528618
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 15:25:33 +08:00
Tuukka Toivonen
ef159a6697 UPSTREAM: [media] v4l2-async: failing functions shouldn't have side effects
v4l2-async had several functions doing some operations and then
not undoing the operations in a failure situation. For example,
v4l2_async_test_notify() moved a subdev into notifier's done list
even if registering the subdev (v4l2_device_register_subdev) failed.
If the subdev was allocated and v4l2_async_register_subdev() called
from the driver's probe() function, as usually, the probe()
function freed the allocated subdev and returned a failure.
Nevertheless, the subdev was still left into the notifier's done
list, causing an access to already freed memory when the notifier
was later unregistered.

A hand-edited call trace leaving freed subdevs into the notifier:

v4l2_async_register_notifier(notifier, asd)
cameradrv_probe
 sd = devm_kzalloc()
 v4l2_async_register_subdev(sd)
  v4l2_async_test_notify(notifier, sd, asd)
   list_move(sd, &notifier->done)
   v4l2_device_register_subdev(notifier->v4l2_dev, sd)
    cameradrv_registered(sd) -> fails
->v4l2_async_register_subdev returns failure
->cameradrv_probe returns failure
->devres frees the allocated sd
->sd was freed but it still remains in the notifier's list.

This patch fixes this and several other cases where a failing
function could leave nodes into a linked list while the caller
might free the node due to a failure.

Signed-off-by: Tuukka Toivonen <tuukka.toivonen@intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 47b037a051)
from media/v4.11-1

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

Change-Id: I2c719fd0338cc47ca05e838ff2dc2a3132ee3971
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528603
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 15:21:45 +08:00
Javi Merino
650da809b8 UPSTREAM: [media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay
In asds configured with V4L2_ASYNC_MATCH_OF, the v4l2 subdev can be
part of a devicetree overlay, for example:

&media_bridge {
	...
	my_port: port@0 {
		#address-cells = <1>;
		#size-cells = <0>;
		reg = <0>;
		ep: endpoint@0 {
			remote-endpoint = <&camera0>;
		};
	};
};

/ {
	fragment@0 {
		target = <&i2c0>;
		__overlay__ {
			my_cam {
				compatible = "foo,bar";
				port {
					camera0: endpoint {
						remote-endpoint = <&my_port>;
						...
					};
				};
			};
		};
	};
};

Each time the overlay is applied, its of_node pointer will be
different.  We are not interested in matching the pointer, what we
want to match is that the path is the one we are expecting.  Change to
use of_node_cmp() so that we continue matching after the overlay has
been removed and reapplied.

Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javi Merino <javi.merino@kernel.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit d2180e0cf7)
from media/v4.11-1

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

Change-Id: I1b52741775f3bb011cd7b40d986c56c8c2a8cccd
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528602
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 15:21:33 +08:00
Markus Elfring
8f20cc44fc UPSTREAM: [media] v4l2-async: Use kmalloc_array() in v4l2_async_notifier_unregister()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
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@s-opensource.com>
(cherry picked from commit f9e9c0669f)
from media/v4.11-1

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

Change-Id: I8e44b3a2a1eb8538fa05378cc28dab10fc734984
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528601
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 15:21:20 +08:00
Mauro Carvalho Chehab
120bedb20c UPSTREAM: [media] v4l2-flash-led-class: remove a now unused var
commit 079933dbcb ("[media] v4l: flash led class: Fix of_node release
in probe() error path") removed the need of an ancillary var at
the release function, as reported by smatch:

drivers/media/v4l2-core/v4l2-flash-led-class.c: In function 'v4l2_flash_release':
drivers/media/v4l2-core/v4l2-flash-led-class.c:678:23: warning: variable 'led_cdev' set but not used [-Wunused-but-set-variable]
  struct led_classdev *led_cdev;
                       ^~~~~~~~

Get rid of it.

Fixes: commit 079933dbcb ("[media] v4l: flash led class: Fix of_node release in probe() error path")
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit bd676c0c04)
from media/v4.9-2

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

Change-Id: Id2d0b84b2f0f5d91efa86c7a63c6b38dd97a1c58
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528599
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 15:13:01 +08:00
Sakari Ailus
e89ddc7d24 UPSTREAM: [media] v4l: flash led class: Fix of_node release in probe() error path
The sub-device's OF node was used (of_node_get()) if it was set, but
device's OF node was always put. Fix this.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 079933dbcb)
from media/v4.9-2

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

Change-Id: I4681980ea36e6a51e39f0c6f3223bf77bb0b5460
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528598
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 15:12:43 +08:00
Sakari Ailus
fd424e34f1 UPSTREAM: device property: Add fwnode_get_next_parent()
In order to differentiate the functionality between dropping a reference
to the node (or not) for the benefit of OF, introduce
fwnode_get_next_parent().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 233872585d)
from v4.12-rc1

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

Change-Id: I3d80dff164c45b75a32f5e8e3152fb1f9757c716
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528616
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 15:05:39 +08:00
Sakari Ailus
5741287331 UPSTREAM: device property: Add support for fwnode endpoints
Similar to OF endpoints, endpoint type nodes can be also supported on
ACPI. In order to make it possible for drivers to ignore the matter,
add a type for fwnode_endpoint and a function to parse them.

On ACPI, find the child node index instead of relying on the "endpoint"
property.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 2bd5452d46)
from v4.12-rc1

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

Change-Id: I4e052e5d3d0f3bc0950fb3a059eaa89ab12bd902
Signed-off-by: Nathan Ciobanu <nathan.d.ciobanu@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/528615
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 15:05:39 +08:00