Commit eb11eabc authored by Jani Nikula's avatar Jani Nikula

drm/i915: move and group hdcp under display.hdcp

Move display hdcp related members under drm_i915_private display
sub-struct.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: default avatarArun R Murthy <arun.r.murthy@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1083f5a58cce1507bd19bf7f98bf85e9351b741e.1661779055.git.jani.nikula@intel.com
parent 917bda9a
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
struct drm_i915_private; struct drm_i915_private;
struct i915_audio_component; struct i915_audio_component;
struct i915_hdcp_comp_master;
struct intel_atomic_state; struct intel_atomic_state;
struct intel_audio_funcs; struct intel_audio_funcs;
struct intel_cdclk_funcs; struct intel_cdclk_funcs;
...@@ -231,6 +232,14 @@ struct intel_display { ...@@ -231,6 +232,14 @@ struct intel_display {
wait_queue_head_t wait_queue; wait_queue_head_t wait_queue;
} gmbus; } gmbus;
struct {
struct i915_hdcp_comp_master *master;
bool comp_added;
/* Mutex to protect the above hdcp component related values. */
struct mutex comp_mutex;
} hdcp;
struct { struct {
u32 mmio_base; u32 mmio_base;
......
...@@ -188,12 +188,12 @@ bool intel_hdcp2_capable(struct intel_connector *connector) ...@@ -188,12 +188,12 @@ bool intel_hdcp2_capable(struct intel_connector *connector)
return false; return false;
/* MEI interface is solid */ /* MEI interface is solid */
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
if (!dev_priv->hdcp_comp_added || !dev_priv->hdcp_master) { if (!dev_priv->display.hdcp.comp_added || !dev_priv->display.hdcp.master) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return false; return false;
} }
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
/* Sink's capability for HDCP2.2 */ /* Sink's capability for HDCP2.2 */
hdcp->shim->hdcp_2_2_capable(dig_port, &capable); hdcp->shim->hdcp_2_2_capable(dig_port, &capable);
...@@ -1124,11 +1124,11 @@ hdcp2_prepare_ake_init(struct intel_connector *connector, ...@@ -1124,11 +1124,11 @@ hdcp2_prepare_ake_init(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1136,7 +1136,7 @@ hdcp2_prepare_ake_init(struct intel_connector *connector, ...@@ -1136,7 +1136,7 @@ hdcp2_prepare_ake_init(struct intel_connector *connector,
if (ret) if (ret)
drm_dbg_kms(&dev_priv->drm, "Prepare_ake_init failed. %d\n", drm_dbg_kms(&dev_priv->drm, "Prepare_ake_init failed. %d\n",
ret); ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1154,11 +1154,11 @@ hdcp2_verify_rx_cert_prepare_km(struct intel_connector *connector, ...@@ -1154,11 +1154,11 @@ hdcp2_verify_rx_cert_prepare_km(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1168,7 +1168,7 @@ hdcp2_verify_rx_cert_prepare_km(struct intel_connector *connector, ...@@ -1168,7 +1168,7 @@ hdcp2_verify_rx_cert_prepare_km(struct intel_connector *connector,
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Verify rx_cert failed. %d\n", drm_dbg_kms(&dev_priv->drm, "Verify rx_cert failed. %d\n",
ret); ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1182,18 +1182,18 @@ static int hdcp2_verify_hprime(struct intel_connector *connector, ...@@ -1182,18 +1182,18 @@ static int hdcp2_verify_hprime(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
ret = comp->ops->verify_hprime(comp->mei_dev, data, rx_hprime); ret = comp->ops->verify_hprime(comp->mei_dev, data, rx_hprime);
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Verify hprime failed. %d\n", ret); drm_dbg_kms(&dev_priv->drm, "Verify hprime failed. %d\n", ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1208,11 +1208,11 @@ hdcp2_store_pairing_info(struct intel_connector *connector, ...@@ -1208,11 +1208,11 @@ hdcp2_store_pairing_info(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1220,7 +1220,7 @@ hdcp2_store_pairing_info(struct intel_connector *connector, ...@@ -1220,7 +1220,7 @@ hdcp2_store_pairing_info(struct intel_connector *connector,
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Store pairing info failed. %d\n", drm_dbg_kms(&dev_priv->drm, "Store pairing info failed. %d\n",
ret); ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1235,11 +1235,11 @@ hdcp2_prepare_lc_init(struct intel_connector *connector, ...@@ -1235,11 +1235,11 @@ hdcp2_prepare_lc_init(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1247,7 +1247,7 @@ hdcp2_prepare_lc_init(struct intel_connector *connector, ...@@ -1247,7 +1247,7 @@ hdcp2_prepare_lc_init(struct intel_connector *connector,
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Prepare lc_init failed. %d\n", drm_dbg_kms(&dev_priv->drm, "Prepare lc_init failed. %d\n",
ret); ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1262,11 +1262,11 @@ hdcp2_verify_lprime(struct intel_connector *connector, ...@@ -1262,11 +1262,11 @@ hdcp2_verify_lprime(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1274,7 +1274,7 @@ hdcp2_verify_lprime(struct intel_connector *connector, ...@@ -1274,7 +1274,7 @@ hdcp2_verify_lprime(struct intel_connector *connector,
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Verify L_Prime failed. %d\n", drm_dbg_kms(&dev_priv->drm, "Verify L_Prime failed. %d\n",
ret); ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1288,11 +1288,11 @@ static int hdcp2_prepare_skey(struct intel_connector *connector, ...@@ -1288,11 +1288,11 @@ static int hdcp2_prepare_skey(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1300,7 +1300,7 @@ static int hdcp2_prepare_skey(struct intel_connector *connector, ...@@ -1300,7 +1300,7 @@ static int hdcp2_prepare_skey(struct intel_connector *connector,
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Get session key failed. %d\n", drm_dbg_kms(&dev_priv->drm, "Get session key failed. %d\n",
ret); ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1317,11 +1317,11 @@ hdcp2_verify_rep_topology_prepare_ack(struct intel_connector *connector, ...@@ -1317,11 +1317,11 @@ hdcp2_verify_rep_topology_prepare_ack(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1331,7 +1331,7 @@ hdcp2_verify_rep_topology_prepare_ack(struct intel_connector *connector, ...@@ -1331,7 +1331,7 @@ hdcp2_verify_rep_topology_prepare_ack(struct intel_connector *connector,
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(&dev_priv->drm,
"Verify rep topology failed. %d\n", ret); "Verify rep topology failed. %d\n", ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1346,18 +1346,18 @@ hdcp2_verify_mprime(struct intel_connector *connector, ...@@ -1346,18 +1346,18 @@ hdcp2_verify_mprime(struct intel_connector *connector,
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
ret = comp->ops->verify_mprime(comp->mei_dev, data, stream_ready); ret = comp->ops->verify_mprime(comp->mei_dev, data, stream_ready);
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Verify mprime failed. %d\n", ret); drm_dbg_kms(&dev_priv->drm, "Verify mprime failed. %d\n", ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1370,11 +1370,11 @@ static int hdcp2_authenticate_port(struct intel_connector *connector) ...@@ -1370,11 +1370,11 @@ static int hdcp2_authenticate_port(struct intel_connector *connector)
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
...@@ -1382,7 +1382,7 @@ static int hdcp2_authenticate_port(struct intel_connector *connector) ...@@ -1382,7 +1382,7 @@ static int hdcp2_authenticate_port(struct intel_connector *connector)
if (ret < 0) if (ret < 0)
drm_dbg_kms(&dev_priv->drm, "Enable hdcp auth failed. %d\n", drm_dbg_kms(&dev_priv->drm, "Enable hdcp auth failed. %d\n",
ret); ret);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -1394,17 +1394,17 @@ static int hdcp2_close_mei_session(struct intel_connector *connector) ...@@ -1394,17 +1394,17 @@ static int hdcp2_close_mei_session(struct intel_connector *connector)
struct i915_hdcp_comp_master *comp; struct i915_hdcp_comp_master *comp;
int ret; int ret;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
comp = dev_priv->hdcp_master; comp = dev_priv->display.hdcp.master;
if (!comp || !comp->ops) { if (!comp || !comp->ops) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return -EINVAL; return -EINVAL;
} }
ret = comp->ops->close_hdcp_session(comp->mei_dev, ret = comp->ops->close_hdcp_session(comp->mei_dev,
&dig_port->hdcp_port_data); &dig_port->hdcp_port_data);
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return ret; return ret;
} }
...@@ -2122,10 +2122,10 @@ static int i915_hdcp_component_bind(struct device *i915_kdev, ...@@ -2122,10 +2122,10 @@ static int i915_hdcp_component_bind(struct device *i915_kdev,
struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev); struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev);
drm_dbg(&dev_priv->drm, "I915 HDCP comp bind\n"); drm_dbg(&dev_priv->drm, "I915 HDCP comp bind\n");
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
dev_priv->hdcp_master = (struct i915_hdcp_comp_master *)data; dev_priv->display.hdcp.master = (struct i915_hdcp_comp_master *)data;
dev_priv->hdcp_master->mei_dev = mei_kdev; dev_priv->display.hdcp.master->mei_dev = mei_kdev;
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return 0; return 0;
} }
...@@ -2136,9 +2136,9 @@ static void i915_hdcp_component_unbind(struct device *i915_kdev, ...@@ -2136,9 +2136,9 @@ static void i915_hdcp_component_unbind(struct device *i915_kdev,
struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev); struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev);
drm_dbg(&dev_priv->drm, "I915 HDCP comp unbind\n"); drm_dbg(&dev_priv->drm, "I915 HDCP comp unbind\n");
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
dev_priv->hdcp_master = NULL; dev_priv->display.hdcp.master = NULL;
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
} }
static const struct component_ops i915_hdcp_component_ops = { static const struct component_ops i915_hdcp_component_ops = {
...@@ -2229,19 +2229,19 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv) ...@@ -2229,19 +2229,19 @@ void intel_hdcp_component_init(struct drm_i915_private *dev_priv)
if (!is_hdcp2_supported(dev_priv)) if (!is_hdcp2_supported(dev_priv))
return; return;
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
drm_WARN_ON(&dev_priv->drm, dev_priv->hdcp_comp_added); drm_WARN_ON(&dev_priv->drm, dev_priv->display.hdcp.comp_added);
dev_priv->hdcp_comp_added = true; dev_priv->display.hdcp.comp_added = true;
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
ret = component_add_typed(dev_priv->drm.dev, &i915_hdcp_component_ops, ret = component_add_typed(dev_priv->drm.dev, &i915_hdcp_component_ops,
I915_COMPONENT_HDCP); I915_COMPONENT_HDCP);
if (ret < 0) { if (ret < 0) {
drm_dbg_kms(&dev_priv->drm, "Failed at component add(%d)\n", drm_dbg_kms(&dev_priv->drm, "Failed at component add(%d)\n",
ret); ret);
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
dev_priv->hdcp_comp_added = false; dev_priv->display.hdcp.comp_added = false;
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return; return;
} }
} }
...@@ -2454,14 +2454,14 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state, ...@@ -2454,14 +2454,14 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state,
void intel_hdcp_component_fini(struct drm_i915_private *dev_priv) void intel_hdcp_component_fini(struct drm_i915_private *dev_priv)
{ {
mutex_lock(&dev_priv->hdcp_comp_mutex); mutex_lock(&dev_priv->display.hdcp.comp_mutex);
if (!dev_priv->hdcp_comp_added) { if (!dev_priv->display.hdcp.comp_added) {
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
return; return;
} }
dev_priv->hdcp_comp_added = false; dev_priv->display.hdcp.comp_added = false;
mutex_unlock(&dev_priv->hdcp_comp_mutex); mutex_unlock(&dev_priv->display.hdcp.comp_mutex);
component_del(dev_priv->drm.dev, &i915_hdcp_component_ops); component_del(dev_priv->drm.dev, &i915_hdcp_component_ops);
} }
......
...@@ -338,7 +338,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv) ...@@ -338,7 +338,7 @@ static int i915_driver_early_probe(struct drm_i915_private *dev_priv)
mutex_init(&dev_priv->display.audio.mutex); mutex_init(&dev_priv->display.audio.mutex);
mutex_init(&dev_priv->display.wm.wm_mutex); mutex_init(&dev_priv->display.wm.wm_mutex);
mutex_init(&dev_priv->display.pps.mutex); mutex_init(&dev_priv->display.pps.mutex);
mutex_init(&dev_priv->hdcp_comp_mutex); mutex_init(&dev_priv->display.hdcp.comp_mutex);
i915_memcpy_init_early(dev_priv); i915_memcpy_init_early(dev_priv);
intel_runtime_pm_init_early(&dev_priv->runtime_pm); intel_runtime_pm_init_early(&dev_priv->runtime_pm);
......
...@@ -538,12 +538,6 @@ struct drm_i915_private { ...@@ -538,12 +538,6 @@ struct drm_i915_private {
struct i915_drm_clients clients; struct i915_drm_clients clients;
struct i915_hdcp_comp_master *hdcp_master;
bool hdcp_comp_added;
/* Mutex to protect the above hdcp component related values. */
struct mutex hdcp_comp_mutex;
/* The TTM device structure. */ /* The TTM device structure. */
struct ttm_device bdev; struct ttm_device bdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment