firefly-linux-kernel-4.4.55.git
7 years agodrm/rockchip: rga: fix potential buffer overflow
Jacob Chen [Fri, 10 Mar 2017 07:21:08 +0000 (15:21 +0800)]
drm/rockchip: rga: fix potential buffer overflow

Change-Id: Id923e38264855320fbe994bed156bf16eac60245
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agodrm/rockchip: rga: don't flush buffer context
Jacob Chen [Fri, 10 Mar 2017 07:04:59 +0000 (15:04 +0800)]
drm/rockchip: rga: don't flush buffer context

to save time

Change-Id: Ie4a1618eabdbb9ebf5ad0b73b8acc9df884a81bb
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agoARM: dts: rk3288: add dma-coherent to rga
Jacob Chen [Fri, 10 Mar 2017 07:03:19 +0000 (15:03 +0800)]
ARM: dts: rk3288: add dma-coherent to rga

RGA are used for scale copy buffer form vpu,isp,
no need to flush CPU cache

Change-Id: Id3cfa0560a14cea122321dc1ea814aa8ec5dd4b6
Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
7 years agodriver, touch, gt9xx: enable regulator default
Zorro Liu [Mon, 13 Mar 2017 09:12:09 +0000 (17:12 +0800)]
driver, touch, gt9xx: enable regulator default

Change-Id: I6e3e7fe6102c83058078486104f88a31cdf1d65b
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
7 years agoarm64: configs: rockchip_defconfig: enable mailbox and scpi
Frank Wang [Thu, 21 Jan 2016 08:42:24 +0000 (16:42 +0800)]
arm64: configs: rockchip_defconfig: enable mailbox and scpi

This adds select mailbox and scpi support.

Change-Id: I98fa6ee1ca210779b44c1351b68e8725071de07a
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm64: dts: rockchip: enable mbox related for rk3368-tb
Frank Wang [Tue, 7 Mar 2017 09:37:30 +0000 (17:37 +0800)]
arm64: dts: rockchip: enable mbox related for rk3368-tb

This adds enable mbox and scpi function for rk3368-tb board.

Change-Id: I0b4866b72ad59892bc1c051c60bafd1a15ddce14
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoarm64: dts: rockchip: add mbox related nodes for rk3368
Frank Wang [Thu, 21 Jan 2016 08:16:22 +0000 (16:16 +0800)]
arm64: dts: rockchip: add mbox related nodes for rk3368

This adds support rk3368-mbox and scpi nodes for rk3368 SoC.

Change-Id: Ifdb90f8101c67ec579b5bba28f163527ed096c4c
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agomailbox: rk3368: add mailbox and scpi function
Frank Wang [Thu, 21 Jan 2016 08:30:20 +0000 (16:30 +0800)]
mailbox: rk3368: add mailbox and scpi function

Add mailbox and scpi protocol function support for rk3368 SoC.

Change-Id: I201c916865eb2729ed135c3f5a77a9dd97007952
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agovideo: rockchip: vcodec: fix the output buffer of jpeg
Randy Li [Fri, 10 Mar 2017 06:17:59 +0000 (14:17 +0800)]
video: rockchip: vcodec: fix the output buffer of jpeg

The JPEG decoder is also able to output the raw image in
NV12 format without the help of Post Processor of decoder
in VDPU1.

Change-Id: I1b29a5d93d2dd8ae2f21a7537cc3493adf57d022
Signed-off-by: Randy Li <randy.li@rock-chips.com>
7 years agosoc: rockchip: add virtual poweroff support
XiaoDong Huang [Mon, 6 Mar 2017 03:34:41 +0000 (11:34 +0800)]
soc: rockchip: add virtual poweroff support

Change-Id: I79240fa936eee3e64eb74eb5d5cdc952c3b2ac9b
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
7 years agoARM64: dts: rk3399: config rockchip_suspend
wlq [Mon, 13 Mar 2017 02:41:14 +0000 (10:41 +0800)]
ARM64: dts: rk3399: config rockchip_suspend

Change-Id: I41e7e77b1cc903200c7e1711bae15c629a616564
Signed-off-by: Wu Liangqing <wlq@rock-chips.com>
7 years agoARM64: dts: rk3399-mid-818: enable hdmi on vopl
Mark Yao [Mon, 13 Mar 2017 01:43:37 +0000 (09:43 +0800)]
ARM64: dts: rk3399-mid-818: enable hdmi on vopl

Change-Id: Ic42cd1895aaf0326671a30b4971c79b8ab309b4e
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable CONFIG_FW_LOADER_USER_HELPER_FALLBACK
xiaoyao [Fri, 10 Mar 2017 12:05:35 +0000 (20:05 +0800)]
arm64: rockchip_defconfig: enable CONFIG_FW_LOADER_USER_HELPER_FALLBACK

Change-Id: Ide84478567d97b53359619bd646c3d11c89e2485
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3328: Fix the saradc compitiable
David Wu [Fri, 10 Mar 2017 09:09:27 +0000 (17:09 +0800)]
arm64: dts: rockchip: rk3328: Fix the saradc compitiable

The rk3328 saradc is the same as rk3399, so change the compitiable,
they are both 6 channels.

Change-Id: Ia6104e8c5c3590cc745792b8cd3a457a15bb53d2
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3328: remove the gmac m0 pins
David Wu [Fri, 10 Mar 2017 07:50:01 +0000 (15:50 +0800)]
arm64: dts: rockchip: rk3328: remove the gmac m0 pins

The RK3328 datasheet is not define the pins of gmac m0,
so remove them.

Change-Id: Ic537586c76bd2f3a937c1e15b5877744598cc702
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3328: Use new define for RK3328 pins
David Wu [Fri, 10 Mar 2017 07:32:31 +0000 (15:32 +0800)]
arm64: dts: rockchip: rk3328: Use new define for RK3328 pins

Change-Id: I33ba7d3ae0fd93e94fe661936d90f2100f478205
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoinclude: dt-bindings: Add GPIO pin index definition for rockchip pinctrl
Andy Yan [Wed, 7 Sep 2016 01:00:53 +0000 (09:00 +0800)]
include: dt-bindings: Add GPIO pin index definition for rockchip pinctrl

Add gpio pin index definition to make it easier to describe
GPIO in dts.

Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Change-Id: I4aa6c01f96d91fd8ddcb371fd01ca9629f1a3013

7 years agonet: wireless: rockchip_wlan: update for ap6xxx wifi firmware
Xu Xuehui [Thu, 9 Mar 2017 03:03:43 +0000 (11:03 +0800)]
net: wireless: rockchip_wlan: update for ap6xxx wifi firmware

bcmdhd driver support ko module or compile into kernel

Change-Id: I260c9d3c3da0a9e249a4ee3883ed3efe03964ddf
Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
7 years agolinux: mfd: rk808: fix up the RK818_NUM_REGULATORS
Elaine Zhang [Fri, 10 Mar 2017 07:06:10 +0000 (15:06 +0800)]
linux: mfd: rk808: fix up the RK818_NUM_REGULATORS

