From patchwork Fri Oct 20 19:18:38 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: 10020867 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 10A0060224 for ; Fri, 20 Oct 2017 19:19:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01EEC28F40 for ; Fri, 20 Oct 2017 19:19:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EAAE928F42; Fri, 20 Oct 2017 19:19:54 +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=-3.7 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 A3DBB28F41 for ; Fri, 20 Oct 2017 19:19:54 +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=d10R/4hPrf7IAqZ1nrEszLFbxCPCCsjkI6HUAsEtzu8=; b=n1t 83cEpIQEeIWolTAbHMmQsRJSUkF7k+nvpwXVPR1coKx+Bosw130UlPOsX4dqdWGz6HUvCk1p9T0FJ bpwloxxq5sa1cpgp33duA5EHOCGOdXFPmy/NwbYKQ3OwZse886VTGtDcGFRo2N4XGWZQhHG1dbGL4 Fqkgx/mQyX3c2KpzXEsqvGQ6V9oyn/edQuUsWJFHt8oYgp3gxe5hc9aG4D7L8dVlbqZJDApidJMLL pdaD5ePgE7P6obwhXBnGpIEndpvuyW14DsZbMHPxb6eQOb9CnWEiGREVpK7gtitd20JwAaeqiH0Cs cX8JYg0Zav7jr9O4I9RcFhjbwxoOUtQ==; 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 1e5cpd-0004JJ-KY; Fri, 20 Oct 2017 19:19:45 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e5cpY-0004Fo-Bo; Fri, 20 Oct 2017 19:19:42 +0000 Received: by mail-wm0-x241.google.com with SMTP id m72so1637399wmc.0; Fri, 20 Oct 2017 12:19:18 -0700 (PDT) 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=Cp0nPcPux4pw/6LBVpgWgJKFVVJLcXXDz0xi2LvuiSY=; b=WjhWVPHqKudVbeCcNBHZdCM63Dpqrdqkiuv+GoaBbkMLp+3gVsUpR1idkJ6TKbpQND XCRwFcRK4TztbbsEVOXnRVebMUjPjFA/Roa1A2kcSyChs4jWaxd05CKZgxGxPXq7SLEg WIYEB1WzYBbdZ7TB+VDoshF59PJFLewPNwZHRJyp0daPRIssux4hEvfy5tLE4hUvUrvy x4RpM87LKL6l9hfIxHsKlI4JQQ/q1ibe8SF/RZW5O8WgeR/MFI3gp4XreIXA6G5nhJpL XhMbOwQfI0R/27CnNFAjdfUTIJMCRVAaWQGBYwKjEnq/1D5jF3AU7YBQ+uoc77CByosu a/Sg== 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=Cp0nPcPux4pw/6LBVpgWgJKFVVJLcXXDz0xi2LvuiSY=; b=Swx6h9VDaXPF5EAN4dFAozKwwFZCpQHxkmeQyxr69YWCCbbMAGKpBMrILpJiu6eBcS AnsEiwkkVZ/8T5YFJHiJVsiiPwsSzuC1GV04ku284QidpJOey4u2QHwAoL7DTD4TqJD0 Ap948I3DFZZUsKfefr56bSZnZs5vmgFEViDcOfkikhuN1C3p8BGXn8KV8ABnhDCpf8g1 O/vGVy5mMBrHpzHaKcOC22BYFWO4/o/Zub99P9FDzLyIOv6Kxgh/AUXQpvLhpDjtjz88 5z6dYlr3XzIHOcdlKfzBM4W8WM7xBWe60AJ3ZjqzbIe9WyFqoYW+qipqxQ0Kemt6bNPB TWQw== X-Gm-Message-State: AMCzsaXDm7p5ufLKJluCeEOI1WpbY9/7pxnwwAe+x3Sjlf6IZqkFAtvu vF6Bpuxhii0fc1ikO9mjZC05cyQB X-Google-Smtp-Source: ABhQp+QwKcLAizCzd+1iYAsucf5OsdjnSBBazQmX0rQAPe5XX3wHaPomGLj4b0im+Ng6rY3HpTsmZQ== X-Received: by 10.28.35.9 with SMTP id j9mr2171200wmj.109.1508527156855; Fri, 20 Oct 2017 12:19:16 -0700 (PDT) Received: from phh-desktop.rezel.net (2a01cb000a08d500257a045be3c79ac2.ipv6.abo.wanadoo.fr. [2a01:cb00:a08:d500:257a:45b:e3c7:9ac2]) by smtp.gmail.com with ESMTPSA id e196sm3922170wmf.9.2017.10.20.12.19.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Oct 2017 12:19:16 -0700 (PDT) From: Pierre-Hugues Husson To: linux-rockchip@lists.infradead.org Subject: [PATCH v2] drm: bridge: synopsys/dw-hdmi: Enable cec clock Date: Fri, 20 Oct 2017 21:18:38 +0200 Message-Id: <20171020191838.392-1-phh@phh.me> X-Mailer: git-send-email 2.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171020_121940_559419_EAF8453A X-CRM114-Status: UNSURE ( 8.98 ) X-CRM114-Notice: Please train this message. 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: heiko@sntech.de, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, 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 The documentation already mentions "cec" optional clock, but currently the driver doesn't enable it. Changes: 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 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index bf14214fa464..b31fc95d5fef 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,27 @@ __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 +2540,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 +2565,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);