Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4715167ybi; Tue, 11 Jun 2019 11:12:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwW4l2xHejw/pNDIrsZPKNQB00zrXc88wM8uwmMXmE7vcx4DWSxZpR9bMl+/RpT1RQnRCB/ X-Received: by 2002:a17:902:6a88:: with SMTP id n8mr70837692plk.266.1560276740776; Tue, 11 Jun 2019 11:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560276740; cv=none; d=google.com; s=arc-20160816; b=and7bYUkIt6O+kHn5kdiPy6birOGReuXMxPW8hXWI/7+ZHl2ng9SdsUWeWXmfdB85c qPoRixPzaXvoM4S+UxL4zxB44KOi3fv4lu7VvN7AhLTC0v1sFDKIetOsGD32ihpUMS+c yQS9+SGHv6iLIvLMPUIy9LA4pXCjct3IeatOPhwXQ71GIhAbhhyCZi78o+EKOfURjfA5 4GLdltd3MADfG0luNPkPCvAHRxw12qRsnBdArlQS6k4goQcAh26W1On8l7OGVwjmgfJL G39Adx51qfCalw9RIJL7GaUhODp3x1Eky+Eog1DQKzcrPinwW7xbZC8HS3aGc10dgRBE NT9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=peYFKLzPhqwUmnOegGJwAFk/XJ+5786ChjX+btKHRc0=; b=RMKVFAaQWVzTXRmZTnygtERlIjGh53g+mhvmZOmVSpk0OfS9yzGfkDaTidqaLS/kMA 7/69rYcutg0CPijggCXGtdXir/58LMgaxlXkXgHO8rnM42Xma4sGVYrRDIS7ESJd13fb 8TM+LmQ8OWQdoWCfMZIdmpdBCbev7tSljWD77o/Hb3G657hLehpTH4ippZ2Ks3+a/td0 oqr8A7UmSaJgTWcoTCYoFh0c74zQuXzwIurtTwATXhLZJieMyouLSHu61ihj8Ds++SI3 SPvlH82LNZmpohYlJsJe/L5jNgn+Vcct9b1tFnIyKLKkEzV2LaZX8/EbIvKyGLR5onX0 zCEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=hcIOtR0S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b38si12874549pgb.250.2019.06.11.11.11.50; Tue, 11 Jun 2019 11:12:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=hcIOtR0S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406893AbfFKSLE (ORCPT + 99 others); Tue, 11 Jun 2019 14:11:04 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:36342 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406685AbfFKSLE (ORCPT ); Tue, 11 Jun 2019 14:11:04 -0400 Received: from pendragon.ideasonboard.com (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F070F1030; Tue, 11 Jun 2019 20:11:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1560276662; bh=X5ba4hPanC2AN4ceWEVuMDO4nnB5xvvl9LT4UMu+zYQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hcIOtR0SSyWGNef99sUwB28gGA+lFi/F/FphmQuvgI0MTjARriXxO/K1eUH5m6o9/ LVgI8p+IrMWyqRuwTIE0c1kXCNIGaSpiqrxgCPSkick5B2BaqeMqvBtiXBHLSSvnRZ 1xi8CWzBevXuv4WcwNseLfRvqjRiubK0dRO9dPyQ= Date: Tue, 11 Jun 2019 21:10:46 +0300 From: Laurent Pinchart To: Michael Drake Cc: Andrzej Hajda , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , Rob Herring , Mark Rutland , linux-kernel@lists.codethink.co.uk, Patrick Glaser , Nate Case Subject: Re: [PATCH v1 06/11] ti948: Reconfigure in the alive check when device returns Message-ID: <20190611181046.GU5016@pendragon.ideasonboard.com> References: <20190611140412.32151-1-michael.drake@codethink.co.uk> <20190611140412.32151-7-michael.drake@codethink.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190611140412.32151-7-michael.drake@codethink.co.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Patrick Glaser > Cc: Nate Case > --- > 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