Skip to content

Commit 4e0dd9b

Browse files
committed
drivers: video: gc2145: Fix output format.
- Fix analog mode register address. - Fix output format register update. Signed-off-by: Ibrahim Abdalkader <[email protected]>
1 parent 5db74f2 commit 4e0dd9b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

drivers/video/gc2145.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ static const struct gc2145_reg default_regs[] = {
8080
{0x9a, 0x0E}, /* Subsample mode */
8181

8282
{0x12, 0x2e},
83-
{GC2145_REG_OUTPUT_FMT, 0x14}, /* Analog Mode 1 (vflip/mirror[1:0]) */
84-
{0x18, 0x22}, /* Analog Mode 2 */
83+
{0x17, 0x14}, /* Analog Mode 1 (vflip/mirror[1:0]) */
84+
{0x18, 0x22}, /* Analog Mode 2 */
8585
{0x19, 0x0e},
8686
{0x1a, 0x01},
8787
{0x1b, 0x4b},
@@ -891,6 +891,7 @@ static int gc2145_set_window(const struct device *dev, uint16_t reg, uint16_t x,
891891
static int gc2145_set_output_format(const struct device *dev, int output_format)
892892
{
893893
int ret;
894+
uint8_t old_value;
894895
const struct gc2145_config *cfg = dev->config;
895896

896897
ret = gc2145_write_reg(&cfg->i2c, GC2145_REG_RESET, GC2145_SET_P0_REGS);
@@ -908,7 +909,13 @@ static int gc2145_set_output_format(const struct device *dev, int output_format)
908909
return -ENOTSUP;
909910
}
910911

911-
ret = gc2145_write_reg(&cfg->i2c, GC2145_REG_OUTPUT_FMT, output_format);
912+
ret = gc2145_read_reg(&cfg->i2c, GC2145_REG_OUTPUT_FMT, &old_value);
913+
if (ret < 0) {
914+
return ret;
915+
}
916+
917+
ret = gc2145_write_reg(&cfg->i2c, GC2145_REG_OUTPUT_FMT,
918+
(old_value & 0xE0) | output_format);
912919
if (ret < 0) {
913920
return ret;
914921
}

0 commit comments

Comments
 (0)