Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp641805ybl; Wed, 14 Aug 2019 03:49:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx3oNj6KTKuyRMwVooRGo/rryHvT6u8KbXThdyy1+0MeqbimpAciq4P9h6FFyEvvk5opSwg X-Received: by 2002:a65:528d:: with SMTP id y13mr39483622pgp.120.1565779753903; Wed, 14 Aug 2019 03:49:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565779753; cv=none; d=google.com; s=arc-20160816; b=kM3BJX7zHyRWmf729mRjS/hmYqOq7erDRgdjBoiOGWn8dVZVUWNLZqoe2ZZ57UcdeW UOKlHDcbMnjVg60NBivIUJreKvih8SFE3HVLy+ol7A8lHHiohrUQWooDgszakWTA5OgU 3Xixp3iY1lLSXsr3kY7nyos+eQqh2okUpy8iSSPai+ZCxlRaiz0y+I7MHW9GKXfv936v 8/9vCHr0HN29eJ9nmxZt6tBYQYxr8dUhbMUKsE4cBmrQ9u0QF2CDz0OB3JoXvdmgP1fs KEG/AltHvRbGV7fTbZXoJGBBNwX7JsxhFs7OvedDIJ5KeH67duzpJmF38aFxw1Qwgv1C AdGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=4SGVKzSfOWWb5eHKsBAlwwo8FxZigEPwWxwM+lh0QRU=; b=qUl9sT19Qwy755uSLV0ny6U1j7N2A2TVrPWZeJxwkeq96jmQs77qOGRDeWLMyYhQI3 q9giUoGnl+S2PJw2uoHCRSTY5cMff0Nzy2zpX28Mu5+SaNJm6kUsfolqUHDU6REpmGgN Z0RK0tLiToRqWyc/9vcT1mg/k++J3E1DSZ1sGNlHXqf3z9wio5DS3uUQkis7yDNRPVRo xl7Nvi9OFIFPqc2+2tKF0SYsApJxAijZMVCPH2eb9O/MOBaW6SgM3FjqJrwm7v8wYlGU bOaEP2h7+zBXlRsmlz8e3Y1OuNr3lz6eSBRJU/hAqtCY2V1JKcq6yRtHiBdhImdjPVA8 m0JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jsibvCEa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y30si18054444pga.143.2019.08.14.03.48.58; Wed, 14 Aug 2019 03:49:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=jsibvCEa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727953AbfHNKqZ (ORCPT + 99 others); Wed, 14 Aug 2019 06:46:25 -0400 Received: from mail-vs1-f73.google.com ([209.85.217.73]:35415 "EHLO mail-vs1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727942AbfHNKqW (ORCPT ); Wed, 14 Aug 2019 06:46:22 -0400 Received: by mail-vs1-f73.google.com with SMTP id 66so24592255vsp.2 for ; Wed, 14 Aug 2019 03:46:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=4SGVKzSfOWWb5eHKsBAlwwo8FxZigEPwWxwM+lh0QRU=; b=jsibvCEaVrpw/TIVu7voxbDfejQBHrmB5WikoOLqMXW3Sz6KSshq9AHg5uJF+51H7A BzZGy+I1w9PPt7wVhSUK1mLfrAROtdLA6BauC8IvBF3UYhGVr/xbBxog/ugoCPM08jgm RMlTYL2a2K6mkw858Ip783T1xBDXOaH3+AcaRHMUV7TcYiCYF6fTPu7GjLFmxSHARTgm LedOl5171OM4hR+KhMB2EWKKFvjnL99MoEryuXx36fhWtPGML6nkft+ugutYtG9IS063 f74pWb3nL7BZ1SXUsllZ71l9xdLWb1j9bQeDEa5Oba66jqEZ8cwGCnOWBlCxSYXjQBAe Eq7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=4SGVKzSfOWWb5eHKsBAlwwo8FxZigEPwWxwM+lh0QRU=; b=X1RDiL8eiNy053ynXS6n7FqtZgALWMR2U6/0vxWKBLGD1/YO2+QxndrqZfE1atRa0u tp0FjRtFkKXzTfJIuAvTZAiEQ6w8CyHOnbbEY+twj35tbwIsRB9jClYsf1FNehWYO+bO gqNx8/En64mq6O6S8Xw2lFap19PDuZKrXXCAEdgNkTlyacdTnSdRbUDW6VaeH0uVbeJc GW6cGgTB0lDbmOLC7ZmtErt8OXFyL24L2Qvz45nHvscPaQmqa2jEC3sE9GDCnIY7rTAR KwFDRGEpwnxUqw/ixl4KCGT0VlvEOw1Yszna5Q/jxCS5C/qDBWV+zmDpnzE/nnP2vTfp ZSuw== X-Gm-Message-State: APjAAAVuG1N1JOdvoLYYhiGBtdh6+/iFXLnpfD+kBO8x81r8TkKi1V2n bUS+ywZ0tSlyze6jQNtlFC6BE5PV/a4= X-Received: by 2002:a1f:7c0e:: with SMTP id x14mr6828024vkc.0.1565779581300; Wed, 14 Aug 2019 03:46:21 -0700 (PDT) Date: Wed, 14 Aug 2019 12:45:07 +0200 In-Reply-To: <20190814104520.6001-1-darekm@google.com> Message-Id: <20190814104520.6001-10-darekm@google.com> Mime-Version: 1.0 References: <20190814104520.6001-1-darekm@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH v7 9/9] drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl Cc: Dariusz Marcinkiewicz , Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , David Airlie , Daniel Vetter , Kukjin Kim , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the new cec_notifier_conn_(un)register() functions to (un)register the notifier for the HDMI connector, and fill in the cec_connector_info. Changes since v2: - removed unnecessary call to invalidate phys address before deregistering the notifier, - use cec_notifier_phys_addr_invalidate instead of setting invalid address on a notifier. Signed-off-by: Dariusz Marcinkiewicz Tested-by: Hans Verkuil --- drivers/gpu/drm/exynos/exynos_hdmi.c | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index bc1565f1822ab..d532b468d9af5 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -852,6 +852,10 @@ static enum drm_connector_status hdmi_detect(struct drm_connector *connector, static void hdmi_connector_destroy(struct drm_connector *connector) { + struct hdmi_context *hdata = connector_to_hdmi(connector); + + cec_notifier_conn_unregister(hdata->notifier); + drm_connector_unregister(connector); drm_connector_cleanup(connector); } @@ -935,6 +939,7 @@ static int hdmi_create_connector(struct drm_encoder *encoder) { struct hdmi_context *hdata = encoder_to_hdmi(encoder); struct drm_connector *connector = &hdata->connector; + struct cec_connector_info conn_info; int ret; connector->interlace_allowed = true; @@ -957,6 +962,15 @@ static int hdmi_create_connector(struct drm_encoder *encoder) DRM_DEV_ERROR(hdata->dev, "Failed to attach bridge\n"); } + cec_fill_conn_info_from_drm(&conn_info, connector); + + hdata->notifier = cec_notifier_conn_register(hdata->dev, NULL, + &conn_info); + if (hdata->notifier == NULL) { + ret = -ENOMEM; + DRM_DEV_ERROR(hdata->dev, "Failed to allocate CEC notifier\n"); + } + return ret; } @@ -1528,8 +1542,8 @@ static void hdmi_disable(struct drm_encoder *encoder) */ mutex_unlock(&hdata->mutex); cancel_delayed_work(&hdata->hotplug_work); - cec_notifier_set_phys_addr(hdata->notifier, - CEC_PHYS_ADDR_INVALID); + if (hdata->notifier) + cec_notifier_phys_addr_invalidate(hdata->notifier); return; } @@ -2006,12 +2020,6 @@ static int hdmi_probe(struct platform_device *pdev) } } - hdata->notifier = cec_notifier_get(&pdev->dev); - if (hdata->notifier == NULL) { - ret = -ENOMEM; - goto err_hdmiphy; - } - pm_runtime_enable(dev); audio_infoframe = &hdata->audio.infoframe; @@ -2023,7 +2031,7 @@ static int hdmi_probe(struct platform_device *pdev) ret = hdmi_register_audio_device(hdata); if (ret) - goto err_notifier_put; + goto err_runtime_disable; ret = component_add(&pdev->dev, &hdmi_component_ops); if (ret) @@ -2034,8 +2042,7 @@ static int hdmi_probe(struct platform_device *pdev) err_unregister_audio: platform_device_unregister(hdata->audio.pdev); -err_notifier_put: - cec_notifier_put(hdata->notifier); +err_runtime_disable: pm_runtime_disable(dev); err_hdmiphy: @@ -2054,12 +2061,10 @@ static int hdmi_remove(struct platform_device *pdev) struct hdmi_context *hdata = platform_get_drvdata(pdev); cancel_delayed_work_sync(&hdata->hotplug_work); - cec_notifier_set_phys_addr(hdata->notifier, CEC_PHYS_ADDR_INVALID); component_del(&pdev->dev, &hdmi_component_ops); platform_device_unregister(hdata->audio.pdev); - cec_notifier_put(hdata->notifier); pm_runtime_disable(&pdev->dev); if (!IS_ERR(hdata->reg_hdmi_en)) -- 2.23.0.rc1.153.gdeed80330f-goog