Commit Graph

607267 Commits

Author SHA1 Message Date
shika.zhou
1322dd69bb ARM: dts: rockchip: rk3229-evb-android: fix hdmi_sound mclk-fs from 256 to 128
Change-Id: I214ea50044c675067262392c36cdc917cbb2bb02
Signed-off-by: Didong Zhou <shika.zhou@rock-chips.com>
2018-03-06 18:29:39 +08:00
Finley Xiao
81206a0348 arm64: dts: rockchip: rk3308: Add cru node
Change-Id: Ica80020436931a5b146581b26e419f49c0077635
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-06 18:17:49 +08:00
Finley Xiao
539fd81fc6 clk: rockchip: Add clock controller for the RK3308
Add the clock tree definition for the new RK3308 SoC.

Change-Id: I1c0794b290207d28102e8d30cca13bbbf54ccfb8
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-06 18:17:49 +08:00
Finley Xiao
229a58abce clk: rockchip: Add dt-binding header for rk3308
Add the dt-bindings header for the rk3308, that gets shared between
the clock controller and the clock references in the dts.

Change-Id: I9c6ea1228417f07603d89f810726e9cdffd2a10a
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-06 18:17:49 +08:00
Finley Xiao
44977b50e8 dt-bindings: Add bindings for rk3308 clock controller
Add devicetree bindings for Rockchip cru which found on
Rockchip SoCs.

Change-Id: Ib28b15d3011704a04294672f82d6a8f855da1536
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-06 18:17:49 +08:00
Huang jianzhi
385b64ec76 ARM: dts: rockchip: enable nandc on rk3229-evb-android board
Change-Id: Ibb6af409aa5409eb4d1e0933ef15fa80126ec807
Signed-off-by: Huang jianzhi <jesse.huang@rock-chips.com>
2018-03-06 17:36:42 +08:00
Alexander Kochetkov
97eca46d52 clocksource/arm_global_timer: reconfigure clockevents after cpufreq change
After a cpufreq transition, update the clockevent's frequency
by fetching the new clock rate from the clock framework and
reprogram the next clock event.

The clock supplying the arm-global-timer on the rk3188 is coming
from the the cpu clock itself and thus changes its rate everytime
cpufreq adjusts the cpu frequency.

Found by code review, real impact not known. Assume what actual
HZ value will be different from expected on platforms using
arm-global-timer as clockevent.

