Revert "v4l2: imx219 use pinctrl"
authorJianlong Huang <jianlong.huang@starfivetech.com>
Fri, 19 Aug 2022 02:22:44 +0000 (10:22 +0800)
committerJianlong Huang <jianlong.huang@starfivetech.com>
Thu, 3 Nov 2022 09:23:27 +0000 (17:23 +0800)
This patch just for evb

This reverts commit 8d7c702d7bc0fef9ee5882db660390801bbccaa7.

arch/riscv/boot/dts/starfive/jh7110-common.dtsi
arch/riscv/boot/dts/starfive/jh7110-evb-pinctrl.dtsi
drivers/media/platform/starfive/v4l2_driver/imx219_mipi.c

index c482d40..933f000 100644 (file)
                reg = <0x10>;
                clocks = <&clk_ext_camera>;
                clock-names = "xclk";
-               //reset-gpio = <&gpio 10 0>;
+               //reset-gpio = <&gpio 18 0>;
                //DOVDD-supply = <&v2v8>;
-               pinctrl-names = "default", "power_up", "power_down";
-               pinctrl-0 = <&csi_pins_default>;
-               pinctrl-1 = <&csi_pins_pwup>;
-               pinctrl-2 = <&csi_pins_pwdn>;
                rotation = <0>;
                orientation = <1>; //CAMERA_ORIENTATION_BACK
 
index 507a536..d5be79e 100644 (file)
                };
        };
 
-       csi_pins_default: csi-pins-default {
-               csi-pins-default {
-                       starfive,pins = <PAD_GPIO10>;
-                       starfive,pinmux = <PAD_GPIO10_FUNC_SEL 0>;
-                       starfive,pin-ioconfig = <IO(GPIO_IE(1))>;
-                       starfive,pin-gpio-dout = <GPO_LOW>;
-                       starfive,pin-gpio-doen = <OEN_LOW>;
-               };
-       };
-
-       csi_pins_pwup: csi-pins-pwup {
-               csi-pins-pwup {
-                       starfive,pins = <PAD_GPIO10>;
-                       starfive,pinmux = <PAD_GPIO10_FUNC_SEL 0>;
-                       starfive,pin-ioconfig = <IO(GPIO_IE(1))>;
-                       starfive,pin-gpio-dout = <GPO_HIGH>;
-                       starfive,pin-gpio-doen = <OEN_LOW>;
-               };
-       };
-
-       csi_pins_pwdn: csi-pins-pwdn {
-               csi-pins-pwdn {
-                       starfive,pins = <PAD_GPIO10>;
-                       starfive,pinmux = <PAD_GPIO10_FUNC_SEL 0>;
-                       starfive,pin-ioconfig = <IO(GPIO_IE(1))>;
-                       starfive,pin-gpio-dout = <GPO_LOW>;
-                       starfive,pin-gpio-doen = <OEN_LOW>;
-               };
-       };
-
        mmc0_pins: mmc0-pins {
                 mmc0-pins-rest {
                        starfive,pins = <PAD_GPIO22>;
index 9bc20d1..589c664 100644 (file)
@@ -27,7 +27,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
@@ -472,13 +471,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;
@@ -514,38 +506,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);
@@ -1186,7 +1148,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);
@@ -1202,15 +1163,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);
 
@@ -1226,18 +1179,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);
 
@@ -1511,13 +1454,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()