Skip to content

Commit fa19161

Browse files
CharlesDiascarlescufi
authored andcommitted
drivers: video: ov2640: add clock rate control property
Add Clock Rate Control property to OV2640 CMOS video sensor Signed-off-by: Charles Dias <[email protected]>
1 parent 3cde0f7 commit fa19161

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

drivers/video/ov2640.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,7 @@ struct ov2640_config {
435435
#if DT_INST_NODE_HAS_PROP(0, reset_gpios)
436436
struct gpio_dt_spec reset_gpio;
437437
#endif
438+
uint8_t clock_rate_control;
438439
};
439440

440441
struct ov2640_data {
@@ -821,7 +822,7 @@ static int ov2640_set_resolution(const struct device *dev,
821822

822823
/* Set CLKRC */
823824
ret |= ov2640_write_reg(&cfg->i2c, BANK_SEL, BANK_SEL_SENSOR);
824-
ret |= ov2640_write_reg(&cfg->i2c, CLKRC, 0x87);
825+
ret |= ov2640_write_reg(&cfg->i2c, CLKRC, cfg->clock_rate_control);
825826

826827
/* Write DSP input registers */
827828
ov2640_write_all(dev, uxga_regs, ARRAY_SIZE(uxga_regs));
@@ -1030,6 +1031,7 @@ static const struct ov2640_config ov2640_cfg_0 = {
10301031
#if DT_INST_NODE_HAS_PROP(0, reset_gpios)
10311032
.reset_gpio = GPIO_DT_SPEC_INST_GET(0, reset_gpios),
10321033
#endif
1034+
.clock_rate_control = DT_INST_PROP(0, clock_rate_control),
10331035
};
10341036
static struct ov2640_data ov2640_data_0;
10351037

dts/bindings/video/ovti,ov2640.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,18 @@ properties:
1212
The RESETn pin is asserted to disable the sensor causing a hard
1313
reset. The sensor receives this as an active-low signal.
1414
15+
clock-rate-control:
16+
type: int
17+
default: 0x87
18+
description: |
19+
Define the value to the Clock Rate Control register. By changing
20+
the system clock divide ratio and PLL, the frame rate and pixel
21+
rate will change together.
22+
Bit[7] Internal frequency doublers ON/OFF selection.
23+
0: ON 1: OFF
24+
Bit[6] Reserved
25+
Bit[5:0] Clock divider.
26+
27+
CLK = XVCLK /(decimal value of CLKRC[5:0] + 1)
28+
1529
include: i2c-device.yaml

0 commit comments

Comments
 (0)