Commit Graph

600906 Commits

Author SHA1 Message Date
Randy Li
a551def232 video: rockchip: vpu: only use the dev_mode for combo
The most of device can get this its running type from the
compatible. This property becomes unnecessary.

Change-Id: I40ec41b130fac2cadd47d92332d27c58a8c2c9f7
Signed-off-by: Randy Li <randy.li@rock-chips.com>
2017-05-04 15:45:30 +08:00
Finley Xiao
9c76cd21b9 PM / devfreq: rockchip_dmc: add mutex lock for pmu register
As dmc may also assess register PMU_BUS_IDLE_REQ, we should prevent
pd driver and dmc driver assessing this register at the same time.

Change-Id: I546033536c87dcf497774cbc6c8f36a3e651ff07
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-04 15:01:17 +08:00
Finley Xiao
a670400e8b soc: rockchip: power-domain: export rockchip_pm_register_notify_to_dmc
This function registers a notifier to dmc devfreq, it will lock the mutex
of pmu when scaling frequency, so that pd driver and dmc driver will not
assess register PMU_BUS_IDLE_REQ at the same time.

Change-Id: I0ba96599d9050d11924d032146e6b4d415629614
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-04 15:00:54 +08:00
Xu Jianqun
e25503f147 dmaengine: pl330: fix error message to dev_err_ratelimited
Change-Id: I4d1191f5b7d330c2786eaac42213b4d255b05db8
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
2017-05-04 14:53:05 +08:00
Zorro Liu
df9708384f ARM64: dts: rk3368-p9: enable route mipi
Change-Id: Ib93918524c173bce1283b0001e0f8ca91594dc6f
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
2017-05-04 14:16:04 +08:00
Finley Xiao
f1ec141d60 PM / devfreq: rockchip_dmc: set polling_ms to 50
In order to scaling frequency more timely, reduce the polling_ms.

Change-Id: Icbee5552396fa0552fb514d92ea77687228c3e28
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-04 12:03:17 +08:00
Finley Xiao
3aacbd51b7 PM / devfreq: rockchip_dmc: add support for rk3368
This adds the necessary data for handling dmcfreq on the rk3368.

Change-Id: Ie202cbaa3b27e52b22a5efc57c6e108fbd03a20a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-04 12:02:45 +08:00
Finley Xiao
509fc95951 PM / devfreq: rockchip_dmc: separate the initialized code of dram
It will be easy to compatible with more rockchip platforms,
if move the initialized code of dram into a separated function.

Change-Id: Iad8738b2c0995712723a8e3e84f12ae6b9b2aa91
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-04 12:01:24 +08:00
dalong.zhang
7daa21f818 camera: rockchip: camsys_drv: 0.0x21.0xe
1) correct mipiphy_hsfreqrange of 3368.
2) add csi-phy timing setting for 3368.

Change-Id: Ia5203dcd8f01bc8989d5bb41a1b2af71bb91f607
Signed-off-by: dalong.zhang <dalon.zhang@rock-chips.com>
2017-05-04 11:42:42 +08:00
Zorro Liu
436523aab0 arm64: dts: rockchip: fix uart3 pinctrl error of rk3368
Change-Id: Ie62fd4c6cf1a9c38a1793c9ccd0085c91f38f438
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
2017-05-04 11:41:41 +08:00
Jacob Chen
1010faef86 drm/rockchip: rga: use DMA_BIDIRECTIONAL
In some cases, we need to read data from RGA
and DMA_TO_DEVICE are not a proper flag
So change to DMA_BIDIRECTIONAL

Change-Id: I9d421e8a15f948fcb6643addab558803247ea161
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
2017-05-04 11:34:21 +08:00
Xu Jianqun
70c3600f8f arm: dts: rk3288: remove assinged parent for NPLL/GPLL
Change-Id: I6ab7dff4d886a776677331f370d9632363abaa87
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
2017-05-04 09:09:45 +08:00
Frank Wang
169af2bdfd arm: dts: add the basic dt file for rk3229-echo-v10
Initial support for rk3229-echo board.

Change-Id: I7587d333f296f66727bf1c686911cfca2f3c5619
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2017-05-03 17:22:32 +08:00
Frank Wang
21839244d9 arm: dts: add android dtsi for rk322x SoC
Change-Id: I400ab97db9d333d53474978bb339ce2ed8a99ed4
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
2017-05-03 17:22:20 +08:00
Elaine Zhang
4ee4163916 clk: rockchip: rk3228: fix up the clk cpu setting
support more cpu freq
add armcore div setting

Change-Id: I46ab974da763bab2e887377848be1d9049a1568f
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-05-03 17:19:33 +08:00
Elaine Zhang
5950a6e5ae arm: dts: rk3228: add some assigned-clocks
Change-Id: I257bbfe5ccea74245a6fe3269a896ab968a34c4f
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-05-03 17:18:35 +08:00
Elaine Zhang
94fb9cc3be clk: rockchip: rk3228: Perfect clock description
1 Add some necessary clk ID.
2 some clks add CLK_IGNORE_UNUSED flag
3 add some critical clk

Change-Id: If52699b4d5f430413b06084b7d21fb1afd4539dd
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
2017-05-03 17:18:12 +08:00
Finley Xiao
ed39592cfa clk: rockchip: rk3288: add ddrc clock support
Add a ddrc clock into clk branches, so we can do ddr frequency
scaling on rk3288 platform in future.

Change-Id: Ia6c93e5ce82fa30475eddf051bc9ea2512b0cc07
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-03 17:16:34 +08:00
Finley Xiao
0d9aeb389a clk: rockchip: add SCLK_DDRCLK id for rk3288 ddrc
Add the needed id for the ddr clock.

Change-Id: I9578decd2348a35a6e9c4cc3527375d4d02a2af6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-03 17:15:23 +08:00
Finley Xiao
d8ad961d31 arm64: dts: rockchip: Rename OPP nodes as opp-<opp-hz>
Compiling the DT file with W=1, DTC warns like follows:

Warning (unit_address_vs_reg): Node /opp_table0/opp@1000000000 has a
unit name, but no reg property

Fix this by replacing '@' with '-' as the OPP nodes will never have a
"reg" property.

Change-Id: I5748be7888db149633c3980c3f5e9715cd256a52
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-03 14:49:37 +08:00
Finley Xiao
0c0f2bfde4 ARM: dts: rk3288: Rename OPP nodes as opp-<opp-hz>
Compiling the DT file with W=1, DTC warns like follows:

Warning (unit_address_vs_reg): Node /opp_table0/opp@1000000000 has a
unit name, but no reg property

Fix this by replacing '@' with '-' as the OPP nodes will never have a
"reg" property.

Change-Id: Id239f49618a818ad87bb77e99f52b52a5ee2dbc6
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2017-05-03 14:49:07 +08:00
Huang, Tao
97706cfcc8 iio: adc: remove unused rockchip_adc driver
replaced by rockchip_saradc from upstream.

Change-Id: I1a0a54240cd4b6f647a84597c739669b7c829157
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
2017-05-03 11:30:51 +08:00
Xu Jianqun
c505c0d7ae drm/rockchip: vop: fix update timeout to 1000 ms
Extend timeout value from 100 jiffies to 1000 millisecond.

Change-Id: I4941bb487051a73cf348f72799226e17d4b60e49
Signed-off-by: Xu Jianqun <jay.xu@rock-chips.com>
2017-05-03 09:53:38 +08:00
dalong.zhang
c29b870b7c camera: rockchip: camsys driver 0.0x21.d
modify mipiphy_hsfreqrange for 3368

Change-Id: I4a9d2d6a28202e734e900f3bb761190842c2948e
Signed-off-by: dalong.zhang <dalon.zhang@rock-chips.com>
2017-05-02 19:58:01 +08:00
Mark Yao
cf24760cf6 drm/rockchip: vop: fix NV12 video display error
fixup the scale calculation formula on the case
src_height == (dst_height/2).

Change-Id: I620a4646232c016ff1547b5b6469ed2eedeacfed
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2017-05-02 16:32:34 +08:00
Zheng Yang
508e51e0b2 drm: bridge: dw-hdmi: Reorder HDMI Initialization Step
There is a bug of pll lock detection in previous code.

/* Wait for PHY PLL lock */
msec = 5;
do {
	val = hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_TX_PHY_LOCK;
	if (!val)
		break;
	...
} while (1)

while is break if pll is not lock yet, the real lock status may
be after the dw_hdmi_enable_video_path.

This bug is fixed in commit <a479fa5417b12fdf7aef8e41fdb99393e1c28581>
(FROMLIST: drm: bridge: dw-hdmi: Fix the PHY power up sequence)

But it introduced an new bug: hdmi output timing may be not stable,
the format shown on some TV is not a standard hdmi timing. For example,
1080P will be shown as 1922x1080 on LEADSTAR LD-1088.

After reorder the HDMI Initialization Step, phy initialization is
moved after the dw_hdmi_enable_video_path, this bug is fixed.

Change-Id: Id996978ceabcf1cce4bf83ddb84528c04fbb7583
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2017-05-02 15:30:08 +08:00
Zheng Yang
eeceae5505 drm: bridge: dw-hdmi: remove the function is_rockchip
The function is_rockchip isn't used any more now that phy reset
operation is performed based on detected phy type.

Change-Id: I58e7a222bc1e1578f0d5d2fcd884b17171fb9601
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2017-05-02 15:21:28 +08:00
Zheng Yang
a3d6d48166 drm: bridge: dw-hdmi: add default phy function for DW_HDMI_PHY_DWC_HDMI20_TX_PHY
DWC HDMI 2.0 TX PHY has the same register layout with DWC HDMI
MHL TX PHY, so we use hdmi_phy_configure_dwc_hdmi_3d_tx as
DW_HDMI_PHY_DWC_HDMI20_TX_PHY default configuration function.

Change-Id: Ib50464b9eef87707a8597493cc05e61a1ecde240
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2017-05-02 15:20:39 +08:00
Kieran Bingham
594a077e31 FROMLIST: drm: bridge: dw-hdmi: Add support for custom PHY configuration
The DWC HDMI TX controller interfaces with a companion PHY. While
Synopsys provides multiple standard PHYs, SoC vendors can also integrate
a custom PHY.

Modularize PHY configuration to support vendor PHYs through platform
data. The existing PHY configuration code was originally written to
support the DWC HDMI 3D TX PHY, and seems to be compatible with the DWC
MLP PHY. The HDMI 2.0 PHY will require a separate configuration
function.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303172007.26541-8-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I7527e77fd8679434379161a6bf3daa1639d081b8
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9603303/)
2017-05-02 15:17:51 +08:00
Huibin Hong
0c49ba335d fiq_debugger: use __handle_sysrq instead of handle_sysrq
Because init.rc does the following operation, handle_sysrq
will do nothing. If we want to use sysrq, __handle_sysrq
can work.
write /proc/sys/kernel/sysrq 0

Change-Id: Ia51debd92f393326f183736e405e25dc4d6a2abc
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2017-05-02 10:46:41 +08:00
Huang, Tao
92ee5ce90b drivers: switch: clear drvdata before device_destroy
Otherwise, we see write after free.

=============================================================================
BUG kmalloc-1024 (Not tainted): Poison overwritten
-----------------------------------------------------------------------------

