From patchwork Tue Aug 13 11:02:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dariusz Marcinkiewicz X-Patchwork-Id: 11095277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 042941398 for ; Thu, 15 Aug 2019 08:37:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA6CA2811A for ; Thu, 15 Aug 2019 08:37:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBE512884A; Thu, 15 Aug 2019 08:37:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 940DC2811A for ; Thu, 15 Aug 2019 08:37:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B85CA6E90D; Thu, 15 Aug 2019 08:35:04 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by gabe.freedesktop.org (Postfix) with ESMTPS id 45BDA6E0EF for ; Tue, 13 Aug 2019 11:04:03 +0000 (UTC) Received: by mail-qt1-x849.google.com with SMTP id j10so17266164qtl.23 for ; Tue, 13 Aug 2019 04:04:03 -0700 (PDT) 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=ip9lF/U/ATkDBCN52xa8MDYElKkFg+n6UubAPvcwdoQ=; b=PoJI795HY0e7Y/7ZcND+gayOjzC9ZZ0UJ/ScILWe5RAQOLyiDNtITRjXcn+ROk2yJ2 mmh/WmV6CxrVSgmiruRkVt01nfyEhUgQ1uMnFhkgMAZ94actj9QiEPCa64XGHX72rmbs FOSA12C6IS4jOe5XW6FgiDYxyiRBbkT5JN0tTen58+fDfwrJyu9ISl78QbEAQGOxmH7T G28wy1PsdPwhiNXezlG7+ER+q6vCS7k0D6vYwH8NOqpH0YuzIfU/4JKpTkrhFGLmYoMi aRaGvG8ElInSfsErZVKLuBU0sjO8kegCfXsXyRtL4OhkFmYCvCL/hoXwBIq51wniFTSW XvMA== X-Gm-Message-State: APjAAAU880diCghohhqfzhymm/jHADiLoUalZ/oiAYFFT9hlrM9SIB1D nKlcyjpzL6VXCBrCgPmFBv6Ubm8+kNPcbl3eBwZgi5BDdl/JfITDbrVXb9MyC52cOAiPV1TJWuk NzLziI0txh8DQKHudvT0UPhijtF3grb0m4wJlXqqRGMP1+K+oWRavzv8jfdNU2wP5eitNeTG5CQ == X-Google-Smtp-Source: APXvYqysSUrmxH++r5MmUXV4gWwiLxUMWPgS8nugFZzvIugrQ9MfQDgywxdIlcVe+Xz2GFVznywfU+Ysfvs= X-Received: by 2002:ac8:6105:: with SMTP id a5mr15179523qtm.285.1565694242255; Tue, 13 Aug 2019 04:04:02 -0700 (PDT) Date: Tue, 13 Aug 2019 13:02:37 +0200 In-Reply-To: <20190813110300.83025-1-darekm@google.com> Message-Id: <20190813110300.83025-6-darekm@google.com> Mime-Version: 1.0 References: <20190813110300.83025-1-darekm@google.com> X-Mailer: git-send-email 2.23.0.rc1.153.gdeed80330f-goog Subject: [PATCH v6 5/8] drm: sti: use cec_notifier_conn_(un)register From: Dariusz Marcinkiewicz To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, hverkuil-cisco@xs4all.nl X-Mailman-Approved-At: Thu, 15 Aug 2019 08:34:55 +0000 X-Mailman-Original-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=ip9lF/U/ATkDBCN52xa8MDYElKkFg+n6UubAPvcwdoQ=; b=L8MnBJ66KutyhXM1pVJve1tTkI9eCP1J5jPB3Zz1KokSDUH6mh59HIERL2XGmcVUPr 3WrIC6I9g5N127W9P+9Rp5VuHoeaKnvsC+8o341cSsS2xtEvgkrarWZA8QbeVAOjMGe1 liVA/FbdyxZivqYi7Yr+irg6HA4OxJeMf/IF0alLg66zc6sUjvufCQCkDO3FCvv2e4Zv 3SHnX+IE4HMfr4asT3FCECTYCwZKb0b2SKzJ3if+MCbZXG6GvmwgU3l8ogIEl6tkipYu e7wOP85XCH2b5SpFdqb7dERv+2Zz6z1h5BRtL99ey4tkpST978h96jVyK5Chw7JsPAFd Yfpw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , open list , Dariusz Marcinkiewicz , Vincent Abriou Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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: Don't invalidate physical address before unregistering the notifier. Signed-off-by: Dariusz Marcinkiewicz --- drivers/gpu/drm/sti/sti_hdmi.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 9862c322f0c4a..bd15902b825ad 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1256,6 +1256,7 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) struct drm_device *drm_dev = data; struct drm_encoder *encoder; struct sti_hdmi_connector *connector; + struct cec_connector_info conn_info; struct drm_connector *drm_connector; struct drm_bridge *bridge; int err; @@ -1318,6 +1319,14 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) goto err_sysfs; } + cec_fill_conn_info_from_drm(&conn_info, drm_connector); + hdmi->notifier = cec_notifier_conn_register(&hdmi->dev, NULL, + &conn_info); + if (!hdmi->notifier) { + hdmi->drm_connector = NULL; + return -ENOMEM; + } + /* Enable default interrupts */ hdmi_write(hdmi, HDMI_DEFAULT_INT, HDMI_INT_EN); @@ -1331,6 +1340,9 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) static void sti_hdmi_unbind(struct device *dev, struct device *master, void *data) { + struct sti_hdmi *hdmi = dev_get_drvdata(dev); + + cec_notifier_conn_unregister(hdmi->notifier); } static const struct component_ops sti_hdmi_ops = { @@ -1436,10 +1448,6 @@ static int sti_hdmi_probe(struct platform_device *pdev) goto release_adapter; } - hdmi->notifier = cec_notifier_get(&pdev->dev); - if (!hdmi->notifier) - goto release_adapter; - hdmi->reset = devm_reset_control_get(dev, "hdmi"); /* Take hdmi out of reset */ if (!IS_ERR(hdmi->reset)) @@ -1459,14 +1467,11 @@ static int sti_hdmi_remove(struct platform_device *pdev) { struct sti_hdmi *hdmi = dev_get_drvdata(&pdev->dev); - cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID); - i2c_put_adapter(hdmi->ddc_adapt); if (hdmi->audio_pdev) platform_device_unregister(hdmi->audio_pdev); component_del(&pdev->dev, &sti_hdmi_ops); - cec_notifier_put(hdmi->notifier); return 0; }