From: Daniel Kurtz <djkurtz@chromium.org>
To: Yakir Yang <ykk@rock-chips.com>
Cc: "David Airlie" <airlied@linux.ie>,
"Russell King" <rmk+kernel@arm.linux.org.uk>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Fabio Estevam" <fabio.estevam@freescale.com>,
"Shawn Guo" <shawn.guo@linaro.org>,
"Rob Clark" <robdclark@gmail.com>,
"Mark Yao" <mark.yao@rock-chips.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
dri-devel <dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Arnd Bergmann" <arnd@arndb.de>, "Sean Cross" <xobs@kosagi.com>,
"Jyri Sarha" <jsarha@ti.com>, "Ben Zhang" <benzh@chromium.org>,
alsa-devel@alsa-project.org, "Heiko Stuebner" <heiko@sntech.de>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"Rob Herring" <robh+dt@kernel.org>,
"Pawel Moll" <pawel.moll@arm.com>,
"Mark Rutland" <mark.rutland@arm.com>,
"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
"Kumar Gala" <galak@codeaurora.org>,
"open list:OPEN FIRMWARE AND..." <devicetree@vger.kernel.org>,
"Heiko Stübner" <mmind00@googlemail.com>,
"Douglas Anderson" <dianders@chromium.org>,
"Stéphane Marchesin" <marcheu@chromium.org>,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>
Subject: Re: [PATCH v3 04/15] drm: bridge/dw_hdmi: add indentification registers parse and record
Date: Thu, 5 Feb 2015 23:46:29 +0800 [thread overview]
Message-ID: <CAGS+omCiGh0-4BbPjPS+KqMW9-OpJ8Je7o37Web06w1CR7RPgw@mail.gmail.com> (raw)
In-Reply-To: <1422976283-30071-1-git-send-email-ykk@rock-chips.com>
On Tue, Feb 3, 2015 at 11:11 PM, Yakir Yang <ykk@rock-chips.com> wrote:
> By parsing the indentification registers we can know what functions
> are present on the hdmi ip.
>
> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
> ---
> Changes in v3:
> - Add ID registers parse and record
>
> Changes in v2: None
>
> drivers/gpu/drm/bridge/dw_hdmi.c | 59 ++++++++++++++++++++++++++++++++++++++++
> drivers/gpu/drm/bridge/dw_hdmi.h | 23 ++++++++++++++++
> 2 files changed, 82 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
> index 08f10da..7b5b664 100644
> --- a/drivers/gpu/drm/bridge/dw_hdmi.c
> +++ b/drivers/gpu/drm/bridge/dw_hdmi.c
> @@ -79,6 +79,23 @@ static const u16 csc_coeff_rgb_in_eitu709[3][4] = {
> { 0x6756, 0x78ab, 0x2000, 0x0200 }
> };
>
> +struct hdmi_id {
> + u8 design;
> + u8 revision;
> +
> + bool prepen;
> + bool audspdif;
> + bool audi2s;
> + bool hdmi14;
> + bool csc;
> + bool hdcp;
> + bool hdmi20;
> + bool confapb;
> + bool ahbauddma;
> + bool gpaud;
> + u8 phy_type;
> +};
> +
> struct hdmi_vmode {
> bool mdvi;
> bool mhsyncpolarity;
> @@ -111,6 +128,8 @@ struct dw_hdmi {
> struct clk *isfr_clk;
> struct clk *iahb_clk;
>
> + struct hdmi_id id;
> +
> struct hdmi_data_info hdmi_data;
> const struct dw_hdmi_plat_data *plat_data;
>
> @@ -1259,6 +1278,36 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
> return 0;
> }
>
> +static void hdmi_parse_id(struct dw_hdmi *hdmi)
> +{
> + u8 config0_id, config1_id, config2_id, config3_id;
> +
> + config0_id = hdmi_readb(hdmi, HDMI_CONFIG0_ID);
> + config1_id = hdmi_readb(hdmi, HDMI_CONFIG1_ID);
> + config2_id = hdmi_readb(hdmi, HDMI_CONFIG2_ID);
> + config3_id = hdmi_readb(hdmi, HDMI_CONFIG3_ID);
> +
> + hdmi->id.prepen = config0_id & HDMI_CONFIG0_ID_PREPEN ? true : false;
These could all be "!!(A & B)", but perhaps that is just a matter of
personal preference.
> + hdmi->id.audi2s = config0_id & HDMI_CONFIG0_ID_AUDI2S ? true : false;
> + hdmi->id.hdmi14 = config0_id & HDMI_CONFIG0_ID_HDMI14 ? true : false;
> + hdmi->id.hdcp = config0_id & HDMI_CONFIG0_ID_HDCP ? true : false;
> + hdmi->id.csc = config0_id & HDMI_CONFIG0_ID_CSC ? true : false;
> + hdmi->id.audspdif = config0_id & HDMI_CONFIG0_ID_AUDSPDIF ?
> + true : false;
> +
> + hdmi->id.confapb = config1_id & HDMI_CONFIG1_ID_CONFAPB ? true : false;
> + hdmi->id.hdmi20 = config1_id & HDMI_CONFIG1_ID_HDMI20 ? true : false;
> +
> + hdmi->id.phy_type = config2_id & HDMI_CONFIG2_ID;
HDMI_CONFIG2_ID is a register offset, not a mask.
> +
> + hdmi->id.gpaud = config3_id & HDMI_CONFIG3_ID_GPAUD ? true : false;
> + hdmi->id.ahbauddma = config3_id & HDMI_CONFIG3_ID_AHBAUDDMA ?
> + true : false;
> +
> + hdmi->id.design = hdmi_readb(hdmi, HDMI_DESIGN_ID);
> + hdmi->id.revision = hdmi_readb(hdmi, HDMI_REVISION_ID);
> +}
> +
> /* Wait until we are registered to enable interrupts */
> static int dw_hdmi_fb_registered(struct dw_hdmi *hdmi)
> {
> @@ -1670,6 +1719,16 @@ int dw_hdmi_bind(struct device *dev, struct device *master,
> hdmi_readb(hdmi, HDMI_PRODUCT_ID0),
> hdmi_readb(hdmi, HDMI_PRODUCT_ID1));
>
> + /* Config IDs */
> + dev_info(dev,
> + "Detected HDMI config_id 0x%x:0x%x:0x%x:0x%x\n",
> + hdmi_readb(hdmi, HDMI_CONFIG0_ID),
> + hdmi_readb(hdmi, HDMI_CONFIG1_ID),
> + hdmi_readb(hdmi, HDMI_CONFIG2_ID),
> + hdmi_readb(hdmi, HDMI_CONFIG3_ID));
> +
> + hdmi_parse_id(hdmi);
It seems a bit silly to read the regs once to print them, and then
again in hdmi_parse_id().
Perhaps move the dev_info() inside hdmi_parse_id().
It would also be nice to print a full summary of all of the parsed fields.
> +
> initialize_hdmi_ih_mutes(hdmi);
>
> ret = devm_request_threaded_irq(dev, irq, dw_hdmi_hardirq,
> diff --git a/drivers/gpu/drm/bridge/dw_hdmi.h b/drivers/gpu/drm/bridge/dw_hdmi.h
> index 175dbc8..e4ba634 100644
> --- a/drivers/gpu/drm/bridge/dw_hdmi.h
> +++ b/drivers/gpu/drm/bridge/dw_hdmi.h
> @@ -545,6 +545,29 @@
> #define HDMI_I2CM_FS_SCL_LCNT_0_ADDR 0x7E12
>
> enum {
> +/* HDMI_CONFIG0_ID */
> + HDMI_CONFIG0_ID_PREPEN = 0x80,
> + HDMI_CONFIG0_ID_AUDSPDIF = 0x20,
> + HDMI_CONFIG0_ID_AUDI2S = 0x10,
> + HDMI_CONFIG0_ID_HDMI14 = 0x08,
> + HDMI_CONFIG0_ID_CSC = 0x04,
> + HDMI_CONFIG0_ID_HDCP = 0x01,
> +
> +/* HDMI_CONFIG1_ID */
> + HDMI_CONFIG1_ID_HDMI20 = 0x20,
> + HDMI_CONFIG1_ID_CONFAPB = 0x02,
> +
> +/* HDMI_CONFIG2_ID */
> + HDMI_CONFIG2_ID_PHY_GEN2 = 0xf2,
> + HDMI_CONFIG2_ID_PHY_GEN2_HECA = 0xe2,
> + HDMI_CONFIG2_ID_PHY_HDMI_MHL = 0xc2,
> + HDMI_CONFIG2_ID_PHY_HDMI_MHL_HECA = 0xb2,
> + HDMI_CONFIG2_ID_LEGACY_PHY = 0x00,
> +
> +/* HDMI_CONFIG3_ID */
> + HDMI_CONFIG3_ID_AHBAUDDMA = 0x02,
> + HDMI_CONFIG3_ID_GPAUD = 0x01,
> +
> /* IH_FC_INT2 field values */
> HDMI_IH_FC_INT2_OVERFLOW_MASK = 0x03,
> HDMI_IH_FC_INT2_LOW_PRIORITY_OVERFLOW = 0x02,
> --
> 2.1.2
>
>
next prev parent reply other threads:[~2015-02-05 15:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 14:56 [PATCH v3 0/15] Those patches is used for dw_hdmi audio support Yakir Yang
2015-02-03 15:01 ` [PATCH v3 01/15] drm: bridge/dw_hdmi: add irq control to suspend/resume Yakir Yang
2015-02-03 15:02 ` [PATCH v3 02/15] drm: bridge/dw_hdmi: wrap irq control in fucntions Yakir Yang
2015-02-03 15:08 ` [PATCH v3 03/15] drm: rockchip/dw_hdmi_rockchip: add resume/suspend support Yakir Yang
2015-02-03 15:11 ` [PATCH v3 04/15] drm: bridge/dw_hdmi: add indentification registers parse and record Yakir Yang
2015-02-05 15:46 ` Daniel Kurtz [this message]
2015-02-07 3:33 ` yakir
2015-02-03 15:12 ` [PATCH v3 05/15] drm: bridge/dw_hdmi: combine hdmi_set_clock_regenerator_n() and hdmi_regenerate_cts() Yakir Yang
2015-02-05 15:54 ` Daniel Kurtz
2015-02-07 3:33 ` yakir
2015-02-03 15:13 ` [PATCH v3 06/15] drm: bridge/dw_hdmi: adjust n/cts setting order Yakir Yang
2015-02-03 15:13 ` [PATCH v3 07/15] drm: bridge/dw_hdmi: set ncts_atomic_write & cts_manual Yakir Yang
2015-02-03 15:14 ` [PATCH v3 08/15] drm: bridge/dw_hdmi: add audio support for more display resolutions Yakir Yang
2015-02-03 15:15 ` [PATCH v3 09/15] drm: bridge/dw_hdmi: enable audio support for No-CEA " Yakir Yang
2015-02-03 15:16 ` [PATCH v3 10/15] drm: bridge/dw_hdmi: add audio sample channel status setting Yakir Yang
2015-02-03 15:16 ` [PATCH v3 11/15] drm: bridge/dw_hdmi: add audio clock control interfaces Yakir Yang
2015-02-03 15:17 ` [PATCH v3 12/15] drm: bridge/dw_hdmi: creat dw-hdmi-audio platform device Yakir Yang
2015-02-03 15:18 ` [PATCH v3 13/15] ASoC: dw-hdmi-audio: add codec driver for dw hdmi audio Yakir Yang
2015-02-03 15:19 ` [PATCH v3 14/15] ASoC: rockchip-hdmi-audio: add sound driver for " Yakir Yang
2015-02-03 15:19 ` [PATCH v3 15/15] dt-bindings: Add documentation for Rockchip dw-hdmi-audio Yakir Yang
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=CAGS+omCiGh0-4BbPjPS+KqMW9-OpJ8Je7o37Web06w1CR7RPgw@mail.gmail.com \
--to=djkurtz@chromium.org \
--cc=airlied@linux.ie \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=benzh@chromium.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=fabio.estevam@freescale.com \
--cc=galak@codeaurora.org \
--cc=heiko@sntech.de \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jsarha@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=marcheu@chromium.org \
--cc=mark.rutland@arm.com \
--cc=mark.yao@rock-chips.com \
--cc=mmind00@googlemail.com \
--cc=p.zabel@pengutronix.de \
--cc=pawel.moll@arm.com \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=robdclark@gmail.com \
--cc=robh+dt@kernel.org \
--cc=shawn.guo@linaro.org \
--cc=xobs@kosagi.com \
--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).