Toybrick

RV1103 sensor上电 pwdn不能拉高和拉低

wenjie

新手上路

积分
7
楼主
发表于 2024-9-11 18:48:22    查看: 95|回复: 0 | [复制链接]    打印 | 只看该作者
我们在点亮新camera sensor时,配置了avdd dvdd clk;但是pwdn配置时,发现不能正常操作,使用万用表测量pwdn引脚没有电压。
下面是给sensor上电的代码
  1. static int __sc3336_power_on(struct sc3336 *sc3336)
  2. {
  3.         int ret;
  4.         u32 delay_us;
  5.         struct device *dev = &sc3336->client->dev;

  6.         if (!IS_ERR_OR_NULL(sc3336->pins_default)) {
  7.                 ret = pinctrl_select_state(sc3336->pinctrl,
  8.                                            sc3336->pins_default);
  9.                 if (ret < 0)
  10.                         dev_err(dev, "could not set pins\n");
  11.         }
  12.         #if 1
  13.         ret = clk_set_rate(sc3336->xvclk, sc3336->cur_mode->xvclk_freq);
  14.         if (ret < 0)
  15.                 dev_warn(dev, "Failed to set xvclk rate (%dHz)\n", sc3336->cur_mode->xvclk_freq);
  16.         if (clk_get_rate(sc3336->xvclk) != sc3336->cur_mode->xvclk_freq)
  17.                 dev_warn(dev, "xvclk mismatched, modes are based on %dHz\n",
  18.                          sc3336->cur_mode->xvclk_freq);
  19.         ret = clk_prepare_enable(sc3336->xvclk);
  20.         if (ret < 0) {
  21.                 dev_err(dev, "Failed to enable xvclk\n");
  22.                 return ret;
  23.         }
  24.         #endif
  25.         if (sc3336->is_thunderboot)
  26.                 return 0;
  27.         #if 0
  28.         if (!IS_ERR(sc3336->reset_gpio))
  29.                 gpiod_set_value_cansleep(sc3336->reset_gpio, 0);
  30.         #endif
  31.         usleep_range(50, 100);

  32.         ret = regulator_bulk_enable(SC3336_NUM_SUPPLIES, sc3336->supplies);
  33.         if (ret < 0) {
  34.                 dev_err(dev, "Failed to enable regulators\n");
  35.                 goto disable_clk;
  36.         }
  37.         #if 0
  38.         if (!IS_ERR(sc3336->reset_gpio))
  39.                 gpiod_set_value_cansleep(sc3336->reset_gpio, 1);
  40.         #endif
  41.         usleep_range(50, 100);
  42. #if 1
  43.         if (!IS_ERR(sc3336->pwdn_gpio))
  44.         {
  45.                 gpiod_set_value_cansleep(sc3336->pwdn_gpio, 0);
  46.                 printk("WENJIE sc3336->pwdn_gpio set 0\n");
  47.         }
  48. #endif
  49.         if (!IS_ERR(sc3336->reset_gpio))
  50.                 usleep_range(6000, 8000);
  51.         else
  52.                 usleep_range(12000, 16000);
  53. #if 1
  54.         if (!IS_ERR(sc3336->pwdn_gpio))
  55.         {
  56.                 gpiod_set_value_cansleep(sc3336->pwdn_gpio, 1);
  57.                 printk("WENJIE sc3336->pwdn_gpio set 1\n");
  58.         }
  59. #endif
  60.         if (!IS_ERR(sc3336->pwdn_gpio))
  61.         {
  62.                 gpiod_set_value_cansleep(sc3336->pwdn_gpio, 0);
  63.                 printk("WENJIE sc3336->pwdn_gpio set 0\n");
  64.         }
  65.         /* 8192 cycles prior to first SCCB transaction */
  66.         delay_us = sc3336_cal_delay(8192, sc3336);
  67.         usleep_range(delay_us, delay_us * 2);

  68.         return 0;

  69. disable_clk:
  70.         clk_disable_unprepare(sc3336->xvclk);

  71.         return ret;
  72. }
复制代码
帮忙分析一下,应该如何正确的配置pwdn
上电时序图如附件所示,
设备树代码节选如下所示,配置了gpio1_c7为高电平,但是测量不到电压
  1. &i2c4 {

  2. status = "okay";

  3. clock-frequency = <40000>;

  4. pinctrl-names = "default";

  5. pinctrl-0 = <&i2c4m2_xfer>;



  6. sc3336: sc3336@21 {

  7. compatible = "smartsens,sc3336";

  8. status = "okay";

  9. reg = <0x21>;

  10. clocks = <&cru MCLK_REF_MIPI0>;

  11. clock-names = "xvclk";

  12. pwdn-gpios = <&gpio1 RK_PC7 1>;

  13. pinctrl-names = "default";

  14. pinctrl-0 = <&mipi_refclk_out0>;

  15. rockchip,camera-module-index = <0>;

  16. rockchip,camera-module-facing = "back";

  17. rockchip,camera-module-name = "CMK-OT2119-PC1";

  18. rockchip,camera-module-lens-name = "30IRC-F16";

  19. port {

  20. sc3336_out: endpoint {

  21. remote-endpoint = <&csi_dphy_input0>;

  22. data-lanes = <1 2>;

  23. };

  24. };

  25. };};

  26. &pinctrl {spi0 {spi0m0_clk: spi0m0-clk {rockchip,pins = <1 RK_PC1 4 &pcfg_pull_none>;};spi0m0_mosi: spi0m0-mosi {rockchip,pins = <1 RK_PC2 6 &pcfg_pull_none>;};spi0m0_miso: spi0m0-miso {rockchip,pins = <1 RK_PC3 6 &pcfg_pull_none>;};spi0m0_cs0: spi0m0-cs0 {rockchip,pins = <1 RK_PC0 4 &pcfg_pull_none>;};};

  27.     gpio1-pc7 {        gpio1_pc7:gpio1-pc7 {            rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;    };};};





复制代码


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表