Skip to content

drivers: video: ov7725: add sensor driver for ov7725 #30744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 6, 2021

Conversation

lgl88911
Copy link
Collaborator

This patch adds the driver for Omnivision OV7725
Color CMOS VGA Sensor.

The driver currently provides a simple capture
function, the output format only provides
RGB565,640x480.

Signed-off-by: Frank Li lgl88911@163.com

@loicpoulain
Copy link
Collaborator

loicpoulain commented Dec 15, 2020

@lgl88911, It looks interesting, but could you please split it in several commits, at least one for the dts changes, one for the new ov driver and one for the sample.

@lgl88911
Copy link
Collaborator Author

lgl88911 commented Dec 16, 2020

@lgl88911, It looks interesting, but could you please split it in several commits, at least one for the dts changes, one for the new ov driver and one for the sample.
Thanks for review, the PR will be close and I divided this commit into three:

  1. OV7725 driver drivers: video: ov7725: add sensor driver for ov7725 #30787
    In order to avoid CI fail, After drivers: video: ov7725: add sensor driver for ov7725 #30787 be merged, the following two branches will make a pull request.
  2. mm_swiftio support OV7725, https://github.com/lgl88911/zephyr/tree/mm_swiftio_ov7725
  3. sample,https://github.com/lgl88911/zephyr/tree/add_ov7725_sample

@lgl88911 lgl88911 closed this Dec 16, 2020
@loicpoulain
Copy link
Collaborator

loicpoulain commented Dec 16, 2020

@lgl88911, It looks interesting, but could you please split it in several commits, at least one for the dts changes, one for the new ov driver and one for the sample.
Thanks for review, the PR will be close and I divided this commit into three:

1. OV7725 driver #30787
   In order to avoid CI fail, After #30787 be merged, the following two branches will make a pull request.

2. mm_swiftio support OV7725, https://github.com/lgl88911/zephyr/tree/mm_swiftio_ov7725

3. sample,https://github.com/lgl88911/zephyr/tree/add_ov7725_sample

No, keep one branch and one PR/MR, don't need to close this one, I just wanted you split your changes in multiple git commits not in multiple branches.

@lgl88911 lgl88911 reopened this Dec 17, 2020
@lgl88911
Copy link
Collaborator Author

lgl88911 commented Dec 17, 2020

@loicpoulain Thanks for your explain, I split it to three commits, Please help review again

Copy link
Collaborator

@loicpoulain loicpoulain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, it looks good, just few comments to address.

@loicpoulain loicpoulain self-requested a review December 17, 2020 14:44
Copy link
Member

@MaureenHelm MaureenHelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lgl88911 !

msgs[1].len = 1;
msgs[1].flags = I2C_MSG_WRITE | I2C_MSG_STOP;

return i2c_transfer(drv_data->i2c, msgs, 2, drv_data->i2c_addr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you can't use i2c_reg_write_byte() instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although i2c_reg_write_byte can achieve the same purpose, I hope it is the similar as ov7725_read_reg.

msgs[1].len = 1;
msgs[1].flags = I2C_MSG_READ | I2C_MSG_STOP | I2C_MSG_RESTART;

return i2c_transfer(drv_data->i2c, msgs, 2, drv_data->i2c_addr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace with i2c_reg_read_byte()

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OV7725 uses SCCB to communicate. SCCB is similar to I2C, but not exactly the same. When SCCB reads the register, an I2C stop bit is required after the register address of OV7725 is written, and then the read operation can be performed. i2c_reg_read_byte call i2c_write_read, Its implementation lacks a stop bit

{
	struct i2c_msg msg[2];

	msg[0].buf = (uint8_t *)write_buf;
	msg[0].len = num_write;
	msg[0].flags = I2C_MSG_WRITE;

	msg[1].buf = (uint8_t *)read_buf;
	msg[1].len = num_read;
	msg[1].flags = I2C_MSG_RESTART | I2C_MSG_READ | I2C_MSG_STOP;

	return i2c_transfer(dev, msg, 2, addr);
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to add the SCCB explanation as an inline comment.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for suggest, Added it.

This patch adds the driver for Omnivision OV7725
Color CMOS VGA Sensor.

The driver currently provides a simple capture
function, the output format only provides
RGB565,640x480.

Signed-off-by: Frank Li <lgl88911@163.com>
Move the unrelated whitespace and
Modify line break alignment.

Signed-off-by: Frank Li <lgl88911@163.com>
Add camera support, use OV7725 CMOS sensor.

Signed-off-by: Frank Li <lgl88911@163.com>
Add the ov7725 senser example,
which can run normally on mm_swiftio.

Signed-off-by: Frank Li <lgl88911@163.com>
@lgl88911 lgl88911 requested a review from loicpoulain December 22, 2020 15:16
@lgl88911
Copy link
Collaborator Author

lgl88911 commented Jan 6, 2021

@MaureenHelm Can you help review again,Thanks

@MaureenHelm MaureenHelm merged commit d7c2f8a into zephyrproject-rtos:master Jan 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants