From nobody Sun Apr 5 16:27:59 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (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 6402D2475F7; Fri, 3 Apr 2026 00:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775177239; cv=none; b=diLdf/VFQtn8Px3lOu4ObnWHAVdbka3tMEcUiFHpUb7vvKoLitXui+Ex2UZBO5ps+8aknLGS2E4UQPXGJaQFi9q8zLXfH9B5CPsQs9CZ01eJRHf7k0xhm+sutT7859ZE/DTwXV2b9YZbo48m7+KprsrWshf7K5XLMRtyfROoeYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775177239; c=relaxed/simple; bh=LTeQaUWHvsph4joDVjSb9M34kexlgvWpIEuOIo8m45k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pjECrcifRhmu9KtylB/sNh+JELasjPMiGj3s/B+8dgTfH5qKt+zjTFa+q2H6XXfUJHm+E9RgpsDTI2tSCtGwx+d7CS3rneGXn6yIqGZFhdcC34d0mlFI2qnXtKCnyLrkxv+zsroIo35HmQOqE8yBlMeHHqmN/Ecopf6ESWT8yVU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=U48ykSlU; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="U48ykSlU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1775177235; x=1806713235; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LTeQaUWHvsph4joDVjSb9M34kexlgvWpIEuOIo8m45k=; b=U48ykSlUY9aTzo8vPT01Rs/ha45rlTkJmjY9jtbp96OIBckaoAE/LGAx OGMUdL9b+OhBH96C0/R4TGVd0wGMSDo72oB4ZAfrvvGaI8wU23P3PGG3d QygQT+h5VYF47+qbZhssFBm644AY3ZGLiQoKh0SHZrSPneGiNpKlYu6aq fJOXK8rQ/v5g3t9dy7DgxVCFdRHAmSmvuHpkpqHeXCRvArF/Yeiz7WT44 Pkj9vfayXgyROl6BWDqqg1vxeU5W1OfyJZFy9TIw0l0meCG7u9PF7abXz MntkYCAQv2uD2Qwp33ak3/d3TZK+UsttBl0BeyMm2G8vdTC45tyapzaOb g==; X-CSE-ConnectionGUID: 8SCQOLHOR6ezwF061YDvEQ== X-CSE-MsgGUID: cJaAnKP8Sc+VkyXG42WqLw== X-IronPort-AV: E=McAfee;i="6800,10657,11747"; a="75417225" X-IronPort-AV: E=Sophos;i="6.23,156,1770624000"; d="scan'208";a="75417225" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2026 17:47:15 -0700 X-CSE-ConnectionGUID: cwzy6uNBRs6F9CIbi7vQLw== X-CSE-MsgGUID: 8WIzhzOsTSegU3kRNW153g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,156,1770624000"; d="scan'208";a="227371056" Received: from intel-nuc8i7beh.iind.intel.com ([10.223.163.35]) by orviesa007.jf.intel.com with ESMTP; 02 Apr 2026 17:47:12 -0700 From: Arun T To: arun.t@intel.com, johannes.goede@oss.qualcomm.com Cc: sakari.ailus@linux.intel.com, arec.kao@intel.com, ilpo.jarvinen@linux.intel.com, dan.scally@ideasonboard.com, platform-driver-x86@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, mehdi.djait@intel.com Subject: [PATCH v9 2/2] media: ov13b10: Support multiple regulators Date: Fri, 3 Apr 2026 06:10:43 +0530 Message-ID: <20260403004044.4093501-3-arun.t@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260403004044.4093501-1-arun.t@intel.com> References: <20260403004044.4093501-1-arun.t@intel.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" The OV13B10 sensor driver currently handles a single regulator called avdd, however the sensor can be supplied by up to three regulators. Update the driver to handle all of them together using the regulator bulk API. Signed-off-by: Arun T Reviewed-by: Hans de Goede --- drivers/media/i2c/ov13b10.c | 47 ++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/drivers/media/i2c/ov13b10.c b/drivers/media/i2c/ov13b10.c index 5421874732bc..b0d34141a13a 100644 --- a/drivers/media/i2c/ov13b10.c +++ b/drivers/media/i2c/ov13b10.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -699,6 +700,12 @@ static const struct ov13b10_mode supported_2_lanes_mod= es[] =3D { }, }; =20 +static const char * const ov13b10_supply_names[] =3D { + "dovdd", /* Digital I/O power */ + "avdd", /* Analog power */ + "dvdd", /* Digital core power */ +}; + struct ov13b10 { struct device *dev; =20 @@ -708,7 +715,7 @@ struct ov13b10 { struct v4l2_ctrl_handler ctrl_handler; =20 struct clk *img_clk; - struct regulator *avdd; + struct regulator_bulk_data supplies[ARRAY_SIZE(ov13b10_supply_names)]; struct gpio_desc *reset; =20 /* V4L2 Controls */ @@ -1194,9 +1201,8 @@ static int ov13b10_power_off(struct device *dev) struct ov13b10 *ov13b10 =3D to_ov13b10(sd); =20 gpiod_set_value_cansleep(ov13b10->reset, 1); - - if (ov13b10->avdd) - regulator_disable(ov13b10->avdd); + regulator_bulk_disable(ARRAY_SIZE(ov13b10_supply_names), + ov13b10->supplies); =20 clk_disable_unprepare(ov13b10->img_clk); =20 @@ -1214,14 +1220,12 @@ static int ov13b10_power_on(struct device *dev) dev_err(dev, "failed to enable imaging clock: %d", ret); return ret; } - - if (ov13b10->avdd) { - ret =3D regulator_enable(ov13b10->avdd); - if (ret < 0) { - dev_err(dev, "failed to enable avdd: %d", ret); - clk_disable_unprepare(ov13b10->img_clk); - return ret; - } + ret =3D regulator_bulk_enable(ARRAY_SIZE(ov13b10_supply_names), + ov13b10->supplies); + if (ret < 0) { + dev_err(dev, "failed to enable regulators\n"); + clk_disable_unprepare(ov13b10->img_clk); + return ret; } =20 gpiod_set_value_cansleep(ov13b10->reset, 0); @@ -1475,7 +1479,8 @@ static int ov13b10_get_pm_resources(struct ov13b10 *o= v13b) unsigned long freq; int ret; =20 - ov13b->reset =3D devm_gpiod_get_optional(ov13b->dev, "reset", GPIOD_OUT_L= OW); + ov13b->reset =3D devm_gpiod_get_optional(ov13b->dev, "reset", + GPIOD_OUT_LOW); if (IS_ERR(ov13b->reset)) return dev_err_probe(ov13b->dev, PTR_ERR(ov13b->reset), "failed to get reset gpio\n"); @@ -1491,15 +1496,15 @@ static int ov13b10_get_pm_resources(struct ov13b10 = *ov13b) "external clock %lu is not supported\n", freq); =20 - ov13b->avdd =3D devm_regulator_get_optional(ov13b->dev, "avdd"); - if (IS_ERR(ov13b->avdd)) { - ret =3D PTR_ERR(ov13b->avdd); - ov13b->avdd =3D NULL; - if (ret !=3D -ENODEV) - return dev_err_probe(ov13b->dev, ret, - "failed to get avdd regulator\n"); - } + for (unsigned int i =3D 0; i < ARRAY_SIZE(ov13b10_supply_names); i++) + ov13b->supplies[i].supply =3D ov13b10_supply_names[i]; =20 + ret =3D devm_regulator_bulk_get(ov13b->dev, + ARRAY_SIZE(ov13b10_supply_names), + ov13b->supplies); + if (ret) + return dev_err_probe(ov13b->dev, ret, + "failed to get regulators\n"); return 0; } =20 --=20 2.43.0