Skip to content

Commit 9c22912

Browse files
superna9999Lee Jones
authored andcommitted
drm/i915: hdmi: add CEC notifier to intel_hdmi
This patchs adds the cec_notifier feature to the intel_hdmi part of the i915 DRM driver. It uses the HDMI DRM connector name to differentiate between each HDMI ports. The changes will allow the i915 HDMI code to notify EDID and HPD changes to an eventual CEC adapter. Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 7a78c1e commit 9c22912

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

drivers/gpu/drm/i915/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ config DRM_I915
2323
select SYNC_FILE
2424
select IOSF_MBI
2525
select CRC32
26+
select CEC_CORE if CEC_NOTIFIER
2627
help
2728
Choose this option if you have a system that has "Intel Graphics
2829
Media Accelerator" or "HD Graphics" integrated graphics,

drivers/gpu/drm/i915/intel_display.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,30 @@ enum port {
126126

127127
#define port_name(p) ((p) + 'A')
128128

129+
/*
130+
* Ports identifier referenced from other drivers.
131+
* Expected to remain stable over time
132+
*/
133+
static inline const char *port_identifier(enum port port)
134+
{
135+
switch (port) {
136+
case PORT_A:
137+
return "Port A";
138+
case PORT_B:
139+
return "Port B";
140+
case PORT_C:
141+
return "Port C";
142+
case PORT_D:
143+
return "Port D";
144+
case PORT_E:
145+
return "Port E";
146+
case PORT_F:
147+
return "Port F";
148+
default:
149+
return "<invalid>";
150+
}
151+
}
152+
129153
enum dpio_channel {
130154
DPIO_CH0,
131155
DPIO_CH1

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <drm/drm_dp_mst_helper.h>
4040
#include <drm/drm_rect.h>
4141
#include <drm/drm_atomic.h>
42+
#include <media/cec-notifier.h>
4243

4344
/**
4445
* __wait_for - magic wait macro
@@ -1017,6 +1018,7 @@ struct intel_hdmi {
10171018
bool has_audio;
10181019
bool rgb_quant_range_selectable;
10191020
struct intel_connector *attached_connector;
1021+
struct cec_notifier *cec_notifier;
10201022
};
10211023

10221024
struct intel_dp_mst_encoder;

drivers/gpu/drm/i915/intel_hdmi.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,6 +1868,8 @@ intel_hdmi_set_edid(struct drm_connector *connector)
18681868
connected = true;
18691869
}
18701870

1871+
cec_notifier_set_phys_addr_from_edid(intel_hdmi->cec_notifier, edid);
1872+
18711873
return connected;
18721874
}
18731875

@@ -1876,6 +1878,7 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
18761878
{
18771879
enum drm_connector_status status;
18781880
struct drm_i915_private *dev_priv = to_i915(connector->dev);
1881+
struct intel_hdmi *intel_hdmi = intel_attached_hdmi(connector);
18791882

18801883
DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n",
18811884
connector->base.id, connector->name);
@@ -1891,6 +1894,9 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)
18911894

18921895
intel_display_power_put(dev_priv, POWER_DOMAIN_GMBUS);
18931896

1897+
if (status != connector_status_connected)
1898+
cec_notifier_phys_addr_invalidate(intel_hdmi->cec_notifier);
1899+
18941900
return status;
18951901
}
18961902

@@ -2031,6 +2037,8 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder,
20312037

20322038
static void intel_hdmi_destroy(struct drm_connector *connector)
20332039
{
2040+
if (intel_attached_hdmi(connector)->cec_notifier)
2041+
cec_notifier_put(intel_attached_hdmi(connector)->cec_notifier);
20342042
kfree(to_intel_connector(connector)->detect_edid);
20352043
drm_connector_cleanup(connector);
20362044
kfree(connector);
@@ -2350,6 +2358,11 @@ void intel_hdmi_init_connector(struct intel_digital_port *intel_dig_port,
23502358
u32 temp = I915_READ(PEG_BAND_GAP_DATA);
23512359
I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
23522360
}
2361+
2362+
intel_hdmi->cec_notifier = cec_notifier_get_conn(dev->dev,
2363+
port_identifier(port));
2364+
if (!intel_hdmi->cec_notifier)
2365+
DRM_DEBUG_KMS("CEC notifier get failed\n");
23532366
}
23542367

23552368
void intel_hdmi_init(struct drm_i915_private *dev_priv,

0 commit comments

Comments
 (0)