About the Xserver for rockchip

2016-10-17 Thread Heiko Stuebner
Am Montag, 17. Oktober 2016, 14:45:30 CEST schrieb Randy Li:
> Hello Tomasz:
>   Heiko told me you are in charge of the graphics part of chromium, I
> think I had better told you the developing status of the xorg xserver in
> rockchip.

What I actually said was that Tomasz did the original VPU driver used on 
veyron chromebooks, so may be interested in your current work on that :-) .

Also ChromeOS moved from X11 to use Freon instead, so I'm not sure if ChromeOS 
cares about that anymore.

> Currently the graphics department released a modification
> version of xserver which would support the libMali, but the way to
> support it is some kind of hacker which disabled the original mesa gl
> support.
> https://github.com/rockchip-linux/xserver/commit/bae12718e76d50d7388a93a251e
> f6777f6ca4850#diff-92a9ba7d51895d2d69c5c893fa0f658dL792
> 
>Since the code base of that is really a mess, I rebase the branch
> rockchip with the xserver branch 1.18 from upstream, it is there
> https://github.com/rockchip-linux/xserver/tree/rockchip-1.18
> But the version I made would omit some pixels when it is drawing, I have
> not found out why.

Didn't Mark do a lot of changes on your xserver, so maybe he knows what might 
be going wrong?


Heiko


[PATCH v4 1/7] clk: rockchip: add clock flag parameter when register pll

2016-08-05 Thread Heiko Stuebner
Am Freitag, 29. Juli 2016, 15:56:55 schrieb Lin Huang:
> From: Heiko Stübner 
> 
> add clock flag parameter so we can pass specific clock flag
> (like CLK_GET_RATE_NOCACHE etc..)to pll driver.
> 
> Signed-off-by: Heiko Stübner 
> Signed-off-by: Lin Huang 

applied to my clock branch for 4.9 after some minor edits on the commit 
message.


Thanks
Heiko


[PATCH v4 3/7] clk: rockchip: rk3399: add SCLK_DDRCLK ID for ddrc

2016-08-05 Thread Heiko Stuebner
Am Freitag, 29. Juli 2016, 15:56:57 schrieb Lin Huang:
> Signed-off-by: Lin Huang 
> ---
> Changes in v4:
> -None
> 
> Changes in v3:
> -None
> 
> Changes in v2:
> - None
> Changes in v1:
> - None
> 
>  include/dt-bindings/clock/rk3399-cru.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/dt-bindings/clock/rk3399-cru.h
> b/include/dt-bindings/clock/rk3399-cru.h index 50a44cf..8a0f0442 100644
> --- a/include/dt-bindings/clock/rk3399-cru.h
> +++ b/include/dt-bindings/clock/rk3399-cru.h
> @@ -131,6 +131,7 @@
>  #define SCLK_DPHY_RX0_CFG165
>  #define SCLK_RMII_SRC166
>  #define SCLK_PCIEPHY_REF100M 167
> +#define SCLK_DDRCLK  168

name it SCLK_DDRC instead, somewhat matching the naming in the TRM?


[PATCH v4 2/7] clk: rockchip: add new clock-type for the ddrclk

2016-08-05 Thread Heiko Stuebner
Am Donnerstag, 4. August 2016, 22:23:05 schrieb Heiko Stübner:
> Hi Lin,
> 
> Am Freitag, 29. Juli 2016, 15:56:56 schrieb Lin Huang:
> > On new rockchip platform(rk3399 etc), there have dcf controller to
> > do ddr frequency scaling, and this controller will implement in
> > arm-trust-firmware. We add a special clock-type to handle that.
> > 
> > Signed-off-by: Lin Huang 
> 
> please also include the ARM people from last time in your list.
> The arm_smccc_smc calls look correct on first glance, but there is only
> one other example in the kernel [0] outside psci that is using it, so I'd
> like some confirmation that we're doing the right thing :-)
> 
> 
> [0]
> http://lxr.free-electrons.com/source/arch/arm/mach-artpec/board-artpec6.c
> #L55
> > diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h
> > index bac775d..2e3bccf 100644
> > --- a/drivers/clk/rockchip/clk.h
> > +++ b/drivers/clk/rockchip/clk.h
> > @@ -281,6 +281,13 @@ struct clk *rockchip_clk_register_mmc(const char
> > *name, const char *const *parent_names, u8 num_parents,
> > 
> > void __iomem *reg, int shift);
> > 
> > +struct clk *rockchip_clk_register_ddrclk(const char *name, int flags,
> > +   const char *const *parent_names, u8 num_parents,
> > +   int mux_offset, int mux_shift, int mux_width,
> > +   int mux_flag, int div_shift, int div_width,
> > +   int div_flag, void __iomem *reg_base,
> > +   spinlock_t *lock);
> > +
> > 
> >  #define ROCKCHIP_INVERTER_HIWORD_MASK  BIT(0)
> >  
> >  struct clk *rockchip_clk_register_inverter(const char *name,
> > 
> > @@ -299,6 +306,7 @@ enum rockchip_clk_branch_type {
> > 
> > branch_mmc,
> > branch_inverter,
> > branch_factor,
> > 
> > +   branch_ddrc,
> > 
> >  };
> >  
> >  struct rockchip_clk_branch {
> > 
> > @@ -488,6 +496,25 @@ struct rockchip_clk_branch {
> > 
> > .child  = ch,   \
> > 
> > }
> > 
> > +#define COMPOSITE_DDRC(_id, cname, pnames, f, mo, ms, mw, mf,  \
> > +ds, dw, df)\
> > +   {   \
> > +   .id = _id,  \
> > +   .branch_type= branch_ddrc,  \
> > +   .name   = cname,\
> > +   .parent_names   = pnames,   \
> > +   .num_parents= ARRAY_SIZE(pnames),   \
> > +   .flags  = f,\
> > +   .muxdiv_offset  = mo,   \
> > +   .mux_shift  = ms,   \
> > +   .mux_width  = mw,   \
> > +   .mux_flags  = mf,   \
> > +   .div_shift  = ds,   \
> > +   .div_width  = dw,   \
> > +   .div_flags  = df,   \
> 
> you don't need (nor use) div and mux flags here, please use one flag
> param like the inverter type does and maybe directly add a flag like
>   ROCKCHIP_DDRCLK_SIP
> for this type.
> 
> Background being, that the ddr clock mechanism is essentially the same
> on all socs and only the method to change the rate varies
> (sip on rk3399, scpi on rk3368, something sram-based on rk3288 and before)
> so in the future, this driver should hopefully be able to carry all those
> different methods.

and maybe name it COMPOSITE_DDRCLK(...)


[PATCH v6 1/8] clk: rockchip: add new clock-type for the ddrclk

2016-08-19 Thread Heiko Stuebner
Hi Lin,

Am Mittwoch, 17. August 2016, 06:36:22 CEST schrieb Lin Huang:
> On new rockchip platform(rk3399 etc), there have dcf controller to
> do ddr frequency scaling, and this controller will implement in
> arm-trust-firmware. We add a special clock-type to handle that.
> 
> Signed-off-by: Lin Huang 
> ---
> Changes in v6:
> - none
> 
> Changes in v5:
> - delete unuse mux_flag
> - use div_flag to distinguish sip call and other operate
> 
> Changes in v4:
> - use arm_smccc_smc() to set/read ddr rate
> 
> Changes in v3:
> - use sip call to set/read ddr rate
> 
> Changes in v2:
> - use GENMASK instead val_mask
> - use divider_recalc_rate() instead DIV_ROUND_UP_ULL
> - cleanup code
> 
> Changes in v1:
> - none
> 
>  drivers/clk/rockchip/Makefile   |   1 +
>  drivers/clk/rockchip/clk-ddr.c  | 150
>  drivers/clk/rockchip/clk.c  | 
>  9 +++
>  drivers/clk/rockchip/clk.h  |  33 
>  include/soc/rockchip/rockchip_sip.h |  27 +++
>  5 files changed, 220 insertions(+)
>  create mode 100644 drivers/clk/rockchip/clk-ddr.c
>  create mode 100644 include/soc/rockchip/rockchip_sip.h
> 
> diff --git a/drivers/clk/rockchip/Makefile b/drivers/clk/rockchip/Makefile
> index f47a2fa..b5f2c8e 100644
> --- a/drivers/clk/rockchip/Makefile
> +++ b/drivers/clk/rockchip/Makefile
> @@ -8,6 +8,7 @@ obj-y += clk-pll.o
>  obj-y+= clk-cpu.o
>  obj-y+= clk-inverter.o
>  obj-y+= clk-mmc-phase.o
> +obj-y+= clk-ddr.o
>  obj-$(CONFIG_RESET_CONTROLLER)   += softrst.o
> 
>  obj-y+= clk-rk3036.o
> diff --git a/drivers/clk/rockchip/clk-ddr.c b/drivers/clk/rockchip/clk-ddr.c
> new file mode 100644
> index 000..7dbe8bff
> --- /dev/null
> +++ b/drivers/clk/rockchip/clk-ddr.c
> @@ -0,0 +1,150 @@
> +/*
> + * Copyright (c) 2016 Rockchip Electronics Co. Ltd.
> + * Author: Lin Huang 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "clk.h"
> +
> +struct rockchip_ddrclk {
> + struct clk_hw   hw;
> + void __iomem*reg_base;
> + int mux_offset;
> + int mux_shift;
> + int mux_width;
> + int div_shift;
> + int div_width;
> + int ddr_flag;
> + spinlock_t  *lock;
> +};
> +
> +#define to_rockchip_ddrclk_hw(hw) container_of(hw, struct rockchip_ddrclk,
> hw) +
> +static int rockchip_ddrclk_set_rate(struct clk_hw *hw, unsigned long drate,
> + unsigned long prate)
> +{
> + struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw);
> + unsigned long flags;
> + struct arm_smccc_res res;
> +
> + spin_lock_irqsave(ddrclk->lock, flags);
> + if (ddrclk->ddr_flag == ROCKCHIP_DDRCLK_SIP) {
> + arm_smccc_smc(SIP_DRAM_FREQ, drate, 0, CONFIG_DRAM_SET_RATE,
> +   0, 0, 0, 0, );
> + return res.a0;
> + }
> + spin_unlock_irqrestore(ddrclk->lock, flags);
> +
> + return 0;
> +}
> +
> +static unsigned long
> +rockchip_ddrclk_recalc_rate(struct clk_hw *hw,
> + unsigned long parent_rate)
> +{
> + struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw);
> + struct arm_smccc_res res;
> +
> + if (ddrclk->ddr_flag == ROCKCHIP_DDRCLK_SIP) {
> + arm_smccc_smc(SIP_DRAM_FREQ, 0, 0, CONFIG_DRAM_GET_RATE,
> +   0, 0, 0, 0, );
> + return res.a0;
> + }
> +
> + return 0;
> +}
> +
> +static long clk_ddrclk_round_rate(struct clk_hw *hw, unsigned long rate,

missing a Rockchip prefix

can't you also introduce a SIP method that returns the rounded rate - aka the 
ATF telling you which rate will be actually set, so that you can return a real 
round_rate value?


> +   unsigned long *prate)
> +{
> + return rate;
> +}
> +
> +static u8 rockchip_ddrclk_get_parent(struct clk_hw *hw)
> +{
> + struct rockchip_ddrclk *ddrclk = to_rockchip_ddrclk_hw(hw);
> + int num_parents = clk_hw_get_num_parents(hw);
> + u32 val;
> +
> + val = clk_readl(ddrclk->reg_base +
> + ddrclk->mux_offset) >> ddrclk->mux_shift;
> + val &= GENMASK(ddrclk->mux_width - 1, 0);
> +
> + if (val >= num_parents)
> + return -EINVAL;
> +
> + return val;
> +}
> +
> +static const struct clk_ops rockchip_ddrclk_ops = {
> + 

[PATCH v6 3/8] clk: rockchip: rk3399: add ddrc clock support

2016-08-19 Thread Heiko Stuebner
Am Mittwoch, 17. August 2016, 06:36:24 CEST schrieb Lin Huang:
> add ddrc clock setting, so we can do ddr frequency
> scaling on rk3399 platform in future.
> 
> Signed-off-by: Lin Huang 
> ---
> Changes in v6:
> - None
> 
> Changes in v5:
> - fit for the ddr type
> 
> Changes in v4:
> - None
> 
> Changes in v3:
> - None
> 
> Changes in v2:
> - remove clk_ddrc_dpll_src from critical clock list
> 
> Changes in v1:
> - remove ddrc source CLK_IGNORE_UNUSED flag
> - move clk_ddrc and clk_ddrc_dpll_src to critical
> 
>  drivers/clk/rockchip/clk-rk3399.c | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/clk/rockchip/clk-rk3399.c
> b/drivers/clk/rockchip/clk-rk3399.c index e445cd6..01d4945 100644
> --- a/drivers/clk/rockchip/clk-rk3399.c
> +++ b/drivers/clk/rockchip/clk-rk3399.c
> @@ -120,6 +120,10 @@ PNAME(mux_armclkb_p) = { 
"clk_core_b_lpll_src",
>   "clk_core_b_bpll_src",
>   "clk_core_b_dpll_src",
>   "clk_core_b_gpll_src" };
> +PNAME(mux_ddrclk_p)  = { "clk_ddrc_lpll_src",
> + "clk_ddrc_bpll_src",
> + "clk_ddrc_dpll_src",
> + "clk_ddrc_gpll_src" };
>  PNAME(mux_aclk_cci_p)= { "cpll_aclk_cci_src",
>   "gpll_aclk_cci_src",
>   "npll_aclk_cci_src",
> @@ -1379,6 +1383,18 @@ static struct rockchip_clk_branch
> rk3399_clk_branches[] __initdata = { COMPOSITE_NOMUX(0, "clk_test",
> "clk_test_pre", CLK_IGNORE_UNUSED, RK3368_CLKSEL_CON(58), 0, 5, DFLAGS,
>   RK3368_CLKGATE_CON(13), 11, GFLAGS),
> +
> + /* ddrc */
> + GATE(0, "clk_ddrc_lpll_src", "lpll", 0, RK3399_CLKGATE_CON(3),
> +  0, GFLAGS),
> + GATE(0, "clk_ddrc_bpll_src", "bpll", 0, RK3399_CLKGATE_CON(3),
> +  1, GFLAGS),
> + GATE(0, "clk_ddrc_dpll_src", "dpll", 0, RK3399_CLKGATE_CON(3),
> +  2, GFLAGS),
> + GATE(0, "clk_ddrc_gpll_src", "gpll", 0, RK3399_CLKGATE_CON(3),
> +  3, GFLAGS),
> + COMPOSITE_DDRCLK(SCLK_DDRC, "clk_ddrc", mux_ddrclk_p, 0,

I think I'd like to have the clock also named sclk_ddrc :-)

Otherwise that looks fine


Heiko


[PATCH] clk: rockchip: rk3399: fix copy-paste error

2016-11-16 Thread Heiko Stuebner
Am Mittwoch, 16. November 2016, 08:19:41 CET schrieb Jianqun Xu:
> Fix RK3368_* to RK3399_* for rk3399 clk_test clock.
> 
> Signed-off-by: Jianqun Xu 

applied to my clk branch for 4.10


Thanks
Heiko


[PATCH v3 02/10] drm/rockchip: analogix_dp: split the lcdc select setting into device data

2016-06-23 Thread Heiko Stuebner
Am Donnerstag, 23. Juni 2016, 10:32:53 schrieb Sean Paul:
> On Tue, Jun 14, 2016 at 7:46 AM, Yakir Yang  wrote:
> > eDP controller need to declare which vop provide the video source,
> > and it's defined in GRF registers.
> > 
> > But different chips have different GRF register address, so we need to
> > create a device data to declare the GRF messages for each chips.
> > 
> > Signed-off-by: Yakir Yang 
> > Acked-by: Mark Yao 
> > ---
> > Changes in v3:
> > - Write a kerneldoc-style comment explaining the chips data fields
> > (Tomasz, reviewed at Google Gerrit)> 
> > [https://chromium-review.googlesource.com/#/c/346313/10/drivers/gpu/
> > drm/rockchip/analogix_dp-rockchip.c at 39]> 
> > - Drop the '.lcdcsel_mask' number in chips data field (Tomasz, reviewed
> > at Google Gerrit)> 
> > [https://chromium-review.googlesource.com/#/c/346313/10/drivers/gpu/
> > drm/rockchip/analogix_dp-rockchip.c at 382]> 
> > - Add acked flag from Mark.
> > 
> > Changes in v2: None
> > 
> >  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 39
> >  +++-- 1 file changed, 30 insertions(+), 9
> >  deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> > b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index
> > 2bc8a7e..3855f46 100644
> > --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> > +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> > @@ -14,6 +14,7 @@
> > 
> >  #include 
> >  #include 
> > 
> > +#include 
> > 
> >  #include 
> >  #include 
> >  #include 
> > 
> > @@ -35,11 +36,17 @@
> > 
> >  #define to_dp(nm)  container_of(nm, struct rockchip_dp_device, nm)
> > 
> > -/* dp grf register offset */
> > -#define GRF_SOC_CON60x025c
> > -#define GRF_EDP_LCD_SEL_MASKBIT(5)
> > -#define GRF_EDP_SEL_VOP_LIT BIT(5)
> > -#define GRF_EDP_SEL_VOP_BIG 0
> > +/**
> > + * struct rockchip_dp_chip_data - splite the grf setting of kind of
> > chips + * @lcdsel_grf_reg: grf register offset of lcdc select
> > + * @lcdsel_big: reg value of selecting vop big for eDP
> > + * @lcdsel_lit: reg value of selecting vop little for eDP
> > + */
> > +struct rockchip_dp_chip_data {
> > +   u32 lcdsel_grf_reg;
> > +   u32 lcdsel_big;
> > +   u32 lcdsel_lit;
> > +};
> > 
> >  struct rockchip_dp_device {
> >  
> > struct drm_device*drm_dev;
> > 
> > @@ -51,6 +58,8 @@ struct rockchip_dp_device {
> > 
> > struct regmap*grf;
> > struct reset_control *rst;
> > 
> > +   const struct rockchip_dp_chip_data *data;
> > +
> > 
> > struct analogix_dp_plat_data plat_data;
> >  
> >  };
> > 
> > @@ -119,13 +128,13 @@ static void rockchip_dp_drm_encoder_enable(struct
> > drm_encoder *encoder)> 
> > return;
> > 
> > if (ret)
> > 
> > -   val = GRF_EDP_SEL_VOP_LIT | (GRF_EDP_LCD_SEL_MASK <<
> > 16);
> > +   val = dp->data->lcdsel_lit;
> > 
> > else
> > 
> > -   val = GRF_EDP_SEL_VOP_BIG | (GRF_EDP_LCD_SEL_MASK <<
> > 16);
> > +   val = dp->data->lcdsel_big;
> > 
> > dev_dbg(dp->dev, "vop %s output to dp\n", (ret) ? "LIT" :
> > "BIG");
> > 
> > -   ret = regmap_write(dp->grf, GRF_SOC_CON6, val);
> > +   ret = regmap_write(dp->grf, dp->data->lcdsel_grf_reg, val);
> > 
> > if (ret != 0) {
> > 
> > dev_err(dp->dev, "Could not write to GRF: %d\n", ret);
> > return;
> > 
> > @@ -246,6 +255,7 @@ static int rockchip_dp_bind(struct device *dev,
> > struct device *master,> 
> > void *data)
> >  
> >  {
> >  
> > struct rockchip_dp_device *dp = dev_get_drvdata(dev);
> > 
> > +   const struct rockchip_dp_chip_data *dp_data;
> > 
> > struct drm_device *drm_dev = data;
> > int ret;
> > 
> > @@ -256,10 +266,15 @@ static int rockchip_dp_bind(struct device *dev,
> > struct device *master,> 
> >  */
> > 
> > dev_set_drvdata(dev, NULL);
> > 
> > +   dp_data = of_device_get_match_data(dev);
> > +   if (!dp_data)
> > +   return -ENODEV;
> > +
> > 
> > ret = rockchip_dp_init(dp);
> > if (ret < 0)
> > 
> > return ret;
> > 
> > +   dp->data = dp_data;
> > 
> > dp->drm_dev = drm_dev;
> > 
> > ret = rockchip_dp_drm_create_encoder(dp);
> > 
> > @@ -365,8 +380,14 @@ static const struct dev_pm_ops rockchip_dp_pm_ops =
> > {> 
> > SET_SYSTEM_SLEEP_PM_OPS(rockchip_dp_suspend, rockchip_dp_resume)
> >  
> >  };
> > 
> > +static const struct rockchip_dp_chip_data rk3288_dp = {
> > +   .lcdsel_grf_reg = 0x025c,
> > +   .lcdsel_big = 0 | BIT(21),
> > +   .lcdsel_lit = BIT(5) | BIT(21),
> 
> I'm not sure what convention is in other drivers, but this seems less
> readable to me.
> 
> I'd prefer that the magic numbers 

[PATCH v12 0/18] Add Analogix Core Display Port Driver

2016-01-17 Thread Heiko Stuebner
Hi Yakir,

Am Mittwoch, 13. Januar 2016, 15:59:51 schrieb Heiko Stuebner:
> Am Mittwoch, 23. Dezember 2015, 20:25:38 schrieb Yakir Yang:
> >The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller
> > 
> > share the same IP, so a lot of parts can be re-used. I split the common
> > code into bridge directory, then rk3288 and exynos only need to keep
> > some platform code. Cause I can't find the exact IP name of exynos dp
> > controller, so I decide to name dp core driver with "analogix" which I
> > find in rk3288 eDP TRM
> 
> could you rebase your patches on top of Dave's drm-next branch [0] please?
> The exynos part got some const attributes for the *_func_ops structs and
> drm_encoder_init got an additional parameter.
> I'm still hoping that we can get this finally committed once 4.5-rc1 is
> released in 1.5 weeks :-) .
> 
> I did try to merge things together [1], the system at least comes up and
> detects the panel (EDID is read correctly and it turns the backlight on)
> but I don't see any output on the display - hdmi works fine though and
> X11 is claiming everything to be fine in both cases.
> 
> So I don't know yet if I made a mistake when putting this together or
> there is an issue on the driver-side.

I was able to debug this a bit more, and it seems the encoder_helper_funcs 
don't like the prepare/commit callbacks and like enable better.

So when I do something similar to Marks patch a8eef71d38da ("drm/rockchip: 
dw_hdmi: use encoder enable function"), like in the attached patch (to be 
folded into the original addition of those functions), I get display output 
again.


Heiko

> [0] http://cgit.freedesktop.org/~airlied/linux/log/?h=drm-next
> [1] https://github.com/mmind/linux-rockchip/tree/tmp/analogixdp_v12-veyron
> I left out patch16, per your talk with Jingoo and me not seeing any AUX
> CH errors without it.
-- next part --
A non-text attachment was scrubbed...
Name: 0001-analogix_dp-rockchip-use-.enable-instead-of-preprare.patch
Type: text/x-patch
Size: 1406 bytes
Desc: not available
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20160117/40b29442/attachment.bin>


[RFC/PATCH] drm/rockchip: don't wait for vblank if fb hasn't changed

2016-01-17 Thread Heiko Stuebner
Am Mittwoch, 13. Januar 2016, 12:53:34 schrieb John Keeping:
> As commented in drm_atomic_helper_wait_for_vblanks(), userspace relies
> on cursor ioctls being unsynced.  Converting the rockchip driver to
> atomic has significantly impacted cursor performance by making every
> cursor update wait for vblank.
> 
> By skipping the vblank sync when the framebuffer has not changed (as is
> done in drm_atomic_helper_wait_for_vblanks()) we can avoid this for the
> common case of moving the cursor and only need to delay the cursor ioctl
> when the cursor icon changes.
> 
> I originally inserted a check on legacy_cursor_update as well, but that
> caused a storm of iommu page faults.  I didn't investigate the cause of
> those since this change gives enough of a performance improvement for my
> use case.
> 
> This is RFC because of that and because the framebuffer_changed()
> function is copied from drm_atomic_helper.c as a quick way to test the
> result.
> 
> Signed-off-by: John Keeping 

I've seen the effects now as well after making the atomic parts work on in 
my devtree - i.e. sluggish cursor movements.

This patch fixes that issue, so at least:
Tested-by: Heiko Stuebner 


Right now I still see flickering on animated cursors though (like ones used 
by KDE), that wasn't present before.


Heiko


[patch] drm: rockchip: signedness bug in dw_mipi_dsi_get_lane_bps()

2016-01-21 Thread Heiko Stuebner
Hi Dan,

Am Mittwoch, 20. Januar 2016, 12:53:52 schrieb Dan Carpenter:
> "bpp" needs to be signed for the error handling to work.
> 
> Fixes: 84e05408fcfe ('drm: rockchip: Support Synopsys DW MIPI DSI')
> Signed-off-by: Dan Carpenter 

There's also "drm/rockchip/dsi: fix handling mipi_dsi_pixel_format_to_bpp 
result" from Andrzej Hajda from january the 14th doing the same change.


Heiko

> 
> diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 7bfe243..c35e5af 100644
> --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c
> @@ -461,7 +461,8 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi
> *dsi)
> 
>  static int dw_mipi_dsi_get_lane_bps(struct dw_mipi_dsi *dsi)
>  {
> - unsigned int bpp, i, pre;
> + int bpp;
> + unsigned int i, pre;
>   unsigned long mpclk, pllref, tmp;
>   unsigned int m = 1, n = 1, target_mbps = 1000;
>   unsigned int max_mbps = dptdin_map[ARRAY_SIZE(dptdin_map) - 
1].max_mbps;



[PATCH v12.1 07/17] drm: rockchip: dp: add rockchip platform dp driver

2016-01-21 Thread Heiko Stuebner
Hi Yakir,

Am Dienstag, 19. Januar 2016, 18:04:53 schrieb Yakir Yang:
> Rockchip have three clocks for dp controller, we leave pclk_edp
> to analogix_dp driver control, and keep the sclk_edp_24m and
> sclk_edp in platform driver.
> 
> Signed-off-by: Yakir Yang 
> Tested-by: Javier Martinez Canillas 
> ---

[...]

> +static int rockchip_dp_drm_create_encoder(struct rockchip_dp_device *dp)
> +{
> + struct drm_encoder *encoder = >encoder;
> + struct drm_device *drm_dev = dp->drm_dev;
> + struct device *dev = dp->dev;
> + int ret;
> +
> + encoder->possible_crtcs = drm_of_find_possible_crtcs(drm_dev,
> +  dev->of_node);
> + DRM_DEBUG_KMS("possible_crtcs = 0x%x\n", encoder->possible_crtcs);
> +
> + ret = drm_encoder_init(drm_dev, encoder, _dp_encoder_funcs,
> +DRM_MODE_ENCODER_TMDS);

should be
+  DRM_MODE_ENCODER_TMDS, NULL);

Exynos-side seems to be ok though.

With the adapted v12.1 patches it applies cleanly and display is working as 
well. So with the thing above fixed, you could resubmit a full v13, 
especially as you want to drop patch 16 as discussed there.


Heiko


[PATCH v4 0/3] drm_of_encoder_active_endpoint helpers

2016-01-30 Thread Heiko Stuebner
Hi Philipp,

Am Freitag, 29. Januar 2016, 10:58:57 schrieb Philipp Zabel:
> I'm just looking for feedback whether
> I should include the rockchip patch in the next imx-drm pull request.

I'm hoping that we'd get the analogix dp driver sorted for 4.6 as well, 
which having that change in the imx-tree would make quite difficult.

One possible solution may be to put patch1 into an immutable branch, that 
you can then merge into your imx-tree and Mark can merge into the Rockchip 
drm-tree?

> Changes since v3:
>  - Rebased onto v4.5-rc1,
>  - also update dw-mipi-dsi from rockchip_drm_encoder_get_mux_id() to
>drm_of_encoder_active_endpoint().
> 
> regards
> Philipp
> 
> Philipp Zabel (3):
>   drm: add drm_of_encoder_active_endpoint helpers
>   drm/imx: remove imx_drm_encoder_get_mux_id
>   drm/rockchip: remove rockchip_drm_encoder_get_mux_id
> 
>  drivers/gpu/drm/drm_of.c| 34
> + drivers/gpu/drm/imx/dw_hdmi-imx.c  
> |  2 +-
>  drivers/gpu/drm/imx/imx-drm-core.c  | 30
> - drivers/gpu/drm/imx/imx-drm.h   | 
> 2 --
>  drivers/gpu/drm/imx/imx-ldb.c   |  5 +++--
>  drivers/gpu/drm/rockchip/dw-mipi-dsi.c  |  2 +-
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30
> - drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 
> 2 --
>  include/drm/drm_of.h| 32
> +++ 10 files changed, 72 insertions(+), 69
> deletions(-)



[PATCH v1 3/5] ARM: dts: rockchip: add eDP/panel display device nodes for rk3288-evb

2016-07-08 Thread Heiko Stuebner
Am Dienstag, 28. Juni 2016, 12:51:18 schrieb Yakir Yang:
> The default eDP panel on RK3288 EVB board is LG LP079QX1-SP0V TFT LCD,
> we haven't declared the panel regulator in the 'panel-simple' device
> node here, so the specific board like ACT8846 / RK8080 need to support
> the panel power supply.
> 
> Signed-off-by: Yakir Yang 

applied, after reordering the entries to keep our alphabetical sorting.


Heiko


[PATCH v1 4/5] ARM: dts: rockchip: add the panel power supply for rk3288-evb board with act8846 pmu

2016-07-08 Thread Heiko Stuebner
Am Dienstag, 28. Juni 2016, 12:51:21 schrieb Yakir Yang:
> Panel regulator is controller by a normal GPIO, so we need to
> write a regulator-fixed node for it.
> 
> Signed-off-by: Yakir Yang 

applied, thanks.


Heiko


[PATCH v1 5/5] ARM: dts: rockchip: add the panel power supply for rk3288-evb board with rk808 pmu

2016-07-08 Thread Heiko Stuebner
Am Dienstag, 28. Juni 2016, 12:51:24 schrieb Yakir Yang:
> Panel regulator is controller by a normal GPIO, so we need to
> write a regulator-fixed node for it.
> 
> Signed-off-by: Yakir Yang 

applied after rewording the commit message a bit.
On the rk808-evb vcc_lcd comes from the rk808 directly and not through some 
gpio regulator :-) .


Heiko


[PATCH v8.1 1/2] drm/rockchip: hdmi: add Innosilicon HDMI support

2016-02-17 Thread Heiko Stuebner
Am Mittwoch, 3. Februar 2016, 17:44:57 schrieb Yakir Yang:
> The Innosilicon HDMI is a low power HDMI 1.4 transmitter
> IP, and it have been integrated on some rockchip CPUs
> (like RK3036, RK312x).
> 
> Signed-off-by: Yakir Yang 

On a Kylin board against 4.5-rc
Tested-by: Heiko Stuebner 

@Mark: While testing I noticed a black box around my cursor. It moves with 
the cursor, so seems to be the plane itself - the hdmi driver is of course 
innocent. May there exist an issue with plane transparency?


Heiko


[RFC PATCH v1 1/2] drm/rockchip: vop: add rk3229 vop support

2016-01-04 Thread Heiko Stuebner
Hi Yakir,

Am Montag, 4. Januar 2016, 19:53:58 schrieb Yakir Yang:
> RK3229 registers layout is simalar to RK3288 layout, only the
> interruput registers is different to RK3288.
> 
> RK3229 support two overlay plane and one hwc plane, max output
> resolution is 4K. it support IOMMU, and its IOMMU same as rk3288's.
> 
> Signed-off-by: Yakir Yang 
> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |   7 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.h |   2 +
>  drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 120
>  drivers/gpu/drm/rockchip/rockchip_vop_reg.h
> |  90 + 4 files changed, 217 insertions(+), 2
> deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index d83bf87..3c83097
> 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -63,9 +63,12 @@
>  #define VOP_INTR_SET_TYPE(vop, name, type, v) \
>   do { \
>   int i, reg = 0; \
> - for (i = 0; i < vop->data->intr->nintrs; i++) { \
> - if (vop->data->intr->intrs[i] & type) \
> + const struct vop_intr *intr = vop->data->intr; \
> + for (i = 0; i < intr->nintrs; i++) { \
> + if (intr->intrs[i] & type) { \
>   reg |= (v) << i; \
> + reg |= intr->write_mask ? (1 << (i + 16)) : 0; \
> + } \
>   } \
>   VOP_INTR_SET(vop, name, reg); \
>   } while (0)

I do believe this part, as well as setting the default .write_mask = false 
for the existing parts should get its own patch + a bit more explanation
on what this does and why it's needed.

 8< 
drm/rockchip: Add support for interrupt registers using write-masks

Some new display-controllers are need to set write-masks to enable writes
to interrupt registers. Allow this to be set on a per-vop basis.
 8< 

or something like that, and then patches 2+3 being the rk3229 support + 
binding.


> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h index 071ff0b..1e839e8
> 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h
> @@ -60,6 +60,7 @@ struct vop_ctrl {
>  };
> 
>  struct vop_intr {
> + bool write_mask;
>   const int *intrs;
>   uint32_t nintrs;
>   struct vop_reg enable;
> @@ -136,6 +137,7 @@ struct vop_data {
>  };
> 
>  /* interrupt define */
> +#define DUMMY_INTR   (0 << 0)
>  #define DSP_HOLD_VALID_INTR  (1 << 0)
>  #define FS_INTR  (1 << 1)
>  #define LINE_FLAG_INTR   (1 << 2)
> diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
> b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c index 3166b46..bbcd128
> 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c
> @@ -174,6 +174,7 @@ static const int rk3288_vop_intrs[] = {
>  };
> 
>  static const struct vop_intr rk3288_vop_intr = {
> + .write_mask = false,
>   .intrs = rk3288_vop_intrs,
>   .nintrs = ARRAY_SIZE(rk3288_vop_intrs),
>   .status = VOP_REG(RK3288_INTR_CTRL0, 0xf, 0),
> @@ -190,6 +191,122 @@ static const struct vop_data rk3288_vop = {
>   .win_size = ARRAY_SIZE(rk3288_vop_win_data),
>  };
> 
> +static const struct vop_scl_extension rk3229_win_full_scl_ext = {
> + .cbcr_vsd_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 31),
> + .cbcr_vsu_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 30),
> + .cbcr_hsd_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x3, 28),
> + .cbcr_ver_scl_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x3, 26),
> + .cbcr_hor_scl_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x3, 24),
> + .yrgb_vsd_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 23),
> + .yrgb_vsu_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 22),
> + .yrgb_hsd_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x3, 20),
> + .yrgb_ver_scl_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x3, 18),
> + .yrgb_hor_scl_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x3, 16),
> + .line_load_mode = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 15),
> + .cbcr_axi_gather_num = VOP_REG(RK3229_WIN0_CTRL1, 0x7, 12),
> + .yrgb_axi_gather_num = VOP_REG(RK3229_WIN0_CTRL1, 0xf, 8),
> + .vsd_cbcr_gt2 = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 7),
> + .vsd_cbcr_gt4 = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 6),
> + .vsd_yrgb_gt2 = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 5),
> + .vsd_yrgb_gt4 = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 4),
> + .bic_coe_sel = VOP_REG(RK3229_WIN0_CTRL1, 0x3, 2),
> + .cbcr_axi_gather_en = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 1),
> + .yrgb_axi_gather_en = VOP_REG(RK3229_WIN0_CTRL1, 0x1, 0),
> + .lb_mode = VOP_REG(RK3229_WIN0_CTRL0, 0x7, 5),
> +};
> +
> +static const struct vop_scl_regs rk3229_win_full_scl = {
> + .ext = _win_full_scl_ext,
> + .scale_yrgb_x = 

[PATCH v12 0/18] Add Analogix Core Display Port Driver

2016-01-13 Thread Heiko Stuebner
Hi Yakir,

Am Mittwoch, 23. Dezember 2015, 20:25:38 schrieb Yakir Yang:
>The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller
> share the same IP, so a lot of parts can be re-used. I split the common
> code into bridge directory, then rk3288 and exynos only need to keep
> some platform code. Cause I can't find the exact IP name of exynos dp
> controller, so I decide to name dp core driver with "analogix" which I
> find in rk3288 eDP TRM

could you rebase your patches on top of Dave's drm-next branch [0] please?
The exynos part got some const attributes for the *_func_ops structs and 
drm_encoder_init got an additional parameter.
I'm still hoping that we can get this finally committed once 4.5-rc1 is 
released in 1.5 weeks :-) .

