- static int __sc3336_power_on(struct sc3336 *sc3336)
- {
- int ret;
- u32 delay_us;
- struct device *dev = &sc3336->client->dev;
- if (!IS_ERR_OR_NULL(sc3336->pins_default)) {
- ret = pinctrl_select_state(sc3336->pinctrl,
- sc3336->pins_default);
- if (ret < 0)
- dev_err(dev, "could not set pins\n");
- }
- #if 1
- ret = clk_set_rate(sc3336->xvclk, sc3336->cur_mode->xvclk_freq);
- if (ret < 0)
- dev_warn(dev, "Failed to set xvclk rate (%dHz)\n", sc3336->cur_mode->xvclk_freq);
- if (clk_get_rate(sc3336->xvclk) != sc3336->cur_mode->xvclk_freq)
- dev_warn(dev, "xvclk mismatched, modes are based on %dHz\n",
- sc3336->cur_mode->xvclk_freq);
- ret = clk_prepare_enable(sc3336->xvclk);
- if (ret < 0) {
- dev_err(dev, "Failed to enable xvclk\n");
- return ret;
- }
- #endif
- if (sc3336->is_thunderboot)
- return 0;
- #if 0
- if (!IS_ERR(sc3336->reset_gpio))
- gpiod_set_value_cansleep(sc3336->reset_gpio, 0);
- #endif
- usleep_range(50, 100);
- ret = regulator_bulk_enable(SC3336_NUM_SUPPLIES, sc3336->supplies);
- if (ret < 0) {
- dev_err(dev, "Failed to enable regulators\n");
- goto disable_clk;
- }
- #if 0
- if (!IS_ERR(sc3336->reset_gpio))
- gpiod_set_value_cansleep(sc3336->reset_gpio, 1);
- #endif
- usleep_range(50, 100);
- #if 1
- if (!IS_ERR(sc3336->pwdn_gpio))
- {
- gpiod_set_value_cansleep(sc3336->pwdn_gpio, 0);
- printk("WENJIE sc3336->pwdn_gpio set 0\n");
- }
- #endif
- if (!IS_ERR(sc3336->reset_gpio))
- usleep_range(6000, 8000);
- else
- usleep_range(12000, 16000);
- #if 1
- if (!IS_ERR(sc3336->pwdn_gpio))
- {
- gpiod_set_value_cansleep(sc3336->pwdn_gpio, 1);
- printk("WENJIE sc3336->pwdn_gpio set 1\n");
- }
- #endif
- if (!IS_ERR(sc3336->pwdn_gpio))
- {
- gpiod_set_value_cansleep(sc3336->pwdn_gpio, 0);
- printk("WENJIE sc3336->pwdn_gpio set 0\n");
- }
- /* 8192 cycles prior to first SCCB transaction */
- delay_us = sc3336_cal_delay(8192, sc3336);
- usleep_range(delay_us, delay_us * 2);
- return 0;
- disable_clk:
- clk_disable_unprepare(sc3336->xvclk);
- return ret;
- }
复制代码
帮忙分析一下,应该如何正确的配置pwdn- &i2c4 {
- status = "okay";
- clock-frequency = <40000>;
- pinctrl-names = "default";
- pinctrl-0 = <&i2c4m2_xfer>;
- sc3336: sc3336@21 {
- compatible = "smartsens,sc3336";
- status = "okay";
- reg = <0x21>;
- clocks = <&cru MCLK_REF_MIPI0>;
- clock-names = "xvclk";
- pwdn-gpios = <&gpio1 RK_PC7 1>;
- pinctrl-names = "default";
- pinctrl-0 = <&mipi_refclk_out0>;
- rockchip,camera-module-index = <0>;
- rockchip,camera-module-facing = "back";
- rockchip,camera-module-name = "CMK-OT2119-PC1";
- rockchip,camera-module-lens-name = "30IRC-F16";
- port {
- sc3336_out: endpoint {
- remote-endpoint = <&csi_dphy_input0>;
- data-lanes = <1 2>;
- };
- };
- };};
- &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>;};};
- gpio1-pc7 { gpio1_pc7:gpio1-pc7 { rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>; };};};
复制代码
欢迎光临 Toybrick (https://t.rock-chips.com/) | Powered by Discuz! X3.3 |