Commit Graph

605656 Commits

Author SHA1 Message Date
Liang Chen
17efab953d soc: rockchip: add functions to select opp level form device-tree
Some chips need adjust opp level by different chip-process, add
common functions to select opp level from device-tree, so modules
can select opp level easy.

Change-Id: Ifbd5f720e6a52a68f13697bbb37ac01ff4a87e3e
Signed-off-by: Liang Chen <cl@rock-chips.com>
2018-01-02 10:21:39 +08:00
Algea Cao
039a91179b drm/rockchip: Fix up cvbs color abnormal
Solve the cvbs color err after switch from hdmi by
setting cvbs tv state.

Change-Id: Iaf50c2dbbf954fc8437395b88c41846ca47631f3
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-29 19:22:30 +08:00
Algea Cao
7ba0e9b47a drm/rockchip: Fix cvbs color space
Set cvbs color space to V4L2_COLORSPACE_SMPTE170M
to prevent display err.

Change-Id: I12cb71938e9c423397d64f68a46a257e7e0af5c4
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-29 18:41:37 +08:00
Zheng Yang
214f0874a3 drm/rockchip: dw-hdmi: fix note of Automatic color depth
Automatic color depth is same as 24bit.

Change-Id: Ifb9cc0d1292626019c9e1260124f79db1490bb70
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2017-12-29 17:05:06 +08:00
Algea Cao
6e4eaff822 arm64: dts: rockchip: add HDMI cec support for rk3399
Change-Id: Ib27fa6c0475b060a4af5d79cc0e158070efbeceb
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-29 16:08:06 +08:00
Xinhuang Li
e5b1b157cb arm64: dts: rk3328-evb-android: enable tve
Change-Id: Icb50d82738bc88e7d8f29fdda925a34a70c6c293
Signed-off-by: Xinhuang Li <buluess.li@rock-chips.com>
2017-12-29 16:02:44 +08:00
Zheng Yang
377f793ebf phy: rockchip: inno-hdmi: enable RK3328 150ohm differential resistance
On some sink, e.g. Philips 24PFL3545/T3, Y data which is transmitted
in the D1 channel was recognized error, and picture will show noise.
It's fixed after enable the 150ohm differential resistance.

Change-Id: Ie1197dc78260bf7931786ebbccf98e9599b66ccd
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2017-12-29 15:56:48 +08:00
Algea Cao
86155ccebc drm/bridge/synopsys: Move cec_notifier_set_phys_addr out of rxsense setup
If put cec_notifier_set_phys_addr in rxsense setup, hdmi->mutex may
become deadlock. Because cec_notifier_set_phys_addr will call
dw_hdmi_cec_enable which cause hdmi->mutex become deadlock.

Change-Id: I4fed641c9e9d7674451402a973196ef0efeb198f
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-29 14:30:42 +08:00
Jianqun Xu
015580a008 clk: rockchip: clk-ddr: fix section mismatch problem
In rockchip_clk_register_ddrclk,

    ifdef CONFIG_ARM
	if (!psci_smp_available())
		return NULL;
    endif

Add "__init" for rockchip_clk_register_ddrclk() to match with
psci_smp_available().

Change-Id: Ib6849e359921c3a937bf8dc4f6547aed353f1071
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2017-12-29 14:25:32 +08:00
Shawn Lin
a1d240b41b arm64: dts: rockchip: enable PCIe for rk3399-sapphire-excavator-linux
Change-Id: I862ea611490306398d685427a53b475f755640e5
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
2017-12-29 09:39:31 +08:00
Liang Chen
8015fd9804 soc: rockchip: pvtm: add support for RK3288 SoCs
Change-Id: Ie2ced08cbaf8ed992cbe6e01a615f9fe2a1637e4
Signed-off-by: Liang Chen <cl@rock-chips.com>
2017-12-29 09:22:02 +08:00
Pierre-Hugues Husson
fc41368466 UPSTREAM: drm/bridge: synopsys/dw-hdmi: Enable cec clock
Support the "cec" optional clock. The documentation already mentions "cec"
optional clock and it is used by several boards, but currently the driver
doesn't enable it, thus preventing cec from working on those boards.