Change-Id: I049286ec7afcaa66ca88458f51a3e0d516121001
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoFROMLIST: drm/bridge: analogix_dp: Don't read EDID if panel present
Sean Paul [Wed, 24 Aug 2016 14:25:29 +0000 (10:25 -0400)]
FROMLIST: drm/bridge: analogix_dp: Don't read EDID if panel present

If there's a panel connected to the analogix_dp bridge, rely on
the panel driver for modes, rather than reading EDID *and* calling
get_modes() on the panel.

This allows panels with a valid EDID to read it in the panel driver
(e.g. simple_panel), and panels with invalid EDID to homebrew modes
in their get_modes implementation.

BUG=chrome-os-partner:53565
TEST=Boot device and confirm the modes returned are from panel driver
     instead of EDID

[from https://patchwork.freedesktop.org/patch/107115/]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/374959
Commit-Ready: Chris Zhong <zyw@rock-chips.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Change-Id: Ie07dd33e3c121215bf24394cfcb3fff8c7c746a5
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable CONFIG_BT_RTKBTUSB
xiaoyao [Wed, 8 Mar 2017 09:19:46 +0000 (17:19 +0800)]
arm64: rockchip_defconfig: enable CONFIG_BT_RTKBTUSB

Change-Id: I571f3c53cb63a0f5f4d11c2e3dd128d828815b47
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
7 years agonet: wireless: rockchip: add rtl8822be pcie wifi driver
xiaoyao [Wed, 8 Mar 2017 08:49:29 +0000 (16:49 +0800)]
net: wireless: rockchip: add rtl8822be pcie wifi driver

Change-Id: Ibdc9a9272bf5221b56e2c63b59ffcba41674994c
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
7 years agoarm64: rockchip_defconfig: enable CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP
Xu Xuehui [Fri, 10 Mar 2017 04:03:06 +0000 (12:03 +0800)]
arm64: rockchip_defconfig: enable CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP

Change-Id: Idd64d6b137dc4bdabfd553bd6912d75a405b6485
Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
7 years agoiommu/rockchip: don't do power domain enable on probe
Mark Yao [Fri, 10 Mar 2017 03:26:30 +0000 (11:26 +0800)]
iommu/rockchip: don't do power domain enable on probe

Change-Id: I1484cbe6f7aa4fe358a3223de62a19aabee29d5c
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agoARM64: dts: rk3368-android: assigned aclk_vop to 400Mhz
Jianqun Xu [Fri, 10 Mar 2017 05:57:06 +0000 (13:57 +0800)]
ARM64: dts: rk3368-android: assigned aclk_vop to 400Mhz

Change-Id: Ie70934cb7046aa96a94e14b251d11e87a98b1512
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
7 years agoARM64: dts: rk3368-android: set firmware_class.path=/system/vendor/firmware
Jianqun Xu [Thu, 9 Mar 2017 08:22:03 +0000 (16:22 +0800)]
ARM64: dts: rk3368-android: set firmware_class.path=/system/vendor/firmware

It's required by gpu driver, which will load firmware through
/system/vendor/firmware.

If android finds another way to fix it, then can be reverted.

Change-Id: I2fede28f022f10c2e16f68b21159a638a10a53ec
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
7 years agostaging: ion: add api to set/get platform device
Jianqun Xu [Wed, 28 Dec 2016 03:27:37 +0000 (11:27 +0800)]
staging: ion: add api to set/get platform device

Change-Id: Ic251497b173608e1f98bf68fbf2b54b75f89c143
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
7 years agoRevert "arm64/dma-mapping: __generic_dma_ops always call swiotlb_dma_ops"
Jianqun Xu [Wed, 28 Dec 2016 00:32:18 +0000 (08:32 +0800)]
Revert "arm64/dma-mapping: __generic_dma_ops always call swiotlb_dma_ops"

This reverts commit 3e89f7de9a3abe9cff127e161d4e11699554cb76.

Change-Id: I4cf45807f91ab3021b6593f171c1f2573e1ea7f2
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
7 years agoARM64: dts: rk3399 box: enable hdmi_dp_sound
Sugar Zhang [Thu, 9 Mar 2017 07:47:07 +0000 (15:47 +0800)]
ARM64: dts: rk3399 box: enable hdmi_dp_sound

Change-Id: I04bdec75510b3e47a62a5093fdbd6ec66926e282
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
7 years agoARM64: dts: rk3399-android: add hdmi-dp drm audio
Sugar Zhang [Wed, 8 Mar 2017 12:41:05 +0000 (20:41 +0800)]
ARM64: dts: rk3399-android: add hdmi-dp drm audio

this patch register hdmi and dp as one sound card, and compatible
single hdmi audio, single dp audio or both.

Change-Id: I840e6c13f1a0c765a3a9235eb0a798011fc3bf06
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
7 years agoARM64: configs: rockchip: enable SND_SOC_ROCKCHIP_HDMI_DP
Sugar Zhang [Wed, 8 Mar 2017 12:40:19 +0000 (20:40 +0800)]
ARM64: configs: rockchip: enable SND_SOC_ROCKCHIP_HDMI_DP

Change-Id: Icce0802191f2f92913ffc637c50d849bfa79859a
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
7 years agodrm/rockchip: cdn-dp: return zero when dp is inactive
Sugar Zhang [Wed, 8 Mar 2017 12:37:26 +0000 (20:37 +0800)]
drm/rockchip: cdn-dp: return zero when dp is inactive

Change-Id: I741b8ac140014c7f046f59e371ed3ddb245468a2
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
7 years agoASoC: rockchip: add machine driver for built-in hdmi and dp
Sugar Zhang [Wed, 8 Mar 2017 12:34:27 +0000 (20:34 +0800)]
ASoC: rockchip: add machine driver for built-in hdmi and dp

this patch is used for rockchip built-in HDMI and DP audio output which are
wired to the same i2s line. so we use a DAI link CPU to multicodecs.

Change-Id: Ie8d1ede201a4d4b4cd11c8c05cd1f6177d844957
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
7 years agoUPSTREAM: ASoC: soc-core: snd_soc_get_dai_name() become non static
Kuninori Morimoto [Fri, 11 Nov 2016 01:19:28 +0000 (01:19 +0000)]
UPSTREAM: ASoC: soc-core: snd_soc_get_dai_name() become non static

snd_soc_get_dai_name() is used from snd_soc_of_get_dai_name(),
and it is assuming that DT is using "sound-dai" / "#sound-dai-cells".
But graph base DT is using "remote-endpoint". This patch makes
snd_soc_get_dai_name() non static for graph support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
(cherry picked from commit 1ad8ec535b997ed36c0f32c2616206725258dd30)

Change-Id: If99dcbfa722f09e3238cfafb5dc2803b6636a2e0

7 years agoarm64: dts: rockchip: amend usb-otg related nodes for rk3368-tb
Frank Wang [Wed, 8 Mar 2017 07:07:02 +0000 (15:07 +0800)]
arm64: dts: rockchip: amend usb-otg related nodes for rk3368-tb

This adds move some common properties of usb-otg from dts to dtsi.

Change-Id: I84355433b5ca63cc0b763d66dcdbb38897635418
Signed-off-by: Frank Wang <frank.wang@rock-chips.com>
7 years agoARM: dts: rockchip: use hdmi-ddc for ddc bus in rk3288
Nickey Yang [Fri, 3 Mar 2017 07:45:53 +0000 (15:45 +0800)]
ARM: dts: rockchip: use hdmi-ddc for ddc bus in rk3288

Using the builtin I2C controller in dw_hdmi is better than using the
normal RK3288 I2C controller(I2C5).

Test: work normally when switch mode between 4K@60hz|4K@30hz|1080P..
Change-Id: Ifb4b72ca5649efb0cc3055f2db34ebbcc2377c4c
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
7 years agoarm64: dts: rockchip: use hdmi-ddc for ddc bus in rk3399
Nickey Yang [Fri, 3 Mar 2017 07:56:35 +0000 (15:56 +0800)]
arm64: dts: rockchip: use hdmi-ddc for ddc bus in rk3399

Using the builtin I2C controller in dw_hdmi is better than using the
normal RK3399 I2C controller(I2C3).

Change-Id: I6a2de7221263e8564f7cca56ea5c52e1a133c138
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
7 years agoFROMLIST: drm/bridge: dw_hdmi: support i2c extended read mode
Nickey Yang [Thu, 9 Mar 2017 02:56:37 +0000 (10:56 +0800)]
FROMLIST: drm/bridge: dw_hdmi: support i2c extended read mode

"I2C Master Interface Extended Read Mode" implements a segment
pointer-based read operation using the Special Register configuration.

This patch fix https://patchwork.kernel.org/patch/7098101/ mentioned
"The current implementation does not support "I2C Master Interface
Extended Read Mode" to read data addressed by non-zero segment
pointer, this means that if EDID has more than 1 extension blocks"

With this patch,dw-hdmi can read EDID data with 1/2/4 blocks.

(am from https://patchwork.kernel.org/patch/9586343/)

BUG=chrome-os-partner:59768
TEST=fievel can read 1/2/4 blocks EDID data

Change-Id: I086e6ea63ec69c0532be445b958ce253a7f1f3cc
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/442308
Reviewed-by: Douglas Anderson <dianders@chromium.org>
7 years agovideo: rockchip: vop: add ourput color bt601, bt709, bt2020
Huang Jiachai [Thu, 29 Dec 2016 07:26:53 +0000 (15:26 +0800)]
video: rockchip: vop: add ourput color bt601, bt709, bt2020

Change-Id: I0b679244817f1a524d6f834ade32dce1666a6352
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
(cherry picked from commit b76f11e6652a825fd4cb7798ec3fe06c60587338)

7 years agoarm64: dts: rk3399: sapphire-excavator: enabled hdmi sound
wlq [Thu, 23 Feb 2017 01:15:13 +0000 (09:15 +0800)]
arm64: dts: rk3399: sapphire-excavator: enabled hdmi sound

Change-Id: If95f0b885aa3afdbaa985b4b39628502075be90e
Signed-off-by: wlq <wlq@rock-chips.com>
7 years agoclk: rockchip: rk3368: add CLK_IGNORE_UNUSED flag for mcu clk
Elaine Zhang [Thu, 9 Mar 2017 02:36:00 +0000 (10:36 +0800)]
clk: rockchip: rk3368: add CLK_IGNORE_UNUSED flag for mcu clk

Change-Id: I27856c9523ac3bffd4b509f016a659a1e3094b41
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agoUPSTREAM: pwm: Use pwm_get/set_xxx() helpers where appropriate
Boris Brezillon [Thu, 14 Apr 2016 19:17:22 +0000 (21:17 +0200)]
UPSTREAM: pwm: Use pwm_get/set_xxx() helpers where appropriate

Use pwm_get/set_xxx() helpers instead of directly accessing the pwm->xxx
field. Doing that will ease adaptation of the PWM framework to support
atomic update.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 4b58896f72176b781816a9e14dcea5f755b19b5c)

Change-Id: Ic6bdaf2017bb292ef920604fba86805999cebf0c
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: dts: rockchip: sync pmugrf with upstream for rk3399
Huang, Tao [Wed, 8 Mar 2017 10:59:02 +0000 (18:59 +0800)]
arm64: dts: rockchip: sync pmugrf with upstream for rk3399

Change-Id: I0b023824265418c72413e6702fbc5592eba0dc4e
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: dts: rockchip: rename ethernet node name for rk3399
Huang, Tao [Wed, 8 Mar 2017 10:51:40 +0000 (18:51 +0800)]
arm64: dts: rockchip: rename ethernet node name for rk3399

Same as upstream.

Change-Id: I737f7974d01a22abc697483956db795e7e151fe0
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoUPSTREAM: arm64: dts: rockchip: add rk3399 thermal_zones phandle
Brian Norris [Fri, 2 Dec 2016 02:27:26 +0000 (18:27 -0800)]
UPSTREAM: arm64: dts: rockchip: add rk3399 thermal_zones phandle

We're going to need to amend this table in board files.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
(cherry picked from commit 647cea2e68420fa73efb97c908cdf0c852c22cec)

Change-Id: Ife7affa44554622b1b35ad6756cef78d22c69a3a
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoarm64: dts: rockchip: reorder some nodes for rk3399
Huang, Tao [Wed, 8 Mar 2017 10:32:18 +0000 (18:32 +0800)]
arm64: dts: rockchip: reorder some nodes for rk3399

keep order as upstream.

Change-Id: I52e0dfe97f0d12c550603675085a66346529794d
Signed-off-by: Huang, Tao <huangtao@rock-chips.com>
7 years agoARM64: dts: rockchip: rk3399: change the pll init freq
Elaine Zhang [Tue, 28 Feb 2017 07:51:28 +0000 (15:51 +0800)]
ARM64: dts: rockchip: rk3399: change the pll init freq

set npll init freq 600M
set gpll init freq 800M

Change-Id: I110cc4b4051504dd875712bce9e473f74d8578b4
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agopwm: rockchip: Fix the warning for rockchip_linux_defconfig
David Wu [Wed, 8 Mar 2017 02:51:43 +0000 (10:51 +0800)]
pwm: rockchip: Fix the warning for rockchip_linux_defconfig

This patch fix the following warning:
drivers/pwm/pwm-rockchip.c:176:6: warning: unused variable 'ret' [-Wunused-variable]

Change-Id: I9ac08ad08fdefee5b875d36592936b07f032586c
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agonet: wireless: rockchip_wlan: update realtek wifi support
Xu Xuehui [Tue, 7 Mar 2017 03:46:36 +0000 (11:46 +0800)]
net: wireless: rockchip_wlan: update realtek wifi support

support wifi driver work as ko module or compile into kernel

1. wifi driver work as ko module, configs show as below:

CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP=n
CONFIG_RTL8188EU = m and CONFIG_RTL8188FU = m

2. wifi driver compile into kernel, configs show as below:
ps: Only one Realtek driver can be compiled into the kernel
CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP=y
CONFIG_RTL8188EU = y or CONFIG_RTL8188FU = y

Change-Id: I40e33a6f27597f9f90d9987d189b74fb637c40c1
Signed-off-by: Xu Xuehui <xxh@rock-chips.com>
7 years agoarm64: dts: rockchip: rk3399: set ir irq handle on cpu1
Huang zhibao [Mon, 6 Mar 2017 02:53:00 +0000 (10:53 +0800)]
arm64: dts: rockchip: rk3399: set ir irq handle on cpu1

Change-Id: I89f75184af810a050f6ca09daeba17774af4465e
Signed-off-by: Huang zhibao <hzb@rock-chips.com>
7 years agodrm/rockchip: vop: fix background color on yuv domain
Mark Yao [Fri, 3 Mar 2017 00:40:21 +0000 (08:40 +0800)]
drm/rockchip: vop: fix background color on yuv domain

On yuv domain, background need use 10bit yuv format.

Change-Id: I02fe3894ac12b509e22c0d90977bcb7e4535c16d
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: dw_hdmi: support ROCKCHIP_OUT_MODE_YUV420
Zheng Yang [Wed, 1 Mar 2017 08:05:37 +0000 (16:05 +0800)]
drm/rockchip: dw_hdmi: support ROCKCHIP_OUT_MODE_YUV420

VOP output mode and bus_format must be ROCKCHIP_OUT_MODE_YUV420
and MEDIA_BUS_FMT_YUV8_1X24 when display mode has a YCbCr420
flag.

Change-Id: Ib2d51c119f5a8f1b8a9285c47ab228b22a293d56
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
7 years agodrm: bridge/dw_hdmi: support HDMI 2.0 YCbCr 4:2:0
Zheng Yang [Wed, 1 Mar 2017 08:03:52 +0000 (16:03 +0800)]
drm: bridge/dw_hdmi: support HDMI 2.0 YCbCr 4:2:0

Change-Id: I21fe667e8beeaf2f9b46fce043b6e14b366a3e05
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
7 years agoARM64: dts: rockchip: rk3368: add ramp-delay for syr82x dcdc
Elaine Zhang [Tue, 7 Mar 2017 02:57:39 +0000 (10:57 +0800)]
ARM64: dts: rockchip: rk3368: add ramp-delay for syr82x dcdc

Change-Id: I61ef71b32aa708123909124b89f61e8a8f3a1bb7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agomfd: rk818: use rk808-regulator
Elaine Zhang [Tue, 7 Mar 2017 02:55:09 +0000 (10:55 +0800)]
mfd: rk818: use rk808-regulator

Change-Id: Ib7150f229a4682b6d0f4c5a6776a9ebc8565d221
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agodrm: redefine YCbCr420 flag to bits 23:24
Zheng Yang [Mon, 6 Mar 2017 03:00:33 +0000 (11:00 +0800)]
drm: redefine YCbCr420 flag to bits 23:24

Since bits[19:22] have been used for picture aspect ratio
in upstream patch 876f43c073d79ad3f14a4cebd1aea1f39fc4daf5.
We define YCbCr420 flag to the subsequent bits.

Change-Id: I2eff8b51227fc7beb4f587e90bc070ae865ba9d4
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
7 years agoUPSTREAM: drm: add picture aspect ratio flags
Zheng Yang [Mon, 6 Mar 2017 02:49:46 +0000 (10:49 +0800)]
UPSTREAM: drm: add picture aspect ratio flags

This patch adds drm flag bits for aspect ratio information

Currently drm flag bits don't have field for mode's picture
aspect ratio. This field will help the driver to pick mode with
right aspect ratio, and help in setting right VIC field in avi
infoframes.

V2: Addressed review comments from Sean
- Changed PAR-> PIC_AR
V3: Rebase
V3: Added r-b by Jose

Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
Reviewed-by: Jim Bride <jim.bride@linux.intel.com>
Reviewed-by: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1476705880-15600-2-git-send-email-shashank.sharma@intel.com
(cherry picked from commit 876f43c073d79ad3f14a4cebd1aea1f39fc4daf5)
Change-Id: I7dc4d82722d4824ba2b6c041080373175b8f6d18
Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
7 years agodrm/rockchip: gem: reorder pages if page chunk less than 8
Simon [Tue, 17 Jan 2017 01:23:19 +0000 (09:23 +0800)]
drm/rockchip: gem: reorder pages if page chunk less than 8

Change-Id: I03a91d2f9c017086b3cb35edeaf6b7913b147b9b
Signed-off-by: Simon <xxm@rock-chips.com>
7 years agoARM64: dts: rk3399: Add pd/clk for iommu
Simon [Mon, 19 Dec 2016 12:20:33 +0000 (20:20 +0800)]
ARM64: dts: rk3399: Add pd/clk for iommu

Change-Id: I6da7372e82a031140fead601a0661260be75855b
Signed-off-by: Simon <xxm@rock-chips.com>
7 years agodrm/rockchip: support YUV420 output mode
Mark Yao [Wed, 1 Mar 2017 01:58:34 +0000 (09:58 +0800)]
drm/rockchip: support YUV420 output mode

Change-Id: I7b991c544df6da81be93d84febe59fc5089895ca
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agodrm/rockchip: vop: fixup color space table
Mark Yao [Fri, 3 Mar 2017 00:46:17 +0000 (08:46 +0800)]
drm/rockchip: vop: fixup color space table

Change-Id: Ia3c14602ffe837efd2fb4dcf8d3dd2c0960cfce6
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
7 years agovideo: rockchip: vcodec: add reg_rlc inside dec_pp
Jung Zhao [Wed, 21 Dec 2016 02:55:57 +0000 (10:55 +0800)]
video: rockchip: vcodec: add reg_rlc inside dec_pp

dec_pp also need to remap input fd.

Change-Id: Ic19a14a5ccc002b5be36d90ec3114244d5e494aa
Signed-off-by: Jung Zhao <jung.zhao@rock-chips.com>
7 years agoARM64: dts: rockchip: rk3399: invert the pwm polarity
Elaine Zhang [Mon, 6 Mar 2017 07:44:22 +0000 (15:44 +0800)]
ARM64: dts: rockchip: rk3399: invert the pwm polarity

invert the pwm polarity for new pwm interface

Change-Id: I8dfde14fbc4fd4aa907722f260ce72fdb4d7d3bb
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
7 years agovideo: backlight: pwm_bl: Fix the bug of Splashing screen when boot
David Wu [Fri, 3 Mar 2017 14:16:09 +0000 (22:16 +0800)]
video: backlight: pwm_bl: Fix the bug of Splashing screen when boot

The pwm_apply_args() should be removed when switching to the atomic
PWM API. Oherwise, the screen would splashing as the backlight is
disabled once when boot.

Change-Id: I0cadd471db54140192c39b9d7c6a673862e8f8d8
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agopwm: rockchip: State of pwm clock should synchronize with pwm enabled state
david.wu [Tue, 28 Feb 2017 03:23:34 +0000 (11:23 +0800)]
pwm: rockchip: State of pwm clock should synchronize with pwm enabled state

If the pwm was not enabled at uboot loader, pwm could not work for clock
always disabled at pwm driver. The pwm clock is enabled at beginning of
pwm_apply(), but disabled at end of pwm_apply().

If the pwm was enabled at uboot loader, pwm clock is always enabled unless
closed by ATF. The pwm-backlight might turn off the power at early suspend,
should disable pwm clock for saving power consume.

It is important to provide opportunity to enable/disable clock at pwm driver,
the pwm consumer should ensure correct order to call pwm enable/disable, and
pwm driver ensure state of pwm clock synchronized with pwm enabled state.

Change-Id: I545db81eb638957567abacb93fd06fff9dd7181b
Fixes: 2bf1c98aa5a4 ("pwm: rockchip: Add support for atomic update")
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: cros-ec: Add __packed to prevent padding
Brian Norris [Tue, 26 Jul 2016 18:22:13 +0000 (11:22 -0700)]
UPSTREAM: pwm: cros-ec: Add __packed to prevent padding

While the particular usage in question is likely safe (struct
cros_ec_command is 32-bit aligned, followed by <= 32-bit fields), it's
been suggested this is not a great pattern to follow for the general
case -- for example, if we follow a 'struct cros_ec_command' (which is
32-bit- but not 64-bit-aligned) with a struct that starts with a 64-bit
type (e.g., u64), the compiler may add padding.

Let's add __packed, to inform the compiler of our true intention -- to
have no padding between these struct elements -- and to future proof for
any refactorings that might occur.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 065cfbbb638cce3d388020c4b97813b4a904a7c3)

