Lines Matching full:sensor

735 	/* Sensor */
812 /* Sensor */
1165 /* Sensor */
1294 static int ov8865_read(struct ov8865_sensor *sensor, u16 address, u8 *value) in ov8865_read() argument
1297 struct i2c_client *client = sensor->i2c_client; in ov8865_read()
1317 static int ov8865_write(struct ov8865_sensor *sensor, u16 address, u8 value) in ov8865_write() argument
1320 struct i2c_client *client = sensor->i2c_client; in ov8865_write()
1333 static int ov8865_write_sequence(struct ov8865_sensor *sensor, in ov8865_write_sequence() argument
1341 ret = ov8865_write(sensor, sequence[i].address, in ov8865_write_sequence()
1353 static int ov8865_update_bits(struct ov8865_sensor *sensor, u16 address, in ov8865_update_bits() argument
1359 ret = ov8865_read(sensor, address, &value); in ov8865_update_bits()
1366 return ov8865_write(sensor, address, value); in ov8865_update_bits()
1369 /* Sensor */
1371 static int ov8865_sw_reset(struct ov8865_sensor *sensor) in ov8865_sw_reset() argument
1373 return ov8865_write(sensor, OV8865_SW_RESET_REG, OV8865_SW_RESET_RESET); in ov8865_sw_reset()
1376 static int ov8865_sw_standby(struct ov8865_sensor *sensor, int standby) in ov8865_sw_standby() argument
1383 return ov8865_write(sensor, OV8865_SW_STANDBY_REG, value); in ov8865_sw_standby()
1386 static int ov8865_chip_id_check(struct ov8865_sensor *sensor) in ov8865_chip_id_check() argument
1397 ret = ov8865_read(sensor, regs[i], &value); in ov8865_chip_id_check()
1402 dev_err(sensor->dev, in ov8865_chip_id_check()
1412 static int ov8865_charge_pump_configure(struct ov8865_sensor *sensor) in ov8865_charge_pump_configure() argument
1414 return ov8865_write(sensor, OV8865_PUMP_CLK_DIV_REG, in ov8865_charge_pump_configure()
1418 static int ov8865_mipi_configure(struct ov8865_sensor *sensor) in ov8865_mipi_configure() argument
1421 &sensor->endpoint.bus.mipi_csi2; in ov8865_mipi_configure()
1425 ret = ov8865_write(sensor, OV8865_MIPI_SC_CTRL0_REG, in ov8865_mipi_configure()
1432 ret = ov8865_write(sensor, OV8865_MIPI_SC_CTRL2_REG, in ov8865_mipi_configure()
1438 ret = ov8865_write(sensor, OV8865_MIPI_LANE_SEL01_REG, in ov8865_mipi_configure()
1446 ret = ov8865_write(sensor, OV8865_MIPI_LANE_SEL23_REG, in ov8865_mipi_configure()
1453 ret = ov8865_update_bits(sensor, OV8865_CLK_SEL1_REG, in ov8865_mipi_configure()
1464 return ov8865_write(sensor, OV8865_MIPI_PCLK_PERIOD_REG, 0x16); in ov8865_mipi_configure()
1467 static int ov8865_black_level_configure(struct ov8865_sensor *sensor) in ov8865_black_level_configure() argument
1472 ret = ov8865_write(sensor, OV8865_BLC_CTRL0_REG, in ov8865_black_level_configure()
1482 ret = ov8865_write(sensor, OV8865_BLC_CTRLD_REG, in ov8865_black_level_configure()
1487 ret = ov8865_write(sensor, OV8865_BLC_CTRL1F_REG, 0); in ov8865_black_level_configure()
1492 return ov8865_write(sensor, OV8865_BLC_OFFSET_LIMIT_REG, in ov8865_black_level_configure()
1496 static int ov8865_isp_configure(struct ov8865_sensor *sensor) in ov8865_isp_configure() argument
1501 ret = ov8865_write(sensor, OV8865_ISP_CTRL0_REG, in ov8865_isp_configure()
1508 return ov8865_write(sensor, OV8865_ISP_CTRL1_REG, in ov8865_isp_configure()
1512 static unsigned long ov8865_mode_pll1_rate(struct ov8865_sensor *sensor, in ov8865_mode_pll1_rate() argument
1519 extclk_rate = clk_get_rate(sensor->extclk); in ov8865_mode_pll1_rate()
1550 static int ov8865_mode_pll1_configure(struct ov8865_sensor *sensor, in ov8865_mode_pll1_configure() argument
1566 ret = ov8865_write(sensor, OV8865_MIPI_BIT_SEL_REG, value); in ov8865_mode_pll1_configure()
1570 ret = ov8865_write(sensor, OV8865_PLL_CTRLA_REG, in ov8865_mode_pll1_configure()
1575 ret = ov8865_write(sensor, OV8865_PLL_CTRL0_REG, in ov8865_mode_pll1_configure()
1580 ret = ov8865_write(sensor, OV8865_PLL_CTRL1_REG, in ov8865_mode_pll1_configure()
1585 ret = ov8865_write(sensor, OV8865_PLL_CTRL2_REG, in ov8865_mode_pll1_configure()
1590 ret = ov8865_write(sensor, OV8865_PLL_CTRL3_REG, in ov8865_mode_pll1_configure()
1595 ret = ov8865_write(sensor, OV8865_PLL_CTRL4_REG, in ov8865_mode_pll1_configure()
1600 ret = ov8865_update_bits(sensor, OV8865_PCLK_SEL_REG, in ov8865_mode_pll1_configure()
1606 ret = ov8865_write(sensor, OV8865_PLL_CTRL5_REG, in ov8865_mode_pll1_configure()
1611 ret = ov8865_write(sensor, OV8865_PLL_CTRL6_REG, in ov8865_mode_pll1_configure()
1616 return ov8865_update_bits(sensor, OV8865_PLL_CTRL1E_REG, in ov8865_mode_pll1_configure()
1621 static int ov8865_mode_pll2_configure(struct ov8865_sensor *sensor, in ov8865_mode_pll2_configure() argument
1627 ret = ov8865_write(sensor, OV8865_PLL_CTRL12_REG, in ov8865_mode_pll2_configure()
1633 ret = ov8865_write(sensor, OV8865_PLL_CTRLB_REG, in ov8865_mode_pll2_configure()
1638 ret = ov8865_write(sensor, OV8865_PLL_CTRLC_REG, in ov8865_mode_pll2_configure()
1643 ret = ov8865_write(sensor, OV8865_PLL_CTRLD_REG, in ov8865_mode_pll2_configure()
1648 ret = ov8865_write(sensor, OV8865_PLL_CTRLF_REG, in ov8865_mode_pll2_configure()
1653 return ov8865_write(sensor, OV8865_PLL_CTRLE_REG, in ov8865_mode_pll2_configure()
1657 static int ov8865_mode_sclk_configure(struct ov8865_sensor *sensor, in ov8865_mode_sclk_configure() argument
1663 ret = ov8865_write(sensor, OV8865_CLK_SEL0_REG, in ov8865_mode_sclk_configure()
1668 ret = ov8865_update_bits(sensor, OV8865_CLK_SEL1_REG, in ov8865_mode_sclk_configure()
1674 return ov8865_write(sensor, OV8865_SCLK_CTRL_REG, in ov8865_mode_sclk_configure()
1680 static int ov8865_mode_binning_configure(struct ov8865_sensor *sensor, in ov8865_mode_binning_configure() argument
1687 ret = ov8865_write(sensor, OV8865_FORMAT1_REG, 0); in ov8865_mode_binning_configure()
1705 ret = ov8865_write(sensor, OV8865_FORMAT2_REG, value); in ov8865_mode_binning_configure()
1709 ret = ov8865_update_bits(sensor, OV8865_ISP_CTRL2_REG, in ov8865_mode_binning_configure()
1725 ret = ov8865_write(sensor, OV8865_VAP_CTRL1_REG, in ov8865_mode_binning_configure()
1731 ret = ov8865_write(sensor, OV8865_INC_X_ODD_REG, in ov8865_mode_binning_configure()
1736 ret = ov8865_write(sensor, OV8865_INC_X_EVEN_REG, in ov8865_mode_binning_configure()
1741 ret = ov8865_write(sensor, OV8865_INC_Y_ODD_REG, in ov8865_mode_binning_configure()
1746 return ov8865_write(sensor, OV8865_INC_Y_EVEN_REG, in ov8865_mode_binning_configure()
1750 static int ov8865_mode_black_level_configure(struct ov8865_sensor *sensor, in ov8865_mode_black_level_configure() argument
1756 ret = ov8865_write(sensor, OV8865_BLC_CTRL1_REG, in ov8865_mode_black_level_configure()
1764 ret = ov8865_write(sensor, OV8865_BLC_TOP_ZLINE_START_REG, in ov8865_mode_black_level_configure()
1769 ret = ov8865_write(sensor, OV8865_BLC_TOP_ZLINE_NUM_REG, in ov8865_mode_black_level_configure()
1776 ret = ov8865_write(sensor, OV8865_BLC_TOP_BLKLINE_START_REG, in ov8865_mode_black_level_configure()
1781 ret = ov8865_write(sensor, OV8865_BLC_TOP_BLKLINE_NUM_REG, in ov8865_mode_black_level_configure()
1788 ret = ov8865_write(sensor, OV8865_BLC_BOT_ZLINE_START_REG, in ov8865_mode_black_level_configure()
1793 ret = ov8865_write(sensor, OV8865_BLC_BOT_ZLINE_NUM_REG, in ov8865_mode_black_level_configure()
1800 ret = ov8865_write(sensor, OV8865_BLC_BOT_BLKLINE_START_REG, in ov8865_mode_black_level_configure()
1805 ret = ov8865_write(sensor, OV8865_BLC_BOT_BLKLINE_NUM_REG, in ov8865_mode_black_level_configure()
1812 ret = ov8865_write(sensor, OV8865_BLC_ANCHOR_LEFT_START_H_REG, in ov8865_mode_black_level_configure()
1817 ret = ov8865_write(sensor, OV8865_BLC_ANCHOR_LEFT_START_L_REG, in ov8865_mode_black_level_configure()
1822 ret = ov8865_write(sensor, OV8865_BLC_ANCHOR_LEFT_END_H_REG, in ov8865_mode_black_level_configure()
1827 ret = ov8865_write(sensor, OV8865_BLC_ANCHOR_LEFT_END_L_REG, in ov8865_mode_black_level_configure()
1832 ret = ov8865_write(sensor, OV8865_BLC_ANCHOR_RIGHT_START_H_REG, in ov8865_mode_black_level_configure()
1837 ret = ov8865_write(sensor, OV8865_BLC_ANCHOR_RIGHT_START_L_REG, in ov8865_mode_black_level_configure()
1842 ret = ov8865_write(sensor, OV8865_BLC_ANCHOR_RIGHT_END_H_REG, in ov8865_mode_black_level_configure()
1847 return ov8865_write(sensor, OV8865_BLC_ANCHOR_RIGHT_END_L_REG, in ov8865_mode_black_level_configure()
1851 static int ov8865_mode_configure(struct ov8865_sensor *sensor, in ov8865_mode_configure() argument
1858 ret = ov8865_write(sensor, OV8865_OUTPUT_SIZE_X_H_REG, in ov8865_mode_configure()
1863 ret = ov8865_write(sensor, OV8865_OUTPUT_SIZE_X_L_REG, in ov8865_mode_configure()
1870 ret = ov8865_write(sensor, OV8865_HTS_H_REG, OV8865_HTS_H(mode->hts)); in ov8865_mode_configure()
1874 ret = ov8865_write(sensor, OV8865_HTS_L_REG, OV8865_HTS_L(mode->hts)); in ov8865_mode_configure()
1880 ret = ov8865_write(sensor, OV8865_OUTPUT_SIZE_Y_H_REG, in ov8865_mode_configure()
1885 ret = ov8865_write(sensor, OV8865_OUTPUT_SIZE_Y_L_REG, in ov8865_mode_configure()
1892 ret = ov8865_write(sensor, OV8865_VTS_H_REG, OV8865_VTS_H(mode->vts)); in ov8865_mode_configure()
1896 ret = ov8865_write(sensor, OV8865_VTS_L_REG, OV8865_VTS_L(mode->vts)); in ov8865_mode_configure()
1903 ret = ov8865_write(sensor, OV8865_AUTO_SIZE_CTRL_REG, in ov8865_mode_configure()
1913 ret = ov8865_write(sensor, OV8865_AUTO_SIZE_BOUNDARIES_REG, in ov8865_mode_configure()
1921 ret = ov8865_write(sensor, OV8865_CROP_START_X_H_REG, in ov8865_mode_configure()
1926 ret = ov8865_write(sensor, OV8865_CROP_START_X_L_REG, in ov8865_mode_configure()
1933 ret = ov8865_write(sensor, OV8865_OFFSET_X_H_REG, in ov8865_mode_configure()
1938 ret = ov8865_write(sensor, OV8865_OFFSET_X_L_REG, in ov8865_mode_configure()
1945 ret = ov8865_write(sensor, OV8865_CROP_END_X_H_REG, in ov8865_mode_configure()
1950 ret = ov8865_write(sensor, OV8865_CROP_END_X_L_REG, in ov8865_mode_configure()
1957 ret = ov8865_write(sensor, OV8865_CROP_START_Y_H_REG, in ov8865_mode_configure()
1962 ret = ov8865_write(sensor, OV8865_CROP_START_Y_L_REG, in ov8865_mode_configure()
1969 ret = ov8865_write(sensor, OV8865_OFFSET_Y_H_REG, in ov8865_mode_configure()
1974 ret = ov8865_write(sensor, OV8865_OFFSET_Y_L_REG, in ov8865_mode_configure()
1981 ret = ov8865_write(sensor, OV8865_CROP_END_Y_H_REG, in ov8865_mode_configure()
1986 ret = ov8865_write(sensor, OV8865_CROP_END_Y_L_REG, in ov8865_mode_configure()
1994 ret = ov8865_write(sensor, OV8865_VFIFO_READ_START_H_REG, in ov8865_mode_configure()
1999 ret = ov8865_write(sensor, OV8865_VFIFO_READ_START_L_REG, in ov8865_mode_configure()
2004 ret = ov8865_write(sensor, OV8865_ABLC_NUM_REG, in ov8865_mode_configure()
2009 ret = ov8865_write(sensor, OV8865_ZLINE_NUM_REG, in ov8865_mode_configure()
2016 ret = ov8865_mode_binning_configure(sensor, mode); in ov8865_mode_configure()
2022 ret = ov8865_mode_black_level_configure(sensor, mode); in ov8865_mode_configure()
2028 ret = ov8865_mode_pll1_configure(sensor, mode, mbus_code); in ov8865_mode_configure()
2032 ret = ov8865_mode_pll2_configure(sensor, mode); in ov8865_mode_configure()
2036 ret = ov8865_mode_sclk_configure(sensor, mode); in ov8865_mode_configure()
2043 ret = ov8865_write_sequence(sensor, mode->register_values, in ov8865_mode_configure()
2052 static unsigned long ov8865_mode_mipi_clk_rate(struct ov8865_sensor *sensor, in ov8865_mode_mipi_clk_rate() argument
2058 pll1_rate = ov8865_mode_pll1_rate(sensor, mode); in ov8865_mode_mipi_clk_rate()
2065 static int ov8865_exposure_configure(struct ov8865_sensor *sensor, u32 exposure) in ov8865_exposure_configure() argument
2069 ret = ov8865_write(sensor, OV8865_EXPOSURE_CTRL_HH_REG, in ov8865_exposure_configure()
2074 ret = ov8865_write(sensor, OV8865_EXPOSURE_CTRL_H_REG, in ov8865_exposure_configure()
2079 return ov8865_write(sensor, OV8865_EXPOSURE_CTRL_L_REG, in ov8865_exposure_configure()
2085 static int ov8865_gain_configure(struct ov8865_sensor *sensor, u32 gain) in ov8865_gain_configure() argument
2089 ret = ov8865_write(sensor, OV8865_GAIN_CTRL_H_REG, in ov8865_gain_configure()
2094 return ov8865_write(sensor, OV8865_GAIN_CTRL_L_REG, in ov8865_gain_configure()
2100 static int ov8865_red_balance_configure(struct ov8865_sensor *sensor, in ov8865_red_balance_configure() argument
2105 ret = ov8865_write(sensor, OV8865_ISP_GAIN_RED_H_REG, in ov8865_red_balance_configure()
2110 return ov8865_write(sensor, OV8865_ISP_GAIN_RED_L_REG, in ov8865_red_balance_configure()
2114 static int ov8865_blue_balance_configure(struct ov8865_sensor *sensor, in ov8865_blue_balance_configure() argument
2119 ret = ov8865_write(sensor, OV8865_ISP_GAIN_BLUE_H_REG, in ov8865_blue_balance_configure()
2124 return ov8865_write(sensor, OV8865_ISP_GAIN_BLUE_L_REG, in ov8865_blue_balance_configure()
2130 static int ov8865_flip_vert_configure(struct ov8865_sensor *sensor, bool enable) in ov8865_flip_vert_configure() argument
2135 return ov8865_update_bits(sensor, OV8865_FORMAT1_REG, bits, in ov8865_flip_vert_configure()
2139 static int ov8865_flip_horz_configure(struct ov8865_sensor *sensor, bool enable) in ov8865_flip_horz_configure() argument
2144 return ov8865_update_bits(sensor, OV8865_FORMAT2_REG, bits, in ov8865_flip_horz_configure()
2150 static int ov8865_test_pattern_configure(struct ov8865_sensor *sensor, in ov8865_test_pattern_configure() argument
2156 return ov8865_write(sensor, OV8865_PRE_CTRL0_REG, in ov8865_test_pattern_configure()
2162 static int ov8865_state_mipi_configure(struct ov8865_sensor *sensor, in ov8865_state_mipi_configure() argument
2166 struct ov8865_ctrls *ctrls = &sensor->ctrls; in ov8865_state_mipi_configure()
2168 &sensor->endpoint.bus.mipi_csi2; in ov8865_state_mipi_configure()
2175 mipi_clk_rate = ov8865_mode_mipi_clk_rate(sensor, mode); in ov8865_state_mipi_configure()
2186 for (j = 0; j < sensor->endpoint.nr_of_link_frequencies; j++) { in ov8865_state_mipi_configure()
2187 u64 freq = sensor->endpoint.link_frequencies[j]; in ov8865_state_mipi_configure()
2194 dev_err(sensor->dev, in ov8865_state_mipi_configure()
2197 } else if (j == sensor->endpoint.nr_of_link_frequencies) { in ov8865_state_mipi_configure()
2198 dev_err(sensor->dev, in ov8865_state_mipi_configure()
2221 static int ov8865_state_configure(struct ov8865_sensor *sensor, in ov8865_state_configure() argument
2227 if (sensor->state.streaming) in ov8865_state_configure()
2231 if (pm_runtime_enabled(sensor->dev) && in ov8865_state_configure()
2232 !pm_runtime_suspended(sensor->dev)) { in ov8865_state_configure()
2233 ret = ov8865_mode_configure(sensor, mode, mbus_code); in ov8865_state_configure()
2238 ret = ov8865_state_mipi_configure(sensor, mode, mbus_code); in ov8865_state_configure()
2242 sensor->state.mode = mode; in ov8865_state_configure()
2243 sensor->state.mbus_code = mbus_code; in ov8865_state_configure()
2248 static int ov8865_state_init(struct ov8865_sensor *sensor) in ov8865_state_init() argument
2250 return ov8865_state_configure(sensor, &ov8865_modes[0], in ov8865_state_init()
2254 /* Sensor Base */
2256 static int ov8865_sensor_init(struct ov8865_sensor *sensor) in ov8865_sensor_init() argument
2260 ret = ov8865_sw_reset(sensor); in ov8865_sensor_init()
2262 dev_err(sensor->dev, "failed to perform sw reset\n"); in ov8865_sensor_init()
2266 ret = ov8865_sw_standby(sensor, 1); in ov8865_sensor_init()
2268 dev_err(sensor->dev, "failed to set sensor standby\n"); in ov8865_sensor_init()
2272 ret = ov8865_chip_id_check(sensor); in ov8865_sensor_init()
2274 dev_err(sensor->dev, "failed to check sensor chip id\n"); in ov8865_sensor_init()
2278 ret = ov8865_write_sequence(sensor, ov8865_init_sequence, in ov8865_sensor_init()
2281 dev_err(sensor->dev, "failed to write init sequence\n"); in ov8865_sensor_init()
2285 ret = ov8865_charge_pump_configure(sensor); in ov8865_sensor_init()
2287 dev_err(sensor->dev, "failed to configure pad\n"); in ov8865_sensor_init()
2291 ret = ov8865_mipi_configure(sensor); in ov8865_sensor_init()
2293 dev_err(sensor->dev, "failed to configure MIPI\n"); in ov8865_sensor_init()
2297 ret = ov8865_isp_configure(sensor); in ov8865_sensor_init()
2299 dev_err(sensor->dev, "failed to configure ISP\n"); in ov8865_sensor_init()
2303 ret = ov8865_black_level_configure(sensor); in ov8865_sensor_init()
2305 dev_err(sensor->dev, "failed to configure black level\n"); in ov8865_sensor_init()
2310 ret = ov8865_state_configure(sensor, sensor->state.mode, in ov8865_sensor_init()
2311 sensor->state.mbus_code); in ov8865_sensor_init()
2313 dev_err(sensor->dev, "failed to configure state\n"); in ov8865_sensor_init()
2320 static int ov8865_sensor_power(struct ov8865_sensor *sensor, bool on) in ov8865_sensor_power() argument
2326 gpiod_set_value_cansleep(sensor->reset, 1); in ov8865_sensor_power()
2327 gpiod_set_value_cansleep(sensor->powerdown, 1); in ov8865_sensor_power()
2329 ret = regulator_enable(sensor->dovdd); in ov8865_sensor_power()
2331 dev_err(sensor->dev, in ov8865_sensor_power()
2336 ret = regulator_enable(sensor->avdd); in ov8865_sensor_power()
2338 dev_err(sensor->dev, in ov8865_sensor_power()
2343 ret = regulator_enable(sensor->dvdd); in ov8865_sensor_power()
2345 dev_err(sensor->dev, in ov8865_sensor_power()
2350 ret = clk_prepare_enable(sensor->extclk); in ov8865_sensor_power()
2352 dev_err(sensor->dev, "failed to enable EXTCLK clock\n"); in ov8865_sensor_power()
2356 gpiod_set_value_cansleep(sensor->reset, 0); in ov8865_sensor_power()
2357 gpiod_set_value_cansleep(sensor->powerdown, 0); in ov8865_sensor_power()
2363 gpiod_set_value_cansleep(sensor->powerdown, 1); in ov8865_sensor_power()
2364 gpiod_set_value_cansleep(sensor->reset, 1); in ov8865_sensor_power()
2366 clk_disable_unprepare(sensor->extclk); in ov8865_sensor_power()
2368 regulator_disable(sensor->dvdd); in ov8865_sensor_power()
2369 regulator_disable(sensor->avdd); in ov8865_sensor_power()
2370 regulator_disable(sensor->dovdd); in ov8865_sensor_power()
2381 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_s_ctrl() local
2385 /* Wait for the sensor to be on before setting controls. */ in ov8865_s_ctrl()
2386 if (pm_runtime_suspended(sensor->dev)) in ov8865_s_ctrl()
2391 ret = ov8865_exposure_configure(sensor, ctrl->val); in ov8865_s_ctrl()
2396 ret = ov8865_gain_configure(sensor, ctrl->val); in ov8865_s_ctrl()
2401 return ov8865_red_balance_configure(sensor, ctrl->val); in ov8865_s_ctrl()
2403 return ov8865_blue_balance_configure(sensor, ctrl->val); in ov8865_s_ctrl()
2405 return ov8865_flip_horz_configure(sensor, !!ctrl->val); in ov8865_s_ctrl()
2407 return ov8865_flip_vert_configure(sensor, !!ctrl->val); in ov8865_s_ctrl()
2410 return ov8865_test_pattern_configure(sensor, index); in ov8865_s_ctrl()
2422 static int ov8865_ctrls_init(struct ov8865_sensor *sensor) in ov8865_ctrls_init() argument
2424 struct ov8865_ctrls *ctrls = &sensor->ctrls; in ov8865_ctrls_init()
2432 handler->lock = &sensor->mutex; in ov8865_ctrls_init()
2481 sensor->subdev.ctrl_handler = handler; in ov8865_ctrls_init()
2495 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_s_stream() local
2496 struct ov8865_state *state = &sensor->state; in ov8865_s_stream()
2500 ret = pm_runtime_resume_and_get(sensor->dev); in ov8865_s_stream()
2505 mutex_lock(&sensor->mutex); in ov8865_s_stream()
2506 ret = ov8865_sw_standby(sensor, !enable); in ov8865_s_stream()
2507 mutex_unlock(&sensor->mutex); in ov8865_s_stream()
2515 pm_runtime_put(sensor->dev); in ov8865_s_stream()
2523 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_g_frame_interval() local
2526 mutex_lock(&sensor->mutex); in ov8865_g_frame_interval()
2528 mode = sensor->state.mode; in ov8865_g_frame_interval()
2531 mutex_unlock(&sensor->mutex); in ov8865_g_frame_interval()
2577 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_get_fmt() local
2580 mutex_lock(&sensor->mutex); in ov8865_get_fmt()
2586 ov8865_mbus_format_fill(mbus_format, sensor->state.mbus_code, in ov8865_get_fmt()
2587 sensor->state.mode); in ov8865_get_fmt()
2589 mutex_unlock(&sensor->mutex); in ov8865_get_fmt()
2598 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_set_fmt() local
2605 mutex_lock(&sensor->mutex); in ov8865_set_fmt()
2607 if (sensor->state.streaming) { in ov8865_set_fmt()
2638 else if (sensor->state.mode != mode || in ov8865_set_fmt()
2639 sensor->state.mbus_code != mbus_code) in ov8865_set_fmt()
2640 ret = ov8865_state_configure(sensor, mode, mbus_code); in ov8865_set_fmt()
2643 mutex_unlock(&sensor->mutex); in ov8865_set_fmt()
2717 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_suspend() local
2718 struct ov8865_state *state = &sensor->state; in ov8865_suspend()
2721 mutex_lock(&sensor->mutex); in ov8865_suspend()
2724 ret = ov8865_sw_standby(sensor, true); in ov8865_suspend()
2729 ret = ov8865_sensor_power(sensor, false); in ov8865_suspend()
2731 ov8865_sw_standby(sensor, false); in ov8865_suspend()
2734 mutex_unlock(&sensor->mutex); in ov8865_suspend()
2743 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_resume() local
2744 struct ov8865_state *state = &sensor->state; in ov8865_resume()
2747 mutex_lock(&sensor->mutex); in ov8865_resume()
2749 ret = ov8865_sensor_power(sensor, true); in ov8865_resume()
2753 ret = ov8865_sensor_init(sensor); in ov8865_resume()
2757 ret = __v4l2_ctrl_handler_setup(&sensor->ctrls.handler); in ov8865_resume()
2762 ret = ov8865_sw_standby(sensor, false); in ov8865_resume()
2770 ov8865_sensor_power(sensor, false); in ov8865_resume()
2773 mutex_unlock(&sensor->mutex); in ov8865_resume()
2782 struct ov8865_sensor *sensor; in ov8865_probe() local
2788 sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); in ov8865_probe()
2789 if (!sensor) in ov8865_probe()
2792 sensor->dev = dev; in ov8865_probe()
2793 sensor->i2c_client = client; in ov8865_probe()
2803 sensor->endpoint.bus_type = V4L2_MBUS_CSI2_DPHY; in ov8865_probe()
2805 ret = v4l2_fwnode_endpoint_alloc_parse(handle, &sensor->endpoint); in ov8865_probe()
2814 sensor->powerdown = devm_gpiod_get_optional(dev, "powerdown", in ov8865_probe()
2816 if (IS_ERR(sensor->powerdown)) { in ov8865_probe()
2817 ret = PTR_ERR(sensor->powerdown); in ov8865_probe()
2821 sensor->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); in ov8865_probe()
2822 if (IS_ERR(sensor->reset)) { in ov8865_probe()
2823 ret = PTR_ERR(sensor->reset); in ov8865_probe()
2830 sensor->dvdd = devm_regulator_get(dev, "dvdd"); in ov8865_probe()
2831 if (IS_ERR(sensor->dvdd)) { in ov8865_probe()
2833 ret = PTR_ERR(sensor->dvdd); in ov8865_probe()
2838 sensor->dovdd = devm_regulator_get(dev, "dovdd"); in ov8865_probe()
2839 if (IS_ERR(sensor->dovdd)) { in ov8865_probe()
2841 ret = PTR_ERR(sensor->dovdd); in ov8865_probe()
2846 sensor->avdd = devm_regulator_get(dev, "avdd"); in ov8865_probe()
2847 if (IS_ERR(sensor->avdd)) { in ov8865_probe()
2849 ret = PTR_ERR(sensor->avdd); in ov8865_probe()
2855 sensor->extclk = devm_clk_get(dev, NULL); in ov8865_probe()
2856 if (IS_ERR(sensor->extclk)) { in ov8865_probe()
2858 ret = PTR_ERR(sensor->extclk); in ov8865_probe()
2862 rate = clk_get_rate(sensor->extclk); in ov8865_probe()
2871 subdev = &sensor->subdev; in ov8865_probe()
2877 pad = &sensor->pad; in ov8865_probe()
2886 mutex_init(&sensor->mutex); in ov8865_probe()
2888 /* Sensor */ in ov8865_probe()
2890 ret = ov8865_ctrls_init(sensor); in ov8865_probe()
2894 ret = ov8865_state_init(sensor); in ov8865_probe()
2900 pm_runtime_enable(sensor->dev); in ov8865_probe()
2901 pm_runtime_set_suspended(sensor->dev); in ov8865_probe()
2912 pm_runtime_disable(sensor->dev); in ov8865_probe()
2915 v4l2_ctrl_handler_free(&sensor->ctrls.handler); in ov8865_probe()
2918 mutex_destroy(&sensor->mutex); in ov8865_probe()
2921 media_entity_cleanup(&sensor->subdev.entity); in ov8865_probe()
2924 v4l2_fwnode_endpoint_free(&sensor->endpoint); in ov8865_probe()
2932 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); in ov8865_remove() local
2935 pm_runtime_disable(sensor->dev); in ov8865_remove()
2936 v4l2_ctrl_handler_free(&sensor->ctrls.handler); in ov8865_remove()
2937 mutex_destroy(&sensor->mutex); in ov8865_remove()
2940 v4l2_fwnode_endpoint_free(&sensor->endpoint); in ov8865_remove()
2968 MODULE_DESCRIPTION("V4L2 driver for the OmniVision OV8865 image sensor");