Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13472013ybl; Sun, 29 Dec 2019 12:43:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxewwSoa7W7swuZGqQiXYd5jelB3CwY4gdG09e8pa2OO8hJ4VrlG1a80ITg0v4vPW3iCmGb X-Received: by 2002:a9d:7852:: with SMTP id c18mr61939851otm.247.1577652194342; Sun, 29 Dec 2019 12:43:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652194; cv=none; d=google.com; s=arc-20160816; b=QiCSVPKntT3EhbVBkL2EU1ZMZ6Z5GEuceTIcCBy7fm6Ha8JB6Io7TjeNJwN30TmBwv F1h/p9gQnQBRxutVRHmeAyclKCSpqKYZ8Nj86/848DRxCC2WGxs+HTjWr/6wagDBdLgB OYq0c4CtC0oD5vPQFhtdD5Nn1pXUIE79yJlv+fDpk5eK03qfACfHXwkrG9j5zlizxPAr G0UKsI3DwSCkvDrKWTQC+/W530pEY6Fyfrh2m0poofu5XDbNBaoFhV/JsJ1mhiF960F4 oFs73bWoSLlkSeWDKwhxpgPBwZOHWwxIkNWm1Vo/MM92Sfz6lR/ZFaL9wRtPF1ZYEj8I fEmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=N9QI7MdQflRvbxRuRRa9r0BVbcwHIRNqsIflrKlwpQU=; b=x2lJdWA7Z7JKhgd+DINnntBt8TjQFp8F0pqylQaR/BrnEdnJvdWMMsW/So60+I5Jp9 ywsfHHPRFYo98iwdlsBHPQVb2CQLz763otKnElP0wDTphG6k2aDvq9H9MbgVY7Do7JUU h8+Ur46vdtIRFkBTC9dyuG/0k2EklPdTSXPksjwDflAkrc6atIowBIplEeoiWZy/daBW CrEHX5rYz/YpawMzJ+ksUWk+2SxItQdYlJWqtdlyEKdxP+lGYUGoTyi3pS9xaOhWh14B UR6r41sMauTeH/nOK/3p7rj6UKwngaqwyNavZMPuVHRY1y3sdqWsqmgpqitUjVsm2xij xRkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AOP0aJ4B; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j18si22399004otq.275.2019.12.29.12.43.03; Sun, 29 Dec 2019 12:43:14 -0800 (PST) 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=@kernel.org header.s=default header.b=AOP0aJ4B; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730469AbfL2RnX (ORCPT + 99 others); Sun, 29 Dec 2019 12:43:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:50554 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbfL2RnU (ORCPT ); Sun, 29 Dec 2019 12:43:20 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B557A206A4; Sun, 29 Dec 2019 17:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577641399; bh=hWSVPFhehnGaofdjBZepM4BylQBTdV/G2Ffh62Sv4Pk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AOP0aJ4BLTTfc0yzyukY2Iam0g5GIHf6fuOOh6EUJdOvsTs3az+1Q8J3lP8wV4J/B ow+WSsswQN/ekukpUTwmdLC19Ae3qNCb/ZKCF/P/itp7FLNb7hmGQtS6E15473i376 xxC/CdQ5i3Q2i00VIw35inQvbIbQgK5azb+OBc2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dariusz Marcinkiewicz , Hans Verkuil , Sasha Levin Subject: [PATCH 5.4 048/434] drm: exynos: exynos_hdmi: use cec_notifier_conn_(un)register Date: Sun, 29 Dec 2019 18:21:41 +0100 Message-Id: <20191229172705.166874507@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dariusz Marcinkiewicz [ Upstream commit 71137bfd98973efb7b762ba168df077b87b34311 ] 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 v7: - err_runtime_disable -> err_rpm_disable 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 [hverkuil-cisco@xs4all.nl: use 'if (!hdata->notifier)' instead of '== NULL'] Signed-off-by: Hans Verkuil Link: https://patchwork.freedesktop.org/patch/msgid/20190828123415.139441-1-darekm@google.com Signed-off-by: Sasha Levin --- 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 bc1565f1822a..09aa73c0f2ad 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) { + 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_rpm_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_rpm_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.20.1