Re: [PATCH v10 05/11] drm: bridge/dw_hdmi:split some phy configuration to platform driver
Hi Andy, Nice work on this patch series. Its getting better and better :). On 14/11/14 03:27, Andy Yan wrote: > hdmi phy clock symbol and transmission termination value > can adjust platform specific to get the best SI ^Is this signal integrity? Are these two disjoint features in separate patches? > > also add mode_valid interface for some platform may not support > all the display mode Sounds like another separate patch to me. :) Also, This series is becoming quite large. With major changes and fixes mixed together. Patch 3 splits imx-drm. Patch 4 moves dw-drm out of imx-drm folder. Patch 7 adds binding Patch 9 converts to drm bridge. Can these be placed together easily? And in the start. i.e. patch 1, 2, 3, 4, Then all fixes etc can come afterwards? It helps when checking histories later as to how a driver was made and how fixes happened. Especially when file moves happen.. Cheers, ZubairLK > > Signed-off-by: Andy Yan > > --- > > Changes in v10: > - split generic dw_hdmi.c improvements from patch#11 (add rk3288 support) > > Changes in v9: None > Changes in v8: None > Changes in v7: None > Changes in v6: None > Changes in v5: None > Changes in v4: None > Changes in v3: None > Changes in v2: None > > drivers/gpu/drm/bridge/dw_hdmi.c | 29 +++-- > drivers/staging/imx-drm/dw_hdmi-imx.c | 10 +- > include/drm/bridge/dw_hdmi.h | 7 +++ > 3 files changed, 43 insertions(+), 3 deletions(-) > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 11/11] drm: bridge/dw_hdmi: add rockchip rk3288 support
Hi Andy On 14/11/14 03:31, Andy Yan wrote: > Rockchip RK3288 hdmi is compatible with dw_hdmi > > Signed-off-by: Andy Yan > > --- > > Changes in v10: > - add more display mode support mpll configuration for rk3288 > > Changes in v9: > - move some phy configuration to platform driver > > Changes in v8: None > Changes in v7: None > Changes in v6: None > Changes in v5: None > Changes in v4: None > Changes in v3: None > Changes in v2: None > > drivers/gpu/drm/bridge/dw_hdmi.c| 10 + > drivers/gpu/drm/bridge/dw_hdmi.h| 3 +- > drivers/gpu/drm/rockchip/Kconfig| 10 + > drivers/gpu/drm/rockchip/Makefile | 2 +- > drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 355 > > include/drm/bridge/dw_hdmi.h| 1 + > 6 files changed, 379 insertions(+), 2 deletions(-) > create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c > > diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c > b/drivers/gpu/drm/bridge/dw_hdmi.c > index a2876fe..1dd1f0b 100644 > --- a/drivers/gpu/drm/bridge/dw_hdmi.c > +++ b/drivers/gpu/drm/bridge/dw_hdmi.c > @@ -715,6 +715,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi > *hdmi, u8 enable) >HDMI_PHY_CONF0_ENTMDS_MASK); > } > > +static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) > +{ > + hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, > + HDMI_PHY_CONF0_SPARECTRL_OFFSET, > + HDMI_PHY_CONF0_SPARECTRL_MASK); > +} > + What does enable spare do? Can other future SoCs use it? This looks like DW specific. And can be a separate commit that adds a feature to the dw hdmi driver. Thanks ZubairLK > static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) > { > hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, > @@ -846,6 +853,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, > unsigned char prep, > dw_hdmi_phy_gen2_txpwron(hdmi, 1); > dw_hdmi_phy_gen2_pddq(hdmi, 0); > > + if (hdmi->dev_type == RK3288_HDMI) > + dw_hdmi_phy_enable_spare(hdmi, 1); > + > /*Wait for PHY PLL lock */ > msec = 5; > do { > diff --git a/drivers/gpu/drm/bridge/dw_hdmi.h > b/drivers/gpu/drm/bridge/dw_hdmi.h > index b8412a9..30a6b28 100644 > --- a/drivers/gpu/drm/bridge/dw_hdmi.h > +++ b/drivers/gpu/drm/bridge/dw_hdmi.h > @@ -837,7 +837,8 @@ enum { > HDMI_PHY_CONF0_PDZ_OFFSET = 7, > HDMI_PHY_CONF0_ENTMDS_MASK = 0x40, > HDMI_PHY_CONF0_ENTMDS_OFFSET = 6, > - HDMI_PHY_CONF0_SPARECTRL = 0x20, > + HDMI_PHY_CONF0_SPARECTRL_MASK = 0x20, > + HDMI_PHY_CONF0_SPARECTRL_OFFSET = 5, Cheers, ZubairLK ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 11/11] drm: bridge/dw_hdmi: add rockchip rk3288 support
On 2014年11月14日 18:23, Zubair Lutfullah Kakakhel wrote: Hi Andy On 14/11/14 03:31, Andy Yan wrote: Rockchip RK3288 hdmi is compatible with dw_hdmi Signed-off-by: Andy Yan --- Changes in v10: - add more display mode support mpll configuration for rk3288 Changes in v9: - move some phy configuration to platform driver Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c| 10 + drivers/gpu/drm/bridge/dw_hdmi.h| 3 +- drivers/gpu/drm/rockchip/Kconfig| 10 + drivers/gpu/drm/rockchip/Makefile | 2 +- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 355 include/drm/bridge/dw_hdmi.h| 1 + 6 files changed, 379 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index a2876fe..1dd1f0b 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -715,6 +715,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable) HDMI_PHY_CONF0_ENTMDS_MASK); } +static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) +{ + hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, +HDMI_PHY_CONF0_SPARECTRL_OFFSET, +HDMI_PHY_CONF0_SPARECTRL_MASK); +} + What does enable spare do? Can other future SoCs use it? This looks like DW specific. And can be a separate commit that adds a feature to the dw hdmi driver. Actually I am not very clearly about this bit, but RK3288 HDMI will not work without this bit enable. On imx6, the description about this bit is:Reserved. Spare pin control. On rk3288, the description is: svsret/sparectrl Both are very simple. Thanks ZubairLK static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) { hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, @@ -846,6 +853,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep, dw_hdmi_phy_gen2_txpwron(hdmi, 1); dw_hdmi_phy_gen2_pddq(hdmi, 0); + if (hdmi->dev_type == RK3288_HDMI) + dw_hdmi_phy_enable_spare(hdmi, 1); + /*Wait for PHY PLL lock */ msec = 5; do { diff --git a/drivers/gpu/drm/bridge/dw_hdmi.h b/drivers/gpu/drm/bridge/dw_hdmi.h index b8412a9..30a6b28 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.h +++ b/drivers/gpu/drm/bridge/dw_hdmi.h @@ -837,7 +837,8 @@ enum { HDMI_PHY_CONF0_PDZ_OFFSET = 7, HDMI_PHY_CONF0_ENTMDS_MASK = 0x40, HDMI_PHY_CONF0_ENTMDS_OFFSET = 6, - HDMI_PHY_CONF0_SPARECTRL = 0x20, + HDMI_PHY_CONF0_SPARECTRL_MASK = 0x20, + HDMI_PHY_CONF0_SPARECTRL_OFFSET = 5, Cheers, ZubairLK ___ Linux-rockchip mailing list linux-rockc...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 11/11] staging: unisys: small bug parser.c
I have added Markus to the CC list because I want to describe how "extra" if statements make the code more readable towards the end of this function. This patch needs more work. The subject shouldn't be "11/11" because it's not part of a series. Just say: "[PATCH] staging: unisys: small bug in parser.c". On Thu, Nov 13, 2014 at 09:56:39AM -0500, Jeffrey Brown wrote: > Fixed small bug in parser.c by removing "cleanups:" in parser_init > _guts struct. Replaced it with proper error handling code > and removed the instances of rc = NULL in the code. rc = NULL is > redudant > > Signed-off-by: Jeffrey Brown > --- > drivers/staging/unisys/visorchipset/parser.c | 46 ++--- > 1 files changed, 11 insertions(+), 35 deletions(-) > > diff --git a/drivers/staging/unisys/visorchipset/parser.c > b/drivers/staging/unisys/visorchipset/parser.c > index 5f6a7b2..beb36a2 100644 > --- a/drivers/staging/unisys/visorchipset/parser.c > +++ b/drivers/staging/unisys/visorchipset/parser.c Get rid of the "rc" declaration. > @@ -64,8 +64,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > MAX_CONTROLVM_PAYLOAD_BYTES); > if (try_again) > *try_again = TRUE; > - rc = NULL; > - goto cleanups; We haven't allocated "ctx" yet so it's just "return NULL;" > } > ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); > if (ctx == NULL) { > @@ -73,8 +71,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > __func__, __FILE__, __LINE__, allocbytes); > if (try_again) > *try_again = TRUE; > - rc = NULL; > - goto cleanups; return NULL; > } > > ctx->allocbytes = allocbytes; > @@ -89,42 +85,27 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)", > __func__, > (unsigned long long)addr, (ulong)bytes); > - rc = NULL; > - goto cleanups; Now we have allocated ctx but not rgn so "goto err_ctx;" > } > p = __va((ulong)(addr)); > memcpy(ctx->data, p, bytes); > } else { > rgn = visor_memregion_create(addr, bytes); > - if (!rgn) { > - rc = NULL; > - goto cleanups; We tried to allocate rgn but failed so it's still "goto err_ctx;" > - } > - if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) { > - rc = NULL; > - goto cleanups; Every error after this point is "goto err_rgn;" > - } > } > if (!has_standard_payload_header) { > ctx->byte_stream = TRUE; > rc = ctx; > - goto cleanups; But this is not an error so it goes to the success path. "goto out_rgn;" > } > phdr = (struct spar_controlvm_parameters_header *)(ctx->data); > if (phdr->total_length != bytes) { > ERRDRV("%s - bad total length %lu (should be %lu)", > __func__, > (ulong)(phdr->total_length), (ulong)(bytes)); > - rc = NULL; > - goto cleanups; goto err_rgn; > } > if (phdr->total_length < phdr->header_length) { > ERRDRV("%s - total length < header length (%lu < %lu)", > __func__, > (ulong)(phdr->total_length), > (ulong)(phdr->header_length)); > - rc = NULL; > - goto cleanups; goto err_rgn; > } > if (phdr->header_length < > sizeof(struct spar_controlvm_parameters_header)) { > @@ -133,25 +114,20 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > (ulong)(phdr->header_length), > (ulong)(sizeof( > struct spar_controlvm_parameters_header))); > - rc = NULL; > - goto cleanups; goto err_rgn; > } > Ok, now we write the code for the end of the success path. The rgn allocation is conditinal so we *must* have an if statement here. We could use the if statement hidden inside the call to visor_memregion_destroy() but that means when someone reads the code they think, "Why is there not an if statement here. Oh. It is hidden in another place in the code." Using the hidden if statement is a layering violation. Readers shouldn't have to know the deep details of how visor_memregion_destroy() is implemented. out_rgn: if (rgn) visor_memregion_destroy(rgn); return ctx; Now we write the error path: err_rgn: if (rgn) visor_memregion_destroy(rgn); err_ctx: kfree(ctx); return NULL; } Some people might argue that it is a waste of memory to have:
Re: [PATCH v10 05/11] drm: bridge/dw_hdmi:split some phy configuration to platform driver
Hi ZubairLK: Thanks for your review. On 2014年11月14日 18:19, Zubair Lutfullah Kakakhel wrote: Hi Andy, Nice work on this patch series. Its getting better and better :). On 14/11/14 03:27, Andy Yan wrote: hdmi phy clock symbol and transmission termination value can adjust platform specific to get the best SI ^Is this signal integrity? yes , SI is signal integrity, such as eye diagram measurement Are these two disjoint features in separate patches? also add mode_valid interface for some platform may not support all the display mode Sounds like another separate patch to me. :) they can seperate Also, This series is becoming quite large. With major changes and fixes mixed together. Patch 3 splits imx-drm. Patch 4 moves dw-drm out of imx-drm folder. Patch 7 adds binding Patch 9 converts to drm bridge. Can these be placed together easily? And in the start. i.e. patch 1, 2, 3, 4, Then all fixes etc can come afterwards? It helps when checking histories later as to how a driver was made and how fixes happened. Especially when file moves happen.. Do you mean we can rearrange the patch series? put patch 3, 4 ,7, 9 together one bye one than followed by the fixes patches 5 ,6, 8, 11 ? Cheers, ZubairLK Signed-off-by: Andy Yan --- Changes in v10: - split generic dw_hdmi.c improvements from patch#11 (add rk3288 support) Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c | 29 +++-- drivers/staging/imx-drm/dw_hdmi-imx.c | 10 +- include/drm/bridge/dw_hdmi.h | 7 +++ 3 files changed, 43 insertions(+), 3 deletions(-) ___ Linux-rockchip mailing list linux-rockc...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 11/11] drm: bridge/dw_hdmi: add rockchip rk3288 support
On 14/11/14 10:37, Andy Yan wrote: > > On 2014年11月14日 18:23, Zubair Lutfullah Kakakhel wrote: >> Hi Andy >> >> On 14/11/14 03:31, Andy Yan wrote: >>> Rockchip RK3288 hdmi is compatible with dw_hdmi >>> >>> Signed-off-by: Andy Yan >>> >>> --- >>> >>> Changes in v10: >>> - add more display mode support mpll configuration for rk3288 >>> >>> Changes in v9: >>> - move some phy configuration to platform driver >>> >>> Changes in v8: None >>> Changes in v7: None >>> Changes in v6: None >>> Changes in v5: None >>> Changes in v4: None >>> Changes in v3: None >>> Changes in v2: None >>> >>> drivers/gpu/drm/bridge/dw_hdmi.c| 10 + >>> drivers/gpu/drm/bridge/dw_hdmi.h| 3 +- >>> drivers/gpu/drm/rockchip/Kconfig| 10 + >>> drivers/gpu/drm/rockchip/Makefile | 2 +- >>> drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 355 >>> >>> include/drm/bridge/dw_hdmi.h| 1 + >>> 6 files changed, 379 insertions(+), 2 deletions(-) >>> create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c >>> >>> diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c >>> b/drivers/gpu/drm/bridge/dw_hdmi.c >>> index a2876fe..1dd1f0b 100644 >>> --- a/drivers/gpu/drm/bridge/dw_hdmi.c >>> +++ b/drivers/gpu/drm/bridge/dw_hdmi.c >>> @@ -715,6 +715,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi >>> *hdmi, u8 enable) >>>HDMI_PHY_CONF0_ENTMDS_MASK); >>> } >>> +static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) >>> +{ >>> +hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, >>> + HDMI_PHY_CONF0_SPARECTRL_OFFSET, >>> + HDMI_PHY_CONF0_SPARECTRL_MASK); >>> +} >>> + >> What does enable spare do? Can other future SoCs use it? >> >> This looks like DW specific. And can be a separate commit that adds a >> feature to the dw hdmi driver. > Actually I am not very clearly about this bit, but RK3288 HDMI will not > work without this bit enable. > On imx6, the description about this bit is:Reserved. Spare pin control. > On rk3288, the description is: svsret/sparectrl >Both are very simple. Sounds like the IP Core in the rk3288 is slightly upgraded. Separate this section in a different commit as it is generic DW stuff. And add what you wrote above in the commit message. Thanks ZubairLK ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 05/11] drm: bridge/dw_hdmi:split some phy configuration to platform driver
On 14/11/14 10:53, Andy Yan wrote: > Hi ZubairLK: >Thanks for your review. > On 2014年11月14日 18:19, Zubair Lutfullah Kakakhel wrote: >> Hi Andy, >> >> Nice work on this patch series. Its getting better and better :). >> >> On 14/11/14 03:27, Andy Yan wrote: >>> hdmi phy clock symbol and transmission termination value >>> can adjust platform specific to get the best SI >> ^Is this signal integrity? >yes , SI is signal integrity, such as eye diagram measurement >> >> Are these two disjoint features in separate patches? >> >>> also add mode_valid interface for some platform may not support >>> all the display mode >> Sounds like another separate patch to me. :) >they can seperate >> >> Also, This series is becoming quite large. With major changes and fixes >> mixed together. >> >> Patch 3 splits imx-drm. >> Patch 4 moves dw-drm out of imx-drm folder. >> Patch 7 adds binding >> Patch 9 converts to drm bridge. >> >> Can these be placed together easily? >> And in the start. i.e. patch 1, 2, 3, 4, >> >> Then all fixes etc can come afterwards? >> >> It helps when checking histories later as to how a driver was made and how >> fixes happened. >> >> Especially when file moves happen.. > Do you mean we can rearrange the patch series? > put patch 3, 4 ,7, 9 together one bye one > than followed by the fixes patches 5 ,6, 8, 11 ? Yes. Rearrange so that the split imx-drm/imx-hdmi and conversion to drm-bridge is at the start of the series. Then the rest are bug fixes and feature additions. Cheers, ZubairLK ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 11/11] staging: unisys: small bug parser.c
On Fri, Nov 14, 2014 at 01:48:32PM +0300, Dan Carpenter wrote: > out_rgn: > if (rgn) > visor_memregion_destroy(rgn); Oops. We're supposed to increase controlvm_payload_bytes_buffered on the success path: controlvm_payload_bytes_buffered += ctx->param_bytes; > > return ctx; > regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 05/11] drm: bridge/dw_hdmi:split some phy configuration to platform driver
On 2014年11月14日 18:55, Zubair Lutfullah Kakakhel wrote: On 14/11/14 10:53, Andy Yan wrote: Hi ZubairLK: Thanks for your review. On 2014年11月14日 18:19, Zubair Lutfullah Kakakhel wrote: Hi Andy, Nice work on this patch series. Its getting better and better :). On 14/11/14 03:27, Andy Yan wrote: hdmi phy clock symbol and transmission termination value can adjust platform specific to get the best SI ^Is this signal integrity? yes , SI is signal integrity, such as eye diagram measurement Are these two disjoint features in separate patches? also add mode_valid interface for some platform may not support all the display mode Sounds like another separate patch to me. :) they can seperate Also, This series is becoming quite large. With major changes and fixes mixed together. Patch 3 splits imx-drm. Patch 4 moves dw-drm out of imx-drm folder. Patch 7 adds binding Patch 9 converts to drm bridge. Can these be placed together easily? And in the start. i.e. patch 1, 2, 3, 4, Then all fixes etc can come afterwards? It helps when checking histories later as to how a driver was made and how fixes happened. Especially when file moves happen.. Do you mean we can rearrange the patch series? put patch 3, 4 ,7, 9 together one bye one than followed by the fixes patches 5 ,6, 8, 11 ? Yes. Rearrange so that the split imx-drm/imx-hdmi and conversion to drm-bridge is at the start of the series. Then the rest are bug fixes and feature additions. Can I put patch#1(make checkpatch happy) and patch#2 (defer probe) as the first two patch. Daniel from Google chromium think it's better to put the two slightly changes in the front for easy review. Cheers, ZubairLK ___ Linux-rockchip mailing list linux-rockc...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 11/11] drm: bridge/dw_hdmi: add rockchip rk3288 support
On 2014年11月14日 18:53, Zubair Lutfullah Kakakhel wrote: On 14/11/14 10:37, Andy Yan wrote: On 2014年11月14日 18:23, Zubair Lutfullah Kakakhel wrote: Hi Andy On 14/11/14 03:31, Andy Yan wrote: Rockchip RK3288 hdmi is compatible with dw_hdmi Signed-off-by: Andy Yan --- Changes in v10: - add more display mode support mpll configuration for rk3288 Changes in v9: - move some phy configuration to platform driver Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c| 10 + drivers/gpu/drm/bridge/dw_hdmi.h| 3 +- drivers/gpu/drm/rockchip/Kconfig| 10 + drivers/gpu/drm/rockchip/Makefile | 2 +- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 355 include/drm/bridge/dw_hdmi.h| 1 + 6 files changed, 379 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index a2876fe..1dd1f0b 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -715,6 +715,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable) HDMI_PHY_CONF0_ENTMDS_MASK); } +static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) +{ +hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, + HDMI_PHY_CONF0_SPARECTRL_OFFSET, + HDMI_PHY_CONF0_SPARECTRL_MASK); +} + What does enable spare do? Can other future SoCs use it? This looks like DW specific. And can be a separate commit that adds a feature to the dw hdmi driver. Actually I am not very clearly about this bit, but RK3288 HDMI will not work without this bit enable. On imx6, the description about this bit is:Reserved. Spare pin control. On rk3288, the description is: svsret/sparectrl Both are very simple. Sounds like the IP Core in the rk3288 is slightly upgraded. Separate this section in a different commit as it is generic DW stuff. And add what you wrote above in the commit message. Only Separate function dw_hdmi_phy_enale_spare ? not include if (hdmi->dev_type == rk3288_hdmi) dw_hdmi_enable_phy_spare(hdmi, 1); ? Thanks ZubairLK ___ Linux-rockchip mailing list linux-rockc...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 05/11] drm: bridge/dw_hdmi:split some phy configuration to platform driver
On 14/11/14 11:08, Andy Yan wrote: > > On 2014年11月14日 18:55, Zubair Lutfullah Kakakhel wrote: >> >> On 14/11/14 10:53, Andy Yan wrote: >>> Hi ZubairLK: >>> Thanks for your review. >>> On 2014年11月14日 18:19, Zubair Lutfullah Kakakhel wrote: Hi Andy, Nice work on this patch series. Its getting better and better :). On 14/11/14 03:27, Andy Yan wrote: > hdmi phy clock symbol and transmission termination value > can adjust platform specific to get the best SI ^Is this signal integrity? >>> yes , SI is signal integrity, such as eye diagram measurement Are these two disjoint features in separate patches? > also add mode_valid interface for some platform may not support > all the display mode Sounds like another separate patch to me. :) >>> they can seperate Also, This series is becoming quite large. With major changes and fixes mixed together. Patch 3 splits imx-drm. Patch 4 moves dw-drm out of imx-drm folder. Patch 7 adds binding Patch 9 converts to drm bridge. Can these be placed together easily? And in the start. i.e. patch 1, 2, 3, 4, Then all fixes etc can come afterwards? It helps when checking histories later as to how a driver was made and how fixes happened. Especially when file moves happen.. >>>Do you mean we can rearrange the patch series? >>>put patch 3, 4 ,7, 9 together one bye one >>>than followed by the fixes patches 5 ,6, 8, 11 ? >> Yes. Rearrange so that the split imx-drm/imx-hdmi and conversion to >> drm-bridge is at the start of the series. >> Then the rest are bug fixes and feature additions. > Can I put patch#1(make checkpatch happy) and patch#2 (defer probe) as the > first two patch. > Daniel from Google chromium think it's better to put the two slightly > changes in the front for easy review. Sure. I am not the maintainer. They have to make the final decision. ZubairLK ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 11/11] drm: bridge/dw_hdmi: add rockchip rk3288 support
On 14/11/14 11:13, Andy Yan wrote: > > On 2014年11月14日 18:53, Zubair Lutfullah Kakakhel wrote: >> >> On 14/11/14 10:37, Andy Yan wrote: >>> On 2014年11月14日 18:23, Zubair Lutfullah Kakakhel wrote: Hi Andy On 14/11/14 03:31, Andy Yan wrote: > Rockchip RK3288 hdmi is compatible with dw_hdmi > > Signed-off-by: Andy Yan > > --- > > Changes in v10: > - add more display mode support mpll configuration for rk3288 > > Changes in v9: > - move some phy configuration to platform driver > > Changes in v8: None > Changes in v7: None > Changes in v6: None > Changes in v5: None > Changes in v4: None > Changes in v3: None > Changes in v2: None > >drivers/gpu/drm/bridge/dw_hdmi.c| 10 + >drivers/gpu/drm/bridge/dw_hdmi.h| 3 +- >drivers/gpu/drm/rockchip/Kconfig| 10 + >drivers/gpu/drm/rockchip/Makefile | 2 +- >drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 355 > >include/drm/bridge/dw_hdmi.h| 1 + >6 files changed, 379 insertions(+), 2 deletions(-) >create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c > > diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c > b/drivers/gpu/drm/bridge/dw_hdmi.c > index a2876fe..1dd1f0b 100644 > --- a/drivers/gpu/drm/bridge/dw_hdmi.c > +++ b/drivers/gpu/drm/bridge/dw_hdmi.c > @@ -715,6 +715,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi > *hdmi, u8 enable) > HDMI_PHY_CONF0_ENTMDS_MASK); >} >+static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) > +{ > +hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, > + HDMI_PHY_CONF0_SPARECTRL_OFFSET, > + HDMI_PHY_CONF0_SPARECTRL_MASK); > +} > + What does enable spare do? Can other future SoCs use it? This looks like DW specific. And can be a separate commit that adds a feature to the dw hdmi driver. >>>Actually I am not very clearly about this bit, but RK3288 HDMI will not >>> work without this bit enable. >>>On imx6, the description about this bit is:Reserved. Spare pin control. >>>On rk3288, the description is: svsret/sparectrl >>> Both are very simple. >> Sounds like the IP Core in the rk3288 is slightly upgraded. >> Separate this section in a different commit as it is generic DW stuff. >> >> And add what you wrote above in the commit message. > Only Separate function dw_hdmi_phy_enale_spare ? not include > if (hdmi->dev_type == rk3288_hdmi) >dw_hdmi_enable_phy_spare(hdmi, 1); > ? Yes. Separate dw_hdmi_phy_enable_spare and its associated defines HDMI_PHY_CONF0_SPARECTRL_OFFSET HDMI_PHY_CONF0_SPARECTRL_MASK in the header as one commit. The if (hdmi->dev_type == rk3288_hdmi) code is part of the add rk3288 support. ZubairLK ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v10 11/11] drm: bridge/dw_hdmi: add rockchip rk3288 support
On 2014年11月14日 19:16, Zubair Lutfullah Kakakhel wrote: On 14/11/14 11:13, Andy Yan wrote: On 2014年11月14日 18:53, Zubair Lutfullah Kakakhel wrote: On 14/11/14 10:37, Andy Yan wrote: On 2014年11月14日 18:23, Zubair Lutfullah Kakakhel wrote: Hi Andy On 14/11/14 03:31, Andy Yan wrote: Rockchip RK3288 hdmi is compatible with dw_hdmi Signed-off-by: Andy Yan --- Changes in v10: - add more display mode support mpll configuration for rk3288 Changes in v9: - move some phy configuration to platform driver Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c| 10 + drivers/gpu/drm/bridge/dw_hdmi.h| 3 +- drivers/gpu/drm/rockchip/Kconfig| 10 + drivers/gpu/drm/rockchip/Makefile | 2 +- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 355 include/drm/bridge/dw_hdmi.h| 1 + 6 files changed, 379 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index a2876fe..1dd1f0b 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -715,6 +715,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable) HDMI_PHY_CONF0_ENTMDS_MASK); } +static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) +{ +hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, + HDMI_PHY_CONF0_SPARECTRL_OFFSET, + HDMI_PHY_CONF0_SPARECTRL_MASK); +} + What does enable spare do? Can other future SoCs use it? This looks like DW specific. And can be a separate commit that adds a feature to the dw hdmi driver. Actually I am not very clearly about this bit, but RK3288 HDMI will not work without this bit enable. On imx6, the description about this bit is:Reserved. Spare pin control. On rk3288, the description is: svsret/sparectrl Both are very simple. Sounds like the IP Core in the rk3288 is slightly upgraded. Separate this section in a different commit as it is generic DW stuff. And add what you wrote above in the commit message. Only Separate function dw_hdmi_phy_enale_spare ? not include if (hdmi->dev_type == rk3288_hdmi) dw_hdmi_enable_phy_spare(hdmi, 1); ? Yes. Separate dw_hdmi_phy_enable_spare and its associated defines HDMI_PHY_CONF0_SPARECTRL_OFFSET HDMI_PHY_CONF0_SPARECTRL_MASK in the header as one commit. The if (hdmi->dev_type == rk3288_hdmi) code is part of the add rk3288 support. ZubairLK Many thanks :-) ___ Linux-rockchip mailing list linux-rockc...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 0/12] dw-hdmi: convert imx hdmi to bridge/dw_hdmi
We found Freescale imx6 and Rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only be accessed by word), 4K support(imx6 doesn't support 4k, but rk3288 does), and HDMI2.0 support. To reuse the imx-hdmi driver, we make this patch set: (1): fix some CodingStyle warning to make checkpatch happy (2): split out imx-soc code from imx-hdmi to dw_hdmi-imx.c (3): move imx-hdmi to bridge/dw-hdmi, and convert it to a drm_bridge driver (4): add rockchip rk3288 platform specific code dw_hdmi-rockchip.c Changes in v11: - rearrange the patch order - squash patch - split some modification form patch Changes in v10: - split generic dw_hdmi.c improvements from patch#11 (add rk3288 support) - add more display mode support mpll configuration for rk3288 Changes in v9: - move some phy configuration to platform driver Changes in v8: - correct some spelling mistake - modify ddc-i2c-bus and interrupt description - Add documentation for rockchip dw hdmi Changes in v7: - remove unused variables from structure dw_hdmi - remove a wrong modification - add copyrights for dw_hdmi-imx.c Changes in v6: - rearrange the patch order - move some modification from patch#5 - move some modification to patch#6 - refactor register access without reg_shift Changes in v5: - refactor reg-io-width Changes in v4: - fix checkpatch CHECK - defer probe ddc i2c adapter Changes in v3: - split multi-register access to one indepent patch Changes in v2: - use git format -M to generate these patch Andy Yan (11): staging: imx-drm: imx-hdmi: make checkpatch happy staging: imx-drm: imx-hdmi: return defer if can't get ddc i2c adapter staging: imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi staging: imx-drm: imx-hdmi: move imx-hdmi to bridge/dw_hdmi dt-bindings: add document for dw_hdmi drm: bridge/dw_hdmi: add support for multi-byte register width access drm: bridge/dw_hdmi: add mode_valid support drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare dt-bindings: Add documentation for rockchip dw hdmi drm: bridge/dw_hdmi: add rockchip rk3288 support Yakir Yang (1): drm: bridge/dw_hdmi: convert dw-hdmi to drm_bridge mode .../devicetree/bindings/drm/bridge/dw_hdmi.txt | 40 ++ .../devicetree/bindings/video/dw_hdmi-rockchip.txt | 43 ++ drivers/gpu/drm/bridge/Kconfig | 5 + drivers/gpu/drm/bridge/Makefile| 1 + .../imx-hdmi.c => gpu/drm/bridge/dw_hdmi.c}| 762 + .../imx-hdmi.h => gpu/drm/bridge/dw_hdmi.h}| 8 +- drivers/gpu/drm/rockchip/Kconfig | 10 + drivers/gpu/drm/rockchip/Makefile | 2 +- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c| 355 ++ drivers/staging/imx-drm/Kconfig| 1 + drivers/staging/imx-drm/Makefile | 2 +- drivers/staging/imx-drm/dw_hdmi-imx.c | 274 include/drm/bridge/dw_hdmi.h | 60 ++ 13 files changed, 1138 insertions(+), 425 deletions(-) create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt rename drivers/{staging/imx-drm/imx-hdmi.c => gpu/drm/bridge/dw_hdmi.c} (70%) rename drivers/{staging/imx-drm/imx-hdmi.h => gpu/drm/bridge/dw_hdmi.h} (99%) create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c create mode 100644 drivers/staging/imx-drm/dw_hdmi-imx.c create mode 100644 include/drm/bridge/dw_hdmi.h -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 01/12] staging: imx-drm: imx-hdmi: make checkpatch happy
CHECK: Alignment should match open parenthesis + if ((hdmi->vic == 10) || (hdmi->vic == 11) || + (hdmi->vic == 12) || (hdmi->vic == 13) || CHECK: braces {} should be used on all arms of this statement + if (hdmi->hdmi_data.video_mode.mdvi) [...] + else { [...] Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: - rearrange the patch order Changes in v5: None Changes in v4: - fix checkpatch CHECK Changes in v3: None Changes in v2: None drivers/staging/imx-drm/imx-hdmi.c | 97 +++--- 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index aaec6b2..79daec4 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c @@ -163,7 +163,7 @@ static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 mask, unsigned reg) } static void hdmi_mask_writeb(struct imx_hdmi *hdmi, u8 data, unsigned int reg, - u8 shift, u8 mask) +u8 shift, u8 mask) { hdmi_modb(hdmi, data << shift, mask, reg); } @@ -327,7 +327,7 @@ static unsigned int hdmi_compute_cts(unsigned int freq, unsigned long pixel_clk, } static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi, - unsigned long pixel_clk) +unsigned long pixel_clk) { unsigned int clk_n, clk_cts; @@ -338,7 +338,7 @@ static void hdmi_set_clk_regenerator(struct imx_hdmi *hdmi, if (!clk_cts) { dev_dbg(hdmi->dev, "%s: pixel clock not supported: %lu\n", -__func__, pixel_clk); + __func__, pixel_clk); return; } @@ -477,13 +477,11 @@ static void imx_hdmi_update_csc_coeffs(struct imx_hdmi *hdmi) u16 coeff_b = (*csc_coeff)[1][i]; u16 coeff_c = (*csc_coeff)[2][i]; - hdmi_writeb(hdmi, coeff_a & 0xff, - HDMI_CSC_COEF_A1_LSB + i * 2); + hdmi_writeb(hdmi, coeff_a & 0xff, HDMI_CSC_COEF_A1_LSB + i * 2); hdmi_writeb(hdmi, coeff_a >> 8, HDMI_CSC_COEF_A1_MSB + i * 2); hdmi_writeb(hdmi, coeff_b & 0xff, HDMI_CSC_COEF_B1_LSB + i * 2); hdmi_writeb(hdmi, coeff_b >> 8, HDMI_CSC_COEF_B1_MSB + i * 2); - hdmi_writeb(hdmi, coeff_c & 0xff, - HDMI_CSC_COEF_C1_LSB + i * 2); + hdmi_writeb(hdmi, coeff_c & 0xff, HDMI_CSC_COEF_C1_LSB + i * 2); hdmi_writeb(hdmi, coeff_c >> 8, HDMI_CSC_COEF_C1_MSB + i * 2); } @@ -535,21 +533,22 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi) struct hdmi_data_info *hdmi_data = &hdmi->hdmi_data; u8 val, vp_conf; - if (hdmi_data->enc_out_format == RGB - || hdmi_data->enc_out_format == YCBCR444) { - if (!hdmi_data->enc_color_depth) + if (hdmi_data->enc_out_format == RGB || + hdmi_data->enc_out_format == YCBCR444) { + if (!hdmi_data->enc_color_depth) { output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS; - else if (hdmi_data->enc_color_depth == 8) { + } else if (hdmi_data->enc_color_depth == 8) { color_depth = 4; output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_BYPASS; - } else if (hdmi_data->enc_color_depth == 10) + } else if (hdmi_data->enc_color_depth == 10) { color_depth = 5; - else if (hdmi_data->enc_color_depth == 12) + } else if (hdmi_data->enc_color_depth == 12) { color_depth = 6; - else if (hdmi_data->enc_color_depth == 16) + } else if (hdmi_data->enc_color_depth == 16) { color_depth = 7; - else + } else { return; + } } else if (hdmi_data->enc_out_format == YCBCR422_8BITS) { if (!hdmi_data->enc_color_depth || hdmi_data->enc_color_depth == 8) @@ -561,8 +560,9 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi) else return; output_select = HDMI_VP_CONF_OUTPUT_SELECTOR_YCC422; - } else + } else { return; + } /* set the packetizer registers */ val = ((color_depth << HDMI_VP_PR_CD_COLOR_DEPTH_OFFSET) & @@ -623,34 +623,34 @@ static void hdmi_video_packetize(struct imx_hdmi *hdmi) } static inline void hdmi_phy_test_clear(struct imx_hdmi *hdmi, - unsigned char bit) + unsigned char bit) { hdmi_modb(hdmi, bit << HDMI_PHY_TST0_TSTCLR_OFFSET,
[PATCH v11 02/12] staging: imx-drm: imx-hdmi: return defer if can't get ddc i2c adapter
drm driver may probe before the i2c bus, so the driver should defer probing until it is available Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: - defer probe ddc i2c adapter Changes in v3: None Changes in v2: None drivers/staging/imx-drm/imx-hdmi.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index 79daec4..c2b035a 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c @@ -1611,8 +1611,11 @@ static int imx_hdmi_bind(struct device *dev, struct device *master, void *data) ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0); if (ddc_node) { hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node); - if (!hdmi->ddc) + if (!hdmi->ddc) { dev_dbg(hdmi->dev, "failed to read ddc node\n"); + of_node_put(ddc_node); + return -EPROBE_DEFER; + } of_node_put(ddc_node); } else { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 03/12] staging: imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi
IMX6 and Rockchip RK3288 and JZ4780 (Ingenic Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly differences, such as phy pll configuration, register width, 4K support, clk useage, and the crtc mux configuration is also platform specific. To reuse the imx hdmi driver, split the platform specific code out to dw_hdmi-imx.c. Signed-off-by: Andy Yan --- Changes in v11: - squash patch Changes in v10: - split generic dw_hdmi.c improvements from patch#11 (add rk3288 support) Changes in v9: None Changes in v8: None Changes in v7: - remove unused variables from structure dw_hdmi - remove a wrong modification - add copyrights for dw_hdmi-imx.c Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/staging/imx-drm/Makefile | 2 +- drivers/staging/imx-drm/dw_hdmi-imx.c | 225 drivers/staging/imx-drm/imx-hdmi.c| 267 +- drivers/staging/imx-drm/imx-hdmi.h| 50 +++ 4 files changed, 347 insertions(+), 197 deletions(-) create mode 100644 drivers/staging/imx-drm/dw_hdmi-imx.c diff --git a/drivers/staging/imx-drm/Makefile b/drivers/staging/imx-drm/Makefile index 582c438..809027d 100644 --- a/drivers/staging/imx-drm/Makefile +++ b/drivers/staging/imx-drm/Makefile @@ -9,4 +9,4 @@ obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o imx-ipuv3-crtc-objs := ipuv3-crtc.o ipuv3-plane.o obj-$(CONFIG_DRM_IMX_IPUV3)+= imx-ipuv3-crtc.o -obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o +obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o dw_hdmi-imx.o diff --git a/drivers/staging/imx-drm/dw_hdmi-imx.c b/drivers/staging/imx-drm/dw_hdmi-imx.c new file mode 100644 index 000..7154c96 --- /dev/null +++ b/drivers/staging/imx-drm/dw_hdmi-imx.c @@ -0,0 +1,225 @@ +/* Copyright (C) 2011-2013 Freescale Semiconductor, Inc. + * + * derived from imx-hdmi.c(renamed to bridge/dw_hdmi.c now) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include + +#include "imx-drm.h" +#include "imx-hdmi.h" + +struct imx_hdmi_priv { + struct device *dev; + struct clk *isfr_clk; + struct clk *iahb_clk; + struct regmap *regmap; +}; + +static const struct mpll_config imx_mpll_cfg[] = { + { + 4525, { + { 0x01e0, 0x }, + { 0x21e1, 0x }, + { 0x41e2, 0x } + }, + }, { + 9250, { + { 0x0140, 0x0005 }, + { 0x2141, 0x0005 }, + { 0x4142, 0x0005 }, + }, + }, { + 14850, { + { 0x00a0, 0x000a }, + { 0x20a1, 0x000a }, + { 0x40a2, 0x000a }, + }, + }, { + ~0UL, { + { 0x00a0, 0x000a }, + { 0x2001, 0x000f }, + { 0x4002, 0x000f }, + }, + } +}; + +static const struct curr_ctrl imx_cur_ctr[] = { + /* pixelclk bpp8bpp10 bpp12 */ + { + 5400, { 0x091c, 0x091c, 0x06dc }, + }, { + 5840, { 0x091c, 0x06dc, 0x06dc }, + }, { + 7200, { 0x06dc, 0x06dc, 0x091c }, + }, { + 7425, { 0x06dc, 0x0b5c, 0x091c }, + }, { + 11880, { 0x091c, 0x091c, 0x06dc }, + }, { + 21600, { 0x06dc, 0x0b5c, 0x091c }, + } +}; + +static const struct sym_term imx_sym_term[] = { + /*pixelclk symbol term*/ + { 14850, 0x800d, 0x0005 }, + { ~0UL, 0x, 0x } +}; + +static int imx_hdmi_parse_dt(struct imx_hdmi_priv *hdmi) +{ + struct device_node *np = hdmi->dev->of_node; + + hdmi->regmap = syscon_regmap_lookup_by_phandle(np, "gpr"); + if (IS_ERR(hdmi->regmap)) { + dev_err(hdmi->dev, "Unable to get gpr\n"); + return PTR_ERR(hdmi->regmap); + } + + hdmi->isfr_clk = devm_clk_get(hdmi->dev, "isfr"); + if (IS_ERR(hdmi->isfr_clk)) { + dev_err(hdmi->dev, "Unable to get HDMI isfr clk\n"); + return PTR_ERR(hdmi->isfr_clk); + } + + hdmi->iahb_clk = devm_clk_get(hdmi->dev, "iahb"); + if (IS_ERR(hdmi->iahb_clk)) { + dev_err(hdmi->dev, "Unable to get HDMI iahb clk\n"); + return PTR_ERR(hdmi->iahb_clk); + } + + return 0; +} + +static void *imx_hdmi_imx_setup(struct platform_device *pdev) +{ + struct imx_hdmi_priv *hdmi; + int ret; + + hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); + if (!hdmi) + return ERR_PTR(-ENOMEM); + hdm
[PATCH v11 04/12] staging: imx-drm: imx-hdmi: move imx-hdmi to bridge/dw_hdmi
the original imx hdmi driver is under staging/imx-drm, which depends on imx-drm, so move the imx hdmi driver out to drm/bridge and rename imx-hdmi to dw_hdmi Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: - use git format -M to generate these patch drivers/gpu/drm/bridge/Kconfig | 5 + drivers/gpu/drm/bridge/Makefile| 1 + .../imx-hdmi.c => gpu/drm/bridge/dw_hdmi.c}| 281 +++-- .../imx-hdmi.h => gpu/drm/bridge/dw_hdmi.h}| 53 +--- drivers/staging/imx-drm/Kconfig| 1 + drivers/staging/imx-drm/Makefile | 2 +- drivers/staging/imx-drm/dw_hdmi-imx.c | 70 ++--- include/drm/bridge/dw_hdmi.h | 64 + 8 files changed, 250 insertions(+), 227 deletions(-) rename drivers/{staging/imx-drm/imx-hdmi.c => gpu/drm/bridge/dw_hdmi.c} (83%) rename drivers/{staging/imx-drm/imx-hdmi.h => gpu/drm/bridge/dw_hdmi.h} (97%) create mode 100644 include/drm/bridge/dw_hdmi.h diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 884923f..26162ef 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -3,3 +3,8 @@ config DRM_PTN3460 depends on DRM select DRM_KMS_HELPER ---help--- + +config DRM_DW_HDMI + bool "Synopsys DesignWare High-Definition Multimedia Interface" + depends on DRM + select DRM_KMS_HELPER diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile index b4733e1..d8a8cfd 100644 --- a/drivers/gpu/drm/bridge/Makefile +++ b/drivers/gpu/drm/bridge/Makefile @@ -1,3 +1,4 @@ ccflags-y := -Iinclude/drm obj-$(CONFIG_DRM_PTN3460) += ptn3460.o +obj-$(CONFIG_DRM_DW_HDMI) += dw_hdmi.o diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c similarity index 83% rename from drivers/staging/imx-drm/imx-hdmi.c rename to drivers/gpu/drm/bridge/dw_hdmi.c index ba4e392..1a9026b 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -6,8 +6,7 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * - * SH-Mobile High-Definition Multimedia Interface (HDMI) driver - * for SLISHDMI13T and SLIPHDMIT IP cores + * Designware High-Definition Multimedia Interface (HDMI) driver * * Copyright (C) 2010, Guennadi Liakhovetski */ @@ -24,8 +23,9 @@ #include #include #include +#include -#include "imx-hdmi.h" +#include "dw_hdmi.h" #define HDMI_EDID_LEN 512 @@ -101,15 +101,15 @@ struct hdmi_data_info { struct hdmi_vmode video_mode; }; -struct imx_hdmi { +struct dw_hdmi { struct drm_connector connector; struct drm_encoder encoder; - enum imx_hdmi_devtype dev_type; + enum dw_hdmi_devtype dev_type; struct device *dev; struct hdmi_data_info hdmi_data; - const struct imx_hdmi_plat_data *plat_data; + const struct dw_hdmi_plat_data *plat_data; void *priv; int vic; @@ -127,17 +127,17 @@ struct imx_hdmi { int ratio; }; -static inline void hdmi_writeb(struct imx_hdmi *hdmi, u8 val, int offset) +static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) { writeb(val, hdmi->regs + offset); } -static inline u8 hdmi_readb(struct imx_hdmi *hdmi, int offset) +static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset) { return readb(hdmi->regs + offset); } -static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 mask, unsigned reg) +static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg) { u8 val = hdmi_readb(hdmi, reg) & ~mask; @@ -145,13 +145,13 @@ static void hdmi_modb(struct imx_hdmi *hdmi, u8 data, u8 mask, unsigned reg) hdmi_writeb(hdmi, val, reg); } -static void hdmi_mask_writeb(struct imx_hdmi *hdmi, u8 data, unsigned int reg, +static void hdmi_mask_writeb(struct dw_hdmi *hdmi, u8 data, unsigned int reg, u8 shift, u8 mask) { hdmi_modb(hdmi, data << shift, mask, reg); } -static void hdmi_set_clock_regenerator_n(struct imx_hdmi *hdmi, +static void hdmi_set_clock_regenerator_n(struct dw_hdmi *hdmi, unsigned int value) { hdmi_writeb(hdmi, value & 0xff, HDMI_AUD_N1); @@ -162,7 +162,7 @@ static void hdmi_set_clock_regenerator_n(struct imx_hdmi *hdmi, hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3); } -static void hdmi_regenerate_cts(struct imx_hdmi *hdmi, unsigned int cts) +static void hdmi_regenerate_cts(struct dw_hdmi *hdmi, unsigned int cts) { /* Must be set/cleared first */ hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3); @@ -309,7 +
[PATCH v11 05/12] drm: bridge/dw_hdmi: convert dw-hdmi to drm_bridge mode
From: Yakir Yang keep the connector & birdge in dw_hdmi.c, handle encoder in dw_hdmi-imx.c, as most of the encoder operation are platform specific such as crtc select and panel format set Signed-off-by: Andy Yan Signed-off-by: Yakir Yang --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: - move some modification from patch#5 Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c | 228 +++--- drivers/staging/imx-drm/dw_hdmi-imx.c | 143 ++--- include/drm/bridge/dw_hdmi.h | 13 +- 3 files changed, 198 insertions(+), 186 deletions(-) diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index 1a9026b..08b56ea 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -11,7 +11,6 @@ * Copyright (C) 2010, Guennadi Liakhovetski */ -#include #include #include #include @@ -103,7 +102,8 @@ struct hdmi_data_info { struct dw_hdmi { struct drm_connector connector; - struct drm_encoder encoder; + struct drm_encoder *encoder; + struct drm_bridge *bridge; enum dw_hdmi_devtype dev_type; struct device *dev; @@ -1299,6 +1299,50 @@ static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) dw_hdmi_phy_disable(hdmi); } +static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge, + struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct dw_hdmi *hdmi = bridge->driver_private; + + dw_hdmi_setup(hdmi, mode); + + /* Store the display mode for plugin/DKMS poweron events */ + memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode)); +} + +static bool dw_hdmi_bridge_mode_fixup(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + return true; +} + +static void dw_hdmi_bridge_disable(struct drm_bridge *bridge) +{ + struct dw_hdmi *hdmi = bridge->driver_private; + + dw_hdmi_poweroff(hdmi); +} + +static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) +{ + struct dw_hdmi *hdmi = bridge->driver_private; + + dw_hdmi_poweron(hdmi); +} + +static void dw_hdmi_bridge_destroy(struct drm_bridge *bridge) +{ + drm_bridge_cleanup(bridge); + kfree(bridge); +} + +static void dw_hdmi_bridge_nope(struct drm_bridge *bridge) +{ + /* do nothing */ +} + static enum drm_connector_status dw_hdmi_connector_detect(struct drm_connector *connector, bool force) { @@ -1340,60 +1384,7 @@ static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, connector); - return &hdmi->encoder; -} - -static void dw_hdmi_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct dw_hdmi *hdmi = container_of(encoder, struct dw_hdmi, encoder); - - dw_hdmi_setup(hdmi, mode); - - /* Store the display mode for plugin/DKMS poweron events */ - memcpy(&hdmi->previous_mode, mode, sizeof(hdmi->previous_mode)); -} - -static bool dw_hdmi_encoder_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - return true; -} - -static void dw_hdmi_encoder_disable(struct drm_encoder *encoder) -{ -} - -static void dw_hdmi_encoder_dpms(struct drm_encoder *encoder, int mode) -{ - struct dw_hdmi *hdmi = container_of(encoder, struct dw_hdmi, encoder); - - if (mode) - dw_hdmi_poweroff(hdmi); - else - dw_hdmi_poweron(hdmi); -} - -static void dw_hdmi_encoder_prepare(struct drm_encoder *encoder) -{ - struct dw_hdmi *hdmi = container_of(encoder, struct dw_hdmi, encoder); - - dw_hdmi_poweroff(hdmi); - - if (hdmi->plat_data->encoder_prepare) - hdmi->plat_data->encoder_prepare(&hdmi->connector, encoder); -} - -static void dw_hdmi_encoder_commit(struct drm_encoder *encoder) -{ - struct dw_hdmi *hdmi = container_of(encoder, struct dw_hdmi, encoder); - - if (hdmi->plat_data->encoder_commit) - hdmi->plat_data->encoder_commit(hdmi->priv, encoder); - - dw_hdmi_poweron(hdmi); + return hdmi->encoder; } void dw_hdmi_connector_destroy(struct drm_connector *connector) @@ -1402,19 +1393,6 @@ void dw_hdmi_connector_destroy(struct drm_connector *connector) drm_connector_cleanup(connector); } -static struct drm_encoder
[PATCH v11 06/12] dt-bindings: add document for dw_hdmi
Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: - correct some spelling mistake - modify ddc-i2c-bus and interrupt description Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None .../devicetree/bindings/drm/bridge/dw_hdmi.txt | 40 ++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt diff --git a/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt new file mode 100644 index 000..0558442 --- /dev/null +++ b/Documentation/devicetree/bindings/drm/bridge/dw_hdmi.txt @@ -0,0 +1,40 @@ +DesignWare HDMI bridge bindings + +Required properities: +- compatible: platform specific such as: + * "fsl,imx6q-hdmi" + * "fsl,imx6dl-hdmi" + * "rockchip,rk3288-dw-hdmi" +- reg: physical base address of the controller and length +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- interrupts: The HDMI interrupt number + +Optional properties +- reg-io-width: the width of the reg:1,4, default set to 1 if not present + +Example: + hdmi: hdmi@012 { + compatible = "fsl,imx6q-hdmi"; + reg = <0x0012 0x9000>; + interrupts = <0 115 0x04>; + gpr = <&gpr>; + clocks = <&clks 123>, <&clks 124>; + clock-names = "iahb", "isfr"; + ddc-i2c-bus = <&i2c2>; + + port@0 { + reg = <0>; + + hdmi_mux_0: endpoint { + remote-endpoint = <&ipu1_di0_hdmi>; + }; + }; + + port@1 { + reg = <1>; + + hdmi_mux_1: endpoint { + remote-endpoint = <&ipu1_di1_hdmi>; + }; + }; + }; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 07/12] drm: bridge/dw_hdmi: add support for multi-byte register width access
On rockchip rk3288, only word(32-bit) accesses are permitted for hdmi registers. Byte width accesses (writeb, readb) generate an imprecise external abort. Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: - move some modification to patch#6 - refactor register access without reg_shift Changes in v5: - refactor reg-io-width Changes in v4: None Changes in v3: - split multi-register access to one indepent patch Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c | 57 +++- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index 08b56ea..24a66ff 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -100,6 +100,11 @@ struct hdmi_data_info { struct hdmi_vmode video_mode; }; +union dw_reg_ptr { + u32 __iomem *p32; + u8 __iomem *p8; +}; + struct dw_hdmi { struct drm_connector connector; struct drm_encoder *encoder; @@ -121,20 +126,43 @@ struct dw_hdmi { struct regmap *regmap; struct i2c_adapter *ddc; - void __iomem *regs; + union dw_reg_ptr regs; unsigned int sample_rate; int ratio; + + void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); + u8 (*read)(struct dw_hdmi *hdmi, int offset); }; +static void dw_hdmi_writel(struct dw_hdmi *hdmi, u8 val, int offset) +{ + writel(val, hdmi->regs.p32 + offset); +} + +static u8 dw_hdmi_readl(struct dw_hdmi *hdmi, int offset) +{ + return readl(hdmi->regs.p32 + offset); +} + +static void dw_hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) +{ + writeb(val, hdmi->regs.p8 + offset); +} + +static u8 dw_hdmi_readb(struct dw_hdmi *hdmi, int offset) +{ + return readb(hdmi->regs.p8 + offset); +} + static inline void hdmi_writeb(struct dw_hdmi *hdmi, u8 val, int offset) { - writeb(val, hdmi->regs + offset); + hdmi->write(hdmi, val, offset); } static inline u8 hdmi_readb(struct dw_hdmi *hdmi, int offset) { - return readb(hdmi->regs + offset); + return hdmi->read(hdmi, offset); } static void hdmi_modb(struct dw_hdmi *hdmi, u8 data, u8 mask, unsigned reg) @@ -1508,6 +1536,7 @@ int dw_hdmi_bind(struct device *dev, struct device *master, struct resource *iores; struct dw_hdmi *hdmi; int ret, irq; + u32 val = 1; hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); if (!hdmi) @@ -1520,6 +1549,22 @@ int dw_hdmi_bind(struct device *dev, struct device *master, hdmi->ratio = 100; hdmi->encoder = encoder; + of_property_read_u32(np, "reg-io-width", &val); + + switch (val) { + case 4: + hdmi->write = dw_hdmi_writel; + hdmi->read = dw_hdmi_readl; + break; + case 1: + hdmi->write = dw_hdmi_writeb; + hdmi->read = dw_hdmi_readb; + break; + default: + dev_err(dev, "reg-io-width must be 1 or 4\n"); + return -EINVAL; + } + ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0); if (ddc_node) { hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node); @@ -1545,9 +1590,9 @@ int dw_hdmi_bind(struct device *dev, struct device *master, return ret; iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hdmi->regs = devm_ioremap_resource(dev, iores); - if (IS_ERR(hdmi->regs)) - return PTR_ERR(hdmi->regs); + hdmi->regs.p32 = devm_ioremap_resource(dev, iores); + if (IS_ERR(hdmi->regs.p32)) + return PTR_ERR(hdmi->regs.p32); /* Product and revision IDs */ dev_info(dev, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 08/12] drm: bridge/dw_hdmi: add mode_valid support
some platform may not support all the display mode, add mode_valid interface check it Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index 24a66ff..e94f6bb 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -1406,6 +1406,20 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) return 0; } +static enum drm_mode_status +dw_hdmi_connector_mode_valid(struct drm_connector *connector, +struct drm_display_mode *mode) +{ + struct dw_hdmi *hdmi = container_of(connector, + struct dw_hdmi, connector); + enum drm_mode_status mode_status = MODE_OK; + + if (hdmi->plat_data->mode_valid) + mode_status = hdmi->plat_data->mode_valid(connector, mode); + + return mode_status; +} + static struct drm_encoder *dw_hdmi_connector_best_encoder(struct drm_connector *connector) { @@ -1430,6 +1444,7 @@ static struct drm_connector_funcs dw_hdmi_connector_funcs = { static struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs = { .get_modes = dw_hdmi_connector_get_modes, + .mode_valid = dw_hdmi_connector_mode_valid, .best_encoder = dw_hdmi_connector_best_encoder, }; @@ -1632,6 +1647,8 @@ int dw_hdmi_bind(struct device *dev, struct device *master, dev_set_drvdata(dev, hdmi); + drm_connector_register(&hdmi->connector); + return 0; } EXPORT_SYMBOL_GPL(dw_hdmi_bind); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 09/12] drm: bridge/dw_hdmi: clear i2cmphy_stat0 reg in hdmi_phy_wait_i2c_done
HDMI_IH_I2CMPHY_STAT0 is a clear on write register, which indicates i2cm operation status(i2c transfer done or error), every hdmi phy register configuration must check this register to make sure the configuration has complete. But the indication bit should be cleared after check, otherwise the corresponding bit will hold on forever, this may give a wrong signal for next check. Signed-off-by: Andy Yan --- Changes in v11: - split form patch Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index e94f6bb..d5d5207 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -668,11 +668,15 @@ static inline void hdmi_phy_test_dout(struct dw_hdmi *hdmi, static bool hdmi_phy_wait_i2c_done(struct dw_hdmi *hdmi, int msec) { - while ((hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) { + u32 val; + + while ((val = hdmi_readb(hdmi, HDMI_IH_I2CMPHY_STAT0) & 0x3) == 0) { if (msec-- == 0) return false; udelay(1000); } + hdmi_writeb(hdmi, val, HDMI_IH_I2CMPHY_STAT0); + return true; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 10/12] drm: bridge/dw_hdmi: add function dw_hdmi_phy_enable_spare
RK3288 HDMI will not work without the spare bit of HDMI_PHY_CONF0 enable Signed-off-by: Andy Yan --- Changes in v11: - split from patch Changes in v10: None Changes in v9: None Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c | 7 +++ drivers/gpu/drm/bridge/dw_hdmi.h | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index d5d5207..87f0327 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -715,6 +715,13 @@ static void dw_hdmi_phy_enable_tmds(struct dw_hdmi *hdmi, u8 enable) HDMI_PHY_CONF0_ENTMDS_MASK); } +static void dw_hdmi_phy_enable_spare(struct dw_hdmi *hdmi, u8 enable) +{ + hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, +HDMI_PHY_CONF0_SPARECTRL_OFFSET, +HDMI_PHY_CONF0_SPARECTRL_MASK); +} + static void dw_hdmi_phy_gen2_pddq(struct dw_hdmi *hdmi, u8 enable) { hdmi_mask_writeb(hdmi, enable, HDMI_PHY_CONF0, diff --git a/drivers/gpu/drm/bridge/dw_hdmi.h b/drivers/gpu/drm/bridge/dw_hdmi.h index b8412a9..30a6b28 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.h +++ b/drivers/gpu/drm/bridge/dw_hdmi.h @@ -837,7 +837,8 @@ enum { HDMI_PHY_CONF0_PDZ_OFFSET = 7, HDMI_PHY_CONF0_ENTMDS_MASK = 0x40, HDMI_PHY_CONF0_ENTMDS_OFFSET = 6, - HDMI_PHY_CONF0_SPARECTRL = 0x20, + HDMI_PHY_CONF0_SPARECTRL_MASK = 0x20, + HDMI_PHY_CONF0_SPARECTRL_OFFSET = 5, HDMI_PHY_CONF0_GEN2_PDDQ_MASK = 0x10, HDMI_PHY_CONF0_GEN2_PDDQ_OFFSET = 4, HDMI_PHY_CONF0_GEN2_TXPWRON_MASK = 0x8, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 11/12] dt-bindings: Add documentation for rockchip dw hdmi
Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: None Changes in v9: None Changes in v8: - Add documentation for rockchip dw hdmi Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None .../devicetree/bindings/video/dw_hdmi-rockchip.txt | 43 ++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt diff --git a/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt b/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt new file mode 100644 index 000..6ea6764 --- /dev/null +++ b/Documentation/devicetree/bindings/video/dw_hdmi-rockchip.txt @@ -0,0 +1,43 @@ +Rockchip specific extensions to the Synopsys Designware HDMI + + +Required properties: +- compatible: "rockchip,rk3288-dw-hdmi"; +- reg: physical base address of the controller and length +- ddc-i2c-bus: phandle of an I2C controller used for DDC EDID probing +- clocks: from common clock binding: handle to hdmi clock. +- clock-names: should be "clk" "hdcp_clk" +- rockchip,grf: this soc should set GRF regs to mux vopl/vopb. +- interrupts: HDMI interrupt number +- ports: contain a port node with endpoint definitions as defined in + Documentation/devicetree/bindings/media/video-interfaces.txt. For + vopb,set the reg = <0> and set the reg = <1> for vopl. +- reg-io-width: the width of the reg:1,4, the value should be 4 on + rk3288 platform + +Example: +hdmi: hdmi@ff98 { + compatible = "rockchip,rk3288-dw-hdmi"; + reg = <0xff98 0x2>; + reg-io-width = <4>; + ddc-i2c-bus = <&i2c5>; + rockchip,grf = <&grf>; + interrupts = ; + clocks = <&cru PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>; + clock-names = "clk", "hdcp_clk"; + status = "disabled"; + ports { + hdmi_in: port { + #address-cells = <1>; + #size-cells = <0>; + hdmi_in_vopb: endpoint@0 { + reg = <0>; + remote-endpoint = <&vopb_out_hdmi>; + }; + hdmi_in_vopl: endpoint@1 { + reg = <1>; + remote-endpoint = <&vopl_out_hdmi>; + }; + }; + }; +}; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v11 12/12] drm: bridge/dw_hdmi: add rockchip rk3288 support
Rockchip RK3288 hdmi is compatible with dw_hdmi Signed-off-by: Andy Yan --- Changes in v11: None Changes in v10: - add more display mode support mpll configuration for rk3288 Changes in v9: - move some phy configuration to platform driver Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/bridge/dw_hdmi.c| 3 + drivers/gpu/drm/rockchip/Kconfig| 10 + drivers/gpu/drm/rockchip/Makefile | 2 +- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 355 include/drm/bridge/dw_hdmi.h| 1 + 5 files changed, 370 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c index 87f0327..5a0a498 100644 --- a/drivers/gpu/drm/bridge/dw_hdmi.c +++ b/drivers/gpu/drm/bridge/dw_hdmi.c @@ -853,6 +853,9 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep, dw_hdmi_phy_gen2_txpwron(hdmi, 1); dw_hdmi_phy_gen2_pddq(hdmi, 0); + if (hdmi->dev_type == RK3288_HDMI) + dw_hdmi_phy_enable_spare(hdmi, 1); + /*Wait for PHY PLL lock */ msec = 5; do { diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig index 0ff6682..06371ae 100644 --- a/drivers/gpu/drm/rockchip/Kconfig +++ b/drivers/gpu/drm/rockchip/Kconfig @@ -15,3 +15,13 @@ config DRM_ROCKCHIP management to userspace. This driver does not provide 2D or 3D acceleration; acceleration is performed by other IP found on the SoC. + +config ROCKCHIP_DW_HDMI +bool "Rockchip specific extensions for Synopsys DW HDMI" +depends on DRM_ROCKCHIP +select DRM_DW_HDMI +help + This selects support for Rockchip SoC specific extensions + for the Synopsys DesignWare HDMI driver. If you want to + enable HDMI on RK3288 based SoC, you should selet this + option. diff --git a/drivers/gpu/drm/rockchip/Makefile b/drivers/gpu/drm/rockchip/Makefile index b3a5193..347e65c 100644 --- a/drivers/gpu/drm/rockchip/Makefile +++ b/drivers/gpu/drm/rockchip/Makefile @@ -4,5 +4,5 @@ rockchipdrm-y := rockchip_drm_drv.o rockchip_drm_fb.o rockchip_drm_fbdev.o \ rockchip_drm_gem.o rockchip_drm_vop.o - +rockchipdrm-$(CONFIG_ROCKCHIP_DW_HDMI) += dw_hdmi-rockchip.o obj-$(CONFIG_DRM_ROCKCHIP) += rockchipdrm.o diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c new file mode 100644 index 000..16cad75 --- /dev/null +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -0,0 +1,355 @@ +/* + * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rockchip_drm_drv.h" +#include "rockchip_drm_vop.h" + +#define GRF_SOC_CON60x025c +#define HDMI_SEL_VOP_LIT(1 << 4) + +struct rockchip_hdmi { + struct device *dev; + struct clk *clk; + struct clk *hdcp_clk; + struct regmap *regmap; + struct drm_encoder encoder; +}; + +#define to_rockchip_hdmi(x)container_of(x, struct rockchip_hdmi, x) + +static const struct mpll_config rockchip_mpll_cfg[] = { + { + 2700, { + { 0x00b3, 0x}, + { 0x2153, 0x}, + { 0x40f3, 0x} + }, + }, { + 3600, { + { 0x00b3, 0x}, + { 0x2153, 0x}, + { 0x40f3, 0x} + }, + }, { + 4000, { + { 0x00b3, 0x}, + { 0x2153, 0x}, + { 0x40f3, 0x} + }, + }, { + 5400, { + { 0x0072, 0x0001}, + { 0x2142, 0x0001}, + { 0x40a2, 0x0001}, + }, + }, { + 6500, { + { 0x0072, 0x0001}, + { 0x2142, 0x0001}, + { 0x40a2, 0x0001}, + }, + }, { + 6600, { + { 0x013e, 0x0003}, + { 0x217e, 0x0002}, + { 0x4061, 0x0002} + }, + }, { + 7425, { + { 0x0072, 0x0001}, + { 0x2145, 0x0002}, + { 0x406
[PATCH 1/1] staging: unisys: small parser.c bug fix
Replaced "cleanups" in the struct parser_init_guts with err_rgn, err_ctx, and out_rgn. The purpose is to remove redundant code and have proper error handling Signed-off-by: Jeffrey Brown --- drivers/staging/unisys/visorchipset/parser.c | 43 +++-- 1 files changed, 19 insertions(+), 24 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 5f6a7b2..2897125 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -64,8 +64,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, MAX_CONTROLVM_PAYLOAD_BYTES); if (try_again) *try_again = TRUE; - rc = NULL; - goto cleanups; } ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); if (ctx == NULL) { @@ -74,7 +72,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, if (try_again) *try_again = TRUE; rc = NULL; - goto cleanups; + return NULL; } ctx->allocbytes = allocbytes; @@ -90,7 +88,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, __func__, (unsigned long long)addr, (ulong)bytes); rc = NULL; - goto cleanups; } p = __va((ulong)(addr)); memcpy(ctx->data, p, bytes); @@ -98,17 +95,17 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, rgn = visor_memregion_create(addr, bytes); if (!rgn) { rc = NULL; - goto cleanups; + goto err_ctx; } if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) { rc = NULL; - goto cleanups; + goto err_ctx; } } if (!has_standard_payload_header) { ctx->byte_stream = TRUE; rc = ctx; - goto cleanups; + goto err_rgn; } phdr = (struct spar_controlvm_parameters_header *)(ctx->data); if (phdr->total_length != bytes) { @@ -116,7 +113,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, __func__, (ulong)(phdr->total_length), (ulong)(bytes)); rc = NULL; - goto cleanups; + goto out_rgn; } if (phdr->total_length < phdr->header_length) { ERRDRV("%s - total length < header length (%lu < %lu)", @@ -124,7 +121,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, (ulong)(phdr->total_length), (ulong)(phdr->header_length)); rc = NULL; - goto cleanups; + goto err_rgn; } if (phdr->header_length < sizeof(struct spar_controlvm_parameters_header)) { @@ -134,24 +131,22 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, (ulong)(sizeof( struct spar_controlvm_parameters_header))); rc = NULL; - goto cleanups; + goto err_rgn; } - rc = ctx; -cleanups: - if (rgn) { +out_rgn: + if (rgn) visor_memregion_destroy(rgn); - rgn = NULL; - } - if (rc) { - controlvm_payload_bytes_buffered += ctx->param_bytes; - } else { - if (ctx) { - parser_done(ctx); - ctx = NULL; - } - } - return rc; + + return ctx; + +err_rgn: + if (rgn) + visor_memregion_destroy(rgn); + +err_ctx: + kfree(ctx); + return NULL; } struct parser_context_tag * -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: unisys: small parser.c bug fix
Better, but it still needs more work. On Fri, Nov 14, 2014 at 07:41:28AM -0500, Jeffrey Brown wrote: > Replaced "cleanups" in the struct parser_init_guts with err_rgn, > err_ctx, and out_rgn. The purpose is to remove redundant code and > have proper error handling > > Signed-off-by: Jeffrey Brown > --- > drivers/staging/unisys/visorchipset/parser.c | 43 +++-- > 1 files changed, 19 insertions(+), 24 deletions(-) > > diff --git a/drivers/staging/unisys/visorchipset/parser.c > b/drivers/staging/unisys/visorchipset/parser.c > index 5f6a7b2..2897125 100644 > --- a/drivers/staging/unisys/visorchipset/parser.c > +++ b/drivers/staging/unisys/visorchipset/parser.c > @@ -64,8 +64,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > MAX_CONTROLVM_PAYLOAD_BYTES); > if (try_again) > *try_again = TRUE; > - rc = NULL; > - goto cleanups; return NULL; > } > ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY); > if (ctx == NULL) { > @@ -74,7 +72,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > if (try_again) > *try_again = TRUE; > rc = NULL; > - goto cleanups; > + return NULL; > } > > ctx->allocbytes = allocbytes; > @@ -90,7 +88,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > __func__, > (unsigned long long)addr, (ulong)bytes); > rc = NULL; > - goto cleanups; goto err_ctx; > } > p = __va((ulong)(addr)); > memcpy(ctx->data, p, bytes); > @@ -98,17 +95,17 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > rgn = visor_memregion_create(addr, bytes); > if (!rgn) { > rc = NULL; > - goto cleanups; > + goto err_ctx; > } > if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) { > rc = NULL; > - goto cleanups; > + goto err_ctx; > } > } > if (!has_standard_payload_header) { > ctx->byte_stream = TRUE; > rc = ctx; > - goto cleanups; > + goto err_rgn; This is not an error. goto out_ctx; > } > phdr = (struct spar_controlvm_parameters_header *)(ctx->data); > if (phdr->total_length != bytes) { > @@ -116,7 +113,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > __func__, > (ulong)(phdr->total_length), (ulong)(bytes)); > rc = NULL; > - goto cleanups; > + goto out_rgn; This is an error. goto err_rgn; > } > if (phdr->total_length < phdr->header_length) { > ERRDRV("%s - total length < header length (%lu < %lu)", > @@ -124,7 +121,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > (ulong)(phdr->total_length), > (ulong)(phdr->header_length)); > rc = NULL; > - goto cleanups; > + goto err_rgn; > } > if (phdr->header_length < > sizeof(struct spar_controlvm_parameters_header)) { > @@ -134,24 +131,22 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > (ulong)(sizeof( > struct spar_controlvm_parameters_header))); > rc = NULL; > - goto cleanups; > + goto err_rgn; > } > > - rc = ctx; > -cleanups: > - if (rgn) { > +out_rgn: > + if (rgn) > visor_memregion_destroy(rgn); > - rgn = NULL; > - } > - if (rc) { > - controlvm_payload_bytes_buffered += ctx->param_bytes; > - } else { > - if (ctx) { > - parser_done(ctx); > - ctx = NULL; > - } > - } > - return rc; Missing line: controlvm_payload_bytes_buffered += ctx->param_bytes; > + > + return ctx; > + > +err_rgn: > + if (rgn) > + visor_memregion_destroy(rgn); > + > +err_ctx: > + kfree(ctx); > + return NULL; regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: unisys: small parser.c bug fix
On Fri, Nov 14, 2014 at 05:43:24PM +0300, Dan Carpenter wrote: > > @@ -90,7 +88,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, > >__func__, > >(unsigned long long)addr, (ulong)bytes); > > rc = NULL; > > - goto cleanups; Also after this patch then every reference to "rc" in this function should be deleted. You forgot to delete one here. It doesn't cause a bug but it's messy to leave unneeded variables. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Patch for applying pixelclk-active in ipuv3-crtc.c
Hi, attached patch applies value of pixelclk-active to support displays which need a falling edge on pixelclk like seiko-wvga on wandboard. diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 720868b..71c741b 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c @@ -166,7 +166,9 @@ static int ipu_crtc_mode_set(struct drm_crtc *crtc, sig_cfg.Vsync_pol = 1; sig_cfg.enable_pol = 1; - sig_cfg.clk_pol = 0; + sig_cfg.clk_pol = 0; /* rising edge */ + if (mode->private_flags & DRM_MODE_FLAG_PCSYNC) /* falling edge */ + sig_cfg.clk_pol = 1; sig_cfg.width = mode->hdisplay; sig_cfg.height = mode->vdisplay; sig_cfg.pixel_fmt = out_pixel_fmt; diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index 4ca61af..bf7eee4 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "imx-drm.h" @@ -80,11 +82,15 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) if (np) { struct drm_display_mode *mode = drm_mode_create(connector->dev); + struct videomode vm; if (!mode) return -EINVAL; of_get_drm_display_mode(np, &imxpd->mode, OF_USE_NATIVE_MODE); drm_mode_copy(mode, &imxpd->mode); mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, + /* imxpd->mode.flags does not contain all flags from devicetree */ + of_get_videomode(np, &vm, OF_USE_NATIVE_MODE); + mode->private_flags=vm.flags; drm_mode_probed_add(connector, mode); num_modes++; } -- 2.1.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] staging: unisys: small parser.c bug fix
Replaced "cleanups" in the struct parser_init_guts with err_rgn, err_ctx, and out_rgn. The purpose is to remove redundant code and have proper error handling. Put "goto out_rgn" on lin 108 because there was no "out_ctx". Signed-off-by: Jeffrey Brown --- drivers/staging/unisys/visorchipset/parser.c | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 2897125..d31c856 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -71,7 +71,6 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, __func__, __FILE__, __LINE__, allocbytes); if (try_again) *try_again = TRUE; - rc = NULL; return NULL; } @@ -87,40 +86,41 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, ERRDRV("%s - bad local address (0x%-16.16Lx for %lu)", __func__, (unsigned long long)addr, (ulong)bytes); - rc = NULL; + return NULL; + goto err_ctx; } p = __va((ulong)(addr)); memcpy(ctx->data, p, bytes); } else { rgn = visor_memregion_create(addr, bytes); if (!rgn) { - rc = NULL; + return NULL; goto err_ctx; } if (visor_memregion_read(rgn, 0, ctx->data, bytes) < 0) { - rc = NULL; + return NULL; goto err_ctx; } } if (!has_standard_payload_header) { ctx->byte_stream = TRUE; rc = ctx; - goto err_rgn; + goto out_rgn; } phdr = (struct spar_controlvm_parameters_header *)(ctx->data); if (phdr->total_length != bytes) { ERRDRV("%s - bad total length %lu (should be %lu)", __func__, (ulong)(phdr->total_length), (ulong)(bytes)); - rc = NULL; - goto out_rgn; + return NULL; + goto err_rgn; } if (phdr->total_length < phdr->header_length) { ERRDRV("%s - total length < header length (%lu < %lu)", __func__, (ulong)(phdr->total_length), (ulong)(phdr->header_length)); - rc = NULL; + return NULL; goto err_rgn; } if (phdr->header_length < @@ -130,7 +130,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL is_local, (ulong)(phdr->header_length), (ulong)(sizeof( struct spar_controlvm_parameters_header))); - rc = NULL; + return NULL; goto err_rgn; } @@ -138,7 +138,8 @@ out_rgn: if (rgn) visor_memregion_destroy(rgn); - return ctx; + controlvm_payload_bytes_buffered += ctx->param_bytes; + return ctx; err_rgn: if (rgn) -- 1.8.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Patch for applying pixelclk-active in ipuv3-crtc.c
Hi Stefan, On Fri, Nov 14, 2014 at 2:39 PM, Stefan wrote: > Hi, > > attached patch applies value of pixelclk-active > to support displays which need a falling edge on pixelclk like > seiko-wvga on wandboard. Thanks for the patch. Please split it in two patches: one for ipuv3-crtc.c and another one for parallel-display.c. Then follow Documentation/SubmittingPatches for the correct process. You need to add your Signed-off-by and do not send it as attachment. Send it via git send-email and also Cc Phillip Zabel. Regards, Fabio Estevam ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: unisys: small parser.c bug fix
I'm sorry this one doesn't make any sense. ??? Take the weekend off. Have your co-workers review the patch on Monday. Then resend. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [V2 PATCH 01/10] added media agnostic (MA) USB HCD driver
On Wed, Nov 12, 2014 at 05:03:18PM -0500, Alan Stern wrote: > On Wed, 12 Nov 2014, Sean O. Stalley wrote: > > Our plan to support multiple MA devices is to have them all connected > > to the same virtual host controller, so only 1 would be needed. > > > > Would you prefer we have 1 host controller instance per MA device? > > We are definitely open to suggestions on how this should be architected. > > I haven't read the MA USB spec, so I don't know how it's intended to > work. Still, what happens if you create a virtual host controller > with, say, 16 ports, and then someone wants to connect a 17th MA > device? To summarize the spec: MA USB groups a host & connected devices into MA service sets (MSS). The architectural limit is 254 MA devices per MSS. If the host needs to connect more devices than that, It can start a new MSS and connect to 254 more MA devices. Is supporting up to 254 devices on one machine sufficient? Would it make sense (and does the usb stack support) having 254 root ports on one host controller? If so, we could make our host controller instance have 254 ports. I'm guessing the hub driver may have a problem with this (especially for superspeed). If that doesn't make sense (or isn't supported), we can have 1 host controller instance per MA device. Would that be preferred? > Also, I noticed that your patch adds a new bus type for these MA host > controllers. It really seems like overkill to have a whole new bus > type if there's only going to be one device on it. The bus was added when we were quickly trying to replace the platform device code. It's probably not the right thing to do. I'm still not sure why we can't make our hcd a platform device, especially since dummy_hcd & the usbip's hcd are both platform devices. > > If we get rid of these locks, endpoints can't run simultaneously. > > MA USB IN endpoints have to copy data, which could take a while. > > I don't know what you mean by "run simultaneously". Certainly multiple > network packets can be transmitted and received concurrently even if > you use a single spinlock, since your locking won't affect the > networking subsystem. I meant we couldn't have 2 threads in our driver. With one lock, One thread would always have to wait for the other, even though they could be working on 2 different endpoints doing completely independent tasks. > > Couldn't this cause a bottleneck? > > Probably not enough to matter. After all, the other host controller > drivers rely on a single spinlock. And if it did matter, you could > drop the spinlock while copying the data. Good point. We can cut our driver down to using 1 lock. If we find that only having 1 spinlock does cause a bottleneck, we can deal with it then. Thanks, Sean ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] mmap() for vme_user and CR/CSR fix for master
Dear all, mmap() on VME bridge devices is a feature present in many existing Linux and UNIX drivers. The proposed solution follows the approach so that mmap() offsets are coherent with read() and write() offsets, which seems to be the only manner compatible with the current vme_user API. It also ends up adding vme_master_mmap call to the VME subsystem API. On one hand this might come useful for a board driver that will be able to expose one of its windows to the user that way. On the other hand it introduces dependency on vma_area_struct into vme.h, which doesn't seem very right. Also I'm bringing up a bugfix by Martyn Welch that was published on the list, but for some reason didn't make it to the kernel. Cheers, Dmitry Dmitry Kalinkin (2): staging: vme: use image mutex for ioctl() staging: vme: mmap() support for vme_user Martyn Welch (1): vme: tsi148: Master windows support USERx and CR/CSR accesses, not slaves drivers/staging/vme/devices/vme_user.c | 94 -- drivers/vme/bridges/vme_tsi148.c | 11 ++-- drivers/vme/vme.c | 26 ++ include/linux/vme.h| 1 + 4 files changed, 120 insertions(+), 12 deletions(-) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] vme: tsi148: Master windows support USERx and CR/CSR accesses, not slaves
From: Martyn Welch The tsi148 driver is registering the slave images as supporting the "USER" access modes and CR/CSR access mode rather than the master images as it should. Remove the incorrect case entries for these modes from the tsi148_slave_set() function, stop registering slave_images as supporting these modes and instead register master windows as supporting these modes. Signed-off-by: Martyn Welch Acked-by: Dmitry Kalinkin --- drivers/vme/bridges/vme_tsi148.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c index e07cfa8..895c2a3 100644 --- a/drivers/vme/bridges/vme_tsi148.c +++ b/drivers/vme/bridges/vme_tsi148.c @@ -587,11 +587,6 @@ static int tsi148_slave_set(struct vme_slave_resource *image, int enabled, granularity = 0x1; addr |= TSI148_LCSR_ITAT_AS_A64; break; - case VME_CRCSR: - case VME_USER1: - case VME_USER2: - case VME_USER3: - case VME_USER4: default: dev_err(tsi148_bridge->parent, "Invalid address space\n"); return -EINVAL; @@ -2471,7 +2466,8 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) master_image->locked = 0; master_image->number = i; master_image->address_attr = VME_A16 | VME_A24 | VME_A32 | - VME_A64; + VME_A64 | VME_CRCSR | VME_USER1 | VME_USER2 | + VME_USER3 | VME_USER4; master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT | VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 | VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER | @@ -2500,8 +2496,7 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) slave_image->locked = 0; slave_image->number = i; slave_image->address_attr = VME_A16 | VME_A24 | VME_A32 | - VME_A64 | VME_CRCSR | VME_USER1 | VME_USER2 | - VME_USER3 | VME_USER4; + VME_A64; slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT | VME_2eVME | VME_2eSST | VME_2eSSTB | VME_2eSST160 | VME_2eSST267 | VME_2eSST320 | VME_SUPER | VME_USER | -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] staging: vme: mmap() support for vme_user
We also make sure that user won't be able to reconfigure the window while it is mmap'ed. Signed-off-by: Dmitry Kalinkin Cc: Igor Alekseev --- drivers/staging/vme/devices/vme_user.c | 85 ++ drivers/vme/vme.c | 26 +++ include/linux/vme.h| 1 + 3 files changed, 112 insertions(+) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 8731838..b7fe1f0 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -17,6 +17,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -99,6 +100,7 @@ struct image_desc { struct device *device; /* Sysfs device */ struct vme_resource *resource; /* VME resource */ int users; /* Number of current users */ + int mmap_count; /* Number of current mmap's */ }; static struct image_desc image[VME_DEVS]; @@ -134,6 +136,10 @@ static ssize_t vme_user_write(struct file *, const char __user *, size_t, loff_t *); static loff_t vme_user_llseek(struct file *, loff_t, int); static long vme_user_unlocked_ioctl(struct file *, unsigned int, unsigned long); +static int vme_user_mmap(struct file *file, struct vm_area_struct *vma); + +static void vme_user_vm_open(struct vm_area_struct *vma); +static void vme_user_vm_close(struct vm_area_struct *vma); static int vme_user_match(struct vme_dev *); static int vme_user_probe(struct vme_dev *); @@ -147,6 +153,17 @@ static const struct file_operations vme_user_fops = { .llseek = vme_user_llseek, .unlocked_ioctl = vme_user_unlocked_ioctl, .compat_ioctl = vme_user_unlocked_ioctl, + .mmap = vme_user_mmap, +}; + +struct vme_user_vma_priv { + unsigned int minor; + atomic_t refcnt; +}; + +static const struct vm_operations_struct vme_user_vm_ops = { + .open = vme_user_vm_open, + .close = vme_user_vm_close, }; @@ -488,6 +505,11 @@ static int vme_user_ioctl(struct inode *inode, struct file *file, case VME_SET_MASTER: + if (image[minor].mmap_count != 0) { + pr_warn("Can't adjust mapped window\n"); + return -EPERM; + } + copied = copy_from_user(&master, argp, sizeof(master)); if (copied != 0) { pr_warn("Partial copy from userspace\n"); @@ -564,6 +586,69 @@ vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) return ret; } +static void vme_user_vm_open(struct vm_area_struct *vma) +{ + struct vme_user_vma_priv *vma_priv = vma->vm_private_data; + + atomic_inc(&vma_priv->refcnt); +} + +static void vme_user_vm_close(struct vm_area_struct *vma) +{ + struct vme_user_vma_priv *vma_priv = vma->vm_private_data; + unsigned int minor = vma_priv->minor; + + if (!atomic_dec_and_test(&vma_priv->refcnt)) + return; + + mutex_lock(&image[minor].mutex); + image[minor].mmap_count--; + mutex_unlock(&image[minor].mutex); + + kfree(vma_priv); +} + +static int vme_user_master_mmap(unsigned int minor, struct vm_area_struct *vma) +{ + int err; + struct vme_user_vma_priv *vma_priv; + + mutex_lock(&image[minor].mutex); + + err = vme_master_mmap(image[minor].resource, vma); + if (err) { + mutex_unlock(&image[minor].mutex); + return err; + } + + vma_priv = kmalloc(sizeof(struct vme_user_vma_priv), GFP_KERNEL); + if (vma_priv == NULL) { + mutex_unlock(&image[minor].mutex); + return -ENOMEM; + } + + vma_priv->minor = minor; + atomic_set(&vma_priv->refcnt, 1); + vma->vm_ops = &vme_user_vm_ops; + vma->vm_private_data = vma_priv; + + image[minor].mmap_count++; + + mutex_unlock(&image[minor].mutex); + + return 0; +} + +static int vme_user_mmap(struct file *file, struct vm_area_struct *vma) +{ + unsigned int minor = MINOR(file->f_dentry->d_inode->i_rdev); + + if (type[minor] == MASTER_MINOR) + return vme_user_master_mmap(minor, vma); + + return -ENODEV; +} + /* * Unallocate a previously allocated buffer diff --git a/drivers/vme/vme.c b/drivers/vme/vme.c index 7516030..3dc62b4 100644 --- a/drivers/vme/vme.c +++ b/drivers/vme/vme.c @@ -609,6 +609,32 @@ unsigned int vme_master_rmw(struct vme_resource *resource, unsigned int mask, } EXPORT_SYMBOL(vme_master_rmw); +int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma) +{ + struct vme_master_resource *image; + phys_addr_t phys_addr; + unsigned long vma_size; + + if (resource->type != VME_MASTER) { + printk(KERN_ERR "Not a master resource\n"); +
[PATCH 1/3] staging: vme: use image mutex for ioctl()
This implements more granular locking in vme_user_ioctl() by using separate locks for each devfs device. This also provides a synchronization between vme_user_read(), vme_user_write() and vme_user_ioctl(). Signed-off-by: Dmitry Kalinkin Cc: Igor Alekseev --- drivers/staging/vme/devices/vme_user.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c index 8b1f533..8731838 100644 --- a/drivers/staging/vme/devices/vme_user.c +++ b/drivers/staging/vme/devices/vme_user.c @@ -41,7 +41,6 @@ #include "vme_user.h" -static DEFINE_MUTEX(vme_user_mutex); static const char driver_name[] = "vme_user"; static int bus[VME_USER_BUS_MAX]; @@ -555,10 +554,12 @@ static long vme_user_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { int ret; + struct inode *inode = file_inode(file); + unsigned int minor = MINOR(inode->i_rdev); - mutex_lock(&vme_user_mutex); - ret = vme_user_ioctl(file_inode(file), file, cmd, arg); - mutex_unlock(&vme_user_mutex); + mutex_lock(&image[minor].mutex); + ret = vme_user_ioctl(inode, file, cmd, arg); + mutex_unlock(&image[minor].mutex); return ret; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] staging: vme: mmap() support for vme_user
On Sat, Nov 15, 2014 at 02:36:17AM +0300, Dmitry Kalinkin wrote: > +int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct > *vma) > +{ > + struct vme_master_resource *image; > + phys_addr_t phys_addr; > + unsigned long vma_size; > + > + if (resource->type != VME_MASTER) { > + printk(KERN_ERR "Not a master resource\n"); Run your patch through scripts/checkpatch.pl Also warning messages let people flood /var/log/messages so they can be a DoS vector. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel