From: Yakir Yang <ykk@rock-chips.com>
To: Sean Paul <seanpaul@chromium.org>
Cc: "Thierry Reding" <treding@nvidia.com>,
"Krzysztof Kozlowski" <k.kozlowski@samsung.com>,
linux-samsung-soc@vger.kernel.org,
"Javier Martinez Canillas" <javier@osg.samsung.com>,
"Mark Yao" <yzq@rock-chips.com>,
"Jingoo Han" <jingoohan1@gmail.com>,
emil.l.velikov@gmail.com, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, dianders@chromium.org,
linux-rockchip@lists.infradead.org, daniel.vetter@ffwll.ch,
"Stéphane Marchesin" <marcheu@chromium.org>,
"Tomasz Figa" <tfiga@chromium.org>,
"Dan Carpenter" <dan.carpenter@oracle.com>
Subject: Re: [PATCH v4 4/4] drm/rockchip: analogix_dp: implement PSR function
Date: Fri, 15 Jul 2016 13:45:59 +0800 [thread overview]
Message-ID: <57887897.2090303@rock-chips.com> (raw)
In-Reply-To: <20160714152640.GD13857@seanpaul0.roam.corp.google.com>
Sean,
On 07/14/2016 11:26 PM, Sean Paul wrote:
> On Thu, Jul 14, 2016 at 12:15:58PM +0800, Yakir Yang wrote:
>> Alway enable the PSR function for Rockchip analogix_dp driver. If panel
>> don't support PSR, then the core analogix_dp would ignore this setting.
>>
>> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
> Reviewed-by: Sean Paul <seanpaul@chromium.org>
Thanks :-D
- Yakir
>> ---
>> Changes in v4:
>> - Return 'void' instead of 'int' in analogix_dp_psr_set(). (Sean)
>> - Pull the 10ms delay time out into a #define. (Sean)
>> - Improved the code of analogix_dp_psr_work(). (Sean)
>> - Indented with spaces for new numbers in rockchip_dp_device struct. (Stéphane, reviewed at Google gerrit)
>> [https://chromium-review.googlesource.com/#/c/349085/33/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c@83]
>>
>> Changes in v3:
>> - split the common psr logic into a seperate driver, make this to a
>> simple sub-psr device driver.
>>
>> Changes in v2:
>> - remove vblank notify out (Daniel)
>> - create a psr_active() callback in vop data struct.
>>
>> drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 57 +++++++++++++++++++++++++
>> 1 file changed, 57 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> index e81e19a..aa916f4 100644
>> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> @@ -32,6 +32,7 @@
>> #include <drm/bridge/analogix_dp.h>
>>
>> #include "rockchip_drm_drv.h"
>> +#include "rockchip_drm_psr.h"
>> #include "rockchip_drm_vop.h"
>>
>> #define RK3288_GRF_SOC_CON6 0x25c
>> @@ -41,6 +42,9 @@
>>
>> #define HIWORD_UPDATE(val, mask) (val | (mask) << 16)
>>
>> +#define PSR_SET_DELAY_TIME msecs_to_jiffies(10)
>> +#define PSR_WAIT_LINE_FLAG_TIMEOUT_MS 100
>> +
>> #define to_dp(nm) container_of(nm, struct rockchip_dp_device, nm)
>>
>> /**
>> @@ -68,11 +72,55 @@ struct rockchip_dp_device {
>> struct regmap *grf;
>> struct reset_control *rst;
>>
>> + struct delayed_work psr_work;
>> + unsigned int psr_state;
>> +
>> const struct rockchip_dp_chip_data *data;
>>
>> struct analogix_dp_plat_data plat_data;
>> };
>>
>> +static void analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled)
>> +{
>> + struct rockchip_dp_device *dp = to_dp(encoder);
>> +
>> + dev_dbg(dp->dev, "%s PSR...\n", enabled ? "Entry" : "Exit");
>> +
>> + if (enabled)
>> + dp->psr_state = EDP_VSC_PSR_STATE_ACTIVE;
>> + else
>> + dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
>> +
>> + schedule_delayed_work(&dp->psr_work, PSR_SET_DELAY_TIME);
>> +}
>> +
>> +static void analogix_dp_psr_work(struct work_struct *work)
>> +{
>> + struct rockchip_dp_device *dp =
>> + container_of(work, typeof(*dp), psr_work.work);
>> + struct drm_crtc *crtc = dp->encoder.crtc;
>> + int psr_state = dp->psr_state;
>> + int vact_end;
>> + int ret;
>> +
>> + if (!crtc)
>> + return;
>> +
>> + vact_end = crtc->mode.vtotal - crtc->mode.vsync_start + crtc->mode.vdisplay;
>> +
>> + ret = rockchip_drm_wait_line_flag(dp->encoder.crtc, vact_end,
>> + PSR_WAIT_LINE_FLAG_TIMEOUT_MS);
>> + if (ret) {
>> + dev_err(dp->dev, "line flag interrupt did not arrive\n");
>> + return;
>> + }
>> +
>> + if (psr_state == EDP_VSC_PSR_STATE_ACTIVE)
>> + analogix_dp_enable_psr(dp->dev);
>> + else
>> + analogix_dp_disable_psr(dp->dev);
>> +}
>> +
>> static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
>> {
>> reset_control_assert(dp->rst);
>> @@ -340,12 +388,21 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
>> dp->plat_data.power_off = rockchip_dp_powerdown;
>> dp->plat_data.get_modes = rockchip_dp_get_modes;
>>
>> + dp->psr_state = ~EDP_VSC_PSR_STATE_ACTIVE;
>> + INIT_DELAYED_WORK(&dp->psr_work, analogix_dp_psr_work);
>> +
>> + rockchip_drm_psr_register(&dp->encoder, analogix_dp_psr_set);
>> +
>> return analogix_dp_bind(dev, dp->drm_dev, &dp->plat_data);
>> }
>>
>> static void rockchip_dp_unbind(struct device *dev, struct device *master,
>> void *data)
>> {
>> + struct rockchip_dp_device *dp = dev_get_drvdata(dev);
>> +
>> + rockchip_drm_psr_unregister(&dp->encoder);
>> +
>> return analogix_dp_unbind(dev, master, data);
>> }
>>
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2016-07-15 5:45 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 4:15 [PATCH v4 0/4] Add PSR function support for Analogix/Rockchip DP Yakir Yang
2016-07-14 4:15 ` [PATCH v4 1/4] drm/rockchip: vop: export line flag function Yakir Yang
2016-07-14 14:46 ` Sean Paul
2016-07-15 1:43 ` Yakir Yang
2016-07-14 4:15 ` [PATCH v4 2/4] drm/rockchip: add an common abstracted PSR driver Yakir Yang
2016-07-14 15:14 ` Sean Paul
2016-07-15 1:43 ` Yakir Yang
2016-07-24 7:14 ` Yakir Yang
2016-07-23 4:04 ` Doug Anderson
2016-07-24 7:08 ` Yakir Yang
2016-07-14 4:15 ` [PATCH v4 3/4] drm/bridge: analogix_dp: add the PSR function support Yakir Yang
2016-07-14 15:23 ` Sean Paul
2016-07-15 9:32 ` Yakir Yang
2016-07-15 10:47 ` Yakir Yang
2016-07-14 4:15 ` [PATCH v4 4/4] drm/rockchip: analogix_dp: implement PSR function Yakir Yang
2016-07-14 15:26 ` Sean Paul
2016-07-15 5:45 ` Yakir Yang [this message]
2016-07-15 10:55 ` [PATCH v4.1 1/4] drm/rockchip: vop: export line flag function Yakir Yang
2016-07-15 13:04 ` Sean Paul
2016-07-16 2:30 ` Yakir Yang
2016-07-15 10:55 ` [PATCH v4.1 3/4] drm/bridge: analogix_dp: add the PSR function support Yakir Yang
2016-07-15 13:13 ` Sean Paul
2016-07-16 2:31 ` Yakir Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57887897.2090303@rock-chips.com \
--to=ykk@rock-chips.com \
--cc=dan.carpenter@oracle.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dianders@chromium.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
--cc=javier@osg.samsung.com \
--cc=jingoohan1@gmail.com \
--cc=k.kozlowski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=marcheu@chromium.org \
--cc=seanpaul@chromium.org \
--cc=tfiga@chromium.org \
--cc=treding@nvidia.com \
--cc=yzq@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).