[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1426156158.14455.24.camel@pengutronix.de>
Date: Thu, 12 Mar 2015 11:29:18 +0100
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Yakir Yang <ykk@...k-chips.com>
Cc: djkurtz@...omium.org, dianders@...omium.org,
linux-rockchip@...ts.infradead.org,
David Airlie <airlied@...ux.ie>,
Russell King <rmk+kernel@....linux.org.uk>,
Andy Yan <andy.yan@...k-chips.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Fabio Estevam <fabio.estevam@...escale.com>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
mmind00@...glemail.com, marcheu@...omium.org,
mark.yao@...k-chips.com
Subject: Re: [PATCH v4 04/15] drm: bridge/dw_hdmi: add identification
registers parse and record
Am Samstag, den 28.02.2015, 21:35 -0500 schrieb Yakir Yang:
> By parsing the identification registers we can know what functions
> are present on the hdmi ip.
>
> Signed-off-by: Yakir Yang <ykk@...k-chips.com>
> ---
> Changes in v4:
> -Correct phy_type assignment bug
>
> 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..937beed 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;
> + 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->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);
> +}
What is the purpose of creating a copy of all the feature bits? As far
as I can tell you are only ever using hdmi_id.design afterwards.
regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists