From: Philipp Zabel <p.zabel@pengutronix.de>
To: Andy Yan <andy.yan@rock-chips.com>
Cc: heiko@sntech.de, airlied@linux.ie,
dri-devel@lists.freedesktop.org, ykk@rock-chips.com,
devel@driverdev.osuosl.org, linux-rockchip@lists.infradead.org,
Grant Likely <grant.likely@linaro.org>,
Dave Airlie <airlied@redhat.com>,
devicetree@vger.kernel.org, Zubair.Kakakhel@imgtec.com,
Arnd Bergmann <arnd@arndb.de>, Inki Dae <inki.dae@samsung.com>,
Rob Herring <robh+dt@kernel.org>,
Sean Paul <seanpaul@chromium.org>,
rmk+kernel@arm.linux.org.uk, fabio.estevam@freescale.com,
Josh Boyer <jwboyer@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, djkurtz@google.com,
Shawn Guo <shawn.guo@linaro.org>,
Lucas Stach <l.stach@pengutronix.de>
Subject: Re: [PATCH 1/2] imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi
Date: Wed, 05 Nov 2014 14:41:22 +0100 [thread overview]
Message-ID: <1415194882.5696.9.camel@pengutronix.de> (raw)
In-Reply-To: <1415192101-6404-2-git-send-email-andy.yan@rock-chips.com>
Hi Andy,
I think separating the core from the SoC specific part is a good step
into the right direction.
Am Mittwoch, den 05.11.2014, 20:55 +0800 schrieb Andy Yan:
> imx6 and rockchip rk3288 and JZ4780 (Ingenic Xburst/MIPS)
> use the interface compatible Designware HDMI IP, but they
> also have some lightly difference, such as phy pll configuration,
> register width(imx hdmi register is one byte, but rk3288 is 4
> bytes width), 4K support(imx6 doesn't support 4k, but rk3288 does),
> 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 <andy.yan@rock-chips.com>
[...]
> +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);
> + }
Surely this IP core needs to be clocked regardless of the SoC? How are
clocks controlled on rk3288 and jz4780?
[...]
> +/*On rockchip platform, no-word access to the hdmi
> + * register will causes an imprecise external abort
> + */
> +static inline void hdmi_writel(struct imx_hdmi *hdmi, u32 val, int offset)
> +{
> + writel(val, hdmi->regs + (offset << 2));
> +}
>
> - bool phy_enabled;
> - struct drm_display_mode previous_mode;
> +static inline u32 hdmi_readl(struct imx_hdmi *hdmi, int offset)
> +{
> + return readl(hdmi->regs + (offset << 2));
> +}
>
> - struct regmap *regmap;
> - struct i2c_adapter *ddc;
> - void __iomem *regs;
> +static void hdmi_modl(struct imx_hdmi *hdmi, u32 data, u32 mask, unsigned reg)
> +{
> + u32 val = hdmi_readl(hdmi, reg) & ~mask;
>
> - unsigned int sample_rate;
> - int ratio;
> -};
> + val |= data & mask;
> + hdmi_writel(hdmi, val, reg);
> +}
>
> -static void imx_hdmi_set_ipu_di_mux(struct imx_hdmi *hdmi, int ipu_di)
> +static void hdmi_mask_writel(struct imx_hdmi *hdmi, u32 data, unsigned int reg,
> + u32 shift, u32 mask)
> {
> - regmap_update_bits(hdmi->regmap, IOMUXC_GPR3,
> - IMX6Q_GPR3_HDMI_MUX_CTL_MASK,
> - ipu_di << IMX6Q_GPR3_HDMI_MUX_CTL_SHIFT);
> + hdmi_modl(hdmi, data << shift, mask, reg);
> }
>
> -static inline void hdmi_writeb(struct imx_hdmi *hdmi, u8 val, int offset)
> +static inline void hdmi_writeb(struct imx_hdmi *hdmi, u32 val, int offset)
> {
> writeb(val, hdmi->regs + offset);
> }
>
> -static inline u8 hdmi_readb(struct imx_hdmi *hdmi, int offset)
> +static inline u32 hdmi_readb(struct imx_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 imx_hdmi *hdmi, u32 data, u32 mask, unsigned reg)
> {
> u8 val = hdmi_readb(hdmi, reg) & ~mask;
Do you really need to use readl instead of readb? In my opinion it would
be better then to convert the driver to use regmap for register access
(in a separate patch) and then let the SoC specific driver extension
provide the regmap to the core driver.
[...]
> diff --git a/include/drm/bridge/dw_hdmi.h b/include/drm/bridge/dw_hdmi.h
> new file mode 100644
> index 0000000..e7e8285
> --- /dev/null
> +++ b/include/drm/bridge/dw_hdmi.h
> @@ -0,0 +1,114 @@
> +/*
> + * Copyright (C) 2011 Freescale Semiconductor, Inc.
> + *
> + * 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.
> + */
> +
> +#ifndef __DW_HDMI_H__
> +#define __DW_HDMI_H__
> +
> +#include <drm/drmP.h>
> +
> +#define HDMI_EDID_LEN 512
> +
> +enum {
> + RES_8,
> + RES_10,
> + RES_12,
> + RES_MAX,
> +};
> +
> +enum imx_hdmi_devtype {
> + IMX6Q_HDMI,
> + IMX6DL_HDMI,
> +};
> +
> +struct mpll_config {
> + unsigned long mpixelclock;
> + struct {
> + u16 cpce;
> + u16 gmp;
> + } res[RES_MAX];
> +};
> +
> +struct curr_ctrl {
> + unsigned long mpixelclock;
> + u16 curr[RES_MAX];
> +};
For a header file in include/drm/bridge maybe these struct names are a
bit too generic now.
regards
Philipp
next prev parent reply other threads:[~2014-11-05 13:41 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-05 12:54 [PATCH V2 0/2] make imx hdmi publicly used by dw hdmi compatible platform Andy Yan
2014-11-05 12:55 ` [PATCH 1/2] imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi Andy Yan
2014-11-05 13:41 ` Philipp Zabel [this message]
2014-11-07 2:47 ` Andy Yan
2014-11-06 11:21 ` [PATCH V3 0/4] dw-hdmi: make imx hdmi publicly used by dw hdmi compatible platform Andy Yan
[not found] ` <1415272913-56889-1-git-send-email-andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-11-06 11:23 ` [PATCH V3 1/4] imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi Andy Yan
2014-11-06 11:24 ` [PATCH V3 2/4] dw-hdmi: move imx-hdmi to bridge/dw-hdmi Andy Yan
2014-11-06 11:25 ` [PATCH V3 3/4] dw-hdmi: add support for multi byte register width access Andy Yan
2014-11-06 11:26 ` [PATCH V3 4/4] dw-hdmi: convert dw-hdmi to drm_bridge mode Andy Yan
2014-11-06 15:54 ` Greg Kroah-Hartman
2014-11-07 2:21 ` Andy Yan
2014-11-07 11:27 ` [PATCH V4 0/6] dw-hdmi: make imx hdmi publicly used by dw hdmi compatible platform Andy Yan
[not found] ` <1415359672-8402-1-git-send-email-andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-11-07 11:30 ` [PATCH V4 1/6] imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi Andy Yan
[not found] ` <1415359841-8463-1-git-send-email-andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-11-07 11:32 ` [PATCH V4 2/6] dw-hdmi: move imx-hdmi to bridge/dw-hdmi Andy Yan
[not found] ` <1415359958-8512-1-git-send-email-andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-11-07 11:33 ` [PATCH V4 3/6] dw-hdmi: make checkpatch happy Andy Yan
2014-11-07 11:34 ` [PATCH V4 4/6] dw-hdmi: return defer if can't get ddc i2c adapter Andy Yan
2014-11-07 11:35 ` [PATCH V4 5/6] dw-hdmi: add support for multi byte register width access Andy Yan
2014-11-07 11:36 ` [PATCH V4 6/6] dw-hdmi: convert dw-hdmi to drm_bridge mode Andy Yan
2014-11-07 11:45 ` [PATCH V4 5/6] dw-hdmi: add support for multi byte register width access Lucas Stach
2014-11-08 3:19 ` Andy Yan
-- strict thread matches above, loose matches on Subject: below --
2014-11-04 13:33 [PATCH 0/2] make imx hdmi publicly used by dw hdmi compatible platform Andy Yan
[not found] ` <1415107992-34289-1-git-send-email-andy.yan-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2014-11-04 13:33 ` [PATCH 1/2] imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi Andy Yan
2014-11-04 14:23 ` Zubair Lutfullah Kakakhel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415194882.5696.9.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=Zubair.Kakakhel@imgtec.com \
--cc=airlied@linux.ie \
--cc=airlied@redhat.com \
--cc=andy.yan@rock-chips.com \
--cc=arnd@arndb.de \
--cc=devel@driverdev.osuosl.org \
--cc=devicetree@vger.kernel.org \
--cc=djkurtz@google.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=fabio.estevam@freescale.com \
--cc=grant.likely@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=heiko@sntech.de \
--cc=inki.dae@samsung.com \
--cc=jwboyer@redhat.com \
--cc=l.stach@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=robh+dt@kernel.org \
--cc=seanpaul@chromium.org \
--cc=shawn.guo@linaro.org \
--cc=ykk@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).