And even worse: a /dev/cecX device will appear for those boards, but it
won't be functioning without configuring this clock.

Changes:
v4:
- Change commit message to stress the importance of this patch

v3:
- Drop useless braces

v2:
- Separate ENOENT errors from others
- Propagate other errors (especially -EPROBE_DEFER)

Signed-off-by: Pierre-Hugues Husson <phh@phh.me>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171125201844.11353-1-phh@phh.me
(cherry picked from commit ebe32c3e28)

Change-Id: I084e254f7ee1b2c537d3f18897d64578e8bfd482
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-29 09:17:52 +08:00
Finley Xiao
05258c165b arm64: dts: rockchip: rk3328: Rename opp table
Change-Id: I0dbd1b71e2d57aa6c25fb6897253e0aae9d5966b
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-12-28 19:29:12 +08:00
Frank Wang
4f496910c5 ARM: dts: rockchip: add utmi clock for ehci and ohci on rk3288
This change adds USB-PHY output clock reference for EHCI and OHCI.

Change-Id: I39e91fed99756a86c83fe9332587c6630a5e5853
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2017-12-28 18:21:14 +08:00
Frank Wang
dcbf7ad238 phy: rockchip: disable commononn for ehci-phy on rk3288
We found that the system was blocked in EHCI when perform suspend or
reboot on RK3288 platform, the root cause is that EHCI (auto) suspend
causes the corresponding usb-phy into suspend mode which would power
down the inner PLL blocks in usb-phy if the COMMONONN is set to 1'b1.

The PLL output clocks contained CLK480M, CLK12MOHCI, CLK48MOHCI, PHYCLOCK0
and so on, these clocks are not only supplied for EHCI and OHCI, but also
supplied for GPU and other external modules, so setting COMMONONN to 1'b0
to keep the inner PLL blocks in usb-phy always powered.

Change-Id: Ifb7f3d233cf72155aa54d20b15a62b683944a526
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2017-12-28 18:21:14 +08:00
Heiko Stuebner
6ad8a62be6 clk: rockchip: fix usbphy-related clocks
The otgphy clocks really only drive the phy blocks. These in turn
contain plls that then generate the 480m clocks the clock controller
uses to supply some other clocks like uart0, gpu or the video-codec.

So fix this structure to actually respect that hirarchy and removed
that usb480m fixed-rate clock working as a placeholder till now, as
this wouldn't even work if the supplying phy gets turned off while
its pll-output gets used elsewhere.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Michael Turquette <mturquette@baylibre.com>
(cherry picked from commit 219a5859c8)

Conflicts:
	drivers/clk/rockchip/clk-rk3188.c

Change-Id: Ib7dce56943e2642833285fb89dd1aeb9328f84a7
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2017-12-28 18:21:14 +08:00
Joseph Chen
94a7fc2cbd mfd: rk808: power off system in syscore shutdown
For PMIC that power off supplies by write register via i2c bus,
it's better to do power off at syscore shutdown.

Because when run to kernel's "pm_power_off" call, i2c may has
been stopped or PMIC may not be able to get i2c transfer while
there are too many devices are competiting.

This patch effects on PMIC: RK808/RK818/RK816, not including RK805
which power off system by pull up pmic sleep pin in ATF.

Change-Id: I116f79dc91f6f10c6d8070a9168eea44954bf01f
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
2017-12-28 16:35:54 +08:00
Chris Wilson
2741859988 UPSTREAM: drm: Release driver references to handle before making it available again
When userspace closes a handle, we remove it from the file->object_idr
and then tell the driver to drop its references to that file/handle.
However, as the file/handle is already available again for reuse, it may
be reallocated back to userspace and active on a new object before the
driver has had a chance to drop the old file/handle references.

Whilst calling back into the driver, we have to drop the
file->table_lock spinlock and so to prevent reusing the closed handle we
mark that handle as stale in the idr, perform the callback and then
remove the handle. We set the stale handle to point to the NULL object,
then any idr_find() whilst the driver is removing the handle will return
NULL, just as if the handle is already removed from idr.

Note: This will be used to have a direct handle -> vma lookup table,
instead of first a handle -> obj lookup, and then an (obj, vm) -> vma
lookup.

