From: Sakari Ailus <sakari.ailus@iki.fi>
To: Yassine Oudjana <yassine.oudjana@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Tianshu Qiu <tian.shu.qiu@intel.com>,
Bingbu Cao <bingbu.cao@intel.com>,
Yassine Oudjana <y.oudjana@protonmail.com>,
Jacopo Mondi <jacopo@jmondi.org>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] media: i2c: ak7375: Add regulator management
Date: Sat, 23 Jul 2022 14:33:46 +0300 [thread overview]
Message-ID: <Ytvcmpa3aPkS9NYK@valkosipuli.retiisi.eu> (raw)
In-Reply-To: <20220711144039.232196-4-y.oudjana@protonmail.com>
Hi Yassine,
Thanks for the patch.
On Mon, Jul 11, 2022 at 06:40:39PM +0400, Yassine Oudjana wrote:
> From: Yassine Oudjana <y.oudjana@protonmail.com>
>
> Make the driver get needed regulators on probe and enable/disable
> them on runtime PM callbacks.
>
> Signed-off-by: Yassine Oudjana <y.oudjana@protonmail.com>
> ---
> Changes since v1:
> - Reorganize variable declaration
> - Change the power-on delay range to 3000-3500 microseconds.
>
> drivers/media/i2c/ak7375.c | 39 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/drivers/media/i2c/ak7375.c b/drivers/media/i2c/ak7375.c
> index 40b1a4aa846c..c2b2542a0056 100644
> --- a/drivers/media/i2c/ak7375.c
> +++ b/drivers/media/i2c/ak7375.c
> @@ -6,6 +6,7 @@
> #include <linux/i2c.h>
> #include <linux/module.h>
> #include <linux/pm_runtime.h>
> +#include <linux/regulator/consumer.h>
> #include <media/v4l2-ctrls.h>
> #include <media/v4l2-device.h>
>
> @@ -23,17 +24,32 @@
> */
> #define AK7375_CTRL_STEPS 64
> #define AK7375_CTRL_DELAY_US 1000
> +/*
> + * The vcm takes around 3 ms to power on and start taking
> + * I2C messages. This value was found experimentally due to
> + * lack of documentation.
> + */
> +#define AK7375_POWER_DELAY_US 3000
>
> #define AK7375_REG_POSITION 0x0
> #define AK7375_REG_CONT 0x2
> #define AK7375_MODE_ACTIVE 0x0
> #define AK7375_MODE_STANDBY 0x40
>
> +static const char * const ak7375_supply_names[] = {
> + "vdd",
> + "vio",
> +};
> +
> +#define AK7375_NUM_SUPPLIES ARRAY_SIZE(ak7375_supply_names)
Please drop this, and use ARRAY_SIZE() directly.
> +
> /* ak7375 device structure */
> struct ak7375_device {
> struct v4l2_ctrl_handler ctrls_vcm;
> struct v4l2_subdev sd;
> struct v4l2_ctrl *focus;
> + struct regulator_bulk_data supplies[AK7375_NUM_SUPPLIES];
> +
> /* active or standby mode */
> bool active;
> };
> @@ -133,12 +149,24 @@ static int ak7375_probe(struct i2c_client *client)
> {
> struct ak7375_device *ak7375_dev;
> int ret;
> + int i;
unsigned int, please.
--
Kind regards,
Sakari Ailus
next prev parent reply other threads:[~2022-07-23 11:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 14:40 [PATCH v2 0/3] " Yassine Oudjana
2022-07-11 14:40 ` [PATCH v2 1/3] media: dt-bindings: ak7375: Convert to DT schema Yassine Oudjana
2022-07-12 8:17 ` Krzysztof Kozlowski
2022-11-28 6:44 ` Umang Jain
2022-07-11 14:40 ` [PATCH v2 2/3] media: dt-bindings: ak7375: Add supplies Yassine Oudjana
2022-11-28 6:45 ` Umang Jain
2022-07-11 14:40 ` [PATCH v2 3/3] media: i2c: ak7375: Add regulator management Yassine Oudjana
2022-07-11 17:31 ` Jacopo Mondi
2022-07-14 13:56 ` Yassine Oudjana
2022-07-14 15:56 ` Jacopo Mondi
2022-07-20 7:36 ` Christophe JAILLET
2022-07-13 7:39 ` Jacopo Mondi
2022-07-14 14:06 ` Yassine Oudjana
2022-07-14 15:58 ` Jacopo Mondi
2022-07-20 2:58 ` Lee Jackson
2022-07-23 11:33 ` Sakari Ailus [this message]
2022-11-28 6:47 ` Umang Jain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Ytvcmpa3aPkS9NYK@valkosipuli.retiisi.eu \
--to=sakari.ailus@iki.fi \
--cc=bingbu.cao@intel.com \
--cc=devicetree@vger.kernel.org \
--cc=jacopo@jmondi.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=robh+dt@kernel.org \
--cc=tian.shu.qiu@intel.com \
--cc=y.oudjana@protonmail.com \
--cc=yassine.oudjana@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®