From: "Maíra Canal" <maira.canal@usp.br>
To: linux-media@vger.kernel.org
Cc: a.hajda@samsung.com, mchehab@kernel.org, hverkuil-cisco@xs4all.nl
Subject: [PATCH] s5c73m3: adding gpiod support for the s5c73m3
Date: Tue, 12 Oct 2021 16:46:15 -0300 [thread overview]
Message-ID: <YWXmB3yHDeR9ORN7@fedora> (raw)
Removing old gpiod interface and replacing it for the gpiod consumer
interface.
Signed-off-by: Maíra Canal <maira.canal@usp.br>
---
drivers/media/i2c/s5c73m3/s5c73m3-core.c | 25 +++++++++++++-----------
include/media/i2c/s5c73m3.h | 3 ++-
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index e2b88c5e4f98..0c69a3fc7ebe 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -10,7 +10,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/firmware.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/media.h>
@@ -1349,9 +1349,9 @@ static int s5c73m3_oif_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
static int s5c73m3_gpio_set_value(struct s5c73m3 *priv, int id, u32 val)
{
- if (!gpio_is_valid(priv->gpio[id].gpio))
+ if (!priv->gpio[id].gpio)
return 0;
- gpio_set_value(priv->gpio[id].gpio, !!val);
+ gpiod_set_value(priv->gpio[id].gpio, !!val);
return 1;
}
@@ -1548,20 +1548,24 @@ static int s5c73m3_configure_gpios(struct s5c73m3 *state)
static const char * const gpio_names[] = {
"S5C73M3_STBY", "S5C73M3_RST"
};
+ static const char * const prop_names[] = {
+ "standby", "xshutdown",
+ };
+
struct i2c_client *c = state->i2c_client;
struct s5c73m3_gpio *g = state->gpio;
- int ret, i;
+ int i;
for (i = 0; i < GPIO_NUM; ++i) {
- unsigned int flags = GPIOF_DIR_OUT;
+ unsigned int flags = GPIOD_OUT_LOW;
if (g[i].level)
- flags |= GPIOF_INIT_HIGH;
- ret = devm_gpio_request_one(&c->dev, g[i].gpio, flags,
- gpio_names[i]);
- if (ret) {
+ flags = GPIOD_OUT_HIGH;
+ g[i].gpio = devm_gpiod_get_optional(&c->dev, prop_names[i],
+ flags);
+ if (IS_ERR(g[i].gpio)) {
v4l2_err(c, "failed to request gpio %s\n",
gpio_names[i]);
- return ret;
+ return PTR_ERR(g[i].gpio);
}
}
return 0;
@@ -1586,7 +1590,6 @@ static int s5c73m3_parse_gpios(struct s5c73m3 *state)
prop_names[i]);
return -EINVAL;
}
- state->gpio[i].gpio = ret;
state->gpio[i].level = !(of_flags & OF_GPIO_ACTIVE_LOW);
}
return 0;
diff --git a/include/media/i2c/s5c73m3.h b/include/media/i2c/s5c73m3.h
index a51f1025ba1c..41e2235f0626 100644
--- a/include/media/i2c/s5c73m3.h
+++ b/include/media/i2c/s5c73m3.h
@@ -17,6 +17,7 @@
#ifndef MEDIA_S5C73M3__
#define MEDIA_S5C73M3__
+#include <linux/gpio/consumer.h>
#include <linux/videodev2.h>
#include <media/v4l2-mediabus.h>
@@ -26,7 +27,7 @@
* @level: indicates active state of the @gpio
*/
struct s5c73m3_gpio {
- int gpio;
+ struct gpio_desc *gpio;
int level;
};
--
2.31.1
next reply other threads:[~2021-10-12 19:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 19:46 Maíra Canal [this message]
2021-11-24 11:25 ` [PATCH] s5c73m3: adding gpiod support for the s5c73m3 Hans Verkuil
2021-11-24 13:20 ` Andrzej Hajda
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=YWXmB3yHDeR9ORN7@fedora \
--to=maira.canal@usp.br \
--cc=a.hajda@samsung.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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