Loading Documentation/devicetree/bindings/arm/msm/adv7481.txt +29 −4 Original line number Diff line number Diff line Loading @@ -8,16 +8,41 @@ The devicetree representation of the VIDEO_ADV7481 block should be: Required properties - compatible: "qcom,adv7481" - qcom,slave-addr: The i2c slave address of adv7481 driver. - reg: The i2c slave address of adv7481 device. - qcom,cci-master: The i2c master id to be used for adv7481 driver. - gpios: The GPIOs required to be configured for the driver. It should be in the order I2C data line, i2c clock line, reset line, interrupt 1, interrupt 2 and interrupt 3. - cam_vdig-supply: Should contain regulator to be used for the digital vdd. - cam_vio-supply: Should contain regulator to be used for the IO vdd. - cam_vana-supply: Should contain regulator from which analog voltage is supplied. - qcom,cam-vreg-name: Should specify array of regulator names required for the device. - qcom,cam-vreg-min-voltage: Should specify array of minimum voltage level in uV for the regulators specified in the property "qcom,cam-vreg-name". - qcom,cam-vreg-max-voltage: Should specify array of maximum voltage level in uV for the regulators specified in the property "qcom,cam-vreg-name". - qcom,cam-vreg-op-mode: Should specify array of current level in uA for the regulators specified in the property "qcom,cam-vreg-name". Example: qcom,adv7481@0 { qcom,adv7481@70 { compatible = "qcom,adv7481"; reg = <0x70 0xff>; cam_vdig-supply = <&vph_pwr_vreg>; /* Cameras powered by PMIC: */ cam_vio-supply = <&pm8994_lvs1>; cam_vana-supply = <&pm8994_l17>; /* Self-powered cameras: */ qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana"; qcom,cam-vreg-min-voltage = <1300000 0 2500000>; qcom,cam-vreg-max-voltage = <1300000 0 2500000>; qcom,cam-vreg-op-mode = <105000 0 80000>; qcom,cci-master = <0>; qcom,slave-addr = <0x70>; gpios = <&tlmm 17 0>, /* I2C SDA */ Loading arch/arm/boot/dts/qcom/apq8096-auto-dragonboard.dtsi +40 −14 Original line number Diff line number Diff line Loading @@ -701,6 +701,28 @@ qcom,user-type = <1>; /* user type */ }; }; qcom,adv7481@70 { compatible = "qcom,adv7481"; reg = <0x70 0xff>; cam_vdig-supply = <&vph_pwr_vreg>; /* Cameras powered by PMIC: */ cam_vio-supply = <&pm8994_lvs1>; cam_vana-supply = <&pm8994_l17>; /* Self-powered cameras: */ qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana"; qcom,cam-vreg-min-voltage = <1300000 0 2500000>; qcom,cam-vreg-max-voltage = <1300000 0 2500000>; qcom,cam-vreg-op-mode = <105000 0 80000>; qcom,cci-master = <0>; gpios = <&tlmm 17 0>, /* I2C SDA */ <&tlmm 18 0>, /* I2C SCL */ <&pm8994_gpios 4 0>, /* RST */ <&pm8994_gpios 5 0>, /* INT1 */ <&pm8994_gpios 6 0>, /* INT2 */ <&pm8994_gpios 7 0>; /* INT3 */ }; }; &spmi_bus { Loading @@ -722,28 +744,32 @@ status = "okay"; }; gpio@c300 { /* GPIO 4 - BL1_PWM */ gpio@c300 { /* GPIO 4 - adv7481 RST */ qcom,mode = <1>; qcom,pull = <1>; qcom,pull = <0>; qcom,vin-sel = <2>; qcom,src-sel = <4>; qcom,src-sel = <0>; status = "okay"; }; gpio@c400 { /* GPIO 5 - BL0_PWM */ qcom,mode = <1>; /* DIGITAL OUT */ qcom,pull = <1>; /* PULL DOWN */ qcom,vin-sel = <2>; /* 1.8 */ qcom,src-sel = <7>; /* LPG4 */ qcom,master-en = <1>; /* Enable GPIO */ gpio@c400 { /* GPIO 5 - adv7481 INT1 */ qcom,mode = <0>; qcom,vin-sel = <2>; qcom,src-sel = <0>; status = "okay"; }; gpio@c600 { /* GPIO 7 */ qcom,mode = <1>; /* DIGITAL OUT */ qcom,vin-sel = <2>; /* 1.8 */ qcom,src-sel = <0>; /* GPIO */ qcom,master-en = <1>; /* ENABLE GPIO */ gpio@c500 { /* GPIO 6 - adv7481 INT2*/ qcom,mode = <0>; qcom,vin-sel = <2>; qcom,src-sel = <0>; status = "okay"; }; gpio@c600 { /* GPIO 7 - adv7481 INT3*/ qcom,mode = <0>; qcom,vin-sel = <2>; qcom,src-sel = <0>; status = "okay"; }; Loading drivers/media/i2c/adv7481.c +38 −7 Original line number Diff line number Diff line Loading @@ -79,6 +79,11 @@ enum adv7481_gpio_t { struct adv7481_state { struct device *dev; /* VREG */ struct camera_vreg_t *cci_vreg; struct regulator *cci_reg_ptr[MAX_REGULATOR]; int32_t regulator_count; /* I2C */ struct msm_camera_i2c_client i2c_client; u32 cci_master; Loading Loading @@ -2043,11 +2048,13 @@ err_cci_init: return ret; } static int adv7481_parse_dt(struct adv7481_state *state) static int adv7481_parse_dt(struct platform_device *pdev, struct adv7481_state *state) { struct device_node *np = state->dev->of_node; uint32_t i = 0; int gpio_count = 0; struct resource *adv_addr_res = NULL; int ret = 0; /* config CCI */ Loading @@ -2059,13 +2066,12 @@ static int adv7481_parse_dt(struct adv7481_state *state) goto exit; } pr_debug("%s: cci_master: 0x%x\n", __func__, state->cci_master); ret = of_property_read_u32(np, "qcom,slave-addr", &state->i2c_slave_addr); if (ret < 0) { pr_err("%s: failed to read slave-addr. ret %d\n", __func__, ret); adv_addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!adv_addr_res) { pr_err("%s: failed to read adv7481 resource.\n", __func__); goto exit; } state->i2c_slave_addr = adv_addr_res->start; pr_debug("%s: i2c_slave_addr: 0x%x\n", __func__, state->i2c_slave_addr); state->i2c_io_addr = (uint8_t)state->i2c_slave_addr; Loading Loading @@ -2123,7 +2129,7 @@ static int adv7481_probe(struct platform_device *pdev) state->dev = &pdev->dev; mutex_init(&state->mutex); ret = adv7481_parse_dt(state); ret = adv7481_parse_dt(pdev, state); if (ret < 0) { pr_err("Error parsing dt tree\n"); goto err_mem_free; Loading @@ -2135,6 +2141,31 @@ static int adv7481_probe(struct platform_device *pdev) goto err_mem_free; } /* config VREG */ ret = msm_camera_get_dt_vreg_data(pdev->dev.of_node, &(state->cci_vreg), &(state->regulator_count)); if (ret < 0) { pr_err("%s:cci get_dt_vreg failed\n", __func__); goto err_mem_free; } ret = msm_camera_config_vreg(&pdev->dev, state->cci_vreg, state->regulator_count, NULL, 0, &state->cci_reg_ptr[0], 1); if (ret < 0) { pr_err("%s:cci config_vreg failed\n", __func__); goto err_mem_free; } ret = msm_camera_enable_vreg(&pdev->dev, state->cci_vreg, state->regulator_count, NULL, 0, &state->cci_reg_ptr[0], 1); if (ret < 0) { pr_err("%s:cci enable_vreg failed\n", __func__); goto err_mem_free; } pr_debug("%s - VREG Initialized...\n", __func__); /* Configure and Register V4L2 Sub-device */ sd = &state->sd; v4l2_subdev_init(sd, &adv7481_ops); Loading Loading
Documentation/devicetree/bindings/arm/msm/adv7481.txt +29 −4 Original line number Diff line number Diff line Loading @@ -8,16 +8,41 @@ The devicetree representation of the VIDEO_ADV7481 block should be: Required properties - compatible: "qcom,adv7481" - qcom,slave-addr: The i2c slave address of adv7481 driver. - reg: The i2c slave address of adv7481 device. - qcom,cci-master: The i2c master id to be used for adv7481 driver. - gpios: The GPIOs required to be configured for the driver. It should be in the order I2C data line, i2c clock line, reset line, interrupt 1, interrupt 2 and interrupt 3. - cam_vdig-supply: Should contain regulator to be used for the digital vdd. - cam_vio-supply: Should contain regulator to be used for the IO vdd. - cam_vana-supply: Should contain regulator from which analog voltage is supplied. - qcom,cam-vreg-name: Should specify array of regulator names required for the device. - qcom,cam-vreg-min-voltage: Should specify array of minimum voltage level in uV for the regulators specified in the property "qcom,cam-vreg-name". - qcom,cam-vreg-max-voltage: Should specify array of maximum voltage level in uV for the regulators specified in the property "qcom,cam-vreg-name". - qcom,cam-vreg-op-mode: Should specify array of current level in uA for the regulators specified in the property "qcom,cam-vreg-name". Example: qcom,adv7481@0 { qcom,adv7481@70 { compatible = "qcom,adv7481"; reg = <0x70 0xff>; cam_vdig-supply = <&vph_pwr_vreg>; /* Cameras powered by PMIC: */ cam_vio-supply = <&pm8994_lvs1>; cam_vana-supply = <&pm8994_l17>; /* Self-powered cameras: */ qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana"; qcom,cam-vreg-min-voltage = <1300000 0 2500000>; qcom,cam-vreg-max-voltage = <1300000 0 2500000>; qcom,cam-vreg-op-mode = <105000 0 80000>; qcom,cci-master = <0>; qcom,slave-addr = <0x70>; gpios = <&tlmm 17 0>, /* I2C SDA */ Loading
arch/arm/boot/dts/qcom/apq8096-auto-dragonboard.dtsi +40 −14 Original line number Diff line number Diff line Loading @@ -701,6 +701,28 @@ qcom,user-type = <1>; /* user type */ }; }; qcom,adv7481@70 { compatible = "qcom,adv7481"; reg = <0x70 0xff>; cam_vdig-supply = <&vph_pwr_vreg>; /* Cameras powered by PMIC: */ cam_vio-supply = <&pm8994_lvs1>; cam_vana-supply = <&pm8994_l17>; /* Self-powered cameras: */ qcom,cam-vreg-name = "cam_vdig", "cam_vio", "cam_vana"; qcom,cam-vreg-min-voltage = <1300000 0 2500000>; qcom,cam-vreg-max-voltage = <1300000 0 2500000>; qcom,cam-vreg-op-mode = <105000 0 80000>; qcom,cci-master = <0>; gpios = <&tlmm 17 0>, /* I2C SDA */ <&tlmm 18 0>, /* I2C SCL */ <&pm8994_gpios 4 0>, /* RST */ <&pm8994_gpios 5 0>, /* INT1 */ <&pm8994_gpios 6 0>, /* INT2 */ <&pm8994_gpios 7 0>; /* INT3 */ }; }; &spmi_bus { Loading @@ -722,28 +744,32 @@ status = "okay"; }; gpio@c300 { /* GPIO 4 - BL1_PWM */ gpio@c300 { /* GPIO 4 - adv7481 RST */ qcom,mode = <1>; qcom,pull = <1>; qcom,pull = <0>; qcom,vin-sel = <2>; qcom,src-sel = <4>; qcom,src-sel = <0>; status = "okay"; }; gpio@c400 { /* GPIO 5 - BL0_PWM */ qcom,mode = <1>; /* DIGITAL OUT */ qcom,pull = <1>; /* PULL DOWN */ qcom,vin-sel = <2>; /* 1.8 */ qcom,src-sel = <7>; /* LPG4 */ qcom,master-en = <1>; /* Enable GPIO */ gpio@c400 { /* GPIO 5 - adv7481 INT1 */ qcom,mode = <0>; qcom,vin-sel = <2>; qcom,src-sel = <0>; status = "okay"; }; gpio@c600 { /* GPIO 7 */ qcom,mode = <1>; /* DIGITAL OUT */ qcom,vin-sel = <2>; /* 1.8 */ qcom,src-sel = <0>; /* GPIO */ qcom,master-en = <1>; /* ENABLE GPIO */ gpio@c500 { /* GPIO 6 - adv7481 INT2*/ qcom,mode = <0>; qcom,vin-sel = <2>; qcom,src-sel = <0>; status = "okay"; }; gpio@c600 { /* GPIO 7 - adv7481 INT3*/ qcom,mode = <0>; qcom,vin-sel = <2>; qcom,src-sel = <0>; status = "okay"; }; Loading
drivers/media/i2c/adv7481.c +38 −7 Original line number Diff line number Diff line Loading @@ -79,6 +79,11 @@ enum adv7481_gpio_t { struct adv7481_state { struct device *dev; /* VREG */ struct camera_vreg_t *cci_vreg; struct regulator *cci_reg_ptr[MAX_REGULATOR]; int32_t regulator_count; /* I2C */ struct msm_camera_i2c_client i2c_client; u32 cci_master; Loading Loading @@ -2043,11 +2048,13 @@ err_cci_init: return ret; } static int adv7481_parse_dt(struct adv7481_state *state) static int adv7481_parse_dt(struct platform_device *pdev, struct adv7481_state *state) { struct device_node *np = state->dev->of_node; uint32_t i = 0; int gpio_count = 0; struct resource *adv_addr_res = NULL; int ret = 0; /* config CCI */ Loading @@ -2059,13 +2066,12 @@ static int adv7481_parse_dt(struct adv7481_state *state) goto exit; } pr_debug("%s: cci_master: 0x%x\n", __func__, state->cci_master); ret = of_property_read_u32(np, "qcom,slave-addr", &state->i2c_slave_addr); if (ret < 0) { pr_err("%s: failed to read slave-addr. ret %d\n", __func__, ret); adv_addr_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!adv_addr_res) { pr_err("%s: failed to read adv7481 resource.\n", __func__); goto exit; } state->i2c_slave_addr = adv_addr_res->start; pr_debug("%s: i2c_slave_addr: 0x%x\n", __func__, state->i2c_slave_addr); state->i2c_io_addr = (uint8_t)state->i2c_slave_addr; Loading Loading @@ -2123,7 +2129,7 @@ static int adv7481_probe(struct platform_device *pdev) state->dev = &pdev->dev; mutex_init(&state->mutex); ret = adv7481_parse_dt(state); ret = adv7481_parse_dt(pdev, state); if (ret < 0) { pr_err("Error parsing dt tree\n"); goto err_mem_free; Loading @@ -2135,6 +2141,31 @@ static int adv7481_probe(struct platform_device *pdev) goto err_mem_free; } /* config VREG */ ret = msm_camera_get_dt_vreg_data(pdev->dev.of_node, &(state->cci_vreg), &(state->regulator_count)); if (ret < 0) { pr_err("%s:cci get_dt_vreg failed\n", __func__); goto err_mem_free; } ret = msm_camera_config_vreg(&pdev->dev, state->cci_vreg, state->regulator_count, NULL, 0, &state->cci_reg_ptr[0], 1); if (ret < 0) { pr_err("%s:cci config_vreg failed\n", __func__); goto err_mem_free; } ret = msm_camera_enable_vreg(&pdev->dev, state->cci_vreg, state->regulator_count, NULL, 0, &state->cci_reg_ptr[0], 1); if (ret < 0) { pr_err("%s:cci enable_vreg failed\n", __func__); goto err_mem_free; } pr_debug("%s - VREG Initialized...\n", __func__); /* Configure and Register V4L2 Sub-device */ sd = &state->sd; v4l2_subdev_init(sd, &adv7481_ops); Loading