Change-Id: Iddd499863dde168679a88c2f9ecc461316b417a0
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Add ChromeOS EC PWM driver
Brian Norris [Fri, 15 Jul 2016 23:28:44 +0000 (16:28 -0700)]
UPSTREAM: pwm: Add ChromeOS EC PWM driver

Use the new ChromeOS EC EC_CMD_PWM_{GET,SET}_DUTY commands to control
one or more PWMs attached to the Embedded Controller. Because the EC
allows us to modify the duty cycle (as a percentage, where U16_MAX is
100%) but not the period, we assign the period a fixed value of
EC_PWM_MAX_DUTY and reject all attempts to change it.

This driver supports only device tree at the moment, because that
provides a very flexible way of describing the relationship between PWMs
and their consumer devices (e.g., backlight). On a non-DT system, we'll
probably want to use the non-GENERIC addressing (i.e., we'll need to
make special device instances that will use EC_PWM_TYPE_KB_LIGHT or
EC_PWM_TYPE_DISPLAY_LIGHT), as well as the relatively inflexible
pwm_lookup infrastructure for matching devices. Defer that work for now.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 1f0d3bb02785f698dc273b9006a473194c32f874)

Change-Id: I47dbb20b10ae1b941e50e9a783cb708dff8f7efd
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: dt-bindings: pwm: Add binding for ChromeOS EC PWM
Brian Norris [Fri, 15 Jul 2016 23:28:43 +0000 (16:28 -0700)]
UPSTREAM: dt-bindings: pwm: Add binding for ChromeOS EC PWM

