From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Tony Lindgren <tony@atomide.com>, Sekhar Nori <nsekhar@ti.com>,
dri-devel@lists.freedesktop.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
linux-omap@vger.kernel.org, devicetree@vger.kernel.org,
Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: [PATCHv2 2/6] drm/omapdrm/dss/hdmi4: switch to the connector bridge ops
Date: Tue, 2 Mar 2021 17:23:59 +0100 [thread overview]
Message-ID: <20210302162403.983585-3-hverkuil-cisco@xs4all.nl> (raw)
In-Reply-To: <20210302162403.983585-1-hverkuil-cisco@xs4all.nl>
Implement the new connector_attach/detach bridge ops. This makes it
possible to associate a CEC adapter with a drm connector, which helps
userspace determine which cec device node belongs to which drm connector.
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---
drivers/gpu/drm/omapdrm/dss/hdmi4.c | 27 +++++++++++++++++--------
drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c | 9 ++++++---
drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h | 7 ++++---
3 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index 35b750cebaeb..c387156a5cbb 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -482,6 +482,22 @@ static struct edid *hdmi4_bridge_get_edid(struct drm_bridge *bridge,
return edid;
}
+static void hdmi4_bridge_connector_attach(struct drm_bridge *bridge,
+ struct drm_connector *conn)
+{
+ struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
+
+ hdmi4_cec_init(hdmi->pdev, &hdmi->core, &hdmi->wp, conn);
+}
+
+static void hdmi4_bridge_connector_detach(struct drm_bridge *bridge,
+ struct drm_connector *conn)
+{
+ struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
+
+ hdmi4_cec_uninit(&hdmi->core);
+}
+
static const struct drm_bridge_funcs hdmi4_bridge_funcs = {
.attach = hdmi4_bridge_attach,
.mode_set = hdmi4_bridge_mode_set,
@@ -492,6 +508,8 @@ static const struct drm_bridge_funcs hdmi4_bridge_funcs = {
.atomic_disable = hdmi4_bridge_disable,
.hpd_notify = hdmi4_bridge_hpd_notify,
.get_edid = hdmi4_bridge_get_edid,
+ .connector_attach = hdmi4_bridge_connector_attach,
+ .connector_detach = hdmi4_bridge_connector_detach,
};
static void hdmi4_bridge_init(struct omap_hdmi *hdmi)
@@ -647,14 +665,10 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
if (r)
goto err_runtime_put;
- r = hdmi4_cec_init(hdmi->pdev, &hdmi->core, &hdmi->wp);
- if (r)
- goto err_pll_uninit;
-
r = hdmi_audio_register(hdmi);
if (r) {
DSSERR("Registering HDMI audio failed\n");
- goto err_cec_uninit;
+ goto err_pll_uninit;
}
hdmi->debugfs = dss_debugfs_create_file(dss, "hdmi", hdmi_dump_regs,
@@ -664,8 +678,6 @@ static int hdmi4_bind(struct device *dev, struct device *master, void *data)
return 0;
-err_cec_uninit:
- hdmi4_cec_uninit(&hdmi->core);
err_pll_uninit:
hdmi_pll_uninit(&hdmi->pll);
err_runtime_put:
@@ -682,7 +694,6 @@ static void hdmi4_unbind(struct device *dev, struct device *master, void *data)
if (hdmi->audio_pdev)
platform_device_unregister(hdmi->audio_pdev);
- hdmi4_cec_uninit(&hdmi->core);
hdmi_pll_uninit(&hdmi->pll);
}
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c
index 43592c1cf081..80ec52c9c846 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.c
@@ -335,10 +335,10 @@ void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, u16 pa)
}
int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core,
- struct hdmi_wp_data *wp)
+ struct hdmi_wp_data *wp, struct drm_connector *conn)
{
- const u32 caps = CEC_CAP_TRANSMIT | CEC_CAP_LOG_ADDRS |
- CEC_CAP_PASSTHROUGH | CEC_CAP_RC;
+ const u32 caps = CEC_CAP_DEFAULTS | CEC_CAP_CONNECTOR_INFO;
+ struct cec_connector_info conn_info;
int ret;
core->adap = cec_allocate_adapter(&hdmi_cec_adap_ops, core,
@@ -346,6 +346,8 @@ int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core,
ret = PTR_ERR_OR_ZERO(core->adap);
if (ret < 0)
return ret;
+ cec_fill_conn_info_from_drm(&conn_info, conn);
+ cec_s_conn_info(core->adap, &conn_info);
core->wp = wp;
/* Disable clock initially, hdmi_cec_adap_enable() manages it */
@@ -354,6 +356,7 @@ int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core,
ret = cec_register_adapter(core->adap, &pdev->dev);
if (ret < 0) {
cec_delete_adapter(core->adap);
+ core->adap = NULL;
return ret;
}
return 0;
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h
index 0292337c97cc..b59a54c3040e 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_cec.h
@@ -29,7 +29,7 @@ struct platform_device;
void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, u16 pa);
void hdmi4_cec_irq(struct hdmi_core_data *core);
int hdmi4_cec_init(struct platform_device *pdev, struct hdmi_core_data *core,
- struct hdmi_wp_data *wp);
+ struct hdmi_wp_data *wp, struct drm_connector *conn);
void hdmi4_cec_uninit(struct hdmi_core_data *core);
#else
static inline void hdmi4_cec_set_phys_addr(struct hdmi_core_data *core, u16 pa)
@@ -41,8 +41,9 @@ static inline void hdmi4_cec_irq(struct hdmi_core_data *core)
}
static inline int hdmi4_cec_init(struct platform_device *pdev,
- struct hdmi_core_data *core,
- struct hdmi_wp_data *wp)
+ struct hdmi_core_data *core,
+ struct hdmi_wp_data *wp,
+ struct drm_connector *conn)
{
return 0;
}
--
2.30.1
next prev parent reply other threads:[~2021-03-03 1:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 16:23 [PATCHv2 0/6] drm/omap: hdmi: improve hdmi4 CEC, add CEC for hdmi5 Hans Verkuil
2021-03-02 16:23 ` [PATCHv2 1/6] drm: drm_bridge: add connector_attach/detach bridge ops Hans Verkuil
2021-04-16 7:46 ` Tomi Valkeinen
2021-04-28 12:10 ` Hans Verkuil
2021-03-02 16:23 ` Hans Verkuil [this message]
2021-04-16 7:55 ` [PATCHv2 2/6] drm/omapdrm/dss/hdmi4: switch to the connector " Tomi Valkeinen
2021-03-02 16:24 ` [PATCHv2 3/6] drm/omapdrm/dss/hdmi4: simplify CEC Phys Addr handling Hans Verkuil
2021-03-02 16:24 ` [PATCHv2 4/6] dt-bindings: display: ti: ti,omap5-dss.txt: add cec clock Hans Verkuil
2021-03-03 7:40 ` Tomi Valkeinen
2021-03-08 18:59 ` [PATCHv2 4/6] dt-bindings: display: ti: ti, omap5-dss.txt: " Rob Herring
2021-03-02 16:24 ` [PATCHv2 5/6] dra7.dtsi/omap5.dtsi: " Hans Verkuil
2021-03-03 7:44 ` Tomi Valkeinen
2021-03-02 16:24 ` [PATCHv2 6/6] drm/omapdrm/dss/hdmi5: add CEC support Hans Verkuil
2021-03-03 7:47 ` Tomi Valkeinen
2021-03-03 7:51 ` Hans Verkuil
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=20210302162403.983585-3-hverkuil-cisco@xs4all.nl \
--to=hverkuil-cisco@xs4all.nl \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tony@atomide.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).