v2: Use NULL rather than an ERR_PTR to avoid having to adjust callers.
idr_alloc() tracks existing handles using an internal bitmap, so we are
free to use the NULL object as our stale identifier.
v3: Needed to update the return value check after changing from using
the stale error pointer to NULL.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Thierry Reding <treding@nvidia.com>
[danvet: Add note about the use-case.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1460721308-32405-1-git-send-email-chris@chris-wilson.co.uk
(cherry picked from commit f6cd7daecf)

Change-Id: Icfa68bd1916c6a3f3b13a33b648bad5006ee2f80
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2017-12-28 16:24:06 +08:00
Chris Wilson
b64b1e03c9 UPSTREAM: drm: Remove opencoded drm_gem_object_release_handle()
drm_gem_handle_delete() contains its own version of
drm_gem_object_release_handle(), so lets just call the release method
instead.

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451986951-3703-2-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 8815b23aa0)

Change-Id: I3ab767d8f42e9ac6ca29b2b2f1d56a30eca02497
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2017-12-28 16:24:06 +08:00
Chris Wilson
6fe76ee08e UPSTREAM: drm: Do not set outparam on error during GEM handle allocation
Good practice dictates that we do not leak stale information to our
callers, and should avoid overwriting an outparam on an error path.

Reported-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451986951-3703-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 9649399e91)

Change-Id: Id6f2a968d66ff463481e8e090522c837b9e12730
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2017-12-28 16:24:06 +08:00
Chris Wilson
3535f99a2d UPSTREAM: drm: Use a normal idr allocation for the obj->name
Unlike the handle, the name table uses a sleeping mutex rather than a
spinlock. The allocation is in a normal context, and we can use the
simpler sleeping gfp_t, rather than have to take from the atomic
reserves.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451902261-25380-3-git-send-email-chris@chris-wilson.co.uk
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 0f646425b9)

Change-Id: I5e087d086b0cd8efbc6bbca56d2dbe6f587ad63f
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2017-12-28 16:24:06 +08:00
Chris Wilson
330381b990 UPSTREAM: drm: Only bump object-reference count when adding first handle
We only need a single reference count for all handles (i.e. non-zero
obj->handle_count) and so can trim a few atomic operations by only
taking the reference on the first handle and dropping it after the last.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451902261-25380-2-git-send-email-chris@chris-wilson.co.uk
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 98a8883ad4)

Change-Id: I49d99d2d66658591bf7dcd2a290eb3106c4f6cbb
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
2017-12-28 16:24:06 +08:00
Liang Chen
3ec8b5cf62 arm: rockchip: rockchip.c: remove register cpufreq-dt device
This has been done in drivers/cpufreq/rockchip-cpufreq.c

Change-Id: Ie3142f1db99560e596706871a67af6e2e06f5153
Signed-off-by: Liang Chen <cl@rock-chips.com>
2017-12-28 15:20:43 +08:00
Sandy Huang
eaa2077de0 drm/rockchip: fix VOP_REG_SUPPORT judge wrong
If the register isn't define at rockchip_vop_reg.c, the default value
of reg.major is 0, this will lead to judge error. so we add reg.mask
conditions because if it's defined register, the reg.mask can't be 0.

Change-Id: I753b92476fda15a64f94e4a8a47894c5ac3a1a7f
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2017-12-28 14:44:05 +08:00
Hecanyang
2d2a4b860e arm64: dts: rockchip: add rk3328 ddr relate node
except add note to existing dts file, also add ddr timing and de-skew's
dts file.

Change-Id: I92b7e9c2c6572babd4be00beadbbb75aae431707
Signed-off-by: CanYang He <hcy@rock-chips.com>
2017-12-28 14:20:18 +08:00
Tao Huang
6e5938dac3 arm64: rockchip_linux_defconfig: update by savedefconfig
Change-Id: Ie8d1530338b76ca68e2020519eb6521c1afe1cd4
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2017-12-28 11:15:27 +08:00
Tao Huang
506a642ac2 arm64: rockchip_defconfig: update by savedefconfig
Change-Id: Ib06f6c7087f230f1523b456ea0a793a533008840
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2017-12-28 11:14:13 +08:00
Taniya Das
cd6fa34b83 clk: add/modify debugfs support for clocks
Update clock debugfs to support the below functionalities.
 - Allow enable/disable a clock.
 - Allow set_rate on a clock.
 - Display available parent of a clock.
 - Allow set_parent on a clock.
 - Display the list of enabled_clocks along with prepare_count,
   enable_count and rate.