The ChromeOS Embedded Controller can support controlling its attached
PWMs via its host-command interface. The number of supported PWMs varies
on a per-board basis, but we can autodetect this by checking the error
codes, so we don't need an extra property for this. And because the EC
only allows specifying the duty cycle and not the period, we don't
specify the period via pwm-cells, and instead have only support for one
cell -- to specify the index.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 9e60f50b4a79ae2df791d89d08cf2b78ad7629bd)

Change-Id: Ibb2ac5cff1e8cc2ab43c9f1f89e68e48da23d897
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Document pwm-dutycycle-unit and pwm-dutycycle-range
Boris Brezillon [Tue, 14 Jun 2016 09:13:22 +0000 (11:13 +0200)]
UPSTREAM: regulator: pwm: Document pwm-dutycycle-unit and pwm-dutycycle-range

Document the pwm-dutycycle-unit and pwm-dutycycle-range properties.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Brian Norris <briannorris@chromium.org>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 58fd822b2e344edae6b4dbc09b19bd0c4a2f8f60)

Change-Id: I029307b54210f2203276a467e947d0fa2e51966d
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Support extra continuous mode cases
Boris Brezillon [Tue, 14 Jun 2016 09:13:21 +0000 (11:13 +0200)]
UPSTREAM: regulator: pwm: Support extra continuous mode cases

The continuous mode allows one to declare a PWM regulator without having
to declare the voltage <-> dutycycle association table. It works fine as
long as your voltage(dutycycle) function is linear, but also has the
following constraints:

- dutycycle for min_uV = 0%
- dutycycle for max_uV = 100%
- dutycycle for min_uV < dutycycle for max_uV

While the linearity constraint is acceptable for now, we sometimes need to
restrict of the PWM range (to limit the maximum/minimum voltage for
example) or have a min_uV_dutycycle > max_uV_dutycycle (this could be
tweaked with PWM polarity, but not all PWMs support inverted polarity).

Add the pwm-dutycycle-range and pwm-dutycycle-unit DT properties to define
such constraints. If those properties are not defined, the PWM regulator
use the default pwm-dutycycle-range = <0 100> and
pwm-dutycycle-unit = <100> values (existing behavior).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit ea398e28739e25651ede7ddf5aeb57cbcbc8ca7d)

Change-Id: I6e10c93a6620113e1463221d461fc23ccf3fe398
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: rockchip: Add support for atomic update
Boris Brezillon [Tue, 14 Jun 2016 09:13:14 +0000 (11:13 +0200)]
UPSTREAM: pwm: rockchip: Add support for atomic update

Implement the ->apply() function to add support for atomic update.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(commit 2bf1c98aa5a41651f5e6455117ff06f66ff3cc50)

Conflicts:
drivers/pwm/pwm-rockchip.c

Change-Id: I92745cf301c26d20da284da8234e244828598d52
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: rockchip: Avoid glitches on already running PWMs
Boris Brezillon [Tue, 14 Jun 2016 09:13:13 +0000 (11:13 +0200)]
UPSTREAM: pwm: rockchip: Avoid glitches on already running PWMs

The current logic will disable the PWM clk even if the PWM was left
enabled by the bootloader (because it's controlling a critical device
like a regulator for example).
Keep the PWM clk enabled if the PWM is enabled to avoid any glitches.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(commit 48cf973cae33488f84d7ab79a0f613383cff4de4)

Conflicts:
drivers/pwm/pwm-rockchip.c

Change-Id: I75ffccd19c5244568fc0034d1585dac490296111
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: rockchip: Add support for hardware readout
Boris Brezillon [Tue, 14 Jun 2016 09:13:12 +0000 (11:13 +0200)]
UPSTREAM: pwm: rockchip: Add support for hardware readout

Implement the ->get_state() function to expose initial state.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 1ebb74cf3537135f157beddf1a4366070155edda)

