mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
media: i2c: imx296: Add OF option for vsync sink for XTRIG
Copying our downstream patch for imx477 that allows configuration of external synchronisation signals via DT, add the same to imx296. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
b5426ae2cb
commit
c0afa3e1e2
@@ -205,6 +205,7 @@ struct imx296 {
|
|||||||
|
|
||||||
const struct imx296_clk_params *clk_params;
|
const struct imx296_clk_params *clk_params;
|
||||||
bool mono;
|
bool mono;
|
||||||
|
int trigger_mode_of;
|
||||||
|
|
||||||
struct v4l2_subdev subdev;
|
struct v4l2_subdev subdev;
|
||||||
struct media_pad pad;
|
struct media_pad pad;
|
||||||
@@ -645,16 +646,17 @@ static int imx296_setup(struct imx296 *sensor, struct v4l2_subdev_state *state)
|
|||||||
|
|
||||||
static int imx296_stream_on(struct imx296 *sensor)
|
static int imx296_stream_on(struct imx296 *sensor)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0, tm;
|
||||||
|
|
||||||
imx296_write(sensor, IMX296_CTRL00, 0, &ret);
|
imx296_write(sensor, IMX296_CTRL00, 0, &ret);
|
||||||
usleep_range(2000, 5000);
|
usleep_range(2000, 5000);
|
||||||
|
|
||||||
/* external trigger mode: 0=normal, 1=triggered */
|
/* external trigger mode: 0=normal, 1=triggered */
|
||||||
|
tm = (sensor->trigger_mode_of >= 0) ? sensor->trigger_mode_of : trigger_mode;
|
||||||
imx296_write(sensor, IMX296_CTRL0B,
|
imx296_write(sensor, IMX296_CTRL0B,
|
||||||
(trigger_mode == 1) ? IMX296_CTRL0B_TRIGEN : 0, &ret);
|
(tm == 1) ? IMX296_CTRL0B_TRIGEN : 0, &ret);
|
||||||
imx296_write(sensor, IMX296_LOWLAGTRG,
|
imx296_write(sensor, IMX296_LOWLAGTRG,
|
||||||
(trigger_mode == 1) ? IMX296_LOWLAGTRG_FAST : 0, &ret);
|
(tm == 1) ? IMX296_LOWLAGTRG_FAST : 0, &ret);
|
||||||
|
|
||||||
imx296_write(sensor, IMX296_CTRL0A, 0, &ret);
|
imx296_write(sensor, IMX296_CTRL0A, 0, &ret);
|
||||||
|
|
||||||
@@ -1078,6 +1080,7 @@ static int imx296_probe(struct i2c_client *client)
|
|||||||
unsigned long clk_rate;
|
unsigned long clk_rate;
|
||||||
struct imx296 *sensor;
|
struct imx296 *sensor;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
u32 tm_of;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
|
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
|
||||||
@@ -1144,6 +1147,10 @@ static int imx296_probe(struct i2c_client *client)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_power;
|
goto err_power;
|
||||||
|
|
||||||
|
/* Default the trigger mode from OF to -1, which means invalid */
|
||||||
|
ret = of_property_read_u32(client->dev.of_node, "trigger-mode", &tm_of);
|
||||||
|
sensor->trigger_mode_of = (ret == 0) ? tm_of : -1;
|
||||||
|
|
||||||
/* Initialize the V4L2 subdev. */
|
/* Initialize the V4L2 subdev. */
|
||||||
ret = imx296_subdev_init(sensor);
|
ret = imx296_subdev_init(sensor);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user