The patch is port of commit 4fd7f9b128 ("ARM: 7212/1: smp_twd:
reconfigure clockevents after cpufreq change") and
commit 2b25d9f64b ("ARM: 7535/1: Reprogram smp_twd based on
new common clk framework notifiers").

Change-Id: I82552f621e30254b9c48f22fb3ebd2866d4476c8
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Signed-off-by: Ziyuan Xu <xzy.xu@rock-chips.com>
2018-03-06 17:29:54 +08:00
William Wu
7df9f2fba5 usb: quirks: add device quirk for Sonix FaceBlack device
We found that some Sonix usb cameras(e.g. idVendor=0c45,
idProduct=64ab or idProduct=64ac) can't support auto-suspend
well on rockchip platforms(e.g. rk3399).With auto-suspend,
these usb cameras MJPEG will display abnormally on all usb
controllers(DWC2/DWC3/EHCI). So we need to disable auto-
suspend for these special usb cameras.

Change-Id: I08c87cf5c9fa5ebe076b5dd3e873b74c5ec2cb83
Signed-off-by: William Wu <william.wu@rock-chips.com>
2018-03-06 17:02:05 +08:00
Sandy Huang
f72adfb770 drm/rockchip: vop: fix out of memory when calc bandwidth
bug log:
[   21.432332] Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP
[   21.433228] Modules linked in:
[   21.433530] CPU: 3 PID: 716 Comm: ndroid.settings Not tainted 4.4.83 #121
[   21.434130] Hardware name: Rockchip RK3399 Excavator Board edp (Android) (DT)
[   21.434768] task: ffffffc0cd63e800 task.stack: ffffffc0cd630000
[   21.435304] PC is at kmem_cache_alloc_trace+0xa8/0x204
[   21.435776] LR is at binder_transaction+0x58c/0x1c44
......
[   21.572340] [<ffffff80081ad584>] kmem_cache_alloc_trace+0xa8/0x204
[   21.572890] [<ffffff800893964c>] binder_transaction+0x58c/0x1c44
[   21.573424] [<ffffff800893cd08>] binder_thread_write+0xa44/0x136c
[   21.573968] [<ffffff800893d710>] binder_ioctl_write_read+0xe0/0x314
[   21.574523] [<ffffff800893db14>] binder_ioctl+0x1d0/0x668
[   21.575010] [<ffffff80081c77b8>] do_vfs_ioctl+0x5e4/0x720
[   21.575494] [<ffffff80081c7954>] SyS_ioctl+0x60/0x88
[   21.575936] [<ffffff8008083170>] el0_svc_naked+0x24/0x28

or:

[  549.171031] Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP
[  549.171920] Modules linked in:
[  549.172213] CPU: 2 PID: 2575 Comm: surfaceflinger Not tainted 4.4.83 #121
[  549.172810] Hardware name: Rockchip RK3399 Excavator Board edp (Android) (DT)
[  549.173444] task: ffffffc0b851a700 task.stack: ffffffc0b2a40000
[  549.173973] PC is at kmem_cache_alloc_trace+0xa8/0x204
[  549.174437] LR is at drm_flip_work_allocate_task+0x2c/0x4c
[  549.174920] pc : [<ffffff80081ad584>] lr : [<ffffff800848ce04>] pstate: 60400145
......
[  549.285299] [<ffffff80081ad584>] kmem_cache_alloc_trace+0xa8/0x204
[  549.285845] [<ffffff800848ce04>] drm_flip_work_allocate_task+0x2c/0x4c
[  549.286422] [<ffffff800848d020>] drm_flip_work_queue+0x38/0xa4
[  549.286942] [<ffffff80084a7a30>] vop_crtc_atomic_flush+0x1f48/0x2274
[  549.287509] [<ffffff800846add4>] drm_atomic_helper_commit_planes+0x194/0x1bc
[  549.288136] [<ffffff80084a0584>] rockchip_atomic_commit_complete+0x58/0xa0
[  549.288750] [<ffffff80084a0750>] rockchip_drm_atomic_commit+0x184/0x1a4
[  549.289340] [<ffffff800848e678>] drm_atomic_commit+0x64/0x70
[  549.289848] [<ffffff800848f960>] drm_mode_atomic_ioctl+0x4fc/0x604
[  549.290393] [<ffffff8008473368>] drm_ioctl+0x278/0x3f8
[  549.290856] [<ffffff80081c77b8>] do_vfs_ioctl+0x5e4/0x720
[  549.291339] [<ffffff80081c7954>] SyS_ioctl+0x60/0x88
[  549.291778] [<ffffff8008083170>] el0_svc_naked+0x24/0x28

Change-Id: I101c7dfa881611f3ca9225542e767897efe8fc1d
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-06 14:08:00 +08:00
Sandy Huang
b42661a086 drm/rockchip: framebuffer should never be freed
In recovery mode, fb will be freed and lead to following error:

[    2.571563] ffffffc03d5f9400: FB ID: 0 (0) fb:0xffffffc03d5f9400, fb->refcount:0
[    2.571694] ------------[ cut here ]------------
[    2.571717] WARNING: at include/linux/kref.h:46
[    2.571738] Modules linked in:
[    2.571763]
[    2.571792] CPU: 0 PID: 169 Comm: recovery Not tainted 4.4.114 #1042
[    2.571815] Hardware name: Rockchip rk3326 863 board (DT)
[    2.571843] task: ffffffc03b078d40 task.stack: ffffffc03b064000
[    2.571877] PC is at drm_framebuffer_reference+0x98/0xc8
[    2.571910] LR is at drm_framebuffer_reference+0x68/0xc8
......
[    2.589269] [<ffffff80084823a8>] drm_framebuffer_reference+0x98/0xc8
[    2.589306] [<ffffff80084831ac>] drm_mode_set_config_internal+0xd4/0x110
[    2.589339] [<ffffff8008488560>] drm_mode_setcrtc+0x448/0x4ec
[    2.589370] [<ffffff8008479830>] drm_ioctl+0x26c/0x3f4
[    2.589404] [<ffffff80081d3884>] do_vfs_ioctl+0x6f0/0x82c
[    2.589438] [<ffffff80081d3a20>] SyS_ioctl+0x60/0x88
[    2.589470] [<ffffff80080832f0>] el0_svc_naked+0x24/0x28

Change-Id: I0706c832b4705bf23147c306e34557a152fb069b
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-06 09:25:17 +08:00
Algea Cao
fe5dcc5f85 ARM: dts: rk322x: Support 322x hdmi cec
Change-Id: Ib321551c66127d6684c1502cb9b71944e06fd61e
Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
2018-03-05 18:36:01 +08:00
Tao Huang
483d2c91cb pinctrl: remove unused pinctrl-rk
Change-Id: I2420c01b80c56379f926f06d9070817a87a7c0eb
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-03-05 18:33:30 +08:00
Tao Huang
efe187c0d4 arm64: dts: rockchip: include dt-bindings/pinctrl/rockchip.h for rk3399-tve1205g
we should not use dt-bindings/pinctrl/rk.h

Change-Id: Idb86c360ea005a48fc3e0ed6a824139eb2afa2ff
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
2018-03-05 18:33:15 +08:00
Meng Dongyang
423ac27a94 arm64: dts: rockchip: px30: modify error of EHCI and OHCI DT
Modify the clock name of EHCI and OHCI controllers, add
property of "status" for OHCI.

Change-Id: I444a906bc26e26989f5f6011de949b816266b9c6
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
2018-03-05 18:29:36 +08:00
Tony Xie
1c1653f366 mfd: rk808: remove suspend config for rk817&rk809
rk817&rk809 run in auto mode always.

Change-Id: Iaa0f257445e6b0c3bddccbb722c8e36c7086a759
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-03-05 16:53:13 +08:00
Huicong Xu
45d0d8f11c phy: rockchip: inno-hdmi: fix hdmi can't display after change mode
for rk322x power down post-PLL must to both set rege0[5]=0 and set
pre pll pre-PLL unlock. So power down pre-PLL before post-PLL power
down

Change-Id: If0eb325b10bb6eb117b0a61d5852e9aae9d92ba6
Signed-off-by: Huicong Xu <xhc@rock-chips.com>
2018-03-05 16:50:43 +08:00
Meng Dongyang
2c759dbf17 phy: rockchip-inno-usb2: turn off differential receiver
Turn off differential receiver in suspend mode for RK3328 and
PX30 to save power.

The effect of turn off differential receiver on electricity:
USB20_AVDD_1V8: 0.73mA (turn on)
USB20_AVDD_1V8: 0.03mA (tunn off)

Change-Id: I0650d6d4b712a3692eed2564dda36d41b7956bb9
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
2018-03-05 15:32:37 +08:00
Finley Xiao
ece39c304d arm64: dts: rockchip: Assign SCLK_UART1_SRC to USB480M fox px30
Change-Id: Iab1c8af4289cf0767910d6301689ea52a4195067
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-05 14:54:33 +08:00
Finley Xiao
9d6d0e8f7e clk: rockchip: px30: Add clock id and CLK_SET_RATE_NO_REPARENT for uart1
Change-Id: I1115c5cdeca962b3281297eec0c1d56a1fa7d023
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
2018-03-05 14:54:02 +08:00
Zhaoyifeng
693e23c113 drivers: rk_nand: add dev pm ops
Change-Id: I9b428035b4a38127fdbb2dd8e2cf8a9b65342624
Signed-off-by: Zhaoyifeng <zyf@rock-chips.com>
2018-03-05 14:50:34 +08:00
Wyon Bi
0a40a57a15 phy/rockchip: mipi-dphy: add da_pwrok handling
we can power off the da_pwrok to reduce power consumption.

Change-Id: Ie08af149e74408e57750a186cf16d5adf4b3cfb7
Signed-off-by: Wyon Bi <bivvy.bi@rock-chips.com>
2018-03-05 09:38:22 +08:00
Huibin Hong
d312ed3e2b spi/rockchip: add pinctrl state high_speed
Change-Id: I2c81fabab31cf5cc07590f38ae517eccd5fa93f2
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2018-03-05 09:37:13 +08:00
Huibin Hong
7e4349ec9d spi: rockchip: set higher io driver when sclk higher than 24MHz
Change-Id: I963c92eab7f7bff0b32e2ac262aa79f0667f39ee
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2018-03-05 09:37:13 +08:00
Huibin Hong
787343f9d7 arm64: dts: rockchip: spi pinctrl-1 with 8ma driver strength for px30
Change-Id: I8e8298e5f37e56585815a29fc0bf46f3a31ff334
Signed-off-by: Huibin Hong <huibin.hong@rock-chips.com>
2018-03-05 09:37:13 +08:00
Sandy Huang
91b8d990c0 drm/rockchip: px30 vop: set win2 zorder to 2
Change-Id: Id0d510ce4f247d14646d51bba4dfa94383ff8e29
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 18:27:17 +08:00
Sandy Huang
ddcb4f03b5 drm/rockchip: px30 vop: enable more debug interrupt
Change-Id: Ib9a6835cf4113b84fbd4ef249868a5ba11ec8073
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 18:19:36 +08:00
Zheng Yang
955745bc12 drm/bridge: synopsys: dw-hdmi: disable phy in dw_hdmi_bind
If hdmi is enabled in uboot and pluged out when booting kernel,
the hdmi phy is still enabled. It's better to disable it to
match the real status.

Change-Id: Ia1c5ede6499ee277d08c35a85c50e3257305f90f
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2018-03-01 16:23:55 +08:00
Zheng Yang
b87d97a99c drm/bridge: synopsys: dw-hdmi: update rxsense status in repo_hpd_event
Under following processes, rxsense will be not match the real
signal status.
1. HDMI plug in, irq is triggered.

2. HDMI irq is mute in dw_hdmi_hardirq, bring up dw_hdmi_irq.

3. For HDMI connection is not stable, phy_stat read in
   dw_hdmi_irq may be zero, then hdmi->rxsense will be false.

4. Connection fallback to stable, but dw_hdmi_irq had not
   unmute the irq, irq is not triggered again, and hdmi->rxsense
   keep false.

5. repo_hpd_event inform HDMI is pluggned in, dw_hdmi_bridge_enable
   is called to enable HDMI. For rxsense is flase, bridge is not
   powered up.

When repo_hpd_event is called, we think HDMI connection is stable,
updating rxsense is reliable.

Change-Id: Ie1f52f65b15e9a603dad9200529202053528a390
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2018-03-01 16:22:43 +08:00
Sandy Huang
f1f22eb38b drm/rockchip: add version control for rockchip drm driver
Add basic version for rockchip DRM driver

Change-Id: I13f9b81a79e4f580aa0ba6cb5b418e2780ee4f5e
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 16:04:28 +08:00
Sandy Huang
23d7592936 drm/rockchip: rk3288 vop: identify vop lit and vop big
most of rk3288 vop lit is same with vop big, but some feature is
different, just like max output resolution.

vop big max output: 3840*2160
vop lit max ougput: 2560*1600

Change-Id: Ie926ed29c9d23159ccf3dd5c3e885e48a21731cb
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 16:04:28 +08:00
Zheng Yang
c8b307dd01 phy: rockchip: inno-hdmi: set sync detection counter length
The RK3328 HDMI PHY adds a method to detect the TMDS Data sync
enable status. The counter length is defined as:
	Fref * 495 * 4 / Ftmdsclk
If sync enable counter match the counter length, the sync status
defined in reg0xdd will be set to true.

Change-Id: Ib6a58cb50127e84399011cb398e7fa36f72b3a45
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
2018-03-01 15:45:11 +08:00
Tony Xie
1ed201f3fa arm64: dts: rockchip: set dcdc auto mode for rk817&rk809
Change-Id: I149bd790e20eb89899e091a767ef8293f83ecdd6
Signed-off-by: Tony Xie <tony.xie@rock-chips.com>
2018-03-01 14:22:53 +08:00
Sandy Huang
621759cbea arm64: dts: rockchip: rk3328: add clk define for vop iommu
Change-Id: I1f6a2ad41455046e3de90be3a6026ac0afa2490d
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 14:22:04 +08:00
Sandy Huang
d37da3f924 drm/rockchip: vop: close all win when enable vop
Because vop is unstable when update output timing,
so we close all win make sure stable.

Change-Id: Ifd4e60a41c667426d40e0d57e5180034bab9d5e7
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 14:22:04 +08:00
Sandy Huang
3edcf7147a drm/rockchip: update crtc->primary->fb to fb help fb
Before this update, drm_fb_helper_is_bound will return false
when hdmi plug.

Change-Id: I28c07b1c1c3405af2627bf423721c757f1e84258
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 14:22:04 +08:00
Sandy Huang
0f25f377ac drm/rockchip: vop: set is_iommu_enabled to false when enable iommu fail
for some unknown reason, iommu will enable fail, so we set is_iommu_enabled
to false insure the iommu will be enable at next frame.

Change-Id: Icd8779fff816f7498385aff9aa4712e6ad18f93c
Signed-off-by: Sandy Huang <hjc@rock-chips.com>
2018-03-01 14:22:04 +08:00
Xiao Yao
edda3bd7f2 arm64: dts: rockchip: add sample/drv clk for sdmmc/ext for rk3328 chip
Change-Id: I2c00f2e461e283abbc18b426f5298490dee4bdfe
Signed-off-by: Xiao Yao <xiaoyao@rock-chips.com>
2018-02-28 17:46:49 +08:00
Binyuan Lan
d23a54bc04 ASoC: rockchip: rk817-codec: add get_regmap and optimize the code
Change-Id: If6a810b3b9f2d192bf765ad28bcd6c9f4bfd5a9e
Signed-off-by: Binyuan Lan <lby@rock-chips.com>
2018-02-28 17:47:55 +08:00
Markus Elfring
bd48cb28be UPSTREAM: pinctrl: rockchip: Fix a typo in four comment lines
Adjust words in these descriptions.

Change-Id: I93775d4d1c40f278e46889fabbd1a65eb7708520
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 85dc397a24)
2018-02-28 14:55:00 +08:00
Markus Elfring
3598d8ec98 UPSTREAM: pinctrl: rockchip: Improve a size determination in rockchip_pinctrl_probe()
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Change-Id: Ic9e944a36fb8ed01a71c60922c949c00e6ecda48
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 283b7ac92b)
2018-02-28 14:55:00 +08:00
Markus Elfring
e9db9f694e UPSTREAM: pinctrl: rockchip: Delete error messages for a failed memory allocation in two functions
Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Change-Id: If4c563f14388b60a9c49bcf4c050198a53c89a6c
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 98c8ee73fe)
2018-02-28 14:55:00 +08:00
Laxman Dewangan
84f76e7c4b UPSTREAM: pinctrl: rockchip: Use devm_pinctrl_register() for pinctrl registration
Use devm_pinctrl_register() for pin control registration.

