devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-pwm@vger.kernel.org,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	dri-devel@lists.freedesktop.org, Rob Herring <robh+dt@kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v1 7/7] drm: add Atmel LCDC display controller support
Date: Sun, 26 Aug 2018 20:41:21 +0200	[thread overview]
Message-ID: <20180826184121.GA24867@ravnborg.org> (raw)
In-Reply-To: <20180824143125.4e99e791@bbrezillon>

Hi Boris.

Very usefull feedback!
I am working on v2, and have addressed your review items.
Just a few comments below to a few items.
The rest is processed/done.

I hope to post v2 in the week to come.

> > +static int lcdc_dc_load(struct drm_device *drm)
> > +{
> > +	const struct of_device_id *match;
> > +	struct platform_device *pdev;
> > +	struct lcdc_dc *lcdc_dc;
> > +	struct device *dev;
> > +	int ret;
> > +
> > +	dev = drm->dev;
> > +	pdev = to_platform_device(dev);
> > +
> > +	match = of_match_node(atmel_lcdc_of_match, dev->parent->of_node);
> > +	if (!match) {
> > +		DRM_DEV_ERROR(dev, "invalid compatible string (node=%s)",
> > +			      dev->parent->of_node->name);
> > +		return -ENODEV;
> > +	}
> > +
> > +	if (!match->data) {
> > +		DRM_DEV_ERROR(dev, "invalid lcdc_dc description\n");
> > +		return -EINVAL;
> > +	}
> > +
> > +	lcdc_dc = devm_kzalloc(dev, sizeof(*lcdc_dc), GFP_KERNEL);
> > +	if (!lcdc_dc) {
> > +		DRM_DEV_ERROR(dev, "Failed to allocate lcdc_dc\n");
> > +		return -ENOMEM;
> > +	}
> > +
> > +	/* reset of lcdc might sleep and require a preemptible task context */
> > +	INIT_WORK(&lcdc_dc->reset_lcdc_work, reset_lcdc_work);
> > +
> > +	platform_set_drvdata(pdev, drm);
> > +	dev_set_drvdata(dev, lcdc_dc);
> > +
> > +	lcdc_dc->mfd_lcdc = dev_get_drvdata(dev->parent);
> > +	drm->dev_private = lcdc_dc;
> > +
> > +	lcdc_dc->regmap = lcdc_dc->mfd_lcdc->regmap;
> > +	lcdc_dc->desc = match->data;
> > +	lcdc_dc->dev = dev;
> > +
> > +	lcdc_dc->lcd_supply = devm_regulator_get(dev, "lcd");
> > +	if (IS_ERR(lcdc_dc->lcd_supply)) {
> > +		DRM_DEV_ERROR(dev, "Failed to get lcd-supply (%ld)\n",
> > +			      PTR_ERR(lcdc_dc->lcd_supply));
> > +		lcdc_dc->lcd_supply = NULL;
> > +	}
> > +
> > +	lcdc_dc_start_clock(lcdc_dc);
> 
> Hm, do you really need to call that here? I'd make it part of the
> runtime PM resume hook, and put a lcdc_dc_stop_clock() in the suspend
> hook.

As suggested I have introduced suspend/resume hooks and have included
start/stop clock calls.

But as the suspend/resume hooks depends on CONFIG_PM_SLEEP I
still need the explicit call in this function.

> > +
> > +	pm_runtime_enable(dev);
> > +
> > +	ret = drm_vblank_init(drm, 1);
> > +	if (ret) {
> > +		DRM_DEV_ERROR(dev, "failed to initialize vblank (%d)\n",
> > +			      ret);
> > +		goto err_pm_runtime_disable;
> > +	}
> > +
> > +	ret = lcdc_dc_modeset_init(lcdc_dc, drm);
> > +	if (ret) {
> > +		DRM_DEV_ERROR(dev, "modeset_init failed (%d)", ret);
> > +		goto err_pm_runtime_disable;
> > +	}
> > +
> > +	pm_runtime_get_sync(dev);
> 
> This call will automatically call the runtime PM resume hook, so if you
> need the clk to be enabled before that point you should put it earlier.
> 
> Also, you should call pm_runtime_get_sync() in the ->enable() path and
> pm_runtime_put() in the ->disable() path.
Good catch! Added.

	Sam


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-08-26 18:41 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-12 18:41 [RFC PATCH 0/7] add at91sam9 LCDC DRM driver Sam Ravnborg
2018-08-12 18:46 ` [PATCH v1 1/7] atmel-hlcdc: renamed directory to drm/atmel/ Sam Ravnborg
2018-08-14  8:39   ` Daniel Vetter
2018-08-14 16:19     ` Sam Ravnborg
2018-08-16  7:41       ` Daniel Vetter
2018-08-22 20:09         ` Sam Ravnborg
2018-08-22 20:22           ` Daniel Vetter
2018-08-24  8:28   ` Boris Brezillon
2018-08-24 15:43     ` Sam Ravnborg
2018-08-12 18:46 ` [PATCH v1 2/7] dt-binding: add bindings for Atmel LCDC mfd Sam Ravnborg
2018-08-24  8:45   ` Boris Brezillon
2018-08-24 15:58     ` Sam Ravnborg
2018-08-12 18:46 ` [PATCH v1 3/7] mfd: add atmel-lcdc driver Sam Ravnborg
2018-08-14 11:09   ` kbuild test robot
2018-08-15  5:24   ` Lee Jones
2018-08-15 20:40     ` Sam Ravnborg
2018-08-16  8:28       ` Nicolas Ferre
2018-08-16  8:42         ` Lee Jones
2018-08-24  8:37         ` Boris Brezillon
2018-08-24  8:15     ` Boris Brezillon
2018-08-24 10:58       ` Lee Jones
2018-08-15  8:11   ` kbuild test robot
2018-08-24  8:48   ` Boris Brezillon
2018-08-12 18:46 ` [PATCH v1 4/7] dt-bindings: add bindings for Atmel LCDC pwm Sam Ravnborg
2018-08-12 18:46 ` [PATCH v1 5/7] pwm: add pwm-atmel-lcdc driver Sam Ravnborg
2018-08-12 18:46 ` [PATCH v1 6/7] dt-bindings: add bindings for Atmel lcdc-display-controller Sam Ravnborg
2018-08-12 18:46 ` [PATCH v1 7/7] drm: add Atmel LCDC display controller support Sam Ravnborg
2018-08-24 12:31   ` Boris Brezillon
2018-08-26 18:41     ` Sam Ravnborg [this message]
2018-08-26 14:28   ` Noralf Trønnes
2018-08-26 14:58     ` Sam Ravnborg
2018-08-12 19:55 ` [RFC PATCH 0/7] add at91sam9 LCDC DRM driver Sam Ravnborg
2018-08-13 14:47   ` Nicolas Ferre
2018-08-14  8:41     ` Daniel Vetter
2018-08-22 20:12       ` Sam Ravnborg
2018-08-23  6:16         ` Daniel Vetter
2018-08-13 15:54 ` Nicolas Ferre
2018-08-13 18:18   ` Sam Ravnborg
2018-08-13 22:04     ` Rob Herring
2018-08-14 16:43       ` Sam Ravnborg
2018-08-14 22:42         ` Rob Herring
2018-08-15  4:48           ` Sam Ravnborg
2018-08-15 14:45             ` Rob Herring
2018-08-15 15:04               ` Daniel Vetter
2018-08-15 15:41                 ` Peter Rosin
2018-08-15 20:48                   ` Sam Ravnborg
2018-08-14 14:36     ` Alexandre Belloni
2018-08-14 16:16       ` Sam Ravnborg
2018-08-24  8:22 ` Boris Brezillon
2018-08-24 15:52   ` Sam Ravnborg

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=20180826184121.GA24867@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=nicolas.ferre@microchip.com \
    --cc=robh+dt@kernel.org \
    /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).