INFO: 0xc599bcc4-0xc599bcc7. First byte 0x0 instead of 0x6b
INFO: Allocated in device_create_groups_vargs+0x34/0xcc age=43 cpu=3 pid=1
	kmem_cache_alloc_trace+0xd8/0x378
	device_create_groups_vargs+0x34/0xcc
	device_create_vargs+0x20/0x28
	device_create+0x28/0x48
	switch_dev_register+0x80/0x108
	dw_hdmi_bind+0x38c/0x9e4
	dw_hdmi_rockchip_bind+0x248/0x38c
	component_bind_all+0x78/0x1e4
	rockchip_drm_bind+0x1bc/0xbc0
	try_to_bring_up_master.part.0+0xa8/0x138
	component_master_add_with_match+0xb8/0x100
	rockchip_drm_platform_probe+0x188/0x1d0
	platform_drv_probe+0x50/0xa0
	driver_probe_device+0x110/0x2c0
	__driver_attach+0x70/0x94
	bus_for_each_dev+0x94/0xc0
INFO: Freed in device_release+0x5c/0x90 age=42 cpu=3 pid=1
	device_release+0x5c/0x90
	kobject_release+0xd4/0x11c
	device_destroy+0x2c/0x38
	switch_dev_unregister+0x30/0x5c
	dw_hdmi_unbind+0x48/0xc8
	component_bind_all+0x1a4/0x1e4
	rockchip_drm_bind+0x1bc/0xbc0
	try_to_bring_up_master.part.0+0xa8/0x138
	component_master_add_with_match+0xb8/0x100
	rockchip_drm_platform_probe+0x188/0x1d0
	platform_drv_probe+0x50/0xa0
	driver_probe_device+0x110/0x2c0
	__driver_attach+0x70/0x94
	bus_for_each_dev+0x94/0xc0
	bus_add_driver+0xcc/0x1e8
	driver_register+0x9c/0xe0

Change-Id: Ied903eed40212e9666e123dd3f69a2a2966b6bb5
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
2017-04-28 18:35:47 +08:00
Nickey Yang
40db425e45 drm: bridge/dw-hdmi: fix 4 block edid read error
msgs[0].addr will be 0x30 when read edid with more than 2 block.
but still a read edid operation with write DDC_ADDR to
HDMI_I2CM_SLAVE register.So fix it.

Change-Id: I5f0cd9172acd4a68d5b54eaf99f17b45385a4263
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
2017-04-28 17:49:57 +08:00
Huang Jiachai
12df93a333 video: rockchip: vop: 3399: fix bt709 to bt2020 csc error
Change-Id: I073c2dbb6693885a3c75c9ca476879544ec15349
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
2017-04-28 17:49:49 +08:00
Mark Yao
6809316454 video/rockchip: rga2: do some check for user memory
Change-Id: Idbf3d918f127ad53e2d05e56fadcf0b7a4fea2b4
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2017-04-28 17:48:21 +08:00
Mark Yao
c06e1d104b video/rockchip: rga2: fix error page on cache flush
Change-Id: Ic23e0f6c25f68c28a87f4e4ef459bda56d4990ba
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
2017-04-28 17:48:16 +08:00
chenjh
473b3cd1b7 firmware: rockchip: deliver sip implement version v2 to optee
Because optee works on both kernel 3.10 and 4.4, these two branches
have different rockchip sip protocol that sip version v1 for 3.10
and sip version v2 for 4.4

Change-Id: I4f69352d2001b1c22c5617dc443510263b4c53f5
Signed-off-by: chenjh <chenjh@rock-chips.com>
2017-04-28 17:43:54 +08:00
chenjh
91a3b9bf46 gpio: rk8xx: print probe successful info
because gpio framework doesn't print any related info

Change-Id: I2325270027210432cd31d1cec6caf19770363705
Signed-off-by: chenjh <chenjh@rock-chips.com>
2017-04-28 17:43:16 +08:00
Laurent Pinchart
27f255aa55 FROMLIST: drm: bridge: dw-hdmi: Create PHY operations
The HDMI TX controller support different PHYs whose programming
interface can vary significantly, especially with vendor PHYs that are
not provided by Synopsys. To support them, create a PHY operation
structure that can be provided by the platform glue layer. The existing
PHY handling code (limited to Synopsys PHY support) is refactored into a
set of default PHY operations that are used automatically when the
platform glue doesn't provide its own operations.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170305233615.11993-1-laurent.pinchart+renesas@ideasonboard.com

