Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3874637pxu; Tue, 20 Oct 2020 02:49:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQKKIlV5UIHG4CjsC6NniYTcLdw7Lr/1uThUpGUYqixzyzFfPsFkLBN672C5swdSeNOoQn X-Received: by 2002:a50:e442:: with SMTP id e2mr1986893edm.186.1603187365973; Tue, 20 Oct 2020 02:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603187365; cv=none; d=google.com; s=arc-20160816; b=AxLY7zOZTMOb89O8KvmiYRNOU8V8dYvl9nF5PVuiYdyRfZRNMqnqYMJOIubdaUySK9 VevJHSXTWdf7x8bGvbP+CX8mOlisI97B11UGKs/K41ldFK/hzCHP9gRfWis8nZ4IDEO8 qM88BL/UxjfD7j9wDPQqTpvoOPCPh5SzUJXNnGZP4kMiOK76on0b60cYEA0fgitWvhFN VrXMX+O2+P79pn+NDDY2+4nami99RpCp6JHyQRShSQRKmsroud9kCrN1NT0+lQ8Ft/e0 WCX8PtZcTmMNWETVcBcrMXDiCZyN5MCmxaUeAE+ZjZYKI1OrIFUa3/XzhMZend5oEAL1 Awow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=G08oKUo1IBgVuMlGLwZoggz7LaVqryOb62z9agBNRCM=; b=fGW+ALZAWGlmYsOif30uyAJTC2juaQsjARIT+k9wp8mpMFVxexsLk7PMNnzZGYMXEH N8iAxb8cEUjAuuKClxWSJaQmhOstHLKDhmc2ZytotsLeVL8anNJRPX5VaLht824q9aGz xKLGa6qCBc/CqJQmeFjH0SZwcpDJ83tL+O7zZSKLet5wTa3jqMMJRkRzTagCb1XjHSxV mFbGXSLoon/CuhHoJkJA101bFLu8YWk/nY+JAiuBDvuoXgKwxnl+uauc76/9T7HIB23D RG6atR2XZ7Mk5ch4tKijBqAqTamDxE7Fpo+CkxTCiuELglAHmx3PFsTBFUFaRy7caM9a ND2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u2si837353edq.230.2020.10.20.02.49.04; Tue, 20 Oct 2020 02:49:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404898AbgJTHQh (ORCPT + 99 others); Tue, 20 Oct 2020 03:16:37 -0400 Received: from asavdk3.altibox.net ([109.247.116.14]:45590 "EHLO asavdk3.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404810AbgJTHQf (ORCPT ); Tue, 20 Oct 2020 03:16:35 -0400 Received: from ravnborg.org (unknown [188.228.123.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by asavdk3.altibox.net (Postfix) with ESMTPS id 26D402002A; Tue, 20 Oct 2020 09:16:30 +0200 (CEST) Date: Tue, 20 Oct 2020 09:16:28 +0200 From: Sam Ravnborg To: "Alex G." Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, Jernej Skrabec , Thomas Bogendoerfer , Neil Armstrong , David Airlie , Mark Brown , Jonas Karlman , open list , Andrzej Hajda , Rob Herring , Laurent Pinchart , Mauro Carvalho Chehab Subject: Re: [PATCH v2 1/2] drm/bridge: sii902x: Enable I/O and core VCC supplies if present Message-ID: <20201020071628.GA1737816@ravnborg.org> References: <20200924200507.1175888-1-mr.nuke.me@gmail.com> <20200928173056.1674274-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=S433PrkP c=1 sm=1 tr=0 a=S6zTFyMACwkrwXSdXUNehg==:117 a=S6zTFyMACwkrwXSdXUNehg==:17 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=e5mUnYsNAAAA:8 a=vrf_ZfXLQi0HMj2fYoAA:9 a=CjuIK1q_8ugA:10 a=Vxmtnl_E_bksehYqCbjh:22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alex. On Mon, Oct 19, 2020 at 08:24:40PM -0500, Alex G. wrote: > On 9/28/20 12:30 PM, Alexandru Gagniuc wrote: > > On the SII9022, the IOVCC and CVCC12 supplies must reach the correct > > voltage before the reset sequence is initiated. On most boards, this > > assumption is true at boot-up, so initialization succeeds. > > > > However, when we try to initialize the chip with incorrect supply > > voltages, it will not respond to I2C requests. sii902x_probe() fails > > with -ENXIO. > > > > To resolve this, look for the "iovcc" and "cvcc12" regulators, and > > make sure they are enabled before starting the reset sequence. If > > these supplies are not available in devicetree, then they will default > > to dummy-regulator. In that case everything will work like before. > > > > This was observed on a STM32MP157C-DK2 booting in u-boot falcon mode. > > On this board, the supplies would be set by the second stage > > bootloader, which does not run in falcon mode. > > > > Signed-off-by: Alexandru Gagniuc > > --- > > Changes since v1: > > * Fix return code after regulator_enable(sii902x->iovcc) fails (Fabio Estevam) > > * Use dev_err_probe() instead of dev_err() where appropriate (Sam Ravnborg) > > > > drivers/gpu/drm/bridge/sii902x.c | 54 ++++++++++++++++++++++++++++---- > > 1 file changed, 48 insertions(+), 6 deletions(-) > > This patch seems to have entered fall dormancy. Did I miss somebody in the > CC field? I have lost the original mail/patch. Can you resend with one fix - see below. Sam > > Alex > > > > diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c > > index 33fd33f953ec..d15e9f2c0d8a 100644 > > --- a/drivers/gpu/drm/bridge/sii902x.c > > +++ b/drivers/gpu/drm/bridge/sii902x.c > > @@ -17,6 +17,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > @@ -168,6 +169,8 @@ struct sii902x { > > struct drm_connector connector; > > struct gpio_desc *reset_gpio; > > struct i2c_mux_core *i2cmux; > > + struct regulator *iovcc; > > + struct regulator *cvcc12; > > /* > > * Mutex protects audio and video functions from interfering > > * each other, by keeping their i2c command sequences atomic. > > @@ -954,13 +957,13 @@ static const struct drm_bridge_timings default_sii902x_timings = { > > | DRM_BUS_FLAG_DE_HIGH, > > }; > > +static int sii902x_init(struct sii902x *sii902x); Please re-arrange the code so this prototype is not needed. > > + > > static int sii902x_probe(struct i2c_client *client, > > const struct i2c_device_id *id) > > { > > struct device *dev = &client->dev; > > - unsigned int status = 0; > > struct sii902x *sii902x; > > - u8 chipid[4]; > > int ret; > > ret = i2c_check_functionality(client->adapter, > > @@ -989,6 +992,43 @@ static int sii902x_probe(struct i2c_client *client, > > mutex_init(&sii902x->mutex); > > + sii902x->iovcc = devm_regulator_get(dev, "iovcc"); > > + if (IS_ERR(sii902x->iovcc)) > > + return PTR_ERR(sii902x->iovcc); > > + > > + sii902x->cvcc12 = devm_regulator_get(dev, "cvcc12"); > > + if (IS_ERR(sii902x->cvcc12)) > > + return PTR_ERR(sii902x->cvcc12); > > + > > + ret = regulator_enable(sii902x->iovcc); > > + if (ret < 0) { > > + dev_err_probe(dev, ret, "Failed to enable iovcc supply"); > > + return ret; > > + } > > + > > + ret = regulator_enable(sii902x->cvcc12); > > + if (ret < 0) { > > + dev_err_probe(dev, ret, "Failed to enable cvcc12 supply"); > > + regulator_disable(sii902x->iovcc); > > + return ret; > > + } > > + > > + ret = sii902x_init(sii902x); > > + if (ret < 0) { > > + regulator_disable(sii902x->cvcc12); > > + regulator_disable(sii902x->iovcc); > > + } > > + > > + return ret; > > +} > > + > > +static int sii902x_init(struct sii902x *sii902x) > > +{ > > + struct device *dev = &sii902x->i2c->dev; > > + unsigned int status = 0; > > + u8 chipid[4]; > > + int ret; > > + > > sii902x_reset(sii902x); > > ret = regmap_write(sii902x->regmap, SII902X_REG_TPI_RQB, 0x0); > > @@ -1012,11 +1052,11 @@ static int sii902x_probe(struct i2c_client *client, > > regmap_read(sii902x->regmap, SII902X_INT_STATUS, &status); > > regmap_write(sii902x->regmap, SII902X_INT_STATUS, status); > > - if (client->irq > 0) { > > + if (sii902x->i2c->irq > 0) { > > regmap_write(sii902x->regmap, SII902X_INT_ENABLE, > > SII902X_HOTPLUG_EVENT); > > - ret = devm_request_threaded_irq(dev, client->irq, NULL, > > + ret = devm_request_threaded_irq(dev, sii902x->i2c->irq, NULL, > > sii902x_interrupt, > > IRQF_ONESHOT, dev_name(dev), > > sii902x); > > @@ -1031,9 +1071,9 @@ static int sii902x_probe(struct i2c_client *client, > > sii902x_audio_codec_init(sii902x, dev); > > - i2c_set_clientdata(client, sii902x); > > + i2c_set_clientdata(sii902x->i2c, sii902x); > > - sii902x->i2cmux = i2c_mux_alloc(client->adapter, dev, > > + sii902x->i2cmux = i2c_mux_alloc(sii902x->i2c->adapter, dev, > > 1, 0, I2C_MUX_GATE, > > sii902x_i2c_bypass_select, > > sii902x_i2c_bypass_deselect); > > @@ -1051,6 +1091,8 @@ static int sii902x_remove(struct i2c_client *client) > > i2c_mux_del_adapters(sii902x->i2cmux); > > drm_bridge_remove(&sii902x->bridge); > > + regulator_disable(sii902x->cvcc12); > > + regulator_disable(sii902x->iovcc); > > return 0; > > } > > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel