Message ID | 20171026181942.9516-1-phh@phh.me (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers |
Received: from vger.kernel.org ([209.132.180.67]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1e7mlH-0002AS-G7; Thu, 26 Oct 2017 18:20:11 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932386AbdJZSUH (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Thu, 26 Oct 2017 14:20:07 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:45416 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932275AbdJZSUF (ORCPT <rfc822;linux-media@vger.kernel.org>); Thu, 26 Oct 2017 14:20:05 -0400 Received: by mail-wr0-f195.google.com with SMTP id y9so4049637wrb.2; Thu, 26 Oct 2017 11:20:05 -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=v8w5GCaykxc4Z3ZFplgNOHxHNuvqwiV14z0iTGK6PBk=; b=HSwZbvyaY+EvWbDT3zhevkL3sPL2yeQx3nlx4AIV1Wvi0dRQgl02kElwvIDrSrZcol wUbPjrbqqkF47F7049pxc5Qpit18cjaYcH3/E1We3PBq5rm2CgTTg7UQQ1dArhvoxUk0 SHVAoFEvgfHG+W/Rd70VD7SiG3sYhNmn6GsyVq6Snk1kOAr9oYYxwzfH+qjf5IM5r+oy 6QEm5vJOz8PWuFL2Izp6kCPy3bJgO7j0yZ5k5E4blzFaZcWQyx6GyVSU4KOhZ7bvcr2L KD+4a5aY9WDj1bd1oHGLJoi4khc0weUne3zko7wiUzK8/XYMJenKU4/l3qbJPGiy1ogO FfiQ== 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=v8w5GCaykxc4Z3ZFplgNOHxHNuvqwiV14z0iTGK6PBk=; b=rCu3cxDiznMlE8lc3ykgBoeCfHrtfYvrI9yvY4QLqLYCjPVOi5ja16X6IlobSElCmb c8Yoa2Xu9lWIlhjdCMkHxqOyFf7fy2Xfg+O95axJa+vVpeiBUbU8aTW7PXvR/IxsqFGQ /LTfULj6x96j/JLSuaQXDWnrj0ery9t/GyJoI8u1IhpmMNSvUNlvFi0OZScGiq37P/qT Ywh/Owjub5wDa3J4dGWIU8BvD3bw9J0NyCkG4WISBnR7ScouQ7lrpr3dy/EfPG8668ZF /eLG+d9EajXFrn0w3dC2h8n6LmVwbyZi2rncY8SsAMLttiYUmkPGr01Hn3fOtKk4LMuz mucA== X-Gm-Message-State: AMCzsaXI7AExlFfqyAwEmhE+L+ZUA6yx9HXBP1tpPvq3mlUskkOYtIiE s3A2xZqTCWnPZKDCTt6gSUU= X-Google-Smtp-Source: ABhQp+QKZSBYd5D8CGfIkf6gnfAljogfRQdtnY1NxESrj01Ey43V9oZpiBR+Wo9jgVhTq7k0kXGMKg== X-Received: by 10.223.190.132 with SMTP id i4mr6640036wrh.123.1509042004273; Thu, 26 Oct 2017 11:20:04 -0700 (PDT) Received: from phh-desktop.home (2a01cb000a08d500a554de3a52fe8259.ipv6.abo.wanadoo.fr. [2a01:cb00:a08:d500:a554:de3a:52fe:8259]) by smtp.gmail.com with ESMTPSA id l130sm2493048wmd.47.2017.10.26.11.20.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 11:20:03 -0700 (PDT) From: Pierre-Hugues Husson <phh@phh.me> To: linux-rockchip@lists.infradead.org Cc: heiko@sntech.de, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux@armlinux.org.uk, Archit Taneja <architt@codeaurora.org>, Andrzej Hajda <a.hajda@samsung.com>, dri-devel@lists.freedesktop.org, Pierre-Hugues Husson <phh@phh.me> Subject: [PATCH v3] drm: bridge: synopsys/dw-hdmi: Enable cec clock Date: Thu, 26 Oct 2017 20:19:42 +0200 Message-Id: <20171026181942.9516-1-phh@phh.me> X-Mailer: git-send-email 2.14.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Pierre-Hugues Husson
Oct. 26, 2017, 6:19 p.m. UTC
The documentation already mentions "cec" optional clock, but
currently the driver doesn't enable it.
Changes:
v3:
- Drop useless braces
v2:
- Separate ENOENT errors from others
- Propagate other errors (especially -EPROBE_DEFER)
Signed-off-by: Pierre-Hugues Husson <phh@phh.me>
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
Comments
I didn't see this merged for 4.15, is it too late to include this? All other changes needed to get CEC to work on rk3288 and rk3399 are all merged. Regards, Hans On 10/26/2017 08:19 PM, Pierre-Hugues Husson wrote: > The documentation already mentions "cec" optional clock, but > currently the driver doesn't enable it. > > Changes: > v3: > - Drop useless braces > > v2: > - Separate ENOENT errors from others > - Propagate other errors (especially -EPROBE_DEFER) > > Signed-off-by: Pierre-Hugues Husson <phh@phh.me> > --- > 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); >
Hi, On 11/20/2017 06:00 PM, Hans Verkuil wrote: > I didn't see this merged for 4.15, is it too late to include this? > All other changes needed to get CEC to work on rk3288 and rk3399 are all merged. Sorry for the late reply. I was out last week. Dave recently sent the second pull request for 4.15, so I think it would be hard to get it in the merge window now. We could target it for the 4.15-rcs since it is preventing the feature from working. Is it possible to rephrase the commit message a bit so that it's clear that we need it for CEC to work? Thanks, Archit > > Regards, > > Hans > > On 10/26/2017 08:19 PM, Pierre-Hugues Husson wrote: >> The documentation already mentions "cec" optional clock, but >> currently the driver doesn't enable it. >> >> Changes: >> v3: >> - Drop useless braces >> >> v2: >> - Separate ENOENT errors from others >> - Propagate other errors (especially -EPROBE_DEFER) >> >> Signed-off-by: Pierre-Hugues Husson <phh@phh.me> >> --- >> 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); >> >
On 11/24/2017 09:04 AM, Archit Taneja wrote: > Hi, > > On 11/20/2017 06:00 PM, Hans Verkuil wrote: >> I didn't see this merged for 4.15, is it too late to include this? >> All other changes needed to get CEC to work on rk3288 and rk3399 are all merged. > > Sorry for the late reply. I was out last week. > > Dave recently sent the second pull request for 4.15, so I think it would be hard to get it > in the merge window now. We could target it for the 4.15-rcs since it is preventing the > feature from working. Is it possible to rephrase the commit message a bit so that it's clear > that we need it for CEC to work? While it is not my patch I would propose something like this: "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." I hadn't realized that last sentence until I started thinking about it, but this patch is really needed. Regards, Hans > > Thanks, > Archit > >> >> Regards, >> >> Hans >> >> On 10/26/2017 08:19 PM, Pierre-Hugues Husson wrote: >>> The documentation already mentions "cec" optional clock, but >>> currently the driver doesn't enable it. >>> >>> Changes: >>> v3: >>> - Drop useless braces >>> >>> v2: >>> - Separate ENOENT errors from others >>> - Propagate other errors (especially -EPROBE_DEFER) >>> >>> Signed-off-by: Pierre-Hugues Husson <phh@phh.me> >>> --- >>> 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); >>> >> >
Hi, >> On 11/20/2017 06:00 PM, Hans Verkuil wrote: >>> I didn't see this merged for 4.15, is it too late to include this? >>> All other changes needed to get CEC to work on rk3288 and rk3399 are all merged. >> >> Sorry for the late reply. I was out last week. >> >> Dave recently sent the second pull request for 4.15, so I think it would be hard to get it >> in the merge window now. We could target it for the 4.15-rcs since it is preventing the >> feature from working. Is it possible to rephrase the commit message a bit so that it's clear >> that we need it for CEC to work? > > While it is not my patch I would propose something like this: > > "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." > > I hadn't realized that last sentence until I started thinking about it, > but this patch is really needed. This change looks good to me. Archit, I can send this as a new version of the patch tomorrow if you need it. Regards,
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);