-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Allow IMX477 and IMX296 to be always on, to simplify multi-camera sync #5774
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1742,26 +1742,21 @@ static int imx477_start_streaming(struct imx477 *imx477) | |
imx477_write_reg(imx477, 0x0b05, IMX477_REG_VALUE_08BIT, !!dpc_enable); | ||
imx477_write_reg(imx477, 0x0b06, IMX477_REG_VALUE_08BIT, !!dpc_enable); | ||
|
||
/* Set vsync trigger mode */ | ||
if (trigger_mode != 0) { | ||
/* trigger_mode == 1 for source, 2 for sink */ | ||
const u32 val = (trigger_mode == 1) ? 1 : 0; | ||
|
||
imx477_write_reg(imx477, IMX477_REG_MC_MODE, | ||
IMX477_REG_VALUE_08BIT, 1); | ||
imx477_write_reg(imx477, IMX477_REG_MS_SEL, | ||
IMX477_REG_VALUE_08BIT, val); | ||
imx477_write_reg(imx477, IMX477_REG_XVS_IO_CTRL, | ||
IMX477_REG_VALUE_08BIT, val); | ||
imx477_write_reg(imx477, IMX477_REG_EXTOUT_EN, | ||
IMX477_REG_VALUE_08BIT, val); | ||
} | ||
|
||
/* Apply customized values from user */ | ||
ret = __v4l2_ctrl_handler_setup(imx477->sd.ctrl_handler); | ||
if (ret) | ||
return ret; | ||
|
||
/* Set vsync trigger mode: 0=standalone, 1=source, 2=sink */ | ||
imx477_write_reg(imx477, IMX477_REG_MC_MODE, | ||
IMX477_REG_VALUE_08BIT, (trigger_mode > 0) ? 1 : 0); | ||
imx477_write_reg(imx477, IMX477_REG_MS_SEL, | ||
IMX477_REG_VALUE_08BIT, (trigger_mode <= 1) ? 1 : 0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the '<=' a typo? It doesn't fit the pattern of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is to get the correct state for trigger mode 0. We want it to match the reset state (the Software Reference Manual p137 mentions only "default" which I guess is the same thing: values 0,1,0,0 respectively. The doc doesn't explain the difference between MS_SEL and EXTOUT_EN but from the names it sounds reasonable. It might be that they are ignored when MC_MODE==0). |
||
imx477_write_reg(imx477, IMX477_REG_XVS_IO_CTRL, | ||
IMX477_REG_VALUE_08BIT, (trigger_mode == 1) ? 1 : 0); | ||
imx477_write_reg(imx477, IMX477_REG_EXTOUT_EN, | ||
IMX477_REG_VALUE_08BIT, (trigger_mode == 1) ? 1 : 0); | ||
|
||
/* set stream on register */ | ||
return imx477_write_reg(imx477, IMX477_REG_MODE_SELECT, | ||
IMX477_REG_VALUE_08BIT, IMX477_MODE_STREAMING); | ||
|
@@ -1778,6 +1773,10 @@ static void imx477_stop_streaming(struct imx477 *imx477) | |
IMX477_REG_VALUE_08BIT, IMX477_MODE_STANDBY); | ||
if (ret) | ||
dev_err(&client->dev, "%s failed to set stream\n", __func__); | ||
|
||
/* Stop driving XVS out (there is still a weak pull-up) */ | ||
imx477_write_reg(imx477, IMX477_REG_EXTOUT_EN, | ||
IMX477_REG_VALUE_08BIT, 0); | ||
} | ||
|
||
static int imx477_set_stream(struct v4l2_subdev *sd, int enable) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the
? 1 : 0
s look unnecessary, but they may be acceptableThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It (almost) matches the previous style, but can be removed.