Change-Id: Id474b9b0020cef9ed56e5fa1f0e477c2f5dee99a
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-rockchip@lists.infradead.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 0085a2b47b)
2018-02-28 14:55:00 +08:00
Brian Norris
108a463671 UPSTREAM: pinctrl: rockchip: enable clock when reading pin direction register
We generally leave the GPIO clock disabled, unless an interrupt is
requested or we're accessing IO registers. We forgot to do this for the
->get_direction() callback, which means we can sometimes [1] get
incorrect results [2] from, e.g., /sys/kernel/debug/gpio.

Enable the clock, so we get the right results!

[1] Sometimes, because many systems have 1 or mor interrupt requested on
each GPIO bank, so they always leave their clock on.

[2] Incorrect, meaning the register returns 0, and so we interpret that
as "input".

Change-Id: I8c98cb41719d0666845d0ff893a7de05ce04128f
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 5c9d8c4f6b)
2018-02-28 14:55:00 +08:00
Caesar Wang
6fc772255b UPSTREAM: pinctrl: rockchip: add support the get_direction
This patch adds the get_direction to support the gpio
interface.

The gpio direction is not used on rockchip platform when use the gpio
debugfs.

Tested on kylin board. (RK3036 SoCs)
The repro steps:
$/sys/class/gpio/
echo 53 > export
$/sys/class/gpio/gpio53# cat direction
in
In general, the gpio53 should be out value, but the direction is the
default value 'in',  since the get_direction didn't supported in rockchip
pinctrl.