Change-Id: Ib67b3a3409c9e7d8adb710bb524f54f543abf712
Signed-off-by: Taniya Das <tdas@codeaurora.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-12-28 11:13:08 +08:00
Zheng Yang
0168873019 drm/bridge/synopsys: fix uninitialized symbol config0
Change-Id: Ifb2438150a5adda4e9542b70668f545c42138e07
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2017-12-28 11:05:04 +08:00
Sandy Huang
6d852444b8 drm/rockchip: add afbdc feature for plane
For next Soc VOP only vopb win1 support AFBDC, so we need
add afbdc feature for every win.

Change-Id: Icbe5e26189d2147a6b81f2f75d0b855b2c35fd26
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2017-12-28 11:04:01 +08:00
Laurent Pinchart
268d7f4e3d drm: bridge: dw-hdmi: Move the driver to a separate directory.
The driver is already made of 5 separate source files. Move it to a
newly created directory named synopsys where more Synopsys bridge
drivers can be added later (for the DisplayPort controller for
instance).

Suggested-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303172007.26541-10-laurent.pinchart+renesas@ideasonboard.com
(cherry picked from commit 35dc8aabc8)

Change-Id: Ibf30c8dcb9f1a326f35dd7e36908d3dd2776091f
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2017-12-28 10:54:44 +08:00
Sandy Huang
70f2a67d36 drm/rockchip: vop: fix hdr2sdr csc error
Change-Id: I9792f14675527ff192e77ea7f9fe0f58b09e54b3
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2017-12-28 10:47:46 +08:00
Hecanyang
4807c45f72 PM / devfreq: rockchip_dmc: add support for rk3328
This adds the necessary data for handling dmcfreq on the rk3328

Change-Id: If4cff5cc372f80b6776a7272a1bff54abef2cf33
Signed-off-by: CanYang He <hcy@rock-chips.com>
2017-12-28 08:48:54 +08:00
Hecanyang
3397fb4994 PM / devfreq: event: add support for rk3328 dfi
This adds the necessary data for handling dfi on the rk3328.

Change-Id: Id870f78dad3ddd6cb5771674a4e8905322f9e8ef
Signed-off-by: CanYang He <hcy@rock-chips.com>
2017-12-28 08:48:23 +08:00
Hecanyang
3943bc44aa PM / devfreq: event: make dfi more extension
after modify, rockchip_dfi_ops can apply to other platform use such
version ddr monitor. regardless of channel count, only one channel
of rk3288,rk3399,rk3328 can work. and regardless of monitor clk,
some platform like rk3328 monitor clk is always on.

Change-Id: Ia1c02a89116546ded385c5a6a3e36d020d66b7f3
Signed-off-by: CanYang He <hcy@rock-chips.com>
2017-12-28 08:47:43 +08:00
Xu Xuehui
6055719454 Revert "net: wireless: rockchip_wlan: ap6255: fix irq abnormal."
This reverts commit a7e71a03cf

Change-Id: I50ef1401a18c71acaddaf8dbda1c525d71ba4392
Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
2017-12-27 19:28:37 +08:00
Zhangbin Tong
220dc4d3ce arm64: rockchip_linux_defconfig: Enable support for Remote Controllers
Change-Id: I3f7fe099d30c5d7475f1c64e6483a38dbbd2bb96
Signed-off-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
2017-12-27 17:20:11 +08:00
Zhangbin Tong
bd36d3832e arm64: dts: rockchip: add remote control node for rk3328-evb
Change-Id: I02c672fe9e63b8f6c379a29f9554f9e43b207834
Signed-off-by: Zhangbin Tong <zebulun.tong@rock-chips.com>
2017-12-27 17:20:03 +08:00
Zhaoyifeng
ff0691d978 drivers: rk_nand: fix firmware upgrade fail issue
After commit 169c390240 ("drivers: rk_nand: support global partition table"),
the partition "rknand_rknand" will not create for firmware upgrade.
This commit will fix this issue and can be compatible with GPT.

