* [RESEND PATCH v2 0/5] rockchip: kevin: Enable edp display
@ 2017-10-16 10:06 Jeffy Chen
2017-10-16 10:06 ` [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm Jeffy Chen
0 siblings, 1 reply; 5+ messages in thread
From: Jeffy Chen @ 2017-10-16 10:06 UTC (permalink / raw)
To: linux-kernel
Cc: dmitry.torokhov, heiko, briannorris, rjw, dianders, tfiga,
broonie, seanpaul, Jeffy Chen, Andrzej Hajda, linux-fbdev,
Arnd Bergmann, linux-pwm, dri-devel, Bartlomiej Zolnierkiewicz,
Daniel Thompson, David Airlie, Catalin Marinas, Laurent Pinchart,
linux-samsung-soc, Seung-Woo Kim, Inki Dae, linux-rockchip,
Kyungmin Park <kyungmi>
Make edp display works on chromebook kevin(at least for boot animation).
Also solve some issues i meet during the bringup.
Changes in v2:
Use device link to correct the suspend/resume and shutdown ordering,
instead of converting rockchip spi's suspend/resume PM callbacks to
late suspend/resume PM callbacks.
Jeffy Chen (4):
arm64: dts: rockchip: Enable edp disaplay on kevin
backlight: pwm_bl: Add device link for pwm_bl and pwm
drm/rockchip: Fix error handling path in rockchip_dp_bind()
drm/rockchip: Add device links for master and components
Tomasz Figa (1):
drm/bridge/analogix: Do not use device's drvdata
arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts | 29 +++++++++++
arch/arm64/boot/dts/rockchip/rk3399-gru.dtsi | 16 ++++++
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 50 ++++++++-----------
drivers/gpu/drm/exynos/exynos_dp.c | 26 +++++-----
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 57 ++++++++++++++--------
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 24 +++++++--
drivers/video/backlight/pwm_bl.c | 2 +
include/drm/bridge/analogix_dp.h | 19 +++++---
8 files changed, 151 insertions(+), 72 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm
2017-10-16 10:06 [RESEND PATCH v2 0/5] rockchip: kevin: Enable edp display Jeffy Chen
@ 2017-10-16 10:06 ` Jeffy Chen
2017-10-16 23:57 ` Brian Norris
0 siblings, 1 reply; 5+ messages in thread
From: Jeffy Chen @ 2017-10-16 10:06 UTC (permalink / raw)
To: linux-kernel
Cc: dmitry.torokhov, heiko, briannorris, rjw, dianders, tfiga,
broonie, seanpaul, Jeffy Chen, linux-pwm, linux-fbdev,
Daniel Thompson, Thierry Reding, Bartlomiej Zolnierkiewicz,
dri-devel, Jingoo Han, Lee Jones
When the pwm driver is unbound, the pwm_bl driver would still hold a
reference to that pwm, and crash the kernel later(if someone trying
to access that invalid pwm).
Add a device link to avoid this.
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
Changes in v2: None
drivers/video/backlight/pwm_bl.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 9bd17682655a..a76f147a26e7 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -328,6 +328,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
goto err_alloc;
}
+ device_link_add(&pdev->dev, pb->pwm->chip->dev, DL_FLAG_AUTOREMOVE);
+
dev_dbg(&pdev->dev, "got pwm for backlight\n");
/*
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm
2017-10-16 10:06 ` [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm Jeffy Chen
@ 2017-10-16 23:57 ` Brian Norris
2017-10-17 8:13 ` jeffy
0 siblings, 1 reply; 5+ messages in thread
From: Brian Norris @ 2017-10-16 23:57 UTC (permalink / raw)
To: Jeffy Chen
Cc: linux-pwm, linux-fbdev, Bartlomiej Zolnierkiewicz, linux-kernel,
dmitry.torokhov, rjw, dianders, dri-devel, tfiga, broonie,
Jingoo Han, Thierry Reding, Daniel Thompson, Lee Jones
Hi,
On Mon, Oct 16, 2017 at 06:06:37PM +0800, Jeffy Chen wrote:
> When the pwm driver is unbound, the pwm_bl driver would still hold a
> reference to that pwm, and crash the kernel later(if someone trying
> to access that invalid pwm).
This is not the primary problem you're trying to address though, is it? This is
mostly supposed to handle PM, not device removal (though it seems to do some of
both).
But for the removal/unbind case, I wondered why the existing PWM "requested"
status [1] didn't catch the stated problem above, but then I noticed...the
driver core doesn't care if the driver remove() callback fails. So
pwmchip_remove() an return -EBUSY all it wants -- the device core is still
going to unbind you (and free all your devm_*'s). This seems kinda bad.
> Add a device link to avoid this.
This is going to be a *lot* of churn throughout the tree, if we expect
all resource consumers to do this. I think we'd want some kind of
agreement from the PM maintainers and (larger) subsystem owners before
going down this route...
And in the PWM case, pwm_get() already has the device pointer. Why can't
we just instrument it instead?
Brian
P.S. A little off-topic, but this enum is wrong, for use with test_bit():
enum {
PWMF_REQUESTED = 1 << 0,
PWMF_EXPORTED = 1 << 1,
};
test_bit() and friends take a bit number, not a bit mask. Fortunately it
doesn't matter much, since the bitmask is just not very dense this way. But
it's misleading and will cause problems if we get a lot new flags.
> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> ---
>
> Changes in v2: None
>
> drivers/video/backlight/pwm_bl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 9bd17682655a..a76f147a26e7 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -328,6 +328,8 @@ static int pwm_backlight_probe(struct platform_device *pdev)
> goto err_alloc;
> }
>
> + device_link_add(&pdev->dev, pb->pwm->chip->dev, DL_FLAG_AUTOREMOVE);
> +
> dev_dbg(&pdev->dev, "got pwm for backlight\n");
>
> /*
> --
> 2.11.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm
2017-10-16 23:57 ` Brian Norris
@ 2017-10-17 8:13 ` jeffy
2017-10-17 16:51 ` Brian Norris
0 siblings, 1 reply; 5+ messages in thread
From: jeffy @ 2017-10-17 8:13 UTC (permalink / raw)
To: Brian Norris
Cc: linux-pwm, linux-fbdev, Bartlomiej Zolnierkiewicz, linux-kernel,
dmitry.torokhov, rjw, dianders, dri-devel, tfiga, broonie,
Jingoo Han, Thierry Reding, Daniel Thompson, Lee Jones
Hi Brian,
On 10/17/2017 07:57 AM, Brian Norris wrote:
> This is going to be a*lot* of churn throughout the tree, if we expect
> all resource consumers to do this. I think we'd want some kind of
> agreement from the PM maintainers and (larger) subsystem owners before
> going down this route...
>
> And in the PWM case, pwm_get() already has the device pointer. Why can't
> we just instrument it instead?
according to pwm_bl driver, we may need to take care of pwm_request() too:
pb->pwm = devm_pwm_get(&pdev->dev, NULL);
if (IS_ERR(pb->pwm) && PTR_ERR(pb->pwm) != -EPROBE_DEFER &&
!node) {
dev_err(&pdev->dev, "unable to request PWM, trying
legacy API\n");
pb->legacy = true;
pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
}
and maybe also *of_pwm_get...
maybe we can add a dummy pwm chip for those orphan pwms?
>
> Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm
2017-10-17 8:13 ` jeffy
@ 2017-10-17 16:51 ` Brian Norris
0 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2017-10-17 16:51 UTC (permalink / raw)
To: jeffy
Cc: linux-pwm, linux-fbdev, Bartlomiej Zolnierkiewicz, linux-kernel,
dmitry.torokhov, rjw, dianders, dri-devel, tfiga, broonie,
Jingoo Han, Thierry Reding, Daniel Thompson, Lee Jones
Hi,
On Tue, Oct 17, 2017 at 04:13:55PM +0800, Jeffy Chen wrote:
> On 10/17/2017 07:57 AM, Brian Norris wrote:
> >This is going to be a*lot* of churn throughout the tree, if we expect
> >all resource consumers to do this. I think we'd want some kind of
> >agreement from the PM maintainers and (larger) subsystem owners before
> >going down this route...
> >
> >And in the PWM case, pwm_get() already has the device pointer. Why can't
> >we just instrument it instead?
>
> according to pwm_bl driver, we may need to take care of pwm_request() too:
That's a legacy API. I wouldn't spend any time on improving it. In fact,
the only other 2 users are:
(a) drivers/input/misc/max8997_haptic.c: abandoned; nobody provides
pdata for that driver, so pwm_request() can never be called...
(b) arch/arm/mach-s3c24xx/mach-rx1950.c: can be easily converted to
the lookup table approach (pwm_add_table() + pwm_get()) if needed
> pb->pwm = devm_pwm_get(&pdev->dev, NULL);
> if (IS_ERR(pb->pwm) && PTR_ERR(pb->pwm) != -EPROBE_DEFER &&
> !node) {
> dev_err(&pdev->dev, "unable to request PWM, trying
> legacy API\n");
> pb->legacy = true;
> pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");
> }
>
> and maybe also *of_pwm_get...
>
> maybe we can add a dummy pwm chip for those orphan pwms?
What? That seems like a very silly idea. And judging by Thierry's
response to your v4, he doesn't understand it either.
All I was suggesting was that you should try to add the device links in
the fewest places possible. Because if you require all consumers to add
extra boilerplate to resolve some strange corner cases, those corner
cases will likely go unsolved in many cases.
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-17 16:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-16 10:06 [RESEND PATCH v2 0/5] rockchip: kevin: Enable edp display Jeffy Chen
2017-10-16 10:06 ` [RESEND PATCH v2 2/5] backlight: pwm_bl: Add device link for pwm_bl and pwm Jeffy Chen
2017-10-16 23:57 ` Brian Norris
2017-10-17 8:13 ` jeffy
2017-10-17 16:51 ` Brian Norris
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).