Change-Id: Ia7454ce2f96ee814118724fa98bdd41d8b5ae922
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: rockchip: Fix period and duty cycle approximation
Boris Brezillon [Tue, 14 Jun 2016 09:13:11 +0000 (11:13 +0200)]
UPSTREAM: pwm: rockchip: Fix period and duty cycle approximation

The current implementation always round down the duty and period values,
while it would be better to round them to the closest integer.

These changes are needed in preparation of atomic update support to
prevent a period/duty cycle drift when executing several times the
'pwm_get_state() / modify / pwm_apply_state()' sequence.

Say you have an expected period of 3.333 us and a clk rate of
112.666667 MHz -- the clock frequency doesn't divide evenly, so the
period (stashed in nanoseconds) shrinks when we convert to the register
value and back, as follows:

  pwm_apply_state(): register = period * 112666667 / 1000000000;
  pwm_get_state(): period = register * 1000000000 / 112666667;

or in other words:

  period = period * 112666667 / 1000000000 * 1000000000 / 112666667;

which yields a sequence like:

  3333 -> 3328
  3328 -> 3319
  3319 -> 3310
  3310 -> 3301
  3301 -> 3292
  3292 -> ... (etc) ...

With this patch, we'd see instead:

  period = div_round_closest(period * 1126666671000000000) *
                   1000000000 / 112666667;

which yields a stable sequence:

  3333 -> 3337
  3337 -> 3337
  3337 -> ... (etc) ...

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 12f9ce4a519845070d338253ab9528b5d7e2df34)

Change-Id: Ife75404e663d1380725d634ac621b2ca9f831791
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Retrieve correct voltage
Boris Brezillon [Tue, 14 Jun 2016 09:13:20 +0000 (11:13 +0200)]
UPSTREAM: regulator: pwm: Retrieve correct voltage

The continuous PWM voltage regulator is caching the voltage value in
the ->volt_uV field. While most of the time this value should reflect the
real voltage, sometime it can be sightly different if the PWM device
rounded the set_duty_cycle request.
Moreover, this value is not valid until someone has modified the regulator
output.

Remove the ->volt_uV field and always rely on the PWM state to calculate
the regulator output.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit d9070fdbe40a04b61262bac0f7ff0c7c29a68015)

Change-Id: Iba7b143c1b08d547b5cd46ac42d9051fb34309df
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Properly initialize the ->state field
Boris Brezillon [Tue, 14 Jun 2016 09:13:19 +0000 (11:13 +0200)]
UPSTREAM: regulator: pwm: Properly initialize the ->state field

The ->state field is currently initialized to 0, thus referencing the
voltage selector at index 0, which might not reflect the current
voltage value.
If possible, retrieve the current voltage selector from the PWM state,
else return -EINVAL.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 87248991a1de28e73dc30057e82d831bc11cdd44)

Change-Id: I179395dc7bad7aa867e68c92be7ce92b03ae7112
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Switch to the atomic PWM API
Boris Brezillon [Tue, 14 Jun 2016 09:13:18 +0000 (11:13 +0200)]
UPSTREAM: regulator: pwm: Switch to the atomic PWM API

Use the atomic API wherever appropriate and get rid of pwm_apply_args()
call (the reference period and polarity are now explicitly set when
calling pwm_apply_state()).

We also make use of the pwm_set_relative_duty_cycle() helper to ease
relative to absolute duty_cycle conversion.

Note that changes introduced by commit fd786fb0276a ("regulator: pwm:
Try to avoid voltage error in duty cycle calculation") are no longer
needed because pwm_set_relative_duty_cycle() takes care of all rounding
approximation for us.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 3f4eb39be9b1402ea01a5c67441d0b0bcb74b4b2)

Change-Id: Id12d4d625fb6e1e5ff3725737cc9232e4df40c36
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Adjust PWM config at probe time
Boris Brezillon [Tue, 14 Jun 2016 09:13:17 +0000 (11:13 +0200)]
UPSTREAM: regulator: pwm: Adjust PWM config at probe time

The PWM attached to a PWM regulator device might have been previously
configured by the bootloader.
Make sure the bootloader and linux config are in sync, and adjust the PWM
config if that's not the case.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Mark Brown <broonie@kernel.org>
Acked-by: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit fd4f99c4c3ce8ccd9b8ea751afc614a7624ecef2)

Change-Id: I06abddddc4666cd6510b6317795931f282e44eb0
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Remove gratuitous blank line
Thierry Reding [Fri, 10 Jun 2016 13:49:53 +0000 (15:49 +0200)]
UPSTREAM: pwm: Remove gratuitous blank line

Commit 5ec803edcb70 ("pwm: Add core infrastructure to allow atomic
updates") introduced this double blank line by mistake.

Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 2b77487f2e8ff7e6496a7f5a08839de9bbb39ab3)

Change-Id: Ie84fc2496ae6ca111386fa42ab31b8ab0559bece
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Add relative duty cycle manipulation helpers
Boris Brezillon [Tue, 14 Jun 2016 09:13:10 +0000 (11:13 +0200)]
UPSTREAM: pwm: Add relative duty cycle manipulation helpers

The PWM framework expects PWM users to configure the duty cycle in nano-
seconds, but many users want to express the duty cycle relatively to the
period value (i.e. duty_cycle = 33% of the period).

Add the pwm_{get,set}_relative_duty_cycle() helpers to ease this kind of
conversion.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit f6f3bddf7b2b994a927808fcc5a3d07069c35956)

Change-Id: Ifffc72290225766a6006db6b18e6902ee51adb1c
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Add a helper to prepare a new PWM state
Boris Brezillon [Tue, 14 Jun 2016 09:13:09 +0000 (11:13 +0200)]
UPSTREAM: pwm: Add a helper to prepare a new PWM state

The pwm_init_state() helper prepares a new state object containing the
current PWM state except for the polarity and period fields which are
set to the reference values (those in struct pwm_args).

This is particularly useful for PWM users who want to apply a new duty-
cycle expressed relatively to the reference period without changing the
enable state.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit a6a0dbbcfa469cf3e5c4d9522106c0b7b9e9e373)

Change-Id: Ib968e8fa6a49d5f853fc13cb4935e2af7494040f
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Fix regulator ramp delay for continuous mode
Douglas Anderson [Wed, 6 Jul 2016 18:42:01 +0000 (11:42 -0700)]
UPSTREAM: regulator: pwm: Fix regulator ramp delay for continuous mode

The original commit adding support for continuous voltage mode didn't
handle the regulator ramp delay properly.  It treated the delay as a
fixed delay in uS despite the property being defined as uV / uS.  Let's
adjust it.  Luckily there appear to be no users of this ramp delay for
PWM regulators (as per grepping through device trees in linuxnext).

Note also that the upper bound of usleep_range probably shouldn't be a
full 1 ms longer than the lower bound since I've seen plenty of hardware
with a ramp rate of ~5000 uS / uV and for small jumps the total delays
are in the tens of uS.  1000 is way too much.  We'll try to be dynamic
and use 10%.

NOTE: This commit doesn't add support for regulator-enable-ramp-delay.
That could be done in a future patch when someone has a user of that
featre.

