From mboxrd@z Thu Jan 1 00:00:00 1970 From: yakir Subject: Re: [PATCH v4 04/15] drm: bridge/dw_hdmi: add identification registers parse and record Date: Thu, 12 Mar 2015 22:32:31 +0800 Message-ID: <5501A37F.10305@rock-chips.com> References: <1425175834-24661-1-git-send-email-ykk@rock-chips.com> <1425177359-1918-1-git-send-email-ykk@rock-chips.com> <1426156158.14455.24.camel@pengutronix.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1617707128==" Return-path: Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.138]) by gabe.freedesktop.org (Postfix) with ESMTP id 6DCAA6E437 for ; Thu, 12 Mar 2015 07:33:07 -0700 (PDT) In-Reply-To: <1426156158.14455.24.camel@pengutronix.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Philipp Zabel Cc: Fabio Estevam , mmind00@googlemail.com, marcheu@chromium.org, Greg Kroah-Hartman , dianders@chromium.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org, Russell King , Andy Yan List-Id: dri-devel@lists.freedesktop.org This is a multi-part message in MIME format. --===============1617707128== Content-Type: multipart/alternative; boundary="------------030202070306050107030002" This is a multi-part message in MIME format. --------------030202070306050107030002 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi philipp, On 2015=E5=B9=B403=E6=9C=8812=E6=97=A5 18:29, Philipp Zabel wrote: > 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 >> --- >> 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] =3D= { >> { 0x6756, 0x78ab, 0x2000, 0x0200 } >> }; >> =20 >> +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; >> =20 >> + struct hdmi_id id; >> + >> struct hdmi_data_info hdmi_data; >> const struct dw_hdmi_plat_data *plat_data; >> =20 >> @@ -1259,6 +1278,36 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, = struct drm_display_mode *mode) >> return 0; >> } >> =20 >> +static void hdmi_parse_id(struct dw_hdmi *hdmi) >> +{ >> + u8 config0_id, config1_id, config2_id, config3_id; >> + >> + config0_id =3D hdmi_readb(hdmi, HDMI_CONFIG0_ID); >> + config1_id =3D hdmi_readb(hdmi, HDMI_CONFIG1_ID); >> + config2_id =3D hdmi_readb(hdmi, HDMI_CONFIG2_ID); >> + config3_id =3D hdmi_readb(hdmi, HDMI_CONFIG3_ID); >> + >> + hdmi->id.prepen =3D config0_id & HDMI_CONFIG0_ID_PREPEN ? true : fal= se; >> + hdmi->id.audi2s =3D config0_id & HDMI_CONFIG0_ID_AUDI2S ? true : fal= se; >> + hdmi->id.hdmi14 =3D config0_id & HDMI_CONFIG0_ID_HDMI14 ? true : fal= se; >> + hdmi->id.hdcp =3D config0_id & HDMI_CONFIG0_ID_HDCP ? true : false; >> + hdmi->id.csc =3D config0_id & HDMI_CONFIG0_ID_CSC ? true : false; >> + hdmi->id.audspdif =3D config0_id & HDMI_CONFIG0_ID_AUDSPDIF ? >> + true : false; >> + >> + hdmi->id.confapb =3D config1_id & HDMI_CONFIG1_ID_CONFAPB ? true : f= alse; >> + hdmi->id.hdmi20 =3D config1_id & HDMI_CONFIG1_ID_HDMI20 ? true : fal= se; >> + >> + hdmi->id.phy_type =3D config2_id; >> + >> + hdmi->id.gpaud =3D config3_id & HDMI_CONFIG3_ID_GPAUD ? true : false= ; >> + hdmi->id.ahbauddma =3D config3_id & HDMI_CONFIG3_ID_AHBAUDDMA ? >> + true : false; >> + >> + hdmi->id.design =3D hdmi_readb(hdmi, HDMI_DESIGN_ID); >> + hdmi->id.revision =3D 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. Yeah, you are right. Seems hdmi audio have long long way to go. As for now, we just need hdmi_id.design to separate registers. Agree, I will simplify it in next verison. > =20 > > regards > Philipp regards :) Yakir > > > --------------030202070306050107030002 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi philipp,

On 2015=E5=B9=B403=E6=9C=8812=E6=97=A5= 18:29, Philipp Zabel wrote:
Am Samstag, den 28.02.2015, 21:35 -0500 schrieb Yaki=
r Yang:
By parsing the identification registers we can kno=
w what functions
are present on the hdmi ip.

Signed-off-by: Yakir Yang <ykk@rock-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] =3D {
 	{ 0x6756, 0x78ab, 0x2000, 0x0200 }
 };
=20
+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;
=20
+	struct hdmi_id id;
+
 	struct hdmi_data_info hdmi_data;
 	const struct dw_hdmi_plat_data *plat_data;
=20
@@ -1259,6 +1278,36 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, str=
uct drm_display_mode *mode)
 	return 0;
 }
=20
+static void hdmi_parse_id(struct dw_hdmi *hdmi)
+{
+	u8 config0_id, config1_id, config2_id, config3_id;
+
+	config0_id =3D hdmi_readb(hdmi, HDMI_CONFIG0_ID);
+	config1_id =3D hdmi_readb(hdmi, HDMI_CONFIG1_ID);
+	config2_id =3D hdmi_readb(hdmi, HDMI_CONFIG2_ID);
+	config3_id =3D hdmi_readb(hdmi, HDMI_CONFIG3_ID);
+
+	hdmi->id.prepen =3D config0_id & HDMI_CONFIG0_ID_PREPEN ? true :=
 false;
+	hdmi->id.audi2s =3D config0_id & HDMI_CONFIG0_ID_AUDI2S ? true :=
 false;
+	hdmi->id.hdmi14 =3D config0_id & HDMI_CONFIG0_ID_HDMI14 ? true :=
 false;
+	hdmi->id.hdcp =3D config0_id & HDMI_CONFIG0_ID_HDCP ? true : fal=
se;
+	hdmi->id.csc =3D config0_id & HDMI_CONFIG0_ID_CSC ? true : false=
;
+	hdmi->id.audspdif =3D config0_id & HDMI_CONFIG0_ID_AUDSPDIF ?
+			    true : false;
+
+	hdmi->id.confapb =3D config1_id & HDMI_CONFIG1_ID_CONFAPB ? true=
 : false;
+	hdmi->id.hdmi20 =3D config1_id & HDMI_CONFIG1_ID_HDMI20 ? true :=
 false;
+
+	hdmi->id.phy_type =3D config2_id;
+
+	hdmi->id.gpaud =3D config3_id & HDMI_CONFIG3_ID_GPAUD ? true : f=
alse;
+	hdmi->id.ahbauddma =3D config3_id & HDMI_CONFIG3_ID_AHBAUDDMA ?
+			     true : false;
+
+	hdmi->id.design =3D hdmi_readb(hdmi, HDMI_DESIGN_ID);
+	hdmi->id.revision =3D 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.
Yeah, you are right. Seems hdmi audio have long long way to go.
As for now, we just need hdmi_id.design to separate registers.

Agree, I will simplify it in next verison.

=20

regards
Philipp
regards :)
Yakir




--------------030202070306050107030002-- --===============1617707128== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9kcmktZGV2ZWwK --===============1617707128==--