From nobody Mon Feb 9 12:15:39 2026 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D15FD1DE4F9 for ; Tue, 28 Jan 2025 17:31:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738085516; cv=none; b=H94Du3cct2quEKccOQuS7Ul/u9ArxvEPKka0mKxqdJL30SY3dPPmwpajiGWOo4DC4lTtkPA/h9+f+jQOoVxkBvJHlIHmfUoiPGkg/f0GLn7R6FGhHtm12NZOmhPknv/OdPU95VFI47rmDnr6gvL7Xj5mxaAd/kXHQY0Yga290cc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738085516; c=relaxed/simple; bh=PyR/S0tgIuQRKHj3akh42/2D1m+YvBfkaDyKrG7X7/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S6p39BXAttaA7esj9XDHJpMOxUVxU4PISOnchxGGAHGOr9wGNQbu4HgTSsN0h/AMoRjw15iUz74una2neR9Tw9X2p6Zm91M6YO5khxV4A7KyWR1Jzcsy5xvGkbqDAuS4mMFFhvlAnQwmj0to05MJUzJHjtEMad6VinswPD5KNWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=Hue4+izK; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Hue4+izK" Received: from isaac-ThinkPad-T16-Gen-2.lan (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 491511054; Tue, 28 Jan 2025 18:30:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1738085444; bh=PyR/S0tgIuQRKHj3akh42/2D1m+YvBfkaDyKrG7X7/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hue4+izKT71eoteMz2pjxvJSMULfvi2sBoZcExQHNgYywxPas5KEoeLVkjsH+Q8YC hmPgoL0y1WYU6BU7FXJDGU8GQ8uzUMfJDh1B9XVA7wcfZJs3cyD7J5uqPs+eaE955s 8iGCd1j1Fv1C7ttN4K6zzdegFuqreCnPquRyWnjA= From: Isaac Scott To: michael.hennerich@analog.com Cc: lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org, Isaac Scott Subject: [PATCH v2 3/3] regulator: ad5398: Add device tree support Date: Tue, 28 Jan 2025 17:31:43 +0000 Message-ID: <20250128173143.959600-4-isaac.scott@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250128173143.959600-1-isaac.scott@ideasonboard.com> References: <20250128173143.959600-1-isaac.scott@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Previously, the ad5398 driver used only platform_data, which is deprecated in favour of device tree. This caused the AD5398 to fail to probe as it could not load its init_data. If the AD5398 has a device tree node, pull the init_data from there using of_get_regulator_init_data. Signed-off-by: Isaac Scott --- drivers/regulator/ad5398.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index 0c60ecd1f0f2..619c999946f3 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c @@ -14,6 +14,7 @@ #include #include #include +#include =20 #define AD5398_SW_POWER_DOWN BIT(16) =20 @@ -220,15 +221,20 @@ static int ad5398_probe(struct i2c_client *client) const struct ad5398_current_data_format *df =3D (struct ad5398_current_data_format *)id->driver_data; =20 - if (!init_data) - return -EINVAL; - chip =3D devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; =20 config.dev =3D &client->dev; + if (client->dev.of_node) + init_data =3D of_get_regulator_init_data(&client->dev, + client->dev.of_node, + &ad5398_reg); + if (!init_data) + return -EINVAL; + config.init_data =3D init_data; + config.of_node =3D client->dev.of_node; config.driver_data =3D chip; =20 chip->client =3D client; --=20 2.43.0