Though this patch is shows as "fixing" a bug, there are no actual known
users of continuous mode PWM regulator w/ ramp delay in mainline and so
this likely won't have any effect on anyone unless they are working
out-of-tree with private patches.  For anyone in this state, it is
highly encouraged to also pick Boris Brezillon's WIP patches to get
yourself a reliable and glitch-free regulator.

Fixes: 4773be185a0f ("regulator: pwm-regulator: Add support for continuous-voltage")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit c2588393e6315ab68207323d37d2a73713d6bc81)

Change-Id: Ib0af8e04275813f333af12d48567b7e411b4d49f
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Fix pwm_apply_args()
Boris Brezillon [Wed, 22 Jun 2016 07:25:14 +0000 (09:25 +0200)]
UPSTREAM: pwm: Fix pwm_apply_args()

Commit 5ec803edcb70 ("pwm: Add core infrastructure to allow atomic
updates"), implemented pwm_disable() as a wrapper around
pwm_apply_state(), and then, commit ef2bf4997f7d ("pwm: Improve args
checking in pwm_apply_state()") added missing checks on the ->period
value in pwm_apply_state() to ensure we were not passing inappropriate
values to the ->config() or ->apply() methods.

The conjunction of these 2 commits led to a case where pwm_disable()
was no longer succeeding, thus preventing the polarity setting done
in pwm_apply_args().

Set a valid period in pwm_apply_args() to ensure polarity setting
won't be rejected.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Suggested-by: Brian Norris <briannorris@chromium.org>
Fixes: 5ec803edcb70 ("pwm: Add core infrastructure to allow atomic updates")
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 33cdcee04be3b4482be97393167e7561b2584e1e)

Change-Id: I9f28ae411953208b31c8d17214fce21e5177cee1
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Support for enable GPIO
Alexandre Courbot [Thu, 23 Jun 2016 07:39:44 +0000 (16:39 +0900)]
UPSTREAM: regulator: pwm: Support for enable GPIO

Add an optional enable GPIO to the pwm-regulator driver.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 27bfa8893b15a3fa22a593c90a48c8bcb1f9c75b)

Change-Id: I6530165e6bccb4fc82d2916d169a02ecdcbfcd3e
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: sysfs: Add PWM capture support
Lee Jones [Wed, 8 Jun 2016 09:21:25 +0000 (10:21 +0100)]
UPSTREAM: pwm: sysfs: Add PWM capture support

Allow a user to read PWM capture results from sysfs. To start a capture
and read the result, simply read the file:

  $ cat $PWMCHIP/capture

The output format is "<period> <duty cycle>".

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 1a366fe9153f445e950a7a344932b7419aa83094)

Change-Id: I86326709c373630a9189232a1cf2804a1a6ed380
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Add PWM capture support
Lee Jones [Wed, 8 Jun 2016 09:21:23 +0000 (10:21 +0100)]
UPSTREAM: pwm: Add PWM capture support

Supply a PWM capture callback op in order to pass back information
obtained by running analysis on a PWM signal. This would normally (at
least during testing) be called from the sysfs routines with a view to
printing out PWM capture data which has been encoded into a string.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
[thierry.reding@gmail.com: make capture data unsigned int for symmetry]
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 3a3d1a4e32ab47323d7b8c8b7631a8d36a3098b2)

Change-Id: Iee3acf2eb02c5282d586f4e7f1745031e17cc383
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: sysfs: Get return value from pwm_apply_state()
Ryo Kodama [Wed, 8 Jun 2016 01:58:23 +0000 (10:58 +0900)]
UPSTREAM: pwm: sysfs: Get return value from pwm_apply_state()

This patch adds to check the return value from pwm_apply_state()
used in enable_store(). The error of enable_store() doesn't work
if the return value doesn't received.

Signed-off-by: Ryo Kodama <ryo.kodama.vz@renesas.com>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Fixes: 39100ceea79f ("pwm: Switch to the atomic API")
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit fe5aa34d6eb9c4d34071845f70f3714b41c8a77d)

Change-Id: I550da28345bcee7a6aa8e1f9b5c43adae923ff2d
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Improve args checking in pwm_apply_state()
Brian Norris [Fri, 27 May 2016 16:45:49 +0000 (09:45 -0700)]
UPSTREAM: pwm: Improve args checking in pwm_apply_state()

It seems like in the process of refactoring pwm_config() to utilize the
newly-introduced pwm_apply_state() API, some args/bounds checking was
dropped.

In particular, I noted that we are now allowing invalid period
selections, e.g.:

  # echo 1 > /sys/class/pwm/pwmchip0/export
  # cat /sys/class/pwm/pwmchip0/pwm1/period
  100
  # echo 101 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle
  [... driver may or may not reject the value, or trigger some logic bug ...]

It's better to see:

  # echo 1 > /sys/class/pwm/pwmchip0/export
  # cat /sys/class/pwm/pwmchip0/pwm1/period
  100
  # echo 101 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle
  -bash: echo: write error: Invalid argument

This patch reintroduces some bounds checks in both pwm_config() (for its
signed parameters; we don't want to convert negative values into large
unsigned values) and in pwm_apply_state() (which fix the above described
behavior, as well as other potential API misuses).

Fixes: 5ec803edcb70 ("pwm: Add core infrastructure to allow atomic updates")
Signed-off-by: Brian Norris <briannorris@chromium.org>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit ef2bf4997f7da6efa8540d9cf726c44bf2b863af)

Change-Id: I7d7515a51b5c3c2a77ae9743b7ed69eedc11d4b4
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Drop unneeded pwm_enable() call
Boris Brezillon [Fri, 3 Jun 2016 08:23:00 +0000 (10:23 +0200)]
UPSTREAM: regulator: pwm: Drop unneeded pwm_enable() call

Now that the PWM regulator driver implements the ->enable/disable() hooks
we can remove the pwm_enable() call from pwm_regulator_set_voltage().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 830583004e615a4637eacc77866b84908414d7a0)

Change-Id: I89fba9a44d98ed94ede099b841b7358ba4011e35
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Add information about polarity, duty cycle and period to debugfs
Heiko Stübner [Thu, 14 Apr 2016 19:17:44 +0000 (21:17 +0200)]
UPSTREAM: pwm: Add information about polarity, duty cycle and period to debugfs

The PWM states make it possible to also output the polarity, duty cycle
and period information in the debugfs summary output. This simplifies
gathering information about PWMs without needing to walk through the
sysfs attributes of every PWM.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[thierry.reding@gmail.com: use more spaces in debugfs output]
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 23e3523f5d3a980edf7f189743cf4bb9490400a9)

Change-Id: Ia5d4d9ab898510d07364ad455ccf93e1c1d95d2b
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Switch to the atomic API
Boris Brezillon [Thu, 14 Apr 2016 19:17:43 +0000 (21:17 +0200)]
UPSTREAM: pwm: Switch to the atomic API

Replace legacy pwm_get/set_xxx() and pwm_config/enable/disable() calls
by pwm_get/apply_state().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 39100ceea79ff2efeb2fb094baf120c73d5ccf47)

