From nobody Tue Nov 26 04:13:15 2024 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91CA219E99E for ; Tue, 22 Oct 2024 13:22:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729603367; cv=none; b=afhlIu3pa8msHGqSKtGvxTIyN+8tXCbEnB9wrCFqjmPC+jjXdIjh/wptBlC0U0+pbnUBcLz80deqhKA5lVpha0wFKvaD2sX2soc3+uO+SLlZDZyDbQZLJWgsdDOaW9wx2eGnbak31ylU697o0S8GRGGZ0V0GYS4tF8L0QG8jQgw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729603367; c=relaxed/simple; bh=s8uFNPbxVNJ0ubj+QtCVAYqEkC0v6RNjIhpOZ81iCT8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jux921S14VYt7RHeF6Hb0P+EgqNaUSjHNYsArF3ocyfJvxKFannSQ252p6GrlN3PIjylEad/1dDuD7WXpH70pyOI868/F3cGiN6K029iWovybdlYYgRelZNRz08HevrGLAB/V/2KhGWZvSaevgSwdbrre82M+R4/kqvrF3KvQk8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=YCWdYPw1; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="YCWdYPw1" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5c99be0a4bbso7539072a12.2 for ; Tue, 22 Oct 2024 06:22:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1729603364; x=1730208164; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=m3THIeKT2uotc/kE1QXaEVNl4DypBbo/jMvvgPrzSZk=; b=YCWdYPw1yMkVbE49gXYI68Upltit+KRrz1Wj1JCHW317wkEYLdhvQM06N15iyDKlw9 Lj4Brm+XDRXRMZpFZcfmcVFJSbA/mSMomKvTK1CJAARIEtNf2IGUd4hWJYG7rr+jK6z4 6xYpBF7gmkvyfX1t9/6TDJR5NG8sqfT/zW6cyM8Mo+yUjUI94UXFQlpK8ca8ZXg8c8oE ZIdYpjL82VvpKpGh9zIPQiItr27jRNBnT5D6rLtYDtlyUptFRAhNO0dpOMrfs2gu3e2P wVa1EiIWXkJpTHsOOivSmoT3SaQi2Byf+1RwnX0oywHsMWnj4/CCaPOAm0fKc66GWjvp IiqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729603364; x=1730208164; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m3THIeKT2uotc/kE1QXaEVNl4DypBbo/jMvvgPrzSZk=; b=AtikEuUrPeG8hRR2x/BUj8sOxnQyddzIg+soRVK/XjLvGcoNwoqRk+aXAAYeAQMwFF HCjfhsGO9mgQQu09MwXNmb+B/zeVas8d5pJccbCbzTiJePCam8W8bNLpNrBhz6xXj/ih EWME0q9XO6g4zOTbSnm5+FEJfdXDjBoWl7zhwuEzHbPSPa3HjKNQQn2eXNvTSVUe0dKD mfoMLRU92mqGZSD8crcOgpADntn66gPVqaBylMBe16mLk5EqPO+jdUUUMvPPXBYdIb6O gB4dxMLNKCrrco6hViYKNXkJ9M/cSgJhZKe7fDMYDBnINDOaKuSmbdKXWBmh+qdb0Bis YB3Q== X-Forwarded-Encrypted: i=1; AJvYcCXM1YL62Tkfod9ol1yL5i08Z6HFeFmDheOhTLQ2KmtS+uRor6zYkUYUuBSntlRPABzliBoELAEbofVfIKw=@vger.kernel.org X-Gm-Message-State: AOJu0Yyohd4jf07mgLHVwhvUjlfDGoVHURxwgDBl9GcJKUtptuAeb2X4 KlmNG8F/ncU73TtNqbprgMoNEDZq8m4aKuWax6lFJzWFW/D8eBvNOfiXtujymOQ= X-Google-Smtp-Source: AGHT+IHiEe+S/y+yuilKaM6h9pl72qQWVuFWIIkOv+21yNIanhGh/C/lniO9KLY9WHrHvXoh9hSRrA== X-Received: by 2002:a05:6402:2788:b0:5c8:84a8:5185 with SMTP id 4fb4d7f45d1cf-5cb782b1dc3mr2759875a12.6.1729603363782; Tue, 22 Oct 2024 06:22:43 -0700 (PDT) Received: from [192.168.1.64] (2a02-842a-d52e-6101-6fd0-06c4-5d68-f0a5.rev.sfr.net. [2a02:842a:d52e:6101:6fd0:6c4:5d68:f0a5]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c737c4sm3109496a12.96.2024.10.22.06.22.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2024 06:22:43 -0700 (PDT) From: Julien Stephan Date: Tue, 22 Oct 2024 15:22:38 +0200 Subject: [PATCH v3 3/5] iio: adc: ad7380: add missing supplies Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241022-ad7380-fix-supplies-v3-3-f0cefe1b7fa6@baylibre.com> References: <20241022-ad7380-fix-supplies-v3-0-f0cefe1b7fa6@baylibre.com> In-Reply-To: <20241022-ad7380-fix-supplies-v3-0-f0cefe1b7fa6@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , David Lechner , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Liam Girdwood , Mark Brown , Jonathan Corbet Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Conor Dooley , Jonathan Cameron , linux-doc@vger.kernel.org, Julien Stephan X-Mailer: b4 0.14.2 vcc and vlogic are required but are not retrieved and enabled in the probe. Add them. In order to prepare support for additional parts requiring different supplies, add vcc and vlogic to the platform specific structures Reviewed-by: Nuno Sa Reviewed-by: David Lechner Signed-off-by: Julien Stephan --- drivers/iio/adc/ad7380.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/iio/adc/ad7380.c b/drivers/iio/adc/ad7380.c index e033c734191143a25a490b09c730dbf95f796737..b107d8e97ab36f7aed4685f18e0= f398d63fd1e8d 100644 --- a/drivers/iio/adc/ad7380.c +++ b/drivers/iio/adc/ad7380.c @@ -75,6 +75,7 @@ #define T_CONVERT_NS 190 /* conversion time */ #define T_CONVERT_0_NS 10 /* 1st conversion start time (oversampling) */ #define T_CONVERT_X_NS 500 /* xth conversion start time (oversampling) */ +#define T_POWERUP_US 5000 /* Power up */ =20 struct ad7380_timing_specs { const unsigned int t_csh_ns; /* CS minimum high time */ @@ -86,6 +87,8 @@ struct ad7380_chip_info { unsigned int num_channels; unsigned int num_simult_channels; bool has_mux; + const char * const *supplies; + unsigned int num_supplies; const char * const *vcm_supplies; unsigned int num_vcm_supplies; const unsigned long *available_scan_masks; @@ -243,6 +246,10 @@ DEFINE_AD7380_8_CHANNEL(ad7386_4_channels, 16, 0, u); DEFINE_AD7380_8_CHANNEL(ad7387_4_channels, 14, 0, u); DEFINE_AD7380_8_CHANNEL(ad7388_4_channels, 12, 0, u); =20 +static const char * const ad7380_supplies[] =3D { + "vcc", "vlogic", +}; + static const char * const ad7380_2_channel_vcm_supplies[] =3D { "aina", "ainb", }; @@ -338,6 +345,8 @@ static const struct ad7380_chip_info ad7380_chip_info = =3D { .channels =3D ad7380_channels, .num_channels =3D ARRAY_SIZE(ad7380_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, .timing_specs =3D &ad7380_timing, }; @@ -347,6 +356,8 @@ static const struct ad7380_chip_info ad7381_chip_info = =3D { .channels =3D ad7381_channels, .num_channels =3D ARRAY_SIZE(ad7381_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, .timing_specs =3D &ad7380_timing, }; @@ -356,6 +367,8 @@ static const struct ad7380_chip_info ad7383_chip_info = =3D { .channels =3D ad7383_channels, .num_channels =3D ARRAY_SIZE(ad7383_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_2_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_2_channel_vcm_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, @@ -367,6 +380,8 @@ static const struct ad7380_chip_info ad7384_chip_info = =3D { .channels =3D ad7384_channels, .num_channels =3D ARRAY_SIZE(ad7384_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_2_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_2_channel_vcm_supplies), .available_scan_masks =3D ad7380_2_channel_scan_masks, @@ -378,6 +393,8 @@ static const struct ad7380_chip_info ad7386_chip_info = =3D { .channels =3D ad7386_channels, .num_channels =3D ARRAY_SIZE(ad7386_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x2_channel_scan_masks, .timing_specs =3D &ad7380_timing, @@ -388,6 +405,8 @@ static const struct ad7380_chip_info ad7387_chip_info = =3D { .channels =3D ad7387_channels, .num_channels =3D ARRAY_SIZE(ad7387_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x2_channel_scan_masks, .timing_specs =3D &ad7380_timing, @@ -398,6 +417,8 @@ static const struct ad7380_chip_info ad7388_chip_info = =3D { .channels =3D ad7388_channels, .num_channels =3D ARRAY_SIZE(ad7388_channels), .num_simult_channels =3D 2, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x2_channel_scan_masks, .timing_specs =3D &ad7380_timing, @@ -408,6 +429,8 @@ static const struct ad7380_chip_info ad7380_4_chip_info= =3D { .channels =3D ad7380_4_channels, .num_channels =3D ARRAY_SIZE(ad7380_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, }; @@ -417,6 +440,8 @@ static const struct ad7380_chip_info ad7381_4_chip_info= =3D { .channels =3D ad7381_4_channels, .num_channels =3D ARRAY_SIZE(ad7381_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, }; @@ -426,6 +451,8 @@ static const struct ad7380_chip_info ad7383_4_chip_info= =3D { .channels =3D ad7383_4_channels, .num_channels =3D ARRAY_SIZE(ad7383_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_4_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_4_channel_vcm_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, @@ -437,6 +464,8 @@ static const struct ad7380_chip_info ad7384_4_chip_info= =3D { .channels =3D ad7384_4_channels, .num_channels =3D ARRAY_SIZE(ad7384_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .vcm_supplies =3D ad7380_4_channel_vcm_supplies, .num_vcm_supplies =3D ARRAY_SIZE(ad7380_4_channel_vcm_supplies), .available_scan_masks =3D ad7380_4_channel_scan_masks, @@ -448,6 +477,8 @@ static const struct ad7380_chip_info ad7386_4_chip_info= =3D { .channels =3D ad7386_4_channels, .num_channels =3D ARRAY_SIZE(ad7386_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, @@ -458,6 +489,8 @@ static const struct ad7380_chip_info ad7387_4_chip_info= =3D { .channels =3D ad7387_4_channels, .num_channels =3D ARRAY_SIZE(ad7387_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, @@ -468,6 +501,8 @@ static const struct ad7380_chip_info ad7388_4_chip_info= =3D { .channels =3D ad7388_4_channels, .num_channels =3D ARRAY_SIZE(ad7388_4_channels), .num_simult_channels =3D 4, + .supplies =3D ad7380_supplies, + .num_supplies =3D ARRAY_SIZE(ad7380_supplies), .has_mux =3D true, .available_scan_masks =3D ad7380_2x4_channel_scan_masks, .timing_specs =3D &ad7380_4_timing, @@ -1004,6 +1039,14 @@ static int ad7380_probe(struct spi_device *spi) if (!st->chip_info) return dev_err_probe(&spi->dev, -EINVAL, "missing match data\n"); =20 + ret =3D devm_regulator_bulk_get_enable(&spi->dev, st->chip_info->num_supp= lies, + st->chip_info->supplies); + + if (ret) + return dev_err_probe(&spi->dev, ret, + "Failed to enable power supplies\n"); + fsleep(T_POWERUP_US); + /* * If there is no REFIO supply, then it means that we are using * the internal 2.5V reference, otherwise REFIO is reference voltage. --=20 2.47.0