So, we should add this patch to support it.

Change-Id: I5510f3e60fdcae16b01a8dff1efbe31960dfcc1d
Cc: linux-gpio@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Reported-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
(cherry picked from commit 6ba20a00a3)
2018-02-28 14:55:00 +08:00
Irina Tirdea
87bd37c8c8 UPSTREAM: pinctrl: Rename pinctrl_utils_dt_free_map to pinctrl_utils_free_map
Rename pinctrl_utils_dt_free_map to pinctrl_utils_free_map, since
it does not depend on device tree despite the current name. This
will enforce a consistent naming in pinctr-utils.c and will make
it clear it can be called from outside device tree (e.g. from
ACPI handling code).

Change-Id: I442cea04967997ed29d6e7a3cfe35f2ec2e9c95f
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit d32f7fd3bb)
2018-02-28 14:55:00 +08:00
Julia Lawall
5e8693fe05 UPSTREAM: pinctrl: mediatek: add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so a
return from the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
local idexpression n;
expression e,e1;
@@

 for_each_child_of_node(e1,n) {
   ...
(
   of_node_put(n);
|
   e = n
|
   return n;
|
+  of_node_put(n);
?  return ...;
)
   ...
 }
// </smpl>

Change-Id: Ifa715e7d1c475d3f33cfff3ce8b7f32636447a7c
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 4fc8a4b2a4)
2018-02-28 14:55:00 +08:00
Laxman Dewangan
5a4d5e6dcb UPSTREAM: pinctrl: Add devm_ apis for pinctrl_{register, unregister}
Add device managed APIs devm_pinctrl_register() and
devm_pinctrl_unregister() for the APIs pinctrl_register()
and pinctrl_unregister().