Change-Id: I01fe340686c044e22c8e78f0a6f6995dc82b440a
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Update documentation
Boris Brezillon [Thu, 14 Apr 2016 19:17:42 +0000 (21:17 +0200)]
UPSTREAM: pwm: Update documentation

Update the PWM subsystem documentation to reflect the atomic PWM
changes.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit a07136fdcf12281781142caf1f78c6696721accd)

Change-Id: I04796750d3da1b7e7fd9eb0e4a2c900796fbd126
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Add core infrastructure to allow atomic updates
Boris Brezillon [Thu, 14 Apr 2016 19:17:41 +0000 (21:17 +0200)]
UPSTREAM: pwm: Add core infrastructure to allow atomic updates

Add an ->apply() method to the pwm_ops struct to allow PWM drivers to
implement atomic updates. This method is preferred over the ->enable(),
->disable() and ->config() methods if available.

Add the pwm_apply_state() function to the PWM user API.

Note that the pwm_apply_state() does not guarantee the atomicity of the
update operation, it all depends on the availability and implementation
of the ->apply() method.

pwm_enable/disable/set_polarity/config() are now implemented as wrappers
around the pwm_apply_state() function.

pwm_adjust_config() is allowing smooth handover between the bootloader
and the kernel. This function tries to adapt the current PWM state to
the PWM arguments coming from a PWM lookup table or a DT definition
without changing the duty_cycle/period proportion.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
[thierry.reding@gmail.com: fix a couple of typos]
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 5ec803edcb703fe379836f13560b79dfac79b01d)

Change-Id: Ib527f34ca3ce90ded3b48725d7ab9509de2053c9
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Add hardware readout infrastructure
Boris Brezillon [Thu, 14 Apr 2016 19:17:40 +0000 (21:17 +0200)]
UPSTREAM: pwm: Add hardware readout infrastructure

Add a ->get_state() function to the pwm_ops struct to let PWM drivers
initialize the PWM state attached to a PWM device.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 15fa8a43c147213a9563903c87b29671035eb6e8)

Change-Id: Ie37be2d34833cbb6cc4b4b4cb6af98ac721b953a
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Move the enabled/disabled info into pwm_state
Boris Brezillon [Thu, 14 Apr 2016 19:17:39 +0000 (21:17 +0200)]
UPSTREAM: pwm: Move the enabled/disabled info into pwm_state

Prepare the transition to PWM atomic update by moving the enabled and
disabled state into the pwm_state struct. This way we can easily update
the whole PWM state by copying the new state in the ->state field.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 09a7e4a3d9fcb95ade2cb02167e85fbeb8315ce0)

Change-Id: I38808d868c7e73f0ffd49cfb6c0b4b45fa911613
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Introduce the pwm_state concept
Boris Brezillon [Thu, 14 Apr 2016 19:17:38 +0000 (21:17 +0200)]
UPSTREAM: pwm: Introduce the pwm_state concept

The PWM state, represented by its period, duty_cycle and polarity is
currently directly stored in the PWM device. Declare a pwm_state
structure embedding those field so that we can later use this struct
to atomically update all the PWM parameters at once.

All pwm_get_xxx() helpers are now implemented as wrappers around
pwm_get_state().

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 43a276b003ed2e03de9d94b02a1ba49c1849b931)

Change-Id: I44037440bcc9d9164d18f3bfa1c8ff3e593925c5
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Keep PWM state in sync with hardware state
Boris Brezillon [Thu, 14 Apr 2016 19:17:37 +0000 (21:17 +0200)]
UPSTREAM: pwm: Keep PWM state in sync with hardware state

Before the introduction of pwm_args, the core was resetting the PWM
period and polarity states to the reference values (those provided
through the DT, a PWM lookup table or hardcoded in the driver).

Now that all PWM users are correctly using pwm_args to configure their
PWM device, we can safely remove the pwm_apply_args() call in pwm_get()
and of_pwm_get().

We can also get rid of the pwm_set_period() call in pwm_apply_args(),
because PWM users are now directly using pargs->period instead of
pwm_get_period(). By doing that we avoid messing with the current PWM
period.

The only remaining bit in pwm_apply_args() is the initial polarity
setting, and it should go away when all PWM users have been patched to
use the atomic API (with this API the polarity will be set along with
other PWM arguments when configuring the PWM).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit a8c3862551e063344f80c3e05d595f9d8836f355)

Change-Id: I5112f2d8a7b66e01184984376dcae84decf5ad28
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: backlight: pwm_bl: Use pwm_get_args() where appropriate
Boris Brezillon [Thu, 14 Apr 2016 19:17:29 +0000 (21:17 +0200)]
UPSTREAM: backlight: pwm_bl: Use pwm_get_args() where appropriate

The PWM framework has clarified the concept of reference PWM config (the
platform dependent config retrieved from the DT or the PWM lookup table)
and real PWM state.

Use pwm_get_args() when the PWM user wants to retrieve this reference
config and not the current state.

This is part of the rework allowing the PWM framework to support
hardware readout and expose real PWM state even when the PWM has just
been requested (before the user calls pwm_config/enable/disable()).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 6cb9644db7364ff5d2980ccd365b8cb684145327)

Change-Id: Idc29a17716d439962b50db156c13b65abd852d90
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: regulator: pwm: Use pwm_get_args() where appropriate
Boris Brezillon [Thu, 14 Apr 2016 19:17:27 +0000 (21:17 +0200)]
UPSTREAM: regulator: pwm: Use pwm_get_args() where appropriate

The PWM framework has clarified the concept of reference PWM config (the
platform dependent config retrieved from the DT or the PWM lookup table)
and real PWM state.

Use pwm_get_args() when the PWM user wants to retrieve this reference
config and not the current state.

This is part of the rework allowing the PWM framework to support
hardware readout and expose real PWM state even when the PWM has just
been requested (before the user calls pwm_config/enable/disable()).

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from 8c12ad8e916ee0477f7a0a0f00b0a87b9a21ebf7)

Conflicts:
drivers/regulator/pwm-regulator.c

Change-Id: Id7fb1d823db7a0be207de4f0393e6c86df143335
Signed-off-by: David Wu <david.wu@rock-chips.com>
7 years agoUPSTREAM: pwm: Get rid of pwm->lock
Boris BREZILLON [Wed, 30 Mar 2016 20:03:27 +0000 (22:03 +0200)]
UPSTREAM: pwm: Get rid of pwm->lock

PWM devices are not protected against concurrent accesses. The lock in
struct pwm_device might let PWM users think it is, but it's actually
only protecting the enabled state.

Removing this lock should be fine as long as all PWM users are aware
that accesses to the PWM device have to be serialized, which seems to be
the case for all of them except the sysfs interface. Patch the sysfs
code by adding a lock to the pwm_export struct and making sure it's
taken for all relevant accesses to the exported PWM device.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 459a25afe97cb3d7f978b90c881f4d7aac8fb755)

Change-Id: I30d97ebaf1db8b80c353da5ebebd0fc5d5c57bb0
Signed-off-by: David Wu <david.wu@rock-chips.com>