Change-Id: Id865ebee71f2a34e12456d721f8b237204ea9f7e
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9604819/)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
c40684128d FROMLIST: drm: bridge: dw-hdmi: Fix the PHY power up sequence
When powering the PHY up we need to wait for the PLL to lock. This is
done by polling the TX_PHY_LOCK bit in the HDMI_PHY_STAT0 register
(interrupt-based wait could be implemented as well but is likely
overkill). The bit is asserted when the PLL locks, but the current code
incorrectly waits for the bit to be deasserted. Fix it, and while at it,
replace the udelay() with a sleep as the code never runs in
non-sleepable context.

To be consistent with the power down implementation move the poll loop
to the power off function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170305233557.11945-1-laurent.pinchart+renesas@ideasonboard.com

Change-Id: Ibdbb87b7474a6137698692480f11ee61cd429f8e
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9604815/)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
550239d83c FROMLIST: drm: bridge: dw-hdmi: Fix the PHY power down sequence
The PHY requires us to wait for the PHY to switch to low power mode
after deasserting TXPWRON and before asserting PDDQ in the power down
sequence, otherwise power down will fail.

The PHY power down can be monitored though the TX_READY bit, available
through I2C in the PHY registers, or the TX_PHY_LOCK bit, available
through the HDMI TX registers. As the two are equivalent, let's pick the
easier solution of polling the TX_PHY_LOCK bit.

The power down code is currently duplicated in multiple places. To avoid
spreading multiple calls to a TX_PHY_LOCK poll function, we have to
refactor the power down code and group it all in a single function.

Tests showed that one poll iteration was enough for TX_PHY_LOCK to
become low, without requiring any additional delay. Retrying the read
five times with a 1ms to 2ms delay between each attempt should thus be
more than enough.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Jose Abreu <joabreu@synopsys.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170305233539.11898-1-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I64dadab663b34800d4fe3fe4fd9cd4fb029e2ce3
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9604811/)
2017-04-28 16:20:37 +08:00
Neil Armstrong
f0e9afb26b FROMLIST: drm: bridge: dw-hdmi: Enable CSC even for DVI
If the input pixel format is not RGB, the CSC must be enabled in order to
provide valid pixel to DVI sinks.
This patch removes the hdmi only dependency on the CSC enabling.

Reviewed-by: Jose Abreu <joabreu@synopsys.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170303172007.26541-4-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I7e9da663158790f7a84e126c6ed8b763a262bd1f
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9603293/)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
0f8ae37bd2 FROMLIST: drm: bridge: dw-hdmi: Move CSC configuration out of PHY code
The color space converter isn't part of the PHY, move its configuration
out of PHY code.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Neil Armstrong <narmstrong@baylibre.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-3-laurent.pinchart+renesas@ideasonboard.com

Change-Id: Ieea06dcb4a73e77e183901206014a42a4e6a460d
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9603291/)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
3b20d03279 UPSTREAM: drm: bridge: dw-hdmi: Assert SVSRET before resetting the PHY
According to the PHY IP core vendor, the SVSRET signal must be asserted
before resetting the PHY. Tests on RK3288 and R-Car Gen3 showed no
regression, the change should thus be safe.

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/20170117082910.27023-20-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I41d4ae5fe19266c430589a254ed1e44120d30ee8
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from 2668db3788)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
e6d1de1142 UPSTREAM: drm: bridge: dw-hdmi: Fix the name of the PHY reset macros
The PHY reset signal is controlled by bit PHYRSTZ in the MC_PHYRSTZ
register. The signal is active low on Gen1 PHYs and active high on Gen2
PHYs. The driver toggles the signal high then low, which is correct for
all currently supported platforms, but the register values macros are
incorrectly named. Replace them with a single macro named after the bit,
and add a comment to the source code to explain the behaviour.