This helps in reducing code in error path and sometimes
removal of .remove callback for driver unbind.

Change-Id: I6e5f092ed0d830f8fdf357d51ae7d65fe9fb2020
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 80e0f8d94d)
Fix devm_pinctrl_dev_match with commit 3024f920eb
("pinctrl: zynq: Use devm_pinctrl_register() for pinctrl registration")
2018-02-28 14:55:00 +08:00
Laxman Dewangan
6f49ad54ab UPSTREAM: gpio: Add devm_ apis for gpiochip_add_data and gpiochip_remove
Add device managed APIs devm_gpiochip_add_data() and
devm_gpiochip_remove() for the APIs gpiochip_add_data()
and gpiochip_remove().

This helps in reducing code in error path and sometimes
removal of .remove callback for driver unbind.

Change-Id: I84e3336b05d0c0e82170d16cdae8977c9f962942
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 0cf3292cde)
2018-02-28 14:55:00 +08:00
Linus Walleij
0ed8601921 UPSTREAM: pinctrl: rockchip: use gpiochip data pointer
This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Change-Id: I9a9c0b6558e09efa680dfee0777469db62669e6c
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit 03bf81f1cb)
2018-02-28 14:55:00 +08:00
Linus Walleij
42ca171815 UPSTREAM: gpio: add a data pointer to gpio_chip
This adds a void * pointer to gpio_chip so that driver can
assign and retrieve some states. This is done to get rid of
container_of() calls for gpio_chips embedded inside state
containers, so we can remove the need to have the gpio_chip
or later (planned) struct gpio_device be dynamically allocated
at registration time, so that its struct device can be properly
reference counted and not bound to its parent device (e.g.
a platform_device) but instead live on after unregistration
if it is opened by e.g. a char device or sysfs.

The data is added with the new function gpiochip_add_data()
and for compatibility we add static inline wrapper function
gpiochip_add() that will call gpiochip_add_data() with
NULL as argument. The latter will be removed once we have
exorcised gpiochip_add() from the kernel.

gpiochip_get_data() is added as a static inline accessor
for drivers to quickly get their data out.

Change-Id: I00f974c6008c7bd36f9bfef30bf1ef162330a6f6
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Tao Huang <huangtao@rock-chips.com>
(cherry picked from commit b08ea35a32)
2018-02-28 14:55:00 +08:00