Change-Id: I919c1f37358a84bf9fd53830235d0868b6352b80
Signed-off-by: Zhaoyifeng <zyf@rock-chips.com>
2017-12-27 17:10:16 +08:00
Algea Cao
1be71d23f0 UPSTREAM: drm/bridge: dw-hdmi: add cec driver
Add a CEC driver for the dw-hdmi hardware.

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
[hans.verkuil: unsigned -> unsigned int]
[hans.verkuil: cec_transmit_done -> cec_transmit_attempt_done]
[hans.verkuil: add missing CEC_CAP_PASSTHROUGH]
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Hans Verkuil <hans.verkuil@cisco.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20170802184108.7913-4-hverkuil@xs4all.nl
(cherry picked from commit a616e63c56)

Change-Id: I9e50f3e87d452bc7291755eae4aa14a3ec7ab0b3
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:54:13 +08:00
Algea Cao
e453db15f1 UPSTREAM: drm/bridge: dw-hdmi: add missing cec_notifier_put
The __dw_hdmi_remove() function was missing a call to cec_notifier_put
to balance the cec_notifier_get in the probe function.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/a7688d13-2d61-ed16-f2df-28cbb5007f38@xs4all.nl
(cherry picked from commit e383bf85d3)

Change-Id: I59de801ba6e4c0956b6ba76a49dc57bda34c36a7
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:48:24 +08:00
Algea Cao
970623d0d1 UPSTREAM: drm/bridge: dw-hdmi: add better clock disable control
The video setup path aways sets the clock disable register to a specific
value, which has the effect of disabling the CEC engine.  When we add the
CEC driver, this becomes a problem.

Fix this by only setting/clearing the bits that the video path needs to.

Reviewed-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/E1dcBha-00088l-DE@rmk-PC.armlinux.org.uk
(cherry picked from commit 7cc4ab225a)

Change-Id: Ic5603e5197d8107cba821ba4bc1bfbad2d12a1e2
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:45:52 +08:00
Algea Cao
c1a59df015 UPSTREAM: drm/bridge: dw-hdmi: add cec notifier support
Add CEC notifier support to the HDMI bridge driver, so that the CEC
part of the IP can receive its physical address.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/E1dcBhV-00088e-8x@rmk-PC.armlinux.org.uk
(cherry picked from commit e84b8d75ac)

Change-Id: Ib3b3f6fc9e08fc3872b043f5dc36b77b50a378aa
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:45:32 +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
5ed0a887d8 UPSTREAM: media: cec-pin: use IS_ERR instead of PTR_ERR_OR_ZERO
cec_allocate_adapter never returns NULL, so just use IS_ERR instead of
PTR_ERR_OR_ZERO.

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

Change-Id: I5c7f74db8c46640319c21d4adb40755059f608a5
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +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
f23f938da2 UPSTREAM: media: cec-pin.c: use proper ktime accessor functions
Use ktime_to_ns/ns_to_ktime. This makes it possible to work with older kernels
and the media_build compatibility system.

For the mainline kernel these functions are NOPs.

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

Change-Id: Ia4e87097cdf0740dbf1ec12acbb5b6fe41fefbb8
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2017-12-27 16:38:53 +08:00
Algea Cao
0a793e6c94 UPSTREAM: media: cec: Respond to unregistered initiators, when
applicable

Running CEC 1.4 compliance test we get the following error on test
11.1.6.2: "ERROR: The DUT did not broadcast a
<Report Physical Address> message to the unregistered device."

Fix this by letting GIVE_PHYSICAL_ADDR message respond to unregistered
device. Also, GIVE_DEVICE_VENDOR_ID and GIVE_FEATURES fall in the
same category so, respond also to these messages.

With this fix we pass CEC 1.4 official compliance.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: Joao Pinto <jpinto@synopsys.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org>      # for v4.10 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
(cherry picked from commit 845d6524d6)

Change-Id: I859631c5a5c73d2e3a0858bab22841d0657d3c62
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