From patchwork Mon Dec 10 16:34:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 10721729 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 E41F991E for ; Mon, 10 Dec 2018 16:35:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D3B222A927 for ; Mon, 10 Dec 2018 16:35:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7CF52AB0A; Mon, 10 Dec 2018 16:35:00 +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, FREEMAIL_FROM,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 6D9C62A94B for ; Mon, 10 Dec 2018 16:35:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 38B866EB3D; Mon, 10 Dec 2018 16:34:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ed1-x543.google.com (mail-ed1-x543.google.com [IPv6:2a00:1450:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33A596EB3D for ; Mon, 10 Dec 2018 16:34:58 +0000 (UTC) Received: by mail-ed1-x543.google.com with SMTP id f23so10038980edb.3 for ; Mon, 10 Dec 2018 08:34:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7QCbV7FTtynMbJ1N5CgZDG9CjfiMGjBfUjHz/Fc8YBU=; b=sdO3OHVUm21eyNTybmM6WkhouKqwwaxlab/VLwg1L7B6JHCTS8TObCWKmQbsJBZjCn Xpv6crmkzAxEGDmU9SPb9V+Lgf+CTfgT64d6Ukx8gpBlDW3PDCIOB4DqluYk2nM5UxI/ L2gGocGLx6Bmo0+f/JU1+0OACToOq/5XNad3dYCDGjOelAMpVnXqJTFCiwCS4osO99My nC++Bg3cRaeIRLVzQmT00QOy0WN8E1nx/O78FflmEKdOTEQtUdWSyKwb668GJBdEXb2z z6Nf0umlDSsw4ac0j42WgWTCcmJa9TkaE3tMpE0nl4Vk1SfO8PZBf77DsfwmH4YzcrS/ 2jEw== X-Gm-Message-State: AA+aEWbMGXwS6HyPcdgGXkz9GIzrc3OporLywHqWHI8WU+siYG5r+/1G Q1HCd5Kj87j5EPMkzPq+X/o= X-Google-Smtp-Source: AFSGD/UoVRab0te4fVTy8qAEle0z8+QG81KWM7SbxGSKH7aAtjWtJNSz/y4fIj9pRb+9IYcZCeLy4w== X-Received: by 2002:a50:cf41:: with SMTP id d1mr12235239edk.242.1544459696800; Mon, 10 Dec 2018 08:34:56 -0800 (PST) Received: from localhost (pD9E51040.dip0.t-ipconnect.de. [217.229.16.64]) by smtp.gmail.com with ESMTPSA id n12-v6sm1838088ejl.13.2018.12.10.08.34.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Dec 2018 08:34:56 -0800 (PST) From: Thierry Reding To: Thierry Reding Subject: [PATCH] drm/tegra: Refactor CEC support Date: Mon, 10 Dec 2018 17:34:54 +0100 Message-Id: <20181210163455.13627-1-thierry.reding@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 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: linux-tegra@vger.kernel.org, Hans Verkuil , dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding Most of the CEC support code already lives in the "output" library code. Move registration and unregistration to the library code as well to make use of the same code with HDMI on Tegra210 and later via the SOR. Signed-off-by: Thierry Reding Reviewed-by: Hans Verkuil --- drivers/gpu/drm/tegra/drm.h | 2 +- drivers/gpu/drm/tegra/hdmi.c | 9 --------- drivers/gpu/drm/tegra/output.c | 11 +++++++++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h index 019862a41cb4..dbc9e11b0aec 100644 --- a/drivers/gpu/drm/tegra/drm.h +++ b/drivers/gpu/drm/tegra/drm.h @@ -132,7 +132,7 @@ struct tegra_output { struct drm_panel *panel; struct i2c_adapter *ddc; const struct edid *edid; - struct cec_notifier *notifier; + struct cec_notifier *cec; unsigned int hpd_irq; int hpd_gpio; enum of_gpio_flags hpd_gpio_flags; diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 0082468f703c..d19973945614 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -22,8 +22,6 @@ #include -#include - #include "hdmi.h" #include "drm.h" #include "dc.h" @@ -1709,10 +1707,6 @@ static int tegra_hdmi_probe(struct platform_device *pdev) return PTR_ERR(hdmi->vdd); } - hdmi->output.notifier = cec_notifier_get(&pdev->dev); - if (hdmi->output.notifier == NULL) - return -ENOMEM; - hdmi->output.dev = &pdev->dev; err = tegra_output_probe(&hdmi->output); @@ -1771,9 +1765,6 @@ static int tegra_hdmi_remove(struct platform_device *pdev) tegra_output_remove(&hdmi->output); - if (hdmi->output.notifier) - cec_notifier_put(hdmi->output.notifier); - return 0; } diff --git a/drivers/gpu/drm/tegra/output.c b/drivers/gpu/drm/tegra/output.c index c662efc7e413..9c2b9dad55c3 100644 --- a/drivers/gpu/drm/tegra/output.c +++ b/drivers/gpu/drm/tegra/output.c @@ -36,7 +36,7 @@ int tegra_output_connector_get_modes(struct drm_connector *connector) else if (output->ddc) edid = drm_get_edid(connector, output->ddc); - cec_notifier_set_phys_addr_from_edid(output->notifier, edid); + cec_notifier_set_phys_addr_from_edid(output->cec, edid); drm_connector_update_edid_property(connector, edid); if (edid) { @@ -73,7 +73,7 @@ tegra_output_connector_detect(struct drm_connector *connector, bool force) } if (status != connector_status_connected) - cec_notifier_phys_addr_invalidate(output->notifier); + cec_notifier_phys_addr_invalidate(output->cec); return status; } @@ -174,11 +174,18 @@ int tegra_output_probe(struct tegra_output *output) disable_irq(output->hpd_irq); } + output->cec = cec_notifier_get(output->dev); + if (!output->cec) + return -ENOMEM; + return 0; } void tegra_output_remove(struct tegra_output *output) { + if (output->cec) + cec_notifier_put(output->cec); + if (gpio_is_valid(output->hpd_gpio)) { free_irq(output->hpd_irq, output); gpio_free(output->hpd_gpio);