* [PATCH 1/2] media: i2c: ov5640: Check for devm_gpiod_get_optional() error
@ 2019-06-28 11:00 Fabio Estevam
2019-06-28 11:00 ` [PATCH 2/2] media: i2c: ov5640: Fix the order for enabling regulators Fabio Estevam
0 siblings, 1 reply; 2+ messages in thread
From: Fabio Estevam @ 2019-06-28 11:00 UTC (permalink / raw)
To: sakari.ailus; +Cc: slongerbeam, jacopo, linux-media, mchehab, Fabio Estevam
The power down and reset GPIO are optional, but the return value
from devm_gpiod_get_optional() needs to be checked and propagated
in the case of error, so that probe deferral can work.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
drivers/media/i2c/ov5640.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index 759d60c6d630..afe7920557a8 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -3022,9 +3022,14 @@ static int ov5640_probe(struct i2c_client *client,
/* request optional power down pin */
sensor->pwdn_gpio = devm_gpiod_get_optional(dev, "powerdown",
GPIOD_OUT_HIGH);
+ if (IS_ERR(sensor->pwdn_gpio))
+ return PTR_ERR(sensor->pwdn_gpio);
+
/* request optional reset pin */
sensor->reset_gpio = devm_gpiod_get_optional(dev, "reset",
GPIOD_OUT_HIGH);
+ if (IS_ERR(sensor->reset_gpio))
+ return PTR_ERR(sensor->reset_gpio);
v4l2_i2c_subdev_init(&sensor->sd, client, &ov5640_subdev_ops);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] media: i2c: ov5640: Fix the order for enabling regulators
2019-06-28 11:00 [PATCH 1/2] media: i2c: ov5640: Check for devm_gpiod_get_optional() error Fabio Estevam
@ 2019-06-28 11:00 ` Fabio Estevam
0 siblings, 0 replies; 2+ messages in thread
From: Fabio Estevam @ 2019-06-28 11:00 UTC (permalink / raw)
To: sakari.ailus; +Cc: slongerbeam, jacopo, linux-media, mchehab, Fabio Estevam
According to the OV5640 datasheet the following sequence needs to be
followed when powering the OV5640 supplies:
- DOVDD
- AVDD
- DVDD
So follow this order inside the ov5640_supply_name[] array, so that
the regulator_bulk() functions can enable the regulator in the
correct sequence.
Signed-off-by: Fabio Estevam <festevam@gmail.com>
---
drivers/media/i2c/ov5640.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index afe7920557a8..4cd246812ae2 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -158,8 +158,8 @@ static const int ov5640_framerates[] = {
/* regulator supplies */
static const char * const ov5640_supply_name[] = {
"DOVDD", /* Digital I/O (1.8V) supply */
- "DVDD", /* Digital Core (1.5V) supply */
"AVDD", /* Analog (2.8V) supply */
+ "DVDD", /* Digital Core (1.5V) supply */
};
#define OV5640_NUM_SUPPLIES ARRAY_SIZE(ov5640_supply_name)
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-28 11:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28 11:00 [PATCH 1/2] media: i2c: ov5640: Check for devm_gpiod_get_optional() error Fabio Estevam
2019-06-28 11:00 ` [PATCH 2/2] media: i2c: ov5640: Fix the order for enabling regulators Fabio Estevam
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.