devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Michael Drake <michael.drake@codethink.co.uk>
Cc: Andrzej Hajda <a.hajda@samsung.com>,
	dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>, Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-kernel@lists.codethink.co.uk,
	Patrick Glaser <pglaser@tesla.com>, Nate Case <ncase@tesla.com>
Subject: Re: [PATCH v1 06/11] ti948: Reconfigure in the alive check when device returns
Date: Tue, 11 Jun 2019 21:10:46 +0300	[thread overview]
Message-ID: <20190611181046.GU5016@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190611140412.32151-7-michael.drake@codethink.co.uk>

Hi Michael,

Thank you for the patch.

On Tue, Jun 11, 2019 at 03:04:07PM +0100, Michael Drake wrote:
> If the alive check detects a transition to the alive state,
> the device configuration is rewritten.

This seems like a big hack. You will have at the very least to explain
why this is needed, and why you can't configure the device in response
to drm_bridge operation calls.

> Signed-off-by: Michael Drake <michael.drake@codethink.co.uk>
> Cc: Patrick Glaser <pglaser@tesla.com>
> Cc: Nate Case <ncase@tesla.com>
> ---
>  drivers/gpu/drm/bridge/ti948.c | 19 ++++++++++++++++++-
>  1 file changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti948.c b/drivers/gpu/drm/bridge/ti948.c
> index 86daa3701b91..b5c766711c4b 100644
> --- a/drivers/gpu/drm/bridge/ti948.c
> +++ b/drivers/gpu/drm/bridge/ti948.c
> @@ -132,6 +132,8 @@ struct ti948_reg_val {
>   * @reg_names:   Array of regulator names, or NULL.
>   * @regs:        Array of regulators, or NULL.
>   * @reg_count:   Number of entries in reg_names and regs arrays.
> + * @alive_check: Context for the alive checking work item.
> + * @alive:       Whether the device is alive or not (alive_check).
>   */
>  struct ti948_ctx {
>  	struct i2c_client *i2c;
> @@ -141,6 +143,8 @@ struct ti948_ctx {
>  	const char **reg_names;
>  	struct regulator **regs;
>  	size_t reg_count;
> +	struct delayed_work alive_check;
> +	bool alive;
>  };
>  
>  static bool ti948_readable_reg(struct device *dev, unsigned int reg)
> @@ -346,6 +350,8 @@ static int ti948_power_on(struct ti948_ctx *ti948)
>  	if (ret != 0)
>  		return ret;
>  
> +	ti948->alive = true;
> +
>  	msleep(500);
>  
>  	return 0;
> @@ -356,6 +362,8 @@ static int ti948_power_off(struct ti948_ctx *ti948)
>  	int i;
>  	int ret;
>  
> +	ti948->alive = false;
> +
>  	for (i = ti948->reg_count; i > 0; i--) {
>  		dev_info(&ti948->i2c->dev, "Disabling %s regulator\n",
>  				ti948->reg_names[i - 1]);
> @@ -388,8 +396,17 @@ static void ti948_alive_check(struct work_struct *work)
>  {
>  	struct delayed_work *dwork = to_delayed_work(work);
>  	struct ti948_ctx *ti948 = delayed_work_to_ti948_ctx(dwork);
> +	int ret = ti948_device_check(ti948);
>  
> -	dev_info(&ti948->i2c->dev, "%s Alive check!\n", __func__);
> +	if (ti948->alive == false && ret == 0) {
> +		dev_info(&ti948->i2c->dev, "Device has come back to life!\n");
> +		ti948_write_config_seq(ti948);
> +		ti948->alive = true;
> +
> +	} else if (ti948->alive == true && ret != 0) {
> +		dev_info(&ti948->i2c->dev, "Device has stopped responding\n");
> +		ti948->alive = false;
> +	}
>  
>  	/* Reschedule ourself for the next check. */
>  	schedule_delayed_work(&ti948->alive_check, TI948_ALIVE_CHECK_DELAY);

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2019-06-11 18:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 14:04 [PATCH v1 00/11] Add ti948 and ti949 display bridge drivers Michael Drake
2019-06-11 14:04 ` [PATCH v1 01/11] dt-bindings: display/bridge: Add bindings for ti948 Michael Drake
2019-06-11 18:03   ` Laurent Pinchart
2019-07-12 12:42     ` Michael Drake
2019-06-11 14:04 ` [PATCH v1 02/11] ti948: i2c device driver for TI DS90UB948-Q1 Michael Drake
2019-06-11 14:04 ` [PATCH v1 03/11] dt-bindings: display/bridge: Add config property for ti948 Michael Drake
2019-06-11 18:07   ` Laurent Pinchart
2019-07-12 12:43     ` Michael Drake
2019-06-11 14:04 ` [PATCH v1 04/11] ti948: Add support for configuration via device properties Michael Drake
2019-06-11 14:04 ` [PATCH v1 05/11] ti948: Add alive check function using schedule_delayed_work() Michael Drake
2019-06-11 14:04 ` [PATCH v1 06/11] ti948: Reconfigure in the alive check when device returns Michael Drake
2019-06-11 18:10   ` Laurent Pinchart [this message]
2019-07-12 12:43     ` Michael Drake
2019-06-11 14:04 ` [PATCH v1 07/11] ti948: Add sysfs node for alive attribute Michael Drake
2019-06-11 18:11   ` Laurent Pinchart
2019-07-12 12:43     ` Michael Drake
2019-06-11 14:04 ` [PATCH v1 08/11] dt-bindings: display/bridge: Add bindings for ti949 Michael Drake
2019-06-11 18:13   ` Laurent Pinchart
2019-07-12 12:43     ` Michael Drake
2019-06-11 14:04 ` [PATCH v1 09/11] ti949: i2c device driver for TI DS90UB949-Q1 Michael Drake
2019-06-11 14:04 ` [PATCH v1 10/11] dt-bindings: display/bridge: Add config property for ti949 Michael Drake
2019-06-11 14:04 ` [PATCH v1 11/11] ti949: Add support for configuration via device properties Michael Drake

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=20190611181046.GU5016@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=michael.drake@codethink.co.uk \
    --cc=ncase@tesla.com \
    --cc=pglaser@tesla.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).