I did try to merge things together [1], the system at least comes up and 
detects the panel (EDID is read correctly and it turns the backlight on) but 
I don't see any output on the display - hdmi works fine though and X11 is 
claiming everything to be fine in both cases.

So I don't know yet if I made a mistake when putting this together or there 
is an issue on the driver-side.


Thanks
Heiko


[0] http://cgit.freedesktop.org/~airlied/linux/log/?h=drm-next
[1] https://github.com/mmind/linux-rockchip/tree/tmp/analogixdp_v12-veyron
I left out patch16, per your talk with Jingoo and me not seeing any AUX CH 
errors without it.



[PATCH] drm/rockchip: Return -EBUSY if there's already a pending flip event v5

2016-05-24 Thread Heiko Stuebner
Hi Tomeu,

Patch subject: please put the version into the brackets, so [PATCH v5] as it 
shouldn't be part of the commit log.

Am Dienstag, 24. Mai 2016, 09:27:37 schrieb Tomeu Vizoso:
> As per the docs, atomic_commit should return -EBUSY "if an asycnhronous
> updated is requested and there is an earlier updated pending".

> v2: Use the status of the workqueue instead of vop->event, and don't add
> a superfluous wait on the workqueue.
> 
> v3: Drop work_busy, as there's a sizeable delay when the worker
> finishes, which introduces a race in which the client has already
> received the last flip event but the next page flip ioctl will still
> return -EBUSY because work_busy returns outdated information.
> 
> v4: Hold dev->event_lock while checking the VOP's event field as
> suggested by Daniel Stone.
> 
> v5: Only block if there's outstanding work if it's a blocking call.

similarly, please put the changelog below the "---" and above the diffstat.


> Signed-off-by: Tomeu Vizoso 
> ---

aka here.

>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h |  1 +
>  drivers/gpu/drm/rockchip/rockchip_drm_fb.c  | 25
> ++--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 
> 6 ++
>  3 files changed, 29 insertions(+), 3 deletions(-)

Heiko


[PATCH] drm/rockchip: Return -EBUSY if there's already a pending flip event v5

2016-05-24 Thread Heiko Stuebner
Am Dienstag, 24. Mai 2016, 10:37:49 schrieb Daniel Vetter:
> On Tue, May 24, 2016 at 10:30:50AM +0200, Daniel Vetter wrote:
> > On Tue, May 24, 2016 at 10:28:42AM +0200, Heiko Stuebner wrote:
> > > Hi Tomeu,
> > > 
> > > Patch subject: please put the version into the brackets, so [PATCH v5]
> > > as it shouldn't be part of the commit log.
> > > 
> > > Am Dienstag, 24. Mai 2016, 09:27:37 schrieb Tomeu Vizoso:
> > > > As per the docs, atomic_commit should return -EBUSY "if an
> > > > asycnhronous
> > > > updated is requested and there is an earlier updated pending".
> > > > 
> > > > v2: Use the status of the workqueue instead of vop->event, and don't
> > > > add
> > > > a superfluous wait on the workqueue.
> > > > 
> > > > v3: Drop work_busy, as there's a sizeable delay when the worker
> > > > finishes, which introduces a race in which the client has already
> > > > received the last flip event but the next page flip ioctl will still
> > > > return -EBUSY because work_busy returns outdated information.
> > > > 
> > > > v4: Hold dev->event_lock while checking the VOP's event field as
> > > > suggested by Daniel Stone.
> > > > 
> > > > v5: Only block if there's outstanding work if it's a blocking call.
> > > 
> > > similarly, please put the changelog below the "---" and above the
> > > diffstat.> 
> > drm culture is to keep it above, since it's kinda useful sometimes when
> > later on trying to reconstruct wtf was discussed and why a patch was
> > merged.
> 
> Maybe needs a bit more context: The only stuff you raised in your review
> is tiny style nits of pretty much utter irrelevance. No substantial and
> material feedback anywehere, and in my opinion in such a case either fix
> up the nits when applying (when you feel really strongly about perfect
> patches), or just merge as-is.
> 
> But sending out content-less bikesheds like these just adds noise and
> helps no-one. I think at least some spelling stuff is the minimal bar (but
> then just include your r-b tag), but personally I don't even care about
> that so much, as long as it's still legible.

ok, will keep that (both mails) in mind for future stuff.

Heiko


[PATCH v2 05/10] drm/rockchip: analogix_dp: add rk3399 eDP support

2016-05-24 Thread Heiko Stuebner
Am Dienstag, 24. Mai 2016, 14:57:23 schrieb Yakir Yang:
> RK3399 and RK3288 shared the same eDP IP controller, only some light
> difference with VOP configure and GRF configure.
> 
> Signed-off-by: Yakir Yang 
> ---
> Changes in v2:
> - rebase with drm-next, fix some conflicts
> 
>  .../bindings/display/bridge/analogix_dp.txt|  1 +
>  .../display/rockchip/analogix_dp-rockchip.txt  |  2 +-
>  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 36
> -- include/drm/bridge/analogix_dp.h  
> |  1 +
>  4 files changed, 37 insertions(+), 3 deletions(-)
> 
> diff --git
> a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt index
> 4f2ba8c..4a0f4f7 100644
> --- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> @@ -5,6 +5,7 @@ Required properties for dp-controller:
>   platform specific such as:
>* "samsung,exynos5-dp"
>* "rockchip,rk3288-dp"
> +  * "rockchip,rk3399-edp"

the cleanlines-freak in my likes to know if there is a difference between 
the rk3399 being called -edp here and -dp on the rk3288 :-)

[...]

> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index 29c4105..d5d4e04
> 100644
> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> @@ -148,6 +148,10 @@ rockchip_dp_drm_encoder_atomic_check(struct
> drm_encoder *encoder, struct drm_connector_state *conn_state)
>  {
>   struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
> + struct rockchip_dp_device *dp = to_dp(encoder);
> + int ret;
> +
> + s->output_type = DRM_MODE_CONNECTOR_eDP;
> 
>   /*
>* FIXME(Yakir): driver should configure the CRTC output video
> @@ -162,8 +166,27 @@ rockchip_dp_drm_encoder_atomic_check(struct
> drm_encoder *encoder, * But if I configure CTRC to RGBaaa, and eDP driver
> still keep * RGB666 input video mode, then screen would works prefect.
>*/
> - s->output_mode = ROCKCHIP_OUT_MODE_;
> - s->output_type = DRM_MODE_CONNECTOR_eDP;
> +
> + ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, encoder);
> + if (ret < 0)
> + return;

this needs a value returned (probably ret), otherwise you create a 
warning: ‘return’ with no value, in function returning non-void

drm_of_encoder_active_endpoint_id also always returns -EINVAL on rk3288-
veyron-jerry because encoder->crtc is unset in 
drm_of_encoder_active_endpoint and that breaks display output right now.

Looking through drm code it seems only two functions would set encoder->crtc
- drm_atomic_helper_update_legacy_modeset_state
- drm_crtc_helper_set_config

drm_crtc_helper_set_config callback got dropped in the atomic-conversion and 
the other sounds to be somewhat in the legacy area.

After that drm-internals get a bit confusing.


Heiko


[PATCH v2 05/10] drm/rockchip: analogix_dp: add rk3399 eDP support

2016-05-24 Thread Heiko Stuebner
Am Dienstag, 24. Mai 2016, 11:12:20 schrieb Doug Anderson:
> Hi,
> 
> On Tue, May 24, 2016 at 3:17 AM, Heiko Stuebner  wrote:
> >> --- a/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> >> +++ b/Documentation/devicetree/bindings/display/bridge/analogix_dp.txt
> >> 
> >> @@ -5,6 +5,7 @@ Required properties for dp-controller:
> >>   platform specific such as:
> >>* "samsung,exynos5-dp"
> >>* "rockchip,rk3288-dp"
> >> 
> >> +  * "rockchip,rk3399-edp"
> > 
> > the cleanlines-freak in my likes to know if there is a difference
> > between
> > the rk3399 being called -edp here and -dp on the rk3288 :-)
> > 
> > [...]
> 
> If I was a guessing man (which I'm not, but if I was), I'd guess that
> this is because on rk3288 there was only one DP port and it was an EDP
> port.  ...but since there was only one people just referred to it as
> the "DP" port and that was codified in the bindings.  On rk3399 there
> are two ports: one EDP and one DP.  All of a sudden we need to
> differentiate.
> 
> Any better suggestions for how to deal with that?

nope - everything as it should be in that regard then - the rk3288-dp is 
permanent now anyway.

But it looks like I'm sort of blind blind and only now have seen the 
separate DP controller chapter in the TRM (probably because I somehow didn't 
expect a second controller).


[PATCH v7 0/5] Add mipi dsi support for rk3288

2016-02-08 Thread Heiko Stuebner
Hi Archit,

Am Montag, 8. Februar 2016, 15:42:04 schrieb Archit Taneja:
> On 01/06/2016 09:33 AM, Chris Zhong wrote:
> > The rk3288 MIPI DSI is a Synopsys DesignWare MIPI DSI host controller
> > IP. This series adds support for a Synopsys DesignWare MIPI DSI host
> > controller DRM driver.
> > 
> > The MIPI DSI feature is tested on rk3288 evb board, backport them to
> > chrome os kernel chrome_v3.14, and it can display normally.
> > 
> > This patchset is base on the patchset from Ying.liu at freescale.com.
> > 
> > 
> > According to the suggestion from Thierry, I have get rid of the bridge,
> > and register the encoder & connecter in drm/rockchip/dw-mipi-dsi.c.
> 
> I've raised this question too late, but what was the reason to not
> implement the DSI block as a bridge driver?

There seems to always be some sort of contention about those being bridge 
drivers - I think I remember Thierry speaking up about that. But I don't 
remember if any different solution was suggested.

Also as we have seen with current shared IPs (dw-hdmi + analogix-dp) there 
are always implementation-specific parts and deciding which needs to land 
where is difficult without the secondary user present.

The first iterations where using a bridge-driver-base for it but I guess it 
was to much hassle without seeing another user on the horizon.


> The drm/hisilicon IP seems to use a very similar DSI Designware IP (the
> register offsets seems to be the same). There is a good potential of
> re-use here by different kms drivers here the way it's already done for
> DW HDMI and the analogix DP driver that's in review process.

I guess, the second user now gets to do the generalization ;-)


Heiko



[PATCH v8 0/2] Add Rockchip Inno-HDMI driver

2016-02-16 Thread Heiko Stuebner
Hi Mark,

Am Dienstag, 16. Februar 2016, 08:44:41 schrieb Mark yao:
> Ping, it seems inno hdmi driver is ready, So I'd like to merge it into
> drm/rockchip if there is no doubt these days.

I think you can just go ahead  with picking them up, I think they have 
ripened enough :-)


Heiko


[RFC PATCH v1 0/4] Add Rockchip RGA support

2016-03-22 Thread Heiko Stuebner
Hi Yakir,

Am Montag, 21. März 2016, 20:17:46 schrieb Yakir Yang:
> On 03/21/2016 07:29 PM, Heiko Stübner wrote:
> > Am Montag, 21. März 2016, 17:28:38 schrieb Yakir Yang:
> >> This patch set would add the RGA direct rendering based 2d graphics
> >> acceleration module.
> > 
> > very cool to see that.
> 
> ;)
> 
> >> This patch set is based on git repository below:
> >> git://people.freedesktop.org/~airlied/linux drm-next
> >> commit id: 568d7c764ae01f3706085ac8f0d8a8ac7e826bd7
> >> 
> >> And the RGA driver is based on Exynos G2D driver, it only manages the
> >> command lists received from user, so user should make the command list
> >> to data and registers needed by operation to use.
> >> 
> >> I have prepared an userspace demo application for testing:
> >>https://github.com/yakir-Yang/libdrm-rockchip
> >> 
> >> That is a rockchip libdrm library, and I have write a simple test case
> >> "rockchip_rga_test" that would test the below RGA features:
> >> - solid
> >> - copy
> >> - rotation
> >> - flip
> >> - window clip
> >> - dithering
> > 
> > Did you submit your libdrm changes as well?
> > 
> > Userspace-interfaces need to be stable so the other side must also get
> > accepted - even before the kernel change if I remember correctly.
> 
> Got it, and I just saw exynos_fimg2d already landed at mainline libdrm.
> But I don't find the way to submit patches to libdrm, would you like
> share some helps here ;)

Looking at the libdrm sources on cgit.freedesktop.org, I did not find any 
specific manual on submitting patches.

But looking at the dri-list archive, dri-devel at lists.freedesktop.org is the 
right list and looking at the libdrm history it looks like Emil Velikov 
 seems to be doing maintenance-stuff in libdrm.
And as a 3rd recipient, please also include the linux-rockchip list.

@Emil, please shout if I read that wrong :-)


Hope that helps
Heiko


[PATCH RFC v2 06/12] dt-bindings: Add documentation for rockchip lvds

2015-04-01 Thread Heiko Stuebner
From: Mark Yao <y...@rock-chips.com>

Add binding documentation for Rockchip SoC LVDS driver.

Signed-off-by: Mark Yao 
Signed-off-by: Heiko Stuebner 
---
 .../devicetree/bindings/video/rockchip-lvds.txt| 74 ++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-lvds.txt

diff --git a/Documentation/devicetree/bindings/video/rockchip-lvds.txt 
b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
new file mode 100644
index 000..80529f4
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
@@ -0,0 +1,74 @@
+Rockchip RK3288 LVDS interface
+
+
+Required properties:
+- compatible: "rockchip,rk3288-lvds";
+
+- reg: physical base address of the controller and length
+   of memory mapped region.
+- clocks: must include clock specifiers corresponding to entries in the
+   clock-names property.
+- clock-names: must contain "pclk_lvds"
+
+- avdd1v0-supply: regulator phandle for 1.0V analog power
+- avdd1v8-supply: regulator phandle for 1.8V analog power
+- avdd3v3-supply: regulator phandle for 3.3V analog power
+
+- rockchip,grf: phandle to the general register files syscon
+
+- rockchip,data-mapping: should be "vesa" or "jeida",
+   This describes how the color bits are laid out in the
+   serialized LVDS signal.
+- rockchip,data-width : should be <18> or <24>;
+- rockchip,output: should be "rgb", "lvds" or "duallvds",
+   This describes the output face.
+
+Required nodes:
+
+The lvds has two video ports as described by
+   Documentation/devicetree/bindings/media/video-interfaces.txt.
+Their connections are modeled using the OF graph bindings specified in
+   Documentation/devicetree/bindings/graph.txt.
+
+- video port 0 for the VOP inputs
+- video port 1 for either a panel or subsequent encoder
+
+Example:
+   lvds: lvds at ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   rockchip,grf = <>;
+   reg = <0xff96c000 0x4000>;
+   clocks = < PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
+   avdd3v3-supply = <_33>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in: port at 0 {
+   reg = <0>;
+
+   lvds_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <_out_lvds>;
+   };
+   lvds_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_out_lvds>;
+   };
+   };
+
+   lvds_out: port at 1 {
+   reg = <1>;
+
+   lvds_out_panel: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+   };
-- 
2.1.4



[PATCH RFC v2 04/12] drm/components: add generic vga encoder driver

2015-04-01 Thread Heiko Stuebner
This adds a driver for generic vga encoders like the Analog Devices adv7123
and similar ics. These chips do not have any special configuration options
except a powersafe gpio.

An exception is added for the rcar-du driver which also implements support
for the adv7123 internally but is not yet converted to the component framework.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/components/Kconfig   |   5 +
 drivers/gpu/drm/components/Makefile  |   2 +
 drivers/gpu/drm/components/vga-encoder.c | 315 +++
 3 files changed, 322 insertions(+)
 create mode 100644 drivers/gpu/drm/components/vga-encoder.c

diff --git a/drivers/gpu/drm/components/Kconfig 
b/drivers/gpu/drm/components/Kconfig
index 9d5d462..647cea6 100644
--- a/drivers/gpu/drm/components/Kconfig
+++ b/drivers/gpu/drm/components/Kconfig
@@ -1,4 +1,9 @@
 menu "Standalone components for use with the component framework"
  depends on DRM && DRM_KMS_HELPER

+config DRM_COMPONENTS_VGA_ENCODER
+   tristate "Generic vga encoder"
+   help
+ Support for generic vga encoder chips without any special controls.
+
 endmenu
diff --git a/drivers/gpu/drm/components/Makefile 
b/drivers/gpu/drm/components/Makefile
index be16eca..719b1c9 100644
--- a/drivers/gpu/drm/components/Makefile
+++ b/drivers/gpu/drm/components/Makefile
@@ -1 +1,3 @@
 ccflags-y := -Iinclude/drm
+
+obj-$(CONFIG_DRM_COMPONENTS_VGA_ENCODER) += vga-encoder.o
diff --git a/drivers/gpu/drm/components/vga-encoder.c 
b/drivers/gpu/drm/components/vga-encoder.c
new file mode 100644
index 000..f559b5e
--- /dev/null
+++ b/drivers/gpu/drm/components/vga-encoder.c
@@ -0,0 +1,315 @@
+/*
+ * Simple vga encoder driver
+ *
+ * Copyright (C) 2014 Heiko Stuebner 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define encoder_to_vga_encoder(x) container_of(x, struct vga_encoder, encoder)
+
+struct vga_encoder {
+   struct drm_encoder encoder;
+   struct device *dev;
+   struct regulator *vaa_reg;
+   struct gpio_desc *psave_gpio;
+
+   struct mutex enable_lock;
+   bool enabled;
+};
+
+static void vga_encoder_destroy(struct drm_encoder *encoder)
+{
+   drm_encoder_cleanup(encoder);
+}
+
+static const struct drm_encoder_funcs vga_encoder_funcs = {
+   .destroy = vga_encoder_destroy,
+};
+
+static void vga_encoder_dpms(struct drm_encoder *encoder, int mode)
+{
+   struct vga_encoder *vga = encoder_to_vga_encoder(encoder);
+
+   mutex_lock(>enable_lock);
+
+   switch (mode) {
+   case DRM_MODE_DPMS_ON:
+   if (vga->enabled)
+   goto out;
+
+   if (!IS_ERR(vga->vaa_reg))
+   regulator_enable(vga->vaa_reg);
+
+   if (vga->psave_gpio)
+   gpiod_set_value(vga->psave_gpio, 1);
+
+   vga->enabled = true;
+   break;
+   case DRM_MODE_DPMS_STANDBY:
+   case DRM_MODE_DPMS_SUSPEND:
+   case DRM_MODE_DPMS_OFF:
+   if (!vga->enabled)
+   goto out;
+
+   if (vga->psave_gpio)
+   gpiod_set_value(vga->psave_gpio, 0);
+
+   if (!IS_ERR(vga->vaa_reg))
+   regulator_enable(vga->vaa_reg);
+
+   vga->enabled = false;
+   break;
+   default:
+   break;
+   }
+
+out:
+   mutex_unlock(>enable_lock);
+}
+
+static bool vga_encoder_mode_fixup(struct drm_encoder *encoder,
+ const struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode)
+{
+   return true;
+}
+
+static void vga_encoder_prepare(struct drm_encoder *encoder)
+{
+}
+
+static void vga_encoder_mode_set(struct drm_encoder *encoder,
+   struct drm_display_mode *mode,
+   struct drm_display_mode *adjusted_mode)
+{
+}
+
+static void vga_encoder_commit(struct drm_encoder *encoder)
+{
+   vga_encoder_dpms(encoder, DRM_MODE_DPMS_ON);
+}
+
+static void vga_encoder_disable(struct drm_encoder *encoder)
+{
+   vga_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+}
+
+static const struct drm_encoder_helper_funcs vga_encoder_helper_funcs = {
+   .dpms = vga_encoder_dpms,
+   .mode_fixup = vga_encoder_mode_fixup,
+   .p

[PATCH RFC v2 03/12] drm: add components subdirectory and infrastructure

2015-04-01 Thread Heiko Stuebner
Until there are only the specialized bridge and i2c directories available
to hold generic support code like external components. But as there are
also things like external encoders that do not use i2c, those do not match
all cases.
Therefore introduce a new subdirectories to hold generic components like the
mentioned external encoders that can be used by component-based drm drivers.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/Kconfig | 2 ++
 drivers/gpu/drm/Makefile| 1 +
 drivers/gpu/drm/components/Kconfig  | 4 
 drivers/gpu/drm/components/Makefile | 1 +
 4 files changed, 8 insertions(+)
 create mode 100644 drivers/gpu/drm/components/Kconfig
 create mode 100644 drivers/gpu/drm/components/Makefile

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 151a050..2f454f4 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -81,6 +81,8 @@ source "drivers/gpu/drm/i2c/Kconfig"

 source "drivers/gpu/drm/bridge/Kconfig"

+source "drivers/gpu/drm/components/Kconfig"
+
 config DRM_TDFX
tristate "3dfx Banshee/Voodoo3+"
depends on DRM && PCI
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2c239b9..aa9ccaa 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -69,3 +69,4 @@ obj-$(CONFIG_DRM_IMX) += imx/
 obj-y  += i2c/
 obj-y  += panel/
 obj-y  += bridge/
+obj-y  += components/
diff --git a/drivers/gpu/drm/components/Kconfig 
b/drivers/gpu/drm/components/Kconfig
new file mode 100644
index 000..9d5d462
--- /dev/null
+++ b/drivers/gpu/drm/components/Kconfig
@@ -0,0 +1,4 @@
+menu "Standalone components for use with the component framework"
+ depends on DRM && DRM_KMS_HELPER
+
+endmenu
diff --git a/drivers/gpu/drm/components/Makefile 
b/drivers/gpu/drm/components/Makefile
new file mode 100644
index 000..be16eca
--- /dev/null
+++ b/drivers/gpu/drm/components/Makefile
@@ -0,0 +1 @@
+ccflags-y := -Iinclude/drm
-- 
2.1.4



[PATCH RFC v2 08/12] drm/rockchip: lvds: register a bridge when no panel is set

2015-04-01 Thread Heiko Stuebner
On socs using the lvds components it also controls the use of the
general rgb outputs and must thus be configured for things like
external encoders.

Therefore register a drm_bridge in this case and try to find
the encoder in the output port.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/rockchip/rockchip_lvds.c | 255 ---
 1 file changed, 233 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 657609e..5ffd70a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -43,6 +43,9 @@
 #define encoder_to_lvds(c) \
container_of(c, struct rockchip_lvds, encoder)

+#define bridge_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, bridge)
+
 /*
  * @grf_offset: offset inside the grf regmap for setting the rockchip lvds
  */
@@ -68,6 +71,8 @@ struct rockchip_lvds {
struct drm_panel *panel;
struct drm_connector connector;
struct drm_encoder encoder;
+   struct drm_bridge bridge;
+   struct drm_encoder *ext_encoder;

struct mutex suspend_lock;
int suspend;
@@ -248,11 +253,10 @@ rockchip_lvds_encoder_mode_fixup(struct drm_encoder 
*encoder,
return true;
 }

-static void rockchip_lvds_encoder_mode_set(struct drm_encoder *encoder,
- struct drm_display_mode *mode,
- struct drm_display_mode *adjusted)
+static void rockchip_lvds_mode_set(struct rockchip_lvds *lvds,
+  struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted)
 {
-   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u32 h_bp = mode->htotal - mode->hsync_start;
u8 pin_hsync = (mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
u8 pin_dclk = (mode->flags & DRM_MODE_FLAG_PCSYNC) ? 1 : 0;
@@ -347,32 +351,52 @@ static void rockchip_lvds_encoder_mode_set(struct 
drm_encoder *encoder,
dsb();
 }

-static void rockchip_lvds_encoder_prepare(struct drm_encoder *encoder)
+static void rockchip_lvds_encoder_mode_set(struct drm_encoder *encoder,
+  struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted)
+{
+   rockchip_lvds_mode_set(encoder_to_lvds(encoder), mode, adjusted);
+}
+
+static int rockchip_lvds_set_vop_source(struct rockchip_lvds *lvds,
+   struct drm_encoder *encoder)
 {
-   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u32 val;
int ret;

-   ret = rockchip_drm_crtc_mode_config(encoder->crtc,
-   lvds->connector.connector_type,
-   ROCKCHIP_OUT_MODE_P888);
-   if (ret < 0) {
-   dev_err(lvds->dev, "Could not set crtc mode config: %d\n", ret);
-   return;
-   }
-
ret = rockchip_drm_encoder_get_mux_id(lvds->dev->of_node, encoder);
if (ret < 0)
-   return;
+   return ret;

if (ret)
val = RK3288_LVDS_SOC_CON6_SEL_VOP_LIT |
  (RK3288_LVDS_SOC_CON6_SEL_VOP_LIT << 16);
else
val = RK3288_LVDS_SOC_CON6_SEL_VOP_LIT << 16;
+
ret = regmap_write(lvds->grf, lvds->soc_data->grf_soc_con6, val);
-   if (ret != 0) {
-   dev_err(lvds->dev, "Could not write to GRF: %d\n", ret);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+}
+
+static void rockchip_lvds_encoder_prepare(struct drm_encoder *encoder)
+{
+   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
+   int ret;
+
+   ret = rockchip_drm_crtc_mode_config(encoder->crtc,
+   lvds->connector.connector_type,
+   ROCKCHIP_OUT_MODE_P888);
+   if (ret < 0) {
+   dev_err(lvds->dev, "Could not set crtc mode config: %d\n", ret);
+   return;
+   }
+
+   ret = rockchip_lvds_set_vop_source(lvds, encoder);
+   if (ret < 0) {
+   dev_err(lvds->dev, "Could not set vop source: %d\n", ret);
return;
}
 }
@@ -405,6 +429,97 @@ static struct drm_encoder_funcs 
rockchip_lvds_encoder_funcs = {
.destroy = rockchip_lvds_encoder_destroy,
 };

+static void rockchip_lvds_bridge_mode_set(struct drm_bridge *bridge,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted)
+{
+   rockchip_lvds_mode_set(bridge_to_lvds(bridge), mode, adjusted);
+}
+
+static void rockchip_lvds_bridge

[PATCH RFC v2 07/12] drm/rockchip: Add support for Rockchip Soc LVDS

2015-04-01 Thread Heiko Stuebner
From: Mark Yao <y...@rock-chips.com>

This adds support for Rockchip soc lvds found on rk3288

Signed-off-by: Mark Yao 
Signed-off-by: Heiko Stuebner 
---
This still needs to address Laurent's comment about trying to get the
lvds settings from the panel/connected device instead of encoding them
as separate properties in the devicetree.

 drivers/gpu/drm/rockchip/Kconfig |   9 +
 drivers/gpu/drm/rockchip/Makefile|   1 +
 drivers/gpu/drm/rockchip/rockchip_lvds.c | 640 +++
 drivers/gpu/drm/rockchip/rockchip_lvds.h | 107 ++
 4 files changed, 757 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 35215f6..845f953 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -25,3 +25,12 @@ config ROCKCHIP_DW_HDMI
  for the Synopsys DesignWare HDMI driver. If you want to
  enable HDMI on RK3288 based SoC, you should selet this
  option.
+
+config ROCKCHIP_LVDS
+   tristate "Rockchip lvds support"
+   depends on DRM_ROCKCHIP
+   help
+ Choose this option to enable support for Rockchip LVDS controllers.
+ Rockchip rk3288 SoC has LVDS TX Controller can be used, and it
+ support lvds, rgb, dual lvds output mode. say Y to enable its
+ driver.
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index f3d8a19..8541304 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -6,5 +6,6 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o 
rockchip_drm_fbdev.o \
rockchip_drm_gem.o

 obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+obj-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o

 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
new file mode 100644
index 000..657609e
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -0,0 +1,640 @@
+/*
+ * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
+ * Author:
+ *  Mark Yao 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+#include "rockchip_lvds.h"
+
+#define DISPLAY_OUTPUT_RGB 0
+#define DISPLAY_OUTPUT_LVDS1
+#define DISPLAY_OUTPUT_DUAL_LVDS   2
+
+#define connector_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, connector)
+
+#define encoder_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, encoder)
+
+/*
+ * @grf_offset: offset inside the grf regmap for setting the rockchip lvds
+ */
+struct rockchip_lvds_soc_data {
+   int grf_soc_con6;
+   int grf_soc_con7;
+};
+
+struct rockchip_lvds {
+   void *base;
+   struct device *dev;
+   void __iomem *regs;
+   struct regmap *grf;
+   struct clk *pclk;
+   const struct rockchip_lvds_soc_data *soc_data;
+
+   struct regulator_bulk_data supplies[3];
+
+   int output;
+   int format;
+
+   struct drm_device *drm_dev;
+   struct drm_panel *panel;
+   struct drm_connector connector;
+   struct drm_encoder encoder;
+
+   struct mutex suspend_lock;
+   int suspend;
+};
+
+static inline void lvds_writel(struct rockchip_lvds *lvds, u32 offset, u32 val)
+{
+   writel_relaxed(val, lvds->regs + offset);
+   writel_relaxed(val, lvds->regs + offset + 0x100);
+}
+
+static inline int lvds_name_to_format(const char *s)
+{
+   if (!s)
+   return -EINVAL;
+
+   if (strncmp(s, "jeida", 6) == 0)
+   return LVDS_FORMAT_JEIDA;
+   else if (strncmp(s, "vesa", 6) == 0)
+   return LVDS_FORMAT_VESA;
+
+   return -EINVAL;
+}
+
+static inline int lvds_name_to_output(const char *s)
+{
+   if (!s)
+   return -EINVAL;
+
+   if (strncmp(s, "rgb", 3) == 0)
+   return DISPLAY_OUTPUT_RGB;
+   else if (strncmp(s, "lvds", 4) == 0)
+   return DISPLAY_OUTPUT_LVDS;
+   else if (strncmp(s, "duallvds", 8) == 0)
+   return DISPLAY_OUTPUT_DUAL_LVDS;
+
+   return -EINVAL

[PATCH RFC v2 01/12] drm/encoder: add functionality to register encoders to a global list

2015-04-01 Thread Heiko Stuebner
This allows standalone encoders to be registered and found again
through their devicetree node when going through their connection graph.

Setting the of_node property is of course still optional, as it is not
necessary in most cases to lookup encoders that are part of a bigger
component.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/drm_crtc.c | 41 +
 include/drm/drm_crtc.h |  8 
 2 files changed, 49 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index f6d04c7..b63e69d 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1066,6 +1066,47 @@ void drm_connector_unplug_all(struct drm_device *dev)
 }
 EXPORT_SYMBOL(drm_connector_unplug_all);

+static DEFINE_MUTEX(encoder_lock);
+static LIST_HEAD(encoder_list);
+
+int drm_encoder_add(struct drm_encoder *encoder)
+{
+   mutex_lock(_lock);
+   list_add_tail(>list, _list);
+   mutex_unlock(_lock);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_encoder_add);
+
+void drm_encoder_remove(struct drm_encoder *encoder)
+{
+   mutex_lock(_lock);
+   list_del_init(>list);
+   mutex_unlock(_lock);
+}
+EXPORT_SYMBOL(drm_encoder_remove);
+
+#ifdef CONFIG_OF
+struct drm_encoder *of_drm_find_encoder(struct device_node *np)
+{
+   struct drm_encoder *encoder;
+
+   mutex_lock(_lock);
+
+   list_for_each_entry(encoder, _list, list) {
+   if (encoder->of_node == np) {
+   mutex_unlock(_lock);
+   return encoder;
+   }
+   }
+
+   mutex_unlock(_lock);
+   return NULL;
+}
+EXPORT_SYMBOL(of_drm_find_encoder);
+#endif
+
 /**
  * drm_encoder_init - Init a preallocated encoder
  * @dev: drm device
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 920e21a..76994ba 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -569,6 +569,7 @@ struct drm_encoder_funcs {
 /**
  * struct drm_encoder - central DRM encoder structure
  * @dev: parent DRM device
+ * @of_node: device node pointer to the bridge
  * @head: list management
  * @base: base KMS object
  * @name: encoder name
@@ -585,6 +586,10 @@ struct drm_encoder_funcs {
  */
 struct drm_encoder {
struct drm_device *dev;
+#ifdef CONFIG_OF
+   struct device_node *of_node;
+#endif
+   struct list_head list;
struct list_head head;

struct drm_mode_object base;
@@ -1225,6 +1230,9 @@ extern void drm_bridge_remove(struct drm_bridge *bridge);
 extern struct drm_bridge *of_drm_find_bridge(struct device_node *np);
 extern int drm_bridge_attach(struct drm_device *dev, struct drm_bridge 
*bridge);

+extern int drm_encoder_add(struct drm_encoder *encoder);
+extern void drm_encoder_remove(struct drm_encoder *encoder);
+extern struct drm_encoder *of_drm_find_encoder(struct device_node *np);
 extern int drm_encoder_init(struct drm_device *dev,
struct drm_encoder *encoder,
const struct drm_encoder_funcs *funcs,
-- 
2.1.4



[PATCH RFC v2 05/12] drm/components: add generic vga connector driver

2015-04-01 Thread Heiko Stuebner
This adds a driver for generic vga connectors using a system i2c-bus for ddc.

An exception is included for rcar-du which implements the vga-connector
binding interally already and is not yet converted to the component framework.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/components/Kconfig |   6 +
 drivers/gpu/drm/components/Makefile|   1 +
 drivers/gpu/drm/components/vga-connector.c | 254 +
 3 files changed, 261 insertions(+)
 create mode 100644 drivers/gpu/drm/components/vga-connector.c

diff --git a/drivers/gpu/drm/components/Kconfig 
b/drivers/gpu/drm/components/Kconfig
index 647cea6..8424143 100644
--- a/drivers/gpu/drm/components/Kconfig
+++ b/drivers/gpu/drm/components/Kconfig
@@ -6,4 +6,10 @@ config DRM_COMPONENTS_VGA_ENCODER
help
  Support for generic vga encoder chips without any special controls.

+config DRM_COMPONENTS_VGA_CONNECTOR:
+   tristate "Generic vga connector"
+   help
+ Support for simple vga connectors using a system i2c bus
+ for ddc.
+
 endmenu
diff --git a/drivers/gpu/drm/components/Makefile 
b/drivers/gpu/drm/components/Makefile
index 719b1c9..2ff64da 100644
--- a/drivers/gpu/drm/components/Makefile
+++ b/drivers/gpu/drm/components/Makefile
@@ -1,3 +1,4 @@
 ccflags-y := -Iinclude/drm

 obj-$(CONFIG_DRM_COMPONENTS_VGA_ENCODER) += vga-encoder.o
+obj-$(CONFIG_DRM_COMPONENTS_VGA_CONNECTOR) += vga-connector.o
diff --git a/drivers/gpu/drm/components/vga-connector.c 
b/drivers/gpu/drm/components/vga-connector.c
new file mode 100644
index 000..400ceb7
--- /dev/null
+++ b/drivers/gpu/drm/components/vga-connector.c
@@ -0,0 +1,254 @@
+/*
+ * Simple vga encoder driver
+ *
+ * Copyright (C) 2014 Heiko Stuebner 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define connector_to_vga_connector(x) container_of(x, struct vga_connector, 
connector)
+
+struct vga_connector {
+   struct drm_connector connector;
+   struct device *dev;
+   struct i2c_adapter *ddc;
+   struct drm_encoder *encoder;
+};
+
+enum drm_connector_status vga_connector_detect(struct drm_connector *connector,
+   bool force)
+{
+   struct vga_connector *vga = connector_to_vga_connector(connector);
+
+   if (!vga->ddc)
+   return connector_status_unknown;
+
+   if (drm_probe_ddc(vga->ddc))
+   return connector_status_connected;
+
+   return connector_status_disconnected;
+}
+
+void vga_connector_connector_destroy(struct drm_connector *connector)
+{
+   drm_connector_unregister(connector);
+   drm_connector_cleanup(connector);
+}
+
+struct drm_connector_funcs vga_connector_connector_funcs = {
+   .dpms = drm_helper_connector_dpms,
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .detect = vga_connector_detect,
+   .destroy = vga_connector_connector_destroy,
+};
+
+/*
+ * Connector helper functions
+ */
+
+static int vga_connector_connector_get_modes(struct drm_connector *connector)
+{
+   struct vga_connector *vga = connector_to_vga_connector(connector);
+   struct edid *edid;
+   int ret = 0;
+
+   if (!vga->ddc)
+   return 0;
+
+   edid = drm_get_edid(connector, vga->ddc);
+   if (edid) {
+   drm_mode_connector_update_edid_property(connector, edid);
+   ret = drm_add_edid_modes(connector, edid);
+   kfree(edid);
+   }
+
+   return ret;
+}
+
+static int vga_connector_connector_mode_valid(struct drm_connector *connector,
+   struct drm_display_mode *mode)
+{
+   return MODE_OK;
+}
+
+static struct drm_encoder
+*vga_connector_connector_best_encoder(struct drm_connector *connector)
+{
+   struct vga_connector *vga = connector_to_vga_connector(connector);
+
+   return vga->encoder;
+}
+
+static struct drm_connector_helper_funcs vga_connector_connector_helper_funcs 
= {
+   .get_modes = vga_connector_connector_get_modes,
+   .best_encoder = vga_connector_connector_best_encoder,
+   .mode_valid = vga_connector_connector_mode_valid,
+};
+
+
+static int vga_connector_bind(struct device *dev, struct device *master,
+void *data)
+{
+   struct vga_connector *vga = dev_get_drvdata(dev);
+   struct drm_device *drm = data;
+   struct device_nod

[PATCH RFC v2 00/12] drm/rockchip: add support for lvds controller and external encoders

2015-04-01 Thread Heiko Stuebner
changes since v1:
- add separate components subdirectory
- implement the already existing bindings for adv7123 and vga-connector
  instead of defining a new one
- use component graph for subsequent lvds-panel or connected external
  encoders instead of defining special properties.


This series still adds support for the soc-level lvds encoder that also
controls the generic rgb output pins. Also generic components for "dumb"
vga encoders and connectors are added to a new subdirectory which implement
the already existing bindings for adv7123 and vga-connector.

While the major comment from Laurent Pinchart gets addressed with these
separate components, it still needs to address others like the lvds setting
in dt and how to handle the atomic mode setting conversion correctly.

But I'd still like to solicit opinions if the general concept looks sane
especially wrt. introducing the new components element and of_graph structure.

Tested on a firefly board using the vga connector.


Thanks
Heiko


Heiko Stuebner (10):
  drm/encoder: add functionality to register encoders to a global list
  drm/connector: add functionality to register connectors to a global
list
  drm: add components subdirectory and infrastructure
  drm/components: add generic vga encoder driver
  drm/components: add generic vga connector driver
  drm/rockchip: lvds: register a bridge when no panel is set
  drm/rockchip: enable rgb output of vops for all other connectors
  ARM: dts: rockchip: add rk3288 lcdc0 pinmux settings
  ARM: dts: rockchip: add rk3288 lvds node
  ARM: dts: rockchip: add vga encoder and enable lvds on rk3288-firefly

Mark Yao (2):
  dt-bindings: Add documentation for rockchip lvds
  drm/rockchip: Add support for Rockchip Soc LVDS

 .../devicetree/bindings/video/rockchip-lvds.txt|  74 ++
 arch/arm/boot/dts/rk3288-firefly.dtsi  |  68 ++
 arch/arm/boot/dts/rk3288.dtsi  |  51 ++
 drivers/gpu/drm/Kconfig|   2 +
 drivers/gpu/drm/Makefile   |   1 +
 drivers/gpu/drm/components/Kconfig |  15 +
 drivers/gpu/drm/components/Makefile|   4 +
 drivers/gpu/drm/components/vga-connector.c | 254 ++
 drivers/gpu/drm/components/vga-encoder.c   | 315 
 drivers/gpu/drm/drm_crtc.c |  82 ++
 drivers/gpu/drm/rockchip/Kconfig   |   9 +
 drivers/gpu/drm/rockchip/Makefile  |   1 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c|  10 +-
 drivers/gpu/drm/rockchip/rockchip_lvds.c   | 851 +
 drivers/gpu/drm/rockchip/rockchip_lvds.h   | 107 +++
 include/drm/drm_crtc.h |  15 +
 16 files changed, 1852 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-lvds.txt
 create mode 100644 drivers/gpu/drm/components/Kconfig
 create mode 100644 drivers/gpu/drm/components/Makefile
 create mode 100644 drivers/gpu/drm/components/vga-connector.c
 create mode 100644 drivers/gpu/drm/components/vga-encoder.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

-- 
2.1.4



[PATCH RFC v2 02/12] drm/connector: add functionality to register connectors to a global list

2015-04-01 Thread Heiko Stuebner
This allows standalone connectors to be registered and found again
through their devicetree node when going through their connection graph.

Setting the of_node property is of course still optional, as it is not
necessary in most cases to lookup connectors that are part of a bigger
component.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/drm_crtc.c | 41 +
 include/drm/drm_crtc.h |  7 +++
 2 files changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index b63e69d..8b49ea7 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -852,6 +852,47 @@ static void drm_connector_get_cmdline_mode(struct 
drm_connector *connector)
  mode->interlace ?  " interlaced" : "");
 }

+static DEFINE_MUTEX(connector_lock);
+static LIST_HEAD(connector_list);
+
+int drm_connector_add(struct drm_connector *connector)
+{
+   mutex_lock(_lock);
+   list_add_tail(>list, _list);
+   mutex_unlock(_lock);
+
+   return 0;
+}
+EXPORT_SYMBOL(drm_connector_add);
+
+void drm_connector_remove(struct drm_connector *connector)
+{
+   mutex_lock(_lock);
+   list_del_init(>list);
+   mutex_unlock(_lock);
+}
+EXPORT_SYMBOL(drm_connector_remove);
+
+#ifdef CONFIG_OF
+struct drm_connector *of_drm_find_connector(struct device_node *np)
+{
+   struct drm_connector *connector;
+
+   mutex_lock(_lock);
+
+   list_for_each_entry(connector, _list, list) {
+   if (connector->of_node == np) {
+   mutex_unlock(_lock);
+   return connector;
+   }
+   }
+
+   mutex_unlock(_lock);
+   return NULL;
+}
+EXPORT_SYMBOL(of_drm_find_connector);
+#endif
+
 /**
  * drm_connector_init - Init a preallocated connector
  * @dev: DRM device
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 76994ba..37b230b 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -671,6 +671,10 @@ struct drm_encoder {
  */
 struct drm_connector {
struct drm_device *dev;
+#ifdef CONFIG_OF
+   struct device_node *of_node;
+#endif
+   struct list_head list;
struct device *kdev;
struct device_attribute *attr;
struct list_head head;
@@ -1213,6 +1217,9 @@ static inline uint32_t drm_crtc_mask(struct drm_crtc 
*crtc)

 extern void drm_connector_ida_init(void);
 extern void drm_connector_ida_destroy(void);
+extern int drm_connector_add(struct drm_connector *connector);
+extern void drm_connector_remove(struct drm_connector *connector);
+extern struct drm_connector *of_drm_find_connector(struct device_node *np);
 extern int drm_connector_init(struct drm_device *dev,
  struct drm_connector *connector,
  const struct drm_connector_funcs *funcs,
-- 
2.1.4



[PATCH RFC v2 09/12] drm/rockchip: enable rgb output of vops for all other connectors

2015-04-01 Thread Heiko Stuebner
The socs itself contains encoders for a lot of different outputs. But every
unsupported connector will be routed through the lvds, as it controls the
pins in question.
Therefore enable the lvds output for all of those.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index c0387f7..3844b12 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -862,20 +862,16 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc,
clk_disable(vop->dclk);

switch (vop->connector_type) {
-   case DRM_MODE_CONNECTOR_LVDS:
-   VOP_CTRL_SET(vop, rgb_en, 1);
-   break;
case DRM_MODE_CONNECTOR_eDP:
VOP_CTRL_SET(vop, edp_en, 1);
break;
case DRM_MODE_CONNECTOR_HDMIA:
VOP_CTRL_SET(vop, hdmi_en, 1);
break;
+   case DRM_MODE_CONNECTOR_LVDS:
default:
-   DRM_ERROR("unsupport connector_type[%d]\n",
- vop->connector_type);
-   ret = -EINVAL;
-   goto out;
+   VOP_CTRL_SET(vop, rgb_en, 1);
+   break;
};
VOP_CTRL_SET(vop, out_mode, vop->connector_out_mode);

-- 
2.1.4



[PATCH RFC v2 11/12] ARM: dts: rockchip: add rk3288 lvds node

2015-04-01 Thread Heiko Stuebner
Add the basic node for the lvds controller of rk3288 and hook it into the
display-subsystem hirarchy.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288.dtsi | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index e7e94f8..97291bb 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -621,6 +621,11 @@
reg = <0>;
remote-endpoint = <_in_vopb>;
};
+
+   vopb_out_lvds: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_in_vopb>;
+   };
};
};

@@ -652,6 +657,11 @@
reg = <0>;
remote-endpoint = <_in_vopl>;
};
+
+   vopl_out_lvds: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_in_vopl>;
+   };
};
};

@@ -664,6 +674,38 @@
status = "disabled";
};

+   lvds: lvds at ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   reg = <0xff96c000 0x4000>;
+   clocks = < PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_ctl>;
+   rockchip,grf = <>;
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in: port at 0 {
+   reg = <0>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <_out_lvds>;
+   };
+   lvds_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_out_lvds>;
+   };
+   };
+   };
+   };
+
hdmi: hdmi at ff98 {
compatible = "rockchip,rk3288-dw-hdmi";
reg = <0xff98 0x2>;
-- 
2.1.4



[PATCH RFC v2 10/12] ARM: dts: rockchip: add rk3288 lcdc0 pinmux settings

2015-04-01 Thread Heiko Stuebner
Add pinctrl settings for the configurable lcdc0 signals dclk, den, hsync
and vsync. The lcdc0 data pin configuration is not software controlable.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 2c29a3e..e7e94f8 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -945,6 +945,15 @@
};
};

+   lcdc0 {
+   lcdc0_ctl: lcdc0-ctl {
+   rockchip,pins = <1 24 RK_FUNC_1 
_pull_none>,
+   <1 25 RK_FUNC_1 
_pull_none>,
+   <1 26 RK_FUNC_1 
_pull_none>,
+   <1 27 RK_FUNC_1 
_pull_none>;
+   };
+   };
+
sdmmc {
sdmmc_clk: sdmmc-clk {
rockchip,pins = <6 20 RK_FUNC_1 
_pull_none>;
-- 
2.1.4



[PATCH RFC v2 12/12] ARM: dts: rockchip: add vga encoder and enable lvds on rk3288-firefly

2015-04-01 Thread Heiko Stuebner
Add the sda7123 simple vga encoder, connect it to the vop outputs
and enable the lvds controller with the correct settings.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288-firefly.dtsi | 68 +++
 1 file changed, 68 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi 
b/arch/arm/boot/dts/rk3288-firefly.dtsi
index b54dd78..2cce2a9 100644
--- a/arch/arm/boot/dts/rk3288-firefly.dtsi
+++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
@@ -159,6 +159,51 @@
regulator-always-on;
vin-supply = <_5v>;
};
+
+   sda7123: vga-encoder {
+   compatible = "adi,adv7123";
+   psave-gpios = < 17 GPIO_ACTIVE_HIGH>;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port at 0 {
+   reg = <0>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   sda7123_in: endpoint at 0 {
+   remote-endpoint = <_out>;
+   };
+   };
+
+   port at 1 {
+   reg = <1>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   sda7123_out: endpoint at 0 {
+   remote-endpoint = <_connector_in>;
+   };
+   };
+   };
+   };
+
+   vga: vga-connector {
+   compatible = "vga-connector";
+   label = "vga";
+
+   ddc-i2c-bus = <>;
+
+   port {
+   vga_connector_in: endpoint {
+   remote-endpoint = <_out>;
+   };
+   };
+   };
 };

  {
@@ -347,6 +392,29 @@
status = "okay";
 };

+ {
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
+   avdd3v3-supply = <_33>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+   status = "okay";
+
+   ports {
+   port at 1 {
+   reg = <1>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   lvds_out: endpoint at 0 {
+   remote-endpoint = <_in>;
+   };
+   };
+   };
+};
+
  {
pcfg_output_high: pcfg-output-high {
output-high;
-- 
2.1.4



[PATCH v3 3/3] drm/rockchip: remove rockchip_drm_encoder_get_mux_id

2015-08-27 Thread Heiko Stuebner
Hi Philipp,

Am Donnerstag, 27. August 2015, 12:56:07 schrieb Philipp Zabel:
> It is replaced by drm_of_encoder_active_endpoint_id.
> 
> Suggested-by: Daniel Kurtz 
> Reviewed-by: Daniel Kurtz 
> Signed-off-by: Philipp Zabel 

the person working the most on the rockchip dw_hdmi currently is probably 
Yakir Yang (included now).

But even to me with my general Rockchip work area outside the drm this looks 
good, as there isn't any functional change present in the moved function, so

Reviewed-by: Heiko Stuebner 


Heiko

> ---
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |  2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 30
> - drivers/gpu/drm/rockchip/rockchip_drm_drv.h |
>  2 --
>  3 files changed, 1 insertion(+), 33 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..042eb95 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> @@ -201,7 +201,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct
> drm_encoder *encoder) u32 val;
>   int mux;
> 
> - mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
> + mux = drm_of_encoder_active_endpoint_id(hdmi->dev->of_node, encoder);
>   if (mux)
>   val = HDMI_SEL_VOP_LIT | (HDMI_SEL_VOP_LIT << 16);
>   else
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 9a0c291..12094d0 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -379,36 +379,6 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = {
>   rockchip_drm_sys_resume)
>  };
> 
> -/*
> - * @node: device tree node containing encoder input ports
> - * @encoder: drm_encoder
> - */
> -int rockchip_drm_encoder_get_mux_id(struct device_node *node,
> - struct drm_encoder *encoder)
> -{
> - struct device_node *ep;
> - struct drm_crtc *crtc = encoder->crtc;
> - struct of_endpoint endpoint;
> - struct device_node *port;
> - int ret;
> -
> - if (!node || !crtc)
> - return -EINVAL;
> -
> - for_each_endpoint_of_node(node, ep) {
> - port = of_graph_get_remote_port(ep);
> - of_node_put(port);
> - if (port == crtc->port) {
> - ret = of_graph_parse_endpoint(ep, );
> - of_node_put(ep);
> - return ret ?: endpoint.id;
> - }
> - }
> -
> - return -EINVAL;
> -}
> -EXPORT_SYMBOL_GPL(rockchip_drm_encoder_get_mux_id);
> -
>  static int compare_of(struct device *dev, void *data)
>  {
>   struct device_node *np = data;
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..20d6ac1 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> @@ -56,8 +56,6 @@ int rockchip_register_crtc_funcs(struct drm_device *dev,
>const struct rockchip_crtc_funcs *crtc_funcs,
>int pipe);
>  void rockchip_unregister_crtc_funcs(struct drm_device *dev, int pipe);
> -int rockchip_drm_encoder_get_mux_id(struct device_node *node,
> - struct drm_encoder *encoder);
>  int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int
> connector_type, int out_mode);
>  int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,



[PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp

2015-08-24 Thread Heiko Stuebner
Hi Yakir,

Am Montag, 24. August 2015, 20:48:01 schrieb Yakir Yang:
> 在 08/24/2015 12:20 PM, Krzysztof Kozlowski 写道:
> > On 24.08.2015 11:42, Yakir Yang wrote:
> >> Hi Krzysztof,
> >> 
> >> 在 08/23/2015 07:43 PM, Krzysztof Kozlowski 写道:
> >>> 2015-08-24 8:23 GMT+09:00 Rob Herring :
>  On Wed, Aug 19, 2015 at 9:50 AM, Yakir Yang  
>  wrote:
> > Analogix dp driver is split from exynos dp driver, so we just
> > make an copy of exynos_dp.txt, and then simplify exynos_dp.txt
> > 
> > Beside update some exynos dtsi file with the latest change
> > according to the devicetree binding documents.
>  
>  You can't just change the exynos bindings and break compatibility. Is
>  there some agreement with exynos folks to do this?
> >>> 
> >>> No, there is no agreement. This wasn't even sent to Exynos maintainers.
> >> 
> >> Sorry about this one, actually I have add Exynos maintainers in version
> >> 1 & version 2,
> >> but lose some maintainers in version 3, I would fix it in bellow
> >> versions.
> >> 
> >>> Additionally the patchset did not look interesting to me because of
> >>> misleading subject - Documentation instead of "ARM: dts:".
> >>> 
> >>> Yakir, please:
> >>> 1. Provide backward compatibility. Mark old properties as deprecated
> >>> but still support them.
> >> 
> >> Do you mean that I should keep the old properties declare in
> >> exynos-dp.txt,
> >> but just mark them as deprecated flag.
> > 
> > That is one of ways how to do this. However more important is that
> > driver should still support old bindings so such code:
> > -   if (of_property_read_u32(dp_node, "samsung,color-space",
> > +   if (of_property_read_u32(dp_node, "analogix,color-space",
> > 
> > is probably wrong. Will the driver support old DTB in the same way as it
> > was supporting before the change?
> 
> Okay, I got your means. So document is not the focus, the most important
> is that
> driver should support the old dts prop. If so the new analogix dp driver
> should keep
> the "samsung,color-space", rather then just mark it with [DEPRECATED] flag.
> 
> But from your follow suggest, I think you agree to update driver code,
> and just mark
> old prop with deprecated flag. If so I think such code would not be wrong
> 
> -   if (of_property_read_u32(dp_node, "samsung,color-space",
> +  if (of_property_read_u32(dp_node, "analogix,color-space",

In a generic driver, the property should have either none, or the analogix 
prefix. But DT-properties need to be backwards compatible, meaning an older 
Exynos devicetree should run unmodified with a newer kernel.

So the common course of action is to mark the old one as deprecated but still 
test for both, so something like:

   if (of_property_read_u32(dp_node, "analogix,color-space",
 _video_config->color_space))
   if (of_property_read_u32(dp_node, "samsung,color-space",
 _video_config->color_space)) {

dev_err(dev, "failed to get color-space\n");
return ERR_PTR(-EINVAL);
}






[PATCH v3 06/14] Documentation: drm/bridge: add document for analogix_dp

2015-08-24 Thread Heiko Stuebner
Am Montag, 24. August 2015, 09:48:27 schrieb Rob Herring:
> On Mon, Aug 24, 2015 at 7:57 AM, Russell King - ARM Linux
> > When we adopted the graph bindings for iMX DRM, I thought exactly at that
> > time "it would be nice if this could become the standard for binding DRM
> > components together" but I don't have the authority from either the DT
> > perspective or the DRM perspective to mandate that.  Neither does anyone
> > else.  That's the _real_ problem here.
> > 
> > I've seen several DRM bindings go by which don't use the of-graph stuff,
> > which means that they'll never be compatible with generic components
> > which do use the of-graph stuff.
> 
> It goes beyond bindings IMO. The use of the component framework or not
> has been at the whim of driver writers as well. It is either used or
> private APIs are created. I'm using components and my need for it
> boils down to passing the struct drm_device pointer to the encoder.
> Other components like panels and bridges have different ways to attach
> to the DRM driver.

but that is then simply implementation specific. Panels and bridges can very 
well be part of and created from an of_graph description without needing to be 
a (linux-)component - see patch 7.


[PATCH v7 11/17] Documentation: phy: add document for rockchip dp phy

2015-10-28 Thread Heiko Stuebner
Am Samstag, 24. Oktober 2015, 11:06:37 schrieb Yakir Yang:
> Add dt binding documentation for rockchip display port PHY.
> 
> Tested-by: Javier Martinez Canillas 
> Signed-off-by: Yakir Yang 
> ---
> Changes in v7: None
> Changes in v6: None
> Changes in v5:
> - Split binding doc's from driver changes. (Rob)
> - Update the rockchip,grf explain in document, and correct the clock required
>   elemets in document. (Rob & Heiko)
> 
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  .../devicetree/bindings/phy/rockchip-dp-phy.txt| 22 
> ++
>  1 file changed, 22 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt 
> b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
> new file mode 100644
> index 000..505194e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
> @@ -0,0 +1,22 @@
> +Rockchip Soc Seroes Display Port PHY
> +
> +
> +Required properties:
> +- compatible : should be one of the following supported values:
> +  - "rockchip.rk3288-dp-phy"
> +- clocks: from common clock binding: handle to dp clock.
> + of memory mapped region.
> +- clock-names: from common clock binding:
> + Required elements: "24m"
> +- rockchip,grf: phandle to the syscon managing the "general register files"
> +- #phy-cells : from the generic PHY bindings, must be 0;
> +
> +Example:
> +
> +edp_phy: edp-phy at ff770274 {

one small thing, I found while playing more ... the node should not have
an address, as it also does not have register property. So just name it
edp_phy: edp-phy {
...
};

There is only one anyway on the rk3288.

With that change the Reviewed-by still applies :-)

> + compatible = "rockchip,rk3288-dp-phy";
> + rockchip,grf = <>;
> + clocks = < SCLK_EDP_24M>;
> + clock-names = "24m";
> + #phy-cells = <0>;
> +};
> 



[PATCH v7 09/17] Documentation: drm/bridge: add document for analogix_dp

2015-10-27 Thread Heiko Stuebner
Patch subject should probably be something like:

dt-bindings: add document for rockchip variant of analogix_dp

or similar, but definitly should mention that it's the Rockchip variant.


Am Samstag, 24. Oktober 2015, 11:06:03 schrieb Yakir Yang:
> Rockchip DP driver is a helper driver of analogix_dp coder driver,
> so most of the DT property should be descriped in analogix_dp document.
> 
> Tested-by: Javier Martinez Canillas 
> Signed-off-by: Yakir Yang 

everything else looks nice, so with a better subject

Reviewed-by: Heiko Stuebner 


[PATCH v7 10/17] phy: Add driver for rockchip Display Port PHY

2015-10-27 Thread Heiko Stuebner
Am Samstag, 24. Oktober 2015, 11:06:04 schrieb Yakir Yang:
> Add phy driver for the Rockchip DisplayPort PHY module. This
> is required to get DisplayPort working in Rockchip SoCs.
> 
> Tested-by: Javier Martinez Canillas 
> Signed-off-by: Yakir Yang 
> ---

> diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c
> new file mode 100644
> index 000..4af19af
> --- /dev/null
> +++ b/drivers/phy/phy-rockchip-dp.c
> @@ -0,0 +1,153 @@
> +/*
> + * Rockchip DP PHY driver
> + *
> + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd.
> + * Author: Yakir Yang <ykk@@rock-chips.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define GRF_SOC_CON12   0x0274
> +#define GRF_EDP_REF_CLK_SEL_INTERBIT(4)
> +#define GRF_EDP_PHY_SIDDQ_WRITE_EN  BIT(21)
> +#define GRF_EDP_PHY_SIDDQ_ON0
> +#define GRF_EDP_PHY_SIDDQ_OFF   BIT(5)

mixed spacers (tabs and spaces), please use either tabs if you want to
align stuff or a single space.

Also you're mixing the handling here, for SIDDQ you're defining both the
actual bit as well as the write-enable bit, but for CLK_SEL_INTR you're
hard-coding the 16-bit shift down in the code.

You could also just use/copy the HIWORD_MASK macro we use for example
in the clock controller.


> +
> +struct rockchip_dp_phy {
> + struct device  *dev;
> + struct regmap  *grf;
> + struct clk *phy_24m;
> +};
> +
> +static int rockchip_set_phy_state(struct phy *phy, bool enable)
> +{
> + struct rockchip_dp_phy *dp = phy_get_drvdata(phy);
> + int ret;
> +
> + if (enable) {
> + ret = regmap_write(dp->grf, GRF_SOC_CON12,
> +GRF_EDP_PHY_SIDDQ_WRITE_EN |
> +GRF_EDP_PHY_SIDDQ_ON);
> + if (ret < 0) {
> + dev_err(dp->dev, "Can't enable PHY power %d\n", ret);
> +     return ret;
> + }
> +
> + ret = clk_prepare_enable(dp->phy_24m);
> +

unnecessary empty line after clk_prepare_enable


with these things fixed,
Reviewed-by: Heiko Stuebner 


Cheers,
Heiko


[PATCH v7 11/17] Documentation: phy: add document for rockchip dp phy

2015-10-27 Thread Heiko Stuebner
Am Samstag, 24. Oktober 2015, 11:06:37 schrieb Yakir Yang:
> Add dt binding documentation for rockchip display port PHY.
> 
> Tested-by: Javier Martinez Canillas 
> Signed-off-by: Yakir Yang 
> ---

phy binding looks nice and easy
Reviewed-by: Heiko Stuebner 




[PATCH v7 06/17] Documentation: drm/bridge: add document for analogix_dp

2015-10-27 Thread Heiko Stuebner
Hi Yakir,

Am Samstag, 24. Oktober 2015, 11:06:00 schrieb Yakir Yang:
> Analogix dp driver is split from exynos dp driver, so we just
> make an copy of exynos_dp.txt, and then simplify exynos_dp.txt
> 
> Beside update some exynos dtsi file with the latest change
> according to the devicetree binding documents.
> 
> Tested-by: Javier Martinez Canillas 
> Signed-off-by: Yakir Yang 
> ---
> diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt 
> b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> index 7a3a9cd..9e47357 100644
> --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> @@ -31,45 +31,31 @@ Required properties for dp-controller:
>   from general PHY binding: the phandle for the PHY device.
>   -phy-names:
>   from general PHY binding: Should be "dp".
> - -samsung,color-space:
> - input video data format.
> - COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2
> - -samsung,dynamic-range:
> - dynamic range for input video data.
> - VESA = 0, CEA = 1
> - -samsung,ycbcr-coeff:
> - YCbCr co-efficients for input video.
> - COLOR_YCBCR601 = 0, COLOR_YCBCR709 = 1
> - -samsung,color-depth:
> - number of bits per colour component.
> - COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3
> - -samsung,link-rate:
> - link rate supported by the panel.
> - LINK_RATE_1_62GBPS = 0x6, LINK_RATE_2_70GBPS = 0x0A
> - -samsung,lane-count:
> - number of lanes supported by the panel.
> - LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
> +
> +Optional properties for dp-controller:
>   - display-timings: timings for the connected panel as described by
>   Documentation/devicetree/bindings/video/display-timing.txt

^^

bindings/display/display-timing.txt ... that actually made the patch not apply 
cleanly


[...]

> -[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
> +Deprecated properties for DisplayPort:
> +-interlaced:deprecated prop that can parsed frm drm_display_mode.
> +-vsync-active-high: deprecated prop that can parsed frm drm_display_mode.
> +-hsync-active-high: deprecated prop that can parsed frm drm_display_mode.
> +-samsung,ycbcr-coeff:   deprecated prop that can parsed frm drm_display_mode.
> +-samsung,dynamic-range: deprecated prop that can parsed frm drm_display_mode.

the "frm" above need some more "o"s to be "from"s :-)

> +-samsung,color-space:   deprecated prop that can parsed from 
> drm_display_info.
> +-samsung,color-depth:   deprecated prop that can parsed from 
> drm_display_info.
> +-samsung,link-rate: deprecated prop that can reading from monitor by 
> dpcd method.
> +-samsung,lane-count:deprecated prop that can reading from monitor by 
> dpcd method.
> +-samsung,hpd-gpio:  deprecated name for hpd-gpios.
> +
> +---


Cheers,
Heiko


[PATCH v8 06/17] dt-bindings: add document for analogix display port driver

2015-10-28 Thread Heiko Stuebner
Hi Yakir,

Am Mittwoch, 28. Oktober 2015, 16:26:33 schrieb Yakir Yang:
> diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt 
> b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> index 7a3a9cd..9905081 100644
> --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> @@ -31,45 +31,31 @@ Required properties for dp-controller:
>   from general PHY binding: the phandle for the PHY device.
>   -phy-names:
>   from general PHY binding: Should be "dp".
> - -samsung,color-space:
> - input video data format.
> - COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2
> - -samsung,dynamic-range:
> - dynamic range for input video data.
> - VESA = 0, CEA = 1
> - -samsung,ycbcr-coeff:
> - YCbCr co-efficients for input video.
> - COLOR_YCBCR601 = 0, COLOR_YCBCR709 = 1
> - -samsung,color-depth:
> - number of bits per colour component.
> - COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3
> - -samsung,link-rate:
> - link rate supported by the panel.
> - LINK_RATE_1_62GBPS = 0x6, LINK_RATE_2_70GBPS = 0x0A
> - -samsung,lane-count:
> - number of lanes supported by the panel.
> - LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
> - - display-timings: timings for the connected panel as described by
> - Documentation/devicetree/bindings/video/display-timing.txt

^^ display/display-timings.txt
otherwise this patch does not apply.



[PATCH v8 10/17] phy: Add driver for rockchip Display Port PHY

2015-10-28 Thread Heiko Stuebner
Hi Yakir,

Am Mittwoch, 28. Oktober 2015, 16:30:33 schrieb Yakir Yang:
> +static int rockchip_dp_phy_probe(struct platform_device *pdev)
> +{
> + struct device *dev = >dev;
> + struct device_node *np = dev->of_node;
> + struct phy_provider *phy_provider;
> + struct rockchip_dp_phy *dp;
> + struct resource *res;

drivers/phy/phy-rockchip-dp.c: In function 'rockchip_dp_phy_probe':
drivers/phy/phy-rockchip-dp.c:86:19: warning: unused variable 'res' 
[-Wunused-variable]

> + struct phy *phy;
> + int ret;
> +
> + if (!np)
> + return -ENODEV;
> +
> + dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
> + if (IS_ERR(dp))
> + return -ENOMEM;
> +
> + dp->dev = dev;
> +
> + dp->phy_24m = devm_clk_get(dev, "24m");
> + if (IS_ERR(dp->phy_24m)) {
> + dev_err(dev, "cannot get clock 24m\n");
> + return PTR_ERR(dp->phy_24m);
> + }
> +
> + ret = clk_set_rate(dp->phy_24m, 2400);
> + if (ret < 0) {
> + dev_err(dp->dev, "cannot set clock phy_24m %d\n", ret);
> + return ret;
> + }
> +



[PATCH v8 06/17] dt-bindings: add document for analogix display port driver

2015-10-29 Thread Heiko Stuebner
Am Donnerstag, 29. Oktober 2015, 09:12:21 schrieb Yakir Yang:
> Hi Heiko,
> 
> On 10/29/2015 04:02 AM, Heiko Stuebner wrote:
> > Hi Yakir,
> >
> > Am Mittwoch, 28. Oktober 2015, 16:26:33 schrieb Yakir Yang:
> >> diff --git 
> >> a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt 
> >> b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> >> index 7a3a9cd..9905081 100644
> >> --- a/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> >> +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dp.txt
> >> @@ -31,45 +31,31 @@ Required properties for dp-controller:
> >>from general PHY binding: the phandle for the PHY device.
> >>-phy-names:
> >>from general PHY binding: Should be "dp".
> >> -  -samsung,color-space:
> >> -  input video data format.
> >> -  COLOR_RGB = 0, COLOR_YCBCR422 = 1, COLOR_YCBCR444 = 2
> >> -  -samsung,dynamic-range:
> >> -  dynamic range for input video data.
> >> -  VESA = 0, CEA = 1
> >> -  -samsung,ycbcr-coeff:
> >> -  YCbCr co-efficients for input video.
> >> -  COLOR_YCBCR601 = 0, COLOR_YCBCR709 = 1
> >> -  -samsung,color-depth:
> >> -  number of bits per colour component.
> >> -  COLOR_6 = 0, COLOR_8 = 1, COLOR_10 = 2, COLOR_12 = 3
> >> -  -samsung,link-rate:
> >> -  link rate supported by the panel.
> >> -  LINK_RATE_1_62GBPS = 0x6, LINK_RATE_2_70GBPS = 0x0A
> >> -  -samsung,lane-count:
> >> -  number of lanes supported by the panel.
> >> -  LANE_COUNT1 = 1, LANE_COUNT2 = 2, LANE_COUNT4 = 4
> >> -  - display-timings: timings for the connected panel as described by
> >> -  Documentation/devicetree/bindings/video/display-timing.txt
> > 
> > ^^ display/display-timings.txt
> > otherwise this patch does not apply.
> 
> I thought I have deleted this old path of "display-timing.txt", and 
> changed it to
> 
> - Documentation/devicetree/bindings/video/display-timing.txt

in the changes I got from Rob Hering's dt-branch [0] the path in the file
is already display/display-timing.txt so applying a change with video/...
in it fails. Anyway, as this will probably only make it in after the merge-
window, we can see how this ends up before anyway :-) .

> 
> + 
> Documentation/devicetree/bindings/display/panel/display-timing.txt
> 
> And the real path of "display-timing.txt" in linux-next [tag 20151022] 
> do under
> the "display/panel/", those change should be right.


Heiko

[0] 
https://git.kernel.org/cgit/linux/kernel/git/robh/linux.git/commit/?h=dt/next=efdbd7345f8836f7495f3ac6ee237d86cb3bb6b0



[PATCH v8 0/17] Add Analogix Core Display Port Driver

2015-10-29 Thread Heiko Stuebner
Am Mittwoch, 28. Oktober 2015, 16:15:43 schrieb Yakir Yang:
> Hi all,
> 
>The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller
> share the same IP, so a lot of parts can be re-used. I split the common
> code into bridge directory, then rk3288 and exynos only need to keep
> some platform code. Cause I can't find the exact IP name of exynos dp
> controller, so I decide to name dp core driver with "analogix" which I
> find in rk3288 eDP TRM
> 
> But  there are still three light registers setting differents bewteen
> exynos and rk3288.
> 1. RK3288 have five special pll resigters which not indicata in exynos
>dp controller.
> 2. The address of DP_PHY_PD(dp phy power manager register) are different
>between rk3288 and exynos.
> 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug
>register).
> 
> This series have been well tested on Rockchip platform with eDP panel on
> Jerry Chromebook and Display Port Monitor on RK3288 board. Also I have
> tested on Samsung Snow and Peach Pit Chromebooks, and thanks to Javier at 
> Samsung
> help to retest the whole series on Samsung Exynos5800 Peach Pi Chromebook,
> glad to say that things works rightlly.

Patch 15/17 looks like it didn't make it? I haven't found it in neither my
inbox nor in the linux-rockchip list archive? So I've used the v7 version
for my tests.

This series on a rk3288-veyron-pinky and rk3288-veyron-jerry
Tested-by: Heiko Stuebner 


[PATCH v4 08/16] drm: rockchip/dp: add rockchip platform dp driver

2015-09-01 Thread Heiko Stuebner
Am Dienstag, 1. September 2015, 14:01:28 schrieb Yakir Yang:
> Rockchip have three clocks for dp controller, we leave pclk_edp
> to analogix_dp driver control, and keep the sclk_edp_24m and
> sclk_edp in platform driver.
> 
> Signed-off-by: Yakir Yang 
> ---
> Changes in v4:
> - Remove some deprecated DT properties in rockchip dp document.
> 
> Changes in v3:
> - Take Thierry Reding and Heiko suggest, leave "sclk_edp_24m" to rockchip
>   dp phy driver which name to "24m", and leave "sclk_edp" to analogix dp
>   core driver which name to "dp", and leave "pclk_edp" to rockchip dp
> platform driver which name to "pclk".
> - Take Heiko suggest, add devicetree binding document.
> - Take Heiko suggest, remove "rockchip,panel" DT property, take use of
> remote point to get panel node.
> - Add the new function point analogix_dp_platdata.get_modes init.
> 
> Changes in v2:
> - Take Heiko suggest, get panel node with remote-endpoint method,
>   and create devicetree binding for driver.
> - Remove the clock enable/disbale with "sclk_edp" & "sclk_edp_24m",
>   leave those clock to rockchip dp phy driver.
> 
>  .../bindings/video/analogix_dp-rockchip.txt|  74 
>  drivers/gpu/drm/rockchip/Kconfig   |   9 +
>  drivers/gpu/drm/rockchip/Makefile  |   1 +
>  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 389
> + 4 files changed, 473 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt create
> mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> 
> diff --git
> a/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
> b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt new file
> mode 100644
> index 000..502483e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
> @@ -0,0 +1,74 @@
> +Rockchip RK3288 specific extensions to the Analogix Display Port
> +
> +
> +Required properties:
> +- compatible: "rockchip,rk3288-edp";
> +
> +- reg: physical base address of the controller and length
> +
> +- clocks: from common clock binding: handle to dp clock.
> +   of memory mapped region.
> +
> +- clock-names: from common clock binding:
> +Required elements: "dp" "pclk"
> +
> +- resets: Must contain an entry for each entry in reset-names.
> +   See ../reset/reset.txt for details.
> +
> +- reset-names: Must include the name "dp"
> +
> +- rockchip,grf: this soc should set GRF regs, so need get grf here.
> +
> +- ports: contain a port node with endpoint definitions as defined in
> +  Documentation/devicetree/bindings/media/video-interfaces.txt.
> +
> +
> +For the below properties, please refer to Analogix DP binding document:
> + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt
> +- phys (required)
> +- phy-names (required)
> +- hpd-gpios (optional)
> +---
>  +
> +Example:
> + dp-controller: dp at ff97 {
> + compatible = "rockchip,rk3288-dp";
> + reg = <0xff97 0x4000>;
> + interrupts = ;
> + clocks = < SCLK_EDP>, < PCLK_EDP_CTRL>;
> + clock-names = "dp", "pclk";
> + phys = <_phy>;
> + phy-names = "dp";
> +
> + rockchip,grf = <>;
> + resets = < 111>;
> + reset-names = "dp";
> +
> + status = "disabled";
> +
> + ports {
> + edp_in: port {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + edp_in_vopb: endpoint at 0 {
> + reg = <0>;
> + remote-endpoint = <_out_edp>;
> + };
> + edp_in_vopl: endpoint at 1 {
> + reg = <1>;
> + remote-endpoint = <_out_edp>;
> + };
> + };
> +
> + edp_out: port at 1 {
> + reg = <1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + edp_out_panel: endpoint {
> + reg = <0>;
> + remote-endpoint = <_in_edp>
> + };
> + };
> + };
> + };
> +
just a nit right now, because "git am" mentioned it:

git am \[PATCH\ v4\ 08_16\]\ drm_rockchip_dp_add\ rockchip\ platform\ dp\ 
driver.mbox 
[...]/linux-rockchip/.git/rebase-apply/patch:108: new blank line at EOF.
+

meaning you're adding an empty line at the end :-)


Heiko


[PATCH v4 10/16] phy: Add driver for rockchip Display Port PHY

2015-09-01 Thread Heiko Stuebner
Am Dienstag, 1. September 2015, 14:04:15 schrieb Yakir Yang:
> This phy driver would control the Rockchip DisplayPort module
> phy clock and phy power, it is relate to analogix_dp-rockchip
> dp driver. If you want DP works rightly on rockchip platform,
> then you should select both of them.
> 
> Signed-off-by: Yakir Yang 
> ---
> Changes in v4:
> - Take Kishon suggest, add commit message, and remove the redundant
>   rockchip_dp_phy_init() function, move those code to probe() method.
>   And remove driver .owner number.
> 
> Changes in v3:
> - Take Heiko suggest, add rockchip dp phy driver,
>   collect the phy clocks and power control.
> 
> Changes in v2: None
> 
>  .../devicetree/bindings/phy/rockchip-dp-phy.txt|  26 
>  drivers/phy/Kconfig|   7 +
>  drivers/phy/Makefile   |   1 +
>  drivers/phy/phy-rockchip-dp.c  | 166
> + 4 files changed, 200 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt create mode
> 100644 drivers/phy/phy-rockchip-dp.c
> 
> diff --git a/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
> b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt new file mode
> 100644
> index 000..5de1088
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/rockchip-dp-phy.txt
> @@ -0,0 +1,26 @@
> +Rockchip Soc Seroes Display Port PHY
> +
> +
> +Required properties:
> +- compatible : should be one of the following supported values:
> +  - "rockchip.rk3288-dp-phy"
> +
> +- reg : a list of registers used by phy driver

nodes do not necessarily need to have a regs property. You can do all 
operations via the grf syscon already.


> +- clocks: from common clock binding: handle to dp clock.
> + of memory mapped region.
> +- clock-names: from common clock binding:
> + Required elements: "sclk_dp" "sclk_dp_24m"
> +
> +- rockchip,grf: this soc should set GRF regs, so need get grf here.
> +- #phy-cells : from the generic PHY bindings, must be 0;
> +
> +Example:
> +
> +edp_phy: phy at ff770274 {

edp_phy: edp-phy {


> + compatilble = "rockchip,rk3288-dp-phy";
> + reg = <0xff770274 4>;

no regs property

> + rockchip,grf = <>;
> + clocks = < SCLK_EDP_24M>;
> + clock-names = "24m";
> + #phy-cells = <0>;
> +}
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 47da573..8f2bc4f 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -310,6 +310,13 @@ config PHY_ROCKCHIP_USB
>   help
> Enable this to support the Rockchip USB 2.0 PHY.
> 
> +config PHY_ROCKCHIP_DP
> + tristate "Rockchip Display Port PHY Driver"
> + depends on ARCH_ROCKCHIP && OF
> + select GENERIC_PHY
> + help
> +   Enable this to support the Rockchip Display Port PHY.
> +
>  config PHY_ST_SPEAR1310_MIPHY
>   tristate "ST SPEAR1310-MIPHY driver"
>   select GENERIC_PHY
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index a5b18c1..e281f35 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -34,6 +34,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)  +=
> phy-s5pv210-usb2.o obj-$(CONFIG_PHY_EXYNOS5_USBDRD)   += phy-exynos5-usbdrd.o
>  obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)  += phy-qcom-apq8064-sata.o
>  obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
> +obj-$(CONFIG_PHY_ROCKCHIP_DP)+= phy-rockchip-dp.o
>  obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)  += phy-qcom-ipq806x-sata.o
>  obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o
>  obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o
> diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c
> new file mode 100644
> index 000..e9a726e
> --- /dev/null
> +++ b/drivers/phy/phy-rockchip-dp.c
> @@ -0,0 +1,166 @@
> +/*
> + * Rockchip DP PHY driver
> + *
> + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd.
> + * Author: Yakir Yang 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define GRF_SOC_CON12   0x0274
> +#define GRF_EDP_REF_CLK_SEL_INTER   BIT(4)
> +
> +#define DP_PHY_SIDDQ_WRITE_EN   BIT(21)
> +#define DP_PHY_SIDDQ_ON 0
> +#define DP_PHY_SIDDQ_OFFBIT(5)
> +
> +struct rockchip_dp_phy {
> + struct device  *dev;
> + struct regmap  *grf;
> + void __iomem   *regs;
> + struct clk *phy_24m;
> +};
> +
> +static int rockchip_dp_phy_clk_enable(struct rockchip_dp_phy *dp)
> +{
> + int ret = 0;
> +
> + ret = clk_set_rate(dp->phy_24m, 2400);
> + if (ret < 0) {
> + 

[PATCH v4 03/16] drm: bridge: analogix/dp: split exynos dp driver to bridge dir

2015-09-01 Thread Heiko Stuebner
Am Dienstag, 1. September 2015, 13:49:58 schrieb Yakir Yang:
> Split the dp core driver from exynos directory to bridge
> directory, and rename the core driver to analogix_dp_*,
> leave the platform code to analogix_dp-exynos.
> 
> Signed-off-by: Yakir Yang 

[...]

> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c
> b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c similarity index 50%
> rename from drivers/gpu/drm/exynos/exynos_dp_core.c
> rename to drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> index bed0252..7d62f22 100644
> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c

[...]

>   connector->polled = DRM_CONNECTOR_POLL_HPD;
> 
>   ret = drm_connector_init(dp->drm_dev, connector,
> -  _dp_connector_funcs,
> +  _dp_connector_funcs,
>DRM_MODE_CONNECTOR_eDP);
>   if (ret) {
>   DRM_ERROR("Failed to initialize connector with drm\n");
>   return ret;
>   }
> 
> - drm_connector_helper_add(connector, _dp_connector_helper_funcs);
> + drm_connector_helper_add(connector,
> +  _dp_connector_helper_funcs);
>   drm_connector_register(connector);

this should only run on exynos, as we're doing all our connector registration 
in the core driver after all components are bound, so I guess something like 
the following is needed:

   if (dp->plat_data && dp->plat_data->dev_type == EXYNOS_DP)
   drm_connector_register(connector);



>   drm_mode_connector_attach_encoder(connector, encoder);
> 

[...]

> @@ -1301,7 +1239,10 @@ static int exynos_dp_bind(struct device *dev, struct
> device *master, void *data) if (IS_ERR(dp->reg_base))
>   return PTR_ERR(dp->reg_base);
> 
> - dp->hpd_gpio = of_get_named_gpio(dev->of_node, "samsung,hpd-gpio", 0);
> + dp->hpd_gpio = of_get_named_gpio(dev->of_node, "hpd-gpios", 0);
> + if (gpio_is_valid(dp->hpd_gpio))

this should be !gpio_is_valid ... i.e. only check the old property if the new 
one is _not_ valid


> + dp->hpd_gpio = of_get_named_gpio(dev->of_node,
> +  "samsung,hpd-gpio", 0);
> 
>   if (gpio_is_valid(dp->hpd_gpio)) {
>   /*



[PATCH v4 10/16] phy: Add driver for rockchip Display Port PHY

2015-09-01 Thread Heiko Stuebner
Hi Yakir,

small nit more below

Am Dienstag, 1. September 2015, 18:51:16 schrieb Heiko Stuebner:
> Am Dienstag, 1. September 2015, 14:04:15 schrieb Yakir Yang:
> > +- clocks: from common clock binding: handle to dp clock.
> > +   of memory mapped region.
> > +- clock-names: from common clock binding:
> > +   Required elements: "sclk_dp" "sclk_dp_24m"
> > +
> > +- rockchip,grf: this soc should set GRF regs, so need get grf here.
> > +- #phy-cells : from the generic PHY bindings, must be 0;
> > +
> > +Example:
> > +
> > +edp_phy: phy at ff770274 {
> 
> edp_phy: edp-phy {
> 
> > +   compatilble = "rockchip,rk3288-dp-phy";

typo: compatible



[PATCH v4 08/16] drm: rockchip/dp: add rockchip platform dp driver

2015-09-02 Thread Heiko Stuebner
Hi Yakir,

Am Dienstag, 1. September 2015, 14:01:28 schrieb Yakir Yang:
> Rockchip have three clocks for dp controller, we leave pclk_edp
> to analogix_dp driver control, and keep the sclk_edp_24m and
> sclk_edp in platform driver.
> 
> Signed-off-by: Yakir Yang 
> ---
> Changes in v4:
> - Remove some deprecated DT properties in rockchip dp document.
> 
> Changes in v3:
> - Take Thierry Reding and Heiko suggest, leave "sclk_edp_24m" to rockchip
>   dp phy driver which name to "24m", and leave "sclk_edp" to analogix dp
>   core driver which name to "dp", and leave "pclk_edp" to rockchip dp
> platform driver which name to "pclk".
> - Take Heiko suggest, add devicetree binding document.
> - Take Heiko suggest, remove "rockchip,panel" DT property, take use of
> remote point to get panel node.
> - Add the new function point analogix_dp_platdata.get_modes init.
> 
> Changes in v2:
> - Take Heiko suggest, get panel node with remote-endpoint method,
>   and create devicetree binding for driver.
> - Remove the clock enable/disbale with "sclk_edp" & "sclk_edp_24m",
>   leave those clock to rockchip dp phy driver.
> 
>  .../bindings/video/analogix_dp-rockchip.txt|  74 
>  drivers/gpu/drm/rockchip/Kconfig   |   9 +
>  drivers/gpu/drm/rockchip/Makefile  |   1 +
>  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c| 389
> + 4 files changed, 473 insertions(+)
>  create mode 100644
> Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt create
> mode 100644 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> 
> diff --git
> a/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
> b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt new file
> mode 100644
> index 000..502483e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/analogix_dp-rockchip.txt
> @@ -0,0 +1,74 @@
> +Rockchip RK3288 specific extensions to the Analogix Display Port
> +
> +
> +Required properties:
> +- compatible: "rockchip,rk3288-edp";
> +
> +- reg: physical base address of the controller and length
> +
> +- clocks: from common clock binding: handle to dp clock.
> +   of memory mapped region.
> +
> +- clock-names: from common clock binding:
> +Required elements: "dp" "pclk"
> +
> +- resets: Must contain an entry for each entry in reset-names.
> +   See ../reset/reset.txt for details.
> +
> +- reset-names: Must include the name "dp"
> +
> +- rockchip,grf: this soc should set GRF regs, so need get grf here.
> +
> +- ports: contain a port node with endpoint definitions as defined in
> +  Documentation/devicetree/bindings/media/video-interfaces.txt.
> +
> +
> +For the below properties, please refer to Analogix DP binding document:
> + * Documentation/devicetree/bindings/drm/bridge/analogix_dp.txt
> +- phys (required)
> +- phy-names (required)
> +- hpd-gpios (optional)
> +---
>  +
> +Example:
> + dp-controller: dp at ff97 {
> + compatible = "rockchip,rk3288-dp";
> + reg = <0xff97 0x4000>;
> + interrupts = ;
> + clocks = < SCLK_EDP>, < PCLK_EDP_CTRL>;
> + clock-names = "dp", "pclk";
> + phys = <_phy>;
> + phy-names = "dp";
> +
> + rockchip,grf = <>;
> + resets = < 111>;
> + reset-names = "dp";
> +
> + status = "disabled";
> +
> + ports {

#address-cells = <1>;
#size-cells = <0>;

> + edp_in: port {

edp_in: port at 0
reg = <0>;

> + #address-cells = <1>;
> + #size-cells = <0>;
> + edp_in_vopb: endpoint at 0 {
> + reg = <0>;
> + remote-endpoint = <_out_edp>;
> + };
> + edp_in_vopl: endpoint at 1 {
> + reg = <1>;
> + remote-endpoint = <_out_edp>;
> + };
> + };
> +
> + edp_out: port at 1 {
> + reg = <1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + edp_out_panel: endpoint {
> + reg = <0>;
> + remote-endpoint = <_in_edp>
> + };
> + };
> + };
> + };
> +
> diff --git a/drivers/gpu/drm/rockchip/Kconfig
> b/drivers/gpu/drm/rockchip/Kconfig index 35215f6..c2ba945 100644
> --- a/drivers/gpu/drm/rockchip/Kconfig
> +++ b/drivers/gpu/drm/rockchip/Kconfig
> @@ -25,3 +25,12 @@ config ROCKCHIP_DW_HDMI
> for the Synopsys DesignWare HDMI driver. If 

[PATCH v4 09/16] drm: rockchip: add bpc and color mode setting

2015-09-02 Thread Heiko Stuebner
Hi Yakir,

Am Dienstag, 1. September 2015, 14:01:48 schrieb Yakir Yang:
> From: Mark Yao 
> 
> Add bpc and color mode setting in rockchip_drm_vop driver, so
> connector could try to use the edid drm_display_info to config
> vop output mode.
> 
> Signed-off-by: Mark Yao 
> Signed-off-by: Yakir Yang 
> ---
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> 
>  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 46
> +++-- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c |
>  2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.h |  2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 33 --
>  4 files changed, 68 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c index cebff9e..efea045
> 100644
> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> @@ -11,11 +11,6 @@
>   * Free Software Foundation; either version 2 of the License, or (at your
>   * option) any later version.
>   */
> -#include 
> -#include 
> -#include 
> -#include 
> -#include 
> 
>  #include 
>  #include 
> @@ -27,6 +22,13 @@
>  #include 
>  #include 
> 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
>  #include 
> 
>  #include "rockchip_drm_drv.h"
> @@ -125,20 +127,44 @@ static void rockchip_dp_drm_encoder_mode_set(struct
> drm_encoder *encoder, /* do nothing */
>  }
> 
> +static drm_connector *rockchip_dp_get_connector(struct rockchip_dp_device

missing a "struct" -> static struct drm_connector


> *dp) +{
> + struct drm_connector *connector;
> + struct drm_device *drm_dev = dp->drm_dev;
> +
> + drm_for_each_connector(connector, drm_dev) {
> + if (connector->encoder != >encoder)
> + return connector;
> + }
> +
> + return NULL;
> +}
> +
>  static void rockchip_dp_drm_encoder_prepare(struct drm_encoder *encoder)
>  {
>   struct rockchip_dp_device *dp = encoder_to_dp(encoder);
> + struct drm_connector *connector;
> + int ret = 0;
>   u32 val;
> - int ret;
> 
> - ret = rockchip_drm_crtc_mode_config(encoder->crtc,
> - DRM_MODE_CONNECTOR_eDP,
> - ROCKCHIP_OUT_MODE_);
> - if (ret < 0) {
> + connector = rockchip_dp_get_connector(dp);
> + if (!connector) {
> + DRM_ERROR("Failed to get connector by encoder[%p]\n", encoder);
> + return;
> + }
> +
> + if (connector->display_info.color_formats | DRM_COLOR_FORMAT_RGB444)
> + ret = rockchip_drm_crtc_mode_config(
> + encoder->crtc, DRM_MODE_CONNECTOR_eDP,
> + connector->display_info.bpc, DRM_COLOR_FORMAT_RGB444);
> + if (!ret) {
>   dev_err(dp->dev, "Could not set crtc mode config: %d.\n", ret);
>   return;
>   }
> 
> + connector->display_info.bpc = ret;
> + connector->display_info.color_formats = DRM_COLOR_FORMAT_RGB444;
> +
>   ret = rockchip_drm_encoder_get_mux_id(dp->dev->of_node, encoder);
>   if (ret < 0)
>   return;
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 80d6fc8..428a3c1 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> @@ -215,7 +215,7 @@ static void dw_hdmi_rockchip_encoder_commit(struct
> drm_encoder *encoder) static void dw_hdmi_rockchip_encoder_prepare(struct
> drm_encoder *encoder) {
>   rockchip_drm_crtc_mode_config(encoder->crtc, DRM_MODE_CONNECTOR_HDMIA,
> -   ROCKCHIP_OUT_MODE_);
> +   10, DRM_COLOR_FORMAT_RGB444);
>  }
> 
>  static struct drm_encoder_helper_funcs
> dw_hdmi_rockchip_encoder_helper_funcs = { diff --git
> a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h index dc4e5f0..ef1d7fb 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
> @@ -59,7 +59,7 @@ void rockchip_unregister_crtc_funcs(struct drm_device
> *dev, int pipe); int rockchip_drm_encoder_get_mux_id(struct device_node
> *node,
>   struct drm_encoder *encoder);
>  int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc, int
> connector_type, -   int out_mode);
> +   int bpc, int color);
>  int rockchip_drm_dma_attach_device(struct drm_device *drm_dev,
>  struct device *dev);
>  void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 34b78e7..5d7f9b6 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ 

[PATCH v4 0/16] Add Analogix Core Display Port Driver

2015-09-02 Thread Heiko Stuebner
Hi Yakir,

Am Dienstag, 1. September 2015, 13:46:11 schrieb Yakir Yang:
>The Samsung Exynos eDP controller and Rockchip RK3288 eDP controller
> share the same IP, so a lot of parts can be re-used. I split the common
> code into bridge directory, then rk3288 and exynos only need to keep
> some platform code. Cause I can't find the exact IP name of exynos dp
> controller, so I decide to name dp core driver with "analogix" which I
> find in rk3288 eDP TRM ;)
> 
> Beyond that, there are three light registers setting differents bewteen
> exynos and rk3288.
> 1. RK3288 have five special pll resigters which not indicata in exynos
>dp controller.
> 2. The address of DP_PHY_PD(dp phy power manager register) are different
>between rk3288 and exynos.
> 3. Rk3288 and exynos have different setting with AUX_HW_RETRY_CTL(dp debug
>register).
> 
> I have verified this series on two kinds of rockchip platform board, one
> is rk3288 sdk board which connect with a 2K display port monitor, the other
> is google jerry chromebook which connect with a eDP screen "cnm,n116bgeea2",
> both of them works rightlly.

it looks like during the rebase something did go wrong and I found some issues 
I mentioned in the replies to individual patches.

I did prepare a branch based on mainline [0] with both the old and the new edp 
driver - rk3288_veyron_defconfig build both drivers into the image.

While the old driver still works, I wasn't able to make the new one work yet 
... the drm core does find the connector, but not that anything is connected 
to it. I'll try to dig deeper tomorrow, but maybe you'll see anything 
interesting before then.


Heiko

[0] https://github.com/mmind/linux-rockchip/tree/tmp/edp-with-veyron



[PATCH v4 10/16] phy: Add driver for rockchip Display Port PHY

2015-09-03 Thread Heiko Stuebner
Am Donnerstag, 3. September 2015, 11:25:00 schrieb Yakir Yang:
> 在 09/02/2015 09:27 PM, Rob Herring 写道:
> > On Tue, Sep 1, 2015 at 1:04 AM, Yakir Yang  wrote:
> >> +- clocks: from common clock binding: handle to dp clock.
> >> +   of memory mapped region.
> >> +- clock-names: from common clock binding:
> >> +   Required elements: "sclk_dp" "sclk_dp_24m"
> >> +
> >> +- rockchip,grf: this soc should set GRF regs, so need get grf here.
> > 
> > I have no idea what GRF means.
> 
> GRF is an module of our IC chip, the full name is General Register Files.
> I would rather to pick some words from our TRM.
> 
> The general register file will be used to do static set by software, which
> is composed of many registers for system control.

The general register files are present on all Rockchip SoCs I've seen so far 
and really are just an aggregation of registers for settings and status 
indications, ranging from memory stuff, dma-controller settings, usb-phy and 
settings for a lot of other phys, etc.

The most prevalent description in dt-bindings is currently:

- rockchip,grf: phandle to the syscon managing the "general register files"


Heiko


[PATCH v4 03/16] drm: bridge: analogix/dp: split exynos dp driver to bridge dir

2015-09-05 Thread Heiko Stuebner
Am Freitag, 4. September 2015, 16:06:02 schrieb Rob Herring:
> On Tue, Sep 1, 2015 at 3:46 PM, Heiko Stuebner  wrote:
> > Am Dienstag, 1. September 2015, 13:49:58 schrieb Yakir Yang:
> >> Split the dp core driver from exynos directory to bridge
> >> directory, and rename the core driver to analogix_dp_*,
> >> leave the platform code to analogix_dp-exynos.
> >> 
> >> Signed-off-by: Yakir Yang 
> > 
> > [...]
> > 
> >> diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c
> >> b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c similarity index 50%
> >> rename from drivers/gpu/drm/exynos/exynos_dp_core.c
> >> rename to drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> >> index bed0252..7d62f22 100644
> >> --- a/drivers/gpu/drm/exynos/exynos_dp_core.c
> >> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
> > 
> > [...]
> > 
> >>   connector->polled = DRM_CONNECTOR_POLL_HPD;
> >>   
> >>   ret = drm_connector_init(dp->drm_dev, connector,
> >> 
> >> -  _dp_connector_funcs,
> >> +  _dp_connector_funcs,
> >> 
> >>DRM_MODE_CONNECTOR_eDP);
> >>   
> >>   if (ret) {
> >>   
> >>   DRM_ERROR("Failed to initialize connector with drm\n");
> >>   return ret;
> >>   
> >>   }
> >> 
> >> - drm_connector_helper_add(connector,
> >> _dp_connector_helper_funcs); +
> >> drm_connector_helper_add(connector,
> >> +  _dp_connector_helper_funcs);
> >> 
> >>   drm_connector_register(connector);
> > 
> > this should only run on exynos, as we're doing all our connector
> > registration in the core driver after all components are bound, so I
> > guess something like> 
> > the following is needed:
> >if (dp->plat_data && dp->plat_data->dev_type == EXYNOS_DP)
> >
> >drm_connector_register(connector);
> 
> Yuck!
> 
> Surely there is a better way. From what I've seen of DRM, I have no
> doubt this is needed, but really a better solution is needed. Surely
> there can be a more generic way for the driver to determine if it
> should handle the connector or not. This seems like a common problem
> including one I have seen. What I'm working on has onchip DSI encoder
> -> ADV7533 -> HDMI. The DSI encoder can also have a direct attached
> panel. So I have to check for a bridge in the encoder driver and only
> register the connector for the panel if a bridge is not attached.

I'm also only a part-time drm meddler, so things may be inaccurate.

This conditional is not meant to prevent the registration of the dp connector, 
only delay it for non-exynos drms. The connector registration does publish it 
to userspace, so like i.MX we're doing that for all connectors at the same 
time after all components are bound - to also make x11 happy. Exynos on the 
other hand seems to register its connectors individually and I'm not sure if 
they would be willing to change that.

see d3007dabeff4 ("drm/rockchip: register all connectors after bind") or 
simply rockchip_drm_drv.c line 178.

and e355e7dd607b ("imx-drm: delay publishing sysfs connector entries")


Heiko


[PATCH 0/3] add power-supply support to dw_hdmi

2015-03-10 Thread Heiko Stuebner
At least the Rockchip variant of the dw_hdmi should control its supplying
regulators. A cursory glance at the imx manual didn't any equivalent there,
so I'm not sure if there are similar controllable regulators present.

Patch1 is only a small fix to keep {devm_}regulator_bulk_get quiet in
the deferring case and could go directly to the regulator tree, if ok.

Patch3 is the addition of the supplies to the rk3288 boards and I would
take it into my dts branch if patch2 gets deemed acceptable.


Heiko Stuebner (3):
  regulator: don't emit errors in {devm_}regulator_bulk_get when defering
  drm/bridge: dw-hdmi: support optional supply regulators
  ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  5 
 arch/arm/boot/dts/rk3288-evb.dtsi  |  2 ++
 arch/arm/boot/dts/rk3288-firefly.dtsi  |  2 ++
 drivers/gpu/drm/bridge/dw_hdmi.c   | 27 +-
 drivers/gpu/drm/imx/dw_hdmi-imx.c  |  3 ++-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 15 +++-
 drivers/regulator/core.c   |  5 ++--
 drivers/regulator/devres.c |  5 ++--
 include/drm/bridge/dw_hdmi.h   |  3 ++-
 9 files changed, 59 insertions(+), 8 deletions(-)

-- 
2.1.4




[PATCH 1/3] regulator: don't emit errors in {devm_}regulator_bulk_get when defering

2015-03-10 Thread Heiko Stuebner
When {devm_}regulator_get returns -EPROBE_DEFER the driver in question will
try probing again at a later time. So don't spam the log with failure messages
as this is an expected result of probe ordering.

Signed-off-by: Heiko Stuebner 
---
 drivers/regulator/core.c   | 5 +++--
 drivers/regulator/devres.c | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 52af1d7..07ca6cb 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3163,8 +3163,9 @@ int regulator_bulk_get(struct device *dev, int 
num_consumers,
  consumers[i].supply);
if (IS_ERR(consumers[i].consumer)) {
ret = PTR_ERR(consumers[i].consumer);
-   dev_err(dev, "Failed to get supply '%s': %d\n",
-   consumers[i].supply, ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev, "Failed to get supply '%s': %d\n",
+   consumers[i].supply, ret);
consumers[i].consumer = NULL;
goto err;
}
diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c
index 6ec1d40..78e460d 100644
--- a/drivers/regulator/devres.c
+++ b/drivers/regulator/devres.c
@@ -168,8 +168,9 @@ int devm_regulator_bulk_get(struct device *dev, int 
num_consumers,
   consumers[i].supply);
if (IS_ERR(consumers[i].consumer)) {
ret = PTR_ERR(consumers[i].consumer);
-   dev_err(dev, "Failed to get supply '%s': %d\n",
-   consumers[i].supply, ret);
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev, "Failed to get supply '%s': %d\n",
+   consumers[i].supply, ret);
consumers[i].consumer = NULL;
goto err;
}
-- 
2.1.4




[PATCH 2/3] drm/bridge: dw-hdmi: support optional supply regulators

2015-03-10 Thread Heiko Stuebner
At least the Rockchip variant of the dw_hdmi can have controllable power 
supplies
providing 1.0 and 1.8V. Therefore add the possibility for the generic bridge
driver to enable supplies provided by the hw-specific drivers.

Signed-off-by: Heiko Stuebner 
---
 .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  5 
 drivers/gpu/drm/bridge/dw_hdmi.c   | 27 +-
 drivers/gpu/drm/imx/dw_hdmi-imx.c  |  3 ++-
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 15 +++-
 include/drm/bridge/dw_hdmi.h   |  3 ++-
 5 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
index a905c14..bb74640 100644
--- a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -22,6 +22,11 @@ Optional properties
 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
 - clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"

+Supplies:
+rockchip,rk3288-dw-hdmi handles two optional power supplies:
+- avdd1v0-supply: 1.0V power supply
+- avdd1v8-supply: 1.8V power supply
+
 Example:
hdmi: hdmi at 012 {
compatible = "fsl,imx6q-hdmi";
diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index cd6a706..9f8999d 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 

 #include 
 #include 
@@ -114,6 +115,9 @@ struct dw_hdmi {
struct hdmi_data_info hdmi_data;
const struct dw_hdmi_plat_data *plat_data;

+   struct regulator_bulk_data *supplies;
+   int nsupplies;
+
int vic;

u8 edid[HDMI_EDID_LEN];
@@ -879,6 +883,12 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi)
int i, ret;
bool cscon = false;

+   if (hdmi->nsupplies > 0) {
+   ret = regulator_bulk_enable(hdmi->nsupplies, hdmi->supplies);
+   if (ret)
+   return ret;
+   }
+
/*check csc whether needed activated in HDMI mode */
cscon = (is_color_space_conversion(hdmi) &&
!hdmi->hdmi_data.video_mode.mdvi);
@@ -1105,6 +1115,9 @@ static void dw_hdmi_phy_disable(struct dw_hdmi *hdmi)
dw_hdmi_phy_enable_tmds(hdmi, 0);
dw_hdmi_phy_enable_power(hdmi, 0);

+   if (hdmi->nsupplies > 0)
+   regulator_bulk_disable(hdmi->nsupplies, hdmi->supplies);
+
hdmi->phy_enabled = false;
 }

@@ -1549,7 +1562,8 @@ static int dw_hdmi_register(struct drm_device *drm, 
struct dw_hdmi *hdmi)
 int dw_hdmi_bind(struct device *dev, struct device *master,
 void *data, struct drm_encoder *encoder,
 struct resource *iores, int irq,
-const struct dw_hdmi_plat_data *plat_data)
+const struct dw_hdmi_plat_data *plat_data,
+struct regulator_bulk_data *supplies, int nsupplies)
 {
struct drm_device *drm = data;
struct device_node *np = dev->of_node;
@@ -1602,6 +1616,17 @@ int dw_hdmi_bind(struct device *dev, struct device 
*master,
if (IS_ERR(hdmi->regs))
return PTR_ERR(hdmi->regs);

+   if (nsupplies > 0) {
+   ret = devm_regulator_bulk_get(hdmi->dev, nsupplies, supplies);
+   if (ret == -EPROBE_DEFER)
+   return ret;
+   if (ret)
+   nsupplies = 0;
+   }
+
+   hdmi->supplies = supplies;
+   hdmi->nsupplies = nsupplies;
+
hdmi->isfr_clk = devm_clk_get(hdmi->dev, "isfr");
if (IS_ERR(hdmi->isfr_clk)) {
ret = PTR_ERR(hdmi->isfr_clk);
diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c 
b/drivers/gpu/drm/imx/dw_hdmi-imx.c
index 121d30c..153e259 100644
--- a/drivers/gpu/drm/imx/dw_hdmi-imx.c
+++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c
@@ -214,7 +214,8 @@ static int dw_hdmi_imx_bind(struct device *dev, struct 
device *master,
drm_encoder_init(drm, encoder, _hdmi_imx_encoder_funcs,
 DRM_MODE_ENCODER_TMDS);

-   return dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data);
+   return dw_hdmi_bind(dev, master, data, encoder, iores, irq, plat_data,
+   NULL, 0);
 }

 static void dw_hdmi_imx_unbind(struct device *dev, struct device *master,
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index d236faa..c085e88 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -24,6 +25,8 @@
 #defi

[PATCH 3/3] ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards

2015-03-10 Thread Heiko Stuebner
Add the recently added hdmi power supplies to evb and firefly boards.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288-evb.dtsi | 2 ++
 arch/arm/boot/dts/rk3288-firefly.dtsi | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi 
b/arch/arm/boot/dts/rk3288-evb.dtsi
index 5e895a5..edd45a0 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -118,6 +118,8 @@
 };

  {
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
ddc-i2c-bus = <>;
status = "okay";
 };
diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi 
b/arch/arm/boot/dts/rk3288-firefly.dtsi
index e6f873a..09fcded 100644
--- a/arch/arm/boot/dts/rk3288-firefly.dtsi
+++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
@@ -180,6 +180,8 @@
 };

  {
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
ddc-i2c-bus = <>;
status = "okay";
 };
-- 
2.1.4




[PATCH 2/3] drm/bridge: dw-hdmi: support optional supply regulators

2015-03-10 Thread Heiko Stuebner
Hi Philipp,

Am Dienstag, 10. März 2015, 10:16:53 schrieb Philipp Zabel:

[cut the obvious stuff I need to fix]

> Am Dienstag, den 10.03.2015, 00:22 +0100 schrieb Heiko Stuebner:
> > @@ -879,6 +883,12 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi)
> > 
> > int i, ret;
> > bool cscon = false;
> > 
> > +   if (hdmi->nsupplies > 0) {
> > +   ret = regulator_bulk_enable(hdmi->nsupplies, hdmi->supplies);
> > +   if (ret)
> > +   return ret;
> > +   }
> > +
> 
> Are these really supplies to the PHY or is this just a convenient place
> to enable them? Looking at the i.MX6 docs, I suppose yes.

According to the TRM, the supplies are "DC supply voltage for Analog part of 
HDMI", so I'd think phy supplies.

> 
> > /*check csc whether needed activated in HDMI mode */
> > cscon = (is_color_space_conversion(hdmi) &&
> > 
> > !hdmi->hdmi_data.video_mode.mdvi);
> > 
> > @@ -1105,6 +1115,9 @@ static void dw_hdmi_phy_disable(struct dw_hdmi
> > *hdmi)
> > 
> > dw_hdmi_phy_enable_tmds(hdmi, 0);
> > dw_hdmi_phy_enable_power(hdmi, 0);
> > 
> > +   if (hdmi->nsupplies > 0)
> > +   regulator_bulk_disable(hdmi->nsupplies, hdmi->supplies);
> > +
> > 
> > hdmi->phy_enabled = false;
> >  
> >  }
> > 
> > @@ -1549,7 +1562,8 @@ static int dw_hdmi_register(struct drm_device *drm,
> > struct dw_hdmi *hdmi)> 
> >  int dw_hdmi_bind(struct device *dev, struct device *master,
> >  
> >  void *data, struct drm_encoder *encoder,
> >  struct resource *iores, int irq,
> > 
> > -const struct dw_hdmi_plat_data *plat_data)
> > +const struct dw_hdmi_plat_data *plat_data,
> > +struct regulator_bulk_data *supplies, int nsupplies)
> 
> I'm not sure I like this function sprouting so many parameters. Is there
> a good reason not to add this to struct dw_hdmi_plat_data?

Nope, moving this to platdata sound sensible and I'll give this a try :-)


Heiko


[PATCH 1/3] regulator: don't emit errors in {devm_}regulator_bulk_get when defering

2015-03-10 Thread Heiko Stuebner
Am Dienstag, 10. März 2015, 12:07:50 schrieb Mark Brown:
> On Tue, Mar 10, 2015 at 12:22:06AM +0100, Heiko Stuebner wrote:
> > When {devm_}regulator_get returns -EPROBE_DEFER the driver in question
> > will
> > try probing again at a later time. So don't spam the log with failure
> > messages as this is an expected result of probe ordering.
> > 
> > -   dev_err(dev, "Failed to get supply '%s': %d\n",
> > -   consumers[i].supply, ret);
> > +   if (ret != -EPROBE_DEFER)
> > +   dev_err(dev, "Failed to get supply '%s': %d\n",
> > +   consumers[i].supply, ret);
> 
> No, this is not good - you get a nice quiet boot even if the regulator
> does not appear which means people have no idea why the driver isn't
> loading.  That's not a good user experience, silent error handling is
> the main problem I see people running into trying to get their systems
> up and running these days.
> 
> Really deferred probe is just fundamentally noisy since it's
> intentionally tolerating errors like this and of course a lot of the
> noise comes from the deferral messages the core prints.

ok, I'll drop this one then



[PATCH v2 1/2] drm/bridge: dw-hdmi: support optional supply regulators

2015-03-10 Thread Heiko Stuebner
At least the Rockchip variant of the dw_hdmi can have controllable power 
supplies
providing 1.0 and 1.8V. Therefore add the possibility for the generic bridge
driver to enable supplies provided by the hw-specific drivers.

Signed-off-by: Heiko Stuebner 
---
changes since v1:
- follow suggestion from Russell King to keep regulator handling local
  to the rockchip implementation for the time being and only generalize
  when a real second implementation needs regulator handling

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  5 
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 32 +-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
index a905c14..bb74640 100644
--- a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -22,6 +22,11 @@ Optional properties
 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
 - clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"

+Optional supplies:
+rockchip,rk3288-dw-hdmi handles two optional power supplies:
+- avdd1v0-supply: 1.0V power supply
+- avdd1v8-supply: 1.8V power supply
+
 Example:
hdmi: hdmi at 012 {
compatible = "fsl,imx6q-hdmi";
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index d236faa..647a240 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,9 @@ struct rockchip_hdmi {
struct device *dev;
struct regmap *regmap;
struct drm_encoder encoder;
+   struct regulator_bulk_data supplies[2];
+   int nsupplies;
+   bool supplies_enabled;
 };

 #define to_rockchip_hdmi(x)container_of(x, struct rockchip_hdmi, x)
@@ -179,6 +183,12 @@ static struct drm_encoder_funcs 
dw_hdmi_rockchip_encoder_funcs = {

 static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
 {
+   struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
+
+   if (hdmi->nsupplies > 0 && hdmi->supplies_enabled) {
+   regulator_bulk_disable(hdmi->nsupplies, hdmi->supplies);
+   hdmi->supplies_enabled = false;
+   }
 }

 static bool
@@ -199,7 +209,16 @@ static void dw_hdmi_rockchip_encoder_commit(struct 
drm_encoder *encoder)
 {
struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
u32 val;
-   int mux;
+   int mux, ret;
+
+   if (hdmi->nsupplies > 0 && !hdmi->supplies_enabled) {
+   ret = regulator_bulk_enable(hdmi->nsupplies, hdmi->supplies);
+   if (ret) {
+   dev_err(hdmi->dev, "could not enable hdmi analog 
supplies\n");
+   return;
+   }
+   hdmi->supplies_enabled = true;
+   }

mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
if (mux)
@@ -275,6 +294,17 @@ static int dw_hdmi_rockchip_bind(struct device *dev, 
struct device *master,
if (!iores)
return -ENXIO;

+   hdmi->supplies[0].supply = "avdd1v0";
+   hdmi->supplies[1].supply = "avdd1v8";
+   hdmi->nsupplies = 2;
+
+   ret = devm_regulator_bulk_get(hdmi->dev,
+ hdmi->nsupplies, hdmi->supplies);
+   if (ret == -EPROBE_DEFER)
+   return ret;
+   if (ret)
+   hdmi->nsupplies = 0;
+
platform_set_drvdata(pdev, hdmi);

encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
-- 
2.1.4




[PATCH v2 2/2] ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards

2015-03-10 Thread Heiko Stuebner
Add the recently added hdmi power supplies to evb and firefly boards.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288-evb.dtsi | 2 ++
 arch/arm/boot/dts/rk3288-firefly.dtsi | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi 
b/arch/arm/boot/dts/rk3288-evb.dtsi
index 5e895a5..edd45a0 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -118,6 +118,8 @@
 };

  {
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
ddc-i2c-bus = <>;
status = "okay";
 };
diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi 
b/arch/arm/boot/dts/rk3288-firefly.dtsi
index e6f873a..09fcded 100644
--- a/arch/arm/boot/dts/rk3288-firefly.dtsi
+++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
@@ -180,6 +180,8 @@
 };

  {
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
ddc-i2c-bus = <>;
status = "okay";
 };
-- 
2.1.4




[PATCH v2 1/2] drm/bridge: dw-hdmi: support optional supply regulators

2015-03-11 Thread Heiko Stuebner
Hi Philipp,

Am Mittwoch, 11. März 2015, 10:28:29 schrieb Philipp Zabel:
> Am Dienstag, den 10.03.2015, 22:45 +0100 schrieb Heiko Stuebner:
> > At least the Rockchip variant of the dw_hdmi can have controllable power
> > supplies providing 1.0 and 1.8V. Therefore add the possibility for the
> > generic bridge driver to enable supplies provided by the hw-specific
> > drivers.
> > 
> > Signed-off-by: Heiko Stuebner 
> > ---
> > changes since v1:
> > - follow suggestion from Russell King to keep regulator handling local
> > 
> >   to the rockchip implementation for the time being and only generalize
> >   when a real second implementation needs regulator handling
> >  
> >  .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  5 
> >  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 32
> >  +- 2 files changed, 36 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> > b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt index
> > a905c14..bb74640 100644
> > --- a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> > +++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> > @@ -22,6 +22,11 @@ Optional properties
> > 
> >  - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
> >  - clocks, clock-names: phandle to the HDMI CEC clock, name should be
> >  "cec"
> > 
> > +Optional supplies:
> > +rockchip,rk3288-dw-hdmi handles two optional power supplies:
> > +- avdd1v0-supply: 1.0V power supply
> > +- avdd1v8-supply: 1.8V power supply
> 
> Are these the names used in the Rockchip documentation?
> 
> Since the older implementation on i.MX6 uses 1.1V (HDMI_VP) and 2.5V
> (HDMI_VPH), I wonder whether each SoC should use their own name or
> whether there should be common names that don't include the voltage.
> I don't have the Synopsys HDMI TX docs, but I've seen avddhv and avddlv
> used of other cores' analog supplies.

The pins of the soc connected to the regulators are named:
HDMI_AVDD_1V0
HDMI_AVDD_1V8
The datasheet only calls both "DC supply voltage for Analog part of HDMI" and 
never mentions them again.

The databook of the IP block itself seems to really call this VPH and VP as 
phy supplies, but documentation is a bit sparse about them.

I guess as we already use the databook clock-names I should also switch to the 
databook supply names (avdd1v0 -> vp and avdd1v8 -> vph).


Heiko


[PATCH 2/2] drm/bridge: Add IT6151 bridge driver

2015-03-12 Thread Heiko Stuebner
Am Donnerstag, 12. März 2015, 10:00:47 schrieb Paul Bolle:
> > --- /dev/null
> > +++ b/drivers/gpu/drm/bridge/it6151.c
> > 
> > +#include 
> 
> This file can only be built-in. So I couldn't help but notice this
> include. And if I remove it
> make drivers/gpu/drm/bridge/it6151.o
> 
> still runs without warning or errors. Unless I've missed something
> non-obvious I'd say it is not needed.

I think the more interesting question would be, why can it only be built in 
:-) .

The drm/bridge series from Ajay Kumar [0] made it into 4.0-rc that enables 
drm-bridges to be regular platform/i2c devices, see [1] for example.

So I think any new bridge driver should use this approach and can thus also be 
build as module.


Heiko


[0] http://www.spinics.net/lists/linux-samsung-soc/msg41403.html
[1] http://www.spinics.net/lists/linux-samsung-soc/msg41406.html



[PATCH v3 1/2] drm/bridge: dw-hdmi: support optional supply regulators

2015-03-12 Thread Heiko Stuebner
At least the Rockchip variant of the dw_hdmi can have controllable power 
supplies
providing 1.0 and 1.8V. Therefore add the possibility for the generic bridge
driver to enable supplies provided by the hw-specific drivers.

Signed-off-by: Heiko Stuebner 
---
changes since v2:
- rename supplies to the names found in the hdmi IP databook
changes since v1:
- follow suggestion from Russell King to keep regulator handling local
  to the rockchip implementation for the time being and only generalize
  when a real second implementation needs regulator handling

 .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  5 
 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 32 +-
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt 
b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
index a905c14..bb74640 100644
--- a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
+++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
@@ -22,6 +22,11 @@ Optional properties
 - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
 - clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"

+Optional supplies:
+rockchip,rk3288-dw-hdmi handles two optional power supplies:
+- vp-supply: 1.0V power supply
+- vph-supply: 1.8V power supply
+
 Example:
hdmi: hdmi at 012 {
compatible = "fsl,imx6q-hdmi";
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c 
b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
index d236faa..647a240 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
@@ -11,6 +11,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -28,6 +29,9 @@ struct rockchip_hdmi {
struct device *dev;
struct regmap *regmap;
struct drm_encoder encoder;
+   struct regulator_bulk_data supplies[2];
+   int nsupplies;
+   bool supplies_enabled;
 };

 #define to_rockchip_hdmi(x)container_of(x, struct rockchip_hdmi, x)
@@ -179,6 +183,12 @@ static struct drm_encoder_funcs 
dw_hdmi_rockchip_encoder_funcs = {

 static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
 {
+   struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
+
+   if (hdmi->nsupplies > 0 && hdmi->supplies_enabled) {
+   regulator_bulk_disable(hdmi->nsupplies, hdmi->supplies);
+   hdmi->supplies_enabled = false;
+   }
 }

 static bool
@@ -199,7 +209,16 @@ static void dw_hdmi_rockchip_encoder_commit(struct 
drm_encoder *encoder)
 {
struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
u32 val;
-   int mux;
+   int mux, ret;
+
+   if (hdmi->nsupplies > 0 && !hdmi->supplies_enabled) {
+   ret = regulator_bulk_enable(hdmi->nsupplies, hdmi->supplies);
+   if (ret) {
+   dev_err(hdmi->dev, "could not enable hdmi analog 
supplies\n");
+   return;
+   }
+   hdmi->supplies_enabled = true;
+   }

mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
if (mux)
@@ -275,6 +294,17 @@ static int dw_hdmi_rockchip_bind(struct device *dev, 
struct device *master,
if (!iores)
return -ENXIO;

+   hdmi->supplies[0].supply = "vp";
+   hdmi->supplies[1].supply = "vph";
+   hdmi->nsupplies = 2;
+
+   ret = devm_regulator_bulk_get(hdmi->dev,
+ hdmi->nsupplies, hdmi->supplies);
+   if (ret == -EPROBE_DEFER)
+   return ret;
+   if (ret)
+   hdmi->nsupplies = 0;
+
platform_set_drvdata(pdev, hdmi);

encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
-- 
2.1.4




[PATCH v3 2/2] ARM: dts: rockchip: add hdmi analog power supplies to rk3288 boards

2015-03-12 Thread Heiko Stuebner
Add the recently added hdmi power supplies to evb and firefly boards.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288-evb.dtsi | 2 ++
 arch/arm/boot/dts/rk3288-firefly.dtsi | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-evb.dtsi 
b/arch/arm/boot/dts/rk3288-evb.dtsi
index 5e895a5..edd45a0 100644
--- a/arch/arm/boot/dts/rk3288-evb.dtsi
+++ b/arch/arm/boot/dts/rk3288-evb.dtsi
@@ -118,6 +118,8 @@
 };

  {
+   vp-supply = <_lcd>;
+   vph-supply = <_lcd>;
ddc-i2c-bus = <>;
status = "okay";
 };
diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi 
b/arch/arm/boot/dts/rk3288-firefly.dtsi
index e6f873a..09fcded 100644
--- a/arch/arm/boot/dts/rk3288-firefly.dtsi
+++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
@@ -180,6 +180,8 @@
 };

  {
+   vp-supply = <_lcd>;
+   vph-supply = <_lcd>;
ddc-i2c-bus = <>;
status = "okay";
 };
-- 
2.1.4




[PATCH v3 1/2] drm/bridge: dw-hdmi: support optional supply regulators

2015-03-23 Thread Heiko Stuebner
Hi Philipp,

Am Donnerstag, 12. März 2015, 21:45:19 schrieb Heiko Stuebner:
> At least the Rockchip variant of the dw_hdmi can have controllable power
> supplies providing 1.0 and 1.8V. Therefore add the possibility for the
> generic bridge driver to enable supplies provided by the hw-specific
> drivers.
> 
> Signed-off-by: Heiko Stuebner 

does this look ok now?

And as we talked about in Chemnitz, who will be taking such bridge-related 
changes, as you mentioned some last bridge-patches going through Thierry.


Heiko

> ---
> changes since v2:
> - rename supplies to the names found in the hdmi IP databook
> changes since v1:
> - follow suggestion from Russell King to keep regulator handling local
>   to the rockchip implementation for the time being and only generalize
>   when a real second implementation needs regulator handling
> 
>  .../devicetree/bindings/drm/bridge/dw_hdmi.txt |  5 
>  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 32
> +- 2 files changed, 36 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt index
> a905c14..bb74640 100644
> --- a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> +++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt
> @@ -22,6 +22,11 @@ Optional properties
>  - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
>  - clocks, clock-names: phandle to the HDMI CEC clock, name should be "cec"
> 
> +Optional supplies:
> +rockchip,rk3288-dw-hdmi handles two optional power supplies:
> +- vp-supply: 1.0V power supply
> +- vph-supply: 1.8V power supply
> +
>  Example:
>   hdmi: hdmi at 012 {
>   compatible = "fsl,imx6q-hdmi";
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index d236faa..647a240 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
> @@ -11,6 +11,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -28,6 +29,9 @@ struct rockchip_hdmi {
>   struct device *dev;
>   struct regmap *regmap;
>   struct drm_encoder encoder;
> + struct regulator_bulk_data supplies[2];
> + int nsupplies;
> + bool supplies_enabled;
>  };
> 
>  #define to_rockchip_hdmi(x)  container_of(x, struct rockchip_hdmi, x)
> @@ -179,6 +183,12 @@ static struct drm_encoder_funcs
> dw_hdmi_rockchip_encoder_funcs = {
> 
>  static void dw_hdmi_rockchip_encoder_disable(struct drm_encoder *encoder)
>  {
> + struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
> +
> + if (hdmi->nsupplies > 0 && hdmi->supplies_enabled) {
> + regulator_bulk_disable(hdmi->nsupplies, hdmi->supplies);
> + hdmi->supplies_enabled = false;
> + }
>  }
> 
>  static bool
> @@ -199,7 +209,16 @@ static void dw_hdmi_rockchip_encoder_commit(struct
> drm_encoder *encoder) {
>   struct rockchip_hdmi *hdmi = to_rockchip_hdmi(encoder);
>   u32 val;
> - int mux;
> + int mux, ret;
> +
> + if (hdmi->nsupplies > 0 && !hdmi->supplies_enabled) {
> + ret = regulator_bulk_enable(hdmi->nsupplies, hdmi->supplies);
> + if (ret) {
> + dev_err(hdmi->dev, "could not enable hdmi analog 
> supplies\n");
> + return;
> + }
> + hdmi->supplies_enabled = true;
> + }
> 
>   mux = rockchip_drm_encoder_get_mux_id(hdmi->dev->of_node, encoder);
>   if (mux)
> @@ -275,6 +294,17 @@ static int dw_hdmi_rockchip_bind(struct device *dev,
> struct device *master, if (!iores)
>   return -ENXIO;
> 
> + hdmi->supplies[0].supply = "vp";
> + hdmi->supplies[1].supply = "vph";
> + hdmi->nsupplies = 2;
> +
> + ret = devm_regulator_bulk_get(hdmi->dev,
> +   hdmi->nsupplies, hdmi->supplies);
> + if (ret == -EPROBE_DEFER)
> + return ret;
> + if (ret)
> + hdmi->nsupplies = 0;
> +
>   platform_set_drvdata(pdev, hdmi);
> 
>   encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);



[PATCH 03/11] drm: add driver for simple vga encoders

2015-03-23 Thread Heiko Stuebner
Hi Laurent,

Am Samstag, 28. Februar 2015, 01:42:45 schrieb Heiko Stübner:
> thanks for the comments
> 
> Am Donnerstag, 26. Februar 2015, 20:33:33 schrieb Laurent Pinchart:
> > On Saturday 31 January 2015 17:32:56 Heiko Stuebner wrote:
> > > There exist simple vga encoders without any type of management interface
> > > and just maybe a simple gpio for turning it on or off. Examples for
> > > these
> > > are the Analog Devices ADV7123, Chipsea CS7123 or Micronas SDA7123.
> > > 
> > > Add a generic encoder driver for those that can be used by drm drivers
> > > using the component framework.
> > 
> > The rcar-du driver already handles the adi,adv7123 compatible string used
> > by this driver. A generic driver is in my opinion a very good idea, but
> > we can't break the existing support. Porting the rcar-du driver to the
> > component model is needed.
> 
> is this in someones plans already? Because I'm still having trouble
> understanding parts of the rockchip driver sometimes, so feel in no way
> qualified to try to get this tackled in some reasonable timeframe :-)

currently my idea is to simply do something like the following for this :-)

static const struct of_device_id rcar_du_of_table[] = {
{ .compatible = "renesas,du-r8a7779" },
{ .compatible = "renesas,du-r8a7790" },
{ .compatible = "renesas,du-r8a7791" },
{ }
};

static int __init vga_encoder_init(void)
{
struct device_node *np;

/*
 * Play nice with rcar-du that is having its own implementation
 * of the adv7123 binding implementation and is not yet
 * converted to using components.
 */
np = of_find_matching_node(NULL, rcar_du_of_table);
if (np) {
of_node_put(np);
return 0;
}

return platform_driver_register(_encoder_driver);
}


slightly similar to what some iommus do


> > > Signed-off-by: Heiko Stuebner 
> > > ---
> > > 
> > >  drivers/gpu/drm/i2c/Kconfig  |   6 +
> > >  drivers/gpu/drm/i2c/Makefile |   2 +
> > >  drivers/gpu/drm/i2c/vga-simple.c | 325
> > >  
> > 
> > drivers/gpu/drm/i2c/ feels wrong for a platform device.
> 
> yep, i2c probably being the wrong place was one of the caveats in the cover
> letter and I was hoping some more seasoned drm people could suggest where
> this should live after all.
> 
> As your comments further down suggest that we might introduce some different
> components, simply congregate them in a "components" subdir or something
> splitting them more?

so does a "components" subdir look reasonable?


> > >  3 files changed, 333 insertions(+)
> > >  create mode 100644 drivers/gpu/drm/i2c/vga-simple.c
> > > 
> > > diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
> > > index 22c7ed6..319f2cb 100644
> > > --- a/drivers/gpu/drm/i2c/Kconfig
> > > +++ b/drivers/gpu/drm/i2c/Kconfig
> > > @@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
> > > 
> > >   help
> > >   
> > > Support for NXP Semiconductors TDA998X HDMI encoders.
> > > 
> > > +config DRM_VGA_SIMPLE
> > > + tristate "Generic simple vga encoder"
> > > + help
> > > +   Support for vga encoder chips without any special settings
> > > +   and at most a power-control gpio.
> > > +
> > > 
> > >  endmenu
> > > 
> > > diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
> > > index 2c72eb5..858961f 100644
> > > --- a/drivers/gpu/drm/i2c/Makefile
> > > +++ b/drivers/gpu/drm/i2c/Makefile
> > > @@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o
> > > 
> > >  tda998x-y := tda998x_drv.o
> > >  obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
> > > 
> > > +
> > > +obj-$(CONFIG_DRM_VGA_SIMPLE) += vga-simple.o
> > > diff --git a/drivers/gpu/drm/i2c/vga-simple.c
> > > b/drivers/gpu/drm/i2c/vga-simple.c new file mode 100644
> > > index 000..bb9d19c
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/i2c/vga-simple.c
> > > @@ -0,0 +1,325 @@
> > > +/*
> > > + * Simple vga encoder driver
> > > + *
> > > + * Copyright (C) 2014 Heiko Stuebner 
> > > + *
> > > + * This software is licensed under the terms of the GNU General Public
> > > + * License version 2, as published by the Free Software Foundation, and
> > > + * may be copied, distributed, and 

[RFC PATCH v3 1/4] drm: Introduce generic probe function for component based masters.

2015-11-09 Thread Heiko Stuebner
Hi Liviu,

Am Montag, 9. November 2015, 12:07:20 schrieb Liviu Dudau:
> On Mon, Nov 09, 2015 at 12:03:35PM +, Russell King - ARM Linux wrote:
> > On Mon, Nov 09, 2015 at 11:57:27AM +, Liviu Dudau wrote:
> > > Meanwhile, what is your suggestion regarding the patchset. I've seen 
> > > David has
> > > sent Linus a pull request for 4.4-rc1 that includes it. Should we send a
> > > revert for rockchip commit and then patch later the function?
> > 
> > It definitely needs to be fixed, and I'd suggest its early enough in the
> > -rc cycle (which hasn't begun yet) to simply fix drm_of_component_probe()
> > to take two compare functions.
> 
> I still don't have a Rockchip board to test the patch, so I need to find out
> someone willing to test them. Mark?

I of course also have a plethora of rockchip boards, so can test stuff
as well.


Heiko



[PATCH 1/2] drm/rockchip: create the fake mmap offset during gem creation

2015-11-09 Thread Heiko Stuebner
Similarly to the equivalent exynos-fix in commit 48cf53f4343a
("drm/exynos: create a fake mmap offset with gem creation") the rockchip
drm driver also calls the drm_gem_create_mmap_offset fake-offset creation
on every invocation of rockchip_gem_dumb_map_offset.

Move that to the creation of the gem to only create that offset once.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index 4ab2f20..e50d113 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -126,8 +126,14 @@ struct rockchip_gem_object *
if (ret)
goto err_free_rk_obj;

+   ret = drm_gem_create_mmap_offset(obj);
+   if (ret)
+   goto err_free_buf;
+
return rk_obj;

+err_free_buf:
+   rockchip_gem_free_buf(rk_obj);
 err_free_rk_obj:
kfree(rk_obj);
return ERR_PTR(ret);
@@ -196,7 +202,6 @@ int rockchip_gem_dumb_map_offset(struct drm_file *file_priv,
 uint64_t *offset)
 {
struct drm_gem_object *obj;
-   int ret;

obj = drm_gem_object_lookup(dev, file_priv, handle);
if (!obj) {
@@ -204,14 +209,9 @@ int rockchip_gem_dumb_map_offset(struct drm_file 
*file_priv,
return -EINVAL;
}

-   ret = drm_gem_create_mmap_offset(obj);
-   if (ret)
-   goto out;
-
*offset = drm_vma_node_offset_addr(>vma_node);
DRM_DEBUG_KMS("offset = 0x%llx\n", *offset);

-out:
drm_gem_object_unreference_unlocked(obj);

return 0;
-- 
2.6.2




[PATCH 2/2] drm/rockchip: unset pgoff when mmap'ing gems

2015-11-09 Thread Heiko Stuebner
Commit 371f0f085f629 ("ARM: 8426/1: dma-mapping: add missing range check
 in dma_mmap()") introduced offset-checking for mappings, which collides
with the fake-offset the drm sets for gems.

Other drm-drivers set this offset to 0 before doing the mapping, so
this looks like the correct way to go for rockchip as well.

Fixes: 371f0f085f629 ("ARM: 8426/1: dma-mapping: add missing range check in 
dma_mmap()")
Signed-off-by: Heiko Stuebner 
---
This patch is definitly necessary to keep the rockchip-drm working
with kernel 4.4.

 drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
index e50d113..e9bc188 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
@@ -68,6 +68,7 @@ static int rockchip_drm_gem_object_mmap(struct drm_gem_object 
*obj,
 * VM_PFNMAP flag that was set by drm_gem_mmap_obj()/drm_gem_mmap().
 */
vma->vm_flags &= ~VM_PFNMAP;
+   vma->vm_pgoff = 0;

ret = dma_mmap_attrs(drm->dev, vma, rk_obj->kvaddr, rk_obj->dma_addr,
 obj->size, _obj->dma_attrs);
-- 
2.6.2




[PATCH 1/2] drm/rockchip: create the fake mmap offset during gem creation

2015-11-10 Thread Heiko Stuebner
Hi Mark,

Am Dienstag, 10. November 2015, 14:17:43 schrieb Mark yao:
> Hi Heiko
>   I don't think this patch is needed for rockchip drm, since 
> rockchip drm only use kms.
> I saw the discussion about ("drm/exynos: create a fake mmap offset with 
> gem creation"),
> Inki said that: "This patch makes drm_gem_create_mmap_offset to be 
> called even in case of
> not using dumb* interfaces. I.e., exynos_drm_gem_create_ioctl -> 
> exynos_drm_gem_mmap"
> 
> So I think this patch doesn't make sense for rockchip drm.

ok :-) . I'm not that knowledgable when it comes to drm and just found that 
similar change in exynos while searching for the dma issue.

So we can drop this patch and you could just merge patch2 as well as

[RESEND PATCH] drm/rockchip: vop: Correct enabled clocks during setup

from Sjoerd and send these two to Dave as fixes for 4.4?


Thanks
Heiko

> 
> 
> On 2015年11月10日 03:50, Heiko Stuebner wrote:
> > Similarly to the equivalent exynos-fix in commit 48cf53f4343a
> > ("drm/exynos: create a fake mmap offset with gem creation") the rockchip
> > drm driver also calls the drm_gem_create_mmap_offset fake-offset creation
> > on every invocation of rockchip_gem_dumb_map_offset.
> >
> > Move that to the creation of the gem to only create that offset once.
> >
> > Signed-off-by: Heiko Stuebner 
> > ---
> >   drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 12 ++--
> >   1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> > index 4ab2f20..e50d113 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> > @@ -126,8 +126,14 @@ struct rockchip_gem_object *
> > if (ret)
> > goto err_free_rk_obj;
> >   
> > +   ret = drm_gem_create_mmap_offset(obj);
> > +   if (ret)
> > +   goto err_free_buf;
> > +
> > return rk_obj;
> >   
> > +err_free_buf:
> > +   rockchip_gem_free_buf(rk_obj);
> >   err_free_rk_obj:
> > kfree(rk_obj);
> > return ERR_PTR(ret);
> > @@ -196,7 +202,6 @@ int rockchip_gem_dumb_map_offset(struct drm_file 
*file_priv,
> >  uint64_t *offset)
> >   {
> > struct drm_gem_object *obj;
> > -   int ret;
> >   
> > obj = drm_gem_object_lookup(dev, file_priv, handle);
> > if (!obj) {
> > @@ -204,14 +209,9 @@ int rockchip_gem_dumb_map_offset(struct drm_file 
*file_priv,
> > return -EINVAL;
> > }
> >   
> > -   ret = drm_gem_create_mmap_offset(obj);
> > -   if (ret)
> > -   goto out;
> > -
> > *offset = drm_vma_node_offset_addr(>vma_node);
> > DRM_DEBUG_KMS("offset = 0x%llx\n", *offset);
> >   
> > -out:
> > drm_gem_object_unreference_unlocked(obj);
> >   
> > return 0;
> 
> 
> 



[PATCH 1/2] drm/rockchip: create the fake mmap offset during gem creation

2015-11-10 Thread Heiko Stuebner
Am Dienstag, 10. November 2015, 17:26:10 schrieb Mark yao:
> On 2015年11月10日 14:46, Heiko Stuebner wrote:
> > Hi Mark,
> >
> > Am Dienstag, 10. November 2015, 14:17:43 schrieb Mark yao:
> >> Hi Heiko
> >>I don't think this patch is needed for rockchip drm, since
> >> rockchip drm only use kms.
> >> I saw the discussion about ("drm/exynos: create a fake mmap offset with
> >> gem creation"),
> >> Inki said that: "This patch makes drm_gem_create_mmap_offset to be
> >> called even in case of
> >> not using dumb* interfaces. I.e., exynos_drm_gem_create_ioctl ->
> >> exynos_drm_gem_mmap"
> >>
> >> So I think this patch doesn't make sense for rockchip drm.
> > ok :-) . I'm not that knowledgable when it comes to drm and just found that
> > similar change in exynos while searching for the dma issue.
> >
> > So we can drop this patch and you could just merge patch2 as well as
> >
> > [RESEND PATCH] drm/rockchip: vop: Correct enabled clocks during setup
> >
> > from Sjoerd and send these two to Dave as fixes for 4.4?
> >
> Right, that patch is needed, and also I want to land two patch:
>[RESEND PATCH] drm/rockchip: import dma_buf to gem

the import should go into 4.5 though (as it is a new feature), while
the other three are fixes that should go into the current 4.4

>[PATCH] Revert "drm/rockchip: Convert the probe function to the 
> generic drm_of_component_probe()"
> 
> > Thanks
> > Heiko
> >
> >>
> >> On 2015年11月10日 03:50, Heiko Stuebner wrote:
> >>> Similarly to the equivalent exynos-fix in commit 48cf53f4343a
> >>> ("drm/exynos: create a fake mmap offset with gem creation") the rockchip
> >>> drm driver also calls the drm_gem_create_mmap_offset fake-offset creation
> >>> on every invocation of rockchip_gem_dumb_map_offset.
> >>>
> >>> Move that to the creation of the gem to only create that offset once.
> >>>
> >>> Signed-off-by: Heiko Stuebner 
> >>> ---
> >>>drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 12 ++--
> >>>1 file changed, 6 insertions(+), 6 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> > b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> >>> index 4ab2f20..e50d113 100644
> >>> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> >>> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> >>> @@ -126,8 +126,14 @@ struct rockchip_gem_object *
> >>>   if (ret)
> >>>   goto err_free_rk_obj;
> >>>
> >>> + ret = drm_gem_create_mmap_offset(obj);
> >>> + if (ret)
> >>> + goto err_free_buf;
> >>> +
> >>>   return rk_obj;
> >>>
> >>> +err_free_buf:
> >>> + rockchip_gem_free_buf(rk_obj);
> >>>err_free_rk_obj:
> >>>   kfree(rk_obj);
> >>>   return ERR_PTR(ret);
> >>> @@ -196,7 +202,6 @@ int rockchip_gem_dumb_map_offset(struct drm_file
> > *file_priv,
> >>>uint64_t *offset)
> >>>{
> >>>   struct drm_gem_object *obj;
> >>> - int ret;
> >>>
> >>>   obj = drm_gem_object_lookup(dev, file_priv, handle);
> >>>   if (!obj) {
> >>> @@ -204,14 +209,9 @@ int rockchip_gem_dumb_map_offset(struct drm_file
> > *file_priv,
> >>>   return -EINVAL;
> >>>   }
> >>>
> >>> - ret = drm_gem_create_mmap_offset(obj);
> >>> - if (ret)
> >>> - goto out;
> >>> -
> >>>   *offset = drm_vma_node_offset_addr(>vma_node);
> >>>   DRM_DEBUG_KMS("offset = 0x%llx\n", *offset);
> >>>
> >>> -out:
> >>>   drm_gem_object_unreference_unlocked(obj);
> >>>
> >>>   return 0;
> >>
> >>
> >
> >
> >
> 
> 
> 



[PATCH] drm/rockchip: vop: fix window origin calculation

2015-11-10 Thread Heiko Stuebner
Am Dienstag, 10. November 2015, 17:59:10 schrieb Mark Yao:
> From: Dominik Behr 
> 
> VOP_WINx_DSP_ST does not require subtracting 1 from the values written to
> it. It actually causes the screen to be shifted by one pixel.
> 
> Signed-off-by: Mark Yao 

funny I never noticed that shift, but now that you mention it, I see it too
on my Chromebook and the patch fixes this. I've also looked up the
matching data in the TRM, so

Reviewed-by: Heiko Stuebner 
Tested-by: Heiko Stuebner 


Heiko


[PATCH] drm/rockchip: vop: fix window origin calculation

2015-11-10 Thread Heiko Stuebner
Am Dienstag, 10. November 2015, 17:59:10 schrieb Mark Yao:
> From: Dominik Behr 
> 
> VOP_WINx_DSP_ST does not require subtracting 1 from the values written to
> it. It actually causes the screen to be shifted by one pixel.
> 
> Signed-off-by: Mark Yao 

One thing I noticed, the original patch [0] had a Signed-off from
Dominik already and you should keep that as he is the author, and then
add your Signed-off below that, as you are the submitter,

So it would look like:

Signed-off-by: Dominik Behr 
Signed-off-by: Mark Yao 


That may not need a repost, but should probably be corrected when applying
the patch.

Heiko

[0] https://chromium-review.googlesource.com/#/c/233251/


> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
> b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 48719df..4730ae4 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -959,8 +959,8 @@ static int vop_update_plane_event(struct drm_plane *plane,
>   val = (dest.y2 - dest.y1 - 1) << 16;
>   val |= (dest.x2 - dest.x1 - 1) & 0x;
>   VOP_WIN_SET(vop, win, dsp_info, val);
> - val = (dsp_sty - 1) << 16;
> - val |= (dsp_stx - 1) & 0x;
> + val = dsp_sty << 16;
> + val |= dsp_stx & 0x;
>   VOP_WIN_SET(vop, win, dsp_st, val);
>   VOP_WIN_SET(vop, win, rb_swap, rb_swap);
>  
> 



[PATCH v8 10/17] phy: Add driver for rockchip Display Port PHY

2015-11-12 Thread Heiko Stuebner
Hi Yakir,

Am Mittwoch, 28. Oktober 2015, 16:30:33 schrieb Yakir Yang:
> Add phy driver for the Rockchip DisplayPort PHY module. This
> is required to get DisplayPort working in Rockchip SoCs.
> 
> Reviewed-by: Heiko Stuebner 
> Signed-off-by: Yakir Yang 

a general thing I have been pondering, we should probably move the
dp-phy under the GRF. Similar to the new power-domains being
a full child of the PMU, the dp-phy is a full child-device of the GRF.

That would include:
- making the GRF a simply-mfd (just adding that property)
- moving the dts node under it
- making the driver get its regmap from its parent (just like
  drivers/soc/rockchip/pm_domains.c does)


The usbphy is another example of that, and I think I'll be moving it
below the grf as well.


Heiko

> ---
> Changes in v8:
> - Fix the mixed spacers on macro definitions. (Heiko)
> - Remove the unnecessary empty line after clk_prepare_enable. (Heiko)
> 
> Changes in v7:
> - Simply the commit message. (Kishon)
> - Symmetrical enable/disbale the phy clock and power. (Kishon)
> 
> Changes in v6: None
> Changes in v5:
> - Remove "reg" DT property, cause driver could poweron/poweroff phy via
>   the exist "grf" syscon already. And rename the example DT node from
>   "edp_phy: phy at ff770274" to "edp_phy: edp-phy" directly. (Heiko)
> - Add deivce_node at the front of driver, update phy_ops type from "static
>   struct" to "static const struct". And correct the input paramters of
>   devm_phy_create() interfaces. (Heiko)
> 
> Changes in v4:
> - Add commit message, and remove the redundant rockchip_dp_phy_init()
>   function, move those code to probe() method. And remove driver .owner
>   number. (Kishon)
> 
> Changes in v3:
> - Suggest, add rockchip dp phy driver, collect the phy clocks and
>   power control. (Heiko)
> 
> Changes in v2: None
> 
>  drivers/phy/Kconfig   |   7 ++
>  drivers/phy/Makefile  |   1 +
>  drivers/phy/phy-rockchip-dp.c | 155 
> ++
>  3 files changed, 163 insertions(+)
>  create mode 100644 drivers/phy/phy-rockchip-dp.c
> 
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 7eb5859d..7355819 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -319,6 +319,13 @@ config PHY_ROCKCHIP_USB
>   help
> Enable this to support the Rockchip USB 2.0 PHY.
>  
> +config PHY_ROCKCHIP_DP
> + tristate "Rockchip Display Port PHY Driver"
> + depends on ARCH_ROCKCHIP && OF
> + select GENERIC_PHY
> + help
> +   Enable this to support the Rockchip Display Port PHY.
> +
>  config PHY_ST_SPEAR1310_MIPHY
>   tristate "ST SPEAR1310-MIPHY driver"
>   select GENERIC_PHY
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 075db1a..b1700cd 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -35,6 +35,7 @@ phy-exynos-usb2-$(CONFIG_PHY_S5PV210_USB2)  += 
> phy-s5pv210-usb2.o
>  obj-$(CONFIG_PHY_EXYNOS5_USBDRD) += phy-exynos5-usbdrd.o
>  obj-$(CONFIG_PHY_QCOM_APQ8064_SATA)  += phy-qcom-apq8064-sata.o
>  obj-$(CONFIG_PHY_ROCKCHIP_USB) += phy-rockchip-usb.o
> +obj-$(CONFIG_PHY_ROCKCHIP_DP)+= phy-rockchip-dp.o
>  obj-$(CONFIG_PHY_QCOM_IPQ806X_SATA)  += phy-qcom-ipq806x-sata.o
>  obj-$(CONFIG_PHY_ST_SPEAR1310_MIPHY) += phy-spear1310-miphy.o
>  obj-$(CONFIG_PHY_ST_SPEAR1340_MIPHY) += phy-spear1340-miphy.o
> diff --git a/drivers/phy/phy-rockchip-dp.c b/drivers/phy/phy-rockchip-dp.c
> new file mode 100644
> index 000..c82c22f
> --- /dev/null
> +++ b/drivers/phy/phy-rockchip-dp.c
> @@ -0,0 +1,155 @@
> +/*
> + * Rockchip DP PHY driver
> + *
> + * Copyright (C) 2015 FuZhou Rockchip Co., Ltd.
> + * Author: Yakir Yang <ykk@@rock-chips.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define GRF_SOC_CON12   0x0274
> +
> +#define GRF_EDP_REF_CLK_SEL_INTER_HIWORD_MASK   BIT(4)
> +#define GRF_EDP_REF_CLK_SEL_INTER   BIT(4)
> +
> +#define GRF_EDP_PHY_SIDDQ_HIWORD_MASK   BIT(21)
> +#define GRF_EDP_PHY_SIDDQ_ON0
> +#define GRF_EDP_PHY_SIDDQ_OFF   BIT(5)
> +
> +struct rockchip_dp_phy {
> + struct device  *dev;
> + struct regmap  *grf;
> + struct clk *phy_24m;

[PATCH v8 10/17] phy: Add driver for rockchip Display Port PHY

2015-11-12 Thread Heiko Stuebner
Hi Yakir,

Am Donnerstag, 12. November 2015, 10:36:51 schrieb Yakir Yang:
> On 11/12/2015 07:23 AM, Heiko Stuebner wrote:
> > Am Mittwoch, 28. Oktober 2015, 16:30:33 schrieb Yakir Yang:
> >> Add phy driver for the Rockchip DisplayPort PHY module. This
> >> is required to get DisplayPort working in Rockchip SoCs.
> >>
> >> Reviewed-by: Heiko Stuebner 
> >> Signed-off-by: Yakir Yang 
> > a general thing I have been pondering, we should probably move the
> > dp-phy under the GRF. Similar to the new power-domains being
> > a full child of the PMU, the dp-phy is a full child-device of the GRF.
> >
> > That would include:
> > - making the GRF a simply-mfd (just adding that property)
> > - moving the dts node under it
> > - making the driver get its regmap from its parent (just like
> >drivers/soc/rockchip/pm_domains.c does)
> >
> >
> > The usbphy is another example of that, and I think I'll be moving it
> > below the grf as well.
> 
> Sounds great, pretty cool to collect those scattered "GRF" driver,
> if you want me do some rebase on your changes, please note me :)

nope, that won't be necessary ... I'm currently doing some usbphy
reorganization/cleanups for 4.5 first, so to keep conflicts down I'll do
the move probably for 4.6. As I expect your edp series to make it into
4.5 we'll also not have conflicts here then :-)


Heiko


[RFC PATCH v1 2/2] dt-bindings: add document for Innosilicon HDMI on Rockchip platform

2015-11-21 Thread Heiko Stuebner
Hi Yakir,

Am Mittwoch, 11. November 2015, 15:47:32 schrieb Yakir Yang:
> Signed-off-by: Yakir Yang 
> ---
>  .../display/rockchip/inno_hdmi-rockchip.txt| 50 
> ++
>  1 file changed, 50 insertions(+)
>  create mode 100644 
> Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt
> 
> diff --git 
> a/Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt 
> b/Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt
> new file mode 100644
> index 000..1898408
> --- /dev/null
> +++ 
> b/Documentation/devicetree/bindings/display/rockchip/inno_hdmi-rockchip.txt
> @@ -0,0 +1,50 @@
> +Rockchip specific extensions to the Innosilicon HDMI
> +
> +
> +Required properties:
> +- compatible:
> + "rockchip,rk3036-dw-hdmi";

should be "rockchip,rk3036-inno-hdmi"; instead I guess


Heiko


[GIT PULL] drm/rockchip: fixes

2015-11-21 Thread Heiko Stuebner
Hi Mark,
Am Mittwoch, 11. November 2015, 08:56:51 schrieb Mark yao:
>   Here are some fixes for drm/rockchip:
>  drm/rockchip can't work now, we need the patch
>  Revert "drm/rockchip: Convert the probe function to the 
> generic drm_of_component_probe()"
>  and other three fixes are also needed.
> 
>   I'd like you can land them.
> 
> The following changes since commit 
> 816d2206f0f9953ca854e4ff1a2749a5cbd62715:
> 
>Merge tag 'drm-intel-next-fixes-2015-11-06' of 
> git://anongit.freedesktop.org/drm-intel into drm-next (2015-11-07 
> 17:16:59 +1000)
> 
> are available in the git repository at:
> 
> 
> https://github.com/markyzq/kernel-drm-rockchip.git drm-rockchip-2015-11-11
> 
> for you to fetch changes up to 55ac58b5d27a35b8caaa9bd07eb1d2899473130c:
> 
>drm/rockchip: vop: fix window origin calculation (2015-11-11 08:36:18 
> +0800)
> 
> 
> Dominik Behr (1):
>drm/rockchip: vop: fix window origin calculation
> 
> Heiko Stuebner (1):
>drm/rockchip: unset pgoff when mmap'ing gems
> 
> Mark Yao (1):
>Revert "drm/rockchip: Convert the probe function to the generic 
> drm_of_component_probe()"

Dave already applied this patch by himself, back before -rc1 was released,
so I guess you should re-do you branch (and pull request) based on
either 4.4-rc1 or Dave's drm-fixes branch.


Heiko



[PATCH 03/11] drm: add driver for simple vga encoders

2015-01-31 Thread Heiko Stuebner
There exist simple vga encoders without any type of management interface
and just maybe a simple gpio for turning it on or off. Examples for these
are the Analog Devices ADV7123, Chipsea CS7123 or Micronas SDA7123.

Add a generic encoder driver for those that can be used by drm drivers
using the component framework.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/i2c/Kconfig  |   6 +
 drivers/gpu/drm/i2c/Makefile |   2 +
 drivers/gpu/drm/i2c/vga-simple.c | 325 +++
 3 files changed, 333 insertions(+)
 create mode 100644 drivers/gpu/drm/i2c/vga-simple.c

diff --git a/drivers/gpu/drm/i2c/Kconfig b/drivers/gpu/drm/i2c/Kconfig
index 22c7ed6..319f2cb 100644
--- a/drivers/gpu/drm/i2c/Kconfig
+++ b/drivers/gpu/drm/i2c/Kconfig
@@ -31,4 +31,10 @@ config DRM_I2C_NXP_TDA998X
help
  Support for NXP Semiconductors TDA998X HDMI encoders.

+config DRM_VGA_SIMPLE
+   tristate "Generic simple vga encoder"
+   help
+ Support for vga encoder chips without any special settings
+ and at most a power-control gpio.
+
 endmenu
diff --git a/drivers/gpu/drm/i2c/Makefile b/drivers/gpu/drm/i2c/Makefile
index 2c72eb5..858961f 100644
--- a/drivers/gpu/drm/i2c/Makefile
+++ b/drivers/gpu/drm/i2c/Makefile
@@ -10,3 +10,5 @@ obj-$(CONFIG_DRM_I2C_SIL164) += sil164.o

 tda998x-y := tda998x_drv.o
 obj-$(CONFIG_DRM_I2C_NXP_TDA998X) += tda998x.o
+
+obj-$(CONFIG_DRM_VGA_SIMPLE) += vga-simple.o
diff --git a/drivers/gpu/drm/i2c/vga-simple.c b/drivers/gpu/drm/i2c/vga-simple.c
new file mode 100644
index 000..bb9d19c
--- /dev/null
+++ b/drivers/gpu/drm/i2c/vga-simple.c
@@ -0,0 +1,325 @@
+/*
+ * Simple vga encoder driver
+ *
+ * Copyright (C) 2014 Heiko Stuebner 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define connector_to_vga_simple(x) container_of(x, struct vga_simple, 
connector)
+#define encoder_to_vga_simple(x) container_of(x, struct vga_simple, encoder)
+
+struct vga_simple {
+   struct drm_connector connector;
+   struct drm_encoder encoder;
+
+   struct device *dev;
+   struct i2c_adapter *ddc;
+
+   struct regulator *vaa_reg;
+   struct gpio_desc *enable_gpio;
+
+   struct mutex enable_lock;
+   bool enabled;
+};
+
+/*
+ * Connector functions
+ */
+
+enum drm_connector_status vga_simple_detect(struct drm_connector *connector,
+   bool force)
+{
+   struct vga_simple *vga = connector_to_vga_simple(connector);
+
+   if (!vga->ddc)
+   return connector_status_unknown;
+
+   if (drm_probe_ddc(vga->ddc))
+   return connector_status_connected;
+
+   return connector_status_disconnected;
+}
+
+void vga_simple_connector_destroy(struct drm_connector *connector)
+{
+   drm_connector_unregister(connector);
+   drm_connector_cleanup(connector);
+}
+
+struct drm_connector_funcs vga_simple_connector_funcs = {
+   .dpms = drm_helper_connector_dpms,
+   .fill_modes = drm_helper_probe_single_connector_modes,
+   .detect = vga_simple_detect,
+   .destroy = vga_simple_connector_destroy,
+};
+
+/*
+ * Connector helper functions
+ */
+
+static int vga_simple_connector_get_modes(struct drm_connector *connector)
+{
+   struct vga_simple *vga = connector_to_vga_simple(connector);
+   struct edid *edid;
+   int ret = 0;
+
+   if (!vga->ddc)
+   return 0;
+
+   edid = drm_get_edid(connector, vga->ddc);
+   if (edid) {
+   drm_mode_connector_update_edid_property(connector, edid);
+   ret = drm_add_edid_modes(connector, edid);
+   kfree(edid);
+   }
+
+   return ret;
+}
+
+static int vga_simple_connector_mode_valid(struct drm_connector *connector,
+   struct drm_display_mode *mode)
+{
+   return MODE_OK;
+}
+
+static struct drm_encoder
+*vga_simple_connector_best_encoder(struct drm_connector *connector)
+{
+   struct vga_simple *vga = connector_to_vga_simple(connector);
+
+   return >encoder;
+}
+
+static struct drm_connector_helper_funcs vga_simple_connector_helper_funcs = {
+   .get_modes = vga_simple_connector_get_modes,
+   .best_encoder = vga_simple_connector_best_encoder,
+   .mode_valid = vga_simple_connector_mode_valid,
+};
+
+/*
+ * Encoder functions
+ */
+
+static void vga_simple_encoder_destroy(st

[PATCH 06/11] drm/rockchip: lvds: register a bridge when no panel is set

2015-01-31 Thread Heiko Stuebner
On socs using the lvds components it also controls the use of the
general rgb outputs and must thus be configured for things like
external encoders.

Therefore register a drm_bridge in this case, an encoder can attach to.

Signed-off-by: Heiko Stuebner 
---
 .../devicetree/bindings/video/rockchip-lvds.txt|   8 +-
 drivers/gpu/drm/rockchip/rockchip_lvds.c   | 167 ++---
 2 files changed, 153 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/rockchip-lvds.txt 
b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
index 1616d7e..6ab69b4 100644
--- a/Documentation/devicetree/bindings/video/rockchip-lvds.txt
+++ b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
@@ -15,8 +15,6 @@ Required properties:
 - avdd3v3-supply: regulator phandle for 3.3V analog power

 - rockchip,grf: phandle to the general register files syscon
-- rockchip,panel: phandle to a panel node as described by
-   Documentation/devicetree/bindings/panel/*

 - rockchip,data-mapping: should be "vesa" or "jeida",
This describes how the color bits are laid out in the
@@ -28,6 +26,12 @@ Required properties:
 - ports: contain a port node with endpoint definitions as defined in
Documentation/devicetree/bindings/media/video-interfaces.txt.

+Optional properties:
+- rockchip,panel: phandle to a panel node as described by
+   Documentation/devicetree/bindings/panel/*
+   If no panel reference is set the lvds will act like a
+   bridge for other outbound interfaces.
+
 Example:
lvds: lvds at ff96c000 {
compatible = "rockchip,rk3288-lvds";
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index a01a3cb..46308fb 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -42,6 +42,9 @@
 #define encoder_to_lvds(c) \
container_of(c, struct rockchip_lvds, encoder)

+#define bridge_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, bridge)
+
 /*
  * @grf_offset: offset inside the grf regmap for setting the rockchip lvds
  */
@@ -67,6 +70,7 @@ struct rockchip_lvds {
struct drm_panel *panel;
struct drm_connector connector;
struct drm_encoder encoder;
+   struct drm_bridge bridge;

struct mutex suspend_lock;
int suspend;
@@ -247,11 +251,10 @@ rockchip_lvds_encoder_mode_fixup(struct drm_encoder 
*encoder,
return true;
 }

-static void rockchip_lvds_encoder_mode_set(struct drm_encoder *encoder,
- struct drm_display_mode *mode,
- struct drm_display_mode *adjusted)
+static void rockchip_lvds_mode_set(struct rockchip_lvds *lvds,
+  struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted)
 {
-   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u32 h_bp = mode->htotal - mode->hsync_start;
u8 pin_hsync = (mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
u8 pin_dclk = (mode->flags & DRM_MODE_FLAG_PCSYNC) ? 1 : 0;
@@ -346,32 +349,52 @@ static void rockchip_lvds_encoder_mode_set(struct 
drm_encoder *encoder,
dsb();
 }

-static void rockchip_lvds_encoder_prepare(struct drm_encoder *encoder)
+static void rockchip_lvds_encoder_mode_set(struct drm_encoder *encoder,
+  struct drm_display_mode *mode,
+  struct drm_display_mode *adjusted)
+{
+   rockchip_lvds_mode_set(encoder_to_lvds(encoder), mode, adjusted);
+}
+
+static int rockchip_lvds_set_vop_source(struct rockchip_lvds *lvds,
+   struct drm_encoder *encoder)
 {
-   struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u32 val;
int ret;

-   ret = rockchip_drm_crtc_mode_config(encoder->crtc,
-   lvds->connector.connector_type,
-   ROCKCHIP_OUT_MODE_P888);
-   if (ret < 0) {
-   dev_err(lvds->dev, "Could not set crtc mode config: %d\n", ret);
-   return;
-   }
-
ret = rockchip_drm_encoder_get_mux_id(lvds->dev->of_node, encoder);
if (ret < 0)
-   return;
+   return ret;

if (ret)
val = RK3288_LVDS_SOC_CON6_SEL_VOP_LIT |
  (RK3288_LVDS_SOC_CON6_SEL_VOP_LIT << 16);
else
val = RK3288_LVDS_SOC_CON6_SEL_VOP_LIT << 16;
+
ret = regmap_write(lvds->grf, lvds->soc_data->grf_soc_con6, val);
-   if (ret != 0) {
-   dev_err(lvds->dev, "Could not write to GRF: %d\n", ret);
+   if (ret < 0)
+   return ret;
+
+   return

[PATCH 02/11] drm: add bindings for simple vga encoders

2015-01-31 Thread Heiko Stuebner
Add the necessary devicetree binding document for simple vga encoders.

Signed-off-by: Heiko Stuebner 
---
 .../devicetree/bindings/drm/i2c/vga-simple.txt | 18 ++
 1 file changed, 18 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/i2c/vga-simple.txt

diff --git a/Documentation/devicetree/bindings/drm/i2c/vga-simple.txt 
b/Documentation/devicetree/bindings/drm/i2c/vga-simple.txt
new file mode 100644
index 000..271df9a
--- /dev/null
+++ b/Documentation/devicetree/bindings/drm/i2c/vga-simple.txt
@@ -0,0 +1,18 @@
+Device-Tree bindings for generic vga encoders
+
+Required properties;
+  - compatible: must be "adi,adv7123"
+
+Optional properties:
+  - ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing
+  - enable-gpio: GPIO pin to enable or disable the encoder
+  - vaa-supply: regulator for the analog power supply
+
+Example:
+
+   adv7123: vga-encoder {
+   compatible = "adi,adv7123";
+   ddc-i2c-bus = <>;
+   vaa-supply = <_io>;
+   enable-gpio = < 17 GPIO_ACTIVE_HIGH>;
+   };
-- 
2.1.1



[PATCH 00/11] drm/rockchip: add support for lvds controller and external encoders

2015-01-31 Thread Heiko Stuebner
This series adds support for the lvds encoder present on rk3288 soc and
allows external connectors to use the generic rgb pins.

On the older socs (rk3188, rk3066, etc) these pins where accessible by
anyone, while on the rk3288 the lvds controller controls access to them.

So while on the old socs an external encoder was explicitly connected
to one of the two lcd-controllers, on the rk3288 the lvds in between
can toggle which controller should be the source.

To facilitate this the lvds encoder can use two modes. When a panel is
attached it acts as encoder and without panel it just registers a bridge
that can be used later.

The bridge association to an encoder is done via a rockchip,rgb-bridge
property in the encoder node itself and handled in rockchip_drm_load
to not leak rockchip-specific handling into generic encoder drivers.


As example on how this can work, I've included a driver for simple
(dumb) vga encoders, like the adv7123 (and clones) as used on the
rk3288-firefly board. This same encoder is used on the Rayeager-px2
board but there connected directly to the rgb pins of the rk3066
which will hopefully also be supported in the future.

I've named this currently vga-simply (inspired by panel-simple), because
so far I have found the adv7123 (and two clones) but I guess there will
be more dumb vga encoders around that only differ in minimal things.


Similarly, most of the rk3288-based TV-boxes use a rk1000 i2c tv encoder
connected in a similar way - and again directly connected on the
rk3188-radxarock.


Caveats:
- the i2c subdirectory is probably not the right one for my vga encoder
  so if somebody could suggest where this should live, I'd be very happy
- I'm not sure if I'm abusing some drm-APIs in a wrong way :-)


Heiko Stuebner (9):
  drm/encoder: allow encoders to remember their of_node
  drm: add bindings for simple vga encoders
  drm: add driver for simple vga encoders
  drm/rockchip: lvds: register a bridge when no panel is set
  drm/rockchip: attach rgb bridge to encoders needing it
  drm/rockchip: enable rgb ouput of vops for vga and tv connectors
  ARM: dts: rockchip: add rk3288 lcdc0 pinmux settings
  ARM: dts: rockchip: add rk3288 lvds node
  ARM: dts: rockchip: add vga encoder and enable lvds on rk3288-firefly

Mark Yao (2):
  dt-bindings: Add documentation for rockchip lvds
  drm/rockchip: Add support for Rockchip Soc LVDS

 .../devicetree/bindings/drm/i2c/vga-simple.txt |  18 +
 .../devicetree/bindings/video/rockchip-lvds.txt|  63 ++
 .../devicetree/bindings/video/rockchip-vop.txt |  16 +
 arch/arm/boot/dts/rk3288-firefly.dtsi  |  45 ++
 arch/arm/boot/dts/rk3288.dtsi  |  45 ++
 drivers/gpu/drm/i2c/Kconfig|   6 +
 drivers/gpu/drm/i2c/Makefile   |   2 +
 drivers/gpu/drm/i2c/vga-simple.c   | 325 +
 drivers/gpu/drm/rockchip/Kconfig   |   9 +
 drivers/gpu/drm/rockchip/Makefile  |   1 +
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c|  32 +
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c|   2 +
 drivers/gpu/drm/rockchip/rockchip_lvds.c   | 756 +
 drivers/gpu/drm/rockchip/rockchip_lvds.h   | 107 +++
 include/drm/drm_crtc.h |   4 +
 15 files changed, 1431 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/drm/i2c/vga-simple.txt
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-lvds.txt
 create mode 100644 drivers/gpu/drm/i2c/vga-simple.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

-- 
2.1.1



[PATCH 07/11] drm/rockchip: attach rgb bridge to encoders needing it

2015-01-31 Thread Heiko Stuebner
On SoCs like the rk3288 the lvds controller needs to be configured even for
just providing rgb data to an attached encoder. As internals of the
rockchip drm driver should not leak into the implementation of generic
i2c encoders etc, go through the list of encoders and attach any necessary
rgb bridges when building the drm device in the load callback.

Signed-off-by: Heiko Stuebner 
---
 .../devicetree/bindings/video/rockchip-vop.txt | 16 +++
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c| 32 ++
 2 files changed, 48 insertions(+)

diff --git a/Documentation/devicetree/bindings/video/rockchip-vop.txt 
b/Documentation/devicetree/bindings/video/rockchip-vop.txt
index d15351f..b7762ed 100644
--- a/Documentation/devicetree/bindings/video/rockchip-vop.txt
+++ b/Documentation/devicetree/bindings/video/rockchip-vop.txt
@@ -32,6 +32,11 @@ Required properties:
 - port: A port node with endpoint definitions as defined in
   Documentation/devicetree/bindings/media/video-interfaces.txt.

+Optional properties in encoder nodes:
+- rockchip,rgb-bridge: if a separate controller is regulating access
+   to the rgb output interface it should be referenced
+   in the encoder node.
+
 Example:
 SoC specific DT entry:
vopb: vopb at ff93 {
@@ -56,3 +61,14 @@ SoC specific DT entry:
};
};
};
+
+Additional entries when a rgb-bridge is used:
+
+   lvds: lvds at ff96c000 {
+   ...
+   };
+
+   external-encoder {
+   ...
+   rockchip,rgb-bridge = <>;
+   };
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 30da781..86a3e61 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -130,6 +130,7 @@ static int rockchip_drm_load(struct drm_device *drm_dev, 
unsigned long flags)
struct dma_iommu_mapping *mapping;
struct device *dev = drm_dev->dev;
struct drm_connector *connector;
+   struct drm_encoder *encoder;
int ret;

private = devm_kzalloc(drm_dev->dev, sizeof(*private), GFP_KERNEL);
@@ -173,6 +174,37 @@ static int rockchip_drm_load(struct drm_device *drm_dev, 
unsigned long flags)
goto err_detach_device;

/*
+* Attach rgb bridge to encoders needing it.
+*/
+   list_for_each_entry(encoder, _dev->mode_config.encoder_list, head) {
+   struct device_node *rgb_node;
+
+   if (!encoder->of_node)
+   continue;
+
+   rgb_node = of_parse_phandle(encoder->of_node,
+   "rockchip,rgb-bridge", 0);
+   if (rgb_node) {
+   struct drm_bridge *bridge;
+
+   bridge = of_drm_find_bridge(rgb_node);
+   of_node_put(rgb_node);
+   if (!bridge) {
+   ret = -EPROBE_DEFER;
+   goto err_unbind;
+   }
+
+   encoder->bridge = bridge;
+   bridge->encoder = encoder;
+   ret = drm_bridge_attach(encoder->dev, bridge);
+   if (ret) {
+   DRM_ERROR("Failed to attach bridge to drm\n");
+   goto err_unbind;
+   }
+   }
+   }
+
+   /*
 * All components are now added, we can publish the connector sysfs
 * entries to userspace.  This will generate hotplug events and so
 * userspace will expect to be able to access DRM at this point.
-- 
2.1.1



[PATCH 04/11] dt-bindings: Add documentation for rockchip lvds

2015-01-31 Thread Heiko Stuebner
From: Mark Yao <y...@rock-chips.com>

Add binding documentation for Rockchip SoC LVDS driver.

Signed-off-by: Mark Yao 
Signed-off-by: Heiko Stuebner 
---
 .../devicetree/bindings/video/rockchip-lvds.txt| 59 ++
 1 file changed, 59 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/rockchip-lvds.txt

diff --git a/Documentation/devicetree/bindings/video/rockchip-lvds.txt 
b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
new file mode 100644
index 000..1616d7e
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/rockchip-lvds.txt
@@ -0,0 +1,59 @@
+Rockchip RK3288 LVDS interface
+
+
+Required properties:
+- compatible: "rockchip,rk3288-lvds";
+
+- reg: physical base address of the controller and length
+   of memory mapped region.
+- clocks: must include clock specifiers corresponding to entries in the
+   clock-names property.
+- clock-names: must contain "pclk_lvds"
+
+- avdd1v0-supply: regulator phandle for 1.0V analog power
+- avdd1v8-supply: regulator phandle for 1.8V analog power
+- avdd3v3-supply: regulator phandle for 3.3V analog power
+
+- rockchip,grf: phandle to the general register files syscon
+- rockchip,panel: phandle to a panel node as described by
+   Documentation/devicetree/bindings/panel/*
+
+- rockchip,data-mapping: should be "vesa" or "jeida",
+   This describes how the color bits are laid out in the
+   serialized LVDS signal.
+- rockchip,data-width : should be <18> or <24>;
+- rockchip,output: should be "rgb", "lvds" or "duallvds",
+   This describes the output face.
+
+- ports: contain a port node with endpoint definitions as defined in
+   Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+   lvds: lvds at ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   rockchip,grf = <>;
+   reg = <0xff96c000 0x4000>;
+   clocks = < PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
+   avdd3v3-supply = <_33>;
+   rockchip,panel = <>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+   ports {
+   lvds_in: port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   lvds_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <_out_lvds>;
+   };
+   lvds_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_out_lvds>;
+   };
+   };
+   };
+   };
-- 
2.1.1



[PATCH 05/11] drm/rockchip: Add support for Rockchip Soc LVDS

2015-01-31 Thread Heiko Stuebner
From: Mark Yao <y...@rock-chips.com>

This adds support for Rockchip soc lvds found on rk3288

Signed-off-by: Mark Yao 
Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/rockchip/Kconfig |   9 +
 drivers/gpu/drm/rockchip/Makefile|   1 +
 drivers/gpu/drm/rockchip/rockchip_lvds.c | 629 +++
 drivers/gpu/drm/rockchip/rockchip_lvds.h | 107 ++
 4 files changed, 746 insertions(+)
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.c
 create mode 100644 drivers/gpu/drm/rockchip/rockchip_lvds.h

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 1e84628..23d460b 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -26,3 +26,12 @@ config ROCKCHIP_DW_HDMI
  for the Synopsys DesignWare HDMI driver. If you want to
  enable HDMI on RK3288 based SoC, you should selet this
  option.
+
+config ROCKCHIP_LVDS
+   tristate "Rockchip lvds support"
+   depends on DRM_ROCKCHIP
+   help
+ Choose this option to enable support for Rockchip LVDS controllers.
+ Rockchip rk3288 SoC has LVDS TX Controller can be used, and it
+ support lvds, rgb, dual lvds output mode. say Y to enable its
+ driver.
diff --git a/drivers/gpu/drm/rockchip/Makefile 
b/drivers/gpu/drm/rockchip/Makefile
index f3d8a19..8541304 100644
--- a/drivers/gpu/drm/rockchip/Makefile
+++ b/drivers/gpu/drm/rockchip/Makefile
@@ -6,5 +6,6 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o 
rockchip_drm_fbdev.o \
rockchip_drm_gem.o

 obj-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o
+obj-$(CONFIG_ROCKCHIP_LVDS) += rockchip_lvds.o

 obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o rockchip_drm_vop.o
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c 
b/drivers/gpu/drm/rockchip/rockchip_lvds.c
new file mode 100644
index 000..a01a3cb
--- /dev/null
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -0,0 +1,629 @@
+/*
+ * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
+ * Author:
+ *  Mark Yao 
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "rockchip_drm_drv.h"
+#include "rockchip_drm_vop.h"
+#include "rockchip_lvds.h"
+
+#define DISPLAY_OUTPUT_RGB 0
+#define DISPLAY_OUTPUT_LVDS1
+#define DISPLAY_OUTPUT_DUAL_LVDS   2
+
+#define connector_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, connector)
+
+#define encoder_to_lvds(c) \
+   container_of(c, struct rockchip_lvds, encoder)
+
+/*
+ * @grf_offset: offset inside the grf regmap for setting the rockchip lvds
+ */
+struct rockchip_lvds_soc_data {
+   int grf_soc_con6;
+   int grf_soc_con7;
+};
+
+struct rockchip_lvds {
+   void *base;
+   struct device *dev;
+   void __iomem *regs;
+   struct regmap *grf;
+   struct clk *pclk;
+   const struct rockchip_lvds_soc_data *soc_data;
+
+   struct regulator_bulk_data supplies[3];
+
+   int output;
+   int format;
+
+   struct drm_device *drm_dev;
+   struct drm_panel *panel;
+   struct drm_connector connector;
+   struct drm_encoder encoder;
+
+   struct mutex suspend_lock;
+   int suspend;
+};
+
+static inline void lvds_writel(struct rockchip_lvds *lvds, u32 offset, u32 val)
+{
+   writel_relaxed(val, lvds->regs + offset);
+   writel_relaxed(val, lvds->regs + offset + 0x100);
+}
+
+static inline int lvds_name_to_format(const char *s)
+{
+   if (!s)
+   return -EINVAL;
+
+   if (strncmp(s, "jeida", 6) == 0)
+   return LVDS_FORMAT_JEIDA;
+   else if (strncmp(s, "vesa", 6) == 0)
+   return LVDS_FORMAT_VESA;
+
+   return -EINVAL;
+}
+
+static inline int lvds_name_to_output(const char *s)
+{
+   if (!s)
+   return -EINVAL;
+
+   if (strncmp(s, "rgb", 3) == 0)
+   return DISPLAY_OUTPUT_RGB;
+   else if (strncmp(s, "lvds", 4) == 0)
+   return DISPLAY_OUTPUT_LVDS;
+   else if (strncmp(s, "duallvds", 8) == 0)
+   return DISPLAY_OUTPUT_DUAL_LVDS;
+
+   return -EINVAL;
+}
+
+static int rockchip_lvds_poweron(struct rockchip_lvds *lvds)
+{
+   int ret;
+
+   ret = regulator_bulk_enable(ARRAY_SIZE(lvds->supplies),
+ 

[PATCH 08/11] drm/rockchip: enable rgb ouput of vops for vga and tv connectors

2015-01-31 Thread Heiko Stuebner
The socs itself do not contain encoders for either vga or tv output.
Therefore these will be realized by external components and thus use the
rgb output.

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c 
b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index c0387f7..b744888 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -863,6 +863,8 @@ static int vop_crtc_mode_set(struct drm_crtc *crtc,

switch (vop->connector_type) {
case DRM_MODE_CONNECTOR_LVDS:
+   case DRM_MODE_CONNECTOR_VGA:
+   case DRM_MODE_CONNECTOR_TV:
VOP_CTRL_SET(vop, rgb_en, 1);
break;
case DRM_MODE_CONNECTOR_eDP:
-- 
2.1.1



[PATCH 09/11] ARM: dts: rockchip: add rk3288 lcdc0 pinmux settings

2015-01-31 Thread Heiko Stuebner
Add pinctrl settings for the configurable lcdc0 signals dclk, den, hsync
and vsync. The lcdc0 data pin configuration is not software controlable.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index d771f68..846d961 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -910,6 +910,15 @@
};
};

+   lcdc0 {
+   lcdc0_ctl: lcdc0-ctl {
+   rockchip,pins = <1 24 RK_FUNC_1 
_pull_none>,
+   <1 25 RK_FUNC_1 
_pull_none>,
+   <1 26 RK_FUNC_1 
_pull_none>,
+   <1 27 RK_FUNC_1 
_pull_none>;
+   };
+   };
+
sdmmc {
sdmmc_clk: sdmmc-clk {
rockchip,pins = <6 20 RK_FUNC_1 
_pull_none>;
-- 
2.1.1



[PATCH 01/11] drm/encoder: allow encoders to remember their of_node

2015-01-31 Thread Heiko Stuebner
Add an of_node field to struct drm_encoder to let encoders optionally
remember from which devicetree node they originated.

Signed-off-by: Heiko Stuebner 
---
 include/drm/drm_crtc.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index cc369f3..0448732 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -527,6 +527,7 @@ struct drm_encoder_funcs {
 /**
  * struct drm_encoder - central DRM encoder structure
  * @dev: parent DRM device
+ * @of_node: device node pointer to the bridge
  * @head: list management
  * @base: base KMS object
  * @name: encoder name
@@ -543,6 +544,9 @@ struct drm_encoder_funcs {
  */
 struct drm_encoder {
struct drm_device *dev;
+#ifdef CONFIG_OF
+   struct device_node *of_node;
+#endif
struct list_head head;

struct drm_mode_object base;
-- 
2.1.1



[PATCH 11/11] ARM: dts: rockchip: add vga encoder and enable lvds on rk3288-firefly

2015-01-31 Thread Heiko Stuebner
Add the sda7123 simple vga encoder, connect it to the vop outputs
and enable the lvds controller with the correct settings.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288-firefly.dtsi | 45 +++
 1 file changed, 45 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288-firefly.dtsi 
b/arch/arm/boot/dts/rk3288-firefly.dtsi
index e6f873a..9d383ea 100644
--- a/arch/arm/boot/dts/rk3288-firefly.dtsi
+++ b/arch/arm/boot/dts/rk3288-firefly.dtsi
@@ -159,6 +159,27 @@
regulator-always-on;
vin-supply = <_5v>;
};
+
+   sda7123: vga-encoder {
+   compatible = "adi,adv7123";
+   ddc-i2c-bus = <>;
+   enable-gpio = < 17 GPIO_ACTIVE_HIGH>;
+   rockchip,rgb-bridge = <>;
+   vaa-supply = <_io>;
+
+   vga_in: port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   vga_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <_out_vga>;
+   };
+   vga_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_out_vga>;
+   };
+   };
+   };
 };

  {
@@ -331,6 +352,16 @@
status = "okay";
 };

+ {
+   avdd1v0-supply = <_lcd>;
+   avdd1v8-supply = <_lcd>;
+   avdd3v3-supply = <_33>;
+   rockchip,data-mapping = "jeida";
+   rockchip,data-width = <24>;
+   rockchip,output = "rgb";
+   status = "okay";
+};
+
  {
pcfg_output_high: pcfg-output-high {
output-high;
@@ -477,10 +508,24 @@
status = "okay";
 };

+_out {
+   vopb_out_vga: endpoint at 9 {
+   reg = <9>;
+   remote-endpoint = <_in_vopb>;
+   };
+};
+
  {
status = "okay";
 };

+_out {
+   vopl_out_vga: endpoint at 9 {
+   reg = <9>;
+   remote-endpoint = <_in_vopl>;
+   };
+};
+
 _mmu {
status = "okay";
 };
-- 
2.1.1



[PATCH 10/11] ARM: dts: rockchip: add rk3288 lvds node

2015-01-31 Thread Heiko Stuebner
Add the basic node for the lvds controller of rk3288 and hook it into the
display-subsystem hirarchy.

Signed-off-by: Heiko Stuebner 
---
 arch/arm/boot/dts/rk3288.dtsi | 36 
 1 file changed, 36 insertions(+)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 846d961..d063892 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -615,6 +615,11 @@
reg = <0>;
remote-endpoint = <_in_vopb>;
};
+
+   vopb_out_lvds: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_in_vopb>;
+   };
};
};

@@ -646,6 +651,11 @@
reg = <0>;
remote-endpoint = <_in_vopl>;
};
+
+   vopl_out_lvds: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_in_vopl>;
+   };
};
};

@@ -658,6 +668,32 @@
status = "disabled";
};

+   lvds: lvds at ff96c000 {
+   compatible = "rockchip,rk3288-lvds";
+   reg = <0xff96c000 0x4000>;
+   clocks = < PCLK_LVDS_PHY>;
+   clock-names = "pclk_lvds";
+   pinctrl-names = "default";
+   pinctrl-0 = <_ctl>;
+   rockchip,grf = <>;
+   status = "disabled";
+
+   ports {
+   lvds_in: port {
+   #address-cells = <1>;
+   #size-cells = <0>;
+   lvds_in_vopb: endpoint at 0 {
+   reg = <0>;
+   remote-endpoint = <_out_lvds>;
+   };
+   lvds_in_vopl: endpoint at 1 {
+   reg = <1>;
+   remote-endpoint = <_out_lvds>;
+   };
+   };
+   };
+   };
+
hdmi: hdmi at ff98 {
compatible = "rockchip,rk3288-dw-hdmi";
reg = <0xff98 0x2>;
-- 
2.1.1



Re: [PATCH v3] drm/rockchip: Refactor the component match logic.

2017-03-15 Thread Heiko Stuebner
Am Mittwoch, 15. März 2017, 18:20:47 CET schrieb Jeffy Chen:
> Currently we are adding all components from the dts, if one of their
> drivers been disabled, we would not be able to bring up others.
> 
> Refactor component match logic, follow exynos drm.
> 
> Signed-off-by: Jeffy Chen 
> Reviewed-by: Andrzej Hajda 

This reliably produces null pointer dereference errors in
__platform_driver_register called from rockchip_drm_init
on at least rk3036 and rk3288 (probably more) when applied on top of 
Linus' tree from today. Log attached and Rockchip drm compiled as module.

I'm currently dug into other areas, so hadn't have time to investigate further 
yet.


Heiko^C
U-Boot SPL 2016.11-01442-g5699f71-dirty (Nov 29 2016 - 23:23:39)


U-Boot 2016.11-01442-g5699f71-dirty (Nov 29 2016 - 23:23:39 +0100)

Model: Firefly-RK3288
DRAM:  2 GiB
MMC:   dwmmc@ff0c: 0, dwmmc@ff0f: 1
Card did not respond to voltage select!
*** Warning - MMC init failed, using default environment

In:serial
Out:   serial
Err:   serial
Net:   
Warning: ethernet@ff29 (eth0) using random MAC address - ca:ff:bf:e6:3b:7d
eth0: ethernet@ff29
Hit any key to stop autoboot:  2  1  0 
ethernet@ff29 Waiting for PHY auto negotiation to complete. done
Speed: 100, full duplex
BOOTP broadcast 1
DHCP client bound to address 192.168.140.51 (15 ms)
Using ethernet@ff29 device
TFTP from server 192.168.140.1; our IP address is 192.168.140.51
Filename 'hstuebner/firefly.vmlinuz'.
Load address: 0x400
Loading: *#
	 #
	 #
	 #
	 #
	 #
	 #
	 ##
	 2.6 MiB/s
done
Bytes transferred = 7350967 (702ab7 hex)
## Loading kernel from FIT Image at 0400 ...
   Using 'conf@1' configuration
   Trying 'kernel@1' kernel subimage
 Description:  Mainline kernel
 Type: Kernel Image
 Compression:  uncompressed
 Data Start:   0x04e4
 Data Size:7311440 Bytes = 7 MiB
 Architecture: ARM
 OS:   Linux
 Load Address: 0x0028
 Entry Point:  0x0028
   Verifying Hash Integrity ... OK
## Loading fdt from FIT Image at 0400 ...
   Using 'conf@1' configuration
   Trying 'fdt@1' fdt subimage
 Description:  RK3288-Firefly
 Type: Flat Device Tree
 Compression:  uncompressed
 Data Start:   0x046f91d8
 Data Size:37834 Bytes = 36.9 KiB
 Architecture: ARM
   Verifying Hash Integrity ... OK
   Booting using the fdt blob at 0x46f91d8
   Loading Kernel Image ... OK
   Loading Device Tree to 0fff3000, end 03c9 ... OK

Starting kernel ...

[0.00] Booting Linux on physical CPU 0x500
[0.00] Linux version 4.11.0-rc2-01650-gaa6c2d83ac0f-dirty (hstuebner@phil) (gcc version 6.2.1 20161124 (Debian 6.2.1-5) ) #234 SMP Wed Mar 15 17:42:52 CET 2017
[0.00] CPU: ARMv7 Processor [410fc0d1] revision 1 (ARMv7), cr=10c5387d
[0.00] CPU: div instructions available: patching division code
[0.00] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[0.00] OF: fdt: Machine model: Firefly-RK3288
[0.00] efi: Getting EFI parameters from FDT:
[0.00] efi: UEFI not found.
[0.00] cma: Reserved 64 MiB at 0x7c00
[0.00] Memory policy: Data cache writealloc
[0.00] percpu: Embedded 16 pages/cpu @eef98000 s34380 r8192 d22964 u65536
[0.00] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 522752
[0.00] Kernel command line: earlyprintk console=ttyS2,115200n8 init=/sbin/init ip=dhcp nfsroot=192.168.140.1:/home/devel/nfs/rootfs-firefly root=/dev/nfs rw noinitrd
[0.00] PID hash table entries: 4096 (order: 2, 16384 bytes)
[0.00] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[0.00] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Memory: 1994840K/2097152K available (10240K kernel code, 1192K rwdata, 4012K rodata, 2048K init, 535K bss, 36776K reserved, 65536K cma-reserved, 1245184K highmem)
[0.00] Virtual kernel memory layout:
[0.00] vector  : 0x - 0x1000   (   4 kB)
[0.00] fixmap  : 0xffc0 - 0xfff0   (3072 kB)
[0.00] vmalloc : 0xf080 - 0xff80   ( 240 MB)
[0.00] lowmem  : 0xc000 - 0xf000   ( 768 MB)
[0.00] pkmap   : 0xbfe0 - 0xc000   (   2 MB)
[0.00] modules : 0xbf00 - 0xbfe0   (  14 MB)
[0.00]   .text : 

Re: [PATCH v3] drm/rockchip: Refactor the component match logic.

2017-03-15 Thread Heiko Stuebner
Am Mittwoch, 15. März 2017, 18:00:04 CET schrieb Heiko Stuebner:
> Am Mittwoch, 15. März 2017, 18:20:47 CET schrieb Jeffy Chen:
> > Currently we are adding all components from the dts, if one of their
> > drivers been disabled, we would not be able to bring up others.
> > 
> > Refactor component match logic, follow exynos drm.
> > 
> > Signed-off-by: Jeffy Chen <jeffy.c...@rock-chips.com>
> > Reviewed-by: Andrzej Hajda <a.ha...@samsung.com>
> 
> This reliably produces null pointer dereference errors in
>   __platform_driver_register called from rockchip_drm_init
> on at least rk3036 and rk3288 (probably more) when applied on top of
> Linus' tree from today. Log attached and Rockchip drm compiled as module.
> 
> I'm currently dug into other areas, so hadn't have time to investigate
> further yet.

> +#define DRV_PTR(drv, cond) (IS_ENABLED(cond) ?  : NULL)
> +
> +static struct platform_driver *rockchip_drm_comp_drvs[] = {
> + _platform_driver,
> + DRV_PTR(rockchip_dp_driver, CONFIG_ROCKCHIP_ANALOGIX_DP),
> + DRV_PTR(cdn_dp_driver, CONFIG_ROCKCHIP_CDN_DP),
> + DRV_PTR(dw_hdmi_rockchip_pltfm_driver, CONFIG_ROCKCHIP_DW_HDMI),
> + DRV_PTR(dw_mipi_dsi_driver, CONFIG_ROCKCHIP_DW_MIPI_DSI),
> + DRV_PTR(inno_hdmi_driver, CONFIG_ROCKCHIP_INNO_HDMI),
> +};

[...]

> +static int rockchip_drm_register_drivers(void)
> +{
> + int i, ret;
> +
> + for (i = 0; i < ARRAY_SIZE(rockchip_drm_comp_drvs); i++) {
> + ret = platform_driver_register(rockchip_drm_comp_drvs[i]);
> + if (ret)
> + goto err_unreg;
> + }

This of course won't work in the NULL case, as platform_driver_register always 
dereferences its parameter [0], so you should only call it for the actual non-
null array elements - of course same for unregister.


Heiko

[0] http://lxr.free-electrons.com/source/drivers/base/platform.c#L617

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v4] drm/rockchip: Refactor the component match logic.

2017-03-16 Thread Heiko Stuebner
Hi Jeffy,

Am Donnerstag, 16. März 2017, 10:05:56 CET schrieb Jeffy Chen:
> Currently we are adding all components from the dts, if one of their
> drivers been disabled, we would not be able to bring up others.
> 
> Refactor component match logic, follow exynos drm.
> 
> Signed-off-by: Jeffy Chen 
> Reviewed-by: Andrzej Hajda 

[...]

> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index b360e62..51433da 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -356,34 +356,42 @@ static const struct dev_pm_ops rockchip_drm_pm_ops = {
> rockchip_drm_sys_resume)
>  };
> 
> -static int compare_of(struct device *dev, void *data)
> -{
> - struct device_node *np = data;
> +#define MAX_ROCKCHIP_DRM_DRVS 16
> +static struct platform_driver *rockchip_drm_drvs[MAX_ROCKCHIP_DRM_DRVS];
> +static int rockchip_drm_drvs_cnt;
> 
> - return dev->of_node == np;
> +#define ROCKCHIP_DRM_DRV(drv, cond) { \
> + if (IS_ENABLED(cond)) \
> + rockchip_drm_drvs[rockchip_drm_drvs_cnt++] =  \
>  }

[...]

> +static int __init rockchip_drm_init(void)
> +{
> + int ret;
> +
> + rockchip_drm_drvs_cnt = 0;
> + ROCKCHIP_DRM_DRV(vop_platform_driver, CONFIG_DRM_ROCKCHIP);
> + ROCKCHIP_DRM_DRV(rockchip_dp_driver, CONFIG_ROCKCHIP_ANALOGIX_DP);
> + ROCKCHIP_DRM_DRV(cdn_dp_driver, CONFIG_ROCKCHIP_CDN_DP);
> + ROCKCHIP_DRM_DRV(dw_hdmi_rockchip_pltfm_driver,
> +  CONFIG_ROCKCHIP_DW_HDMI);
> + ROCKCHIP_DRM_DRV(dw_mipi_dsi_driver, CONFIG_ROCKCHIP_DW_MIPI_DSI);
> + ROCKCHIP_DRM_DRV(inno_hdmi_driver, CONFIG_ROCKCHIP_INNO_HDMI);
> +
> + ret = platform_register_drivers(rockchip_drm_drvs,
> + rockchip_drm_drvs_cnt);
> + if (ret)
> + return ret;

With the following config snippet

CONFIG_DRM_ROCKCHIP=m
CONFIG_ROCKCHIP_ANALOGIX_DP=y
# CONFIG_ROCKCHIP_CDN_DP is not set
CONFIG_ROCKCHIP_DW_HDMI=y
CONFIG_ROCKCHIP_DW_MIPI_DSI=y
CONFIG_ROCKCHIP_INNO_HDMI=y

I get these faults on arm32 (1 warning, 1 linker error):

  CC [M]  drivers/gpu/drm/rockchip/rockchip_drm_drv.o
  CC [M]  drivers/gpu/drm/rockchip/rockchip_drm_fb.o
  CC [M]  drivers/gpu/drm/rockchip/rockchip_drm_gem.o
  CC [M]  drivers/gpu/drm/rockchip/rockchip_drm_psr.o
  CC [M]  drivers/gpu/drm/rockchip/rockchip_drm_vop.o
  CC [M]  drivers/gpu/drm/rockchip/rockchip_vop_reg.o
../drivers/gpu/drm/rockchip/rockchip_vop_reg.c:407:31: warning: 
‘vop_platform_driver’ defined but not used [-Wunused-variable]
 static struct platform_driver vop_platform_driver = {
   ^~~
  CC [M]  drivers/gpu/drm/rockchip/rockchip_drm_fbdev.o
  CC [M]  drivers/gpu/drm/rockchip/analogix_dp-rockchip.o
  CC [M]  drivers/gpu/drm/rockchip/dw_hdmi-rockchip.o
  CC [M]  drivers/gpu/drm/rockchip/dw-mipi-dsi.o
  CC [M]  drivers/gpu/drm/rockchip/inno_hdmi.o
  LD [M]  drivers/gpu/drm/rockchip/rockchipdrm.o
  Building modules, stage 2.
  MODPOST 352 modules
ERROR: "vop_platform_driver" [drivers/gpu/drm/rockchip/rockchipdrm.ko] 
undefined!


___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


  1   2   3   4   5   6   7   8   >