The driver's behaviour isn't changed by this rename, the code will still
need to be fixed to support Gen1 PHYs.

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/20170117082910.27023-19-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I61a1185dc2528f6be61a3f250902445b92217365
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from 54d72737b0)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
1a3a390efe UPSTREAM: drm: bridge: dw-hdmi: Define and use macros for PHY register addresses
Replace the hardcoded register address numerical values with macros to
clarify the code.

This change has been tested by comparing the assembly code before and
after the change.

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/20170117082910.27023-18-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I131045008e021218f1338592999ba4de33fc0883
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from f0e7f2f3b6)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
71fa607baa UPSTREAM: drm: bridge: dw-hdmi: Detect PHY type at runtime
Detect the PHY type and use it to handle the PHY type-specific SVSRET
signal.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20170117082910.27023-17-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I6f128e5e513e68a4e42a6161d7cd55721a748dc8
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from faba6c3cff)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
1d4d74a887 UPSTREAM: drm: bridge: dw-hdmi: Handle overflow workaround based on device version
Use the device version queried at runtime instead of the device type
provided through platform data to handle the overflow workaround. This
will make support of other SoCs integrating the same HDMI TX controller
version easier.

Among the supported platforms only i.MX6DL and i.MX6Q have been
identified as needing the workaround. Disabling it on Rockchip RK3288
(which integrates a v2.00a controller) didn't produce any error or
artifact.

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/20170117082910.27023-16-laurent.pinchart+renesas@ideasonboard.com

Change-Id: I42f48df6f8509724d049e93b05a48fe0de8207f2
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from be41fc55f1)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
35fa89ce46 UPSTREAM: drm: bridge: dw-hdmi: Detect AHB audio DMA using correct register
Bit 0 in CONFIG1_ID tells whether the IP core uses an AHB slave
interface for control. The correct way to identify AHB audio DMA support
is through bit 1 in CONFIG3_ID.

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/20170117082910.27023-15-laurent.pinchart+renesas@ideasonboard.com

Change-Id: Iafac3a0d301fdd8e8a217da3c9a49b829cdd2edc
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from 0c674948b7)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
98ef5b0ab2 UPSTREAM: drm: bridge: dw-hdmi: Reject invalid product IDs
The DWC HDMI TX can be recognized by the two product identification
registers. If the registers don't read as expect the IP will be very
different than what the driver has been designed for, or will be
misconfigured in a way that makes it non-operational (invalid memory
address, incorrect clocks, ...). We should reject this situation with an
error.

While this isn't critical for proper operation with supported IPs at the
moment, the driver will soon gain automatic device-specific handling
based on runtime device identification. This change makes it easier to
implement that without having to default to a random guess in case the
device can't be identified.

While at it print a readable version number in the device identification
message instead of raw register values.

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/20170117082910.27023-14-laurent.pinchart+renesas@ideasonboard.com

Change-Id: Iaa8e17429e9b4033f97b2bf49504e6f390ce7c44
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from 0527e12e82)
2017-04-28 16:20:37 +08:00
Laurent Pinchart
d42cfa6c9e UPSTREAM: drm: bridge: dw-hdmi: Rename CONF0 SPARECTRL bit to SVSRET
The bit is documented in a Rockchip BSP as

 #define m_SVSRET_SIG		(1 << 5) /* depend on PHY_MHL_COMB0=1 */

This is confirmed by a Renesas platform, which uses a 2.0 DWC HDMI TX as
the RK3288. Rename the bit accordingly.

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/20170117082910.27023-13-laurent.pinchart+renesas@ideasonboard.com

Change-Id: Ib9cd213b8bc956169cf3d3e13415d99a4c65717c
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
(cherry pick from f4104e8fe1)
2017-04-28 16:20:37 +08:00