Skip to content

Commit 44dd1a1

Browse files
author
Nikolai-L
committed
Remove warnings to debug, 100ms delay on stop
Oneshot only when calib Signed-off-by: ejgoldik <ehud.joseph.goldik@realsenseai.com>
1 parent 361e985 commit 44dd1a1

2 files changed

Lines changed: 39 additions & 49 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/kernel_mod
44
/sources_*
55
/.claude/skills/v4l2-test/v4l2-test_results
6+
**__pycache__

kernel/realsense/d4xx.c

Lines changed: 38 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,9 +1677,9 @@ static int ds5_setup_pipeline(struct ds5 *state, u8 data_type1, u8 data_type2,
16771677
int pipe_id, u32 vc_id)
16781678
{
16791679
int ret = 0;
1680-
dev_warn(&state->client->dev,
1681-
"set pipe %d, data_type1: 0x%x, data_type2: 0x%x, vc_id: %u\n",
1682-
pipe_id, data_type1, data_type2, vc_id);
1680+
dev_dbg(&state->client->dev,
1681+
"set pipe %d, data_type1: 0x%x, data_type2: 0x%x, vc_id: %u\n",
1682+
pipe_id, data_type1, data_type2, vc_id);
16831683
ret |= max9295_set_pipe(state->ser_dev, pipe_id,
16841684
data_type1, data_type2, vc_id);
16851685
ret |= state->dser_ops->set_pipe(state->dser_dev, pipe_id,
@@ -1760,9 +1760,9 @@ static int ds5_configure(struct ds5 *state)
17601760

17611761
vc_id = state->g_ctx.dst_vc;
17621762
if (PIPE_NOT_CONFIGURED == sensor->pipe_id ||
1763-
sensor->pipe_data_type1 != data_type1 ||
1764-
sensor->pipe_data_type2 != data_type2 ||
1765-
sensor->pipe_vc_id != vc_id) {
1763+
sensor->pipe_data_type1 != data_type1 ||
1764+
sensor->pipe_data_type2 != data_type2 ||
1765+
sensor->pipe_vc_id != vc_id) {
17661766
/* Release old pipe only if it changed and was valid */
17671767
if (sensor->pipe_id >= 0) {
17681768
mutex_lock(&serdes_lock__);
@@ -1783,8 +1783,7 @@ static int ds5_configure(struct ds5 *state)
17831783
mutex_unlock(&serdes_lock__);
17841784
if (sensor->pipe_id < 0) {
17851785
dev_err(&state->client->dev, "No free pipe in %s\n",state->dser_ops->name);
1786-
ret = -(ENOSR);
1787-
return ret;
1786+
return -ENOSR;
17881787
}
17891788
ret = ds5_setup_pipeline(state, data_type1, data_type2,
17901789
sensor->pipe_id, vc_id);
@@ -1793,14 +1792,14 @@ static int ds5_configure(struct ds5 *state)
17931792
state->dser_ops->reset_oneshot(state->dser_dev);
17941793
if (ret < 0)
17951794
return ret;
1796-
dev_warn(&state->client->dev,
1795+
dev_dbg(&state->client->dev,
17971796
"pipe %d new (dt1=0x%x dt2=0x%x vc=%u)\n",
17981797
sensor->pipe_id, data_type1, data_type2, vc_id);
17991798
sensor->pipe_data_type1 = data_type1;
18001799
sensor->pipe_data_type2 = data_type2;
18011800
sensor->pipe_vc_id = vc_id;
18021801
} else {
1803-
dev_warn(&state->client->dev,
1802+
dev_dbg(&state->client->dev,
18041803
"pipe %d already configured (dt1=0x%x dt2=0x%x vc=%u)\n",
18051804
sensor->pipe_id, data_type1, data_type2, vc_id);
18061805
}
@@ -4496,13 +4495,23 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on)
44964495
vc_id = state->g_ctx.dst_vc;
44974496
#endif
44984497
#endif
4499-
dev_warn(&state->client->dev, "s_stream for stream %s, vc:%d, SENSOR=%s on = %d\n",
4498+
dev_dbg(&state->client->dev, "s_stream for stream %s, vc:%d, SENSOR=%s on = %d\n",
45004499
sensor->sd.name, vc_id, ds5_get_sensor_name(state), on);
45014500

4501+
if (on) {
4502+
stream_cmd = (DS5_STREAM_START | stream_id);
4503+
expected_streaming_state = DS5_STREAM_STREAMING;
4504+
status = 0;
4505+
} else {
4506+
stream_cmd = (DS5_STREAM_STOP | stream_id);
4507+
expected_streaming_state = DS5_STREAM_IDLE;
4508+
status = DS5_STATUS_STREAMING;
4509+
}
4510+
45024511
/* Verify stream is in the expected state before issuing command */
45034512
ts = jiffies;
4504-
for (timeout = ts + msecs_to_jiffies(DS5_START_MAX_TIME);
4505-
time_before(jiffies, timeout); msleep_range(i*DS5_START_POLL_TIME))
4513+
for (timeout = ts + msecs_to_jiffies(DS5_START_MAX_TIME), i = 0;
4514+
time_before(jiffies, timeout); i++, msleep_range(i*DS5_START_POLL_TIME))
45064515
{
45074516
ret = ds5_read(state, config_status_base, &status);
45084517
if ((ret >= 0) && (on == !(status & DS5_STATUS_STREAMING))) {
@@ -4511,7 +4520,7 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on)
45114520
}
45124521
if (on == !(status & DS5_STATUS_STREAMING))
45134522
{
4514-
dev_warn(&state->client->dev,
4523+
dev_dbg(&state->client->dev,
45154524
"stream %d in expected state, toggling to %d (status: 0x%04x) %dms\n",
45164525
stream_id, on, status, jiffies_to_msecs(jiffies - ts));
45174526
} else {
@@ -4523,27 +4532,20 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on)
45234532

45244533
restore_val = sensor->streaming;
45254534
sensor->streaming = on;
4526-
if (on) {
4527-
stream_cmd = (DS5_STREAM_START | stream_id);
4528-
expected_streaming_state = DS5_STREAM_STREAMING;
4529-
} else {
4530-
stream_cmd = (DS5_STREAM_STOP | stream_id);
4531-
expected_streaming_state = DS5_STREAM_IDLE;
4532-
}
4533-
streaming = ~expected_streaming_state; /* force initial toggle */
45344535

45354536
/*
45364537
* Execute command, poll state (retry if necessary) and poll completion.
45374538
* For start, also confirm config status is valid and not rejected by FW, otherwise retry.
45384539
*/
45394540
ts = jiffies;
4541+
streaming = ~expected_streaming_state; /* force initial toggle */
45404542
for (timeout = ts + msecs_to_jiffies(DS5_START_MAX_TIME), i = 0;
45414543
time_before(jiffies, timeout); i++, msleep_range(i*DS5_START_POLL_TIME))
45424544
{
45434545
if (!ds5_config_done) {
45444546
ret = ds5_configure(state);
45454547
if (ret < 0) {
4546-
dev_err(&state->client->dev, "stream %d config failed on retry %d\n",
4548+
dev_warn(&state->client->dev, "stream %d config failed, retry %d\n",
45474549
stream_id, i);
45484550
continue;
45494551
}
@@ -4553,7 +4555,7 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on)
45534555
if (streaming != expected_streaming_state) {
45544556
ret = ds5_write(state, DS5_START_STOP_STREAM, stream_cmd);
45554557
if (ret < 0) {
4556-
dev_err(&state->client->dev, "stream %d cmd 0x%x write failed on retry %d\n",
4558+
dev_warn(&state->client->dev, "stream %d cmd 0x%x write failed, retry %d\n",
45574559
stream_id, stream_cmd, i);
45584560
continue;
45594561
}
@@ -4576,7 +4578,7 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on)
45764578
DS5_STATUS_INVALID_RES |
45774579
DS5_STATUS_INVALID_FPS)))
45784580
{
4579-
dev_err(&state->client->dev,
4581+
dev_warn(&state->client->dev,
45804582
"stream %d config rejected, status 0x%04x, retry %u\n", stream_id, status, i);
45814583
ds5_config_done = false;
45824584
ds5_config_cache_clear(sensor);
@@ -4585,7 +4587,7 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on)
45854587

45864588
if (!on == !(status & DS5_STATUS_STREAMING))
45874589
{
4588-
dev_warn(&state->client->dev,
4590+
dev_dbg(&state->client->dev,
45894591
"stream %d toggle ok to %d in %dms, retries %d\n",
45904592
stream_id, on, jiffies_to_msecs(jiffies - ts), i);
45914593
break;
@@ -4615,31 +4617,18 @@ static int ds5_mux_s_stream(struct v4l2_subdev *sd, int on)
46154617
}
46164618
else if (!on)
46174619
{
4618-
#ifdef CONFIG_VIDEO_D4XX_SERDES
46194620
mutex_lock(&serdes_lock__);
4620-
// reset data path when Y12I streaming is done
4621+
if (state->dser_ops->release_pipe(state->dser_dev, sensor->pipe_id) < 0)
4622+
dev_warn(&state->client->dev, "release pipe failed\n");
4623+
else
4624+
sensor->pipe_id = PIPE_NOT_CONFIGURED;
46214625
if (state->is_y8 &&
46224626
state->ir.sensor.config.format->data_type ==
46234627
GMSL_CSI_DT_RGB_888) {
46244628
state->dser_ops->reset_oneshot(state->dser_dev);
46254629
}
4626-
#ifndef CONFIG_TEGRA_CAMERA_PLATFORM
4627-
// reset for IPU6
4628-
streaming = 0;
4629-
for (i = 0; i < ARRAY_SIZE(d4xx_set_sub_stream); i++) {
4630-
if (d4xx_set_sub_stream[i]) {
4631-
streaming = 1;
4632-
break;
4633-
}
4634-
}
4635-
if (!streaming) {
4636-
dev_warn(&state->client->dev, "deserializer reset oneshot\n");
4637-
state->dser_ops->reset_oneshot(state->dser_dev);
4638-
}
4639-
#endif
46404630
mutex_unlock(&serdes_lock__);
4641-
#else
4642-
#endif
4631+
msleep_range(100);
46434632
}
46444633
return ret;
46454634
}
@@ -5413,30 +5402,30 @@ static void ds5_adjust_sync_mode_control(struct i2c_client *client, struct ds5 *
54135402
switch (dev_type) {
54145403
case DS5_DEVICE_TYPE_D41X:
54155404
/* D41X does not support sync mode */
5416-
dev_info(&client->dev, "%s(): D41X does not support sync mode\n", __func__);
5405+
dev_dbg(&client->dev, "%s(): D41X does not support sync mode\n", __func__);
54175406
__v4l2_ctrl_modify_range(state->ctrls.sync_mode, 0, 0, 0, 0);
54185407
break;
54195408
case DS5_DEVICE_TYPE_D40X:
54205409
/* D401 only supports modes 0 (Default) and 2 (Slave) */
54215410
__v4l2_ctrl_modify_range(state->ctrls.sync_mode, 0, 2, 0, 0);
54225411
state->ctrls.sync_mode->qmenu = sync_mode_menu_d401;
5423-
dev_info(&client->dev, "%s(): D401 sync mode: 0 (Default), 2 (Slave)\n", __func__);
5412+
dev_dbg(&client->dev, "%s(): D401 sync mode: 0 (Default), 2 (Slave)\n", __func__);
54245413
break;
54255414
case DS5_DEVICE_TYPE_D43X:
54265415
/* D430 GMSL supports all 6 sync modes (0-5) */
54275416
__v4l2_ctrl_modify_range(state->ctrls.sync_mode, 0, 5, 0, 0);
54285417
state->ctrls.sync_mode->qmenu = sync_mode_menu_full;
5429-
dev_info(&client->dev, "%s(): D430 GMSL sync mode: all modes 0-5 supported\n", __func__);
5418+
dev_dbg(&client->dev, "%s(): D430 GMSL sync mode: all modes 0-5 supported\n", __func__);
54305419
break;
54315420
case DS5_DEVICE_TYPE_D45X:
54325421
/* D450 supports all 6 sync modes (0-5) */
54335422
__v4l2_ctrl_modify_range(state->ctrls.sync_mode, 0, 5, 0, 0);
54345423
state->ctrls.sync_mode->qmenu = sync_mode_menu_full;
5435-
dev_info(&client->dev, "%s(): D450 sync mode: all modes 0-5 supported\n", __func__);
5424+
dev_dbg(&client->dev, "%s(): D450 sync mode: all modes 0-5 supported\n", __func__);
54365425
break;
54375426
case DS5_DEVICE_TYPE_D46X:
54385427
/* D46X does not support sync mode */
5439-
dev_info(&client->dev, "%s(): D46X does not support sync mode\n", __func__);
5428+
dev_dbg(&client->dev, "%s(): D46X does not support sync mode\n", __func__);
54405429
__v4l2_ctrl_modify_range(state->ctrls.sync_mode, 0, 0, 0, 0);
54415430
break;
54425431
default:

0 commit comments

Comments
 (0)