summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorChanghuang Liang <changhuang.liang@starfivetech.com>2023-05-04 05:10:54 +0300
committerChanghuang Liang <changhuang.liang@starfivetech.com>2023-05-04 05:10:54 +0300
commitfca13a6c06ade59788fd2d1c10819199f927b3b9 (patch)
tree45569920c09ce3a894f450e51624bdfc938af258 /drivers/media
parent08c8820d7e2faa7fc516e5f3f27fc08d21c8193c (diff)
downloadlinux-fca13a6c06ade59788fd2d1c10819199f927b3b9.tar.xz
Revert "v4l2: imx219 use pinctrl"
This reverts commit 8d7c702d7bc0fef9ee5882db660390801bbccaa7. use gpio10 to configure imx219 reset.
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/starfive/v4l2_driver/imx219_mipi.c70
1 files changed, 4 insertions, 66 deletions
diff --git a/drivers/media/platform/starfive/v4l2_driver/imx219_mipi.c b/drivers/media/platform/starfive/v4l2_driver/imx219_mipi.c
index ceac3ba563a6..28fb287e326c 100644
--- a/drivers/media/platform/starfive/v4l2_driver/imx219_mipi.c
+++ b/drivers/media/platform/starfive/v4l2_driver/imx219_mipi.c
@@ -26,7 +26,6 @@
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <media/v4l2-mediabus.h>
-#include <linux/pinctrl/pinctrl.h>
#include <asm/unaligned.h>
#define IMX219_REG_VALUE_08BIT 1
@@ -471,13 +470,6 @@ static const struct imx219_mode supported_modes[] = {
},
};
-struct sensor_pinctrl_info {
- struct pinctrl *pinctrl;
- struct pinctrl_state *power_up;
- struct pinctrl_state *power_down;
- bool use_pinctrl;
-};
-
struct imx219 {
struct v4l2_subdev sd;
struct media_pad pad;
@@ -513,38 +505,8 @@ struct imx219 {
/* Streaming on/off */
int streaming;
-
- struct sensor_pinctrl_info imx219_pctrl;
};
-int imx219_sensor_pinctrl_init(
- struct sensor_pinctrl_info *sensor_pctrl, struct device *dev)
-{
- sensor_pctrl->pinctrl = devm_pinctrl_get(dev);
- if (IS_ERR_OR_NULL(sensor_pctrl->pinctrl)) {
- pr_err("Getting pinctrl handle failed\n");
- return -EINVAL;
- }
-
- sensor_pctrl->power_up
- = pinctrl_lookup_state(sensor_pctrl->pinctrl, "power_up");
- if (IS_ERR_OR_NULL(sensor_pctrl->power_up)) {
- pr_err("Failed to get the power_up pinctrl handle\n");
- return -EINVAL;
- }
-
- sensor_pctrl->power_down
- = pinctrl_lookup_state(sensor_pctrl->pinctrl, "power_down");
- if (IS_ERR_OR_NULL(sensor_pctrl->power_down)) {
- pr_err("Failed to get the power_down pinctrl handle\n");
- return -EINVAL;
- }
-
- sensor_pctrl->use_pinctrl = true;
-
- return 0;
-}
-
static inline struct imx219 *to_imx219(struct v4l2_subdev *_sd)
{
return container_of(_sd, struct imx219, sd);
@@ -1187,7 +1149,6 @@ static int imx219_power_on(struct device *dev)
{
struct v4l2_subdev *sd = dev_get_drvdata(dev);
struct imx219 *imx219 = to_imx219(sd);
- struct sensor_pinctrl_info *sensor_pctrl = &imx219->imx219_pctrl;
int ret;
ret = regulator_bulk_enable(IMX219_NUM_SUPPLIES, imx219->supplies);
@@ -1203,15 +1164,7 @@ static int imx219_power_on(struct device *dev)
goto reg_off;
}
- if (sensor_pctrl->use_pinctrl) {
- ret = pinctrl_select_state(
- sensor_pctrl->pinctrl,
- sensor_pctrl->power_up);
- if (ret)
- pr_err("cannot set pin to power up\n");
- } else
- gpiod_set_value_cansleep(imx219->reset_gpio, 1);
-
+ gpiod_set_value_cansleep(imx219->reset_gpio, 1);
usleep_range(IMX219_XCLR_MIN_DELAY_US,
IMX219_XCLR_MIN_DELAY_US + IMX219_XCLR_DELAY_RANGE_US);
@@ -1227,18 +1180,8 @@ static int imx219_power_off(struct device *dev)
{
struct v4l2_subdev *sd = dev_get_drvdata(dev);
struct imx219 *imx219 = to_imx219(sd);
- struct sensor_pinctrl_info *sensor_pctrl = &imx219->imx219_pctrl;
- int ret;
-
- if (sensor_pctrl->use_pinctrl) {
- ret = pinctrl_select_state(
- sensor_pctrl->pinctrl,
- sensor_pctrl->power_down);
- if (ret)
- pr_err("cannot set pin to power_down\n");
- } else
- gpiod_set_value_cansleep(imx219->reset_gpio, 0);
+ gpiod_set_value_cansleep(imx219->reset_gpio, 0);
regulator_bulk_disable(IMX219_NUM_SUPPLIES, imx219->supplies);
clk_disable_unprepare(imx219->xclk);
@@ -1512,13 +1455,8 @@ static int imx219_probe(struct i2c_client *client)
return ret;
}
- ret = imx219_sensor_pinctrl_init(&imx219->imx219_pctrl, dev);
- if (ret) {
- pr_err("Can't get pinctrl, use gpio to ctrl\n");
- /* Request optional enable pin */
- imx219->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
- imx219->imx219_pctrl.use_pinctrl = false;
- }
+ /* Request optional enable pin */
+ imx219->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
/*
* The sensor must be powered for imx219_identify_module()