From patchwork Sat Nov 25 20:18:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Hugues Husson X-Patchwork-Id: 10075089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0277460353 for ; Sat, 25 Nov 2017 20:19:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E8A4F29038 for ; Sat, 25 Nov 2017 20:19:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD2C329043; Sat, 25 Nov 2017 20:19:31 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9378B29038 for ; Sat, 25 Nov 2017 20:19:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=LB1gSpi+8M/XF8u05vGbaaV59BqYAfSGkvFevAb2BGI=; b=pff rDBSyhGMmxI9pA4srl6q3A0jOlomDGVehCHAcybANGb9gbX+LZOjnt3KRBVMh3eDOJ519GwcgptuY 25C9VThE67emtFRXVL5U8OxnBCenA0MDwP6mlxZYrWoKXCQGatYnyhh3kHJoIJ5KsuNYEC14roWAi qD5/R3tp348fufC+nb1pdSXi13zpsQYEnKp6NwyV+3RAIz35sGIvNX9c9bUyczmdEorvGIMzE+m2F 3pXsC6dKtmeA7bOfaPYdKD/7b4N8Z4KYuXwcem1dFTfYAfW1HAvlcIg4meJCsf+YJ2fsZple5CxXW XtGL4OudIqQPly5AFQmL12dWar99LRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eIgvB-00079i-6W; Sat, 25 Nov 2017 20:19:29 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eIgv5-00074t-Dj; Sat, 25 Nov 2017 20:19:26 +0000 Received: by mail-wr0-x242.google.com with SMTP id w95so23028763wrc.2; Sat, 25 Nov 2017 12:19:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=2BmmyMcHJMMp+ci6bPmU40RwH0st1TcDY7tKLqTBfY0=; b=cPxfu/D7NQMJqPczlRDYUIQM6HiPJ4kTtxXOS7Kvoohf0HZJDWiKvFColi4kdigNiZ TQWxkTY68A9c1+x47MuxHCGERgJNE8qfZDcOFxwcTCx4l1xhS9K1c2bHTN4kiYLKS5d+ wMVNot7/9ZnP3C/zOf93ulr7a+cw8iV/BX+QQB6AXEBhzIluGNT6bcVWmq4OWYanp6ZL 9yuevp1lf7zF6tCHoOrZLJYnHKzyMCyd7bjTIEPHkmUMwVtuC658vbk+1UtU2fvEhj28 /Q2OQFDDPIERA26n3zhbZcHtKkTEK/mZUAkLkhHoIovT/L3MPy1xluzPNawF2WbEcq// q5Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=2BmmyMcHJMMp+ci6bPmU40RwH0st1TcDY7tKLqTBfY0=; b=V1zd9Sm1+7zthcVzA8kF8eqJndsAIWHW+Cn90ghOOe2V/+PgV9L98T9T0m2hiUG4dR xd5PKsv5ZrG8tzXomxio1Mc+P8JrdXoy0Sah9KsI8cdz7N7ppmQ7dQYVB58xRzkicVjR kmPSwXckbvrJJ8kK2w/csgUN3Z8eXwTVysdq3xxF+4d703uFHsI3zCdgXvoOhAIva6oz 3pqSHcKVHjf7FpWoGKvBoykdAaPzBYF+cR2wcda1ZEjZI19UmP6HWtSGIuOmAj7Gwt7d oi5MLL4Y+BPmIgV1z8W3ydocflYQjbR81+scUt0827NHHZNIMnSx7pHVdnr2+yFzZuMa nWhw== X-Gm-Message-State: AJaThX7poEai4S0ws7JU3utXfh6NWzxWzTvE4NoYLf90NutmolL0m7DB jPLVPQeir/R08su5sPYMx9vQU8bq X-Google-Smtp-Source: AGs4zMZ6g9xbPYXsg+HAvLJK34Lj3qKMKoxgLO31hsz1CMNSm9tV9bGph4ldMDCWF+W98nXaXX0DSQ== X-Received: by 10.223.174.147 with SMTP id y19mr29500831wrc.97.1511641140722; Sat, 25 Nov 2017 12:19:00 -0800 (PST) Received: from phh-desktop.home (2a01cb000a08d500009f6daec4dcb138.ipv6.abo.wanadoo.fr. [2a01:cb00:a08:d500:9f:6dae:c4dc:b138]) by smtp.gmail.com with ESMTPSA id j13sm1103921wre.55.2017.11.25.12.18.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Nov 2017 12:18:59 -0800 (PST) From: Pierre-Hugues Husson To: linux-rockchip@lists.infradead.org Subject: [PATCH v4] drm: bridge: synopsys/dw-hdmi: Enable cec clock Date: Sat, 25 Nov 2017 21:18:44 +0100 Message-Id: <20171125201844.11353-1-phh@phh.me> X-Mailer: git-send-email 2.15.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171125_121923_650387_94CAAB8B X-CRM114-Status: GOOD ( 10.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Archit Taneja , heiko@sntech.de, linux@armlinux.org.uk, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Andrzej Hajda , Pierre-Hugues Husson , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Support the "cec" optional clock. The documentation already mentions "cec" optional clock and it is used by several boards, but currently the driver doesn't enable it, thus preventing cec from working on those boards. And even worse: a /dev/cecX device will appear for those boards, but it won't be functioning without configuring this clock. Changes: v4: - Change commit message to stress the importance of this patch v3: - Drop useless braces v2: - Separate ENOENT errors from others - Propagate other errors (especially -EPROBE_DEFER) Signed-off-by: Pierre-Hugues Husson --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index bf14214fa464..d82b9747a979 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -138,6 +138,7 @@ struct dw_hdmi { struct device *dev; struct clk *isfr_clk; struct clk *iahb_clk; + struct clk *cec_clk; struct dw_hdmi_i2c *i2c; struct hdmi_data_info hdmi_data; @@ -2382,6 +2383,26 @@ __dw_hdmi_probe(struct platform_device *pdev, goto err_isfr; } + hdmi->cec_clk = devm_clk_get(hdmi->dev, "cec"); + if (PTR_ERR(hdmi->cec_clk) == -ENOENT) { + hdmi->cec_clk = NULL; + } else if (IS_ERR(hdmi->cec_clk)) { + ret = PTR_ERR(hdmi->cec_clk); + if (ret != -EPROBE_DEFER) + dev_err(hdmi->dev, "Cannot get HDMI cec clock: %d\n", + ret); + + hdmi->cec_clk = NULL; + goto err_iahb; + } else { + ret = clk_prepare_enable(hdmi->cec_clk); + if (ret) { + dev_err(hdmi->dev, "Cannot enable HDMI cec clock: %d\n", + ret); + goto err_iahb; + } + } + /* Product and revision IDs */ hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8) | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0); @@ -2518,6 +2539,8 @@ __dw_hdmi_probe(struct platform_device *pdev, cec_notifier_put(hdmi->cec_notifier); clk_disable_unprepare(hdmi->iahb_clk); + if (hdmi->cec_clk) + clk_disable_unprepare(hdmi->cec_clk); err_isfr: clk_disable_unprepare(hdmi->isfr_clk); err_res: @@ -2541,6 +2564,8 @@ static void __dw_hdmi_remove(struct dw_hdmi *hdmi) clk_disable_unprepare(hdmi->iahb_clk); clk_disable_unprepare(hdmi->isfr_clk); + if (hdmi->cec_clk) + clk_disable_unprepare(hdmi->cec_clk); if (hdmi->i2c) i2c_del_adapter(&hdmi->i2c->adap);